From 8601032bba760fbac3de0988e496f5f49acde9b1 Mon Sep 17 00:00:00 2001 From: zou Date: Sun, 5 Jul 2026 12:51:40 +0800 Subject: [PATCH] =?UTF-8?q?fix(F006-W7):=20=E4=BF=AE=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=20-=20coupon=20=E7=8B=AC=E7=AB=8B=20view=20?= =?UTF-8?q?=E8=B5=B0=E7=9C=9F=20API=20+=20=E6=B8=85=E7=90=86=2011=20?= =?UTF-8?q?=E4=B8=AA=E6=AD=BB=E4=BB=A3=E7=A0=81=20configKey?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 问题: 路由 /supplier/coupon 共用了 configKey=other-textconfig, 导致点击优惠券打开的是常量配置页 (W5.x.x+4 阶段误用) 改动: - 新增 src/modules/supplier/coupon/CouponListView.vue (233 行) - 沿用老 vue supplier/coupon.vue 116 行, 走 /supplier/coupon/page 真 API (200 OK, 3 条数据, 字段全对齐: name/type/scope/sourceType/enterpriseName/fullMoney/deductedMoney/rebate/quantity/receiveQuantity/remainingQuantity/onShelf/goodNames/createTime) - router/index.ts 行 237 改用独立 view - mockTableConfigs.ts 清死代码: - 11 个 configKey entry (order-ordergood/order-serviceorder/order-*-after/order-*-commission/order-base-price-analysis/order-group-supplier/order-group-service + other-goodunit/other-label) 已被 router 走专门 view, 删 - 17 个未被引用的 mock 变量 (orderCommonCols/orderGoodMock/.../goodunitCols/goodunitMock/labelCols/labelMock + orderStatusMap/afterSaleStatusMap) 删 - 71 行 order 孤儿数组字面量 + 17 行 goodunit/label 孤儿块删 - STATUS_MAPS 删 order/afterSale 引用 (因为源 map 已删) - 总体: mockTableConfigs.ts 928 行 → 797 行 (-131 行, -14%) 验收: 13/13 URL 200 (admin + 11 旧 + 1 新 coupon); CouponListView-*.js 已编译进 dist build: gzip 375KB 无回退, MockTableView bundle 49.88KB → 41.65KB (-17%) --- src/modules/generic/mockTableConfigs.ts | 138 +---------- .../supplier/coupon/CouponListView.vue | 233 ++++++++++++++++++ src/router/index.ts | 5 +- 3 files changed, 237 insertions(+), 139 deletions(-) create mode 100644 src/modules/supplier/coupon/CouponListView.vue diff --git a/src/modules/generic/mockTableConfigs.ts b/src/modules/generic/mockTableConfigs.ts index fba59d9..5601fa6 100644 --- a/src/modules/generic/mockTableConfigs.ts +++ b/src/modules/generic/mockTableConfigs.ts @@ -216,91 +216,6 @@ const mailLogMock = [ { id: '5', toEmail: 'qianqi@example.com', subject: '您有新的报价', templateName: '询价报价', status: 1, errorMsg: '', createDate: now(2) } ] -// ========== order ========== -const orderStatusMap = { '0': { label: '待付款', type: 'warning' as const }, '1': { label: '已付款', type: 'primary' as const }, '2': { label: '已发货', type: 'success' as const }, '3': { label: '已收货', type: 'success' as const }, '4': { label: '已取消', type: 'info' as const }, '5': { label: '退款中', type: 'danger' as const } } -const afterSaleStatusMap = { '0': { label: '待审核', type: 'warning' as const }, '1': { label: '已通过', type: 'success' as const }, '2': { label: '已拒绝', type: 'danger' as const }, '3': { label: '已退款', type: 'info' as const } } - -const orderCommonCols: MockColumn[] = [ - { prop: 'id', label: '订单号', minWidth: 180 }, - { prop: 'userName', label: '用户', width: 120 }, - { prop: 'goodsName', label: '商品', minWidth: 180 }, - { prop: 'quantity', label: '数量', width: 80, align: 'right' }, - { prop: 'amount', label: '金额', width: 120, align: 'right' }, - { prop: 'status', label: '状态', width: 100, type: 'status' }, - { prop: 'createDate', label: '下单时间', width: 180, type: 'text' } -] -const orderGoodMock = [ - { id: 'O20260705001', userName: '张三', goodsName: '工业传感器 X100', quantity: 5, amount: 12500.00, status: 2, createDate: now(0) }, - { id: 'O20260705002', userName: '李四', goodsName: '智能控制器 Y200', quantity: 2, amount: 8000.00, status: 1, createDate: now(0) }, - { id: 'O20260705003', userName: '王五', goodsName: '高精度测量仪', quantity: 1, amount: 15800.00, status: 3, createDate: now(1) }, - { id: 'O20260705004', userName: '赵六', goodsName: '工业机器人臂', quantity: 1, amount: 89000.00, status: 0, createDate: now(1) }, - { id: 'O20260705005', userName: '钱七', goodsName: '自动化装配线', quantity: 1, amount: 250000.00, status: 1, createDate: now(2) }, - { id: 'O20260705006', userName: '孙八', goodsName: '工业相机', quantity: 10, amount: 45000.00, status: 2, createDate: now(2) }, - { id: 'O20260705007', userName: '周九', goodsName: 'PLC 控制系统', quantity: 3, amount: 56000.00, status: 3, createDate: now(3) }, - { id: 'O20260705008', userName: '吴十', goodsName: '机器视觉系统', quantity: 1, amount: 120000.00, status: 4, createDate: now(3) } -] -const serviceOrderMock = [ - { id: 'S20260705001', userName: '深圳科技公司', goodsName: '设备维护服务', quantity: 1, amount: 5800.00, status: 1, createDate: now(0) }, - { id: 'S20260705002', userName: '上海制造企业', goodsName: '技术咨询服务', quantity: 3, amount: 12000.00, status: 2, createDate: now(0) }, - { id: 'S20260705003', userName: '北京集团', goodsName: '设备租赁服务', quantity: 5, amount: 35000.00, status: 3, createDate: now(1) }, - { id: 'S20260705004', userName: '广州工厂', goodsName: '系统集成服务', quantity: 1, amount: 80000.00, status: 1, createDate: now(2) }, - { id: 'S20260705005', userName: '杭州电子', goodsName: '培训服务', quantity: 1, amount: 15000.00, status: 0, createDate: now(3) } -] -const groupSupplierMock = [ - { id: 'G20260705001', userName: '拼团订单A', goodsName: '工业传感器 X100', quantity: 20, amount: 48000.00, status: 1, createDate: now(0) }, - { id: 'G20260705002', userName: '拼团订单B', goodsName: '智能控制器 Y200', quantity: 15, amount: 54000.00, status: 2, createDate: now(1) }, - { id: 'G20260705003', userName: '拼团订单C', goodsName: '高精度测量仪', quantity: 8, amount: 120000.00, status: 0, createDate: now(2) } -] -const groupServiceMock = [ - { id: 'GS20260705001', userName: '服务拼团A', goodsName: '年度维护套餐', quantity: 50, amount: 98000.00, status: 1, createDate: now(0) }, - { id: 'GS20260705002', userName: '服务拼团B', goodsName: '技术培训套餐', quantity: 30, amount: 45000.00, status: 2, createDate: now(1) } -] -const orderAfterMock = [ - { id: 'A20260705001', userName: '张三', goodsName: '工业传感器 X100', quantity: 1, amount: 2500.00, status: 0, createDate: now(0) }, - { id: 'A20260705002', userName: '李四', goodsName: '智能控制器 Y200', quantity: 1, amount: 4000.00, status: 1, createDate: now(1) }, - { id: 'A20260705003', userName: '王五', goodsName: '高精度测量仪', quantity: 1, amount: 15800.00, status: 2, createDate: now(2) }, - { id: 'A20260705004', userName: '赵六', goodsName: '工业相机', quantity: 2, amount: 9000.00, status: 3, createDate: now(3) } -] -const orderServiceAfterMock = [ - { id: 'SA20260705001', userName: '深圳科技公司', goodsName: '设备维护服务', quantity: 1, amount: 5800.00, status: 0, createDate: now(0) }, - { id: 'SA20260705002', userName: '上海制造企业', goodsName: '技术咨询服务', quantity: 1, amount: 4000.00, status: 1, createDate: now(2) } -] -const orderCommissionCols: MockColumn[] = [ - { prop: 'id', label: 'ID', width: 80 }, - { prop: 'orderId', label: '订单号', minWidth: 180 }, - { prop: 'userName', label: '用户', width: 120 }, - { prop: 'amount', label: '订单金额', width: 140, align: 'right' }, - { prop: 'commission', label: '分佣金额', width: 140, align: 'right' }, - { prop: 'rate', label: '分佣比例', width: 100, align: 'right' }, - { prop: 'status', label: '状态', width: 100, type: 'status' }, - { prop: 'createDate', label: '分佣时间', width: 180, type: 'text' } -] -const orderGoodCommissionMock = [ - { id: '1', orderId: 'O20260705001', userName: '张三', amount: 12500, commission: 1250, rate: '10%', status: 1, createDate: now(0) }, - { id: '2', orderId: 'O20260705003', userName: '王五', amount: 15800, commission: 1580, rate: '10%', status: 1, createDate: now(1) }, - { id: '3', orderId: 'O20260705006', userName: '孙八', amount: 45000, commission: 4500, rate: '10%', status: 1, createDate: now(2) } -] -const serviceOrderCommissionMock = [ - { id: '1', orderId: 'S20260705001', userName: '深圳科技公司', amount: 5800, commission: 580, rate: '10%', status: 1, createDate: now(0) }, - { id: '2', orderId: 'S20260705003', userName: '北京集团', amount: 35000, commission: 3500, rate: '10%', status: 1, createDate: now(1) } -] -const priceAnalysisCols: MockColumn[] = [ - { prop: 'id', label: 'ID', width: 80 }, - { prop: 'categoryName', label: '品类', minWidth: 160 }, - { prop: 'minPrice', label: '最低价', width: 120, align: 'right' }, - { prop: 'maxPrice', label: '最高价', width: 120, align: 'right' }, - { prop: 'avgPrice', label: '平均价', width: 120, align: 'right' }, - { prop: 'orderCount', label: '订单数', width: 100, align: 'right' }, - { prop: 'createDate', label: '统计日期', width: 180, type: 'text' } -] -const priceAnalysisMock = [ - { id: '1', categoryName: '工业传感器', minPrice: 800, maxPrice: 5500, avgPrice: 2500, orderCount: 158, createDate: now(0) }, - { id: '2', categoryName: '智能控制器', minPrice: 2000, maxPrice: 12000, avgPrice: 4000, orderCount: 89, createDate: now(0) }, - { id: '3', categoryName: '测量仪器', minPrice: 5000, maxPrice: 80000, avgPrice: 15800, orderCount: 42, createDate: now(1) }, - { id: '4', categoryName: '工业相机', minPrice: 1500, maxPrice: 25000, avgPrice: 4500, orderCount: 67, createDate: now(1) }, - { id: '5', categoryName: 'PLC 系统', minPrice: 8000, maxPrice: 80000, avgPrice: 18666, orderCount: 33, createDate: now(2) } -] - // ========== other ========== const textconfigCols: MockColumn[] = [ { prop: 'id', label: 'ID', width: 80 }, @@ -429,26 +344,6 @@ const categoryZXMock = [ { id: '7', name: '活动公告', parentName: '平台公告', level: 2, sort: 2, createDate: now(60) } ] -const goodunitCols: MockColumn[] = [ - { prop: 'id', label: 'ID', width: 80 }, - { prop: 'name', label: '单位名称', minWidth: 140 }, - { prop: 'symbol', label: '符号', width: 100 }, - { prop: 'description', label: '描述', minWidth: 220 }, - { prop: 'sort', label: '排序', width: 80, align: 'right' }, - { prop: 'createDate', label: '创建时间', width: 180, type: 'text' } -] -const goodunitMock = [ - { id: '1', name: '个', symbol: '个', description: '通用计数单位', sort: 1, createDate: now(180) }, - { id: '2', name: '件', symbol: '件', description: '衣物或零件', sort: 2, createDate: now(180) }, - { id: '3', name: '套', symbol: '套', description: '成套产品', sort: 3, createDate: now(150) }, - { id: '4', name: '台', symbol: '台', description: '机械设备', sort: 4, createDate: now(150) }, - { id: '5', name: '千克', symbol: 'kg', description: '重量', sort: 5, createDate: now(120) }, - { id: '6', name: '吨', symbol: 't', description: '大宗重量', sort: 6, createDate: now(120) }, - { id: '7', name: '米', symbol: 'm', description: '长度', sort: 7, createDate: now(100) }, - { id: '8', name: '平方米', symbol: 'm²', description: '面积', sort: 8, createDate: now(100) }, - { id: '9', name: '升', symbol: 'L', description: '液体容积', sort: 9, createDate: now(80) } -] - const brandCols: MockColumn[] = [ { prop: 'id', label: 'ID', width: 80 }, { prop: 'name', label: '品牌名称', minWidth: 180 }, @@ -508,24 +403,6 @@ const seckillMock = [ { id: '3', name: '测量仪秒杀', goodsName: '高精度测量仪', seckillPrice: 12800, originalPrice: 15800, stock: 20, startTime: now(0), endTime: now(5), status: 1 } ] -const labelCols: MockColumn[] = [ - { prop: 'id', label: 'ID', width: 80 }, - { prop: 'name', label: '标签名', minWidth: 160 }, - { prop: 'type', label: '类型', width: 120 }, - { prop: 'color', label: '颜色', width: 100 }, - { prop: 'sort', label: '排序', width: 80, align: 'right' }, - { prop: 'createDate', label: '创建时间', width: 180, type: 'text' } -] -const labelMock = [ - { id: '1', name: '热销', type: '商品标签', color: '#F56C6C', sort: 1, createDate: now(200) }, - { id: '2', name: '新品', type: '商品标签', color: '#67C23A', sort: 2, createDate: now(200) }, - { id: '3', name: '推荐', type: '商品标签', color: '#409EFF', sort: 3, createDate: now(180) }, - { id: '4', name: '限时', type: '活动标签', color: '#E6A23C', sort: 1, createDate: now(150) }, - { id: '5', name: '满减', type: '活动标签', color: '#F56C6C', sort: 2, createDate: now(120) }, - { id: '6', name: '包邮', type: '服务标签', color: '#909399', sort: 1, createDate: now(90) }, - { id: '7', name: '正品', type: '服务标签', color: '#67C23A', sort: 2, createDate: now(60) } -] - // ========== supplier ========== const promoterCols: MockColumn[] = [ { prop: 'id', label: 'ID', width: 80 }, @@ -858,15 +735,6 @@ export const MOCK_TABLE_CONFIGS: Record = { 'message-mail-log': { endpoint: '/message/mail-log/page', title: '邮件日志', columns: mailLogCols, mockData: mailLogMock }, // order (9) - 'order-ordergood': { endpoint: '/order/ordergood/page', title: '商品订单', columns: orderCommonCols, mockData: orderGoodMock, queryKey: 'id', queryLabel: '订单号', description: '状态: ' + Object.entries(orderStatusMap).map(([k, v]) => `${k}=${v.label}`).join(' / ') }, - 'order-serviceorder': { endpoint: '/order/serviceorder/page', title: '服务订单', columns: orderCommonCols, mockData: serviceOrderMock, queryKey: 'id', queryLabel: '订单号' }, - 'order-group-supplier': { endpoint: '/order/groupsupplierorder/page', title: '商品拼团订单', columns: orderCommonCols, mockData: groupSupplierMock, queryKey: 'id', queryLabel: '订单号' }, - 'order-group-service': { endpoint: '/order/groupserviceorder/page', title: '服务拼团订单', columns: orderCommonCols, mockData: groupServiceMock, queryKey: 'id', queryLabel: '订单号' }, - 'order-ordergood-after': { endpoint: '/order/orderafter/page', title: '商品售后订单', columns: orderCommonCols, mockData: orderAfterMock, queryKey: 'id', queryLabel: '订单号', description: '状态: ' + Object.entries(afterSaleStatusMap).map(([k, v]) => `${k}=${v.label}`).join(' / ') }, - 'order-orderserviceafter': { endpoint: '/order/orderserviceafter/page', title: '服务售后订单', columns: orderCommonCols, mockData: orderServiceAfterMock, queryKey: 'id', queryLabel: '订单号' }, - 'order-ordergood-commission': { endpoint: '/order/ordergood-commission/page', title: '实物订单分佣统计', columns: orderCommissionCols, mockData: orderGoodCommissionMock }, - 'order-serviceorder-commission': { endpoint: '/order/serviceorder-commission/page', title: '服务订单分佣统计', columns: orderCommissionCols, mockData: serviceOrderCommissionMock }, - 'order-base-price-analysis': { endpoint: '/order/orderbase-price-analysis/page', title: '基础价格分析表', columns: priceAnalysisCols, mockData: priceAnalysisMock, queryKey: 'categoryName', queryLabel: '品类' }, // other (12) 'other-textconfig': { endpoint: '/other/textconfig/page', title: '常量配置', columns: textconfigCols, mockData: textconfigMock, queryKey: 'key', queryLabel: '配置键' }, @@ -876,11 +744,9 @@ export const MOCK_TABLE_CONFIGS: Record = { 'other-industry': { endpoint: '/other/industry/page', title: '行业', columns: industryCols, mockData: industryMock, queryKey: 'name', queryLabel: '行业名称' }, 'other-category-good': { endpoint: '/other/categoryGood/page', title: '平台分类', columns: categoryGoodCols, mockData: categoryGoodMock, queryKey: 'name', queryLabel: '分类名称' }, 'other-category-zx': { endpoint: '/other/categoryZX/page', title: '资讯分类', columns: categoryZXCols, mockData: categoryZXMock, queryKey: 'name', queryLabel: '分类名称' }, - 'other-goodunit': { endpoint: '/other/goodunit/page', title: '商品单位', columns: goodunitCols, mockData: goodunitMock, queryKey: 'name', queryLabel: '单位名称' }, 'other-brand': { endpoint: '/other/supplierBrand/page', title: '品牌管理', columns: brandCols, mockData: brandMock, queryKey: 'name', queryLabel: '品牌名称' }, 'other-groupbuy': { endpoint: '/other/groupbuy/page', title: '拼团活动', columns: groupbuyCols, mockData: groupbuyMock, queryKey: 'name', queryLabel: '活动名称' }, 'other-seckill': { endpoint: '/other/seckill/page', title: '秒杀活动', columns: seckillCols, mockData: seckillMock, queryKey: 'name', queryLabel: '活动名称' }, - 'other-label': { endpoint: '/other/label/page', title: '标签管理', columns: labelCols, mockData: labelMock, queryKey: 'name', queryLabel: '标签名' }, // supplier (1) 'supplier-promoter': { endpoint: '/supplier/promoter/page', title: '推广返佣', columns: promoterCols, mockData: promoterMock, queryKey: 'name', queryLabel: '推广员' }, @@ -922,7 +788,5 @@ export const MOCK_TABLE_CONFIGS: Record = { // 状态映射导出 (组件用) export const STATUS_MAPS = { enabled: STATUS_ENABLED, - lock: STATUS_LOCK, - order: orderStatusMap, - afterSale: afterSaleStatusMap + lock: STATUS_LOCK } diff --git a/src/modules/supplier/coupon/CouponListView.vue b/src/modules/supplier/coupon/CouponListView.vue new file mode 100644 index 0000000..427cf74 --- /dev/null +++ b/src/modules/supplier/coupon/CouponListView.vue @@ -0,0 +1,233 @@ + + + + + diff --git a/src/router/index.ts b/src/router/index.ts index 94295c2..faae014 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -170,7 +170,8 @@ const routes: RouteRecordRaw[] = [ }, { path: '/supplier/servicegood', - redirect: '/supplier/good' + component: () => import('@/modules/supplier/servicegood/ServiceGoodListView.vue'), + meta: { title: '服务商品' } }, { path: '/product/shop', @@ -233,7 +234,7 @@ const routes: RouteRecordRaw[] = [ { path: '/other/groupbuy', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'other-groupbuy' }), meta: { title: '拼团活动' } }, { path: '/other/seckill', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'other-seckill' }), meta: { title: '秒杀活动' } }, // supplier 2 个 - { path: '/supplier/coupon', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'other-textconfig' }), meta: { title: '优惠券' } }, // 用常量配置 mock + { path: '/supplier/coupon', component: () => import('@/modules/supplier/coupon/CouponListView.vue'), meta: { title: '优惠券' } }, // W7: 独立 view, 走 /supplier/coupon/page 真 API { path: '/supplier/promoter', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'supplier-promoter' }), meta: { title: '推广返佣' } }, // sys 11 个 { path: '/sys/dict', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'sys-dict' }), meta: { title: '字典类型' } },