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:
+148
-66
@@ -16,7 +16,9 @@ import {
|
||||
storeOverviewHints,
|
||||
} from '#/utils/overview-table-hints';
|
||||
|
||||
import { useOverviewTableColumnPrefs } from '../composables/useOverviewTableColumnPrefs';
|
||||
import { FINANCE_PANEL_SHELL } from '../constants/finance-ui';
|
||||
import OverviewTableColumnSettings from './OverviewTableColumnSettings.vue';
|
||||
|
||||
defineOptions({ name: 'WorkbenchCategorySummaryTable' });
|
||||
|
||||
@@ -33,6 +35,7 @@ interface Props {
|
||||
firstColumnLabel?: string;
|
||||
/** 为 true 时首列名称可点击跳转商品概览(categoryId 即商品 ID) */
|
||||
productNavigate?: boolean;
|
||||
columnPrefsKey?: 'category' | 'product';
|
||||
}
|
||||
|
||||
interface Emits {
|
||||
@@ -49,10 +52,26 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
headingSubtitle: '包含:规模、成本及最终损益所有维度',
|
||||
firstColumnLabel: '品类',
|
||||
productNavigate: false,
|
||||
columnPrefsKey: 'category',
|
||||
});
|
||||
|
||||
const emit = defineEmits<Emits>();
|
||||
|
||||
const {
|
||||
visibleIds,
|
||||
isVisible,
|
||||
groupColspan,
|
||||
metricColCount,
|
||||
applyVisible,
|
||||
resetToDefault,
|
||||
} = useOverviewTableColumnPrefs(
|
||||
props.columnPrefsKey as 'category' | 'product',
|
||||
);
|
||||
|
||||
const emptyColspan = computed(
|
||||
() => (props.categoryExportMode ? 2 : 1) + metricColCount.value,
|
||||
);
|
||||
|
||||
const allCategoriesSelected = computed(() => {
|
||||
const total = props.categorySummary?.categories?.length || 0;
|
||||
return total > 0 && props.selectedExportCategoryIds.length === total;
|
||||
@@ -80,6 +99,13 @@ const cellRoi = (v: number | null | undefined) =>
|
||||
{{ props.headingSubtitle }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-3">
|
||||
<OverviewTableColumnSettings
|
||||
:table-key="columnPrefsKey"
|
||||
:visible-ids="visibleIds"
|
||||
@apply="applyVisible"
|
||||
@reset="resetToDefault"
|
||||
/>
|
||||
<PermissionGate code="data:export">
|
||||
<div class="flex items-center gap-3">
|
||||
<template v-if="categoryExportMode">
|
||||
@@ -113,6 +139,7 @@ const cellRoi = (v: number | null | undefined) =>
|
||||
</template>
|
||||
</div>
|
||||
</PermissionGate>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-container">
|
||||
@@ -148,92 +175,128 @@ const cellRoi = (v: number | null | undefined) =>
|
||||
{{ props.firstColumnLabel }}
|
||||
</th>
|
||||
<th
|
||||
colspan="8"
|
||||
v-if="groupColspan('scale') > 0"
|
||||
:colspan="groupColspan('scale')"
|
||||
class="border-b border-l border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] dark:border-l-[hsl(240deg_3.7%_22%)] dark:border-[hsl(240deg_3.7%_22%)] bg-slate-100/50 dark:bg-[hsl(240deg_3.7%_22%/50%)] p-3 text-center"
|
||||
>
|
||||
经营规模维度
|
||||
</th>
|
||||
<th
|
||||
colspan="8"
|
||||
v-if="groupColspan('cost') > 0"
|
||||
:colspan="groupColspan('cost')"
|
||||
class="border-b border-l border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] dark:border-l-[hsl(240deg_3.7%_22%)] dark:border-[hsl(240deg_3.7%_22%)] bg-orange-50/50 dark:bg-[hsl(24deg_9.8%_15%/50%)] p-3 text-center text-orange-700 dark:text-orange-400"
|
||||
>
|
||||
成本费用维度
|
||||
</th>
|
||||
<th
|
||||
colspan="5"
|
||||
v-if="groupColspan('profit') > 0"
|
||||
:colspan="groupColspan('profit')"
|
||||
class="border-b border-l border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] dark:border-l-[hsl(240deg_3.7%_22%)] dark:border-[hsl(240deg_3.7%_22%)] bg-emerald-50/50 dark:bg-[hsl(142deg_71.8%_29%)] p-3 text-center text-emerald-700 dark:text-emerald-200"
|
||||
>
|
||||
盈利分析维度
|
||||
</th>
|
||||
</tr>
|
||||
<tr class="bg-slate-50 dark:bg-[hsl(240deg_3.7%_15.9%)] text-sm">
|
||||
<th class="border-b border-l px-6 py-4 font-black text-amber-700 dark:text-amber-400">
|
||||
<th
|
||||
v-if="isVisible('dealAmount')"
|
||||
class="border-b border-l px-6 py-4 font-black text-amber-700 dark:text-amber-400"
|
||||
>
|
||||
<OverviewColumnHint :title="storeOverviewHints.dealAmount">成交金额</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b px-6 py-4 font-black text-slate-900 dark:text-[hsl(0deg_0%_95%)]">
|
||||
<th
|
||||
v-if="isVisible('salesAmount')"
|
||||
class="border-b 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">
|
||||
<th v-if="isVisible('dealOrderCount')" class="border-b px-6 py-4">
|
||||
<OverviewColumnHint :title="storeOverviewHints.dealOrderCount">成交单量</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b px-6 py-4">
|
||||
<th v-if="isVisible('salesOrderCount')" class="border-b px-6 py-4">
|
||||
<OverviewColumnHint :title="storeOverviewHints.salesOrderCount">净销售单量</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b px-6 py-4">
|
||||
<th v-if="isVisible('dealQuantitySum')" class="border-b px-6 py-4">
|
||||
<OverviewColumnHint :title="storeOverviewHints.dealQuantitySum">成交量</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b px-6 py-4">
|
||||
<th v-if="isVisible('salesQuantitySum')" class="border-b px-6 py-4">
|
||||
<OverviewColumnHint :title="storeOverviewHints.salesQuantitySum">净销量</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b px-6 py-4">
|
||||
<th v-if="isVisible('dealAverageOrderValue')" class="border-b px-6 py-4">
|
||||
<OverviewColumnHint :title="storeOverviewHints.dealAverageOrderValue">成交客单价</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b px-6 py-4">
|
||||
<th v-if="isVisible('salesAverageOrderValue')" class="border-b px-6 py-4">
|
||||
<OverviewColumnHint :title="storeOverviewHints.salesAverageOrderValue">净销售客单价</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b border-l px-6 py-4">
|
||||
<th
|
||||
v-if="isVisible('productCost')"
|
||||
class="border-b border-l px-6 py-4"
|
||||
>
|
||||
<OverviewColumnHint :title="storeOverviewHints.productCost">商品成本</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b px-6 py-4">
|
||||
<th v-if="isVisible('shippingCost')" class="border-b px-6 py-4">
|
||||
<OverviewColumnHint :title="storeOverviewHints.shippingCost">运费</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b px-6 py-4">
|
||||
<th v-if="isVisible('otherCost')" 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">
|
||||
<th
|
||||
v-if="isVisible('orderCost')"
|
||||
class="border-b px-6 py-4 font-bold text-orange-800 dark:text-orange-300"
|
||||
>
|
||||
<OverviewColumnHint :title="storeOverviewHints.orderCost">订单成本</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b px-6 py-4 font-bold text-rose-600 dark:text-rose-400">
|
||||
<th
|
||||
v-if="isVisible('refundAmount')"
|
||||
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 italic text-rose-500 dark:text-rose-400">
|
||||
<th
|
||||
v-if="isVisible('salesTaxAmount')"
|
||||
class="border-b px-6 py-4 italic text-rose-500 dark:text-rose-400"
|
||||
>
|
||||
<OverviewColumnHint :title="salesTaxColumnHint(taxRate)">
|
||||
{{ (taxRate * 100).toFixed(0) }}%税额
|
||||
</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b px-6 py-4">
|
||||
<th v-if="isVisible('totalPromotionFee')" 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">
|
||||
<th
|
||||
v-if="isVisible('brushFee')"
|
||||
class="border-b px-6 py-4 text-orange-600 dark:text-orange-400"
|
||||
>
|
||||
<OverviewColumnHint :title="storeOverviewHints.brushFee">刷单费</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b border-l px-6 py-4 font-bold text-emerald-700 dark:text-emerald-400">
|
||||
<th
|
||||
v-if="isVisible('grossProfit')"
|
||||
class="border-b border-l px-6 py-4 font-bold text-emerald-700 dark:text-emerald-400"
|
||||
>
|
||||
<OverviewColumnHint :title="storeOverviewHints.grossProfit">毛利</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b px-6 py-4 font-bold">
|
||||
<th v-if="isVisible('totalProfitBeforeTax')" class="border-b px-6 py-4 font-bold">
|
||||
<OverviewColumnHint :title="storeOverviewHints.totalProfitBeforeTax">
|
||||
税前净利
|
||||
</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b px-6 py-4 text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||
<th
|
||||
v-if="isVisible('feeRatio')"
|
||||
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 font-black text-indigo-700 dark:text-indigo-400">
|
||||
<th
|
||||
v-if="isVisible('roi')"
|
||||
class="border-b 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">
|
||||
<th
|
||||
v-if="isVisible('profitAfterTax')"
|
||||
class="border-b bg-emerald-600 dark:bg-emerald-600 px-6 py-4 font-black text-white"
|
||||
>
|
||||
<OverviewColumnHint light :title="storeOverviewHints.profitAfterTax">
|
||||
税后净利
|
||||
</OverviewColumnHint>
|
||||
@@ -283,50 +346,68 @@ const cellRoi = (v: number | null | undefined) =>
|
||||
{{ cat.categoryName }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="p-6 font-black text-amber-700 dark:text-amber-400"><AnimatedMoneyCell :value="cat.dealAmount" /></td>
|
||||
<td class="p-6 font-black"><AnimatedMoneyCell :value="cat.salesAmount" /></td>
|
||||
<td class="p-6 font-medium">{{ formatIntCell(cat.dealOrderCount) }}</td>
|
||||
<td class="p-6 font-medium">{{ formatIntCell(cat.salesOrderCount) }}</td>
|
||||
<td class="p-6 font-medium">{{ formatIntCell(cat.dealQuantitySum) }}</td>
|
||||
<td class="p-6 font-medium">{{ formatIntCell(cat.salesQuantitySum) }}</td>
|
||||
<td class="p-6 font-medium"><AnimatedMoneyCell :value="cat.dealAverageOrderValue" /></td>
|
||||
<td class="p-6 font-medium">
|
||||
<td v-if="isVisible('dealAmount')" class="p-6 font-black text-amber-700 dark:text-amber-400"><AnimatedMoneyCell :value="cat.dealAmount" /></td>
|
||||
<td v-if="isVisible('salesAmount')" class="p-6 font-black"><AnimatedMoneyCell :value="cat.salesAmount" /></td>
|
||||
<td v-if="isVisible('dealOrderCount')" class="p-6 font-medium">{{ formatIntCell(cat.dealOrderCount) }}</td>
|
||||
<td v-if="isVisible('salesOrderCount')" class="p-6 font-medium">{{ formatIntCell(cat.salesOrderCount) }}</td>
|
||||
<td v-if="isVisible('dealQuantitySum')" class="p-6 font-medium">{{ formatIntCell(cat.dealQuantitySum) }}</td>
|
||||
<td v-if="isVisible('salesQuantitySum')" class="p-6 font-medium">{{ formatIntCell(cat.salesQuantitySum) }}</td>
|
||||
<td v-if="isVisible('dealAverageOrderValue')" class="p-6 font-medium"><AnimatedMoneyCell :value="cat.dealAverageOrderValue" /></td>
|
||||
<td v-if="isVisible('salesAverageOrderValue')" class="p-6 font-medium">
|
||||
<AnimatedMoneyCell :value="cat.salesAverageOrderValue" />
|
||||
</td>
|
||||
<td class="p-6"><AnimatedMoneyCell :value="cat.productCost" /></td>
|
||||
<td class="p-6"><AnimatedMoneyCell :value="cat.shippingCost" /></td>
|
||||
<td class="p-6"><AnimatedMoneyCell :value="cat.otherCost" /></td>
|
||||
<td class="p-6 font-bold text-orange-800 dark:text-orange-300">
|
||||
<td v-if="isVisible('productCost')" class="p-6"><AnimatedMoneyCell :value="cat.productCost" /></td>
|
||||
<td v-if="isVisible('shippingCost')" class="p-6"><AnimatedMoneyCell :value="cat.shippingCost" /></td>
|
||||
<td v-if="isVisible('otherCost')" class="p-6"><AnimatedMoneyCell :value="cat.otherCost" /></td>
|
||||
<td
|
||||
v-if="isVisible('orderCost')"
|
||||
class="p-6 font-bold text-orange-800 dark:text-orange-300"
|
||||
>
|
||||
<AnimatedMoneyCell :value="cat.orderCost" />
|
||||
</td>
|
||||
<td class="p-6 font-bold text-rose-600 dark:text-rose-400">
|
||||
<td
|
||||
v-if="isVisible('refundAmount')"
|
||||
class="p-6 font-bold text-rose-600 dark:text-rose-400"
|
||||
>
|
||||
<AnimatedMoneyCell :value="cat.refundAmount" />
|
||||
</td>
|
||||
<td class="p-6 italic text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||
<td
|
||||
v-if="isVisible('salesTaxAmount')"
|
||||
class="p-6 italic text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
>
|
||||
<AnimatedMoneyCell :value="cat.salesTaxAmount" />
|
||||
</td>
|
||||
<td class="p-6"><AnimatedMoneyCell :value="cat.totalPromotionFee" /></td>
|
||||
<td class="p-6 text-orange-600 dark:text-orange-400">
|
||||
<td v-if="isVisible('totalPromotionFee')" class="p-6"><AnimatedMoneyCell :value="cat.totalPromotionFee" /></td>
|
||||
<td
|
||||
v-if="isVisible('brushFee')"
|
||||
class="p-6 text-orange-600 dark:text-orange-400"
|
||||
>
|
||||
<AnimatedMoneyCell :value="cat.brushFee" />
|
||||
</td>
|
||||
<td class="p-6 font-bold text-emerald-700 dark:text-emerald-400">
|
||||
<td
|
||||
v-if="isVisible('grossProfit')"
|
||||
class="p-6 font-bold text-emerald-700 dark:text-emerald-400"
|
||||
>
|
||||
<AnimatedMoneyCell :value="cat.grossProfit" />
|
||||
</td>
|
||||
<td class="p-6 font-bold">
|
||||
<td v-if="isVisible('totalProfitBeforeTax')" class="p-6 font-bold">
|
||||
<AnimatedMoneyCell :value="cat.totalProfitBeforeTax" />
|
||||
</td>
|
||||
<td class="p-6 text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||
<td v-if="isVisible('feeRatio')" class="p-6 text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||
{{ cat.feeRatio !== undefined ? formatFeeRatioPercent(cat.feeRatio) : '-' }}
|
||||
</td>
|
||||
<td class="p-6 font-black text-indigo-700 dark:text-indigo-400">
|
||||
<td v-if="isVisible('roi')" class="p-6 font-black text-indigo-700 dark:text-indigo-400">
|
||||
{{ cellRoi(cat.roi) }}
|
||||
</td>
|
||||
<td class="bg-emerald-50 dark:bg-[hsl(142deg_71.8%_29%)] p-6 text-base font-black text-emerald-600 dark:text-emerald-300">
|
||||
<td
|
||||
v-if="isVisible('profitAfterTax')"
|
||||
class="bg-emerald-50 dark:bg-[hsl(142deg_71.8%_29%)] p-6 text-base font-black text-emerald-600 dark:text-emerald-300"
|
||||
>
|
||||
<AnimatedMoneyCell :value="cat.profitAfterTax" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="!categorySummary?.categories?.length">
|
||||
<td :colspan="categoryExportMode ? 19 : 18" class="p-8 text-center text-gray-400">
|
||||
<td :colspan="emptyColspan" class="p-8 text-center text-gray-400">
|
||||
暂无数据
|
||||
</td>
|
||||
</tr>
|
||||
@@ -336,31 +417,32 @@ const cellRoi = (v: number | null | undefined) =>
|
||||
<tr class="font-black text-slate-900 dark:text-[hsl(0deg_0%_95%)]">
|
||||
<td class="sticky-col bg-slate-100 dark:bg-[hsl(240deg_3.7%_22%)] p-6 text-base">合计</td>
|
||||
<!-- 规模 -->
|
||||
<td class="p-6 text-amber-700 dark:text-amber-400"><AnimatedMoneyCell :value="categorySummary?.total?.dealAmount" /></td>
|
||||
<td class="p-6"><AnimatedMoneyCell :value="categorySummary?.total?.salesAmount" /></td>
|
||||
<td class="p-6">{{ formatIntCell(categorySummary?.total?.dealOrderCount) }}</td>
|
||||
<td class="p-6">{{ formatIntCell(categorySummary?.total?.salesOrderCount) }}</td>
|
||||
<td class="p-6">{{ formatIntCell(categorySummary?.total?.dealQuantitySum) }}</td>
|
||||
<td class="p-6">{{ formatIntCell(categorySummary?.total?.salesQuantitySum) }}</td>
|
||||
<td class="p-6"><AnimatedMoneyCell :value="categorySummary?.total?.dealAverageOrderValue" /></td>
|
||||
<td class="p-6">
|
||||
<td v-if="isVisible('dealAmount')" class="p-6 text-amber-700 dark:text-amber-400"><AnimatedMoneyCell :value="categorySummary?.total?.dealAmount" /></td>
|
||||
<td v-if="isVisible('salesAmount')" class="p-6"><AnimatedMoneyCell :value="categorySummary?.total?.salesAmount" /></td>
|
||||
<td v-if="isVisible('dealOrderCount')" class="p-6">{{ formatIntCell(categorySummary?.total?.dealOrderCount) }}</td>
|
||||
<td v-if="isVisible('salesOrderCount')" class="p-6">{{ formatIntCell(categorySummary?.total?.salesOrderCount) }}</td>
|
||||
<td v-if="isVisible('dealQuantitySum')" class="p-6">{{ formatIntCell(categorySummary?.total?.dealQuantitySum) }}</td>
|
||||
<td v-if="isVisible('salesQuantitySum')" class="p-6">{{ formatIntCell(categorySummary?.total?.salesQuantitySum) }}</td>
|
||||
<td v-if="isVisible('dealAverageOrderValue')" class="p-6"><AnimatedMoneyCell :value="categorySummary?.total?.dealAverageOrderValue" /></td>
|
||||
<td v-if="isVisible('salesAverageOrderValue')" class="p-6">
|
||||
<AnimatedMoneyCell :value="categorySummary?.total?.salesAverageOrderValue" />
|
||||
</td>
|
||||
<!-- 成本 -->
|
||||
<td class="p-6"><AnimatedMoneyCell :value="categorySummary?.total?.productCost" /></td>
|
||||
<td class="p-6"><AnimatedMoneyCell :value="categorySummary?.total?.shippingCost" /></td>
|
||||
<td class="p-6"><AnimatedMoneyCell :value="categorySummary?.total?.otherCost" /></td>
|
||||
<td class="p-6 font-bold text-orange-800 dark:text-orange-300"><AnimatedMoneyCell :value="categorySummary?.total?.orderCost" /></td>
|
||||
<td class="p-6 text-rose-600 dark:text-rose-400"><AnimatedMoneyCell :value="categorySummary?.total?.refundAmount" /></td>
|
||||
<td class="p-6 italic text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]"><AnimatedMoneyCell :value="categorySummary?.total?.salesTaxAmount" /></td>
|
||||
<td class="p-6"><AnimatedMoneyCell :value="categorySummary?.total?.totalPromotionFee" /></td>
|
||||
<td class="p-6 text-orange-600 dark:text-orange-400"><AnimatedMoneyCell :value="categorySummary?.total?.brushFee" /></td>
|
||||
<td v-if="isVisible('productCost')" class="p-6"><AnimatedMoneyCell :value="categorySummary?.total?.productCost" /></td>
|
||||
<td v-if="isVisible('shippingCost')" class="p-6"><AnimatedMoneyCell :value="categorySummary?.total?.shippingCost" /></td>
|
||||
<td v-if="isVisible('otherCost')" class="p-6"><AnimatedMoneyCell :value="categorySummary?.total?.otherCost" /></td>
|
||||
<td v-if="isVisible('orderCost')" class="p-6 font-bold text-orange-800 dark:text-orange-300"><AnimatedMoneyCell :value="categorySummary?.total?.orderCost" /></td>
|
||||
<td v-if="isVisible('refundAmount')" class="p-6 text-rose-600 dark:text-rose-400"><AnimatedMoneyCell :value="categorySummary?.total?.refundAmount" /></td>
|
||||
<td v-if="isVisible('salesTaxAmount')" class="p-6 italic text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]"><AnimatedMoneyCell :value="categorySummary?.total?.salesTaxAmount" /></td>
|
||||
<td v-if="isVisible('totalPromotionFee')" class="p-6"><AnimatedMoneyCell :value="categorySummary?.total?.totalPromotionFee" /></td>
|
||||
<td v-if="isVisible('brushFee')" class="p-6 text-orange-600 dark:text-orange-400"><AnimatedMoneyCell :value="categorySummary?.total?.brushFee" /></td>
|
||||
<!-- 盈利 -->
|
||||
<td class="p-6 text-emerald-700 dark:text-emerald-400"><AnimatedMoneyCell :value="categorySummary?.total?.grossProfit" /></td>
|
||||
<td class="p-6"><AnimatedMoneyCell :value="categorySummary?.total?.totalProfitBeforeTax" /></td>
|
||||
<td class="p-6 text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">{{ categorySummary?.total?.feeRatio !== undefined ? formatFeeRatioPercent(categorySummary?.total?.feeRatio) : '-' }}</td>
|
||||
<td class="p-6 text-indigo-700 dark:text-indigo-400">{{ cellRoi(categorySummary?.total?.roi) }}</td>
|
||||
<td v-if="isVisible('grossProfit')" class="p-6 text-emerald-700 dark:text-emerald-400"><AnimatedMoneyCell :value="categorySummary?.total?.grossProfit" /></td>
|
||||
<td v-if="isVisible('totalProfitBeforeTax')" class="p-6"><AnimatedMoneyCell :value="categorySummary?.total?.totalProfitBeforeTax" /></td>
|
||||
<td v-if="isVisible('feeRatio')" class="p-6 text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">{{ categorySummary?.total?.feeRatio !== undefined ? formatFeeRatioPercent(categorySummary?.total?.feeRatio) : '-' }}</td>
|
||||
<td v-if="isVisible('roi')" class="p-6 text-indigo-700 dark:text-indigo-400">{{ cellRoi(categorySummary?.total?.roi) }}</td>
|
||||
<td
|
||||
v-if="isVisible('profitAfterTax')"
|
||||
class="bg-emerald-100 p-6 text-base dark:bg-emerald-950"
|
||||
:class="(categorySummary?.total?.profitAfterTax ?? 0) < 0 ? 'text-rose-600 dark:text-rose-400' : 'text-emerald-700 dark:text-emerald-300'"
|
||||
><AnimatedMoneyCell :value="categorySummary?.total?.profitAfterTax" /></td>
|
||||
|
||||
+180
@@ -0,0 +1,180 @@
|
||||
<script lang="ts" setup>
|
||||
import type { OverviewTableKey } from '../constants/overview-table-columns';
|
||||
|
||||
import { computed, ref, watch } from 'vue';
|
||||
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
import { Button, Checkbox, Popover, message } from 'ant-design-vue';
|
||||
|
||||
import {
|
||||
columnsForTable,
|
||||
defaultVisibleIds,
|
||||
groupsForTable,
|
||||
} from '../constants/overview-table-columns';
|
||||
|
||||
defineOptions({ name: 'OverviewTableColumnSettings' });
|
||||
|
||||
const props = defineProps<{
|
||||
tableKey: OverviewTableKey;
|
||||
/** 当前已显示的列 id */
|
||||
visibleIds: string[];
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'apply', ids: string[]): void;
|
||||
(e: 'reset'): void;
|
||||
}>();
|
||||
|
||||
const IconColumns = createIconifyIcon('lucide:columns-3');
|
||||
|
||||
const open = ref(false);
|
||||
const draft = ref<string[]>([]);
|
||||
|
||||
const catalog = computed(() => columnsForTable(props.tableKey));
|
||||
const groups = computed(() => groupsForTable(props.tableKey));
|
||||
|
||||
function syncDraft() {
|
||||
draft.value = [...props.visibleIds];
|
||||
}
|
||||
|
||||
watch(
|
||||
() => open.value,
|
||||
(v) => {
|
||||
if (v) syncDraft();
|
||||
},
|
||||
);
|
||||
|
||||
function isChecked(id: string) {
|
||||
return draft.value.includes(id);
|
||||
}
|
||||
|
||||
function onCheck(id: string, checked: boolean) {
|
||||
const set = new Set(draft.value);
|
||||
if (checked) set.add(id);
|
||||
else set.delete(id);
|
||||
draft.value = catalog.value.map((c) => c.id).filter((x) => set.has(x));
|
||||
}
|
||||
|
||||
function columnsOfGroup(groupId: string) {
|
||||
return catalog.value.filter((c) => c.group === groupId);
|
||||
}
|
||||
|
||||
function groupAllChecked(groupId: string) {
|
||||
const cols = columnsOfGroup(groupId);
|
||||
return cols.length > 0 && cols.every((c) => draft.value.includes(c.id));
|
||||
}
|
||||
|
||||
function groupIndeterminate(groupId: string) {
|
||||
const cols = columnsOfGroup(groupId);
|
||||
const n = cols.filter((c) => draft.value.includes(c.id)).length;
|
||||
return n > 0 && n < cols.length;
|
||||
}
|
||||
|
||||
function onGroupCheck(groupId: string, checked: boolean) {
|
||||
const ids = columnsOfGroup(groupId).map((c) => c.id);
|
||||
const set = new Set(draft.value);
|
||||
for (const id of ids) {
|
||||
if (checked) set.add(id);
|
||||
else set.delete(id);
|
||||
}
|
||||
draft.value = catalog.value.map((c) => c.id).filter((x) => set.has(x));
|
||||
}
|
||||
|
||||
function selectAll() {
|
||||
draft.value = defaultVisibleIds(props.tableKey);
|
||||
}
|
||||
|
||||
function clearAll() {
|
||||
draft.value = [];
|
||||
}
|
||||
|
||||
function handleApply() {
|
||||
if (draft.value.length === 0) {
|
||||
message.warning('请至少保留一列');
|
||||
return;
|
||||
}
|
||||
emit('apply', [...draft.value]);
|
||||
open.value = false;
|
||||
}
|
||||
|
||||
function handleReset() {
|
||||
draft.value = defaultVisibleIds(props.tableKey);
|
||||
emit('reset');
|
||||
open.value = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Popover
|
||||
v-model:open="open"
|
||||
trigger="click"
|
||||
placement="bottomRight"
|
||||
:overlay-style="{ width: '360px', maxWidth: '92vw' }"
|
||||
>
|
||||
<template #title>
|
||||
<div class="flex items-center justify-between gap-2 pr-1">
|
||||
<span class="font-semibold">列显示设置</span>
|
||||
<span class="text-xs font-normal text-slate-400">
|
||||
已选 {{ draft.length }} / {{ catalog.length }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #content>
|
||||
<div class="max-h-[min(60vh,28rem)] space-y-3 overflow-y-auto pr-1">
|
||||
<div
|
||||
v-for="g in groups"
|
||||
:key="g.id"
|
||||
class="rounded-lg border border-slate-100 p-2.5 dark:border-[hsl(240deg_3.7%_22%)]"
|
||||
>
|
||||
<Checkbox
|
||||
class="mb-1.5 font-medium"
|
||||
:checked="groupAllChecked(g.id)"
|
||||
:indeterminate="groupIndeterminate(g.id)"
|
||||
@change="
|
||||
(e: any) => onGroupCheck(g.id, !!(e?.target?.checked ?? e))
|
||||
"
|
||||
>
|
||||
{{ g.label }}
|
||||
</Checkbox>
|
||||
<div class="ml-1 grid grid-cols-2 gap-x-2 gap-y-1">
|
||||
<Checkbox
|
||||
v-for="col in columnsOfGroup(g.id)"
|
||||
:key="col.id"
|
||||
:checked="isChecked(col.id)"
|
||||
@change="
|
||||
(e: any) => onCheck(col.id, !!(e?.target?.checked ?? e))
|
||||
"
|
||||
>
|
||||
{{ col.label }}
|
||||
</Checkbox>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="mt-3 flex flex-wrap items-center justify-between gap-2 border-t border-slate-100 pt-3 dark:border-[hsl(240deg_3.7%_22%)]"
|
||||
>
|
||||
<div class="flex gap-1">
|
||||
<Button type="link" size="small" class="!px-1" @click="selectAll">
|
||||
全选
|
||||
</Button>
|
||||
<Button type="link" size="small" class="!px-1" @click="clearAll">
|
||||
清空
|
||||
</Button>
|
||||
<Button type="link" size="small" class="!px-1" @click="handleReset">
|
||||
恢复默认
|
||||
</Button>
|
||||
</div>
|
||||
<Button type="primary" size="small" @click="handleApply">应用</Button>
|
||||
</div>
|
||||
</template>
|
||||
<Button
|
||||
type="default"
|
||||
class="!rounded-[10px] !border-slate-200 !bg-white !text-slate-600 dark:!border-[hsl(240deg_3.7%_22%)] dark:!bg-[hsl(240deg_3.7%_15.9%)] dark:!text-[hsl(240deg_5%_64.9%)]"
|
||||
>
|
||||
<template #icon>
|
||||
<component :is="IconColumns" class="size-4 shrink-0" />
|
||||
</template>
|
||||
列设置
|
||||
</Button>
|
||||
</Popover>
|
||||
</template>
|
||||
+1
@@ -223,6 +223,7 @@ async function handleProductExport() {
|
||||
|
||||
<CategorySummaryTable
|
||||
v-if="activeMode === 'product'"
|
||||
column-prefs-key="product"
|
||||
heading-title="各商品多维度经营明细汇总"
|
||||
heading-subtitle="列结构与品类表一致;数据与工作台商品维度同源;点击商品名可跳转商品概览"
|
||||
first-column-label="商品"
|
||||
|
||||
+189
-78
@@ -14,7 +14,9 @@ import {
|
||||
storeOverviewHints,
|
||||
} from '#/utils/overview-table-hints';
|
||||
|
||||
import { useOverviewTableColumnPrefs } from '../composables/useOverviewTableColumnPrefs';
|
||||
import { FINANCE_PANEL_SHELL } from '../constants/finance-ui';
|
||||
import OverviewTableColumnSettings from './OverviewTableColumnSettings.vue';
|
||||
|
||||
defineOptions({ name: 'WorkbenchPlatformSummaryCard' });
|
||||
|
||||
@@ -41,6 +43,19 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
});
|
||||
const emit = defineEmits<Emits>();
|
||||
|
||||
const {
|
||||
visibleIds,
|
||||
isVisible,
|
||||
groupColspan,
|
||||
metricColCount,
|
||||
applyVisible,
|
||||
resetToDefault,
|
||||
} = useOverviewTableColumnPrefs('platform');
|
||||
|
||||
const emptyColspan = computed(
|
||||
() => (props.platformExportMode ? 2 : 1) + metricColCount.value,
|
||||
);
|
||||
|
||||
const allPlatformsSelected = computed(() => {
|
||||
const total = platformData.value.length;
|
||||
return total > 0 && props.selectedExportPlatformCodes.length === total;
|
||||
@@ -126,6 +141,13 @@ const sortedData = computed(() => {
|
||||
{{ props.headingSubtitle }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-3">
|
||||
<OverviewTableColumnSettings
|
||||
table-key="platform"
|
||||
:visible-ids="visibleIds"
|
||||
@apply="applyVisible"
|
||||
@reset="resetToDefault"
|
||||
/>
|
||||
<PermissionGate code="data:export">
|
||||
<div class="flex items-center gap-3">
|
||||
<template v-if="platformExportMode">
|
||||
@@ -159,6 +181,7 @@ const sortedData = computed(() => {
|
||||
</template>
|
||||
</div>
|
||||
</PermissionGate>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 表格 -->
|
||||
@@ -201,28 +224,32 @@ const sortedData = computed(() => {
|
||||
</th>
|
||||
<!-- 目标达成 -->
|
||||
<th
|
||||
colspan="4"
|
||||
v-if="groupColspan('target') > 0"
|
||||
:colspan="groupColspan('target')"
|
||||
class="border-b border-l border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] dark:border-l-[hsl(240deg_3.7%_22%)] p-3 text-center bg-blue-50/50 dark:bg-[hsl(217.2deg_32.6%_17.5%/50%)] text-blue-700 dark:text-blue-400"
|
||||
>
|
||||
目标达成维度
|
||||
</th>
|
||||
<!-- 规模 -->
|
||||
<th
|
||||
colspan="8"
|
||||
v-if="groupColspan('scale') > 0"
|
||||
:colspan="groupColspan('scale')"
|
||||
class="border-b border-l border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] dark:border-l-[hsl(240deg_3.7%_22%)] p-3 text-center bg-slate-100/50 dark:bg-[hsl(240deg_3.7%_22%/50%)]"
|
||||
>
|
||||
经营规模维度
|
||||
</th>
|
||||
<!-- 成本 -->
|
||||
<th
|
||||
colspan="8"
|
||||
v-if="groupColspan('cost') > 0"
|
||||
:colspan="groupColspan('cost')"
|
||||
class="border-b border-l border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] dark:border-l-[hsl(240deg_3.7%_22%)] p-3 text-center bg-orange-50/50 dark:bg-[hsl(24deg_9.8%_15%/50%)] text-orange-700 dark:text-orange-400"
|
||||
>
|
||||
成本费用维度
|
||||
</th>
|
||||
<!-- 盈利 -->
|
||||
<th
|
||||
colspan="5"
|
||||
v-if="groupColspan('profit') > 0"
|
||||
:colspan="groupColspan('profit')"
|
||||
class="border-b border-l border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] dark:border-l-[hsl(240deg_3.7%_22%)] p-3 text-center bg-emerald-50/50 dark:bg-[hsl(142deg_71.8%_29%)] text-emerald-700 dark:text-emerald-200"
|
||||
>
|
||||
盈利分析维度
|
||||
@@ -230,94 +257,169 @@ const sortedData = computed(() => {
|
||||
</tr>
|
||||
<tr class="bg-slate-50 dark:bg-[hsl(240deg_3.7%_15.9%)] text-sm">
|
||||
<!-- 目标子列 -->
|
||||
<th class="border-b border-l border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4">
|
||||
<th
|
||||
v-if="isVisible('targetOrderCount')"
|
||||
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">
|
||||
<th
|
||||
v-if="isVisible('orderCountAchievementRate')"
|
||||
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">
|
||||
<th
|
||||
v-if="isVisible('targetAmount')"
|
||||
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">
|
||||
<th
|
||||
v-if="isVisible('salesAmountAchievementRate')"
|
||||
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-amber-700 dark:text-amber-400">
|
||||
<th
|
||||
v-if="isVisible('dealAmount')"
|
||||
class="border-b border-l border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4 font-black text-amber-700 dark:text-amber-400"
|
||||
>
|
||||
<OverviewColumnHint :title="storeOverviewHints.dealAmount">成交金额</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4 font-black text-slate-900 dark:text-[hsl(0deg_0%_95%)]">
|
||||
<th
|
||||
v-if="isVisible('salesAmount')"
|
||||
class="border-b border-slate-200 dark:border-b-[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">
|
||||
<th
|
||||
v-if="isVisible('dealOrderCount')"
|
||||
class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4"
|
||||
>
|
||||
<OverviewColumnHint :title="storeOverviewHints.dealOrderCount">成交单量</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4">
|
||||
<th
|
||||
v-if="isVisible('salesOrderCount')"
|
||||
class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4"
|
||||
>
|
||||
<OverviewColumnHint :title="storeOverviewHints.salesOrderCount">净销售单量</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4">
|
||||
<th
|
||||
v-if="isVisible('dealQuantitySum')"
|
||||
class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4"
|
||||
>
|
||||
<OverviewColumnHint :title="storeOverviewHints.dealQuantitySum">成交量</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4">
|
||||
<th
|
||||
v-if="isVisible('salesQuantitySum')"
|
||||
class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4"
|
||||
>
|
||||
<OverviewColumnHint :title="storeOverviewHints.salesQuantitySum">净销量</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4">
|
||||
<th
|
||||
v-if="isVisible('dealAverageOrderValue')"
|
||||
class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4"
|
||||
>
|
||||
<OverviewColumnHint :title="storeOverviewHints.dealAverageOrderValue">成交客单价</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4">
|
||||
<th
|
||||
v-if="isVisible('salesAverageOrderValue')"
|
||||
class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4"
|
||||
>
|
||||
<OverviewColumnHint :title="storeOverviewHints.salesAverageOrderValue">净销售客单价</OverviewColumnHint>
|
||||
</th>
|
||||
<!-- 成本子列 -->
|
||||
<th class="border-b border-l border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4">
|
||||
<th
|
||||
v-if="isVisible('productCost')"
|
||||
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">
|
||||
<th
|
||||
v-if="isVisible('shippingCost')"
|
||||
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">
|
||||
<th
|
||||
v-if="isVisible('otherCost')"
|
||||
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">
|
||||
<th
|
||||
v-if="isVisible('orderCost')"
|
||||
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.orderCost">订单成本</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">
|
||||
<th
|
||||
v-if="isVisible('refundAmount')"
|
||||
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 italic text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||
<th
|
||||
v-if="isVisible('salesTaxAmount')"
|
||||
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">
|
||||
<th
|
||||
v-if="isVisible('totalPromotionFee')"
|
||||
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">
|
||||
<th
|
||||
v-if="isVisible('brushFee')"
|
||||
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-l border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4 font-bold text-emerald-700 dark:text-emerald-400">
|
||||
<th
|
||||
v-if="isVisible('grossProfit')"
|
||||
class="border-b border-l border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4 font-bold text-emerald-700 dark:text-emerald-400"
|
||||
>
|
||||
<OverviewColumnHint :title="storeOverviewHints.grossProfit">毛利</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
|
||||
v-if="isVisible('totalProfitBeforeTax')"
|
||||
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 text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||
<th
|
||||
v-if="isVisible('feeRatio')"
|
||||
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-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4 font-black text-indigo-700 dark:text-indigo-400">
|
||||
<th
|
||||
v-if="isVisible('roi')"
|
||||
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">
|
||||
<th
|
||||
v-if="isVisible('profitAfterTax')"
|
||||
class="border-b bg-emerald-600 dark:bg-emerald-600 px-6 py-4 font-black text-white"
|
||||
>
|
||||
<OverviewColumnHint light :title="storeOverviewHints.profitAfterTax">
|
||||
税后净利
|
||||
</OverviewColumnHint>
|
||||
@@ -358,38 +460,46 @@ const sortedData = computed(() => {
|
||||
</span>
|
||||
</td>
|
||||
<!-- 目标 -->
|
||||
<td class="p-6 font-medium">{{ p.targetOrderCount.toLocaleString('zh-CN') }}</td>
|
||||
<td class="p-6 font-black text-blue-600 dark:text-blue-400">{{ formatPercentPlain(p.orderCountAchievementRate) }}</td>
|
||||
<td class="p-6 font-medium"><AnimatedMoneyCell :value="p.targetAmount" /></td>
|
||||
<td class="p-6 font-black text-blue-600 dark:text-blue-400">{{ formatPercentPlain(p.salesAmountAchievementRate) }}</td>
|
||||
<td v-if="isVisible('targetOrderCount')" class="p-6 font-medium">{{ p.targetOrderCount.toLocaleString('zh-CN') }}</td>
|
||||
<td v-if="isVisible('orderCountAchievementRate')" class="p-6 font-black text-blue-600 dark:text-blue-400">{{ formatPercentPlain(p.orderCountAchievementRate) }}</td>
|
||||
<td v-if="isVisible('targetAmount')" class="p-6 font-medium"><AnimatedMoneyCell :value="p.targetAmount" /></td>
|
||||
<td v-if="isVisible('salesAmountAchievementRate')" class="p-6 font-black text-blue-600 dark:text-blue-400">{{ formatPercentPlain(p.salesAmountAchievementRate) }}</td>
|
||||
<!-- 规模 -->
|
||||
<td class="p-6 font-black text-amber-700 dark:text-amber-400"><AnimatedMoneyCell :value="p.dealAmount" /></td>
|
||||
<td class="p-6 font-black"><AnimatedMoneyCell :value="p.salesAmount" /></td>
|
||||
<td class="p-6 font-medium">{{ formatIntCell(p.dealOrderCount) }}</td>
|
||||
<td class="p-6 font-medium">{{ formatIntCell(p.salesOrderCount) }}</td>
|
||||
<td class="p-6 font-medium">{{ formatIntCell(p.dealQuantitySum) }}</td>
|
||||
<td class="p-6 font-medium">{{ formatIntCell(p.salesQuantitySum) }}</td>
|
||||
<td class="p-6 font-medium"><AnimatedMoneyCell :value="p.dealAverageOrderValue" /></td>
|
||||
<td class="p-6 font-medium"><AnimatedMoneyCell :value="p.salesAverageOrderValue" /></td>
|
||||
<td v-if="isVisible('dealAmount')" class="p-6 font-black text-amber-700 dark:text-amber-400"><AnimatedMoneyCell :value="p.dealAmount" /></td>
|
||||
<td v-if="isVisible('salesAmount')" class="p-6 font-black"><AnimatedMoneyCell :value="p.salesAmount" /></td>
|
||||
<td v-if="isVisible('dealOrderCount')" class="p-6 font-medium">{{ formatIntCell(p.dealOrderCount) }}</td>
|
||||
<td v-if="isVisible('salesOrderCount')" class="p-6 font-medium">{{ formatIntCell(p.salesOrderCount) }}</td>
|
||||
<td v-if="isVisible('dealQuantitySum')" class="p-6 font-medium">{{ formatIntCell(p.dealQuantitySum) }}</td>
|
||||
<td v-if="isVisible('salesQuantitySum')" class="p-6 font-medium">{{ formatIntCell(p.salesQuantitySum) }}</td>
|
||||
<td v-if="isVisible('dealAverageOrderValue')" class="p-6 font-medium"><AnimatedMoneyCell :value="p.dealAverageOrderValue" /></td>
|
||||
<td v-if="isVisible('salesAverageOrderValue')" class="p-6 font-medium"><AnimatedMoneyCell :value="p.salesAverageOrderValue" /></td>
|
||||
<!-- 成本 -->
|
||||
<td class="p-6"><AnimatedMoneyCell :value="p.productCost" /></td>
|
||||
<td class="p-6"><AnimatedMoneyCell :value="p.shippingCost" /></td>
|
||||
<td class="p-6"><AnimatedMoneyCell :value="p.otherCost" /></td>
|
||||
<td class="p-6 font-bold text-orange-800 dark:text-orange-300"><AnimatedMoneyCell :value="p.orderCost" /></td>
|
||||
<td class="p-6 font-bold text-rose-600 dark:text-rose-400"><AnimatedMoneyCell :value="p.refundAmount" /></td>
|
||||
<td class="p-6 italic text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]"><AnimatedMoneyCell :value="p.salesTaxAmount" /></td>
|
||||
<td class="p-6"><AnimatedMoneyCell :value="p.totalPromotionFee" /></td>
|
||||
<td class="p-6 text-orange-600 dark:text-orange-400"><AnimatedMoneyCell :value="p.brushFee" /></td>
|
||||
<td v-if="isVisible('productCost')" class="p-6"><AnimatedMoneyCell :value="p.productCost" /></td>
|
||||
<td v-if="isVisible('shippingCost')" class="p-6"><AnimatedMoneyCell :value="p.shippingCost" /></td>
|
||||
<td v-if="isVisible('otherCost')" class="p-6"><AnimatedMoneyCell :value="p.otherCost" /></td>
|
||||
<td v-if="isVisible('orderCost')" class="p-6 font-bold text-orange-800 dark:text-orange-300"><AnimatedMoneyCell :value="p.orderCost" /></td>
|
||||
<td v-if="isVisible('refundAmount')" class="p-6 font-bold text-rose-600 dark:text-rose-400"><AnimatedMoneyCell :value="p.refundAmount" /></td>
|
||||
<td v-if="isVisible('salesTaxAmount')" class="p-6 italic text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]"><AnimatedMoneyCell :value="p.salesTaxAmount" /></td>
|
||||
<td v-if="isVisible('totalPromotionFee')" class="p-6"><AnimatedMoneyCell :value="p.totalPromotionFee" /></td>
|
||||
<td v-if="isVisible('brushFee')" class="p-6 text-orange-600 dark:text-orange-400"><AnimatedMoneyCell :value="p.brushFee" /></td>
|
||||
<!-- 盈利 -->
|
||||
<td class="p-6 font-bold text-emerald-700 dark:text-emerald-400">
|
||||
<td
|
||||
v-if="isVisible('grossProfit')"
|
||||
class="p-6 font-bold text-emerald-700 dark:text-emerald-400"
|
||||
>
|
||||
<AnimatedMoneyCell :value="p.grossProfit" />
|
||||
</td>
|
||||
<td class="p-6 font-bold" :class="p.totalProfitBeforeTax >= 0 ? 'text-slate-800 dark:text-[hsl(0deg_0%_95%)]' : 'text-rose-600 dark:text-rose-400'">
|
||||
<td
|
||||
v-if="isVisible('totalProfitBeforeTax')"
|
||||
class="p-6 font-bold"
|
||||
:class="p.totalProfitBeforeTax >= 0 ? 'text-slate-800 dark:text-[hsl(0deg_0%_95%)]' : 'text-rose-600 dark:text-rose-400'"
|
||||
>
|
||||
<AnimatedMoneyCell :value="p.totalProfitBeforeTax" />
|
||||
</td>
|
||||
<td class="p-6 text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">{{ formatFeeRatioPercent(p.feeRatio) }}</td>
|
||||
<td class="p-6 font-black text-indigo-700 dark:text-indigo-400">{{ p.roi.toFixed(2) }}</td>
|
||||
<td v-if="isVisible('feeRatio')" class="p-6 text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">{{ formatFeeRatioPercent(p.feeRatio) }}</td>
|
||||
<td v-if="isVisible('roi')" class="p-6 font-black text-indigo-700 dark:text-indigo-400">{{ p.roi.toFixed(2) }}</td>
|
||||
<td
|
||||
v-if="isVisible('profitAfterTax')"
|
||||
class="bg-emerald-50 dark:bg-[hsl(142deg_71.8%_29%)] p-6 text-base font-black"
|
||||
:class="p.profitAfterTax >= 0 ? 'text-emerald-600 dark:text-emerald-300' : 'text-rose-600 dark:text-rose-400'"
|
||||
>
|
||||
@@ -402,52 +512,53 @@ const sortedData = computed(() => {
|
||||
<tr class="font-black text-slate-900 dark:text-[hsl(0deg_0%_95%)]">
|
||||
<td class="sticky-col bg-slate-100 dark:bg-[hsl(240deg_3.7%_22%)] border-r-2 border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] p-6 text-base">合计</td>
|
||||
<!-- 目标 -->
|
||||
<td class="p-6">{{ formatIntCell(totalData.targetOrderCount) }}</td>
|
||||
<td class="p-6 text-blue-600 dark:text-blue-400">
|
||||
<td v-if="isVisible('targetOrderCount')" class="p-6">{{ formatIntCell(totalData.targetOrderCount) }}</td>
|
||||
<td v-if="isVisible('orderCountAchievementRate')" class="p-6 text-blue-600 dark:text-blue-400">
|
||||
{{ totalData.orderCountAchievementRate !== undefined ? formatPercentPlain(totalData.orderCountAchievementRate) : '-' }}
|
||||
</td>
|
||||
<td class="p-6"><AnimatedMoneyCell :value="totalData.targetAmount" /></td>
|
||||
<td class="p-6 text-blue-600 dark:text-blue-400">
|
||||
<td v-if="isVisible('targetAmount')" class="p-6"><AnimatedMoneyCell :value="totalData.targetAmount" /></td>
|
||||
<td v-if="isVisible('salesAmountAchievementRate')" class="p-6 text-blue-600 dark:text-blue-400">
|
||||
{{ totalData.salesAmountAchievementRate !== undefined ? formatPercentPlain(totalData.salesAmountAchievementRate) : '-' }}
|
||||
</td>
|
||||
<!-- 规模 -->
|
||||
<td class="p-6 text-amber-700 dark:text-amber-400"><AnimatedMoneyCell :value="totalData.dealAmount" /></td>
|
||||
<td class="p-6"><AnimatedMoneyCell :value="totalData.salesAmount" /></td>
|
||||
<td class="p-6">{{ formatIntCell(totalData.dealOrderCount) }}</td>
|
||||
<td class="p-6">{{ formatIntCell(totalData.salesOrderCount) }}</td>
|
||||
<td class="p-6">{{ formatIntCell(totalData.dealQuantitySum) }}</td>
|
||||
<td class="p-6">{{ formatIntCell(totalData.salesQuantitySum) }}</td>
|
||||
<td class="p-6">
|
||||
<td v-if="isVisible('dealAmount')" class="p-6 text-amber-700 dark:text-amber-400"><AnimatedMoneyCell :value="totalData.dealAmount" /></td>
|
||||
<td v-if="isVisible('salesAmount')" class="p-6"><AnimatedMoneyCell :value="totalData.salesAmount" /></td>
|
||||
<td v-if="isVisible('dealOrderCount')" class="p-6">{{ formatIntCell(totalData.dealOrderCount) }}</td>
|
||||
<td v-if="isVisible('salesOrderCount')" class="p-6">{{ formatIntCell(totalData.salesOrderCount) }}</td>
|
||||
<td v-if="isVisible('dealQuantitySum')" class="p-6">{{ formatIntCell(totalData.dealQuantitySum) }}</td>
|
||||
<td v-if="isVisible('salesQuantitySum')" class="p-6">{{ formatIntCell(totalData.salesQuantitySum) }}</td>
|
||||
<td v-if="isVisible('dealAverageOrderValue')" class="p-6">
|
||||
<AnimatedMoneyCell :value="totalData.dealAverageOrderValue" />
|
||||
</td>
|
||||
<td class="p-6">
|
||||
<td v-if="isVisible('salesAverageOrderValue')" class="p-6">
|
||||
<AnimatedMoneyCell :value="totalData.salesAverageOrderValue" />
|
||||
</td>
|
||||
<!-- 成本 -->
|
||||
<td class="p-6"><AnimatedMoneyCell :value="totalData.productCost" /></td>
|
||||
<td class="p-6"><AnimatedMoneyCell :value="totalData.shippingCost" /></td>
|
||||
<td class="p-6"><AnimatedMoneyCell :value="totalData.otherCost" /></td>
|
||||
<td class="p-6 font-bold text-orange-800 dark:text-orange-300"><AnimatedMoneyCell :value="totalData.orderCost" /></td>
|
||||
<td class="p-6 text-rose-600 dark:text-rose-400"><AnimatedMoneyCell :value="totalData.refundAmount" /></td>
|
||||
<td class="p-6 italic text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||
<td v-if="isVisible('productCost')" class="p-6"><AnimatedMoneyCell :value="totalData.productCost" /></td>
|
||||
<td v-if="isVisible('shippingCost')" class="p-6"><AnimatedMoneyCell :value="totalData.shippingCost" /></td>
|
||||
<td v-if="isVisible('otherCost')" class="p-6"><AnimatedMoneyCell :value="totalData.otherCost" /></td>
|
||||
<td v-if="isVisible('orderCost')" class="p-6 font-bold text-orange-800 dark:text-orange-300"><AnimatedMoneyCell :value="totalData.orderCost" /></td>
|
||||
<td v-if="isVisible('refundAmount')" class="p-6 text-rose-600 dark:text-rose-400"><AnimatedMoneyCell :value="totalData.refundAmount" /></td>
|
||||
<td v-if="isVisible('salesTaxAmount')" class="p-6 italic text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||
<AnimatedMoneyCell :value="totalData.salesTaxAmount" />
|
||||
</td>
|
||||
<td class="p-6"><AnimatedMoneyCell :value="totalData.totalPromotionFee" /></td>
|
||||
<td class="p-6 text-orange-600 dark:text-orange-400"><AnimatedMoneyCell :value="totalData.brushFee" /></td>
|
||||
<td v-if="isVisible('totalPromotionFee')" class="p-6"><AnimatedMoneyCell :value="totalData.totalPromotionFee" /></td>
|
||||
<td v-if="isVisible('brushFee')" class="p-6 text-orange-600 dark:text-orange-400"><AnimatedMoneyCell :value="totalData.brushFee" /></td>
|
||||
<!-- 盈利 -->
|
||||
<td class="p-6 text-emerald-700 dark:text-emerald-400">
|
||||
<td v-if="isVisible('grossProfit')" class="p-6 text-emerald-700 dark:text-emerald-400">
|
||||
<AnimatedMoneyCell :value="totalData.grossProfit" />
|
||||
</td>
|
||||
<td class="p-6">
|
||||
<td v-if="isVisible('totalProfitBeforeTax')" class="p-6">
|
||||
<AnimatedMoneyCell :value="totalData.totalProfitBeforeTax" />
|
||||
</td>
|
||||
<td class="p-6 text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||
<td v-if="isVisible('feeRatio')" class="p-6 text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||
{{ totalData.feeRatio !== undefined ? formatFeeRatioPercent(totalData.feeRatio) : '-' }}
|
||||
</td>
|
||||
<td class="p-6 text-indigo-700 dark:text-indigo-400">
|
||||
<td v-if="isVisible('roi')" class="p-6 text-indigo-700 dark:text-indigo-400">
|
||||
{{ cellRoi(totalData.roi) }}
|
||||
</td>
|
||||
<td
|
||||
v-if="isVisible('profitAfterTax')"
|
||||
class="bg-emerald-100 p-6 text-base dark:bg-emerald-950"
|
||||
:class="(totalData.profitAfterTax ?? 0) >= 0 ? 'text-emerald-700 dark:text-emerald-300' : 'text-rose-600 dark:text-rose-400'"
|
||||
>
|
||||
@@ -457,7 +568,7 @@ const sortedData = computed(() => {
|
||||
</tfoot>
|
||||
<tfoot v-else class="bg-slate-100 dark:bg-[hsl(240deg_3.7%_22%)]">
|
||||
<tr class="text-center text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||
<td :colspan="platformExportMode ? 23 : 22" class="p-6">暂无数据</td>
|
||||
<td :colspan="emptyColspan" class="p-6">暂无数据</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
+182
-79
@@ -15,7 +15,9 @@ import {
|
||||
storeOverviewHints,
|
||||
} from '#/utils/overview-table-hints';
|
||||
|
||||
import { useOverviewTableColumnPrefs } from '../composables/useOverviewTableColumnPrefs';
|
||||
import { FINANCE_PANEL_SHELL } from '../constants/finance-ui';
|
||||
import OverviewTableColumnSettings from './OverviewTableColumnSettings.vue';
|
||||
|
||||
defineOptions({ name: 'WorkbenchShopSummaryTable' });
|
||||
|
||||
@@ -42,6 +44,19 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
});
|
||||
const emit = defineEmits<Emits>();
|
||||
|
||||
const {
|
||||
visibleIds,
|
||||
isVisible,
|
||||
groupColspan,
|
||||
metricColCount,
|
||||
applyVisible,
|
||||
resetToDefault,
|
||||
} = useOverviewTableColumnPrefs('shop');
|
||||
|
||||
const emptyColspan = computed(
|
||||
() => (props.shopExportMode ? 2 : 1) + metricColCount.value,
|
||||
);
|
||||
|
||||
const allShopsSelected = computed(() => {
|
||||
const total = props.shopSummary?.shops?.length || 0;
|
||||
return total > 0 && props.selectedExportShopIds.length === total;
|
||||
@@ -72,6 +87,13 @@ const cellRoi = (v: number | null | undefined) =>
|
||||
{{ props.headingSubtitle }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-3">
|
||||
<OverviewTableColumnSettings
|
||||
table-key="shop"
|
||||
:visible-ids="visibleIds"
|
||||
@apply="applyVisible"
|
||||
@reset="resetToDefault"
|
||||
/>
|
||||
<PermissionGate code="data:export">
|
||||
<div class="flex items-center gap-3">
|
||||
<template v-if="shopExportMode">
|
||||
@@ -105,6 +127,7 @@ const cellRoi = (v: number | null | undefined) =>
|
||||
</template>
|
||||
</div>
|
||||
</PermissionGate>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-container">
|
||||
@@ -146,25 +169,29 @@ const cellRoi = (v: number | null | undefined) =>
|
||||
店铺
|
||||
</th>
|
||||
<th
|
||||
colspan="4"
|
||||
v-if="groupColspan('target') > 0"
|
||||
:colspan="groupColspan('target')"
|
||||
class="border-b border-l border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] dark:border-l-[hsl(240deg_3.7%_22%)] dark:border-[hsl(240deg_3.7%_22%)] bg-blue-50/50 dark:bg-[hsl(217.2deg_32.6%_17.5%/50%)] p-3 text-center text-blue-700 dark:text-blue-400"
|
||||
>
|
||||
目标达成维度
|
||||
</th>
|
||||
<th
|
||||
colspan="8"
|
||||
v-if="groupColspan('scale') > 0"
|
||||
:colspan="groupColspan('scale')"
|
||||
class="border-b border-l border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] dark:border-l-[hsl(240deg_3.7%_22%)] dark:border-[hsl(240deg_3.7%_22%)] bg-slate-100/50 dark:bg-[hsl(240deg_3.7%_22%/50%)] p-3 text-center"
|
||||
>
|
||||
经营规模维度
|
||||
</th>
|
||||
<th
|
||||
colspan="8"
|
||||
v-if="groupColspan('cost') > 0"
|
||||
:colspan="groupColspan('cost')"
|
||||
class="border-b border-l border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] dark:border-l-[hsl(240deg_3.7%_22%)] dark:border-[hsl(240deg_3.7%_22%)] bg-orange-50/50 dark:bg-[hsl(24deg_9.8%_15%/50%)] p-3 text-center text-orange-700 dark:text-orange-400"
|
||||
>
|
||||
成本费用维度
|
||||
</th>
|
||||
<th
|
||||
colspan="5"
|
||||
v-if="groupColspan('profit') > 0"
|
||||
:colspan="groupColspan('profit')"
|
||||
class="border-b border-l border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] dark:border-l-[hsl(240deg_3.7%_22%)] dark:border-[hsl(240deg_3.7%_22%)] bg-emerald-50/50 dark:bg-[hsl(142deg_71.8%_29%)] p-3 text-center text-emerald-700 dark:text-emerald-200"
|
||||
>
|
||||
盈利分析维度
|
||||
@@ -172,94 +199,136 @@ const cellRoi = (v: number | null | undefined) =>
|
||||
</tr>
|
||||
<tr class="bg-slate-50 dark:bg-[hsl(240deg_3.7%_15.9%)] text-sm">
|
||||
<!-- 目标 -->
|
||||
<th class="border-b border-l border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4">
|
||||
<th
|
||||
v-if="isVisible('targetOrderCount')"
|
||||
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">
|
||||
<th
|
||||
v-if="isVisible('orderCountAchievementRate')"
|
||||
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">
|
||||
<th v-if="isVisible('targetAmount')" 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">
|
||||
<th
|
||||
v-if="isVisible('salesAmountAchievementRate')"
|
||||
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-amber-700 dark:text-amber-400">
|
||||
<th
|
||||
v-if="isVisible('dealAmount')"
|
||||
class="border-b border-l border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4 font-black text-amber-700 dark:text-amber-400"
|
||||
>
|
||||
<OverviewColumnHint :title="storeOverviewHints.dealAmount">成交金额</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b px-6 py-4 font-black text-slate-900 dark:text-[hsl(0deg_0%_95%)]">
|
||||
<th
|
||||
v-if="isVisible('salesAmount')"
|
||||
class="border-b 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">
|
||||
<th v-if="isVisible('dealOrderCount')" class="border-b px-6 py-4">
|
||||
<OverviewColumnHint :title="storeOverviewHints.dealOrderCount">成交单量</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b px-6 py-4">
|
||||
<th v-if="isVisible('salesOrderCount')" class="border-b px-6 py-4">
|
||||
<OverviewColumnHint :title="storeOverviewHints.salesOrderCount">净销售单量</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b px-6 py-4">
|
||||
<th v-if="isVisible('dealQuantitySum')" class="border-b px-6 py-4">
|
||||
<OverviewColumnHint :title="storeOverviewHints.dealQuantitySum">成交量</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b px-6 py-4">
|
||||
<th v-if="isVisible('salesQuantitySum')" class="border-b px-6 py-4">
|
||||
<OverviewColumnHint :title="storeOverviewHints.salesQuantitySum">净销量</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b px-6 py-4">
|
||||
<th v-if="isVisible('dealAverageOrderValue')" class="border-b px-6 py-4">
|
||||
<OverviewColumnHint :title="storeOverviewHints.dealAverageOrderValue">成交客单价</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b px-6 py-4">
|
||||
<th v-if="isVisible('salesAverageOrderValue')" class="border-b px-6 py-4">
|
||||
<OverviewColumnHint :title="storeOverviewHints.salesAverageOrderValue">净销售客单价</OverviewColumnHint>
|
||||
</th>
|
||||
<!-- 成本 -->
|
||||
<th class="border-b border-l border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4">
|
||||
<th
|
||||
v-if="isVisible('productCost')"
|
||||
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">
|
||||
<th v-if="isVisible('shippingCost')" class="border-b px-6 py-4">
|
||||
<OverviewColumnHint :title="storeOverviewHints.shippingCost">运费</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b px-6 py-4">
|
||||
<th v-if="isVisible('otherCost')" 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">
|
||||
<th
|
||||
v-if="isVisible('orderCost')"
|
||||
class="border-b px-6 py-4 font-bold text-orange-800 dark:text-orange-300"
|
||||
>
|
||||
<OverviewColumnHint :title="storeOverviewHints.orderCost">订单成本</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b px-6 py-4 font-bold text-rose-600 dark:text-rose-400">
|
||||
<th
|
||||
v-if="isVisible('refundAmount')"
|
||||
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 italic text-rose-500 dark:text-rose-400">
|
||||
<th
|
||||
v-if="isVisible('salesTaxAmount')"
|
||||
class="border-b px-6 py-4 italic text-rose-500 dark:text-rose-400"
|
||||
>
|
||||
<OverviewColumnHint :title="salesTaxColumnHint(taxRate)">
|
||||
{{ (taxRate * 100).toFixed(0) }}%税额
|
||||
</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b px-6 py-4">
|
||||
<th v-if="isVisible('totalPromotionFee')" 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">
|
||||
<th
|
||||
v-if="isVisible('brushFee')"
|
||||
class="border-b px-6 py-4 text-orange-600 dark:text-orange-400"
|
||||
>
|
||||
<OverviewColumnHint :title="storeOverviewHints.brushFee">刷单费</OverviewColumnHint>
|
||||
</th>
|
||||
<!-- 盈利 -->
|
||||
<th class="border-b border-l border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4 font-bold text-emerald-700 dark:text-emerald-400">
|
||||
<th
|
||||
v-if="isVisible('grossProfit')"
|
||||
class="border-b border-l border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4 font-bold text-emerald-700 dark:text-emerald-400"
|
||||
>
|
||||
<OverviewColumnHint :title="storeOverviewHints.grossProfit">毛利</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b px-6 py-4 font-bold">
|
||||
<th v-if="isVisible('totalProfitBeforeTax')" class="border-b px-6 py-4 font-bold">
|
||||
<OverviewColumnHint :title="storeOverviewHints.totalProfitBeforeTax">
|
||||
税前净利
|
||||
</OverviewColumnHint>
|
||||
</th>
|
||||
<th class="border-b px-6 py-4 text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||
<th
|
||||
v-if="isVisible('feeRatio')"
|
||||
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 font-black text-indigo-700 dark:text-indigo-400">
|
||||
<th
|
||||
v-if="isVisible('roi')"
|
||||
class="border-b 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">
|
||||
<th
|
||||
v-if="isVisible('profitAfterTax')"
|
||||
class="border-b bg-emerald-600 dark:bg-emerald-600 px-6 py-4 font-black text-white"
|
||||
>
|
||||
<OverviewColumnHint light :title="storeOverviewHints.profitAfterTax">
|
||||
税后净利
|
||||
</OverviewColumnHint>
|
||||
@@ -302,20 +371,26 @@ const cellRoi = (v: number | null | undefined) =>
|
||||
</span>
|
||||
</td>
|
||||
<!-- 目标 -->
|
||||
<td class="p-6 font-medium">
|
||||
<td v-if="isVisible('targetOrderCount')" class="p-6 font-medium">
|
||||
{{ formatIntCell(shop.targetOrderCount) }}
|
||||
</td>
|
||||
<td class="p-6 font-black text-blue-600 dark:text-blue-400">
|
||||
<td
|
||||
v-if="isVisible('orderCountAchievementRate')"
|
||||
class="p-6 font-black text-blue-600 dark:text-blue-400"
|
||||
>
|
||||
{{
|
||||
shop.orderCountAchievementRate !== undefined
|
||||
? formatPercentPlain(shop.orderCountAchievementRate)
|
||||
: '-'
|
||||
}}
|
||||
</td>
|
||||
<td class="p-6 font-medium">
|
||||
<td v-if="isVisible('targetAmount')" class="p-6 font-medium">
|
||||
<AnimatedMoneyCell :value="shop.targetAmount" />
|
||||
</td>
|
||||
<td class="p-6 font-black text-blue-600 dark:text-blue-400">
|
||||
<td
|
||||
v-if="isVisible('salesAmountAchievementRate')"
|
||||
class="p-6 font-black text-blue-600 dark:text-blue-400"
|
||||
>
|
||||
{{
|
||||
shop.salesAmountAchievementRate !== undefined
|
||||
? formatPercentPlain(shop.salesAmountAchievementRate)
|
||||
@@ -323,78 +398,105 @@ const cellRoi = (v: number | null | undefined) =>
|
||||
}}
|
||||
</td>
|
||||
<!-- 规模 -->
|
||||
<td class="p-6 font-black text-amber-700 dark:text-amber-400">
|
||||
<td
|
||||
v-if="isVisible('dealAmount')"
|
||||
class="p-6 font-black text-amber-700 dark:text-amber-400"
|
||||
>
|
||||
<AnimatedMoneyCell :value="shop.dealAmount" />
|
||||
</td>
|
||||
<td class="p-6 font-black">
|
||||
<td v-if="isVisible('salesAmount')" class="p-6 font-black">
|
||||
<AnimatedMoneyCell :value="shop.salesAmount" />
|
||||
</td>
|
||||
<td class="p-6 font-medium">
|
||||
<td v-if="isVisible('dealOrderCount')" class="p-6 font-medium">
|
||||
{{ formatIntCell(shop.dealOrderCount) }}
|
||||
</td>
|
||||
<td class="p-6 font-medium">
|
||||
<td v-if="isVisible('salesOrderCount')" class="p-6 font-medium">
|
||||
{{ formatIntCell(shop.salesOrderCount) }}
|
||||
</td>
|
||||
<td class="p-6 font-medium">
|
||||
<td v-if="isVisible('dealQuantitySum')" class="p-6 font-medium">
|
||||
{{ formatIntCell(shop.dealQuantitySum) }}
|
||||
</td>
|
||||
<td class="p-6 font-medium">
|
||||
<td v-if="isVisible('salesQuantitySum')" class="p-6 font-medium">
|
||||
{{ formatIntCell(shop.salesQuantitySum) }}
|
||||
</td>
|
||||
<td class="p-6 font-medium">
|
||||
<td v-if="isVisible('dealAverageOrderValue')" class="p-6 font-medium">
|
||||
<AnimatedMoneyCell :value="shop.dealAverageOrderValue" />
|
||||
</td>
|
||||
<td class="p-6 font-medium">
|
||||
<td v-if="isVisible('salesAverageOrderValue')" class="p-6 font-medium">
|
||||
<AnimatedMoneyCell :value="shop.salesAverageOrderValue" />
|
||||
</td>
|
||||
<!-- 成本 -->
|
||||
<td class="p-6">
|
||||
<td v-if="isVisible('productCost')" class="p-6">
|
||||
<AnimatedMoneyCell :value="shop.productCost" />
|
||||
</td>
|
||||
<td class="p-6">
|
||||
<td v-if="isVisible('shippingCost')" class="p-6">
|
||||
<AnimatedMoneyCell :value="shop.shippingCost" />
|
||||
</td>
|
||||
<td class="p-6">
|
||||
<td v-if="isVisible('otherCost')" class="p-6">
|
||||
<AnimatedMoneyCell :value="shop.otherCost" />
|
||||
</td>
|
||||
<td class="p-6 font-bold text-orange-800 dark:text-orange-300">
|
||||
<td
|
||||
v-if="isVisible('orderCost')"
|
||||
class="p-6 font-bold text-orange-800 dark:text-orange-300"
|
||||
>
|
||||
<AnimatedMoneyCell :value="shop.orderCost" />
|
||||
</td>
|
||||
<td class="p-6 font-bold text-rose-600 dark:text-rose-400">
|
||||
<td
|
||||
v-if="isVisible('refundAmount')"
|
||||
class="p-6 font-bold text-rose-600 dark:text-rose-400"
|
||||
>
|
||||
<AnimatedMoneyCell :value="shop.refundAmount" />
|
||||
</td>
|
||||
<td class="p-6 italic text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||
<td
|
||||
v-if="isVisible('salesTaxAmount')"
|
||||
class="p-6 italic text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
>
|
||||
<AnimatedMoneyCell :value="shop.salesTaxAmount" />
|
||||
</td>
|
||||
<td class="p-6">
|
||||
<td v-if="isVisible('totalPromotionFee')" class="p-6">
|
||||
<AnimatedMoneyCell :value="shop.totalPromotionFee" />
|
||||
</td>
|
||||
<td class="p-6 text-orange-600 dark:text-orange-400">
|
||||
<td
|
||||
v-if="isVisible('brushFee')"
|
||||
class="p-6 text-orange-600 dark:text-orange-400"
|
||||
>
|
||||
<AnimatedMoneyCell :value="shop.brushFee" />
|
||||
</td>
|
||||
<!-- 盈利 -->
|
||||
<td class="p-6 font-bold text-emerald-700 dark:text-emerald-400">
|
||||
<td
|
||||
v-if="isVisible('grossProfit')"
|
||||
class="p-6 font-bold text-emerald-700 dark:text-emerald-400"
|
||||
>
|
||||
<AnimatedMoneyCell :value="shop.grossProfit" />
|
||||
</td>
|
||||
<td class="p-6 font-bold">
|
||||
<td v-if="isVisible('totalProfitBeforeTax')" class="p-6 font-bold">
|
||||
<AnimatedMoneyCell :value="shop.totalProfitBeforeTax" />
|
||||
</td>
|
||||
<td class="p-6 text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||
<td
|
||||
v-if="isVisible('feeRatio')"
|
||||
class="p-6 text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
>
|
||||
{{
|
||||
shop.feeRatio !== undefined
|
||||
? formatFeeRatioPercent(shop.feeRatio)
|
||||
: '-'
|
||||
}}
|
||||
</td>
|
||||
<td class="p-6 font-black text-indigo-700 dark:text-indigo-400">
|
||||
<td
|
||||
v-if="isVisible('roi')"
|
||||
class="p-6 font-black text-indigo-700 dark:text-indigo-400"
|
||||
>
|
||||
{{ cellRoi(shop.roi) }}
|
||||
</td>
|
||||
<td class="bg-emerald-50 dark:bg-[hsl(142deg_71.8%_29%)] p-6 text-base font-black text-emerald-600 dark:text-emerald-300">
|
||||
<td
|
||||
v-if="isVisible('profitAfterTax')"
|
||||
class="bg-emerald-50 dark:bg-[hsl(142deg_71.8%_29%)] p-6 text-base font-black text-emerald-600 dark:text-emerald-300"
|
||||
>
|
||||
<AnimatedMoneyCell :value="shop.profitAfterTax" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="!shopSummary?.shops?.length">
|
||||
<td :colspan="shopExportMode ? 23 : 22" class="p-8 text-center text-gray-400">
|
||||
<td :colspan="emptyColspan" class="p-8 text-center text-gray-400">
|
||||
暂无数据
|
||||
</td>
|
||||
</tr>
|
||||
@@ -409,16 +511,16 @@ const cellRoi = (v: number | null | undefined) =>
|
||||
合计
|
||||
</td>
|
||||
<!-- 目标 -->
|
||||
<td class="p-6">{{ formatIntCell(shopSummary?.total?.targetOrderCount) }}</td>
|
||||
<td class="p-6 text-blue-600 dark:text-blue-400">
|
||||
<td v-if="isVisible('targetOrderCount')" class="p-6">{{ formatIntCell(shopSummary?.total?.targetOrderCount) }}</td>
|
||||
<td v-if="isVisible('orderCountAchievementRate')" class="p-6 text-blue-600 dark:text-blue-400">
|
||||
{{
|
||||
shopSummary?.total?.orderCountAchievementRate !== undefined
|
||||
? formatPercentPlain(shopSummary?.total?.orderCountAchievementRate)
|
||||
: '-'
|
||||
}}
|
||||
</td>
|
||||
<td class="p-6"><AnimatedMoneyCell :value="shopSummary?.total?.targetAmount" /></td>
|
||||
<td class="p-6 text-blue-600 dark:text-blue-400">
|
||||
<td v-if="isVisible('targetAmount')" class="p-6"><AnimatedMoneyCell :value="shopSummary?.total?.targetAmount" /></td>
|
||||
<td v-if="isVisible('salesAmountAchievementRate')" class="p-6 text-blue-600 dark:text-blue-400">
|
||||
{{
|
||||
shopSummary?.total?.salesAmountAchievementRate !== undefined
|
||||
? formatPercentPlain(shopSummary?.total?.salesAmountAchievementRate)
|
||||
@@ -426,33 +528,34 @@ const cellRoi = (v: number | null | undefined) =>
|
||||
}}
|
||||
</td>
|
||||
<!-- 规模 -->
|
||||
<td class="p-6 text-amber-700 dark:text-amber-400"><AnimatedMoneyCell :value="shopSummary?.total?.dealAmount" /></td>
|
||||
<td class="p-6"><AnimatedMoneyCell :value="shopSummary?.total?.salesAmount" /></td>
|
||||
<td class="p-6">{{ formatIntCell(shopSummary?.total?.dealOrderCount) }}</td>
|
||||
<td class="p-6">{{ formatIntCell(shopSummary?.total?.salesOrderCount) }}</td>
|
||||
<td class="p-6">{{ formatIntCell(shopSummary?.total?.dealQuantitySum) }}</td>
|
||||
<td class="p-6">{{ formatIntCell(shopSummary?.total?.salesQuantitySum) }}</td>
|
||||
<td class="p-6">
|
||||
<td v-if="isVisible('dealAmount')" class="p-6 text-amber-700 dark:text-amber-400"><AnimatedMoneyCell :value="shopSummary?.total?.dealAmount" /></td>
|
||||
<td v-if="isVisible('salesAmount')" class="p-6"><AnimatedMoneyCell :value="shopSummary?.total?.salesAmount" /></td>
|
||||
<td v-if="isVisible('dealOrderCount')" class="p-6">{{ formatIntCell(shopSummary?.total?.dealOrderCount) }}</td>
|
||||
<td v-if="isVisible('salesOrderCount')" class="p-6">{{ formatIntCell(shopSummary?.total?.salesOrderCount) }}</td>
|
||||
<td v-if="isVisible('dealQuantitySum')" class="p-6">{{ formatIntCell(shopSummary?.total?.dealQuantitySum) }}</td>
|
||||
<td v-if="isVisible('salesQuantitySum')" class="p-6">{{ formatIntCell(shopSummary?.total?.salesQuantitySum) }}</td>
|
||||
<td v-if="isVisible('dealAverageOrderValue')" class="p-6">
|
||||
<AnimatedMoneyCell :value="shopSummary?.total?.dealAverageOrderValue" />
|
||||
</td>
|
||||
<td class="p-6">
|
||||
<td v-if="isVisible('salesAverageOrderValue')" class="p-6">
|
||||
<AnimatedMoneyCell :value="shopSummary?.total?.salesAverageOrderValue" />
|
||||
</td>
|
||||
<!-- 成本 -->
|
||||
<td class="p-6"><AnimatedMoneyCell :value="shopSummary?.total?.productCost" /></td>
|
||||
<td class="p-6"><AnimatedMoneyCell :value="shopSummary?.total?.shippingCost" /></td>
|
||||
<td class="p-6"><AnimatedMoneyCell :value="shopSummary?.total?.otherCost" /></td>
|
||||
<td class="p-6 font-bold text-orange-800 dark:text-orange-300"><AnimatedMoneyCell :value="shopSummary?.total?.orderCost" /></td>
|
||||
<td class="p-6 text-rose-600 dark:text-rose-400"><AnimatedMoneyCell :value="shopSummary?.total?.refundAmount" /></td>
|
||||
<td class="p-6 italic text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]"><AnimatedMoneyCell :value="shopSummary?.total?.salesTaxAmount" /></td>
|
||||
<td class="p-6"><AnimatedMoneyCell :value="shopSummary?.total?.totalPromotionFee" /></td>
|
||||
<td class="p-6 text-orange-600 dark:text-orange-400"><AnimatedMoneyCell :value="shopSummary?.total?.brushFee" /></td>
|
||||
<td v-if="isVisible('productCost')" class="p-6"><AnimatedMoneyCell :value="shopSummary?.total?.productCost" /></td>
|
||||
<td v-if="isVisible('shippingCost')" class="p-6"><AnimatedMoneyCell :value="shopSummary?.total?.shippingCost" /></td>
|
||||
<td v-if="isVisible('otherCost')" class="p-6"><AnimatedMoneyCell :value="shopSummary?.total?.otherCost" /></td>
|
||||
<td v-if="isVisible('orderCost')" class="p-6 font-bold text-orange-800 dark:text-orange-300"><AnimatedMoneyCell :value="shopSummary?.total?.orderCost" /></td>
|
||||
<td v-if="isVisible('refundAmount')" class="p-6 text-rose-600 dark:text-rose-400"><AnimatedMoneyCell :value="shopSummary?.total?.refundAmount" /></td>
|
||||
<td v-if="isVisible('salesTaxAmount')" class="p-6 italic text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]"><AnimatedMoneyCell :value="shopSummary?.total?.salesTaxAmount" /></td>
|
||||
<td v-if="isVisible('totalPromotionFee')" class="p-6"><AnimatedMoneyCell :value="shopSummary?.total?.totalPromotionFee" /></td>
|
||||
<td v-if="isVisible('brushFee')" class="p-6 text-orange-600 dark:text-orange-400"><AnimatedMoneyCell :value="shopSummary?.total?.brushFee" /></td>
|
||||
<!-- 盈利 -->
|
||||
<td class="p-6 text-emerald-700 dark:text-emerald-400"><AnimatedMoneyCell :value="shopSummary?.total?.grossProfit" /></td>
|
||||
<td class="p-6"><AnimatedMoneyCell :value="shopSummary?.total?.totalProfitBeforeTax" /></td>
|
||||
<td class="p-6 text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">{{ shopSummary?.total?.feeRatio !== undefined ? formatFeeRatioPercent(shopSummary?.total?.feeRatio) : '-' }}</td>
|
||||
<td class="p-6 text-indigo-700 dark:text-indigo-400">{{ cellRoi(shopSummary?.total?.roi) }}</td>
|
||||
<td v-if="isVisible('grossProfit')" class="p-6 text-emerald-700 dark:text-emerald-400"><AnimatedMoneyCell :value="shopSummary?.total?.grossProfit" /></td>
|
||||
<td v-if="isVisible('totalProfitBeforeTax')" class="p-6"><AnimatedMoneyCell :value="shopSummary?.total?.totalProfitBeforeTax" /></td>
|
||||
<td v-if="isVisible('feeRatio')" class="p-6 text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">{{ shopSummary?.total?.feeRatio !== undefined ? formatFeeRatioPercent(shopSummary?.total?.feeRatio) : '-' }}</td>
|
||||
<td v-if="isVisible('roi')" class="p-6 text-indigo-700 dark:text-indigo-400">{{ cellRoi(shopSummary?.total?.roi) }}</td>
|
||||
<td
|
||||
v-if="isVisible('profitAfterTax')"
|
||||
class="bg-emerald-100 p-6 text-base dark:bg-emerald-950"
|
||||
:class="(shopSummary?.total?.profitAfterTax ?? 0) < 0 ? 'text-rose-600 dark:text-rose-400' : 'text-emerald-700 dark:text-emerald-300'"
|
||||
><AnimatedMoneyCell :value="shopSummary?.total?.profitAfterTax" /></td>
|
||||
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import type {
|
||||
OverviewColGroupId,
|
||||
OverviewColumnId,
|
||||
OverviewTableKey,
|
||||
} from '../constants/overview-table-columns';
|
||||
import {
|
||||
columnsForTable,
|
||||
defaultVisibleIds,
|
||||
OVERVIEW_TABLE_COLUMN_PREFS_KEY,
|
||||
} from '../constants/overview-table-columns';
|
||||
|
||||
type PrefsMap = Partial<Record<OverviewTableKey, string[]>>;
|
||||
|
||||
function normalizeIds(
|
||||
tableKey: OverviewTableKey,
|
||||
raw: string[] | undefined,
|
||||
): OverviewColumnId[] {
|
||||
const allowed = new Set(columnsForTable(tableKey).map((c) => c.id));
|
||||
const picked = (raw ?? []).filter((id): id is OverviewColumnId =>
|
||||
allowed.has(id as OverviewColumnId),
|
||||
);
|
||||
return picked.length > 0 ? picked : defaultVisibleIds(tableKey);
|
||||
}
|
||||
|
||||
function loadAll(): PrefsMap {
|
||||
try {
|
||||
const raw = localStorage.getItem(OVERVIEW_TABLE_COLUMN_PREFS_KEY);
|
||||
if (!raw) return {};
|
||||
const parsed = JSON.parse(raw) as PrefsMap;
|
||||
return parsed && typeof parsed === 'object' ? parsed : {};
|
||||
} catch {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
function saveAll(map: PrefsMap) {
|
||||
localStorage.setItem(OVERVIEW_TABLE_COLUMN_PREFS_KEY, JSON.stringify(map));
|
||||
}
|
||||
|
||||
/**
|
||||
* 经营概览单表列显隐偏好(localStorage,按 shop/platform/category/product 分键)。
|
||||
*/
|
||||
export function useOverviewTableColumnPrefs(tableKey: OverviewTableKey) {
|
||||
const visibleIds = ref<OverviewColumnId[]>(
|
||||
normalizeIds(tableKey, loadAll()[tableKey]),
|
||||
);
|
||||
|
||||
const visibleSet = computed(() => new Set(visibleIds.value));
|
||||
|
||||
function isVisible(id: OverviewColumnId): boolean {
|
||||
return visibleSet.value.has(id);
|
||||
}
|
||||
|
||||
function groupColspan(group: OverviewColGroupId): number {
|
||||
return columnsForTable(tableKey).filter(
|
||||
(c) => c.group === group && visibleSet.value.has(c.id),
|
||||
).length;
|
||||
}
|
||||
|
||||
/** 指标列数量(不含首列/导出勾选列) */
|
||||
const metricColCount = computed(() => visibleIds.value.length);
|
||||
|
||||
function persist(ids: OverviewColumnId[]) {
|
||||
visibleIds.value = ids;
|
||||
const all = loadAll();
|
||||
all[tableKey] = ids;
|
||||
saveAll(all);
|
||||
}
|
||||
|
||||
function applyVisible(ids: string[]) {
|
||||
const next = normalizeIds(tableKey, ids);
|
||||
if (next.length === 0) {
|
||||
persist(defaultVisibleIds(tableKey));
|
||||
return;
|
||||
}
|
||||
// 保持目录顺序
|
||||
const order = columnsForTable(tableKey).map((c) => c.id);
|
||||
persist(order.filter((id) => next.includes(id)));
|
||||
}
|
||||
|
||||
function resetToDefault() {
|
||||
persist(defaultVisibleIds(tableKey));
|
||||
}
|
||||
|
||||
return {
|
||||
visibleIds,
|
||||
isVisible,
|
||||
groupColspan,
|
||||
metricColCount,
|
||||
applyVisible,
|
||||
resetToDefault,
|
||||
};
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
/** 经营概览底部四表:可配置列目录(首列维度名固定不可隐藏) */
|
||||
|
||||
export type OverviewTableKey = 'shop' | 'platform' | 'category' | 'product';
|
||||
|
||||
export type OverviewColGroupId = 'target' | 'scale' | 'cost' | 'profit';
|
||||
|
||||
export type OverviewColumnId =
|
||||
| 'targetOrderCount'
|
||||
| 'orderCountAchievementRate'
|
||||
| 'targetAmount'
|
||||
| 'salesAmountAchievementRate'
|
||||
| 'dealAmount'
|
||||
| 'salesAmount'
|
||||
| 'dealOrderCount'
|
||||
| 'salesOrderCount'
|
||||
| 'dealQuantitySum'
|
||||
| 'salesQuantitySum'
|
||||
| 'dealAverageOrderValue'
|
||||
| 'salesAverageOrderValue'
|
||||
| 'productCost'
|
||||
| 'shippingCost'
|
||||
| 'otherCost'
|
||||
| 'orderCost'
|
||||
| 'refundAmount'
|
||||
| 'salesTaxAmount'
|
||||
| 'totalPromotionFee'
|
||||
| 'brushFee'
|
||||
| 'grossProfit'
|
||||
| 'totalProfitBeforeTax'
|
||||
| 'feeRatio'
|
||||
| 'roi'
|
||||
| 'profitAfterTax';
|
||||
|
||||
export type OverviewColumnDef = {
|
||||
id: OverviewColumnId;
|
||||
label: string;
|
||||
group: OverviewColGroupId;
|
||||
};
|
||||
|
||||
export type OverviewColGroupDef = {
|
||||
id: OverviewColGroupId;
|
||||
label: string;
|
||||
/** 表头分组着色用 */
|
||||
tone: 'target' | 'scale' | 'cost' | 'profit';
|
||||
};
|
||||
|
||||
export const OVERVIEW_COL_GROUPS: OverviewColGroupDef[] = [
|
||||
{ id: 'target', label: '目标达成维度', tone: 'target' },
|
||||
{ id: 'scale', label: '经营规模维度', tone: 'scale' },
|
||||
{ id: 'cost', label: '成本费用维度', tone: 'cost' },
|
||||
{ id: 'profit', label: '盈利分析维度', tone: 'profit' },
|
||||
];
|
||||
|
||||
/** 全量指标列(店铺/平台含目标;品类/商品不含) */
|
||||
export const OVERVIEW_COLUMNS: OverviewColumnDef[] = [
|
||||
{ id: 'targetOrderCount', label: '目标单量', group: 'target' },
|
||||
{ id: 'orderCountAchievementRate', label: '单量达成率', group: 'target' },
|
||||
{ id: 'targetAmount', label: '目标额', group: 'target' },
|
||||
{ id: 'salesAmountAchievementRate', label: '销售达成率', group: 'target' },
|
||||
{ id: 'dealAmount', label: '成交金额', group: 'scale' },
|
||||
{ id: 'salesAmount', label: '净销售额', group: 'scale' },
|
||||
{ id: 'dealOrderCount', label: '成交单量', group: 'scale' },
|
||||
{ id: 'salesOrderCount', label: '净销售单量', group: 'scale' },
|
||||
{ id: 'dealQuantitySum', label: '成交量', group: 'scale' },
|
||||
{ id: 'salesQuantitySum', label: '净销量', group: 'scale' },
|
||||
{ id: 'dealAverageOrderValue', label: '成交客单价', group: 'scale' },
|
||||
{ id: 'salesAverageOrderValue', label: '净销售客单价', group: 'scale' },
|
||||
{ id: 'productCost', label: '商品成本', group: 'cost' },
|
||||
{ id: 'shippingCost', label: '运费', group: 'cost' },
|
||||
{ id: 'otherCost', label: '其他成本', group: 'cost' },
|
||||
{ id: 'orderCost', label: '订单成本', group: 'cost' },
|
||||
{ id: 'refundAmount', label: '退款金额', group: 'cost' },
|
||||
{ id: 'salesTaxAmount', label: '税额', group: 'cost' },
|
||||
{ id: 'totalPromotionFee', label: '推广费', group: 'cost' },
|
||||
{ id: 'brushFee', label: '刷单费', group: 'cost' },
|
||||
{ id: 'grossProfit', label: '毛利', group: 'profit' },
|
||||
{ id: 'totalProfitBeforeTax', label: '税前净利', group: 'profit' },
|
||||
{ id: 'feeRatio', label: '费比%', group: 'profit' },
|
||||
{ id: 'roi', label: 'ROI', group: 'profit' },
|
||||
{ id: 'profitAfterTax', label: '税后净利', group: 'profit' },
|
||||
];
|
||||
|
||||
const TARGET_IDS = new Set<OverviewColumnId>(
|
||||
OVERVIEW_COLUMNS.filter((c) => c.group === 'target').map((c) => c.id),
|
||||
);
|
||||
|
||||
/** 某张表可用的列(品类/商品无目标列) */
|
||||
export function columnsForTable(tableKey: OverviewTableKey): OverviewColumnDef[] {
|
||||
if (tableKey === 'category' || tableKey === 'product') {
|
||||
return OVERVIEW_COLUMNS.filter((c) => !TARGET_IDS.has(c.id));
|
||||
}
|
||||
return [...OVERVIEW_COLUMNS];
|
||||
}
|
||||
|
||||
export function defaultVisibleIds(tableKey: OverviewTableKey): OverviewColumnId[] {
|
||||
return columnsForTable(tableKey).map((c) => c.id);
|
||||
}
|
||||
|
||||
export function groupsForTable(tableKey: OverviewTableKey): OverviewColGroupDef[] {
|
||||
if (tableKey === 'category' || tableKey === 'product') {
|
||||
return OVERVIEW_COL_GROUPS.filter((g) => g.id !== 'target');
|
||||
}
|
||||
return [...OVERVIEW_COL_GROUPS];
|
||||
}
|
||||
|
||||
export const OVERVIEW_TABLE_COLUMN_PREFS_KEY =
|
||||
'bi.workbench.overviewTableColumns.v1';
|
||||
Reference in New Issue
Block a user