feat(shop): 更新经销商模块页面结构和功能

- 重构经销商资金页面表格列配置,调整用户ID列为用户昵称显示
- 移除经销商订单页面的批量结算、导出、删除等功能入口和相关API调用
- 将经销商用户页面从申请管理改为用户管理,更新数据模型和表格配置
- 调整经销商订单导出功能的数据结构和字段映射逻辑
- 简化经销商用户搜索组件,移除审核相关功能按钮和搜索条件
- 删除不再使用的经销商申请编辑组件和相关API接口调用
This commit is contained in:
2026-01-26 21:59:54 +08:00
parent c605d0619d
commit e2382aeeab
7 changed files with 568 additions and 1092 deletions

View File

@@ -1,115 +1,85 @@
<template>
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
<a-card :bordered="false" :body-style="{ padding: '16px' }">
<ele-pro-table
ref="tableRef"
row-key="applyId"
:columns="columns"
:datasource="datasource"
:customRow="customRow"
tool-class="ele-toolbar-form"
class="sys-org-table"
v-model:selection="selection"
>
<template #toolbar>
<search
@search="reload"
:selection="selection"
@add="openEdit"
@batchApprove="batchApprove"
@export="exportData"
/>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'applyStatus'">
<a-tag v-if="record.applyStatus === 10" color="orange"
>待审核</a-tag
>
<a-tag v-if="record.applyStatus === 20" color="green">已通过</a-tag>
<a-tag v-if="record.applyStatus === 30" color="red">已驳回</a-tag>
<a-card :bordered="false" :body-style="{ padding: '16px' }">
<ele-pro-table
ref="tableRef"
row-key="id"
:columns="columns"
:datasource="datasource"
:customRow="customRow"
tool-class="ele-toolbar-form"
class="sys-org-table"
>
<template #toolbar>
<search
@search="reload"
:selection="selection"
@add="openEdit"
@remove="removeBatch"
@batchMove="openMove"
/>
</template>
<template v-if="column.key === 'action'">
<a @click="openEdit(record)" class="ele-text-primary">
<EditOutlined />
编辑
</a>
<template v-if="record.applyStatus !== 20">
<a-divider type="vertical" />
<a @click="approveApply(record)" class="ele-text-success">
<CheckOutlined />
通过
</a>
<a-divider type="vertical" />
<a @click="rejectApply(record)" class="ele-text-warning">
<CloseOutlined />
驳回
</a>
<a-divider type="vertical" />
<a-popconfirm
v-if="record.applyStatus != 20"
title="确定要删除此申请记录吗?"
@confirm="remove(record)"
placement="topRight"
>
<a class="ele-text-danger">
<DeleteOutlined />
删除
</a>
</a-popconfirm>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'image'">
<a-image :src="record.image" :width="50" />
</template>
<template v-if="column.key === 'type'">
<a-tag v-if="record.type === 0">经销商</a-tag>
<a-tag v-if="record.type === 1" color="orange">门店</a-tag>
<a-tag v-if="record.type === 2" color="purple">集团</a-tag>
</template>
<template v-if="column.key === 'status'">
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
</template>
<template v-if="column.key === 'action'">
<a-space>
<a @click="openEdit(record)">修改</a>
<a-divider type="vertical" />
<a-popconfirm
title="确定要删除此记录吗?"
@confirm="remove(record)"
>
<a class="ele-text-danger">删除</a>
</a-popconfirm>
</a-space>
</template>
</template>
</template>
</ele-pro-table>
</a-card>
</ele-pro-table>
</a-card>
<!-- 编辑弹窗 -->
<ShopDealerApplyEdit
v-model:visible="showEdit"
:data="current"
@done="reload"
/>
<!-- 编辑弹窗 -->
<ShopDealerUserEdit v-model:visible="showEdit" :data="current" @done="reload" />
</a-page-header>
</template>
<script lang="ts" setup>
import { createVNode, ref } from 'vue';
import { createVNode, ref, computed } from 'vue';
import { message, Modal } from 'ant-design-vue';
import {
ExclamationCircleOutlined,
CheckOutlined,
CloseOutlined,
EditOutlined,
DeleteOutlined
} from '@ant-design/icons-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import type { EleProTable } from 'ele-admin-pro';
import { toDateString } from 'ele-admin-pro';
import type {
DatasourceFunction,
ColumnItem
} from 'ele-admin-pro/es/ele-pro-table/types';
import Search from './components/search.vue';
import { getPageTitle } from '@/utils/common';
import ShopDealerApplyEdit from './components/shopDealerApplyEdit.vue';
import {
pageShopDealerApply,
removeShopDealerApply,
removeBatchShopDealerApply,
batchApproveShopDealerApply,
updateShopDealerApply
} from '@/api/shop/shopDealerApply';
import type {
ShopDealerApply,
ShopDealerApplyParam
} from '@/api/shop/shopDealerApply/model';
import {getPageTitle} from '@/utils/common';
import ShopDealerUserEdit from './components/shopDealerUserEdit.vue';
import { pageShopDealerUser, removeShopDealerUser, removeBatchShopDealerUser } from '@/api/shop/shopDealerUser';
import type { ShopDealerUser, ShopDealerUserParam } from '@/api/shop/shopDealerUser/model';
// 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
// 表格选中数据
const selection = ref<ShopDealerApply[]>([]);
const selection = ref<ShopDealerUser[]>([]);
// 当前编辑数据
const current = ref<ShopDealerApply | null>(null);
const current = ref<ShopDealerUser | null>(null);
// 是否显示编辑弹窗
const showEdit = ref(false);
// 是否显示批量移动弹窗
const showMove = ref(false);
// 加载状态
const loading = ref(true);
@@ -124,9 +94,7 @@
if (filters) {
where.status = filters.status;
}
where.type = 4;
where.applyStatus = 20;
return pageShopDealerApply({
return pageShopDealerUser({
...where,
...orders,
page,
@@ -134,201 +102,139 @@
});
};
// 表格列配置
// 完整的列配置(包含所有字段)
const columns = ref<ColumnItem[]>([
{
title: 'ID',
dataIndex: 'applyId',
key: 'applyId',
align: 'center',
width: 80,
fixed: 'left'
title: '用户ID',
dataIndex: 'userId',
key: 'userId',
width: 90,
},
{
title: '申请人信息',
key: 'applicantInfo',
align: 'left',
fixed: 'left',
customRender: ({ record }) => {
return `${record.realName || '-'} (${record.mobile || '-'})`;
}
},
{
title: '申请方式',
dataIndex: 'applyType',
key: 'applyType',
align: 'center',
width: 120,
customRender: ({ text }) => {
const typeMap = {
10: { text: '需审核', color: 'orange' },
20: { text: '免审核', color: 'green' }
};
const type = typeMap[text] || { text: '未知', color: 'default' };
return {
type: 'tag',
props: { color: type.color },
children: type.text
};
}
},
{
title: '审核状态',
dataIndex: 'applyStatus',
key: 'applyStatus',
align: 'center',
title: '类型',
dataIndex: 'type',
key: 'type',
width: 120
},
{
title: '推荐人',
dataIndex: 'refereeId',
key: 'refereeId',
align: 'center',
width: 100,
customRender: ({ text }) => (text ? `ID: ${text}` : '')
title: '真实姓名',
dataIndex: 'realName',
key: 'realName'
},
{
title: '手机号',
dataIndex: 'mobile',
key: 'mobile'
},
{
title: '可提现',
dataIndex: 'money',
key: 'money',
width: 120
},
{
title: '已冻结',
dataIndex: 'freezeMoney',
key: 'freezeMoney',
width: 120
},
{
title: '累积提现',
dataIndex: 'totalMoney',
key: 'totalMoney',
width: 120
},
// {
// title: '申请时间',
// dataIndex: 'applyTime',
// key: 'applyTime',
// align: 'center',
// width: 120,
// customRender: ({ text }) => text ? toDateString(new Date(text), 'yyyy-MM-dd HH:mm') : '-'
// title: '推荐人用户ID',
// dataIndex: 'refereeId',
// key: 'refereeId',
// width: 120
// },
// {
// title: '审核时间',
// dataIndex: 'auditTime',
// key: 'auditTime',
// align: 'center',
// customRender: ({ text }) => text ? toDateString(new Date(text), 'yyyy-MM-dd HH:mm') : '-'
// title: '成员数量(一级)',
// dataIndex: 'firstNum',
// key: 'firstNum',
// width: 120
// },
// {
// title: '成员数量(二级)',
// dataIndex: 'secondNum',
// key: 'secondNum',
// width: 120
// },
// {
// title: '成员数量(三级)',
// dataIndex: 'thirdNum',
// key: 'thirdNum',
// width: 120
// },
{
title: '驳回原因',
dataIndex: 'rejectReason',
key: 'rejectReason',
align: 'left',
ellipsis: true,
customRender: ({ text }) => text || '-'
title: '专属二维码',
dataIndex: 'qrcode',
key: 'qrcode',
align: 'center'
},
// {
// title: '备注',
// dataIndex: 'comments',
// key: 'comments',
// ellipsis: true
// },
// {
// title: '排序号',
// dataIndex: 'sortNumber',
// key: 'sortNumber',
// width: 120
// },
{
title: '创建时间',
dataIndex: 'createTime',
key: 'createTime',
width: 200,
align: 'center',
sorter: true,
ellipsis: true
ellipsis: true,
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
},
{
title: '操作',
key: 'action',
width: 180,
fixed: 'right',
align: 'center',
width: 380,
hideInSetting: true
}
]);
/* 搜索 */
const reload = (where?: ShopDealerApplyParam) => {
const reload = (where?: ShopDealerUserParam) => {
selection.value = [];
tableRef?.value?.reload({ where: where });
};
/* 审核通过 */
const approveApply = (row: ShopDealerApply) => {
Modal.confirm({
title: '审核通过确认',
content: `确定要通过 ${row.realName} 的经销商申请吗?`,
icon: createVNode(CheckOutlined),
okText: '确认通过',
okType: 'primary',
cancelText: '取消',
onOk: async () => {
const hide = message.loading('正在处理审核...', 0);
try {
await updateShopDealerApply({
...row,
applyId: row.applyId,
applyStatus: 20
});
hide();
message.success('审核通过成功');
reload();
} catch (error: any) {
hide();
message.error(error.message || '审核失败,请重试');
}
}
});
};
/* 审核驳回 */
const rejectApply = (row: ShopDealerApply) => {
let rejectReason = '';
Modal.confirm({
title: '审核驳回',
content: createVNode('div', null, [
createVNode('p', null, `申请人: ${row.realName} (${row.mobile})`),
createVNode('p', { style: 'margin-top: 12px;' }, '请输入驳回原因:'),
createVNode('textarea', {
placeholder: '请输入驳回原因...',
style:
'width: 100%; height: 80px; margin-top: 8px; padding: 8px; border: 1px solid #d9d9d9; border-radius: 4px;',
onInput: (e: any) => {
rejectReason = e.target.value;
}
})
]),
icon: createVNode(CloseOutlined),
okText: '确认驳回',
okType: 'danger',
cancelText: '取消',
onOk: async () => {
if (!rejectReason.trim()) {
message.error('请输入驳回原因');
return Promise.reject();
}
const hide = message.loading('正在处理审核...', 0);
try {
await updateShopDealerApply({
...row,
applyStatus: 30,
rejectReason: rejectReason.trim()
});
hide();
message.success('审核驳回成功');
reload();
} catch (error: any) {
hide();
message.error(error.message || '审核失败,请重试');
}
}
});
};
/* 打开编辑弹窗 */
const openEdit = (row?: ShopDealerApply) => {
const openEdit = (row?: ShopDealerUser) => {
current.value = row ?? null;
showEdit.value = true;
};
/* 删除单个 */
const remove = (row: ShopDealerApply) => {
if (!row.applyId) {
message.error('删除失败:缺少必要参数');
return;
}
/* 打开批量移动弹窗 */
const openMove = () => {
showMove.value = true;
};
const hide = message.loading('正在删除申请记录...', 0);
removeShopDealerApply(row.applyId)
/* 删除单个 */
const remove = (row: ShopDealerUser) => {
const hide = message.loading('请求中..', 0);
removeShopDealerUser(row.id)
.then((msg) => {
hide();
message.success(msg || '删除成功');
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message || '删除失败');
message.error(e.message);
});
};
@@ -338,99 +244,34 @@
message.error('请至少选择一条数据');
return;
}
const validIds = selection.value
.filter((d) => d.applyId)
.map((d) => d.applyId);
if (!validIds.length) {
message.error('选中的数据中没有有效的ID');
return;
}
Modal.confirm({
title: '批量删除确认',
content: `确定要删除选中的 ${validIds.length} 条申请记录吗?此操作不可恢复。`,
title: '提示',
content: '确定要删除选中的记录吗?',
icon: createVNode(ExclamationCircleOutlined),
maskClosable: true,
okText: '确认删除',
okType: 'danger',
cancelText: '取消',
onOk: () => {
const hide = message.loading(
`正在删除 ${validIds.length} 条记录...`,
0
);
removeBatchShopDealerApply(validIds)
const hide = message.loading('请求中..', 0);
removeBatchShopDealerUser(selection.value.map((d) => d.id))
.then((msg) => {
hide();
message.success(msg || `成功删除 ${validIds.length} 条记录`);
selection.value = [];
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message || '批量删除失败');
message.error(e.message);
});
}
});
};
/* 批量通过 */
const batchApprove = () => {
if (!selection.value.length) {
message.error('请至少选择一条数据');
return;
}
const pendingApplies = selection.value.filter(
(item) => item.applyStatus === 10
);
if (!pendingApplies.length) {
message.error('所选申请中没有待审核的记录');
return;
}
Modal.confirm({
title: '批量通过确认',
content: `确定要通过选中的 ${pendingApplies.length} 个申请吗?`,
icon: createVNode(ExclamationCircleOutlined),
okText: '确认通过',
okType: 'primary',
cancelText: '取消',
onOk: async () => {
const hide = message.loading('正在批量通过...', 0);
try {
const ids = pendingApplies.map((item) => item.applyId);
await batchApproveShopDealerApply(ids);
hide();
message.success(`成功通过 ${pendingApplies.length} 个申请`);
selection.value = [];
reload();
} catch (error: any) {
hide();
message.error(error.message || '批量审核失败,请重试');
}
}
});
};
/* 导出数据 */
const exportData = () => {
const hide = message.loading('正在导出申请数据...', 0);
// 这里调用导出API
setTimeout(() => {
hide();
message.success('申请数据导出成功');
}, 2000);
};
/* 查询 */
const query = () => {
loading.value = true;
};
/* 自定义行属性 */
const customRow = (record: ShopDealerApply) => {
const customRow = (record: ShopDealerUser) => {
return {
// 行点击事件
onClick: () => {
@@ -447,71 +288,8 @@
<script lang="ts">
export default {
name: 'ShopDealerApply'
name: 'ShopDealerUser'
};
</script>
<style lang="less" scoped>
.sys-org-table {
:deep(.ant-table-thead > tr > th) {
background-color: #fafafa;
font-weight: 600;
}
:deep(.ant-table-tbody > tr:hover > td) {
background-color: #f8f9fa;
}
}
.detail-item {
p {
margin: 4px 0;
color: #666;
}
strong {
color: #1890ff;
font-size: 14px;
}
}
.ele-text-primary {
color: #1890ff;
&:hover {
color: #40a9ff;
}
}
.ele-text-info {
color: #13c2c2;
&:hover {
color: #36cfc9;
}
}
.ele-text-success {
color: #52c41a;
&:hover {
color: #73d13d;
}
}
.ele-text-warning {
color: #faad14;
&:hover {
color: #ffc53d;
}
}
.ele-text-danger {
color: #ff4d4f;
&:hover {
color: #ff7875;
}
}
</style>
<style lang="less" scoped></style>