diff --git a/ecom-dmb-frontend/apps/web-antd/src/router/routes/modules/ecommerce.ts b/ecom-dmb-frontend/apps/web-antd/src/router/routes/modules/ecommerce.ts index 4ad34e27..9b76e580 100644 --- a/ecom-dmb-frontend/apps/web-antd/src/router/routes/modules/ecommerce.ts +++ b/ecom-dmb-frontend/apps/web-antd/src/router/routes/modules/ecommerce.ts @@ -13,6 +13,8 @@ const routes: RouteRecordRaw[] = [ { name: 'DataImport', path: '/data/import', + /** 与 `router.push('/import')` 等同页,地址栏可保持为 `/import` */ + alias: '/import', component: () => import('#/views/ecommerce/order-import/index.vue'), meta: { icon: 'lucide:upload', diff --git a/ecom-dmb-frontend/apps/web-antd/src/views/dashboard/workbench/data.ts b/ecom-dmb-frontend/apps/web-antd/src/views/dashboard/workbench/data.ts index 68e8a32f..649871ee 100644 --- a/ecom-dmb-frontend/apps/web-antd/src/views/dashboard/workbench/data.ts +++ b/ecom-dmb-frontend/apps/web-antd/src/views/dashboard/workbench/data.ts @@ -1,6 +1,11 @@ /** 电商运营工作台 — 演示数据(与 temp/pdd_dashboard 原型一致,后续可换接口) */ -export type TrendPoint = { date: string; gmv: number; profit: number; refund: number }; +export type TrendPoint = { + date: string; + gmv: number; + profit: number; + refund: number; +}; export const GLOBAL_SUMMARY = { periodLabel: '近30天', @@ -92,7 +97,7 @@ export const GMV_TREND: TrendPoint[] = [ { date: '3/5', gmv: 10.2, profit: 1.35, refund: 0.33 }, { date: '3/6', gmv: 9.4, profit: 1.22, refund: 0.27 }, { date: '3/7', gmv: 8.8, profit: 1.08, refund: 0.3 }, - { date: '3/8', gmv: 11.0, profit: 1.42, refund: 0.35 }, + { date: '3/8', gmv: 11, profit: 1.42, refund: 0.35 }, { date: '3/9', gmv: 9.6, profit: 1.25, refund: 0.28 }, { date: '3/10', gmv: 10.5, profit: 1.38, refund: 0.32 }, ]; @@ -104,7 +109,7 @@ export const COST_STRUCTURE = [ { name: '平台佣金', value: 28.6, pct: 10.5 }, { name: '物流费用', value: 18.2, pct: 6.7 }, { name: '退款损失', value: 14.6, pct: 5.4 }, - { name: '其他费用', value: 18.0, pct: 6.6 }, + { name: '其他费用', value: 18, pct: 6.6 }, ] as const; /** 与 COST_STRUCTURE 顺序一一对应;配色对齐全店概览表(盈利翠绿 / 规模蓝 / 成本橙红系 / 退款灰) */ @@ -124,7 +129,7 @@ export const STORES = [ star: 4.87, color: '#6366f1', gmv: 286.4, - orders: 18432, + orders: 18_432, aov: 155.4, grossRate: 25.1, netRate: 14.3, @@ -145,7 +150,7 @@ export const STORES = [ star: 4.68, color: '#f59e0b', gmv: 182.6, - orders: 11240, + orders: 11_240, aov: 162.4, grossRate: 22.8, netRate: 11.6, @@ -203,13 +208,41 @@ export const STORES = [ ] as const; export const TRAFFIC_KPIS = [ - { label: '总曝光量', value: '1,284', unit: '万', changePct: 32.1, up: true, sub: '日均42.8万' }, - { label: '点击量', value: '98.6', unit: '万', changePct: 28.4, up: true, sub: '点击率7.68%' }, - { label: '加购数', value: '24.7', unit: '万', changePct: 19.2, up: true, sub: '加购转化25.1%' }, - { label: '成交转化率', value: '1.87', unit: '%', changePct: 0.23, up: true, sub: '类目均值1.42%' }, + { + label: '总曝光量', + value: '1,284', + unit: '万', + changePct: 32.1, + up: true, + sub: '日均42.8万', + }, + { + label: '点击量', + value: '98.6', + unit: '万', + changePct: 28.4, + up: true, + sub: '点击率7.68%', + }, + { + label: '加购数', + value: '24.7', + unit: '万', + changePct: 19.2, + up: true, + sub: '加购转化25.1%', + }, + { + label: '成交转化率', + value: '1.87', + unit: '%', + changePct: 0.23, + up: true, + sub: '类目均值1.42%', + }, ] as const; -export type TrafficFunnelRow = { label: string; value: string; rate?: string }; +export type TrafficFunnelRow = { label: string; rate?: string; value: string }; export const TRAFFIC_FUNNEL: TrafficFunnelRow[] = [ { label: '曝光', value: '1,284万' }, @@ -229,10 +262,38 @@ export const TRAFFIC_SOURCES = [ ] as const; export const ADS_KPIS = [ - { label: '广告总花费', value: '73.8', unit: '万', changePct: 12.4, up: true, sub: '占GMV 25.8%' }, - { label: '广告GMV', value: '271.6', unit: '万', changePct: 21.3, up: true, sub: 'ROI 3.68' }, - { label: '广告点击量', value: '62.4', unit: '万', changePct: 18.7, up: true, sub: '均价¥1.18/次' }, - { label: '广告转化率', value: '2.94', unit: '%', changePct: 0.42, up: true, sub: '自然流1.43%' }, + { + label: '广告总花费', + value: '73.8', + unit: '万', + changePct: 12.4, + up: true, + sub: '占GMV 25.8%', + }, + { + label: '广告GMV', + value: '271.6', + unit: '万', + changePct: 21.3, + up: true, + sub: 'ROI 3.68', + }, + { + label: '广告点击量', + value: '62.4', + unit: '万', + changePct: 18.7, + up: true, + sub: '均价¥1.18/次', + }, + { + label: '广告转化率', + value: '2.94', + unit: '%', + changePct: 0.42, + up: true, + sub: '自然流1.43%', + }, ] as const; export const AD_KEYWORDS = [ @@ -317,21 +378,303 @@ export const AD_KEYWORDS = [ ]; export const PRODUCT_RANK = [ - { rank: 1, name: '316不锈钢保温杯-女款粉色500ML', sku: 6, price: 128, sales: 2840, gmv: 36.4, pct: 12.7, margin: 28.4, refund: 3.2, cvr: 2.84, trendUp: true, trendPct: 12.4 }, - { rank: 2, name: '大容量保温杯男款军绿1000ML', sku: 4, price: 148, sales: 2180, gmv: 32.2, pct: 11.2, margin: 26.8, refund: 4.1, cvr: 2.54, trendUp: true, trendPct: 8.2 }, - { rank: 3, name: '情侣对杯礼盒装经典款', sku: 3, price: 268, sales: 1020, gmv: 27.3, pct: 9.5, margin: 31.2, refund: 5.8, cvr: 1.86, trendUp: false, trendPct: 2.1 }, - { rank: 4, name: '儿童保温杯卡通图案380ML', sku: 8, price: 68, sales: 3640, gmv: 24.7, pct: 8.6, margin: 22.4, refund: 4.8, cvr: 3.12, trendUp: true, trendPct: 15.6 }, - { rank: 5, name: '316保温壶2.5L大容量家用', sku: 3, price: 198, sales: 1120, gmv: 22.2, pct: 7.7, margin: 29.6, refund: 3.9, cvr: 1.68, trendUp: true, trendPct: 5.3 }, - { rank: 6, name: '玻璃内胆保温杯480ML', sku: 5, price: 158, sales: 1280, gmv: 20.2, pct: 7.0, margin: 24.2, refund: 6.2, cvr: 2.08, trendUp: false, trendPct: 1.8 }, + { + rank: 1, + name: '316不锈钢保温杯-女款粉色500ML', + sku: 6, + price: 128, + sales: 2840, + gmv: 36.4, + pct: 12.7, + margin: 28.4, + refund: 3.2, + cvr: 2.84, + trendUp: true, + trendPct: 12.4, + }, + { + rank: 2, + name: '大容量保温杯男款军绿1000ML', + sku: 4, + price: 148, + sales: 2180, + gmv: 32.2, + pct: 11.2, + margin: 26.8, + refund: 4.1, + cvr: 2.54, + trendUp: true, + trendPct: 8.2, + }, + { + rank: 3, + name: '情侣对杯礼盒装经典款', + sku: 3, + price: 268, + sales: 1020, + gmv: 27.3, + pct: 9.5, + margin: 31.2, + refund: 5.8, + cvr: 1.86, + trendUp: false, + trendPct: 2.1, + }, + { + rank: 4, + name: '儿童保温杯卡通图案380ML', + sku: 8, + price: 68, + sales: 3640, + gmv: 24.7, + pct: 8.6, + margin: 22.4, + refund: 4.8, + cvr: 3.12, + trendUp: true, + trendPct: 15.6, + }, + { + rank: 5, + name: '316保温壶2.5L大容量家用', + sku: 3, + price: 198, + sales: 1120, + gmv: 22.2, + pct: 7.7, + margin: 29.6, + refund: 3.9, + cvr: 1.68, + trendUp: true, + trendPct: 5.3, + }, + { + rank: 6, + name: '玻璃内胆保温杯480ML', + sku: 5, + price: 158, + sales: 1280, + gmv: 20.2, + pct: 7, + margin: 24.2, + refund: 6.2, + cvr: 2.08, + trendUp: false, + trendPct: 1.8, + }, ]; +/** 多维分析 / 销售额榜:平台·店铺·品类·商品 统一行结构(演示数据) */ +export type WorkbenchMultiRow = { + gmvWan: number; + grossMarginPct: number; + grossProfitWan: number; + key: string; + name: string; + netMarginPct: number; + netProfitWan: number; + refundWan: number; +}; + +function storeToMultiRow(s: (typeof STORES)[number]): WorkbenchMultiRow { + const gmv = s.gmv; + return { + key: s.name, + name: s.name, + gmvWan: gmv, + grossProfitWan: Number(((gmv * s.grossRate) / 100).toFixed(1)), + netProfitWan: Number(((gmv * s.netRate) / 100).toFixed(1)), + refundWan: Number(((gmv * s.refund) / 100).toFixed(1)), + grossMarginPct: s.grossRate, + netMarginPct: s.netRate, + }; +} + +export const MULTI_ANALYSIS_SHOP: WorkbenchMultiRow[] = STORES.map((s) => + storeToMultiRow(s), +); + +export const MULTI_ANALYSIS_PLATFORM: WorkbenchMultiRow[] = [ + { + key: 'pdd', + name: '拼多多', + gmvWan: 128.4, + grossProfitWan: 32.1, + netProfitWan: 18.6, + refundWan: 6.2, + grossMarginPct: 25, + netMarginPct: 14.5, + }, + { + key: 'taobao', + name: '淘宝', + gmvWan: 86.2, + grossProfitWan: 19.8, + netProfitWan: 10.4, + refundWan: 5.8, + grossMarginPct: 23, + netMarginPct: 12.1, + }, + { + key: 'jd', + name: '京东', + gmvWan: 52.6, + grossProfitWan: 11.4, + netProfitWan: 5.9, + refundWan: 2.4, + grossMarginPct: 21.7, + netMarginPct: 11.2, + }, + { + key: 'douyin', + name: '抖音电商', + gmvWan: 41.2, + grossProfitWan: 9.6, + netProfitWan: 4.8, + refundWan: 3, + grossMarginPct: 23.3, + netMarginPct: 11.7, + }, +]; + +export const MULTI_ANALYSIS_CATEGORY: WorkbenchMultiRow[] = [ + { + key: 'c1', + name: '不锈钢保温杯', + gmvWan: 142, + grossProfitWan: 38.2, + netProfitWan: 21.4, + refundWan: 8.1, + grossMarginPct: 26.9, + netMarginPct: 15.1, + }, + { + key: 'c2', + name: '礼盒套装', + gmvWan: 68, + grossProfitWan: 17.8, + netProfitWan: 9.9, + refundWan: 3.9, + grossMarginPct: 26.2, + netMarginPct: 14.6, + }, + { + key: 'c3', + name: '儿童水杯', + gmvWan: 42, + grossProfitWan: 10.5, + netProfitWan: 5.8, + refundWan: 2.6, + grossMarginPct: 25, + netMarginPct: 13.8, + }, + { + key: 'c4', + name: '运动水壶', + gmvWan: 28, + grossProfitWan: 7.8, + netProfitWan: 4.2, + refundWan: 1.5, + grossMarginPct: 27.9, + netMarginPct: 15, + }, + { + key: 'c5', + name: '定制企业版', + gmvWan: 16, + grossProfitWan: 4.9, + netProfitWan: 2.7, + refundWan: 0.6, + grossMarginPct: 30.6, + netMarginPct: 16.9, + }, +]; + +export const MULTI_ANALYSIS_PRODUCT: WorkbenchMultiRow[] = PRODUCT_RANK.map( + (p) => { + const gmv = p.gmv; + const netMarginPct = Number((p.margin * 0.52).toFixed(1)); + return { + key: `p-${p.rank}`, + name: p.name, + gmvWan: gmv, + grossProfitWan: Number(((gmv * p.margin) / 100).toFixed(1)), + netProfitWan: Number(((gmv * netMarginPct) / 100).toFixed(1)), + refundWan: Number(((gmv * p.refund) / 100).toFixed(1)), + grossMarginPct: p.margin, + netMarginPct, + }; + }, +); + +/** 多维分析 / 销售额榜:维度 key(与卡片顺序一致) */ +export type WorkbenchDimKey = 'category' | 'platform' | 'product' | 'shop'; + +export const WORKBENCH_MULTI_BY_DIM: Record< + WorkbenchDimKey, + WorkbenchMultiRow[] +> = { + category: MULTI_ANALYSIS_CATEGORY, + platform: MULTI_ANALYSIS_PLATFORM, + product: MULTI_ANALYSIS_PRODUCT, + shop: MULTI_ANALYSIS_SHOP, +}; + export const PROMO_TIMELINE = [ - { date: '01/01', name: '元旦跨年狂欢节', meta: '预热3天·主推保温杯礼盒', gmv: '¥38.2万', target: '目标¥35万·完成率109%', status: '已完成', tone: 'success' as const }, - { date: '02/14', name: '情人节专属活动', meta: '预热5天·情侣对杯套装', gmv: '¥52.6万', target: '目标¥45万·完成率117%', status: '已完成', tone: 'success' as const }, - { date: '03/08', name: '女王节女生节', meta: '预热7天·主推女款颜值系列', gmv: '¥74.3万', target: '目标¥60万·完成率124%', status: '已完成', tone: 'success' as const }, - { date: '03/28', name: '春季焕新大促', meta: '预热中·全品类联动', gmv: '进行中…', target: '目标¥80万', status: '进行中', tone: 'processing' as const }, - { date: '05/20', name: '520情人节', meta: '备货中', gmv: '—', target: '目标¥90万', status: '筹备中', tone: 'warning' as const }, - { date: '06/18', name: '618年中大促', meta: '策划阶段', gmv: '—', target: '目标¥280万', status: '筹备中', tone: 'warning' as const }, + { + date: '01/01', + name: '元旦跨年狂欢节', + meta: '预热3天·主推保温杯礼盒', + gmv: '¥38.2万', + target: '目标¥35万·完成率109%', + status: '已完成', + tone: 'success' as const, + }, + { + date: '02/14', + name: '情人节专属活动', + meta: '预热5天·情侣对杯套装', + gmv: '¥52.6万', + target: '目标¥45万·完成率117%', + status: '已完成', + tone: 'success' as const, + }, + { + date: '03/08', + name: '女王节女生节', + meta: '预热7天·主推女款颜值系列', + gmv: '¥74.3万', + target: '目标¥60万·完成率124%', + status: '已完成', + tone: 'success' as const, + }, + { + date: '03/28', + name: '春季焕新大促', + meta: '预热中·全品类联动', + gmv: '进行中…', + target: '目标¥80万', + status: '进行中', + tone: 'processing' as const, + }, + { + date: '05/20', + name: '520情人节', + meta: '备货中', + gmv: '—', + target: '目标¥90万', + status: '筹备中', + tone: 'warning' as const, + }, + { + date: '06/18', + name: '618年中大促', + meta: '策划阶段', + gmv: '—', + target: '目标¥280万', + status: '筹备中', + tone: 'warning' as const, + }, ]; export const CATEGORY_GMV_SHARE = [ @@ -343,16 +686,81 @@ export const CATEGORY_GMV_SHARE = [ ] as const; export const PRODUCT_TIME_SEGMENTS = [ - { product: '316不锈钢保温杯-女款', w1: 4.2, w2: 4.8, w3: 5.1, w4: 4.9, total: 19.0, up: true }, - { product: '大容量保温杯-男款', w1: 3.8, w2: 3.6, w3: 4.0, w4: 3.9, total: 15.3, up: false }, - { product: '情侣对杯礼盒', w1: 2.9, w2: 3.4, w3: 3.8, w4: 3.2, total: 13.3, up: true }, - { product: '儿童保温杯卡通款', w1: 3.2, w2: 3.1, w3: 3.5, w4: 3.6, total: 13.4, up: true }, + { + product: '316不锈钢保温杯-女款', + w1: 4.2, + w2: 4.8, + w3: 5.1, + w4: 4.9, + total: 19, + up: true, + }, + { + product: '大容量保温杯-男款', + w1: 3.8, + w2: 3.6, + w3: 4, + w4: 3.9, + total: 15.3, + up: false, + }, + { + product: '情侣对杯礼盒', + w1: 2.9, + w2: 3.4, + w3: 3.8, + w4: 3.2, + total: 13.3, + up: true, + }, + { + product: '儿童保温杯卡通款', + w1: 3.2, + w2: 3.1, + w3: 3.5, + w4: 3.6, + total: 13.4, + up: true, + }, ] as const; export const PROMO_TABLE = [ - { name: '元旦跨年狂欢', period: '01/01-01/03', targetGmv: '35万', actualGmv: '38.2万', rate: '109%', adCost: '9.2万', roi: '4.15', gross: '24.8%', refund: '4.3%', newUser: '62%' }, - { name: '情人节专属', period: '02/14-02/15', targetGmv: '45万', actualGmv: '52.6万', rate: '117%', adCost: '11.8万', roi: '4.46', gross: '26.2%', refund: '5.1%', newUser: '58%' }, - { name: '女王节女生节', period: '03/08-03/10', targetGmv: '60万', actualGmv: '74.3万', rate: '124%', adCost: '16.4万', roi: '4.53', gross: '27.1%', refund: '4.8%', newUser: '65%' }, + { + name: '元旦跨年狂欢', + period: '01/01-01/03', + targetGmv: '35万', + actualGmv: '38.2万', + rate: '109%', + adCost: '9.2万', + roi: '4.15', + gross: '24.8%', + refund: '4.3%', + newUser: '62%', + }, + { + name: '情人节专属', + period: '02/14-02/15', + targetGmv: '45万', + actualGmv: '52.6万', + rate: '117%', + adCost: '11.8万', + roi: '4.46', + gross: '26.2%', + refund: '5.1%', + newUser: '58%', + }, + { + name: '女王节女生节', + period: '03/08-03/10', + targetGmv: '60万', + actualGmv: '74.3万', + rate: '124%', + adCost: '16.4万', + roi: '4.53', + gross: '27.1%', + refund: '4.8%', + newUser: '65%', + }, ]; export function storeCompareRows() { @@ -376,7 +784,9 @@ export function storeCompareRows() { gmv: Number((STORES.reduce((a, s) => a + s.gmv, 0) / n).toFixed(1)), orders: Math.round(STORES.reduce((a, s) => a + s.orders, 0) / n), aov: Number((STORES.reduce((a, s) => a + s.aov, 0) / n).toFixed(1)), - grossRate: Number((STORES.reduce((a, s) => a + s.grossRate, 0) / n).toFixed(1)), + grossRate: Number( + (STORES.reduce((a, s) => a + s.grossRate, 0) / n).toFixed(1), + ), netRate: Number((STORES.reduce((a, s) => a + s.netRate, 0) / n).toFixed(1)), roi: Number((STORES.reduce((a, s) => a + s.roi, 0) / n).toFixed(2)), refund: Number((STORES.reduce((a, s) => a + s.refund, 0) / n).toFixed(1)), diff --git a/ecom-dmb-frontend/apps/web-antd/src/views/dashboard/workbench/index.vue b/ecom-dmb-frontend/apps/web-antd/src/views/dashboard/workbench/index.vue index 9c1a4cf8..5861c5dc 100644 --- a/ecom-dmb-frontend/apps/web-antd/src/views/dashboard/workbench/index.vue +++ b/ecom-dmb-frontend/apps/web-antd/src/views/dashboard/workbench/index.vue @@ -1,51 +1,31 @@