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
@@ -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>