增减用户列表页面,修改crud部分代码,修改店铺列表页面增加三方配置弹窗
This commit is contained in:
55
src/api/account/shopMerchant.ts
Normal file
55
src/api/account/shopMerchant.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
import request from "@/utils/request";
|
||||
import { Account_BaseUrl } from "@/api/config";
|
||||
const baseURL = Account_BaseUrl + "/admin/shopMerchant";
|
||||
const API = {
|
||||
get(shopId: string | number) {
|
||||
return request({
|
||||
url: `${baseURL}`,
|
||||
method: "get",
|
||||
headers: {
|
||||
shopId: shopId
|
||||
}
|
||||
});
|
||||
},
|
||||
edit(shopId: string | number, data: shopMerchantType) {
|
||||
return request({
|
||||
url: `${baseURL}`,
|
||||
method: "put",
|
||||
data: data,
|
||||
headers: {
|
||||
shopId: shopId
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
export default API;
|
||||
/**
|
||||
* ShopMerchantEditDTO
|
||||
*/
|
||||
export interface shopMerchantType {
|
||||
/**
|
||||
* 支付宝appid
|
||||
*/
|
||||
alipaySmallAppid: null | string;
|
||||
/**
|
||||
* 商户应用id
|
||||
*/
|
||||
appId: null | string;
|
||||
/**
|
||||
* 商户秘钥
|
||||
*/
|
||||
appSecret: null | string;
|
||||
/**
|
||||
* 支付密码
|
||||
*/
|
||||
payPassword: null | string;
|
||||
/**
|
||||
* 支付系统商户id
|
||||
*/
|
||||
storeId: null | string;
|
||||
/**
|
||||
* 微信appid
|
||||
*/
|
||||
wechatSmallAppid: null | string;
|
||||
[property: string]: any;
|
||||
}
|
||||
160
src/api/account/shopUser.ts
Normal file
160
src/api/account/shopUser.ts
Normal file
@@ -0,0 +1,160 @@
|
||||
import request from "@/utils/request";
|
||||
import { Account_BaseUrl } from "@/api/config";
|
||||
const baseURL = Account_BaseUrl + "/admin/shopUser";
|
||||
const API = {
|
||||
// 获取店铺用户概述信息
|
||||
getSummary(data: getSummaryRequest) {
|
||||
return request({
|
||||
url: `${baseURL}/summary`,
|
||||
method: "get",
|
||||
params: data
|
||||
});
|
||||
},
|
||||
getList(data: getListRequest) {
|
||||
return request({
|
||||
url: `${baseURL}`,
|
||||
method: "get",
|
||||
params: data
|
||||
});
|
||||
},
|
||||
edit(shopId: string | number, data: editRequest) {
|
||||
return request({
|
||||
url: `${baseURL}`,
|
||||
method: "put",
|
||||
data: data,
|
||||
headers: {
|
||||
shopId: shopId
|
||||
}
|
||||
});
|
||||
},
|
||||
// 店铺用户余额修改
|
||||
editMoney(shopId: string | number, data: editMoneyRequest) {
|
||||
return request({
|
||||
url: `${baseURL}/money`,
|
||||
method: "put",
|
||||
data: data,
|
||||
headers: {
|
||||
shopId: shopId
|
||||
}
|
||||
});
|
||||
},
|
||||
add(shopId: string | number, data: addRequest) {
|
||||
return request({
|
||||
url: `${baseURL}`,
|
||||
method: "post",
|
||||
data: data,
|
||||
headers: {
|
||||
shopId: shopId
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
export default API;
|
||||
|
||||
export interface getSummaryRequest {
|
||||
/**
|
||||
* 0 非vip 1 vip
|
||||
*/
|
||||
isVip?: number;
|
||||
[property: string]: any;
|
||||
}
|
||||
export interface getListRequest {
|
||||
/**
|
||||
* 0 非vip 1 vip
|
||||
*/
|
||||
isVip?: number;
|
||||
/**
|
||||
* 昵称或手机号
|
||||
*/
|
||||
key?: string;
|
||||
[property: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* ShopUserEditDTO
|
||||
*/
|
||||
export interface editRequest {
|
||||
/**
|
||||
* 生日
|
||||
*/
|
||||
birthDay?: null | string;
|
||||
/**
|
||||
* 对应shopUserid
|
||||
*/
|
||||
id: number | null;
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
nickName?: null | string;
|
||||
/**
|
||||
* 性别 0女 1男
|
||||
*/
|
||||
sex?: number | null;
|
||||
[property: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* ShopUserMoneyEditDTO
|
||||
*/
|
||||
export interface editMoneyRequest {
|
||||
/**
|
||||
* 对应shopUserid
|
||||
*/
|
||||
id: number | null;
|
||||
/**
|
||||
* 浮动金额
|
||||
*/
|
||||
money: number | null;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
remark?: null | string;
|
||||
/**
|
||||
* 0减少 1增加
|
||||
*/
|
||||
type: number | null;
|
||||
[property: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* ShopUserAddDTO
|
||||
*/
|
||||
export interface addRequest {
|
||||
/**
|
||||
* 账户积分
|
||||
*/
|
||||
accountPoints?: number | null;
|
||||
/**
|
||||
* 钱包余额
|
||||
*/
|
||||
amount?: number | null;
|
||||
/**
|
||||
* 会员生日
|
||||
*/
|
||||
birthDay?: null | string;
|
||||
/**
|
||||
* 用户头像
|
||||
*/
|
||||
headImg?: null | string;
|
||||
/**
|
||||
* 是否会员,
|
||||
*/
|
||||
isVip?: number | null;
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
nickName: null | string;
|
||||
/**
|
||||
* 电话号码
|
||||
*/
|
||||
phone: null | string;
|
||||
/**
|
||||
* 0-女 1男
|
||||
*/
|
||||
sex?: number | null;
|
||||
/**
|
||||
* 用户Id
|
||||
*/
|
||||
userId: number | null;
|
||||
[property: string]: any;
|
||||
}
|
||||
@@ -8,37 +8,58 @@
|
||||
<template v-if="typeof item === 'string'">
|
||||
<!-- 新增 -->
|
||||
<template v-if="item === 'add'">
|
||||
<el-button v-hasPerm="[`${contentConfig.pageName}:${item}`]" type="success" icon="plus"
|
||||
@click="handleToolbar(item)">
|
||||
<el-button
|
||||
v-hasPerm="[`${contentConfig.pageName}:${item}`]"
|
||||
type="success"
|
||||
icon="plus"
|
||||
@click="handleToolbar(item)"
|
||||
>
|
||||
新增
|
||||
</el-button>
|
||||
</template>
|
||||
<!-- 删除 -->
|
||||
<template v-else-if="item === 'delete'">
|
||||
<el-button v-hasPerm="[`${contentConfig.pageName}:${item}`]" type="danger" icon="delete"
|
||||
:disabled="removeIds.length === 0" @click="handleToolbar(item)">
|
||||
<el-button
|
||||
v-hasPerm="[`${contentConfig.pageName}:${item}`]"
|
||||
type="danger"
|
||||
icon="delete"
|
||||
:disabled="removeIds.length === 0"
|
||||
@click="handleToolbar(item)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
<!-- 导入 -->
|
||||
<template v-else-if="item === 'import'">
|
||||
<el-button v-hasPerm="[`${contentConfig.pageName}:${item}`]" type="default" icon="upload"
|
||||
@click="handleToolbar(item)">
|
||||
<el-button
|
||||
v-hasPerm="[`${contentConfig.pageName}:${item}`]"
|
||||
type="default"
|
||||
icon="upload"
|
||||
@click="handleToolbar(item)"
|
||||
>
|
||||
导入
|
||||
</el-button>
|
||||
</template>
|
||||
<!-- 导出 -->
|
||||
<template v-else-if="item === 'export'">
|
||||
<el-button v-hasPerm="[`${contentConfig.pageName}:${item}`]" type="default" icon="download"
|
||||
@click="handleToolbar(item)">
|
||||
<el-button
|
||||
v-hasPerm="[`${contentConfig.pageName}:${item}`]"
|
||||
type="default"
|
||||
icon="download"
|
||||
@click="handleToolbar(item)"
|
||||
>
|
||||
导出
|
||||
</el-button>
|
||||
</template>
|
||||
</template>
|
||||
<!-- 其他 -->
|
||||
<template v-else-if="typeof item === 'object'">
|
||||
<el-button v-hasPerm="[`${contentConfig.pageName}:${item.auth}`]" :icon="item.icon"
|
||||
:type="item.type ?? 'default'" @click="handleToolbar(item.name)">
|
||||
<el-button
|
||||
v-hasPerm="[`${contentConfig.pageName}:${item.auth}`]"
|
||||
:icon="item.icon"
|
||||
:type="item.type ?? 'default'"
|
||||
@click="handleToolbar(item.name)"
|
||||
>
|
||||
{{ item.text }}
|
||||
</el-button>
|
||||
</template>
|
||||
@@ -67,36 +88,68 @@
|
||||
</template>
|
||||
<!-- 导出 -->
|
||||
<template v-else-if="item === 'exports'">
|
||||
<el-button v-hasPerm="[`${contentConfig.pageName}:export`]" icon="download" circle title="导出"
|
||||
@click="handleToolbar(item)" />
|
||||
<el-button
|
||||
v-hasPerm="[`${contentConfig.pageName}:export`]"
|
||||
icon="download"
|
||||
circle
|
||||
title="导出"
|
||||
@click="handleToolbar(item)"
|
||||
/>
|
||||
</template>
|
||||
<!-- 导入 -->
|
||||
<template v-else-if="item === 'imports'">
|
||||
<el-button v-hasPerm="[`${contentConfig.pageName}:import`]" icon="upload" circle title="导入"
|
||||
@click="handleToolbar(item)" />
|
||||
<el-button
|
||||
v-hasPerm="[`${contentConfig.pageName}:import`]"
|
||||
icon="upload"
|
||||
circle
|
||||
title="导入"
|
||||
@click="handleToolbar(item)"
|
||||
/>
|
||||
</template>
|
||||
<!-- 搜索 -->
|
||||
<template v-else-if="item === 'search'">
|
||||
<el-button v-hasPerm="[`${contentConfig.pageName}:query`]" icon="search" circle title="搜索"
|
||||
@click="handleToolbar(item)" />
|
||||
<el-button
|
||||
v-hasPerm="[`${contentConfig.pageName}:query`]"
|
||||
icon="search"
|
||||
circle
|
||||
title="搜索"
|
||||
@click="handleToolbar(item)"
|
||||
/>
|
||||
</template>
|
||||
</template>
|
||||
<!-- 其他 -->
|
||||
<template v-else-if="typeof item === 'object'">
|
||||
<template v-if="item.auth">
|
||||
<el-button v-hasPerm="[`${contentConfig.pageName}:${item.auth}`]" :icon="item.icon" circle
|
||||
:title="item.title" @click="handleToolbar(item.name)" />
|
||||
<el-button
|
||||
v-hasPerm="[`${contentConfig.pageName}:${item.auth}`]"
|
||||
:icon="item.icon"
|
||||
circle
|
||||
:title="item.title"
|
||||
@click="handleToolbar(item.name)"
|
||||
/>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-button :icon="item.icon" circle :title="item.title" @click="handleToolbar(item.name)" />
|
||||
<el-button
|
||||
:icon="item.icon"
|
||||
circle
|
||||
:title="item.title"
|
||||
@click="handleToolbar(item.name)"
|
||||
/>
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 列表 -->
|
||||
<el-table ref="tableRef" v-loading="loading" v-bind="contentConfig.table" :data="pageData" :row-key="pk"
|
||||
@selection-change="handleSelectionChange" @filter-change="handleFilterChange">
|
||||
<el-table
|
||||
ref="tableRef"
|
||||
v-loading="loading"
|
||||
v-bind="contentConfig.table"
|
||||
:data="pageData"
|
||||
:row-key="pk"
|
||||
@selection-change="handleSelectionChange"
|
||||
@filter-change="handleFilterChange"
|
||||
>
|
||||
<template v-for="col in cols" :key="col">
|
||||
<el-table-column v-if="col.show" v-bind="col">
|
||||
<template #default="scope">
|
||||
@@ -105,15 +158,24 @@
|
||||
<template v-if="col.prop">
|
||||
<template v-if="Array.isArray(scope.row[col.prop])">
|
||||
<template v-for="(item, index) in scope.row[col.prop]" :key="item">
|
||||
<el-image :src="item" :preview-src-list="scope.row[col.prop]" :initial-index="index"
|
||||
:preview-teleported="true" :style="`width: ${col.imageWidth ?? 40}px; height: ${col.imageHeight ?? 40
|
||||
}px`" />
|
||||
<el-image
|
||||
:src="item"
|
||||
:preview-src-list="scope.row[col.prop]"
|
||||
:initial-index="index"
|
||||
:preview-teleported="true"
|
||||
:style="`width: ${col.imageWidth ?? 40}px; height: ${
|
||||
col.imageHeight ?? 40
|
||||
}px`"
|
||||
/>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-image :src="scope.row[col.prop]" :preview-src-list="[scope.row[col.prop]]"
|
||||
<el-image
|
||||
:src="scope.row[col.prop]"
|
||||
:preview-src-list="[scope.row[col.prop]]"
|
||||
:preview-teleported="true"
|
||||
:style="`width: ${col.imageWidth ?? 40}px; height: ${col.imageHeight ?? 40}px`" />
|
||||
:style="`width: ${col.imageWidth ?? 40}px; height: ${col.imageHeight ?? 40}px`"
|
||||
/>
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
@@ -135,20 +197,30 @@
|
||||
<template v-else-if="col.templet === 'switch'">
|
||||
<template v-if="col.prop">
|
||||
<!-- pageData.length>0: 解决el-switch组件会在表格初始化的时候触发一次change事件 -->
|
||||
<el-switch v-model="scope.row[col.prop]" :active-value="col.activeValue ?? 1"
|
||||
:inactive-value="col.inactiveValue ?? 0" :inline-prompt="true" :active-text="col.activeText ?? ''"
|
||||
:inactive-text="col.inactiveText ?? ''" :validate-event="false"
|
||||
:disabled="!hasAuth(`${contentConfig.pageName}:modify`)" @change="
|
||||
<el-switch
|
||||
v-model="scope.row[col.prop]"
|
||||
:active-value="col.activeValue ?? 1"
|
||||
:inactive-value="col.inactiveValue ?? 0"
|
||||
:inline-prompt="true"
|
||||
:active-text="col.activeText ?? ''"
|
||||
:inactive-text="col.inactiveText ?? ''"
|
||||
:validate-event="false"
|
||||
:disabled="!hasAuth(`${contentConfig.pageName}:modify`)"
|
||||
@change="
|
||||
pageData.length > 0 && handleModify(col.prop, scope.row[col.prop], scope.row)
|
||||
" />
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
</template>
|
||||
<!-- 生成输入框组件 -->
|
||||
<template v-else-if="col.templet === 'input'">
|
||||
<template v-if="col.prop">
|
||||
<el-input v-model="scope.row[col.prop]" :type="col.inputType ?? 'text'"
|
||||
<el-input
|
||||
v-model="scope.row[col.prop]"
|
||||
:type="col.inputType ?? 'text'"
|
||||
:disabled="!hasAuth(`${contentConfig.pageName}:modify`)"
|
||||
@blur="handleModify(col.prop, scope.row[col.prop], scope.row)" />
|
||||
@blur="handleModify(col.prop, scope.row[col.prop], scope.row)"
|
||||
/>
|
||||
</template>
|
||||
</template>
|
||||
<!-- 格式化为价格 -->
|
||||
@@ -180,7 +252,7 @@
|
||||
{{
|
||||
scope.row[col.prop]
|
||||
? useDateFormat(scope.row[col.prop], col.dateFormat ?? "YYYY-MM-DD HH:mm:ss")
|
||||
.value
|
||||
.value
|
||||
: ""
|
||||
}}
|
||||
</template>
|
||||
@@ -191,32 +263,68 @@
|
||||
<template v-if="typeof item === 'string'">
|
||||
<!-- 编辑/删除 -->
|
||||
<template v-if="item === 'edit' || item === 'delete'">
|
||||
<el-button v-hasPerm="[`${contentConfig.pageName}:${item}`]"
|
||||
:type="item === 'edit' ? 'primary' : 'danger'" :icon="item" size="small" link @click="
|
||||
<el-button
|
||||
v-hasPerm="[`${contentConfig.pageName}:${item}`]"
|
||||
:type="item === 'edit' ? 'primary' : 'danger'"
|
||||
:icon="item"
|
||||
size="small"
|
||||
link
|
||||
@click="
|
||||
handleOperat({
|
||||
name: item,
|
||||
row: scope.row,
|
||||
column: scope.column,
|
||||
$index: scope.$index,
|
||||
})
|
||||
">
|
||||
"
|
||||
>
|
||||
{{ item === "edit" ? "编辑" : "删除" }}
|
||||
</el-button>
|
||||
</template>
|
||||
</template>
|
||||
<!-- 其他 -->
|
||||
<template v-else-if="typeof item === 'object'">
|
||||
<el-button v-if="item.render === undefined || item.render(scope.row)" v-bind="item.auth ? { 'v-hasPerm': [`${contentConfig.pageName}:${item.auth}`] } : {}
|
||||
" :icon="item.icon" :type="item.type ?? 'primary'" size="small" link @click="
|
||||
handleOperat({
|
||||
name: item.name,
|
||||
row: scope.row,
|
||||
column: scope.column,
|
||||
$index: scope.$index,
|
||||
})
|
||||
">
|
||||
{{ item.text }}
|
||||
</el-button>
|
||||
<el-dropdown>
|
||||
<el-button
|
||||
v-if="item.render === undefined || item.render(scope.row)"
|
||||
v-bind="
|
||||
item.auth ? { 'v-hasPerm': [`${contentConfig.pageName}:${item.auth}`] } : {}
|
||||
"
|
||||
:icon="item.icon"
|
||||
:type="item.type ?? 'primary'"
|
||||
size="small"
|
||||
link
|
||||
@click="
|
||||
handleOperat({
|
||||
name: item.name,
|
||||
row: scope.row,
|
||||
column: scope.column,
|
||||
$index: scope.$index,
|
||||
})
|
||||
"
|
||||
>
|
||||
{{ item.text }}
|
||||
</el-button>
|
||||
<template #dropdown v-if="item.options && item.options.length > 0">
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item
|
||||
@click="
|
||||
handleOperat({
|
||||
name: item.name,
|
||||
row: scope.row,
|
||||
column: scope.column,
|
||||
$index: scope.$index,
|
||||
command: opt.command ? opt.command : '',
|
||||
})
|
||||
"
|
||||
v-for="opt in item.options"
|
||||
:key="opt.value"
|
||||
>
|
||||
{{ opt.label }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
@@ -232,18 +340,33 @@
|
||||
<template v-if="showPagination">
|
||||
<el-scrollbar>
|
||||
<div class="mt-[12px]">
|
||||
<el-pagination v-bind="pagination" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
|
||||
<el-pagination
|
||||
v-bind="pagination"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
</template>
|
||||
<!-- 导出弹窗 -->
|
||||
<el-dialog v-model="exportsModalVisible" :align-center="true" title="导出数据" width="600px" style="padding-right: 0"
|
||||
@close="handleCloseExportsModal">
|
||||
<el-dialog
|
||||
v-model="exportsModalVisible"
|
||||
:align-center="true"
|
||||
title="导出数据"
|
||||
width="600px"
|
||||
style="padding-right: 0"
|
||||
@close="handleCloseExportsModal"
|
||||
>
|
||||
<!-- 滚动 -->
|
||||
<el-scrollbar max-height="60vh">
|
||||
<!-- 表单 -->
|
||||
<el-form ref="exportsFormRef" label-width="auto" style="padding-right: var(--el-dialog-padding-primary)"
|
||||
:model="exportsFormData" :rules="exportsFormRules">
|
||||
<el-form
|
||||
ref="exportsFormRef"
|
||||
label-width="auto"
|
||||
style="padding-right: var(--el-dialog-padding-primary)"
|
||||
:model="exportsFormData"
|
||||
:rules="exportsFormRules"
|
||||
>
|
||||
<el-form-item label="文件名" prop="filename">
|
||||
<el-input v-model="exportsFormData.filename" clearable />
|
||||
</el-form-item>
|
||||
@@ -253,10 +376,16 @@
|
||||
<el-form-item label="数据源" prop="origin">
|
||||
<el-select v-model="exportsFormData.origin">
|
||||
<el-option label="当前数据 (当前页的数据)" :value="ExportsOriginEnum.CURRENT" />
|
||||
<el-option label="选中数据 (所有选中的数据)" :value="ExportsOriginEnum.SELECTED"
|
||||
:disabled="selectionData.length <= 0" />
|
||||
<el-option label="全量数据 (所有分页的数据)" :value="ExportsOriginEnum.REMOTE"
|
||||
:disabled="contentConfig.exportsAction === undefined" />
|
||||
<el-option
|
||||
label="选中数据 (所有选中的数据)"
|
||||
:value="ExportsOriginEnum.SELECTED"
|
||||
:disabled="selectionData.length <= 0"
|
||||
/>
|
||||
<el-option
|
||||
label="全量数据 (所有分页的数据)"
|
||||
:value="ExportsOriginEnum.REMOTE"
|
||||
:disabled="contentConfig.exportsAction === undefined"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="字段" prop="fields">
|
||||
@@ -277,17 +406,35 @@
|
||||
</template>
|
||||
</el-dialog>
|
||||
<!-- 导入弹窗 -->
|
||||
<el-dialog v-model="importModalVisible" :align-center="true" title="导入数据" width="600px" style="padding-right: 0"
|
||||
@close="handleCloseImportModal">
|
||||
<el-dialog
|
||||
v-model="importModalVisible"
|
||||
:align-center="true"
|
||||
title="导入数据"
|
||||
width="600px"
|
||||
style="padding-right: 0"
|
||||
@close="handleCloseImportModal"
|
||||
>
|
||||
<!-- 滚动 -->
|
||||
<el-scrollbar max-height="60vh">
|
||||
<!-- 表单 -->
|
||||
<el-form ref="importFormRef" label-width="auto" style="padding-right: var(--el-dialog-padding-primary)"
|
||||
:model="importFormData" :rules="importFormRules">
|
||||
<el-form
|
||||
ref="importFormRef"
|
||||
label-width="auto"
|
||||
style="padding-right: var(--el-dialog-padding-primary)"
|
||||
:model="importFormData"
|
||||
:rules="importFormRules"
|
||||
>
|
||||
<el-form-item label="文件名" prop="files">
|
||||
<el-upload ref="uploadRef" v-model:file-list="importFormData.files" class="w-full"
|
||||
<el-upload
|
||||
ref="uploadRef"
|
||||
v-model:file-list="importFormData.files"
|
||||
class="w-full"
|
||||
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
|
||||
:drag="true" :limit="1" :auto-upload="false" :on-exceed="handleFileExceed">
|
||||
:drag="true"
|
||||
:limit="1"
|
||||
:auto-upload="false"
|
||||
:on-exceed="handleFileExceed"
|
||||
>
|
||||
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
||||
<div class="el-upload__text">
|
||||
<span>将文件拖到此处,或</span>
|
||||
@@ -296,8 +443,13 @@
|
||||
<template #tip>
|
||||
<div class="el-upload__tip">
|
||||
*.xlsx / *.xls
|
||||
<el-link v-if="contentConfig.importTemplate" type="primary" icon="download" :underline="false"
|
||||
@click="handleDownloadTemplate">
|
||||
<el-link
|
||||
v-if="contentConfig.importTemplate"
|
||||
type="primary"
|
||||
icon="download"
|
||||
:underline="false"
|
||||
@click="handleDownloadTemplate"
|
||||
>
|
||||
下载模板
|
||||
</el-link>
|
||||
</div>
|
||||
@@ -309,7 +461,11 @@
|
||||
<!-- 弹窗底部操作按钮 -->
|
||||
<template #footer>
|
||||
<div style="padding-right: var(--el-dialog-padding-primary)">
|
||||
<el-button type="primary" :disabled="importFormData.files.length === 0" @click="handleImportSubmit">
|
||||
<el-button
|
||||
type="primary"
|
||||
:disabled="importFormData.files.length === 0"
|
||||
@click="handleImportSubmit"
|
||||
>
|
||||
确 定
|
||||
</el-button>
|
||||
<el-button @click="handleCloseImportModal">取 消</el-button>
|
||||
@@ -780,10 +936,10 @@ function fetchPageData(formData: IObject = {}, isRestart = false) {
|
||||
.indexAction(
|
||||
showPagination
|
||||
? {
|
||||
[request.pageName]: pagination.currentPage,
|
||||
[request.limitName]: pagination.pageSize,
|
||||
...formData,
|
||||
}
|
||||
[request.pageName]: pagination.currentPage,
|
||||
[request.limitName]: pagination.pageSize,
|
||||
...formData,
|
||||
}
|
||||
: formData
|
||||
)
|
||||
.then((data) => {
|
||||
|
||||
@@ -94,7 +94,10 @@
|
||||
<template v-else-if="item.type === 'date-picker'">
|
||||
<el-date-picker v-model="formData[item.prop]" v-bind="item.attrs" />
|
||||
</template>
|
||||
|
||||
<!-- 图片上传 -->
|
||||
<template v-else-if="item.type === 'UpImage'">
|
||||
<SingleImageUpload v-model="formData[item.prop]" />
|
||||
</template>
|
||||
<!-- Text 文本 -->
|
||||
<template v-else-if="item.type === 'text'">
|
||||
<el-text v-bind="item.attrs">
|
||||
@@ -284,6 +287,7 @@ const props = defineProps<{
|
||||
// 自定义事件
|
||||
const emit = defineEmits<{
|
||||
submitClick: [];
|
||||
formDataChange: [string, any];
|
||||
}>();
|
||||
const pk = props.modalConfig.pk ?? "id";
|
||||
const modalVisible = ref(false);
|
||||
@@ -303,6 +307,7 @@ for (const item of formItems) {
|
||||
watch(
|
||||
() => formData[item.prop],
|
||||
(newValue, oldValue) => {
|
||||
emit("formDataChange", item.prop, newValue);
|
||||
item.watch && item.watch(newValue, oldValue, formData, formItems);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -24,6 +24,7 @@ export interface IOperatData {
|
||||
row: IObject;
|
||||
column: IObject;
|
||||
$index: number;
|
||||
command?: string | number;
|
||||
}
|
||||
|
||||
export interface ISearchConfig {
|
||||
@@ -185,6 +186,11 @@ export interface IContentConfig<T = any> {
|
||||
text: string;
|
||||
type?: "primary" | "success" | "warning" | "danger" | "info";
|
||||
render?: (row: IObject) => boolean;
|
||||
options?: {
|
||||
label: string;
|
||||
command: string | number,
|
||||
value?: any;
|
||||
}[];
|
||||
}
|
||||
>;
|
||||
// filter值拼接符
|
||||
|
||||
@@ -463,7 +463,7 @@ export const constantRoutes: RouteRecordRaw[] = [
|
||||
children: [
|
||||
{
|
||||
path: "index",
|
||||
component: () => import("@/views/user/index.vue"),
|
||||
component: () => import("@/views/user/list/index.vue"),
|
||||
name: "userIndex",
|
||||
meta: {
|
||||
title: "用户列表",
|
||||
|
||||
@@ -15,6 +15,7 @@ const service = axios.create({
|
||||
// 请求拦截器
|
||||
service.interceptors.request.use(
|
||||
(config: InternalAxiosRequestConfig) => {
|
||||
console.log(config);
|
||||
const accessToken = getToken();
|
||||
// 如果 Authorization 设置为 no-auth,则不携带 Token,用于登录、刷新 Token 等接口
|
||||
if (config.headers.Authorization !== "no-auth" && accessToken) {
|
||||
@@ -22,7 +23,7 @@ service.interceptors.request.use(
|
||||
} else {
|
||||
delete config.headers.token;
|
||||
}
|
||||
config.headers.shopId = useUserStoreHook().userInfo.id;
|
||||
config.headers.shopId = config.headers.shopId || useUserStoreHook().userInfo.id;
|
||||
return config;
|
||||
},
|
||||
(error) => Promise.reject(error)
|
||||
|
||||
@@ -3,13 +3,16 @@
|
||||
<el-tabs v-model="activeName">
|
||||
<el-tab-pane label="聚合支付" name="pay">
|
||||
<el-form ref="form" :model="form" label-width="120px" label-position="left">
|
||||
<el-form-item label="店铺id">
|
||||
<el-input v-model="form.storeId" placeholder="请输入店铺id"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="商户号">
|
||||
<el-input v-model="form.appId" placeholder="请输入商户号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="商户密钥">
|
||||
<el-input
|
||||
type="textarea"
|
||||
v-model="form.appToken"
|
||||
v-model="form.appSecret"
|
||||
placeholder="请输入商户密钥"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
@@ -17,7 +20,10 @@
|
||||
<el-input v-model="form.payPassword" placeholder="请输入支付密码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="微信appid">
|
||||
<el-input v-model="form.smallAppid" placeholder="请输入微信小程序appid"></el-input>
|
||||
<el-input
|
||||
v-model="form.wechatSmallAppid"
|
||||
placeholder="请输入微信小程序appid"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="支付宝appid">
|
||||
<el-input
|
||||
@@ -31,32 +37,33 @@
|
||||
<el-form-item label="支付宝商户密钥">
|
||||
<el-input v-model="form.alipayAppToken" placeholder="请输入支付宝商户密钥"></el-input>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="店铺id">
|
||||
<el-input v-model="form.storeId" placeholder="请输入店铺id"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="状态">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio :label="1">启用</el-radio>
|
||||
<el-radio :label="-1">禁用</el-radio>
|
||||
<el-radio :value="1">启用</el-radio>
|
||||
<el-radio :value="-1">禁用</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="close">取消</el-button>
|
||||
<el-button type="primary" @click="submitHandle" :loading="formLoading">
|
||||
<span v-if="!formLoading">保存</span>
|
||||
<span v-else>保存中...</span>
|
||||
</el-button>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="close">取消</el-button>
|
||||
<el-button type="primary" @click="submitHandle" :loading="formLoading">
|
||||
<span v-if="!formLoading">保存</span>
|
||||
<span v-else>保存中...</span>
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import { tbMerchantThirdApply, tbMerchantThirdApplyPut } from "@/api/shop";
|
||||
import ShopApi from "@/api/account/shop";
|
||||
|
||||
import shopMerchantApi from "@/api/account/shopMerchant";
|
||||
import { ElNotification } from "element-plus";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -64,12 +71,12 @@ export default {
|
||||
activeName: "pay",
|
||||
formLoading: false,
|
||||
form: {
|
||||
appToken: "",
|
||||
appSecret: "",
|
||||
id: "",
|
||||
payPassword: "",
|
||||
status: 1,
|
||||
appId: "",
|
||||
smallAppid: "",
|
||||
wechatSmallAppid: "",
|
||||
storeId: "",
|
||||
alipaySmallAppid: "",
|
||||
alipayAppToken: "",
|
||||
@@ -82,12 +89,12 @@ export default {
|
||||
async submitHandle() {
|
||||
this.formLoading = true;
|
||||
try {
|
||||
await tbMerchantThirdApplyPut(this.form);
|
||||
await shopMerchantApi.edit(this.form.id, this.form);
|
||||
this.$emit("success");
|
||||
this.formLoading = false;
|
||||
this.$notify({
|
||||
ElNotification({
|
||||
title: "成功",
|
||||
message: `提交成功`,
|
||||
message: `修改成功`,
|
||||
type: "success",
|
||||
});
|
||||
this.close();
|
||||
@@ -100,7 +107,7 @@ export default {
|
||||
this.dialogVisible = false;
|
||||
},
|
||||
reset() {
|
||||
this.form.appToken = "";
|
||||
this.form.appSecret = "";
|
||||
this.form.id = "";
|
||||
this.form.payPassword = "";
|
||||
this.form.status = 1;
|
||||
@@ -108,14 +115,16 @@ export default {
|
||||
},
|
||||
// 详情(配置三方支付)
|
||||
async getDetail(id) {
|
||||
console.log(id);
|
||||
try {
|
||||
const res = await tbMerchantThirdApply(id);
|
||||
this.form.appToken = res.appToken;
|
||||
const res = await shopMerchantApi.get(id);
|
||||
this.form.appSecret = res.appSecret;
|
||||
this.form.payPassword = res.payPassword;
|
||||
this.form.status = res.status;
|
||||
this.form.appId = res.appId;
|
||||
this.form.smallAppid = res.smallAppid;
|
||||
this.form.wechatSmallAppid = res.wechatSmallAppid;
|
||||
this.form.alipaySmallAppid = res.alipaySmallAppid;
|
||||
this.form.merchantName = res.merchantName;
|
||||
//this.form.alipayAppToken = res.alipayAppToken
|
||||
//this.form.alipayAppId = res.alipayAppId
|
||||
this.form.storeId = res.storeId;
|
||||
@@ -126,8 +135,8 @@ export default {
|
||||
},
|
||||
show(obj) {
|
||||
if (obj && obj.id) {
|
||||
this.form.id = obj.merchantId;
|
||||
this.getDetail(obj.merchantId);
|
||||
this.form.id = obj.id;
|
||||
this.getDetail(obj.id);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -184,12 +184,13 @@ onMounted(() => {
|
||||
|
||||
const refDetailModal = ref(null);
|
||||
function dropdownClick(e) {
|
||||
switch (e.command) {
|
||||
case 1:
|
||||
refDetailModal.value.show(e.row);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
console.log(e);
|
||||
if (e.command == 1) {
|
||||
refDetailModal.value.show(e.row);
|
||||
return;
|
||||
}
|
||||
if (e == 5) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// 重置查询
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<template></template>
|
||||
135
src/views/user/list/config/add.ts
Normal file
135
src/views/user/list/config/add.ts
Normal file
@@ -0,0 +1,135 @@
|
||||
import shopUserApi, { type addRequest } from "@/api/account/shopUser";
|
||||
import type { IModalConfig } from "@/components/CURD/types";
|
||||
|
||||
const modalConfig: IModalConfig<addRequest> = {
|
||||
pageName: "sys:user",
|
||||
dialog: {
|
||||
title: "添加用户",
|
||||
width: 800,
|
||||
draggable: true,
|
||||
},
|
||||
form: {
|
||||
labelWidth: 140,
|
||||
},
|
||||
formAction: function (data: addRequest) {
|
||||
return shopUserApi.add(data.shopid, data);
|
||||
},
|
||||
beforeSubmit(data) {
|
||||
console.log("提交之前处理", data);
|
||||
},
|
||||
formItems: [
|
||||
{
|
||||
label: "用户头像",
|
||||
prop: "headImg",
|
||||
rules: [{ required: false, message: "请选择用户头像", trigger: "blur" }],
|
||||
type: "UpImage",
|
||||
attrs: {
|
||||
placeholder: "请选择用户头像",
|
||||
},
|
||||
|
||||
},
|
||||
{
|
||||
label: "用户昵称",
|
||||
prop: "nickName",
|
||||
rules: [{ required: true, message: "请输入用户昵称", trigger: "blur" }],
|
||||
type: "input",
|
||||
attrs: {
|
||||
placeholder: "请输入用户昵称",
|
||||
},
|
||||
col: {
|
||||
xs: 24,
|
||||
sm: 12,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
label: "手机号码",
|
||||
prop: "phone",
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
|
||||
message: "请输入正确的手机号码",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
attrs: {
|
||||
placeholder: "请输入手机号码",
|
||||
maxlength: 11,
|
||||
},
|
||||
col: {
|
||||
xs: 24,
|
||||
sm: 12,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "会员生日",
|
||||
prop: "birthDay",
|
||||
rules: [{ required: false, message: "请选择会员生日", trigger: "blur" }],
|
||||
type: "date-picker",
|
||||
attrs: {
|
||||
placeholder: "请选择会员生日",
|
||||
},
|
||||
col: {
|
||||
xs: 24,
|
||||
sm: 12,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "radio",
|
||||
label: "性别",
|
||||
prop: "sex",
|
||||
rules: [{ required: false, message: "请选择性别", trigger: "blur" }],
|
||||
attrs: {
|
||||
placeholder: "请选择性别",
|
||||
},
|
||||
initialValue: '',
|
||||
options: [
|
||||
{ label: '男', value: 1 },
|
||||
{ label: '女', value: 0 },
|
||||
],
|
||||
col: {
|
||||
xs: 24,
|
||||
sm: 12,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "账户积分",
|
||||
prop: "accountPoints",
|
||||
rules: [{ required: false, message: "请输入账户积分", trigger: "blur" }],
|
||||
type: "input-number",
|
||||
attrs: {
|
||||
placeholder: "请输入账户积分",
|
||||
},
|
||||
col: {
|
||||
xs: 24,
|
||||
sm: 12,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "钱包余额",
|
||||
prop: "amount",
|
||||
rules: [{ required: false, message: "请输入钱包余额", trigger: "blur" }],
|
||||
type: "input-number",
|
||||
attrs: {
|
||||
placeholder: "请输入钱包余额",
|
||||
},
|
||||
col: {
|
||||
xs: 24,
|
||||
sm: 12,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "radio",
|
||||
label: "是否会员",
|
||||
prop: "isVip",
|
||||
options: [
|
||||
{ label: '是', value: 1 },
|
||||
{ label: '否', value: 0 },
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
// 如果有异步数据会修改配置的,推荐用reactive包裹,而纯静态配置的可以直接导出
|
||||
export default reactive(modalConfig);
|
||||
46
src/views/user/list/config/config.ts
Normal file
46
src/views/user/list/config/config.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
export const isVipOptions: statusOptions[] = [
|
||||
{ label: "全部", value: "" },
|
||||
{ label: "非会员", value: "0" },
|
||||
{ label: "会员", value: "1" },
|
||||
|
||||
];
|
||||
|
||||
export type optionsType = "isVip";
|
||||
|
||||
export function returnOptions(type: optionsType) {
|
||||
if (type === "isVip") {
|
||||
return isVipOptions;
|
||||
}
|
||||
}
|
||||
|
||||
export function returnOptionsLabel(optionsType: optionsType, value: string | number) {
|
||||
const options = returnOptions(optionsType);
|
||||
if (!options) {
|
||||
return "";
|
||||
}
|
||||
const option = options.find((item) => item.value === value);
|
||||
return option ? option.label : "";
|
||||
}
|
||||
|
||||
export interface options {
|
||||
label: string;
|
||||
value: string | number;
|
||||
[property: string]: any;
|
||||
}
|
||||
export interface statusOptions extends options {
|
||||
}
|
||||
|
||||
export type payTypeValue =
|
||||
| ""
|
||||
| "cash"
|
||||
| "bank"
|
||||
| "scanCode"
|
||||
| "deposit"
|
||||
| "vipPay"
|
||||
| "arrears"
|
||||
| "virtual"
|
||||
| "arrears";
|
||||
|
||||
export interface payTypeOptions extends options {
|
||||
value: payTypeValue;
|
||||
}
|
||||
106
src/views/user/list/config/content.ts
Normal file
106
src/views/user/list/config/content.ts
Normal file
@@ -0,0 +1,106 @@
|
||||
import shopUserApi, { type getListRequest } from "@/api/account/shopUser";
|
||||
import type { IContentConfig } from "@/components/CURD/types";
|
||||
|
||||
const contentConfig: IContentConfig<any> = {
|
||||
pageName: "sys:user",
|
||||
table: {
|
||||
border: true,
|
||||
highlightCurrentRow: true,
|
||||
},
|
||||
pagination: {
|
||||
background: true,
|
||||
layout: "prev,pager,next,jumper,total,sizes",
|
||||
pageSize: 20,
|
||||
pageSizes: [10, 20, 30, 50],
|
||||
},
|
||||
indexAction: function (params: getListRequest) {
|
||||
return shopUserApi.getList(params);
|
||||
},
|
||||
// deleteAction: shopUserApi.delete,
|
||||
// modifyAction: function (data) {
|
||||
// // return shopUserApi.edit(data);
|
||||
// },
|
||||
pk: "id",
|
||||
toolbar: ["add"],
|
||||
defaultToolbar: ["refresh", "filter", "search"],
|
||||
cols: [
|
||||
{ type: "selection", width: 50, align: "center" },
|
||||
{ label: "id", align: "center", prop: "id", width: 100, show: true },
|
||||
{
|
||||
label: "用户",
|
||||
align: "center",
|
||||
prop: "user",
|
||||
templet: "custom",
|
||||
slotName: "user",
|
||||
},
|
||||
{
|
||||
label: "性别",
|
||||
align: "center",
|
||||
prop: "sex",
|
||||
templet: "custom",
|
||||
slotName: "gender",
|
||||
},
|
||||
{
|
||||
label: "会员",
|
||||
align: "center",
|
||||
prop: "isVip",
|
||||
templet: "custom",
|
||||
slotName: "bol",
|
||||
},
|
||||
{
|
||||
label: "手机号",
|
||||
align: "center",
|
||||
prop: "phone",
|
||||
width: 140,
|
||||
templet: "custom",
|
||||
slotName: "mobile",
|
||||
},
|
||||
{
|
||||
label: "余额",
|
||||
align: "center",
|
||||
prop: "amount",
|
||||
},
|
||||
{
|
||||
label: "积分",
|
||||
align: "center",
|
||||
prop: "accountPoints",
|
||||
},
|
||||
{
|
||||
label: "消费累计",
|
||||
align: "center",
|
||||
prop: "consumeAmount",
|
||||
},
|
||||
{
|
||||
label: "消费次数累计",
|
||||
align: "center",
|
||||
prop: "consumeAmount",
|
||||
},
|
||||
{
|
||||
label: "注册时间",
|
||||
align: "center",
|
||||
prop: "createTime",
|
||||
},
|
||||
{
|
||||
label: "操作",
|
||||
align: "center",
|
||||
fixed: "right",
|
||||
width: 180,
|
||||
templet: "tool",
|
||||
operat: [
|
||||
{
|
||||
name: "edit",
|
||||
text: "编辑",
|
||||
},
|
||||
{
|
||||
name: "more",
|
||||
text: "更多",
|
||||
options: [
|
||||
{ label: '增减余额', command: 'change-money' }
|
||||
]
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default contentConfig;
|
||||
145
src/views/user/list/config/edit-money.ts
Normal file
145
src/views/user/list/config/edit-money.ts
Normal file
@@ -0,0 +1,145 @@
|
||||
import shopUserApi, { type editMoneyRequest } from "@/api/account/shopUser";
|
||||
import type { IModalConfig } from "@/components/CURD/types";
|
||||
import { min } from "lodash";
|
||||
|
||||
// 增减或者减少余额的类型
|
||||
export interface optuions {
|
||||
label: string;
|
||||
value: string | number;
|
||||
}
|
||||
export const addOptions: optuions[] = [
|
||||
{ label: '增加充值', value: 'adminIn' },
|
||||
{ label: '增加消费退款', value: 'adminRefund' },
|
||||
]
|
||||
export const reduceOptions: optuions[] = [
|
||||
{ label: '扣除消费', value: 'adminOut' },
|
||||
{ label: '扣除充值退款', value: 'adminInOut' },
|
||||
]
|
||||
|
||||
|
||||
const modalConfig: IModalConfig<editMoneyRequest> = {
|
||||
pageName: "sys:user",
|
||||
dialog: {
|
||||
title: "增减余额",
|
||||
width: 800,
|
||||
draggable: true,
|
||||
},
|
||||
pk: "id",
|
||||
form: {
|
||||
labelWidth: 140,
|
||||
},
|
||||
formAction: function (data) {
|
||||
return shopUserApi.editMoney(data.shopid, data);
|
||||
},
|
||||
beforeSubmit(data) {
|
||||
console.log("提交之前处理", data);
|
||||
},
|
||||
formItems: [
|
||||
{
|
||||
label: "用户昵称",
|
||||
prop: "nickName",
|
||||
rules: [{ required: false, message: "请输入用户昵称", trigger: "blur" }],
|
||||
type: "input",
|
||||
disabled: true,
|
||||
attrs: {
|
||||
placeholder: "请输入用户昵称",
|
||||
},
|
||||
col: {
|
||||
xs: 24,
|
||||
sm: 12,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "钱包余额",
|
||||
prop: "amount",
|
||||
disabled: true,
|
||||
rules: [{ required: false, message: "", trigger: "blur" }],
|
||||
type: "input",
|
||||
attrs: {
|
||||
placeholder: "",
|
||||
},
|
||||
col: {
|
||||
xs: 24,
|
||||
sm: 12,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "radio",
|
||||
label: "增减余额",
|
||||
prop: "type",
|
||||
rules: [{ required: true, message: "增减余额", trigger: "blur" }],
|
||||
initialValue: 1,
|
||||
options: [
|
||||
{ label: '增加', value: 1 },
|
||||
{ label: '减少', value: 0 },
|
||||
],
|
||||
col: {
|
||||
xs: 24,
|
||||
sm: 12,
|
||||
},
|
||||
watch() {
|
||||
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "金额",
|
||||
prop: "money",
|
||||
rules: [{ required: false, message: "请输入要增加或者减少的金额", trigger: "blur" }],
|
||||
type: "input-number",
|
||||
attrs: {
|
||||
placeholder: "请输入要增加或者减少的金额",
|
||||
min: 0,
|
||||
},
|
||||
col: {
|
||||
xs: 24,
|
||||
sm: 12,
|
||||
},
|
||||
initialValue: 0
|
||||
},
|
||||
{
|
||||
label: "类型",
|
||||
prop: "bizEnum",
|
||||
rules: [{ required: true, message: "请选择类型", trigger: "blur" }],
|
||||
type: "radio-button",
|
||||
attrs: {
|
||||
placeholder: "请选择类型",
|
||||
},
|
||||
options: addOptions,
|
||||
},
|
||||
{
|
||||
label: "备注",
|
||||
prop: "remark",
|
||||
rules: [{ required: false, message: "请输入备注", trigger: "blur" }],
|
||||
type: "textarea",
|
||||
attrs: {
|
||||
placeholder: "请输入备注",
|
||||
},
|
||||
},
|
||||
// {
|
||||
// label: "钱包余额",
|
||||
// prop: "amount",
|
||||
// rules: [{ required: false, message: "请输入钱包余额", trigger: "blur" }],
|
||||
// type: "input-number",
|
||||
// attrs: {
|
||||
// placeholder: "请输入钱包余额",
|
||||
// },
|
||||
// col: {
|
||||
// xs: 24,
|
||||
// sm: 12,
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// type: "radio",
|
||||
// label: "是否会员",
|
||||
// prop: "isVip",
|
||||
// options: [
|
||||
// { label: '是', value: 1 },
|
||||
// { label: '否', value: 0 },
|
||||
// ],
|
||||
// },
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
// 如果有异步数据会修改配置的,推荐用reactive包裹,而纯静态配置的可以直接导出
|
||||
export default reactive(modalConfig);
|
||||
136
src/views/user/list/config/edit.ts
Normal file
136
src/views/user/list/config/edit.ts
Normal file
@@ -0,0 +1,136 @@
|
||||
import shopUserApi, { type editRequest } from "@/api/account/shopUser";
|
||||
import type { IModalConfig } from "@/components/CURD/types";
|
||||
|
||||
const modalConfig: IModalConfig<editRequest> = {
|
||||
pageName: "sys:user",
|
||||
dialog: {
|
||||
title: "修改用户",
|
||||
width: 800,
|
||||
draggable: true,
|
||||
},
|
||||
pk: "id",
|
||||
form: {
|
||||
labelWidth: 140,
|
||||
},
|
||||
formAction: function (data: editRequest) {
|
||||
return shopUserApi.edit(data.shopid, data);
|
||||
},
|
||||
beforeSubmit(data) {
|
||||
console.log("提交之前处理", data);
|
||||
},
|
||||
formItems: [
|
||||
// {
|
||||
// label: "用户头像",
|
||||
// prop: "headImg",
|
||||
// rules: [{ required: false, message: "请选择用户头像", trigger: "blur" }],
|
||||
// type: "UpImage",
|
||||
// attrs: {
|
||||
// placeholder: "请选择用户头像",
|
||||
// },
|
||||
|
||||
// },
|
||||
{
|
||||
label: "用户昵称",
|
||||
prop: "nickName",
|
||||
rules: [{ required: false, message: "请输入用户昵称", trigger: "blur" }],
|
||||
type: "input",
|
||||
attrs: {
|
||||
placeholder: "请输入用户昵称",
|
||||
},
|
||||
col: {
|
||||
xs: 24,
|
||||
sm: 12,
|
||||
},
|
||||
},
|
||||
// {
|
||||
// type: "input",
|
||||
// label: "手机号码",
|
||||
// prop: "phone",
|
||||
// rules: [
|
||||
// {
|
||||
// required: true,
|
||||
// pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
|
||||
// message: "请输入正确的手机号码",
|
||||
// trigger: "blur",
|
||||
// },
|
||||
// ],
|
||||
// attrs: {
|
||||
// placeholder: "请输入手机号码",
|
||||
// maxlength: 11,
|
||||
// },
|
||||
// col: {
|
||||
// xs: 24,
|
||||
// sm: 12,
|
||||
// },
|
||||
// },
|
||||
{
|
||||
label: "会员生日",
|
||||
prop: "birthDay",
|
||||
rules: [{ required: false, message: "请选择会员生日", trigger: "blur" }],
|
||||
type: "date-picker",
|
||||
attrs: {
|
||||
placeholder: "请选择会员生日",
|
||||
},
|
||||
col: {
|
||||
xs: 24,
|
||||
sm: 12,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "radio",
|
||||
label: "性别",
|
||||
prop: "sex",
|
||||
rules: [{ required: false, message: "请选择性别", trigger: "blur" }],
|
||||
attrs: {
|
||||
placeholder: "请选择性别",
|
||||
},
|
||||
initialValue: '',
|
||||
options: [
|
||||
{ label: '男', value: 1 },
|
||||
{ label: '女', value: 0 },
|
||||
],
|
||||
col: {
|
||||
xs: 24,
|
||||
sm: 12,
|
||||
},
|
||||
},
|
||||
// {
|
||||
// label: "账户积分",
|
||||
// prop: "accountPoints",
|
||||
// rules: [{ required: false, message: "请输入账户积分", trigger: "blur" }],
|
||||
// type: "input-number",
|
||||
// attrs: {
|
||||
// placeholder: "请输入账户积分",
|
||||
// },
|
||||
// col: {
|
||||
// xs: 24,
|
||||
// sm: 12,
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// label: "钱包余额",
|
||||
// prop: "amount",
|
||||
// rules: [{ required: false, message: "请输入钱包余额", trigger: "blur" }],
|
||||
// type: "input-number",
|
||||
// attrs: {
|
||||
// placeholder: "请输入钱包余额",
|
||||
// },
|
||||
// col: {
|
||||
// xs: 24,
|
||||
// sm: 12,
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// type: "radio",
|
||||
// label: "是否会员",
|
||||
// prop: "isVip",
|
||||
// options: [
|
||||
// { label: '是', value: 1 },
|
||||
// { label: '否', value: 0 },
|
||||
// ],
|
||||
// },
|
||||
],
|
||||
};
|
||||
|
||||
// 如果有异步数据会修改配置的,推荐用reactive包裹,而纯静态配置的可以直接导出
|
||||
export default reactive(modalConfig);
|
||||
35
src/views/user/list/config/search.ts
Normal file
35
src/views/user/list/config/search.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import type { ISearchConfig } from "@/components/CURD/types";
|
||||
import { isVipOptions } from "./config";
|
||||
const searchConfig: ISearchConfig = {
|
||||
pageName: "sys:user",
|
||||
inline: true,
|
||||
isExpandable: false,
|
||||
formItems: [
|
||||
{
|
||||
type: "radio-button",
|
||||
label: "是否会员",
|
||||
prop: "isVip",
|
||||
attrs: {
|
||||
placeholder: "请选择",
|
||||
clearable: true,
|
||||
},
|
||||
options: isVipOptions,
|
||||
},
|
||||
|
||||
{
|
||||
type: "input",
|
||||
label: "昵称或手机号",
|
||||
prop: "key",
|
||||
attrs: {
|
||||
placeholder: "请输入昵称或手机号",
|
||||
clearable: true,
|
||||
style: {
|
||||
width: "200px",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
],
|
||||
};
|
||||
|
||||
export default searchConfig;
|
||||
169
src/views/user/list/index.vue
Normal file
169
src/views/user/list/index.vue
Normal file
@@ -0,0 +1,169 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 列表 -->
|
||||
<!-- 搜索 -->
|
||||
<page-search
|
||||
ref="searchRef"
|
||||
:search-config="searchConfig"
|
||||
@query-click="handleQueryClick"
|
||||
@reset-click="handleResetClick"
|
||||
/>
|
||||
<!-- 列表 -->
|
||||
<page-content
|
||||
ref="contentRef"
|
||||
:content-config="contentConfig"
|
||||
@add-click="handleAddClick"
|
||||
@edit-click="handleEditClick"
|
||||
@export-click="handleExportClick"
|
||||
@search-click="handleSearchClick"
|
||||
@toolbar-click="handleToolbarClick"
|
||||
@operat-click="handleOperatClick"
|
||||
@filter-change="handleFilterChange"
|
||||
>
|
||||
<template #status="scope">
|
||||
<el-tag :type="scope.row[scope.prop] == 1 ? 'success' : 'info'">
|
||||
{{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<template #options="scope">
|
||||
{{ returnOptionsLabel(scope.prop, scope.row[scope.prop]) }}
|
||||
</template>
|
||||
<template #bol="scope">
|
||||
{{ scope.row[scope.prop] ? "是" : "否" }}
|
||||
</template>
|
||||
<template #gender="scope">
|
||||
<el-tag
|
||||
:type="
|
||||
scope.row[scope.prop] == null
|
||||
? 'info'
|
||||
: scope.row[scope.prop] == 1
|
||||
? 'success'
|
||||
: 'warning'
|
||||
"
|
||||
>
|
||||
{{ scope.row[scope.prop] === null ? "未知" : scope.row[scope.prop] == 1 ? "男" : "女" }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<template #user="scope">
|
||||
<div class="flex align-center">
|
||||
<el-avatar :src="scope.row.headImg" />
|
||||
<el-tag>{{ scope.row.nickName }}</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
<template #link="scope">
|
||||
<el-link>{{ scope.row[scope.prop] }}</el-link>
|
||||
</template>
|
||||
<template #mobile="scope">
|
||||
<el-text>{{ scope.row[scope.prop] }}</el-text>
|
||||
<copy-button
|
||||
v-if="scope.row[scope.prop]"
|
||||
:text="scope.row[scope.prop]"
|
||||
style="margin-left: 2px"
|
||||
/>
|
||||
</template>
|
||||
</page-content>
|
||||
|
||||
<!-- 新增 -->
|
||||
<page-modal
|
||||
ref="addModalRef"
|
||||
:modal-config="addModalConfig"
|
||||
@submit-click="handleSubmitClick"
|
||||
></page-modal>
|
||||
|
||||
<!-- 编辑 -->
|
||||
<page-modal
|
||||
ref="editModalRef"
|
||||
:modal-config="editModalConfig"
|
||||
@submit-click="handleSubmitClick"
|
||||
></page-modal>
|
||||
<!-- 用户余额修改 -->
|
||||
<page-modal
|
||||
ref="editMoneyModalRef"
|
||||
:modal-config="editMoneyModalConfig"
|
||||
@formDataChange="formDataChange"
|
||||
@submit-click="handleSubmitClick"
|
||||
></page-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup >
|
||||
import usePage from "@/components/CURD/usePage";
|
||||
import addModalConfig from "./config/add";
|
||||
import contentConfig from "./config/content";
|
||||
import editModalConfig from "./config/edit";
|
||||
import editMoneyModalConfig, { addOptions, reduceOptions } from "./config/edit-money";
|
||||
import searchConfig from "./config/search";
|
||||
import { returnOptionsLabel } from "./config/config";
|
||||
const editMoneyModalRef = ref(null);
|
||||
const {
|
||||
searchRef,
|
||||
contentRef,
|
||||
addModalRef,
|
||||
editModalRef,
|
||||
handleQueryClick,
|
||||
handleResetClick,
|
||||
// handleAddClick,
|
||||
// handleEditClick,
|
||||
handleSubmitClick,
|
||||
handleExportClick,
|
||||
handleSearchClick,
|
||||
handleFilterChange,
|
||||
} = usePage();
|
||||
|
||||
// 修改金额表单类型
|
||||
function formDataChange(type, val) {
|
||||
if (type == "type") {
|
||||
if (val == 1) {
|
||||
editMoneyModalConfig.formItems[4].options = addOptions;
|
||||
} else {
|
||||
editMoneyModalConfig.formItems[4].options = reduceOptions;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 新增
|
||||
async function handleAddClick() {
|
||||
addModalRef.value?.setModalVisible();
|
||||
// 加载部门下拉数据源
|
||||
// addModalConfig.formItems[2]!.attrs!.data = await DeptAPI.getOptions();
|
||||
// 加载角色下拉数据源
|
||||
// addModalConfig.formItems[4]!.options = await RoleAPI.getOptions();
|
||||
}
|
||||
// 编辑
|
||||
async function handleEditClick(row) {
|
||||
editModalRef.value?.handleDisabled(false);
|
||||
editModalRef.value?.setModalVisible();
|
||||
// 根据id获取数据进行填充
|
||||
// const data = await VersionApi.getFormData(row.id);
|
||||
editModalRef.value?.setFormData({ ...row, headImg: row.headImg ? [row.headImg] : "" });
|
||||
}
|
||||
|
||||
// 其他工具栏
|
||||
function handleToolbarClick(name) {
|
||||
console.log(name);
|
||||
if (name === "custom1") {
|
||||
ElMessage.success("点击了自定义1按钮");
|
||||
}
|
||||
}
|
||||
|
||||
// 其他操作列
|
||||
async function handleOperatClick(data) {
|
||||
const row = data.row;
|
||||
if (data.name == "more") {
|
||||
if (data.command === "change-money") {
|
||||
editMoneyModalRef.value.setModalVisible();
|
||||
editMoneyModalRef.value.setFormData({ ...row, headImg: row.headImg ? [row.headImg] : "" });
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 切换示例
|
||||
const isA = ref(true);
|
||||
</script>
|
||||
<style scoped>
|
||||
.align-center {
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user