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

@@ -13,14 +13,12 @@
</template>
<script lang="ts" setup>
import type { GradeParam } from '@/api/user/grade/model';
import { ref, watch } from 'vue';
import { ref } from 'vue';
import { utils, writeFile } from 'xlsx';
import { message } from 'ant-design-vue';
import { ShopDealerCapital } from '@/api/shop/shopDealerCapital/model';
import { getTenantId } from '@/utils/domain';
import useSearch from '@/utils/use-search';
import {
import type {
ShopDealerOrder,
ShopDealerOrderParam
} from '@/api/shop/shopDealerOrder/model';
@@ -35,10 +33,7 @@
);
const emit = defineEmits<{
(e: 'search', where?: GradeParam): void;
(e: 'add'): void;
(e: 'remove'): void;
(e: 'batchMove'): void;
(e: 'search', where?: ShopDealerOrderParam): void;
}>();
const reload = () => {
@@ -50,34 +45,38 @@
keywords: '',
userId: undefined,
orderNo: undefined,
isSettled: 1, // 与列表页一致:只展示/导出已结算订单
page: 1,
limit: 5000
});
const list = ref<ShopDealerCapital[]>([]);
const list = ref<ShopDealerOrder[]>([]);
const toMoney = (val: unknown) => {
const n = Number.parseFloat(String(val ?? '0'));
return Number.isFinite(n) ? n.toFixed(2) : '0.00';
};
const toDateTime = (val: unknown) => {
if (val === null || val === undefined || val === '') return '';
if (typeof val === 'number') return new Date(val).toLocaleString();
return String(val);
};
// 导出
const handleExport = async () => {
const array: (string | number)[][] = [
[
'客户名称',
'业务员',
// 与 `src/views/shop/shopDealerOrder/index.vue` 表头保持一致
'订单编号',
'结算电量',
'换算成度',
'结算单价',
'结算金额',
'税费',
'实发金额',
'一级佣金30%',
'一级佣金收益',
'二级佣金10%',
'二级佣金收益',
'三级佣金60%',
'三级佣金收益',
'月份',
'创建时间',
'结算时间',
'租户ID'
'买家',
'订单金额',
'一级佣金(10%)',
'二级佣金(5%)',
'一级门店分红(2%/3%)',
'二级门店分红(1%)',
'结算状态',
'创建时间'
]
];
@@ -86,26 +85,30 @@
.then((data) => {
list.value = data?.list || [];
list.value?.forEach((d: ShopDealerOrder) => {
const buyer =
(d.title ? String(d.title) : '') +
(d.nickname || d.userId
? `\n${d.nickname ?? '-'}(${d.userId ?? '-'})`
: '');
const firstDividendUserName = (d as any)?.firstDividendUserName ?? '-';
const firstDividend = (d as any)?.firstDividend ?? 0;
const secondDividendUserName =
(d as any)?.secondDividendUserName ?? '-';
const secondDividend = (d as any)?.secondDividend ?? 0;
array.push([
`${d.title}`,
`${d.nickname}(${d.userId})`,
`${d.orderNo}`,
`${d.orderPrice}`,
`${d.degreePrice}`,
`${d.price}`,
`${d.settledPrice}`,
`${d.rate}`,
`${d.payPrice}`,
`${d.firstNickname}(${d.firstUserId})`,
`${d.firstMoney}`,
`${d.secondNickname}(${d.secondUserId})`,
`${d.secondMoney}`,
`${d.thirdNickname}(${d.thirdUserId})`,
`${d.thirdMoney}`,
`${d.month}`,
`${d.createTime}`,
`${d.settleTime}`,
`${d.tenantId}`
d.orderNo ?? '',
buyer,
toMoney(d.orderPrice),
`${toMoney(d.firstMoney)}\n${d.firstNickname ?? '-'}`,
`${toMoney(d.secondMoney)}\n${d.secondNickname ?? '-'}`,
`${toMoney(firstDividend)}\n${firstDividendUserName}`,
`${toMoney(secondDividend)}\n${secondDividendUserName}`,
d.isSettled === 1 ? '已结算' : '未结算',
`${d.createTime ?? ''}${
d.settleTime ? `\n${toDateTime(d.settleTime)}` : ''
}`
]);
});
const sheetName = `bak_shop_dealer_order_${getTenantId()}`;
@@ -117,27 +120,28 @@
workbook.Sheets[sheetName] = sheet;
// 设置列宽
sheet['!cols'] = [
{ wch: 10 },
{ wch: 20 },
{ wch: 20 },
{ wch: 15 },
{ wch: 10 },
{ wch: 12 },
{ wch: 16 },
{ wch: 16 },
{ wch: 18 },
{ wch: 16 },
{ wch: 10 },
{ wch: 20 }
];
message.loading('正在导出...');
message.loading('正在导出...', 0);
setTimeout(() => {
writeFile(workbook, `${sheetName}.xlsx`);
message.destroy();
}, 1000);
})
.catch((msg) => {
message.destroy();
message.error(msg);
})
.finally(() => {});
};
watch(
() => props.selection,
() => {}
);
void props;
</script>

View File

@@ -13,11 +13,6 @@
<template #toolbar>
<search
@search="reload"
:selection="selection"
@batchSettle="batchSettle"
@export="handleExport"
@remove="removeBatch"
@importDone="reload"
/>
</template>
<template #bodyCell="{ column, record }">
@@ -181,7 +176,6 @@
ShopDealerOrderParam
} from '@/api/shop/shopDealerOrder/model';
import {
exportShopDealerOrder,
updateShopDealerOrder
} from '@/api/shop/shopDealerOrder';
@@ -197,9 +191,6 @@
// 加载状态
const loading = ref(true);
// 当前搜索条件
const currentWhere = ref<ShopDealerOrderParam>({});
// 表格数据源
const datasource: DatasourceFunction = ({
page,
@@ -211,8 +202,6 @@
if (filters) {
where.status = filters.status;
}
// 保存当前搜索条件用于导出
currentWhere.value = { ...where };
// 已结算订单
where.isSettled = 1;
return pageShopDealerOrder({
@@ -381,12 +370,6 @@
});
};
/* 导出数据 */
const handleExport = () => {
// 调用导出API传入当前搜索条件
exportShopDealerOrder(currentWhere.value);
};
/* 打开编辑弹窗 */
const openEdit = (row?: ShopDealerOrder) => {
current.value = row ?? null;