mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 03:09:19 +08:00
feat: 添加店铺概览统计功能及退款状态支持
This commit is contained in:
@@ -13,6 +13,8 @@ export namespace OrderStatusDTO {
|
||||
sortOrder?: number;
|
||||
/** 自动统计 0不参与 1参与 */
|
||||
autoStatistics: number;
|
||||
/** 是否为退款状态 0否 1是 */
|
||||
isRefund?: number;
|
||||
}
|
||||
|
||||
/** 更新订单状态参数 */
|
||||
@@ -25,5 +27,7 @@ export namespace OrderStatusDTO {
|
||||
sortOrder?: number;
|
||||
/** 自动统计 0不参与 1参与 */
|
||||
autoStatistics: number;
|
||||
/** 是否为退款状态 0否 1是 */
|
||||
isRefund?: number;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ export namespace OrderStatusVO {
|
||||
sortOrder?: number;
|
||||
/** 自动统计 0不参与 1参与 */
|
||||
autoStatistics: number;
|
||||
/** 是否为退款状态 0否 1是 */
|
||||
isRefund?: number;
|
||||
/** 创建时间 */
|
||||
createTime: string;
|
||||
/** 更新时间 */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { ShopDTO, ShopVO } from './types';
|
||||
|
||||
import type { PageQueryDTO, PageResultVO } from '#/types/common';
|
||||
import type { ProductVO } from '#/api/ecommerce/product/types';
|
||||
import type { PageQueryDTO, PageResultVO } from '#/types/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
@@ -68,3 +68,15 @@ export async function getShopProductPageApi(
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取店铺概览统计数据
|
||||
*/
|
||||
export async function getShopOverviewStatisticsApi(
|
||||
params: ShopDTO.OverviewQuery,
|
||||
) {
|
||||
return requestClient.post<ShopVO.OverviewStatistics>(
|
||||
'/ec/shop/overview-statistics',
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -46,4 +46,12 @@ export namespace ShopDTO {
|
||||
/** 店铺ID */
|
||||
shopId: number;
|
||||
}
|
||||
|
||||
/** 店铺概览查询参数 */
|
||||
export interface OverviewQuery {
|
||||
/** 店铺ID */
|
||||
shopId: number;
|
||||
/** 日期范围数组(第一个是开始日期,第二个是结束日期,只有一个日期则返回当天数据) */
|
||||
dateRange: string[];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,4 +104,90 @@ export namespace ShopVO {
|
||||
/** 费比统计 */
|
||||
feeRatio: DailyStatistics;
|
||||
}
|
||||
|
||||
/** 店铺概览统计信息 */
|
||||
export interface OverviewStatistics {
|
||||
/** 店铺总销售额 */
|
||||
totalSalesAmount: number;
|
||||
/** 较上月同期增长百分比 */
|
||||
monthOverMonthGrowth?: number;
|
||||
/** 店铺总单量 */
|
||||
totalOrderCount: number;
|
||||
/** 总推广费支出 */
|
||||
totalPromotionFee: number;
|
||||
/** 平均费比(推广费/销售额) */
|
||||
averageFeeRatio?: number;
|
||||
/** 店铺总净利(税后) */
|
||||
totalNetProfitAfterTax: number;
|
||||
/** 扣除总税额 */
|
||||
totalTaxAmount?: number;
|
||||
/** 店铺总销量目标(目标订单数) */
|
||||
totalTargetOrderCount?: number;
|
||||
/** 店铺总销售额目标 */
|
||||
totalTargetAmount?: number;
|
||||
/** 销量目标达成率 */
|
||||
orderCountAchievementRate?: number;
|
||||
/** 销售额目标达成率 */
|
||||
salesAmountAchievementRate?: number;
|
||||
/** 汇总ROI */
|
||||
totalROI?: number;
|
||||
/** 总税后盈亏 */
|
||||
totalProfitAfterTax?: number;
|
||||
/** 销售额趋势分析 */
|
||||
salesAmountTrend?: TrendData;
|
||||
/** 单量趋势分析 */
|
||||
orderCountTrend?: TrendData;
|
||||
/** 多商品数据横向对比 */
|
||||
productComparisons?: ProductComparison[];
|
||||
}
|
||||
|
||||
/** 商品对比数据 */
|
||||
export interface ProductComparison {
|
||||
/** 商品ID */
|
||||
productId: number;
|
||||
/** 商品名称 */
|
||||
productName: string;
|
||||
/** 商品编码 */
|
||||
productCode?: string;
|
||||
/** 销售额 */
|
||||
salesAmount: number;
|
||||
/** 单量 */
|
||||
orderCount?: number;
|
||||
/** 客单价 */
|
||||
averageOrderValue?: number;
|
||||
/** 成本运费 */
|
||||
shippingCost?: number;
|
||||
/** 退款金额 */
|
||||
refundAmount?: number;
|
||||
/** 推广费 */
|
||||
totalPromotionFee?: number;
|
||||
/** 刷单费用 */
|
||||
brushFee?: number;
|
||||
/** 费比 */
|
||||
feeRatio?: number;
|
||||
/** 税前盈亏 */
|
||||
totalProfitBeforeTax?: number;
|
||||
/** 销售额4%税额 */
|
||||
salesTaxAmount?: number;
|
||||
/** 税后盈亏 */
|
||||
profitAfterTax?: number;
|
||||
/** ROI */
|
||||
roi?: number;
|
||||
}
|
||||
|
||||
/** 趋势数据 */
|
||||
export interface TrendData {
|
||||
/** 时间范围的总值 */
|
||||
total: number;
|
||||
/** 每日数据列表 */
|
||||
dailyDataList: TrendDataItem[];
|
||||
}
|
||||
|
||||
/** 趋势数据项 */
|
||||
export interface TrendDataItem {
|
||||
/** 日期 */
|
||||
date: string;
|
||||
/** 对应的值 */
|
||||
value: number;
|
||||
}
|
||||
}
|
||||
|
||||
+15
@@ -43,6 +43,7 @@ const formData = ref<Partial<OrderStatusDTO.Create>>({
|
||||
description: '',
|
||||
autoStatistics: 1,
|
||||
sortOrder: 0,
|
||||
isRefund: 0,
|
||||
});
|
||||
|
||||
// 表单验证规则
|
||||
@@ -68,12 +69,14 @@ function open(edit: boolean, record?: OrderStatusVO.Info) {
|
||||
description: record.description || '',
|
||||
autoStatistics: record.autoStatistics,
|
||||
sortOrder: record.sortOrder || 0,
|
||||
isRefund: record.isRefund || 0,
|
||||
}
|
||||
: {
|
||||
statusName: '',
|
||||
description: '',
|
||||
autoStatistics: 1,
|
||||
sortOrder: 0,
|
||||
isRefund: 0,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -97,6 +100,7 @@ async function handleSubmit() {
|
||||
description: formData.value.description,
|
||||
autoStatistics: formData.value.autoStatistics!,
|
||||
sortOrder: formData.value.sortOrder,
|
||||
isRefund: formData.value.isRefund,
|
||||
};
|
||||
await updateOrderStatusApi(currentRecord.value.id, updateData);
|
||||
message.success('更新订单状态成功');
|
||||
@@ -107,6 +111,7 @@ async function handleSubmit() {
|
||||
description: formData.value.description,
|
||||
autoStatistics: formData.value.autoStatistics!,
|
||||
sortOrder: formData.value.sortOrder,
|
||||
isRefund: formData.value.isRefund,
|
||||
};
|
||||
await createOrderStatusApi(createData);
|
||||
message.success('创建订单状态成功');
|
||||
@@ -186,6 +191,16 @@ defineExpose({
|
||||
/>
|
||||
</Form.Item>
|
||||
</div>
|
||||
|
||||
<Form.Item label="是否为退款状态" name="isRefund">
|
||||
<Switch
|
||||
v-model:checked="formData.isRefund"
|
||||
:checked-value="1"
|
||||
:un-checked-value="0"
|
||||
checked-children="是"
|
||||
un-checked-children="否"
|
||||
/>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
</template>
|
||||
|
||||
@@ -0,0 +1,807 @@
|
||||
<script lang="ts" setup>
|
||||
import type { EchartsUIType } from '@vben/plugins/echarts';
|
||||
|
||||
import type { ShopDTO, ShopVO } from '#/api/ecommerce/shop/types';
|
||||
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
|
||||
|
||||
import { Button, DatePicker, message, Spin } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { getShopOverviewStatisticsApi } from '#/api/ecommerce/shop';
|
||||
|
||||
defineOptions({ name: 'ShopOverview' });
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
// 店铺ID(从路由参数获取)
|
||||
const shopId = computed(() => {
|
||||
const id = route.params.id;
|
||||
return id ? Number(id) : 0;
|
||||
});
|
||||
|
||||
// 响应式数据
|
||||
const loading = ref(false);
|
||||
const overviewData = ref<null | ShopVO.OverviewStatistics>(null);
|
||||
|
||||
// 日期范围
|
||||
const dateRange = ref<[dayjs.Dayjs, dayjs.Dayjs]>([
|
||||
dayjs().subtract(7, 'day'),
|
||||
dayjs(),
|
||||
]);
|
||||
|
||||
// 当前选中的时间范围类型
|
||||
const activeTimeRange = ref<
|
||||
'7days' | '30days' | 'custom' | 'today' | 'yesterday'
|
||||
>('7days');
|
||||
|
||||
// 自定义日期范围
|
||||
const customDateRange = ref<[dayjs.Dayjs, dayjs.Dayjs] | undefined>(undefined);
|
||||
|
||||
// 切换时间范围
|
||||
const switchTimeRange = (
|
||||
type: '7days' | '30days' | 'custom' | 'today' | 'yesterday',
|
||||
) => {
|
||||
activeTimeRange.value = type;
|
||||
let startDate: dayjs.Dayjs;
|
||||
let endDate: dayjs.Dayjs = dayjs();
|
||||
|
||||
switch (type) {
|
||||
case '7days': {
|
||||
startDate = dayjs().subtract(7, 'day');
|
||||
break;
|
||||
}
|
||||
case '30days': {
|
||||
startDate = dayjs().subtract(30, 'day');
|
||||
break;
|
||||
}
|
||||
case 'custom': {
|
||||
if (customDateRange.value) {
|
||||
dateRange.value = customDateRange.value;
|
||||
}
|
||||
return;
|
||||
}
|
||||
case 'today': {
|
||||
startDate = dayjs();
|
||||
endDate = dayjs();
|
||||
break;
|
||||
}
|
||||
case 'yesterday': {
|
||||
startDate = dayjs().subtract(1, 'day');
|
||||
endDate = dayjs().subtract(1, 'day');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
dateRange.value = [startDate, endDate];
|
||||
};
|
||||
|
||||
// 自定义日期范围变化
|
||||
const handleCustomDateRangeChange = (
|
||||
value: [dayjs.Dayjs, dayjs.Dayjs] | [string, string] | null,
|
||||
_dateString?: [string, string],
|
||||
) => {
|
||||
if (value && Array.isArray(value) && value.length === 2) {
|
||||
const dates = [
|
||||
dayjs.isDayjs(value[0]) ? value[0] : dayjs(value[0]),
|
||||
dayjs.isDayjs(value[1]) ? value[1] : dayjs(value[1]),
|
||||
] as [dayjs.Dayjs, dayjs.Dayjs];
|
||||
customDateRange.value = dates;
|
||||
activeTimeRange.value = 'custom';
|
||||
dateRange.value = dates;
|
||||
}
|
||||
};
|
||||
|
||||
// 图表引用
|
||||
const trendChartRef = ref<EchartsUIType>();
|
||||
const { renderEcharts: renderTrendChart } = useEcharts(trendChartRef);
|
||||
|
||||
// 格式化金额
|
||||
const formatAmount = (amount: number) => {
|
||||
return `¥${amount.toLocaleString('zh-CN')}`;
|
||||
};
|
||||
|
||||
// 格式化百分比
|
||||
const formatPercent = (value: number | undefined) => {
|
||||
if (value === undefined) return '-';
|
||||
return `${value > 0 ? '+' : ''}${value.toFixed(1)}%`;
|
||||
};
|
||||
|
||||
// 格式化百分比(不带符号)
|
||||
const formatPercentPlain = (value: number | undefined) => {
|
||||
if (value === undefined) return '-';
|
||||
return `${value.toFixed(1)}%`;
|
||||
};
|
||||
|
||||
// 加载概览数据
|
||||
const loadOverviewData = async () => {
|
||||
if (!shopId.value) return;
|
||||
try {
|
||||
loading.value = true;
|
||||
const params: ShopDTO.OverviewQuery = {
|
||||
shopId: shopId.value,
|
||||
dateRange: [
|
||||
dateRange.value[0].format('YYYY-MM-DD'),
|
||||
dateRange.value[1].format('YYYY-MM-DD'),
|
||||
],
|
||||
};
|
||||
const data = await getShopOverviewStatisticsApi(params);
|
||||
overviewData.value = data;
|
||||
} catch (error) {
|
||||
console.error('获取店铺概览数据失败:', error);
|
||||
message.error('获取店铺概览数据失败');
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 渲染趋势图表
|
||||
const renderTrendChartData = () => {
|
||||
if (!trendChartRef.value || !overviewData.value) return;
|
||||
|
||||
const salesTrend = overviewData.value.salesAmountTrend;
|
||||
const orderTrend = overviewData.value.orderCountTrend;
|
||||
|
||||
if (!salesTrend || !orderTrend) return;
|
||||
|
||||
const dates = salesTrend.dailyDataList.map((item) =>
|
||||
dayjs(item.date).format('MM-DD'),
|
||||
);
|
||||
const salesData = salesTrend.dailyDataList.map((item) => item.value);
|
||||
const orderData = orderTrend.dailyDataList.map((item) => item.value);
|
||||
|
||||
renderTrendChart({
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '3%',
|
||||
bottom: '3%',
|
||||
top: '5%',
|
||||
containLabel: true,
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
backgroundColor: '#fff',
|
||||
textStyle: { color: '#000' },
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: dates,
|
||||
axisLine: { lineStyle: { color: '#e2e8f0' } },
|
||||
},
|
||||
yAxis: [
|
||||
{
|
||||
type: 'value',
|
||||
name: '销售额',
|
||||
splitLine: { lineStyle: { type: 'dashed' } },
|
||||
},
|
||||
{
|
||||
type: 'value',
|
||||
name: '单量',
|
||||
position: 'right',
|
||||
splitLine: { show: false },
|
||||
},
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: '销售额',
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
symbol: 'none',
|
||||
lineStyle: { width: 3, color: '#3b82f6' },
|
||||
areaStyle: {
|
||||
color: {
|
||||
type: 'linear',
|
||||
x: 0,
|
||||
y: 0,
|
||||
x2: 0,
|
||||
y2: 1,
|
||||
colorStops: [
|
||||
{ offset: 0, color: 'rgba(59, 130, 246, 0.4)' },
|
||||
{ offset: 1, color: 'rgba(59, 130, 246, 0)' },
|
||||
],
|
||||
},
|
||||
},
|
||||
data: salesData,
|
||||
},
|
||||
{
|
||||
name: '日单量',
|
||||
type: 'line',
|
||||
yAxisIndex: 1,
|
||||
smooth: true,
|
||||
symbol: 'none',
|
||||
lineStyle: { width: 3, color: '#10b981' },
|
||||
areaStyle: {
|
||||
color: {
|
||||
type: 'linear',
|
||||
x: 0,
|
||||
y: 0,
|
||||
x2: 0,
|
||||
y2: 1,
|
||||
colorStops: [
|
||||
{ offset: 0, color: 'rgba(16, 185, 129, 0.2)' },
|
||||
{ offset: 1, color: 'rgba(16, 185, 129, 0)' },
|
||||
],
|
||||
},
|
||||
},
|
||||
data: orderData,
|
||||
},
|
||||
],
|
||||
});
|
||||
};
|
||||
|
||||
// 监听数据变化,重新渲染图表
|
||||
watch(
|
||||
() => overviewData.value,
|
||||
() => {
|
||||
if (overviewData.value) {
|
||||
setTimeout(() => {
|
||||
renderTrendChartData();
|
||||
}, 100);
|
||||
}
|
||||
},
|
||||
{ deep: true },
|
||||
);
|
||||
|
||||
// 监听日期范围变化
|
||||
watch(
|
||||
() => dateRange.value,
|
||||
() => {
|
||||
loadOverviewData();
|
||||
},
|
||||
);
|
||||
|
||||
// 监听 shopId 变化
|
||||
watch(
|
||||
() => shopId.value,
|
||||
() => {
|
||||
if (shopId.value) {
|
||||
loadOverviewData();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
if (shopId.value) {
|
||||
loadOverviewData();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page title="店铺经营概览" auto-content-height class="bg-[#f8fafc]">
|
||||
<template #description>
|
||||
<div class="mt-1 text-sm font-bold italic text-slate-500">
|
||||
数据更新于:{{ dayjs().format('今日 HH:mm:ss') }}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #extra>
|
||||
<!-- 时间选择器 -->
|
||||
<div
|
||||
class="flex items-center gap-1.5 rounded-2xl border border-slate-200 bg-slate-200/50 p-1"
|
||||
>
|
||||
<!-- 快速选择按钮组 -->
|
||||
<div class="flex rounded-xl bg-white/40 p-1 shadow-inner">
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
class="!h-auto !min-w-0 !rounded-lg !border-none !px-5 !py-2 !text-sm !font-bold !shadow-none !transition-all"
|
||||
:class="
|
||||
activeTimeRange === 'today'
|
||||
? '!bg-white !font-black !text-blue-600 !shadow-sm'
|
||||
: '!bg-transparent !text-slate-500 hover:!text-slate-800'
|
||||
"
|
||||
@click="switchTimeRange('today')"
|
||||
>
|
||||
今日
|
||||
</Button>
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
class="!h-auto !min-w-0 !rounded-lg !border-none !px-5 !py-2 !text-sm !font-bold !shadow-none !transition-all"
|
||||
:class="
|
||||
activeTimeRange === 'yesterday'
|
||||
? '!bg-white !font-black !text-blue-600 !shadow-sm'
|
||||
: '!bg-transparent !text-slate-500 hover:!text-slate-800'
|
||||
"
|
||||
@click="switchTimeRange('yesterday')"
|
||||
>
|
||||
昨日
|
||||
</Button>
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
class="!h-auto !min-w-0 !rounded-lg !border-none !px-5 !py-2 !text-sm !font-bold !shadow-none !transition-all"
|
||||
:class="
|
||||
activeTimeRange === '7days'
|
||||
? '!bg-white !font-black !text-blue-600 !shadow-sm'
|
||||
: '!bg-transparent !text-slate-500 hover:!text-slate-800'
|
||||
"
|
||||
@click="switchTimeRange('7days')"
|
||||
>
|
||||
近7日
|
||||
</Button>
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
class="!h-auto !min-w-0 !rounded-lg !border-none !px-5 !py-2 !text-sm !font-bold !shadow-none !transition-all"
|
||||
:class="
|
||||
activeTimeRange === '30days'
|
||||
? '!bg-white !font-black !text-blue-600 !shadow-sm'
|
||||
: '!bg-transparent !text-slate-500 hover:!text-slate-800'
|
||||
"
|
||||
@click="switchTimeRange('30days')"
|
||||
>
|
||||
近30日
|
||||
</Button>
|
||||
</div>
|
||||
<!-- 分隔线 -->
|
||||
<div class="mx-2 h-6 w-px bg-slate-300"></div>
|
||||
<!-- 自定义日期选择器 -->
|
||||
<div class="flex items-center gap-2 px-3">
|
||||
<span class="text-xs font-bold text-slate-400">自定义日期</span>
|
||||
<DatePicker.RangePicker
|
||||
v-model:value="customDateRange"
|
||||
size="small"
|
||||
format="YYYY-MM-DD"
|
||||
:allow-clear="false"
|
||||
:placeholder="['开始日期', '结束日期']"
|
||||
class="!cursor-pointer !border-none !bg-transparent !text-sm !font-bold"
|
||||
@change="handleCustomDateRangeChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<Spin :spinning="loading">
|
||||
<div class="mx-auto w-full space-y-6 p-4 md:p-8">
|
||||
<!-- 第一层:核心统计卡片 -->
|
||||
<div class="grid grid-cols-1 gap-6 sm:grid-cols-2 xl:grid-cols-4">
|
||||
<!-- 销售大盘 -->
|
||||
<div
|
||||
class="flex flex-col justify-between rounded-[20px] border border-slate-200/80 bg-white/85 p-6 shadow-[0_4px_20px_rgba(0,0,0,0.02)] backdrop-blur-[12px]"
|
||||
>
|
||||
<div class="mb-4 flex items-start justify-between">
|
||||
<span
|
||||
class="text-xs font-black uppercase tracking-widest text-slate-400"
|
||||
>
|
||||
店铺销售总额
|
||||
</span>
|
||||
<span
|
||||
v-if="overviewData?.monthOverMonthGrowth !== undefined"
|
||||
class="rounded bg-emerald-50 px-2 py-1 text-xs font-bold text-emerald-600"
|
||||
>
|
||||
增长率 {{ formatPercent(overviewData.monthOverMonthGrowth) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="text-4xl font-black leading-none text-slate-900">
|
||||
{{
|
||||
overviewData?.totalSalesAmount
|
||||
? formatAmount(overviewData.totalSalesAmount)
|
||||
: '-'
|
||||
}}
|
||||
</div>
|
||||
<div
|
||||
v-if="overviewData?.salesAmountAchievementRate !== undefined"
|
||||
class="mt-6 flex items-center justify-between border-t border-slate-100 pt-4 text-xs font-bold"
|
||||
>
|
||||
<span class="text-slate-400">销售额目标达成</span>
|
||||
<span class="font-black text-blue-600">
|
||||
{{
|
||||
formatPercentPlain(overviewData.salesAmountAchievementRate)
|
||||
}}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 订单达成 -->
|
||||
<div
|
||||
class="flex flex-col justify-between rounded-[20px] border border-slate-200/80 bg-white/85 p-6 shadow-[0_4px_20px_rgba(0,0,0,0.02)] backdrop-blur-[12px]"
|
||||
>
|
||||
<div
|
||||
class="mb-4 text-xs font-black uppercase tracking-widest text-slate-400"
|
||||
>
|
||||
订单总量与达成
|
||||
</div>
|
||||
<div class="text-4xl font-black leading-none text-slate-900">
|
||||
{{
|
||||
overviewData?.totalOrderCount?.toLocaleString('zh-CN') || '-'
|
||||
}}
|
||||
<span class="ml-1 text-sm font-normal text-slate-400">单</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="overviewData?.orderCountAchievementRate !== undefined"
|
||||
class="mt-6"
|
||||
>
|
||||
<div
|
||||
class="mb-2 flex justify-between text-[10px] font-black text-slate-400"
|
||||
>
|
||||
<span>
|
||||
目标:
|
||||
{{
|
||||
overviewData.totalTargetOrderCount?.toLocaleString(
|
||||
'zh-CN',
|
||||
) || '-'
|
||||
}}
|
||||
单
|
||||
</span>
|
||||
<span>
|
||||
达成率:
|
||||
{{
|
||||
formatPercentPlain(overviewData.orderCountAchievementRate)
|
||||
}}
|
||||
</span>
|
||||
</div>
|
||||
<div class="h-2 w-full overflow-hidden rounded-full bg-slate-100">
|
||||
<div
|
||||
class="h-full bg-indigo-500 transition-all duration-1000"
|
||||
:style="{
|
||||
width: `${Math.min(overviewData.orderCountAchievementRate || 0, 100)}%`,
|
||||
}"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 推广效率 -->
|
||||
<div
|
||||
class="flex flex-col justify-between rounded-[20px] border border-slate-200/80 bg-white/85 p-6 shadow-[0_4px_20px_rgba(0,0,0,0.02)] backdrop-blur-[12px]"
|
||||
>
|
||||
<div
|
||||
class="mb-4 text-xs font-black uppercase tracking-widest text-slate-400"
|
||||
>
|
||||
投资回报率 (ROI)
|
||||
</div>
|
||||
<div class="text-4xl font-black leading-none text-indigo-600">
|
||||
{{ overviewData?.totalROI?.toFixed(2) || '-' }}
|
||||
</div>
|
||||
<div
|
||||
v-if="overviewData?.averageFeeRatio !== undefined"
|
||||
class="mt-6 space-y-2 border-t border-slate-100 pt-4"
|
||||
>
|
||||
<div class="flex justify-between text-xs font-bold">
|
||||
<span class="text-slate-400">平均费比</span>
|
||||
<span class="text-slate-800">
|
||||
{{ formatPercentPlain(overviewData.averageFeeRatio) }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 利润汇总 -->
|
||||
<div
|
||||
class="flex flex-col justify-between rounded-[20px] border-l-4 border-slate-200/80 border-l-emerald-500 bg-white/85 p-6 shadow-[0_4px_20px_rgba(0,0,0,0.02)] backdrop-blur-[12px]"
|
||||
>
|
||||
<div
|
||||
class="mb-4 text-xs font-black uppercase tracking-widest text-emerald-600"
|
||||
>
|
||||
店铺总净利润 (税后)
|
||||
</div>
|
||||
<div class="text-4xl font-black leading-none text-emerald-600">
|
||||
{{
|
||||
overviewData?.totalNetProfitAfterTax
|
||||
? formatAmount(overviewData.totalNetProfitAfterTax)
|
||||
: '-'
|
||||
}}
|
||||
</div>
|
||||
<div
|
||||
v-if="overviewData?.totalTaxAmount !== undefined"
|
||||
class="mt-6 flex justify-between border-t border-slate-100 pt-4 text-[11px] font-bold text-slate-400"
|
||||
>
|
||||
<span>已扣除 4% 税额</span>
|
||||
<span>-{{ formatAmount(overviewData.totalTaxAmount) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 第二层:趋势与财务拆解 -->
|
||||
<div class="grid grid-cols-1 gap-6 xl:grid-cols-3">
|
||||
<!-- 销售额趋势图 -->
|
||||
<div
|
||||
class="rounded-[20px] border border-slate-200/80 bg-white/85 p-8 shadow-[0_4px_20px_rgba(0,0,0,0.02)] backdrop-blur-[12px] xl:col-span-2"
|
||||
>
|
||||
<h3 class="mb-6 text-lg font-black text-slate-800">
|
||||
销售额与单量趋势分析
|
||||
</h3>
|
||||
<div class="h-[380px] w-full">
|
||||
<EchartsUI ref="trendChartRef" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 财务全维度损益清单 -->
|
||||
<div
|
||||
class="flex flex-col rounded-[20px] border border-slate-200/80 bg-white/85 p-8 shadow-[0_4px_20px_rgba(0,0,0,0.02)] backdrop-blur-[12px]"
|
||||
>
|
||||
<h3 class="mb-6 text-lg font-black text-slate-800">
|
||||
财务损益全维度 (P&L)
|
||||
</h3>
|
||||
<div class="flex flex-1 flex-col space-y-4 text-sm">
|
||||
<div class="flex justify-between border-b border-slate-100 pb-2">
|
||||
<span class="text-slate-500">推广费总支出</span>
|
||||
<span class="font-bold">
|
||||
{{
|
||||
overviewData?.totalPromotionFee
|
||||
? `-${formatAmount(overviewData.totalPromotionFee)}`
|
||||
: '-'
|
||||
}}
|
||||
</span>
|
||||
</div>
|
||||
<div class="flex justify-between border-b border-slate-100 pb-2">
|
||||
<span class="text-slate-500">客单价 (AOV)</span>
|
||||
<span class="font-bold">
|
||||
{{
|
||||
overviewData?.totalSalesAmount &&
|
||||
overviewData?.totalOrderCount
|
||||
? formatAmount(
|
||||
overviewData.totalSalesAmount /
|
||||
overviewData.totalOrderCount,
|
||||
)
|
||||
: '-'
|
||||
}}
|
||||
</span>
|
||||
</div>
|
||||
<div class="flex justify-between border-b border-slate-100 pb-2">
|
||||
<span class="text-slate-500">总税后盈亏 (Profit)</span>
|
||||
<span class="font-bold text-indigo-600">
|
||||
{{
|
||||
overviewData?.totalProfitAfterTax
|
||||
? formatAmount(overviewData.totalProfitAfterTax)
|
||||
: '-'
|
||||
}}
|
||||
</span>
|
||||
</div>
|
||||
<!-- 扣除项 -->
|
||||
<div class="mt-4 space-y-3 rounded-2xl bg-slate-50/80 p-4">
|
||||
<div class="flex justify-between text-xs">
|
||||
<span class="text-slate-400">销售额 4% 税额</span>
|
||||
<span class="font-bold text-rose-500">
|
||||
{{
|
||||
overviewData?.totalTaxAmount
|
||||
? formatAmount(overviewData.totalTaxAmount)
|
||||
: '-'
|
||||
}}
|
||||
</span>
|
||||
</div>
|
||||
<div class="flex justify-between text-xs">
|
||||
<span class="text-slate-400">较上月同期增长</span>
|
||||
<span class="font-black text-emerald-500">
|
||||
{{ formatPercent(overviewData?.monthOverMonthGrowth) }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 最终结果 -->
|
||||
<div
|
||||
class="mt-auto flex items-center justify-between rounded-2xl bg-slate-900 p-5 text-white shadow-2xl"
|
||||
>
|
||||
<div>
|
||||
<p class="text-[10px] font-black uppercase opacity-60">
|
||||
Final Net Profit
|
||||
</p>
|
||||
<p class="text-xs font-bold">税后最终净利</p>
|
||||
</div>
|
||||
<div class="text-3xl font-black">
|
||||
{{
|
||||
overviewData?.totalNetProfitAfterTax
|
||||
? formatAmount(overviewData.totalNetProfitAfterTax)
|
||||
: '-'
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 第三层:多商品 16 维度横向对比表 -->
|
||||
<div
|
||||
class="overflow-hidden rounded-[20px] border border-slate-200/80 bg-white/85 shadow-[0_4px_20px_rgba(0,0,0,0.02)] backdrop-blur-[12px]"
|
||||
>
|
||||
<div
|
||||
class="flex items-center justify-between border-b border-slate-100 bg-white/40 p-8"
|
||||
>
|
||||
<div>
|
||||
<h3 class="text-xl font-black text-slate-800">
|
||||
核心商品多维度损益对比表
|
||||
</h3>
|
||||
<p class="mt-1 text-xs font-bold text-slate-400">
|
||||
横向对比各商品规模、成本及 ROI 效率
|
||||
</p>
|
||||
</div>
|
||||
<Button
|
||||
type="primary"
|
||||
class="!h-auto !rounded-2xl !border-none !bg-slate-900 !px-8 !py-3 !text-sm !font-black !shadow-xl !shadow-slate-200 !transition-all hover:!scale-105 active:!scale-95"
|
||||
>
|
||||
导出商品明细报表
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div class="table-container overflow-x-auto">
|
||||
<table class="w-full whitespace-nowrap text-left text-sm">
|
||||
<!-- 分类复合表头 -->
|
||||
<thead
|
||||
class="bg-slate-50 text-[10px] font-black uppercase tracking-tighter text-slate-500"
|
||||
>
|
||||
<tr>
|
||||
<th
|
||||
rowspan="2"
|
||||
class="sticky-col border-b px-6 py-6 text-sm text-slate-900"
|
||||
>
|
||||
商品详情
|
||||
</th>
|
||||
<th
|
||||
colspan="3"
|
||||
class="border-b border-l border-slate-200 bg-slate-100/50 px-3 py-3 text-center"
|
||||
>
|
||||
商品规模 (Scale)
|
||||
</th>
|
||||
<th
|
||||
colspan="4"
|
||||
class="border-b border-l border-slate-200 bg-orange-50/50 px-3 py-3 text-center italic text-orange-700"
|
||||
>
|
||||
费用成本 (Costs)
|
||||
</th>
|
||||
<th
|
||||
colspan="5"
|
||||
class="border-b border-l border-slate-200 bg-emerald-50/50 px-3 py-3 text-center italic text-emerald-700"
|
||||
>
|
||||
单品损益 (Profitability)
|
||||
</th>
|
||||
</tr>
|
||||
<tr class="bg-slate-50/80">
|
||||
<!-- 规模 -->
|
||||
<th class="border-b border-l px-6 py-4">销售额</th>
|
||||
<th class="border-b px-6 py-4">单量</th>
|
||||
<th class="border-b px-6 py-4">客单价</th>
|
||||
<!-- 成本 -->
|
||||
<th class="border-b border-l px-6 py-4">成本运费</th>
|
||||
<th class="border-b px-6 py-4 text-rose-600">退款金额</th>
|
||||
<th class="border-b px-6 py-4">推广费</th>
|
||||
<th class="border-b px-6 py-4">刷单费用</th>
|
||||
<!-- 损益 -->
|
||||
<th class="border-b border-l px-6 py-4">费比 %</th>
|
||||
<th class="border-b px-6 py-4 text-indigo-700">单品 ROI</th>
|
||||
<th class="border-b px-6 py-4">税前盈亏</th>
|
||||
<th class="border-b px-6 py-4 italic text-rose-500">
|
||||
4%税额
|
||||
</th>
|
||||
<th
|
||||
class="border-b bg-emerald-600 px-6 py-4 font-black text-white"
|
||||
>
|
||||
税后净利
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-slate-100">
|
||||
<tr
|
||||
v-for="product in overviewData?.productComparisons"
|
||||
:key="product.productId"
|
||||
class="transition-colors hover:bg-blue-50/30"
|
||||
>
|
||||
<td
|
||||
class="sticky-col border-r-2 border-slate-100 bg-white px-6 py-6 font-bold text-slate-900"
|
||||
>
|
||||
<div>{{ product.productName }}</div>
|
||||
<div
|
||||
v-if="product.productCode"
|
||||
class="text-[10px] font-normal text-slate-300"
|
||||
>
|
||||
编码: {{ product.productCode }}
|
||||
</div>
|
||||
</td>
|
||||
<!-- 规模 -->
|
||||
<td class="px-6 py-4 font-black">
|
||||
{{ formatAmount(product.salesAmount) }}
|
||||
</td>
|
||||
<td class="px-6 py-4 font-medium">
|
||||
{{ product.orderCount?.toLocaleString('zh-CN') || '-' }}
|
||||
</td>
|
||||
<td class="px-6 py-4">
|
||||
{{
|
||||
product.averageOrderValue
|
||||
? formatAmount(product.averageOrderValue)
|
||||
: '-'
|
||||
}}
|
||||
</td>
|
||||
<!-- 成本 -->
|
||||
<td class="px-6 py-4">
|
||||
{{
|
||||
product.shippingCost
|
||||
? formatAmount(product.shippingCost)
|
||||
: '-'
|
||||
}}
|
||||
</td>
|
||||
<td class="px-6 py-4 font-bold text-rose-500">
|
||||
{{
|
||||
product.refundAmount
|
||||
? formatAmount(product.refundAmount)
|
||||
: '-'
|
||||
}}
|
||||
</td>
|
||||
<td class="px-6 py-4">
|
||||
{{
|
||||
product.totalPromotionFee
|
||||
? formatAmount(product.totalPromotionFee)
|
||||
: '-'
|
||||
}}
|
||||
</td>
|
||||
<td class="px-6 py-4 text-amber-500">
|
||||
{{
|
||||
product.brushFee ? formatAmount(product.brushFee) : '-'
|
||||
}}
|
||||
</td>
|
||||
<!-- 损益 -->
|
||||
<td class="px-6 py-4 text-slate-400">
|
||||
{{
|
||||
product.feeRatio !== undefined
|
||||
? formatPercentPlain(product.feeRatio)
|
||||
: '-'
|
||||
}}
|
||||
</td>
|
||||
<td class="px-6 py-4 font-black text-indigo-700">
|
||||
{{ product.roi?.toFixed(2) || '-' }}
|
||||
</td>
|
||||
<td class="px-6 py-4 font-bold text-slate-600">
|
||||
{{
|
||||
product.totalProfitBeforeTax
|
||||
? formatAmount(product.totalProfitBeforeTax)
|
||||
: '-'
|
||||
}}
|
||||
</td>
|
||||
<td class="px-6 py-4 italic text-slate-400">
|
||||
{{
|
||||
product.salesTaxAmount
|
||||
? formatAmount(product.salesTaxAmount)
|
||||
: '-'
|
||||
}}
|
||||
</td>
|
||||
<td
|
||||
class="bg-emerald-50/30 px-6 py-4 text-base font-black"
|
||||
:class="
|
||||
product.profitAfterTax && product.profitAfterTax < 0
|
||||
? 'text-rose-500'
|
||||
: 'text-emerald-600'
|
||||
"
|
||||
>
|
||||
{{
|
||||
product.profitAfterTax
|
||||
? formatAmount(product.profitAfterTax)
|
||||
: '-'
|
||||
}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="!overviewData?.productComparisons?.length">
|
||||
<td colspan="13" class="p-8 text-center text-gray-400">
|
||||
暂无数据
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Spin>
|
||||
</Page>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
/* 表格滚动条优化 */
|
||||
.table-container::-webkit-scrollbar {
|
||||
height: 6px;
|
||||
}
|
||||
.table-container::-webkit-scrollbar-thumb {
|
||||
background: #e2e8f0;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
/* 固定商品名称列 */
|
||||
.sticky-col {
|
||||
position: sticky;
|
||||
left: 0;
|
||||
z-index: 10;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,284 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>店铺经营概览 - 极简毛玻璃版</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/echarts@5.4.3/dist/echarts.min.js"></script>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;600;700;800&family=Noto+Sans+SC:wght@400;700;900&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Noto Sans SC', 'Plus Jakarta Sans', sans-serif;
|
||||
background-color: #f8fafc; /* 您要求的背景色 */
|
||||
color: #0f172a;
|
||||
}
|
||||
.glass-card {
|
||||
background: rgba(255, 255, 255, 0.85);
|
||||
backdrop-filter: blur(12px);
|
||||
border: 1px solid rgba(226, 232, 240, 0.8);
|
||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
|
||||
border-radius: 20px;
|
||||
}
|
||||
/* 时间选择器激活状态 */
|
||||
.time-btn.active { background: white; box-shadow: 0 4px 10px rgba(0,0,0,0.05); color: #3b82f6; }
|
||||
|
||||
/* 表格滚动条优化 */
|
||||
.table-container::-webkit-scrollbar { height: 6px; }
|
||||
.table-container::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 10px; }
|
||||
|
||||
/* 固定商品名称列 */
|
||||
.sticky-col { position: sticky; left: 0; background: white; z-index: 10; border-right: 2px solid #f1f5f9; }
|
||||
</style>
|
||||
</head>
|
||||
<body class="p-4 md:p-8">
|
||||
|
||||
<div class="w-full mx-auto space-y-6">
|
||||
|
||||
<!-- 头部:标题与时间筛选器 -->
|
||||
<header class="flex flex-col lg:flex-row justify-between items-start lg:items-center gap-6">
|
||||
<div>
|
||||
<h1 class="text-3xl font-black text-slate-900 tracking-tight">店铺经营概览</h1>
|
||||
<p class="text-slate-500 font-bold mt-1 text-sm italic">数据更新于:今日 20:45:12</p>
|
||||
</div>
|
||||
|
||||
<!-- 时间选择组件 (优化后的 UI) -->
|
||||
<div class="flex items-center gap-1.5 bg-slate-200/50 p-1 rounded-2xl border border-slate-200">
|
||||
<div class="flex bg-white/40 rounded-xl p-1 shadow-inner">
|
||||
<button class="px-5 py-2 text-sm font-bold text-slate-500 hover:text-slate-800 transition">今日</button>
|
||||
<button class="px-5 py-2 text-sm font-bold text-slate-500 hover:text-slate-800 transition">昨日</button>
|
||||
<button class="bg-white px-5 py-2 text-sm font-black rounded-lg shadow-sm text-blue-600">近7日</button>
|
||||
<button class="px-5 py-2 text-sm font-bold text-slate-500 hover:text-slate-800 transition">近30日</button>
|
||||
</div>
|
||||
<div class="w-px h-6 bg-slate-300 mx-2"></div>
|
||||
<div class="flex items-center gap-2 px-3">
|
||||
<span class="text-xs font-bold text-slate-400">自定义日期</span>
|
||||
<input type="date" class="bg-transparent text-sm font-bold outline-none cursor-pointer">
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- 第一层:核心统计卡片 (基于 OverviewStatistics) -->
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-6">
|
||||
<!-- 销售大盘 -->
|
||||
<div class="glass-card p-6 flex flex-col justify-between">
|
||||
<div class="flex justify-between items-start mb-4">
|
||||
<span class="text-xs font-black text-slate-400 uppercase tracking-widest">店铺销售总额</span>
|
||||
<span class="text-xs font-bold text-emerald-600 bg-emerald-50 px-2 py-1 rounded">增长率 +12.4%</span>
|
||||
</div>
|
||||
<div class="text-4xl font-black text-slate-900 leading-none">¥1,284,000</div>
|
||||
<div class="mt-6 pt-4 border-t border-slate-100 flex justify-between items-center text-xs font-bold">
|
||||
<span class="text-slate-400">销售额目标达成</span>
|
||||
<span class="text-blue-600 font-black">96.5%</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 订单达成 -->
|
||||
<div class="glass-card p-6 flex flex-col justify-between">
|
||||
<div class="text-xs font-black text-slate-400 mb-4 uppercase tracking-widest">订单总量与达成</div>
|
||||
<div class="text-4xl font-black text-slate-900 leading-none">8,412 <span class="text-sm font-normal text-slate-400 ml-1">单</span></div>
|
||||
<div class="mt-6">
|
||||
<div class="flex justify-between text-[10px] font-black text-slate-400 mb-2">
|
||||
<span>目标: 10,000 单</span>
|
||||
<span>达成率: 84.1%</span>
|
||||
</div>
|
||||
<div class="w-full bg-slate-100 h-2 rounded-full overflow-hidden">
|
||||
<div class="bg-indigo-500 h-full transition-all duration-1000" style="width: 84.1%"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 推广效率 -->
|
||||
<div class="glass-card p-6 flex flex-col justify-between">
|
||||
<div class="text-xs font-black text-slate-400 mb-4 uppercase tracking-widest">投资回报率 (ROI)</div>
|
||||
<div class="text-4xl font-black text-indigo-600 leading-none">4.21</div>
|
||||
<div class="mt-6 pt-4 border-t border-slate-100 space-y-2">
|
||||
<div class="flex justify-between text-xs font-bold">
|
||||
<span class="text-slate-400">平均费比</span>
|
||||
<span class="text-slate-800">23.7%</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 利润汇总 -->
|
||||
<div class="glass-card p-6 border-l-4 border-l-emerald-500 flex flex-col justify-between">
|
||||
<div class="text-xs font-black text-emerald-600 mb-4 uppercase tracking-widest">店铺总净利润 (税后)</div>
|
||||
<div class="text-4xl font-black text-emerald-600 leading-none">¥124,500</div>
|
||||
<div class="mt-6 pt-4 border-t border-slate-100 flex justify-between text-[11px] font-bold text-slate-400">
|
||||
<span>已扣除 4% 税额</span>
|
||||
<span>-¥51,360</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 第二层:趋势与财务拆解 -->
|
||||
<div class="grid grid-cols-1 xl:grid-cols-3 gap-6">
|
||||
<!-- 销售额趋势图 -->
|
||||
<div class="xl:col-span-2 glass-card p-8">
|
||||
<h3 class="text-lg font-black text-slate-800 mb-6">销售额与单量趋势分析</h3>
|
||||
<div id="mainTrendChart" style="height: 380px;" class="w-full"></div>
|
||||
</div>
|
||||
|
||||
<!-- 财务全维度损益清单 -->
|
||||
<div class="glass-card p-8 flex flex-col">
|
||||
<h3 class="text-lg font-black text-slate-800 mb-6">财务损益全维度 (P&L)</h3>
|
||||
<div class="space-y-4 text-sm flex-1">
|
||||
<div class="flex justify-between border-b border-slate-100 pb-2"><span class="text-slate-500">推广费总支出</span><span class="font-bold">-¥305,000</span></div>
|
||||
<div class="flex justify-between border-b border-slate-100 pb-2"><span class="text-slate-500">客单价 (AOV)</span><span class="font-bold">¥152.80</span></div>
|
||||
<div class="flex justify-between border-b border-slate-100 pb-2"><span class="text-slate-500">总税后盈亏 (Profit)</span><span class="font-bold text-indigo-600">¥175,860</span></div>
|
||||
<!-- 扣除项 -->
|
||||
<div class="bg-slate-50/80 p-4 rounded-2xl space-y-3 mt-4">
|
||||
<div class="flex justify-between text-xs"><span class="text-slate-400">销售额 4% 税额</span><span class="text-rose-500 font-bold">¥51,360</span></div>
|
||||
<div class="flex justify-between text-xs"><span class="text-slate-400">较上月同期增长</span><span class="text-emerald-500 font-black">+14.2%</span></div>
|
||||
</div>
|
||||
<!-- 最终结果 -->
|
||||
<div class="mt-auto p-5 rounded-2xl bg-slate-900 text-white flex justify-between items-center shadow-2xl">
|
||||
<div>
|
||||
<p class="text-[10px] font-black uppercase opacity-60">Final Net Profit</p>
|
||||
<p class="text-xs font-bold">税后最终净利</p>
|
||||
</div>
|
||||
<div class="text-3xl font-black">¥124,500</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 第三层:多商品 16 维度横向对比表 (基于 ProductComparison) -->
|
||||
<div class="glass-card overflow-hidden">
|
||||
<div class="p-8 border-b border-slate-100 flex justify-between items-center bg-white/40">
|
||||
<div>
|
||||
<h3 class="text-xl font-black text-slate-800">核心商品多维度损益对比表</h3>
|
||||
<p class="text-xs text-slate-400 font-bold mt-1">横向对比各商品规模、成本及 ROI 效率</p>
|
||||
</div>
|
||||
<button class="bg-slate-900 text-white px-8 py-3 rounded-2xl text-sm font-black shadow-xl shadow-slate-200 hover:scale-105 active:scale-95 transition-all">导出商品明细报表</button>
|
||||
</div>
|
||||
|
||||
<div class="table-container overflow-x-auto">
|
||||
<table class="w-full text-left text-sm whitespace-nowrap">
|
||||
<!-- 分类复合表头 -->
|
||||
<thead class="bg-slate-50 text-[10px] font-black text-slate-500 uppercase tracking-tighter">
|
||||
<tr>
|
||||
<th rowspan="2" class="px-6 py-6 border-b sticky-col text-slate-900 text-sm">商品详情</th>
|
||||
<th colspan="3" class="px-3 py-3 border-b border-l border-slate-200 text-center bg-slate-100/50">商品规模 (Scale)</th>
|
||||
<th colspan="4" class="px-3 py-3 border-b border-l border-slate-200 text-center bg-orange-50/50 text-orange-700 italic">费用成本 (Costs)</th>
|
||||
<th colspan="5" class="px-3 py-3 border-b border-l border-slate-200 text-center bg-emerald-50/50 text-emerald-700 italic">单品损益 (Profitability)</th>
|
||||
</tr>
|
||||
<tr class="bg-slate-50/80">
|
||||
<!-- 规模 -->
|
||||
<th class="px-6 py-4 border-b border-l">销售额</th>
|
||||
<th class="px-6 py-4 border-b">单量</th>
|
||||
<th class="px-6 py-4 border-b">客单价</th>
|
||||
<!-- 成本 -->
|
||||
<th class="px-6 py-4 border-b border-l">成本运费</th>
|
||||
<th class="px-6 py-4 border-b text-rose-600">退款金额</th>
|
||||
<th class="px-6 py-4 border-b">推广费</th>
|
||||
<th class="px-6 py-4 border-b">刷单费用</th>
|
||||
<!-- 损益 -->
|
||||
<th class="px-6 py-4 border-b border-l">费比 %</th>
|
||||
<th class="px-6 py-4 border-b text-indigo-700">单品 ROI</th>
|
||||
<th class="px-6 py-4 border-b">税前盈亏</th>
|
||||
<th class="px-6 py-4 border-b text-rose-500 italic">4%税额</th>
|
||||
<th class="px-6 py-4 border-b bg-emerald-600 text-white font-black">税后净利</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-slate-100">
|
||||
<!-- 演示数据:智能降噪耳机 -->
|
||||
<tr class="hover:bg-blue-50/30 transition-colors">
|
||||
<td class="px-6 py-6 font-bold text-slate-900 sticky-col">
|
||||
<div>智能降噪耳机 G200</div>
|
||||
<div class="text-[10px] text-slate-300 font-normal">编码: ITEM-99201</div>
|
||||
</td>
|
||||
<!-- 规模 -->
|
||||
<td class="px-6 py-4 font-black">¥428,000</td>
|
||||
<td class="px-6 py-4 font-medium">1,240</td>
|
||||
<td class="px-6 py-4">¥345.1</td>
|
||||
<!-- 成本 -->
|
||||
<td class="px-6 py-4">¥42,400</td>
|
||||
<td class="px-6 py-4 text-rose-500 font-bold">¥12,400</td>
|
||||
<td class="px-6 py-4">¥65,000</td>
|
||||
<td class="px-6 py-4 text-amber-500">¥4,500</td>
|
||||
<!-- 损益 -->
|
||||
<td class="px-6 py-4 text-slate-400">15.1%</td>
|
||||
<td class="px-6 py-4 font-black text-indigo-700">6.58</td>
|
||||
<td class="px-6 py-4 font-bold text-slate-600">¥102,500</td>
|
||||
<td class="px-6 py-4 text-slate-400 italic">¥17,120</td>
|
||||
<td class="px-6 py-4 font-black text-emerald-600 text-base bg-emerald-50/30">¥85,380</td>
|
||||
</tr>
|
||||
<!-- 演示数据:复古相机 -->
|
||||
<tr class="hover:bg-blue-50/30 transition-colors">
|
||||
<td class="px-6 py-6 font-bold text-slate-900 sticky-col">
|
||||
<div>复古数码相机 RX-X</div>
|
||||
<div class="text-[10px] text-slate-300 font-normal">编码: ITEM-00821</div>
|
||||
</td>
|
||||
<td class="px-6 py-4 font-black">¥215,000</td>
|
||||
<td class="px-6 py-4 font-medium">890</td>
|
||||
<td class="px-6 py-4">¥241.5</td>
|
||||
<td class="px-6 py-4">¥28,000</td>
|
||||
<td class="px-6 py-4 text-rose-500 font-bold">¥32,000</td>
|
||||
<td class="px-6 py-4">¥82,000</td>
|
||||
<td class="px-6 py-4 text-amber-500">¥8,500</td>
|
||||
<td class="px-6 py-4 text-slate-400">38.1%</td>
|
||||
<td class="px-6 py-4 font-black text-indigo-700">2.62</td>
|
||||
<td class="px-6 py-4 font-bold text-slate-600">¥12,400</td>
|
||||
<td class="px-6 py-4 text-slate-400 italic">¥8,600</td>
|
||||
<td class="px-6 py-4 font-black text-rose-500 text-base bg-rose-50/30">¥3,800</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// 销售趋势与单量图 (复刻参考图中的顺滑面积图)
|
||||
const trendChart = echarts.init(document.getElementById('mainTrendChart'));
|
||||
trendChart.setOption({
|
||||
grid: { left: '3%', right: '3%', bottom: '3%', top: '5%', containLabel: true },
|
||||
tooltip: { trigger: 'axis', backgroundColor: '#fff', textStyle: { color: '#000' } },
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: ['10-01', '10-02', '10-03', '10-04', '10-05', '10-06', '10-07'],
|
||||
axisLine: { lineStyle: { color: '#e2e8f0' } }
|
||||
},
|
||||
yAxis: [
|
||||
{ type: 'value', name: '销售额', splitLine: { lineStyle: { type: 'dashed' } } },
|
||||
{ type: 'value', name: '单量', position: 'right', splitLine: { show: false } }
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: '销售额',
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
symbol: 'none',
|
||||
lineStyle: { width: 3, color: '#3b82f6' },
|
||||
areaStyle: {
|
||||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||||
{ offset: 0, color: 'rgba(59, 130, 246, 0.4)' },
|
||||
{ offset: 1, color: 'rgba(59, 130, 246, 0)' }
|
||||
])
|
||||
},
|
||||
data: [82000, 93000, 90000, 120000, 129000, 133000, 128400]
|
||||
},
|
||||
{
|
||||
name: '日单量',
|
||||
type: 'line',
|
||||
yAxisIndex: 1,
|
||||
smooth: true,
|
||||
symbol: 'none',
|
||||
lineStyle: { width: 3, color: '#10b981' },
|
||||
areaStyle: {
|
||||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||||
{ offset: 0, color: 'rgba(16, 185, 129, 0.2)' },
|
||||
{ offset: 1, color: 'rgba(16, 185, 129, 0)' }
|
||||
])
|
||||
},
|
||||
data: [520, 610, 580, 720, 850, 890, 812]
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
window.onresize = () => trendChart.resize();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user