mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-23 23:19:19 +08:00
feat: 新增工作台静态页面设计
This commit is contained in:
@@ -19,6 +19,8 @@
|
||||
"dashboard": {
|
||||
"title": "Dashboard",
|
||||
"analytics": "Analytics",
|
||||
"workspace": "Workspace"
|
||||
"workspace": "Workspace",
|
||||
"storeOverview": "Store overview",
|
||||
"workbench": "E-commerce operations workbench"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
"dashboard": {
|
||||
"title": "概览",
|
||||
"analytics": "分析页",
|
||||
"workspace": "工作台"
|
||||
"workspace": "工作台",
|
||||
"storeOverview": "全店概览",
|
||||
"workbench": "电商运营工作台"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,15 @@ const routes: RouteRecordRaw[] = [
|
||||
title: $t('page.dashboard.storeOverview'),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'PddWorkbench',
|
||||
path: '/workbench',
|
||||
component: () => import('#/views/dashboard/workbench/index.vue'),
|
||||
meta: {
|
||||
icon: 'lucide:gauge',
|
||||
title: $t('page.dashboard.workbench'),
|
||||
},
|
||||
},
|
||||
// {
|
||||
// name: 'Workspace',
|
||||
// path: '/workspace',
|
||||
|
||||
@@ -0,0 +1,399 @@
|
||||
/** 电商运营工作台 — 演示数据(与 temp/pdd_dashboard 原型一致,后续可换接口) */
|
||||
|
||||
export type TrendPoint = { date: string; gmv: number; profit: number; refund: number };
|
||||
|
||||
export const GLOBAL_SUMMARY = {
|
||||
periodLabel: '近30天',
|
||||
mom: 18.3,
|
||||
yoy: 42.7,
|
||||
currentStoreName: '优品生活旗舰店',
|
||||
storeRating: 4.87,
|
||||
};
|
||||
|
||||
export const FINANCE_KPIS = [
|
||||
{
|
||||
label: '总GMV',
|
||||
value: '286.4',
|
||||
unit: '万',
|
||||
changePct: 18.3,
|
||||
up: true,
|
||||
sub: '目标250万 · 完成率114.6%',
|
||||
},
|
||||
{
|
||||
label: '实收金额',
|
||||
value: '271.8',
|
||||
unit: '万',
|
||||
changePct: 16.2,
|
||||
up: true,
|
||||
sub: '退款扣减14.6万',
|
||||
},
|
||||
{
|
||||
label: '毛利润',
|
||||
value: '68.2',
|
||||
unit: '万',
|
||||
changePct: 11.5,
|
||||
up: true,
|
||||
sub: '毛利率25.1%',
|
||||
},
|
||||
{
|
||||
label: '净利润',
|
||||
value: '38.9',
|
||||
unit: '万',
|
||||
changePct: 8.7,
|
||||
up: true,
|
||||
sub: '净利率14.3%',
|
||||
},
|
||||
{
|
||||
label: '订单量',
|
||||
value: '18,432',
|
||||
unit: '单',
|
||||
changePct: 22.4,
|
||||
up: true,
|
||||
sub: '日均614单',
|
||||
},
|
||||
{
|
||||
label: '客单价',
|
||||
value: '155.4',
|
||||
unit: '元',
|
||||
changePct: 3.2,
|
||||
up: false,
|
||||
sub: '类目均价142元',
|
||||
},
|
||||
{
|
||||
label: '退款率',
|
||||
value: '5.1',
|
||||
unit: '%',
|
||||
changePct: 0.8,
|
||||
up: false,
|
||||
sub: '类目基准7.2%',
|
||||
},
|
||||
{
|
||||
label: '广告ROI',
|
||||
value: '3.68',
|
||||
unit: ':1',
|
||||
changePct: 0.31,
|
||||
up: true,
|
||||
sub: '广告花费73.8万',
|
||||
},
|
||||
] as const;
|
||||
|
||||
export const GMV_TREND: TrendPoint[] = [
|
||||
{ date: '3/1', gmv: 8.2, profit: 1.05, refund: 0.28 },
|
||||
{ date: '3/2', gmv: 7.9, profit: 0.98, refund: 0.31 },
|
||||
{ date: '3/3', gmv: 9.1, profit: 1.18, refund: 0.26 },
|
||||
{ date: '3/4', gmv: 8.5, profit: 1.02, refund: 0.29 },
|
||||
{ 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/9', gmv: 9.6, profit: 1.25, refund: 0.28 },
|
||||
{ date: '3/10', gmv: 10.5, profit: 1.38, refund: 0.32 },
|
||||
];
|
||||
|
||||
export const COST_STRUCTURE = [
|
||||
{ name: '净利润', value: 68.2, pct: 25.1 },
|
||||
{ name: '商品成本', value: 50.4, pct: 18.5 },
|
||||
{ name: '广告花费', value: 73.8, pct: 27.1 },
|
||||
{ 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 },
|
||||
] as const;
|
||||
|
||||
export const FUNNEL_STEPS = [
|
||||
{ name: 'GMV', value: 286.4 },
|
||||
{ name: '实收金额', value: 271.8 },
|
||||
{ name: '扣除成本', value: 220.4 },
|
||||
{ name: '扣除广告', value: 170.0 },
|
||||
{ name: '扣除佣金', value: 141.4 },
|
||||
{ name: '扣除物流', value: 107.8 },
|
||||
{ name: '毛利润', value: 68.2 },
|
||||
{ name: '净利润', value: 38.9 },
|
||||
] as const;
|
||||
|
||||
/** 漏斗图各层颜色(与 FUNNEL_STEPS 顺序一致) */
|
||||
export const FUNNEL_STAGE_COLORS = [
|
||||
'#ef4444',
|
||||
'#f97316',
|
||||
'#f59e0b',
|
||||
'#eab308',
|
||||
'#84cc16',
|
||||
'#22c55e',
|
||||
'#14b8a6',
|
||||
'#10b981',
|
||||
] as const;
|
||||
|
||||
/** 近12月:柱=GMV(万),折线=净利率(%)— 与原型 HTML 一致 */
|
||||
export const MONTHLY_GMV_NET_RATE = {
|
||||
months: ['4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月', '1月', '2月', '3月'],
|
||||
gmvWan: [168, 194, 282, 156, 172, 188, 201, 486, 218, 183, 248, 286],
|
||||
netRatePct: [12.3, 13.1, 11.8, 12.8, 13.4, 14.1, 13.9, 10.2, 13.8, 14.2, 14.8, 14.3],
|
||||
} as const;
|
||||
|
||||
export const STORES = [
|
||||
{
|
||||
name: '优品生活旗舰店',
|
||||
star: 4.87,
|
||||
color: '#6366f1',
|
||||
gmv: 286.4,
|
||||
orders: 18432,
|
||||
aov: 155.4,
|
||||
grossRate: 25.1,
|
||||
netRate: 14.3,
|
||||
roi: 3.68,
|
||||
refund: 5.1,
|
||||
growth: 18.3,
|
||||
products: [
|
||||
'316不锈钢保温杯-女款',
|
||||
'大容量保温杯-男款',
|
||||
'情侣对杯礼盒',
|
||||
'儿童保温杯卡通款',
|
||||
'保温壶2.5L',
|
||||
'玻璃内胆杯',
|
||||
],
|
||||
},
|
||||
{
|
||||
name: '时尚保温杯专营店',
|
||||
star: 4.68,
|
||||
color: '#f59e0b',
|
||||
gmv: 182.6,
|
||||
orders: 11240,
|
||||
aov: 162.4,
|
||||
grossRate: 22.8,
|
||||
netRate: 11.6,
|
||||
roi: 3.12,
|
||||
refund: 6.8,
|
||||
growth: 12.4,
|
||||
products: [
|
||||
'时尚系列保温杯',
|
||||
'莫兰迪色系杯',
|
||||
'网红ins风水杯',
|
||||
'韩系少女杯',
|
||||
'极简设计师款',
|
||||
],
|
||||
},
|
||||
{
|
||||
name: '户外运动水具店',
|
||||
star: 4.81,
|
||||
color: '#10b981',
|
||||
gmv: 124.8,
|
||||
orders: 7680,
|
||||
aov: 162.5,
|
||||
grossRate: 28.4,
|
||||
netRate: 16.2,
|
||||
roi: 4.21,
|
||||
refund: 3.9,
|
||||
growth: -3.2,
|
||||
products: [
|
||||
'运动健身水壶',
|
||||
'户外登山杯',
|
||||
'骑行专用杯',
|
||||
'越野跑补水包',
|
||||
'户外折叠杯',
|
||||
],
|
||||
},
|
||||
{
|
||||
name: '企业定制旗舰店',
|
||||
star: 4.92,
|
||||
color: '#3b82f6',
|
||||
gmv: 68.4,
|
||||
orders: 2840,
|
||||
aov: 240.8,
|
||||
grossRate: 31.6,
|
||||
netRate: 19.4,
|
||||
roi: 5.14,
|
||||
refund: 2.1,
|
||||
growth: 24.1,
|
||||
products: [
|
||||
'企业LOGO定制杯',
|
||||
'礼品套装定制',
|
||||
'大批量采购款',
|
||||
'高端礼盒定制',
|
||||
'节日专属定制',
|
||||
],
|
||||
},
|
||||
] 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%' },
|
||||
] as const;
|
||||
|
||||
export type TrafficFunnelRow = { label: string; value: string; rate?: string };
|
||||
|
||||
export const TRAFFIC_FUNNEL: TrafficFunnelRow[] = [
|
||||
{ label: '曝光', value: '1,284万' },
|
||||
{ label: '点击', value: '98.6万', rate: '点击率7.68%' },
|
||||
{ label: '加购', value: '24.7万', rate: '加购率25.1%' },
|
||||
{ label: '下单', value: '2.84万', rate: '下单率11.5%' },
|
||||
{ label: '付款', value: '1.84万', rate: '支付率64.8%' },
|
||||
];
|
||||
|
||||
export const TRAFFIC_SOURCES = [
|
||||
{ name: '多多搜索(自然)', pct: 32.4 },
|
||||
{ name: '多多搜索(广告)', pct: 24.8 },
|
||||
{ name: '多多场景推荐', pct: 16.2 },
|
||||
{ name: '活动会场', pct: 12.6 },
|
||||
{ name: '直播带货', pct: 8.4 },
|
||||
{ name: '外部引流', pct: 5.6 },
|
||||
] 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%' },
|
||||
] as const;
|
||||
|
||||
export const AD_KEYWORDS = [
|
||||
{
|
||||
keyword: '保温杯女款大容量',
|
||||
impression: 186_420,
|
||||
click: 14_230,
|
||||
ctr: '7.63%',
|
||||
cost: 16_804,
|
||||
cpc: 1.18,
|
||||
orders: 486,
|
||||
gmv: 75_330,
|
||||
roi: 4.48,
|
||||
status: '优质',
|
||||
statusType: 'success' as const,
|
||||
},
|
||||
{
|
||||
keyword: '不锈钢保温杯',
|
||||
impression: 142_680,
|
||||
click: 10_840,
|
||||
ctr: '7.60%',
|
||||
cost: 12_392,
|
||||
cpc: 1.14,
|
||||
orders: 352,
|
||||
gmv: 52_248,
|
||||
roi: 4.22,
|
||||
status: '优质',
|
||||
statusType: 'success' as const,
|
||||
},
|
||||
{
|
||||
keyword: '316不锈钢杯',
|
||||
impression: 98_320,
|
||||
click: 6920,
|
||||
ctr: '7.04%',
|
||||
cost: 9246,
|
||||
cpc: 1.34,
|
||||
orders: 218,
|
||||
gmv: 32_428,
|
||||
roi: 3.51,
|
||||
status: '良好',
|
||||
statusType: 'processing' as const,
|
||||
},
|
||||
{
|
||||
keyword: '保温杯男生',
|
||||
impression: 74_200,
|
||||
click: 4380,
|
||||
ctr: '5.90%',
|
||||
cost: 6132,
|
||||
cpc: 1.4,
|
||||
orders: 124,
|
||||
gmv: 17_236,
|
||||
roi: 2.81,
|
||||
status: '观察',
|
||||
statusType: 'default' as const,
|
||||
},
|
||||
{
|
||||
keyword: '学生杯子保温',
|
||||
impression: 68_400,
|
||||
click: 3980,
|
||||
ctr: '5.82%',
|
||||
cost: 5970,
|
||||
cpc: 1.5,
|
||||
orders: 98,
|
||||
gmv: 12_740,
|
||||
roi: 2.13,
|
||||
status: '暂停',
|
||||
statusType: 'error' as const,
|
||||
},
|
||||
{
|
||||
keyword: '礼盒保温杯套装',
|
||||
impression: 52_100,
|
||||
click: 2680,
|
||||
ctr: '5.14%',
|
||||
cost: 4824,
|
||||
cpc: 1.8,
|
||||
orders: 88,
|
||||
gmv: 19_272,
|
||||
roi: 3.99,
|
||||
status: '良好',
|
||||
statusType: 'processing' as const,
|
||||
},
|
||||
];
|
||||
|
||||
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 },
|
||||
];
|
||||
|
||||
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 },
|
||||
];
|
||||
|
||||
export const CATEGORY_GMV_SHARE = [
|
||||
{ name: '不锈钢保温杯', value: 142 },
|
||||
{ name: '礼盒套装', value: 68 },
|
||||
{ name: '儿童水杯', value: 42 },
|
||||
{ name: '运动水壶', value: 28 },
|
||||
{ name: '定制企业版', value: 16 },
|
||||
] 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 },
|
||||
] 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%' },
|
||||
];
|
||||
|
||||
export function storeCompareRows() {
|
||||
const rows = STORES.map((s) => ({
|
||||
key: s.name,
|
||||
name: s.name,
|
||||
gmv: s.gmv,
|
||||
orders: s.orders,
|
||||
aov: s.aov,
|
||||
grossRate: s.grossRate,
|
||||
netRate: s.netRate,
|
||||
roi: s.roi,
|
||||
refund: s.refund,
|
||||
growth: s.growth,
|
||||
isAvg: false,
|
||||
}));
|
||||
const n = STORES.length;
|
||||
const avg = {
|
||||
key: 'avg',
|
||||
name: '全店平均',
|
||||
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)),
|
||||
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)),
|
||||
growth: Number((STORES.reduce((a, s) => a + s.growth, 0) / n).toFixed(1)),
|
||||
isAvg: true,
|
||||
};
|
||||
return [...rows, avg];
|
||||
}
|
||||
@@ -0,0 +1,966 @@
|
||||
<script lang="ts" setup>
|
||||
import type { EchartsUIType } from '@vben/plugins/echarts';
|
||||
|
||||
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { $t } from '#/locales';
|
||||
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
Progress,
|
||||
Radio,
|
||||
Table,
|
||||
Tabs,
|
||||
Tag,
|
||||
} from 'ant-design-vue';
|
||||
|
||||
import {
|
||||
AD_KEYWORDS,
|
||||
ADS_KPIS,
|
||||
CATEGORY_GMV_SHARE,
|
||||
COST_STRUCTURE,
|
||||
FINANCE_KPIS,
|
||||
FUNNEL_STAGE_COLORS,
|
||||
FUNNEL_STEPS,
|
||||
GLOBAL_SUMMARY,
|
||||
GMV_TREND,
|
||||
MONTHLY_GMV_NET_RATE,
|
||||
PRODUCT_RANK,
|
||||
PRODUCT_TIME_SEGMENTS,
|
||||
PROMO_TABLE,
|
||||
PROMO_TIMELINE,
|
||||
STORES,
|
||||
TRAFFIC_FUNNEL,
|
||||
TRAFFIC_KPIS,
|
||||
TRAFFIC_SOURCES,
|
||||
storeCompareRows,
|
||||
} from './data';
|
||||
|
||||
defineOptions({ name: 'PddWorkbench' });
|
||||
|
||||
type PeriodKey = 'today' | '7d' | '30d' | '90d' | 'month';
|
||||
|
||||
const activePeriod = ref<PeriodKey>('30d');
|
||||
const activeTab = ref('finance');
|
||||
const selectedStoreIndex = ref(0);
|
||||
|
||||
const financeChartRef = ref<EchartsUIType>();
|
||||
const { renderEcharts: renderFinanceTrend } = useEcharts(financeChartRef);
|
||||
|
||||
const funnelChartRef = ref<EchartsUIType>();
|
||||
const { renderEcharts: renderFunnelChart } = useEcharts(funnelChartRef);
|
||||
|
||||
const monthlyChartRef = ref<EchartsUIType>();
|
||||
const { renderEcharts: renderMonthlyChart } = useEcharts(monthlyChartRef);
|
||||
|
||||
const compareDataSource = computed(() => storeCompareRows());
|
||||
|
||||
const selectedStore = computed(() => STORES[selectedStoreIndex.value]!);
|
||||
|
||||
const storeMiniKpis = computed(() => {
|
||||
const s = selectedStore.value;
|
||||
return [
|
||||
{ label: 'GMV', value: `${s.gmv}万`, extra: `${s.growth >= 0 ? '▲' : '▼'}${Math.abs(s.growth)}%`, up: s.growth >= 0 },
|
||||
{ label: '订单数', value: `${s.orders.toLocaleString()}单` },
|
||||
{ label: '客单价', value: `${s.aov}元` },
|
||||
{ label: '毛利率', value: `${s.grossRate}%` },
|
||||
{ label: '净利率', value: `${s.netRate}%` },
|
||||
{ label: '广告ROI', value: `${s.roi}:1` },
|
||||
];
|
||||
});
|
||||
|
||||
const costTotal = computed(() =>
|
||||
COST_STRUCTURE.reduce((a, x) => a + x.value, 0),
|
||||
);
|
||||
|
||||
const keywordColumnsSimple = [
|
||||
{ title: '关键词', dataIndex: 'keyword', key: 'keyword', ellipsis: true },
|
||||
{ title: '曝光量', dataIndex: 'impression', key: 'impression' },
|
||||
{ title: '点击量', dataIndex: 'click', key: 'click' },
|
||||
{ title: '点击率', dataIndex: 'ctr', key: 'ctr' },
|
||||
{ title: '花费(元)', dataIndex: 'cost', key: 'cost' },
|
||||
{ title: 'CPC', dataIndex: 'cpc', key: 'cpc' },
|
||||
{ title: '订单数', dataIndex: 'orders', key: 'orders' },
|
||||
{ title: 'GMV(元)', dataIndex: 'gmv', key: 'gmv' },
|
||||
{ title: 'ROI', dataIndex: 'roi', key: 'roi' },
|
||||
{ title: '状态', key: 'status', dataIndex: 'status' },
|
||||
];
|
||||
|
||||
const productColumns = [
|
||||
{ title: '排名', dataIndex: 'rank', key: 'rank', width: 64 },
|
||||
{ title: '商品名称', dataIndex: 'name', key: 'name', ellipsis: true },
|
||||
{ title: 'SKU数', dataIndex: 'sku', key: 'sku', width: 72 },
|
||||
{ title: '售价(元)', dataIndex: 'price', key: 'price', width: 96 },
|
||||
{ title: '销量', dataIndex: 'sales', key: 'sales', width: 88 },
|
||||
{ title: 'GMV(万)', dataIndex: 'gmv', key: 'gmv', width: 96 },
|
||||
{ title: 'GMV占比', key: 'pct', dataIndex: 'pct', width: 140 },
|
||||
{ title: '毛利率', dataIndex: 'margin', key: 'margin', width: 88 },
|
||||
{ title: '退款率', dataIndex: 'refund', key: 'refund', width: 88 },
|
||||
{ title: '转化率', dataIndex: 'cvr', key: 'cvr', width: 88 },
|
||||
{ title: '趋势', key: 'trend', width: 100 },
|
||||
];
|
||||
|
||||
const promoColumns = [
|
||||
{ title: '活动名称', dataIndex: 'name', key: 'name' },
|
||||
{ title: '活动时间', dataIndex: 'period', key: 'period', width: 130 },
|
||||
{ title: '目标GMV', dataIndex: 'targetGmv', key: 'targetGmv', width: 96 },
|
||||
{ title: '实际GMV', dataIndex: 'actualGmv', key: 'actualGmv', width: 96 },
|
||||
{ title: '完成率', dataIndex: 'rate', key: 'rate', width: 88 },
|
||||
{ title: '广告花费', dataIndex: 'adCost', key: 'adCost', width: 96 },
|
||||
{ title: 'ROI', dataIndex: 'roi', key: 'roi', width: 72 },
|
||||
{ title: '毛利率', dataIndex: 'gross', key: 'gross', width: 88 },
|
||||
{ title: '退款率', dataIndex: 'refund', key: 'refund', width: 88 },
|
||||
{ title: '新客占比', dataIndex: 'newUser', key: 'newUser', width: 96 },
|
||||
];
|
||||
|
||||
const compareColumns = [
|
||||
{ title: '店铺名称', dataIndex: 'name', key: 'name', ellipsis: true },
|
||||
{ title: 'GMV(万)', dataIndex: 'gmv', key: 'gmv', width: 100 },
|
||||
{ title: '订单数', dataIndex: 'orders', key: 'orders', width: 110 },
|
||||
{ title: '客单价(元)', dataIndex: 'aov', key: 'aov', width: 110 },
|
||||
{ title: '毛利率', key: 'grossRate', dataIndex: 'grossRate', width: 88 },
|
||||
{ title: '净利率', dataIndex: 'netRate', key: 'netRate', width: 88 },
|
||||
{ title: '广告ROI', dataIndex: 'roi', key: 'roi', width: 96 },
|
||||
{ title: '退款率', dataIndex: 'refund', key: 'refund', width: 88 },
|
||||
{ title: 'GMV环比', key: 'growth', dataIndex: 'growth', width: 110 },
|
||||
];
|
||||
|
||||
const productTimeColumns = [
|
||||
{ title: '产品名称', dataIndex: 'product', key: 'product', ellipsis: true },
|
||||
{ title: '第1段', dataIndex: 'w1', key: 'w1' },
|
||||
{ title: '第2段', dataIndex: 'w2', key: 'w2' },
|
||||
{ title: '第3段', dataIndex: 'w3', key: 'w3' },
|
||||
{ title: '第4段', dataIndex: 'w4', key: 'w4' },
|
||||
{ title: '区间合计', dataIndex: 'total', key: 'total' },
|
||||
{ title: '趋势', key: 'up', dataIndex: 'up', width: 88 },
|
||||
];
|
||||
|
||||
const drawFinanceTrend = () => {
|
||||
if (!financeChartRef.value) return;
|
||||
const isDark = document.documentElement.classList.contains('dark');
|
||||
const axisLabel = isDark ? 'hsl(240deg 5% 64.9%)' : '#64748b';
|
||||
const split = isDark ? 'hsl(240deg 3.7% 22%)' : '#f1f5f9';
|
||||
|
||||
renderFinanceTrend({
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
backgroundColor: isDark ? 'hsl(222.34deg 10.43% 12.27%)' : '#fff',
|
||||
textStyle: { color: isDark ? 'hsl(0deg 0% 95%)' : '#0f172a' },
|
||||
},
|
||||
legend: {
|
||||
top: 0,
|
||||
textStyle: { color: axisLabel },
|
||||
data: ['GMV(万)', '净利润(万)', '退款(万)'],
|
||||
},
|
||||
grid: { left: '3%', right: '3%', bottom: '3%', top: 48, containLabel: true },
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: GMV_TREND.map((d) => d.date),
|
||||
axisLine: { lineStyle: { color: split } },
|
||||
axisLabel: { color: axisLabel, fontSize: 11 },
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
splitLine: { lineStyle: { type: 'dashed', color: split } },
|
||||
axisLabel: { color: axisLabel },
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: 'GMV(万)',
|
||||
type: 'bar',
|
||||
data: GMV_TREND.map((d) => d.gmv),
|
||||
barMaxWidth: 14,
|
||||
itemStyle: {
|
||||
color: {
|
||||
type: 'linear',
|
||||
x: 0,
|
||||
y: 0,
|
||||
x2: 0,
|
||||
y2: 1,
|
||||
colorStops: [
|
||||
{ offset: 0, color: '#6366f1' },
|
||||
{ offset: 1, color: 'rgba(99, 102, 241, 0.25)' },
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: '净利润(万)',
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
symbolSize: 6,
|
||||
data: GMV_TREND.map((d) => d.profit),
|
||||
lineStyle: { width: 2.5, color: '#10b981' },
|
||||
itemStyle: { color: '#10b981' },
|
||||
},
|
||||
{
|
||||
name: '退款(万)',
|
||||
type: 'bar',
|
||||
data: GMV_TREND.map((d) => d.refund),
|
||||
barMaxWidth: 8,
|
||||
itemStyle: { color: 'rgba(148, 163, 184, 0.55)' },
|
||||
},
|
||||
],
|
||||
});
|
||||
};
|
||||
|
||||
const drawFunnel = () => {
|
||||
if (!funnelChartRef.value) return;
|
||||
const isDark = document.documentElement.classList.contains('dark');
|
||||
const border = isDark ? 'hsl(222.34deg 10.43% 12.27%)' : '#fff';
|
||||
|
||||
renderFunnelChart({
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
backgroundColor: isDark ? 'hsl(222.34deg 10.43% 12.27%)' : '#fff',
|
||||
textStyle: { color: isDark ? 'hsl(0deg 0% 95%)' : '#0f172a' },
|
||||
formatter: '{b}: <b>{c}</b> 万元',
|
||||
},
|
||||
series: [
|
||||
{
|
||||
type: 'funnel',
|
||||
left: '6%',
|
||||
width: '88%',
|
||||
top: 16,
|
||||
bottom: 8,
|
||||
minSize: '8%',
|
||||
maxSize: '100%',
|
||||
sort: 'descending',
|
||||
gap: 2,
|
||||
label: {
|
||||
show: true,
|
||||
position: 'inside',
|
||||
formatter: '{b}\n{c}万',
|
||||
color: '#fff',
|
||||
fontSize: 11,
|
||||
fontWeight: 700,
|
||||
},
|
||||
labelLine: { show: false },
|
||||
itemStyle: {
|
||||
borderColor: border,
|
||||
borderWidth: 2,
|
||||
},
|
||||
data: FUNNEL_STEPS.map((s, i) => ({
|
||||
name: s.name,
|
||||
value: s.value,
|
||||
itemStyle: {
|
||||
color: FUNNEL_STAGE_COLORS[i] ?? '#6366f1',
|
||||
},
|
||||
})),
|
||||
},
|
||||
],
|
||||
});
|
||||
};
|
||||
|
||||
const drawMonthlyGmvNetRate = () => {
|
||||
if (!monthlyChartRef.value) return;
|
||||
const isDark = document.documentElement.classList.contains('dark');
|
||||
const axisLabel = isDark ? 'hsl(240deg 5% 64.9%)' : '#64748b';
|
||||
const split = isDark ? 'hsl(240deg 3.7% 22%)' : '#f1f5f9';
|
||||
|
||||
renderMonthlyChart({
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
backgroundColor: isDark ? 'hsl(222.34deg 10.43% 12.27%)' : '#fff',
|
||||
textStyle: { color: isDark ? 'hsl(0deg 0% 95%)' : '#0f172a' },
|
||||
},
|
||||
legend: {
|
||||
top: 0,
|
||||
textStyle: { color: axisLabel },
|
||||
data: ['月GMV(万)', '净利率(%)'],
|
||||
},
|
||||
grid: { left: '3%', right: '3%', bottom: '3%', top: 48, containLabel: true },
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: [...MONTHLY_GMV_NET_RATE.months],
|
||||
axisLine: { lineStyle: { color: split } },
|
||||
axisLabel: { color: axisLabel, fontSize: 11 },
|
||||
},
|
||||
yAxis: [
|
||||
{
|
||||
type: 'value',
|
||||
name: 'GMV(万)',
|
||||
nameTextStyle: { color: axisLabel },
|
||||
splitLine: { lineStyle: { type: 'dashed', color: split } },
|
||||
axisLabel: { color: axisLabel },
|
||||
},
|
||||
{
|
||||
type: 'value',
|
||||
name: '净利率%',
|
||||
min: 8,
|
||||
max: 20,
|
||||
position: 'right',
|
||||
nameTextStyle: { color: axisLabel },
|
||||
axisLabel: {
|
||||
color: axisLabel,
|
||||
formatter: '{value}%',
|
||||
},
|
||||
splitLine: { show: false },
|
||||
},
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: '月GMV(万)',
|
||||
type: 'bar',
|
||||
data: [...MONTHLY_GMV_NET_RATE.gmvWan],
|
||||
barMaxWidth: 22,
|
||||
itemStyle: {
|
||||
color: {
|
||||
type: 'linear',
|
||||
x: 0,
|
||||
y: 0,
|
||||
x2: 0,
|
||||
y2: 1,
|
||||
colorStops: [
|
||||
{ offset: 0, color: '#6366f1' },
|
||||
{ offset: 1, color: 'rgba(99, 102, 241, 0.35)' },
|
||||
],
|
||||
},
|
||||
},
|
||||
markPoint: {
|
||||
data: [{ type: 'max', name: '峰值' }],
|
||||
itemStyle: { color: '#f59e0b' },
|
||||
},
|
||||
},
|
||||
{
|
||||
name: '净利率(%)',
|
||||
type: 'line',
|
||||
yAxisIndex: 1,
|
||||
smooth: true,
|
||||
symbolSize: 6,
|
||||
data: [...MONTHLY_GMV_NET_RATE.netRatePct],
|
||||
lineStyle: { width: 2.5, color: '#10b981' },
|
||||
itemStyle: { color: '#10b981' },
|
||||
},
|
||||
],
|
||||
});
|
||||
};
|
||||
|
||||
const rerenderFinanceCharts = async () => {
|
||||
await nextTick();
|
||||
drawFinanceTrend();
|
||||
drawFunnel();
|
||||
drawMonthlyGmvNetRate();
|
||||
};
|
||||
|
||||
watch(activeTab, (k) => {
|
||||
if (k === 'finance') {
|
||||
setTimeout(() => rerenderFinanceCharts(), 80);
|
||||
}
|
||||
});
|
||||
|
||||
let darkObserver: MutationObserver | null = null;
|
||||
|
||||
onMounted(() => {
|
||||
setTimeout(() => rerenderFinanceCharts(), 120);
|
||||
darkObserver = new MutationObserver(() => {
|
||||
if (activeTab.value === 'finance') {
|
||||
rerenderFinanceCharts();
|
||||
}
|
||||
});
|
||||
darkObserver.observe(document.documentElement, {
|
||||
attributes: true,
|
||||
attributeFilter: ['class'],
|
||||
});
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
darkObserver?.disconnect();
|
||||
darkObserver = null;
|
||||
});
|
||||
|
||||
const periodBtnClass = (key: PeriodKey) =>
|
||||
activePeriod.value === key
|
||||
? '!bg-white !text-blue-600 dark:!bg-blue-900/30 dark:!text-blue-400 !shadow-sm dark:!shadow-none'
|
||||
: '!bg-transparent !text-slate-600 dark:!bg-[hsl(222.34deg_10.43%_12.27%/50%)] dark:!text-[hsl(240deg_5%_64.9%)] hover:!bg-[hsl(240deg_3.7%_22%)]';
|
||||
|
||||
const kpiCardClass =
|
||||
'rounded-2xl border border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] bg-white/90 dark:bg-[hsl(222.34deg_10.43%_12.27%)] p-5 shadow-[0_4px_12px_rgba(0,0,0,0.03)] dark:shadow-none backdrop-blur-[10px] sm:p-6';
|
||||
|
||||
const panelCardClass =
|
||||
'rounded-2xl border border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] bg-white/90 dark:bg-[hsl(222.34deg_10.43%_12.27%)] p-6 shadow-[0_4px_12px_rgba(0,0,0,0.03)] dark:shadow-none backdrop-blur-[10px]';
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page
|
||||
auto-content-height
|
||||
class="bg-[#f8fafc] dark:bg-[hsl(222.34deg_10.43%_12.27%)]"
|
||||
content-padding-class="px-4 pb-4"
|
||||
header-class="workbench-page-header"
|
||||
>
|
||||
<template #title>
|
||||
<div
|
||||
class="text-xl font-black tracking-tight text-slate-900 dark:text-[hsl(0deg_0%_98%)] sm:text-2xl md:text-3xl"
|
||||
>
|
||||
{{ $t('page.dashboard.workbench') }}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #description>
|
||||
<span class="text-sm text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||
多店铺 · 多维度经营数据(演示数据,接口就绪后可替换)
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<template #extra>
|
||||
<div
|
||||
class="flex w-full max-w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center sm:gap-3"
|
||||
>
|
||||
<div
|
||||
class="flex flex-wrap items-center gap-2 rounded-2xl border border-slate-200 bg-slate-200/50 px-2 py-1.5 dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%/30%)]"
|
||||
>
|
||||
<Tag color="blue">{{ GLOBAL_SUMMARY.currentStoreName }}</Tag>
|
||||
<span class="text-xs font-bold text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||
评分 {{ GLOBAL_SUMMARY.storeRating }}
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="flex w-full flex-wrap items-center gap-1 rounded-2xl border border-slate-200 bg-slate-200/50 p-1.5 dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%/30%)] sm:w-auto"
|
||||
>
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
class="!h-auto !min-w-0 !rounded-xl !border-none !px-3 !py-2 !text-sm !font-bold !shadow-none sm:!px-4"
|
||||
:class="periodBtnClass('today')"
|
||||
@click="activePeriod = 'today'"
|
||||
>
|
||||
今日
|
||||
</Button>
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
class="!h-auto !min-w-0 !rounded-xl !border-none !px-3 !py-2 !text-sm !font-bold !shadow-none sm:!px-4"
|
||||
:class="periodBtnClass('7d')"
|
||||
@click="activePeriod = '7d'"
|
||||
>
|
||||
近7天
|
||||
</Button>
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
class="!h-auto !min-w-0 !rounded-xl !border-none !px-3 !py-2 !text-sm !font-bold !shadow-none sm:!px-4"
|
||||
:class="periodBtnClass('30d')"
|
||||
@click="activePeriod = '30d'"
|
||||
>
|
||||
近30天
|
||||
</Button>
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
class="!h-auto !min-w-0 !rounded-xl !border-none !px-3 !py-2 !text-sm !font-bold !shadow-none sm:!px-4"
|
||||
:class="periodBtnClass('90d')"
|
||||
@click="activePeriod = '90d'"
|
||||
>
|
||||
近90天
|
||||
</Button>
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
class="!h-auto !min-w-0 !rounded-xl !border-none !px-3 !py-2 !text-sm !font-bold !shadow-none sm:!px-4"
|
||||
:class="periodBtnClass('month')"
|
||||
@click="activePeriod = 'month'"
|
||||
>
|
||||
本月
|
||||
</Button>
|
||||
</div>
|
||||
<div
|
||||
class="text-xs font-bold text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
>
|
||||
环比
|
||||
<span class="text-emerald-600 dark:text-emerald-400">+{{ GLOBAL_SUMMARY.mom }}%</span>
|
||||
· 同比
|
||||
<span class="text-emerald-600 dark:text-emerald-400">+{{ GLOBAL_SUMMARY.yoy }}%</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div class="workbench-page-body min-w-0">
|
||||
<Tabs v-model:activeKey="activeTab" class="workbench-tabs">
|
||||
<Tabs.TabPane key="finance" tab="财务概览">
|
||||
<div class="mt-4 space-y-6">
|
||||
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4">
|
||||
<div v-for="(kpi, idx) in FINANCE_KPIS" :key="idx" :class="kpiCardClass">
|
||||
<div class="mb-3 flex items-start justify-between gap-2">
|
||||
<span
|
||||
class="text-xs font-black text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
>
|
||||
{{ kpi.label }}
|
||||
</span>
|
||||
<span
|
||||
class="shrink-0 rounded-lg px-2 py-0.5 text-xs font-bold"
|
||||
:class="
|
||||
kpi.up
|
||||
? 'bg-emerald-50 text-emerald-700 dark:bg-emerald-900/25 dark:text-emerald-400'
|
||||
: 'bg-red-50 text-red-600 dark:bg-red-900/25 dark:text-red-400'
|
||||
"
|
||||
>
|
||||
{{ kpi.up ? '▲' : '▼' }}{{ kpi.changePct }}{{ kpi.label === '广告ROI' ? '' : '%' }}
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="text-3xl font-black leading-none text-slate-900 dark:text-[hsl(0deg_0%_95%)] sm:text-4xl"
|
||||
>
|
||||
{{ kpi.value
|
||||
}}<span
|
||||
v-if="kpi.unit"
|
||||
class="ml-1 text-base font-bold text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
>{{ kpi.unit }}</span>
|
||||
</div>
|
||||
<div
|
||||
class="mt-4 border-t border-slate-100 pt-3 text-xs font-bold text-slate-400 dark:border-[hsl(240deg_3.7%_22%)] dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
>
|
||||
{{ kpi.sub }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 gap-6 xl:grid-cols-2">
|
||||
<div :class="panelCardClass">
|
||||
<h3 class="mb-1 text-lg font-black text-slate-800 dark:text-[hsl(0deg_0%_95%)]">
|
||||
GMV 与净利润趋势
|
||||
</h3>
|
||||
<p class="mb-4 text-xs font-bold text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||
柱=GMV,线=净利润,灰柱=退款(示例区间)
|
||||
</p>
|
||||
<div class="h-[280px] w-full">
|
||||
<EchartsUI ref="financeChartRef" />
|
||||
</div>
|
||||
</div>
|
||||
<div :class="panelCardClass">
|
||||
<h3 class="mb-1 text-lg font-black text-slate-800 dark:text-[hsl(0deg_0%_95%)]">
|
||||
成本结构拆解(占实收比例示意)
|
||||
</h3>
|
||||
<p class="mb-4 text-xs font-bold text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||
合计约 {{ costTotal.toFixed(1) }} 万 · 各分项来自原型看板
|
||||
</p>
|
||||
<div class="space-y-3">
|
||||
<div v-for="row in COST_STRUCTURE" :key="row.name">
|
||||
<div class="mb-1 flex justify-between text-xs font-bold">
|
||||
<span class="text-slate-600 dark:text-[hsl(240deg_5%_64.9%)]">{{ row.name }}</span>
|
||||
<span class="text-slate-900 dark:text-[hsl(0deg_0%_95%)]">{{ row.value }}万 · {{ row.pct }}%</span>
|
||||
</div>
|
||||
<Progress
|
||||
:percent="row.pct"
|
||||
:show-info="false"
|
||||
stroke-color="#6366f1"
|
||||
trail-color="rgba(148,163,184,0.25)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div :class="panelCardClass">
|
||||
<h3 class="mb-1 text-lg font-black text-slate-800 dark:text-[hsl(0deg_0%_95%)]">
|
||||
利润漏斗(万元)
|
||||
</h3>
|
||||
<p class="mb-4 text-xs font-bold text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||
从 GMV 到净利润全链路拆解
|
||||
</p>
|
||||
<div class="h-[380px] w-full sm:h-[400px]">
|
||||
<EchartsUI ref="funnelChartRef" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div :class="panelCardClass">
|
||||
<h3 class="mb-1 text-lg font-black text-slate-800 dark:text-[hsl(0deg_0%_95%)]">
|
||||
月度 GMV & 净利率环比
|
||||
</h3>
|
||||
<p class="mb-4 text-xs font-bold text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||
柱=月 GMV(万),折线=净利率(%)· 近12月
|
||||
</p>
|
||||
<div class="h-[300px] w-full sm:h-[320px]">
|
||||
<EchartsUI ref="monthlyChartRef" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Tabs.TabPane>
|
||||
|
||||
<Tabs.TabPane key="multi" tab="多维分析">
|
||||
<div class="mt-4 space-y-6">
|
||||
<div :class="panelCardClass">
|
||||
<div class="mb-4 text-xs font-black uppercase tracking-wide text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||
选择店铺
|
||||
</div>
|
||||
<Radio.Group v-model:value="selectedStoreIndex" button-style="solid" class="w-full">
|
||||
<Radio.Button
|
||||
v-for="(s, i) in STORES"
|
||||
:key="s.name"
|
||||
:value="i"
|
||||
class="!mb-2"
|
||||
>
|
||||
{{ s.name }}({{ s.star }})
|
||||
</Radio.Button>
|
||||
</Radio.Group>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 gap-3 md:grid-cols-3 xl:grid-cols-6">
|
||||
<div
|
||||
v-for="(m, i) in storeMiniKpis"
|
||||
:key="i"
|
||||
:class="kpiCardClass + ' !p-4'"
|
||||
>
|
||||
<div class="text-[10px] font-black text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||
{{ m.label }}
|
||||
</div>
|
||||
<div class="mt-1 text-lg font-black text-slate-900 dark:text-[hsl(0deg_0%_95%)]">
|
||||
{{ m.value }}
|
||||
</div>
|
||||
<div
|
||||
v-if="m.extra"
|
||||
class="mt-1 text-[10px] font-bold"
|
||||
:class="m.up ? 'text-emerald-600' : 'text-red-500'"
|
||||
>
|
||||
{{ m.extra }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div :class="panelCardClass">
|
||||
<h3 class="mb-4 text-lg font-black text-slate-800 dark:text-[hsl(0deg_0%_95%)]">
|
||||
跨店铺核心指标对比
|
||||
</h3>
|
||||
<Table
|
||||
size="small"
|
||||
:pagination="false"
|
||||
:columns="compareColumns"
|
||||
:data-source="compareDataSource"
|
||||
:row-class-name="(r) => (r.isAvg ? 'bg-slate-50 dark:bg-[hsl(240deg_3.7%_15.9%/40%)]' : '')"
|
||||
scroll-x
|
||||
>
|
||||
<template #bodyCell="{ column, record, text }">
|
||||
<template v-if="column.key === 'growth' && !record.isAvg">
|
||||
<Tag :color="text >= 0 ? 'success' : 'error'">
|
||||
{{ text >= 0 ? '▲' : '▼' }}{{ Math.abs(text) }}%
|
||||
</Tag>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'growth' && record.isAvg">
|
||||
{{ text }}%
|
||||
</template>
|
||||
<template v-else-if="column.key === 'grossRate' || column.key === 'netRate'">
|
||||
{{ text }}%
|
||||
</template>
|
||||
<template v-else-if="column.key === 'refund'">
|
||||
{{ text }}%
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ text }}
|
||||
</template>
|
||||
</template>
|
||||
</Table>
|
||||
</div>
|
||||
|
||||
<div :class="panelCardClass">
|
||||
<h3 class="mb-1 text-lg font-black text-slate-800 dark:text-[hsl(0deg_0%_95%)]">
|
||||
产品 × 时间段明细(示例)
|
||||
</h3>
|
||||
<p class="mb-4 text-xs text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||
{{ selectedStore.name }} · 近30天
|
||||
</p>
|
||||
<Table
|
||||
size="small"
|
||||
:pagination="false"
|
||||
:columns="productTimeColumns"
|
||||
:data-source="[...PRODUCT_TIME_SEGMENTS]"
|
||||
row-key="product"
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'up'">
|
||||
<Tag :color="record.up ? 'success' : 'error'">
|
||||
{{ record.up ? '↗ 上升' : '↘ 下降' }}
|
||||
</Tag>
|
||||
</template>
|
||||
</template>
|
||||
</Table>
|
||||
</div>
|
||||
</div>
|
||||
</Tabs.TabPane>
|
||||
|
||||
<Tabs.TabPane key="traffic" tab="流量分析">
|
||||
<div class="mt-4 space-y-6">
|
||||
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4">
|
||||
<div v-for="(kpi, idx) in TRAFFIC_KPIS" :key="idx" :class="kpiCardClass">
|
||||
<div class="mb-2 text-xs font-black text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||
{{ kpi.label }}
|
||||
</div>
|
||||
<div class="text-3xl font-black text-slate-900 dark:text-[hsl(0deg_0%_95%)]">
|
||||
{{ kpi.value }}<span class="text-base font-bold text-slate-400">{{ kpi.unit }}</span>
|
||||
</div>
|
||||
<div class="mt-3 flex justify-between text-xs font-bold">
|
||||
<span
|
||||
:class="kpi.up ? 'text-emerald-600' : 'text-red-500'"
|
||||
>{{ kpi.up ? '▲' : '▼' }}{{ kpi.changePct }}%</span>
|
||||
<span class="text-slate-400">{{ kpi.sub }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="grid grid-cols-2 gap-px overflow-hidden rounded-2xl border border-slate-200 bg-slate-200 dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_22%)] lg:grid-cols-5"
|
||||
>
|
||||
<div
|
||||
v-for="(f, i) in TRAFFIC_FUNNEL"
|
||||
:key="i"
|
||||
class="bg-white/95 p-4 text-center dark:bg-[hsl(222.34deg_10.43%_12.27%)]"
|
||||
>
|
||||
<div class="text-lg font-black text-slate-900 dark:text-[hsl(0deg_0%_95%)]">
|
||||
{{ f.value }}
|
||||
</div>
|
||||
<div class="mt-1 text-[10px] font-bold text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||
{{ f.label }}
|
||||
</div>
|
||||
<div
|
||||
v-if="f.rate"
|
||||
class="mt-1 text-[10px] font-bold text-emerald-600 dark:text-emerald-400"
|
||||
>
|
||||
{{ f.rate }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div :class="panelCardClass">
|
||||
<h3 class="mb-4 text-lg font-black text-slate-800 dark:text-[hsl(0deg_0%_95%)]">
|
||||
流量来源结构(UV 占比 %)
|
||||
</h3>
|
||||
<div class="grid grid-cols-1 gap-3 sm:grid-cols-2">
|
||||
<div
|
||||
v-for="src in TRAFFIC_SOURCES"
|
||||
:key="src.name"
|
||||
class="flex items-center gap-3"
|
||||
>
|
||||
<span class="w-[140px] shrink-0 truncate text-xs font-bold text-slate-600 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||
{{ src.name }}
|
||||
</span>
|
||||
<Progress :percent="src.pct" :format="(p) => `${p}%`" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Tabs.TabPane>
|
||||
|
||||
<Tabs.TabPane key="ads" tab="广告投放">
|
||||
<div class="mt-4 space-y-6">
|
||||
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4">
|
||||
<div v-for="(kpi, idx) in ADS_KPIS" :key="idx" :class="kpiCardClass">
|
||||
<div class="mb-2 text-xs font-black text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||
{{ kpi.label }}
|
||||
</div>
|
||||
<div class="text-3xl font-black text-slate-900 dark:text-[hsl(0deg_0%_95%)]">
|
||||
{{ kpi.value }}<span class="text-base font-bold text-slate-400">{{ kpi.unit }}</span>
|
||||
</div>
|
||||
<div class="mt-3 flex justify-between text-xs font-bold">
|
||||
<span class="text-emerald-600">▲{{ kpi.changePct }}{{ kpi.label.includes('率') ? '%' : '%' }}</span>
|
||||
<span class="text-slate-400">{{ kpi.sub }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Card
|
||||
:bordered="false"
|
||||
class="!rounded-2xl !border !border-slate-200 !shadow-[0_4px_12px_rgba(0,0,0,0.03)] dark:!border-[hsl(240deg_3.7%_22%)] dark:!bg-[hsl(222.34deg_10.43%_12.27%)] dark:!shadow-none"
|
||||
title="TOP 关键词 ROI 明细"
|
||||
>
|
||||
<Table
|
||||
size="small"
|
||||
:pagination="{ pageSize: 8 }"
|
||||
:columns="keywordColumnsSimple"
|
||||
:data-source="AD_KEYWORDS"
|
||||
row-key="keyword"
|
||||
scroll-x
|
||||
>
|
||||
<template #bodyCell="{ column, text }">
|
||||
<template v-if="column.key === 'roi'">
|
||||
<span
|
||||
class="font-black"
|
||||
:class="
|
||||
text >= 4
|
||||
? 'text-emerald-600'
|
||||
: text >= 3
|
||||
? 'text-amber-600'
|
||||
: 'text-red-500'
|
||||
"
|
||||
>{{ text }}</span>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'status'">
|
||||
<Tag
|
||||
:color="
|
||||
text === '优质'
|
||||
? 'success'
|
||||
: text === '良好'
|
||||
? 'processing'
|
||||
: text === '观察'
|
||||
? 'default'
|
||||
: 'error'
|
||||
"
|
||||
>
|
||||
{{ text }}
|
||||
</Tag>
|
||||
</template>
|
||||
</template>
|
||||
</Table>
|
||||
</Card>
|
||||
</div>
|
||||
</Tabs.TabPane>
|
||||
|
||||
<Tabs.TabPane key="products" tab="商品排行">
|
||||
<div class="mt-4 grid grid-cols-1 gap-6 xl:grid-cols-2">
|
||||
<div :class="panelCardClass">
|
||||
<h3 class="mb-4 text-lg font-black text-slate-800 dark:text-[hsl(0deg_0%_95%)]">
|
||||
品类 GMV 占比
|
||||
</h3>
|
||||
<div class="space-y-3">
|
||||
<div v-for="c in CATEGORY_GMV_SHARE" :key="c.name">
|
||||
<div class="mb-1 flex justify-between text-xs font-bold">
|
||||
<span>{{ c.name }}</span>
|
||||
<span>{{ c.value }}万</span>
|
||||
</div>
|
||||
<Progress
|
||||
:percent="Math.round((c.value / 296) * 100)"
|
||||
:format="(p) => `${p}%`"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div :class="panelCardClass + ' xl:col-span-1'">
|
||||
<h3 class="mb-4 text-lg font-black text-slate-800 dark:text-[hsl(0deg_0%_95%)]">
|
||||
TOP 商品明细
|
||||
</h3>
|
||||
<Table
|
||||
size="small"
|
||||
:pagination="{ pageSize: 8 }"
|
||||
:columns="productColumns"
|
||||
:data-source="PRODUCT_RANK"
|
||||
row-key="rank"
|
||||
scroll-x
|
||||
>
|
||||
<template #bodyCell="{ column, record, text }">
|
||||
<template v-if="column.key === 'pct'">
|
||||
<div class="flex items-center gap-2">
|
||||
<Progress
|
||||
:percent="Math.round((record.gmv / 36.4) * 100)"
|
||||
size="small"
|
||||
:show-info="false"
|
||||
class="!m-0 flex-1"
|
||||
/>
|
||||
<span class="text-xs font-bold text-slate-500">{{ text }}%</span>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'margin' || column.key === 'refund' || column.key === 'cvr'">
|
||||
{{ text }}%
|
||||
</template>
|
||||
<template v-else-if="column.key === 'trend'">
|
||||
<Tag :color="record.trendUp ? 'success' : 'error'">
|
||||
{{ record.trendUp ? '▲' : '▼' }}{{ record.trendPct }}%
|
||||
</Tag>
|
||||
</template>
|
||||
</template>
|
||||
</Table>
|
||||
</div>
|
||||
</div>
|
||||
</Tabs.TabPane>
|
||||
|
||||
<Tabs.TabPane key="promotions" tab="活动复盘">
|
||||
<div class="mt-4 space-y-6">
|
||||
<div :class="panelCardClass">
|
||||
<h3 class="mb-4 text-lg font-black text-slate-800 dark:text-[hsl(0deg_0%_95%)]">
|
||||
活动日历与复盘
|
||||
</h3>
|
||||
<div class="space-y-3">
|
||||
<div
|
||||
v-for="(p, i) in PROMO_TIMELINE"
|
||||
:key="i"
|
||||
class="flex flex-col gap-2 rounded-xl border border-slate-100 bg-slate-50/80 p-4 dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%/30%)] sm:flex-row sm:items-center sm:justify-between"
|
||||
>
|
||||
<div class="flex gap-4">
|
||||
<div
|
||||
class="flex h-12 w-12 shrink-0 items-center justify-center rounded-xl bg-white text-sm font-black text-indigo-600 shadow-sm dark:bg-[hsl(222.34deg_10.43%_18%)] dark:text-indigo-400"
|
||||
>
|
||||
{{ p.date }}
|
||||
</div>
|
||||
<div>
|
||||
<div class="font-black text-slate-900 dark:text-[hsl(0deg_0%_95%)]">
|
||||
{{ p.name }}
|
||||
</div>
|
||||
<div class="mt-0.5 text-xs font-bold text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||
{{ p.meta }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-3 sm:text-right">
|
||||
<div>
|
||||
<div class="text-base font-black text-amber-600 dark:text-amber-400">
|
||||
{{ p.gmv }}
|
||||
</div>
|
||||
<div class="text-xs text-slate-400">{{ p.target }}</div>
|
||||
</div>
|
||||
<Tag
|
||||
:color="
|
||||
p.tone === 'success'
|
||||
? 'success'
|
||||
: p.tone === 'processing'
|
||||
? 'processing'
|
||||
: 'warning'
|
||||
"
|
||||
>
|
||||
{{ p.status }}
|
||||
</Tag>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div :class="panelCardClass">
|
||||
<h3 class="mb-4 text-lg font-black text-slate-800 dark:text-[hsl(0deg_0%_95%)]">
|
||||
活动核心指标汇总
|
||||
</h3>
|
||||
<Table
|
||||
size="small"
|
||||
:pagination="false"
|
||||
:columns="promoColumns"
|
||||
:data-source="PROMO_TABLE"
|
||||
row-key="name"
|
||||
scroll-x
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Tabs.TabPane>
|
||||
</Tabs>
|
||||
</div>
|
||||
</Page>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
:deep(.workbench-page-header) {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
@media (min-width: 640px) {
|
||||
:deep(.workbench-page-header) {
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.workbench-tabs.ant-tabs .ant-tabs-nav) {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 20;
|
||||
margin-bottom: 12px;
|
||||
padding: 4px 0 10px;
|
||||
background-color: #f8fafc;
|
||||
border-bottom: 1px solid rgb(226 232 240);
|
||||
}
|
||||
|
||||
:deep(.workbench-tabs .ant-tabs-tab) {
|
||||
font-weight: 800;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- 深色下 Tab 吸顶背景与页面一致(scoped 无法命中 html.dark) -->
|
||||
<style>
|
||||
html.dark .workbench-tabs.ant-tabs .ant-tabs-nav {
|
||||
background-color: hsl(222.34deg 10.43% 12.27%);
|
||||
border-bottom-color: hsl(240deg 3.7% 22%);
|
||||
}
|
||||
</style>
|
||||
@@ -12,8 +12,11 @@ defineOptions({
|
||||
name: 'Page',
|
||||
});
|
||||
|
||||
const { autoContentHeight = false, heightOffset = 0 } =
|
||||
defineProps<PageProps>();
|
||||
const {
|
||||
autoContentHeight = false,
|
||||
contentPaddingClass,
|
||||
heightOffset = 0,
|
||||
} = defineProps<PageProps>();
|
||||
|
||||
const headerHeight = ref(0);
|
||||
const footerHeight = ref(0);
|
||||
@@ -86,7 +89,10 @@ onMounted(() => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div :class="cn('h-full p-4', contentClass)" :style="contentStyle">
|
||||
<div
|
||||
:class="cn('h-full', contentPaddingClass ?? 'p-4', contentClass)"
|
||||
:style="contentStyle"
|
||||
>
|
||||
<slot></slot>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
export interface PageProps {
|
||||
title?: string;
|
||||
description?: string;
|
||||
/**
|
||||
* 内容区内边距(Tailwind 工具类)。默认 `p-4`;可改为如 `px-4 pb-4` 去掉上内边距等。
|
||||
*/
|
||||
contentPaddingClass?: string;
|
||||
contentClass?: string;
|
||||
/**
|
||||
* 根据content可见高度自适应
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type {
|
||||
// 系列类型的定义后缀都为 SeriesOption
|
||||
BarSeriesOption,
|
||||
FunnelSeriesOption,
|
||||
LineSeriesOption,
|
||||
ScatterSeriesOption,
|
||||
} from 'echarts/charts';
|
||||
@@ -15,6 +16,7 @@ import type { ComposeOption } from 'echarts/core';
|
||||
|
||||
import {
|
||||
BarChart,
|
||||
FunnelChart,
|
||||
LineChart,
|
||||
PieChart,
|
||||
RadarChart,
|
||||
@@ -39,6 +41,7 @@ import { CanvasRenderer } from 'echarts/renderers';
|
||||
export type ECOption = ComposeOption<
|
||||
| BarSeriesOption
|
||||
| DatasetComponentOption
|
||||
| FunnelSeriesOption
|
||||
| GridComponentOption
|
||||
| LineSeriesOption
|
||||
| ScatterSeriesOption
|
||||
@@ -56,6 +59,7 @@ echarts.use([
|
||||
DatasetComponent,
|
||||
TransformComponent,
|
||||
BarChart,
|
||||
FunnelChart,
|
||||
LineChart,
|
||||
ScatterChart,
|
||||
LabelLayout,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user