From f768421b36633d5cd6716889d5b451affeb13f0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=9F=91=E8=9E=82?= Date: Mon, 11 May 2026 23:19:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E9=9D=99=E6=80=81?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/dashboard/workbench/data.ts | 22 ++- .../src/views/dashboard/workbench/index.vue | 145 +++++++++++++++--- 2 files changed, 146 insertions(+), 21 deletions(-) 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 88ca8b1b..8fd17d7b 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 @@ -6,10 +6,17 @@ export const GLOBAL_SUMMARY = { periodLabel: '近30天', mom: 18.3, yoy: 42.7, - currentStoreName: '优品生活旗舰店', - storeRating: 4.87, }; +/** 电商平台筛选(演示,对接接口后可替换) */ +export const PLATFORM_OPTIONS = [ + { label: '全平台', value: 'all' }, + { label: '拼多多', value: 'pdd' }, + { label: '淘宝', value: 'taobao' }, + { label: '京东', value: 'jd' }, + { label: '抖音电商', value: 'douyin' }, +] as const; + export const FINANCE_KPIS = [ { label: '总GMV', @@ -100,6 +107,17 @@ export const COST_STRUCTURE = [ { name: '其他费用', value: 18.0, pct: 6.6 }, ] as const; +/** 与 COST_STRUCTURE 顺序一一对应,用于成本结构饼图 */ +export const COST_STRUCTURE_PIE_COLORS = [ + '#22c55e', + '#3b82f6', + '#ef4444', + '#f59e0b', + '#a855f7', + '#94a3b8', + '#14b8a6', +] as const; + export const FUNNEL_STEPS = [ { name: 'GMV', value: 286.4 }, { name: '实收金额', value: 271.8 }, 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 376ebff9..1b65f28c 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 @@ -11,6 +11,7 @@ import { Card, Progress, Radio, + Select, Table, Tabs, Tag, @@ -21,12 +22,14 @@ import { ADS_KPIS, CATEGORY_GMV_SHARE, COST_STRUCTURE, + COST_STRUCTURE_PIE_COLORS, FINANCE_KPIS, FUNNEL_STAGE_COLORS, FUNNEL_STEPS, GLOBAL_SUMMARY, GMV_TREND, MONTHLY_GMV_NET_RATE, + PLATFORM_OPTIONS, PRODUCT_RANK, PRODUCT_TIME_SEGMENTS, PROMO_TABLE, @@ -45,6 +48,18 @@ type PeriodKey = 'today' | '7d' | '30d' | '90d' | 'month'; const activePeriod = ref('30d'); const activeTab = ref('finance'); const selectedStoreIndex = ref(0); +const selectedPlatform = ref('pdd'); + +const storeSelectOptions = computed(() => + STORES.map((s, i) => ({ + label: `${s.name}(${s.star})`, + value: i, + })), +); + +const platformSelectOptions = computed(() => + PLATFORM_OPTIONS.map((o) => ({ label: o.label, value: o.value })), +); const financeChartRef = ref(); const { renderEcharts: renderFinanceTrend } = useEcharts(financeChartRef); @@ -55,6 +70,9 @@ const { renderEcharts: renderFunnelChart } = useEcharts(funnelChartRef); const monthlyChartRef = ref(); const { renderEcharts: renderMonthlyChart } = useEcharts(monthlyChartRef); +const costPieChartRef = ref(); +const { renderEcharts: renderCostPieChart } = useEcharts(costPieChartRef); + const compareDataSource = computed(() => storeCompareRows()); const selectedStore = computed(() => STORES[selectedStoreIndex.value]!); @@ -338,9 +356,75 @@ const drawMonthlyGmvNetRate = () => { }); }; +const drawCostPie = () => { + if (!costPieChartRef.value) return; + const isDark = document.documentElement.classList.contains('dark'); + const labelColor = isDark ? 'hsl(0deg 0% 95%)' : '#334155'; + const legendColor = isDark ? 'hsl(240deg 5% 64.9%)' : '#64748b'; + const border = isDark ? 'hsl(222.34deg 10.43% 12.27%)' : '#fff'; + + renderCostPieChart({ + tooltip: { + trigger: 'item', + backgroundColor: isDark ? 'hsl(222.34deg 10.43% 12.27%)' : '#fff', + textStyle: { color: isDark ? 'hsl(0deg 0% 95%)' : '#0f172a' }, + formatter: (params: any) => { + const name = String(params.name ?? ''); + const val = Number(params.value ?? 0); + const row = COST_STRUCTURE.find((r) => r.name === name); + const pctText = row + ? `${row.pct}%(占实收)` + : `${Number(params.percent ?? 0).toFixed(1)}%`; + return `${name}
${val} 万
${pctText}`; + }, + }, + legend: { + orient: 'vertical', + right: '0', + top: 'center', + itemWidth: 10, + itemHeight: 10, + textStyle: { color: legendColor, fontSize: 11, fontWeight: 700 }, + }, + series: [ + { + type: 'pie', + radius: ['40%', '68%'], + center: ['36%', '50%'], + avoidLabelOverlap: true, + itemStyle: { + borderRadius: 6, + borderColor: border, + borderWidth: 2, + }, + label: { + show: true, + formatter: '{b}\n{d}%', + color: labelColor, + fontSize: 11, + fontWeight: 700, + }, + labelLine: { + length: 12, + length2: 8, + lineStyle: { color: isDark ? 'hsl(240deg 3.7% 35%)' : '#cbd5e1' }, + }, + data: COST_STRUCTURE.map((row, i) => ({ + name: row.name, + value: row.value, + itemStyle: { + color: COST_STRUCTURE_PIE_COLORS[i] ?? '#6366f1', + }, + })), + }, + ], + }); +}; + const rerenderFinanceCharts = async () => { await nextTick(); drawFinanceTrend(); + drawCostPie(); drawFunnel(); drawMonthlyGmvNetRate(); }; @@ -409,12 +493,32 @@ const panelCardClass = class="flex w-full max-w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center sm:gap-3" >
- {{ GLOBAL_SUMMARY.currentStoreName }} - - 评分 {{ GLOBAL_SUMMARY.storeRating }} - +
+ + 电商平台 + + +

- 合计约 {{ costTotal.toFixed(1) }} 万 · 各分项来自原型看板 + 合计约 {{ costTotal.toFixed(1) }} 万 · 扇区面积按金额(万)占比;悬浮可见占实收比例

-
-
-
- {{ row.name }} - {{ row.value }}万 · {{ row.pct }}% -
- -
+
+
@@ -955,6 +1048,20 @@ const panelCardClass = :deep(.workbench-tabs .ant-tabs-tab) { font-weight: 800; } + +:deep(.workbench-header-select) { + min-width: 0; +} + +:deep(.workbench-header-select .ant-select-selector) { + border-radius: 0.75rem !important; + border: none !important; + font-weight: 700; +} + +html.dark :deep(.workbench-header-select .ant-select-selector) { + background-color: hsl(240deg 3.7% 15.9% / 55%) !important; +}