feat: 添加表格列说明提示(列标题 Hover 气泡)

- 新增 OverviewColumnHint 组件,支持列标题 hover 气泡提示
- 新增 overview-table-hints.ts 定义各列计算口径说明
- 店铺对比表、商品对比表、品类对比表、商品规格汇总表均已接入
- 说明内容包括:目标单量/金额、达成率、推广费、刷单费、税前盈亏、税额等
This commit is contained in:
小蟑螂
2026-05-07 22:11:52 +08:00
parent 061737a984
commit f1e5112e17
8 changed files with 445 additions and 98 deletions
@@ -0,0 +1,40 @@
<script lang="ts" setup>
import { computed } from 'vue';
import { createIconifyIcon } from '@vben/icons';
import { Tooltip } from 'ant-design-vue';
const HelpIcon = createIconifyIcon('lucide:circle-help');
const props = withDefaults(
defineProps<{
/** 深色底表头(如「税后盈亏」列)上的浅色问号 */
light?: boolean;
title: string;
}>(),
{ light: false },
);
const iconWrapClass = computed(() =>
props.light
? 'inline-flex shrink-0 cursor-help text-emerald-100 transition-colors hover:text-white dark:text-emerald-100 dark:hover:text-white'
: 'inline-flex shrink-0 cursor-help text-slate-400 transition-colors hover:text-slate-600 dark:text-slate-500 dark:hover:text-slate-300',
);
</script>
<template>
<span class="inline-flex max-w-full items-center gap-1">
<span class="min-w-0"><slot /></span>
<Tooltip :title="title" placement="topLeft">
<span
:class="iconWrapClass"
tabindex="0"
role="img"
aria-label="列说明"
@click.prevent
>
<HelpIcon class="size-[14px]" />
</span>
</Tooltip>
</span>
</template>
@@ -0,0 +1,55 @@
/**
* 全店 / 店铺 / 商品概览表格列说明(与后端汇总口径一致,供表头 Tooltip 使用)
*/
export const overviewTableHints = {
targetOrderCount:
'所选日期范围内,涉及月份的「店铺月度目标单量」之和(来自各店铺月度目标配置)。',
orderCountAchievementRate: '实际单量 ÷ 目标单量 × 100%。',
targetAmount:
'所选日期范围内,涉及月份的「店铺月度目标销售额」之和(来自各店铺月度目标配置)。',
salesAmountAchievementRate: '实际销售额 ÷ 目标额 × 100%。',
salesAmount:
'统计口径下,计入销售额的订单实收金额合计(与后端订单状态统计一致)。',
/** 与 salesAmount 同口径,表头文案为「销售额」时使用 */
salesAmountShort:
'统计口径下,计入销售额的订单实收金额合计(与后端订单状态统计一致)。',
orderCount: '统计口径下,计入销量的有效订单笔数。',
orderCountSpec:
'该规格下计入统计的订单笔数;括号内「件」为销售件数合计。',
averageOrderValue: '销售额 ÷ 单量。',
productCost: '订单维度「商品成本」字段汇总。',
shippingCost: '订单维度「运费成本」字段汇总。',
otherCost: '订单维度「其他成本」字段汇总。',
totalCost: '总成本 = 商品成本 + 运费 + 其他成本。',
refundAmount: '统计口径下,计入退款的实收金额合计。',
totalPromotionFee: '该维度下推广费金额合计(来自推广费单据)。',
promotionFeeSpec:
'该规格推广费 = 店铺推广费总额 ×(该规格订单数 ÷ 所选时间范围内订单总数),由后端按比例分摊。',
brushFee: '该维度下刷单费用合计(来自刷单记录)。',
feeRatioShopRow:
'费比 = 推广费 ÷ 实际销售额。(「合计」行:推广费与刷单费之和 ÷ 实际销售额)',
feeRatioShopCategoryRow:
'费比(各行)= 推广费 ÷ 实际销售额;「合计」行 =(推广费 + 刷单费)÷ 实际销售额。为单店内该品类汇总。',
feeRatioCategoryRow:
'费比 = 推广费 ÷ 实际销售额。全店品类行的推广费、刷单费按店铺在该品类销售额占比分摊;「合计」行费比 =(推广费 + 刷单费)÷ 实际销售额。',
feeRatioPlatform:
'费比 =(推广费 + 刷单费用)÷ 实际销售额。数据行与「合计」行口径一致。',
feeRatioSpec:
'费比(%)= 推广费 ÷ 销售额;接口字段已为百分数数值(0–100),与店铺商品表费比展示方式不同。',
totalProfitBeforeTax:
'税前盈亏 = 实际销售额 − 总成本 − 退款金额 − 推广费 − 刷单费用。',
profitBeforeTaxSpec:
'税前盈亏 = 销售额 − 总成本 − 退款金额 − 推广费(规格维度不含刷单费)。',
roi: 'ROI =(实际销售额 − 退款金额)÷ 推广费;推广费为 0 时后端记为 0。',
profitAfterTax: '税后盈亏 = 税前盈亏 − 税额。',
profitAfterTaxNet: '税后净利 = 税前盈亏 − 税额(与「税后盈亏」同口径,表头名称不同)。',
} as const;
/** @deprecated 使用 overviewTableHints */
export const storeOverviewHints = overviewTableHints;
export function salesTaxColumnHint(taxRate: number): string {
const pct = (taxRate * 100).toFixed(0);
return `税额 = 销售额 × ${pct}%(与当前页面所选税率一致,由后端按该税率计算)。`;
}
@@ -5,6 +5,12 @@ import { computed } from 'vue';
import { formatFeeRatioPercent } from '#/utils/overview-fee-ratio';
import OverviewColumnHint from '#/components/overview/OverviewColumnHint.vue';
import {
salesTaxColumnHint,
storeOverviewHints,
} from '#/utils/overview-table-hints';
defineOptions({ name: 'CategoryComparisonTable' });
interface Props {
@@ -143,31 +149,57 @@ const formatAmount = (amount: number) => {
</tr>
<tr class="bg-slate-50/80 dark:bg-[hsl(240deg_3.7%_15.9%/80)] text-sm">
<th class="border-b border-l px-6 py-4 font-black text-slate-900 dark:text-[hsl(0deg_0%_95%)]">
实际销售额
<OverviewColumnHint :title="storeOverviewHints.salesAmount">
实际销售额
</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.orderCount">单量</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.averageOrderValue">客单价</OverviewColumnHint>
</th>
<th class="border-b border-l px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.productCost">商品成本</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.shippingCost">运费</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.otherCost">其他成本</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4 font-bold text-orange-800 dark:text-orange-300">
<OverviewColumnHint :title="storeOverviewHints.totalCost">总成本</OverviewColumnHint>
</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">运费</th>
<th class="border-b px-6 py-4">其他成本</th>
<th class="border-b px-6 py-4 font-bold text-orange-800 dark:text-orange-300">总成本</th>
<th class="border-b px-6 py-4 font-bold text-rose-600 dark:text-rose-400">
退款金额
<OverviewColumnHint :title="storeOverviewHints.refundAmount">退款金额</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.totalPromotionFee">推广费</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4 text-orange-600 dark:text-orange-400">
<OverviewColumnHint :title="storeOverviewHints.brushFee">刷单费用</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4 text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">
<OverviewColumnHint :title="storeOverviewHints.feeRatioCategoryRow">费比 %</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4">推广费</th>
<th class="border-b px-6 py-4 text-orange-600 dark:text-orange-400">刷单费用</th>
<th class="border-b px-6 py-4 text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">费比 %</th>
<th class="border-b border-l px-6 py-4 font-bold">
税前盈亏
<OverviewColumnHint :title="storeOverviewHints.totalProfitBeforeTax">
税前盈亏
</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4 italic text-rose-500 dark:text-rose-400">
{{ (taxRate * 100).toFixed(0) }}%税额
<OverviewColumnHint :title="salesTaxColumnHint(taxRate)">
{{ (taxRate * 100).toFixed(0) }}%税额
</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4 font-black text-indigo-700 dark:text-indigo-400">
ROI
<OverviewColumnHint :title="storeOverviewHints.roi">ROI</OverviewColumnHint>
</th>
<th class="border-b bg-emerald-600 dark:bg-emerald-600 px-6 py-4 font-black text-white">
税后盈亏
<OverviewColumnHint light :title="storeOverviewHints.profitAfterTax">
税后盈亏
</OverviewColumnHint>
</th>
</tr>
</thead>
@@ -4,6 +4,12 @@ import type { CompanyOverviewVO } from '#/api/ecommerce/store-overview';
import { formatFeeRatioPercent } from '#/utils/overview-fee-ratio';
import OverviewColumnHint from '#/components/overview/OverviewColumnHint.vue';
import {
salesTaxColumnHint,
storeOverviewHints,
} from '#/utils/overview-table-hints';
defineOptions({ name: 'PlatformSummaryCard' });
interface Props {
@@ -209,28 +215,80 @@ const sortedData = computed(() => {
</tr>
<tr class="bg-slate-50/80 dark:bg-[hsl(240deg_3.7%_15.9%/80)] text-sm">
<!-- 目标子列 -->
<th class="border-b border-l border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4">目标单量</th>
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4 text-blue-600 dark:text-blue-400">单量达成率</th>
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4">目标额</th>
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4 text-blue-600 dark:text-blue-400">销售达成率</th>
<th class="border-b border-l border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.targetOrderCount">
目标单量
</OverviewColumnHint>
</th>
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4 text-blue-600 dark:text-blue-400">
<OverviewColumnHint :title="storeOverviewHints.orderCountAchievementRate">
单量达成率
</OverviewColumnHint>
</th>
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.targetAmount">目标额</OverviewColumnHint>
</th>
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4 text-blue-600 dark:text-blue-400">
<OverviewColumnHint :title="storeOverviewHints.salesAmountAchievementRate">
销售达成率
</OverviewColumnHint>
</th>
<!-- 规模子列 -->
<th class="border-b border-l border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4 font-black text-slate-900 dark:text-[hsl(0deg_0%_95%)]">实际销售额</th>
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4">单量</th>
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4">客单价</th>
<th class="border-b border-l border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4 font-black text-slate-900 dark:text-[hsl(0deg_0%_95%)]">
<OverviewColumnHint :title="storeOverviewHints.salesAmount">
实际销售额
</OverviewColumnHint>
</th>
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.orderCount">单量</OverviewColumnHint>
</th>
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.averageOrderValue">客单价</OverviewColumnHint>
</th>
<!-- 成本子列 -->
<th class="border-b border-l border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4">商品成本</th>
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4">运费</th>
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4">其他成本</th>
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4 font-bold text-orange-800 dark:text-orange-300">总成本</th>
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4 font-bold text-rose-600 dark:text-rose-400">退款金额</th>
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4">推广费</th>
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4 text-orange-600 dark:text-orange-400">刷单费用</th>
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4 text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">费比%</th>
<th class="border-b border-l border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.productCost">商品成本</OverviewColumnHint>
</th>
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.shippingCost">运费</OverviewColumnHint>
</th>
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.otherCost">其他成本</OverviewColumnHint>
</th>
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4 font-bold text-orange-800 dark:text-orange-300">
<OverviewColumnHint :title="storeOverviewHints.totalCost">总成本</OverviewColumnHint>
</th>
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4 font-bold text-rose-600 dark:text-rose-400">
<OverviewColumnHint :title="storeOverviewHints.refundAmount">退款金额</OverviewColumnHint>
</th>
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.totalPromotionFee">推广费</OverviewColumnHint>
</th>
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4 text-orange-600 dark:text-orange-400">
<OverviewColumnHint :title="storeOverviewHints.brushFee">刷单费用</OverviewColumnHint>
</th>
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4 text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">
<OverviewColumnHint :title="storeOverviewHints.feeRatioPlatform">费比%</OverviewColumnHint>
</th>
<!-- 盈利子列 -->
<th class="border-b border-l border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4 font-bold">税前盈亏</th>
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4 italic text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">{{ taxRateNum.toFixed(0) }}%税额</th>
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4 font-black text-indigo-700 dark:text-indigo-400">ROI</th>
<th class="border-b bg-emerald-600 dark:bg-emerald-600 px-6 py-4 font-black text-white">税后盈亏</th>
<th class="border-b border-l border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4 font-bold">
<OverviewColumnHint :title="storeOverviewHints.totalProfitBeforeTax">
税前盈亏
</OverviewColumnHint>
</th>
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4 italic text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">
<OverviewColumnHint :title="salesTaxColumnHint(taxRate ?? 0.04)">
{{ taxRateNum.toFixed(0) }}%税额
</OverviewColumnHint>
</th>
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4 font-black text-indigo-700 dark:text-indigo-400">
<OverviewColumnHint :title="storeOverviewHints.roi">ROI</OverviewColumnHint>
</th>
<th class="border-b bg-emerald-600 dark:bg-emerald-600 px-6 py-4 font-black text-white">
<OverviewColumnHint light :title="storeOverviewHints.profitAfterTax">
税后盈亏
</OverviewColumnHint>
</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-100 dark:divide-[hsl(240deg_3.7%_22%)]">
@@ -5,6 +5,12 @@ import { computed } from 'vue';
import { formatFeeRatioPercent } from '#/utils/overview-fee-ratio';
import OverviewColumnHint from '#/components/overview/OverviewColumnHint.vue';
import {
salesTaxColumnHint,
storeOverviewHints,
} from '#/utils/overview-table-hints';
defineOptions({ name: 'ShopComparisonTable' });
interface Props {
@@ -158,39 +164,79 @@ const formatPercentPlain = (value: number | undefined) => {
</tr>
<tr class="bg-slate-50/80 dark:bg-[hsl(240deg_3.7%_15.9%/80)] text-sm">
<!-- 目标 -->
<th class="border-b border-l border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4">目标单量</th>
<th class="border-b px-6 py-4 text-blue-600 dark:text-blue-400">单量达成率</th>
<th class="border-b px-6 py-4">目标额</th>
<th class="border-b px-6 py-4 text-blue-600 dark:text-blue-400">销售达成率</th>
<th class="border-b border-l border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.targetOrderCount">
目标单量
</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4 text-blue-600 dark:text-blue-400">
<OverviewColumnHint :title="storeOverviewHints.orderCountAchievementRate">
单量达成率
</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.targetAmount">目标额</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4 text-blue-600 dark:text-blue-400">
<OverviewColumnHint :title="storeOverviewHints.salesAmountAchievementRate">
销售达成率
</OverviewColumnHint>
</th>
<!-- 规模 -->
<th class="border-b border-l border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4 font-black text-slate-900 dark:text-[hsl(0deg_0%_95%)]">
实际销售额
<OverviewColumnHint :title="storeOverviewHints.salesAmount">
实际销售额
</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.orderCount">单量</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.averageOrderValue">客单价</OverviewColumnHint>
</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 border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] 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 px-6 py-4 font-bold text-orange-800 dark:text-orange-300">总成本</th>
<th class="border-b border-l border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.productCost">商品成本</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.shippingCost">运费</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.otherCost">其他成本</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4 font-bold text-orange-800 dark:text-orange-300">
<OverviewColumnHint :title="storeOverviewHints.totalCost">总成本</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4 font-bold text-rose-600 dark:text-rose-400">
退款金额
<OverviewColumnHint :title="storeOverviewHints.refundAmount">退款金额</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.totalPromotionFee">推广费</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4 text-orange-600 dark:text-orange-400">
<OverviewColumnHint :title="storeOverviewHints.brushFee">刷单费用</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4 text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">
<OverviewColumnHint :title="storeOverviewHints.feeRatioShopRow">费比 %</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4">推广费</th>
<th class="border-b px-6 py-4 text-orange-600 dark:text-orange-400">刷单费用</th>
<th class="border-b px-6 py-4 text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">费比 %</th>
<!-- 盈利 -->
<th class="border-b border-l border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4 font-bold">
税前盈亏
<OverviewColumnHint :title="storeOverviewHints.totalProfitBeforeTax">
税前盈亏
</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4 italic text-rose-500 dark:text-rose-400">
{{ (taxRate * 100).toFixed(0) }}%税额
<OverviewColumnHint :title="salesTaxColumnHint(taxRate)">
{{ (taxRate * 100).toFixed(0) }}%税额
</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4 font-black text-indigo-700 dark:text-indigo-400">
ROI
<OverviewColumnHint :title="storeOverviewHints.roi">ROI</OverviewColumnHint>
</th>
<th class="border-b bg-emerald-600 dark:bg-emerald-600 px-6 py-4 font-black text-white">
税后盈亏
<OverviewColumnHint light :title="storeOverviewHints.profitAfterTax">
税后盈亏
</OverviewColumnHint>
</th>
</tr>
</thead>
@@ -3,6 +3,12 @@ import type { ProductOverviewVO } from '#/api/ecommerce/product-overview';
import { computed } from 'vue';
import OverviewColumnHint from '#/components/overview/OverviewColumnHint.vue';
import {
overviewTableHints,
salesTaxColumnHint,
} from '#/utils/overview-table-hints';
interface SpecData {
specId: number;
specName: string;
@@ -32,7 +38,7 @@ interface Props {
}
const props = withDefaults(defineProps<Props>(), {
taxRate: 4,
taxRate: 0.04,
footerTotal: null,
});
@@ -153,22 +159,58 @@ const footerRow = computed(() => props.footerTotal ?? computedFooter.value);
</tr>
<tr class="bg-slate-50/80 dark:bg-[hsl(240deg_3.7%_15.9%/80)] text-sm">
<!-- 规模 -->
<th class="border-b border-l px-5 py-3 font-black text-slate-900 dark:text-[hsl(0deg_0%_95%)]">销售额</th>
<th class="border-b px-5 py-3">订单量</th>
<th class="border-b px-5 py-3">客单价</th>
<th class="border-b border-l px-5 py-3 font-black text-slate-900 dark:text-[hsl(0deg_0%_95%)]">
<OverviewColumnHint :title="overviewTableHints.salesAmountShort">
销售额
</OverviewColumnHint>
</th>
<th class="border-b px-5 py-3">
<OverviewColumnHint :title="overviewTableHints.orderCountSpec">
订单量
</OverviewColumnHint>
</th>
<th class="border-b px-5 py-3">
<OverviewColumnHint :title="overviewTableHints.averageOrderValue">客单价</OverviewColumnHint>
</th>
<!-- 成本 -->
<th class="border-b border-l px-5 py-3">商品成本</th>
<th class="border-b px-5 py-3">运费</th>
<th class="border-b px-5 py-3">其他成本</th>
<th class="border-b px-5 py-3 font-bold text-orange-800 dark:text-orange-300">总成本</th>
<th class="border-b px-5 py-3 font-bold text-rose-600 dark:text-rose-400">退款金额</th>
<th class="border-b px-5 py-3">推广费</th>
<th class="border-b px-5 py-3 text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">费比 %</th>
<th class="border-b border-l px-5 py-3">
<OverviewColumnHint :title="overviewTableHints.productCost">商品成本</OverviewColumnHint>
</th>
<th class="border-b px-5 py-3">
<OverviewColumnHint :title="overviewTableHints.shippingCost">运费</OverviewColumnHint>
</th>
<th class="border-b px-5 py-3">
<OverviewColumnHint :title="overviewTableHints.otherCost">其他成本</OverviewColumnHint>
</th>
<th class="border-b px-5 py-3 font-bold text-orange-800 dark:text-orange-300">
<OverviewColumnHint :title="overviewTableHints.totalCost">总成本</OverviewColumnHint>
</th>
<th class="border-b px-5 py-3 font-bold text-rose-600 dark:text-rose-400">
<OverviewColumnHint :title="overviewTableHints.refundAmount">退款金额</OverviewColumnHint>
</th>
<th class="border-b px-5 py-3">
<OverviewColumnHint :title="overviewTableHints.promotionFeeSpec">推广费</OverviewColumnHint>
</th>
<th class="border-b px-5 py-3 text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">
<OverviewColumnHint :title="overviewTableHints.feeRatioSpec">费比 %</OverviewColumnHint>
</th>
<!-- 盈利 -->
<th class="border-b border-l px-5 py-3 font-bold">税前盈亏</th>
<th class="border-b px-5 py-3 italic text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">{{ (taxRate * 100).toFixed(0) }}%税额</th>
<th class="border-b px-5 py-3 font-black text-indigo-700 dark:text-indigo-400">ROI</th>
<th class="border-b bg-emerald-600 dark:bg-emerald-600 px-5 py-3 font-black text-white">税后盈亏</th>
<th class="border-b border-l px-5 py-3 font-bold">
<OverviewColumnHint :title="overviewTableHints.profitBeforeTaxSpec">税前盈亏</OverviewColumnHint>
</th>
<th class="border-b px-5 py-3 italic text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">
<OverviewColumnHint :title="salesTaxColumnHint(taxRate)">
{{ (taxRate * 100).toFixed(0) }}%税额
</OverviewColumnHint>
</th>
<th class="border-b px-5 py-3 font-black text-indigo-700 dark:text-indigo-400">
<OverviewColumnHint :title="overviewTableHints.roi">ROI</OverviewColumnHint>
</th>
<th class="border-b bg-emerald-600 dark:bg-emerald-600 px-5 py-3 font-black text-white">
<OverviewColumnHint light :title="overviewTableHints.profitAfterTax">
税后盈亏
</OverviewColumnHint>
</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-100 dark:divide-[hsl(240deg_3.7%_22%)]">
@@ -6,6 +6,12 @@ import {
formatCurrencyZhFromApi,
formatNumberZhFromApiOptional,
} from '#/utils/shop-overview-display';
import {
salesTaxColumnHint,
overviewTableHints,
} from '#/utils/overview-table-hints';
import OverviewColumnHint from '#/components/overview/OverviewColumnHint.vue';
interface Props {
data: ShopVO.OverviewStatistics | null;
@@ -118,28 +124,58 @@ const emit = defineEmits<Emits>();
</th>
</tr>
<tr class="bg-slate-50/80 dark:bg-[hsl(240deg_3.7%_15.9%/80)] text-sm">
<th class="border-b border-l dark:border-l-[hsl(240deg_3.7%_22%)] px-6 py-4 font-black text-slate-900 dark:bg-[hsl(240deg_3.7%_22%/50%)] dark:text-[hsl(0deg_0%_95%)]">实际销售额</th>
<th class="border-b px-6 py-4 dark:bg-[hsl(240deg_3.7%_22%/50%)]">单量</th>
<th class="border-b px-6 py-4 dark:bg-[hsl(240deg_3.7%_22%/50%)]">客单价</th>
<th class="border-b border-l dark:border-l-[hsl(240deg_3.7%_22%)] px-6 py-4 dark:bg-[hsl(24deg_9.8%_15%/50%)]">商品成本</th>
<th class="border-b px-6 py-4 dark:bg-[hsl(24deg_9.8%_15%/50%)]">运费</th>
<th class="border-b px-6 py-4 dark:bg-[hsl(24deg_9.8%_15%/50%)]">其他成本</th>
<th class="border-b px-6 py-4 font-bold text-orange-800 dark:text-orange-300 dark:bg-[hsl(24deg_9.8%_15%/50%)]">总成本</th>
<th class="border-b px-6 py-4 font-bold text-rose-600 dark:bg-[hsl(24deg_9.8%_15%/50%)] dark:text-rose-400">退款金额</th>
<th class="border-b px-6 py-4 dark:bg-[hsl(24deg_9.8%_15%/50%)]">推广费</th>
<th class="border-b px-6 py-4 text-orange-600 dark:bg-[hsl(24deg_9.8%_15%/50%)] dark:text-orange-400">刷单费用</th>
<th class="border-b px-6 py-4 text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">费比 %</th>
<th class="border-b border-l dark:border-l-[hsl(240deg_3.7%_22%)] px-6 py-4 font-black text-slate-900 dark:bg-[hsl(240deg_3.7%_22%/50%)] dark:text-[hsl(0deg_0%_95%)]">
<OverviewColumnHint :title="overviewTableHints.salesAmount">
实际销售额
</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4 dark:bg-[hsl(240deg_3.7%_22%/50%)]">
<OverviewColumnHint :title="overviewTableHints.orderCount">单量</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4 dark:bg-[hsl(240deg_3.7%_22%/50%)]">
<OverviewColumnHint :title="overviewTableHints.averageOrderValue">客单价</OverviewColumnHint>
</th>
<th class="border-b border-l dark:border-l-[hsl(240deg_3.7%_22%)] px-6 py-4 dark:bg-[hsl(24deg_9.8%_15%/50%)]">
<OverviewColumnHint :title="overviewTableHints.productCost">商品成本</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4 dark:bg-[hsl(24deg_9.8%_15%/50%)]">
<OverviewColumnHint :title="overviewTableHints.shippingCost">运费</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4 dark:bg-[hsl(24deg_9.8%_15%/50%)]">
<OverviewColumnHint :title="overviewTableHints.otherCost">其他成本</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4 font-bold text-orange-800 dark:text-orange-300 dark:bg-[hsl(24deg_9.8%_15%/50%)]">
<OverviewColumnHint :title="overviewTableHints.totalCost">总成本</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4 font-bold text-rose-600 dark:bg-[hsl(24deg_9.8%_15%/50%)] dark:text-rose-400">
<OverviewColumnHint :title="overviewTableHints.refundAmount">退款金额</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4 dark:bg-[hsl(24deg_9.8%_15%/50%)]">
<OverviewColumnHint :title="overviewTableHints.totalPromotionFee">推广费</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4 text-orange-600 dark:bg-[hsl(24deg_9.8%_15%/50%)] dark:text-orange-400">
<OverviewColumnHint :title="overviewTableHints.brushFee">刷单费用</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4 text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">
<OverviewColumnHint :title="overviewTableHints.feeRatioShopCategoryRow">费比 %</OverviewColumnHint>
</th>
<th class="border-b border-l px-6 py-4 font-black text-slate-900 dark:text-[hsl(0deg_0%_95%)]">
税前盈亏
<OverviewColumnHint :title="overviewTableHints.totalProfitBeforeTax">
税前盈亏
</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4 italic text-rose-500 dark:text-rose-400">
{{ (props.taxRate * 100).toFixed(0) }}%税额
<OverviewColumnHint :title="salesTaxColumnHint(props.taxRate)">
{{ (props.taxRate * 100).toFixed(0) }}%税额
</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4 font-black text-indigo-700 dark:text-indigo-400">
ROI
<OverviewColumnHint :title="overviewTableHints.roi">ROI</OverviewColumnHint>
</th>
<th class="border-b bg-emerald-600 px-6 py-4 font-black text-white dark:bg-emerald-600">
税后盈亏
<OverviewColumnHint light :title="overviewTableHints.profitAfterTax">
税后盈亏
</OverviewColumnHint>
</th>
</tr>
</thead>
@@ -10,6 +10,12 @@ import {
formatCurrencyZhFromApi,
formatNumberZhFromApiOptional,
} from '#/utils/shop-overview-display';
import {
salesTaxColumnHint,
overviewTableHints,
} from '#/utils/overview-table-hints';
import OverviewColumnHint from '#/components/overview/OverviewColumnHint.vue';
interface Props {
data: ShopVO.OverviewStatistics | null;
@@ -112,24 +118,56 @@ function goToProductOverview(productId: number) {
</th>
</tr>
<tr class="bg-slate-50/80 dark:bg-[hsl(240deg_3.7%_15.9%/80)] text-sm">
<th class="border-b px-6 py-4 dark:bg-[hsl(240deg_3.7%_15.9%/80%)]">销售额</th>
<th class="border-b border-l dark:border-l dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4">单量</th>
<th class="border-b px-6 py-4">客单价</th>
<th class="border-b border-l dark:border-l dark:border-[hsl(240deg_3.7%_22%)] 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 px-6 py-4 font-bold text-orange-800 dark:text-orange-300">总成本</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 dark:border-l dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4">费比 %</th>
<th class="border-b px-6 py-4 text-indigo-700 dark:text-indigo-400">单品 ROI</th>
<th class="border-b px-6 py-4">税前盈亏</th>
<th class="border-b px-6 py-4 dark:bg-[hsl(240deg_3.7%_15.9%/80%)]">
<OverviewColumnHint :title="overviewTableHints.salesAmountShort">
销售额
</OverviewColumnHint>
</th>
<th class="border-b border-l dark:border-l dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4">
<OverviewColumnHint :title="overviewTableHints.orderCount">单量</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4">
<OverviewColumnHint :title="overviewTableHints.averageOrderValue">客单价</OverviewColumnHint>
</th>
<th class="border-b border-l dark:border-l dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4">
<OverviewColumnHint :title="overviewTableHints.productCost">商品成本</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4">
<OverviewColumnHint :title="overviewTableHints.shippingCost">运费</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4">
<OverviewColumnHint :title="overviewTableHints.otherCost">其他成本</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4 font-bold text-orange-800 dark:text-orange-300">
<OverviewColumnHint :title="overviewTableHints.totalCost">总成本</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4 text-rose-600">
<OverviewColumnHint :title="overviewTableHints.refundAmount">退款金额</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4">
<OverviewColumnHint :title="overviewTableHints.totalPromotionFee">推广费</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4">
<OverviewColumnHint :title="overviewTableHints.brushFee">刷单费用</OverviewColumnHint>
</th>
<th class="border-b border-l dark:border-l dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4">
<OverviewColumnHint :title="overviewTableHints.feeRatioShopRow">费比 %</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4 text-indigo-700 dark:text-indigo-400">
<OverviewColumnHint :title="overviewTableHints.roi">单品 ROI</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4">
<OverviewColumnHint :title="overviewTableHints.totalProfitBeforeTax">税前盈亏</OverviewColumnHint>
</th>
<th class="border-b px-6 py-4 italic text-rose-500 dark:text-rose-400">
{{ (props.taxRate * 100).toFixed(0) }}%税额
<OverviewColumnHint :title="salesTaxColumnHint(props.taxRate)">
{{ (props.taxRate * 100).toFixed(0) }}%税额
</OverviewColumnHint>
</th>
<th class="border-b bg-emerald-600 px-6 py-4 font-black text-white">
税后净利
<OverviewColumnHint light :title="overviewTableHints.profitAfterTaxNet">
税后净利
</OverviewColumnHint>
</th>
</tr>
</thead>