feat: 经营汇总透出退款单量/件数,并将退款指标归入规模维度

This commit is contained in:
2026-09-04 16:17:37 +08:00
parent 2cb0bc205a
commit ea9d792096
10 changed files with 167 additions and 44 deletions
@@ -252,8 +252,15 @@ public class CompanyOverviewVO {
private BigDecimal orderCost;
/** 退款金额(计入经营规模) */
private BigDecimal refundAmount;
/** 退款单量 */
private Integer refundOrderCount;
/** 退款件数 */
private Integer refundQuantitySum;
private BigDecimal totalPromotionFee;
private BigDecimal brushFee;
@@ -310,8 +317,15 @@ public class CompanyOverviewVO {
private BigDecimal orderCost;
/** 退款金额(计入经营规模) */
private BigDecimal refundAmount;
/** 退款单量 */
private Integer refundOrderCount;
/** 退款件数 */
private Integer refundQuantitySum;
private BigDecimal totalPromotionFee;
private BigDecimal brushFee;
@@ -376,8 +390,15 @@ public class CompanyOverviewVO {
private BigDecimal orderCost;
/** 退款金额(计入经营规模) */
private BigDecimal refundAmount;
/** 退款单量 */
private Integer refundOrderCount;
/** 退款件数 */
private Integer refundQuantitySum;
private BigDecimal totalPromotionFee;
private BigDecimal brushFee;
@@ -574,6 +574,8 @@ public class CompanyOverviewServiceImpl implements CompanyOverviewService {
s.setOtherCost(m.otherCost);
s.setOrderCost(m.orderCost());
s.setRefundAmount(m.refund);
s.setRefundOrderCount(m.refundOrderCount);
s.setRefundQuantitySum(m.refundQuantitySum);
s.setTotalPromotionFee(promo);
s.setBrushFee(brush);
s.setFeeRatio(safeDivide(promo, m.sales));
@@ -605,6 +607,8 @@ public class CompanyOverviewServiceImpl implements CompanyOverviewService {
s.setOtherCost(m.otherCost);
s.setOrderCost(m.orderCost());
s.setRefundAmount(m.refund);
s.setRefundOrderCount(m.refundOrderCount);
s.setRefundQuantitySum(m.refundQuantitySum);
s.setTotalPromotionFee(promo);
s.setBrushFee(brush);
s.setFeeRatio(safeDivide(promo, m.sales));
@@ -632,6 +636,8 @@ public class CompanyOverviewServiceImpl implements CompanyOverviewService {
s.setOtherCost(m.otherCost);
s.setOrderCost(m.orderCost());
s.setRefundAmount(m.refund);
s.setRefundOrderCount(m.refundOrderCount);
s.setRefundQuantitySum(m.refundQuantitySum);
s.setTotalPromotionFee(promo);
s.setBrushFee(brush);
s.setFeeRatio(safeDivide(promo.add(brush), m.sales));
@@ -786,6 +792,8 @@ public class CompanyOverviewServiceImpl implements CompanyOverviewService {
int dealQuantitySum;
int salesQuantitySum;
BigDecimal refund = BigDecimal.ZERO;
int refundOrderCount;
int refundQuantitySum;
BigDecimal productCost = BigDecimal.ZERO;
BigDecimal freightCost = BigDecimal.ZERO;
BigDecimal otherCost = BigDecimal.ZERO;
@@ -809,6 +817,8 @@ public class CompanyOverviewServiceImpl implements CompanyOverviewService {
a.dealQuantitySum = row.getDealQuantitySum() != null ? row.getDealQuantitySum().intValue() : 0;
a.salesQuantitySum = row.getSalesQuantitySum() != null ? row.getSalesQuantitySum().intValue() : 0;
a.refund = nz(row.getRefundAmount());
a.refundOrderCount = row.getRefundOrderCount() != null ? row.getRefundOrderCount().intValue() : 0;
a.refundQuantitySum = row.getRefundQuantitySum() != null ? row.getRefundQuantitySum().intValue() : 0;
a.productCost = nz(row.getProductCost());
a.freightCost = nz(row.getFreightCost());
a.otherCost = nz(row.getOtherCost());
@@ -824,6 +834,8 @@ public class CompanyOverviewServiceImpl implements CompanyOverviewService {
a.dealQuantitySum = dealQuantitySum + o.dealQuantitySum;
a.salesQuantitySum = salesQuantitySum + o.salesQuantitySum;
a.refund = refund.add(o.refund);
a.refundOrderCount = refundOrderCount + o.refundOrderCount;
a.refundQuantitySum = refundQuantitySum + o.refundQuantitySum;
a.productCost = productCost.add(o.productCost);
a.freightCost = freightCost.add(o.freightCost);
a.otherCost = otherCost.add(o.otherCost);
@@ -113,7 +113,12 @@ export namespace CompanyOverviewVO {
otherCost?: number;
/** 订单成本(商品成本+运费+其他成本,不含推广费、刷单费) */
orderCost?: number;
/** 退款金额(经营规模) */
refundAmount?: number;
/** 退款单量 */
refundOrderCount?: number;
/** 退款件数 */
refundQuantitySum?: number;
totalPromotionFee?: number;
brushFee?: number;
/** 费比(推广费/销售额,小数) */
@@ -141,7 +146,12 @@ export namespace CompanyOverviewVO {
shippingCost?: number;
otherCost?: number;
orderCost?: number;
/** 退款金额(经营规模) */
refundAmount?: number;
/** 退款单量 */
refundOrderCount?: number;
/** 退款件数 */
refundQuantitySum?: number;
totalPromotionFee?: number;
brushFee?: number;
feeRatio?: number;
@@ -172,7 +182,12 @@ export namespace CompanyOverviewVO {
shippingCost?: number;
otherCost?: number;
orderCost?: number;
/** 退款金额(经营规模) */
refundAmount?: number;
/** 退款单量 */
refundOrderCount?: number;
/** 退款件数 */
refundQuantitySum?: number;
totalPromotionFee?: number;
brushFee?: number;
feeRatio?: number;
@@ -30,6 +30,8 @@ export const overviewTableHints = {
otherCost: '其他成本合计。',
orderCost: '商品成本 + 运费 + 其他成本。',
refundAmount: '计入退款状态的商家实收合计。',
refundOrderCount: '计入退款状态的订单笔数。',
refundQuantitySum: '计入退款状态的商品件数合计。',
totalPromotionFee: '推广费合计。',
promotionFeeSku: '店铺推广费 *(该 SKU 订单数 / 区间总订单数)。',
/** @deprecated 使用 promotionFeeSku */
@@ -203,6 +203,12 @@ const cellRoi = (v: number | null | undefined) =>
>
<OverviewColumnHint :title="storeOverviewHints.dealAmount">成交金额</OverviewColumnHint>
</th>
<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
v-if="isVisible('salesAmount')"
class="border-b px-6 py-4 font-black text-slate-900 dark:text-[hsl(0deg_0%_95%)]"
@@ -214,12 +220,18 @@ const cellRoi = (v: number | null | undefined) =>
<th v-if="isVisible('dealOrderCount')" class="border-b px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.dealOrderCount">成交单量</OverviewColumnHint>
</th>
<th v-if="isVisible('refundOrderCount')" class="border-b px-6 py-4 text-rose-600 dark:text-rose-400">
<OverviewColumnHint :title="storeOverviewHints.refundOrderCount">退款单量</OverviewColumnHint>
</th>
<th v-if="isVisible('salesOrderCount')" class="border-b px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.salesOrderCount">净销售单量</OverviewColumnHint>
</th>
<th v-if="isVisible('dealQuantitySum')" class="border-b px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.dealQuantitySum">成交量</OverviewColumnHint>
</th>
<th v-if="isVisible('refundQuantitySum')" class="border-b px-6 py-4 text-rose-600 dark:text-rose-400">
<OverviewColumnHint :title="storeOverviewHints.refundQuantitySum">退款件数</OverviewColumnHint>
</th>
<th v-if="isVisible('salesQuantitySum')" class="border-b px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.salesQuantitySum">净销量</OverviewColumnHint>
</th>
@@ -247,12 +259,6 @@ const cellRoi = (v: number | null | undefined) =>
>
<OverviewColumnHint :title="storeOverviewHints.orderCost">订单成本</OverviewColumnHint>
</th>
<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
v-if="isVisible('salesTaxAmount')"
class="border-b px-6 py-4 italic text-rose-500 dark:text-rose-400"
@@ -347,10 +353,13 @@ const cellRoi = (v: number | null | undefined) =>
</span>
</td>
<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('refundAmount')" class="p-6 font-bold text-rose-600 dark:text-rose-400"><AnimatedMoneyCell :value="cat.refundAmount" /></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('refundOrderCount')" class="p-6 font-medium text-rose-600 dark:text-rose-400">{{ formatIntCell(cat.refundOrderCount) }}</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('refundQuantitySum')" class="p-6 font-medium text-rose-600 dark:text-rose-400">{{ formatIntCell(cat.refundQuantitySum) }}</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">
@@ -365,12 +374,6 @@ const cellRoi = (v: number | null | undefined) =>
>
<AnimatedMoneyCell :value="cat.orderCost" />
</td>
<td
v-if="isVisible('refundAmount')"
class="p-6 font-bold text-rose-600 dark:text-rose-400"
>
<AnimatedMoneyCell :value="cat.refundAmount" />
</td>
<td
v-if="isVisible('salesTaxAmount')"
class="p-6 italic text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]"
@@ -418,10 +421,13 @@ const cellRoi = (v: number | null | undefined) =>
<td class="sticky-col bg-slate-100 dark:bg-[hsl(240deg_3.7%_22%)] p-6 text-base">合计</td>
<!-- 规模 -->
<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('refundAmount')" class="p-6 text-rose-600 dark:text-rose-400"><AnimatedMoneyCell :value="categorySummary?.total?.refundAmount" /></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('refundOrderCount')" class="p-6 text-rose-600 dark:text-rose-400">{{ formatIntCell(categorySummary?.total?.refundOrderCount) }}</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('refundQuantitySum')" class="p-6 text-rose-600 dark:text-rose-400">{{ formatIntCell(categorySummary?.total?.refundQuantitySum) }}</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">
@@ -432,7 +438,6 @@ const cellRoi = (v: number | null | undefined) =>
<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>
@@ -86,9 +86,12 @@ const platformData = computed(() => {
salesAmountAchievementRate: p.salesAmountAchievementRate ?? 0,
salesAmount: p.salesAmount ?? 0,
dealAmount: p.dealAmount ?? 0,
refundAmount: p.refundAmount ?? 0,
salesOrderCount: p.salesOrderCount ?? 0,
dealOrderCount: p.dealOrderCount ?? 0,
refundOrderCount: p.refundOrderCount ?? 0,
dealQuantitySum: p.dealQuantitySum ?? 0,
refundQuantitySum: p.refundQuantitySum ?? 0,
salesQuantitySum: p.salesQuantitySum ?? 0,
salesAverageOrderValue: p.salesAverageOrderValue ?? 0,
dealAverageOrderValue: p.dealAverageOrderValue ?? 0,
@@ -96,7 +99,6 @@ const platformData = computed(() => {
shippingCost: p.shippingCost ?? 0,
otherCost: p.otherCost ?? 0,
orderCost: p.orderCost ?? 0,
refundAmount: p.refundAmount ?? 0,
totalPromotionFee: p.totalPromotionFee ?? 0,
brushFee: p.brushFee ?? 0,
feeRatio: p.feeRatio ?? 0,
@@ -294,6 +296,12 @@ const sortedData = computed(() => {
>
<OverviewColumnHint :title="storeOverviewHints.dealAmount">成交金额</OverviewColumnHint>
</th>
<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
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%)]"
@@ -308,6 +316,12 @@ const sortedData = computed(() => {
>
<OverviewColumnHint :title="storeOverviewHints.dealOrderCount">成交单量</OverviewColumnHint>
</th>
<th
v-if="isVisible('refundOrderCount')"
class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4 text-rose-600 dark:text-rose-400"
>
<OverviewColumnHint :title="storeOverviewHints.refundOrderCount">退款单量</OverviewColumnHint>
</th>
<th
v-if="isVisible('salesOrderCount')"
class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4"
@@ -320,6 +334,12 @@ const sortedData = computed(() => {
>
<OverviewColumnHint :title="storeOverviewHints.dealQuantitySum">成交量</OverviewColumnHint>
</th>
<th
v-if="isVisible('refundQuantitySum')"
class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4 text-rose-600 dark:text-rose-400"
>
<OverviewColumnHint :title="storeOverviewHints.refundQuantitySum">退款件数</OverviewColumnHint>
</th>
<th
v-if="isVisible('salesQuantitySum')"
class="border-b border-slate-200 dark:border-b-[hsl(240deg_3.7%_22%)] px-6 py-4"
@@ -363,12 +383,6 @@ const sortedData = computed(() => {
>
<OverviewColumnHint :title="storeOverviewHints.orderCost">订单成本</OverviewColumnHint>
</th>
<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
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%)]"
@@ -466,10 +480,13 @@ const sortedData = computed(() => {
<td v-if="isVisible('salesAmountAchievementRate')" class="p-6 font-black text-blue-600 dark:text-blue-400">{{ formatPercentPlain(p.salesAmountAchievementRate) }}</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('refundAmount')" class="p-6 font-bold text-rose-600 dark:text-rose-400"><AnimatedMoneyCell :value="p.refundAmount" /></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('refundOrderCount')" class="p-6 font-medium text-rose-600 dark:text-rose-400">{{ formatIntCell(p.refundOrderCount) }}</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('refundQuantitySum')" class="p-6 font-medium text-rose-600 dark:text-rose-400">{{ formatIntCell(p.refundQuantitySum) }}</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>
@@ -478,7 +495,6 @@ const sortedData = computed(() => {
<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>
@@ -522,10 +538,13 @@ const sortedData = computed(() => {
</td>
<!-- 规模 -->
<td v-if="isVisible('dealAmount')" class="p-6 text-amber-700 dark:text-amber-400"><AnimatedMoneyCell :value="totalData.dealAmount" /></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('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('refundOrderCount')" class="p-6 text-rose-600 dark:text-rose-400">{{ formatIntCell(totalData.refundOrderCount) }}</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('refundQuantitySum')" class="p-6 text-rose-600 dark:text-rose-400">{{ formatIntCell(totalData.refundQuantitySum) }}</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" />
@@ -538,7 +557,6 @@ const sortedData = computed(() => {
<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>
@@ -226,13 +226,19 @@ const cellRoi = (v: number | null | undefined) =>
销售达成率
</OverviewColumnHint>
</th>
<!-- 规模:成交在前,净销售在后 -->
<!-- 规模:成交 → 退款 → 净销售 -->
<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
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
v-if="isVisible('salesAmount')"
class="border-b px-6 py-4 font-black text-slate-900 dark:text-[hsl(0deg_0%_95%)]"
@@ -244,12 +250,18 @@ const cellRoi = (v: number | null | undefined) =>
<th v-if="isVisible('dealOrderCount')" class="border-b px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.dealOrderCount">成交单量</OverviewColumnHint>
</th>
<th v-if="isVisible('refundOrderCount')" class="border-b px-6 py-4 text-rose-600 dark:text-rose-400">
<OverviewColumnHint :title="storeOverviewHints.refundOrderCount">退款单量</OverviewColumnHint>
</th>
<th v-if="isVisible('salesOrderCount')" class="border-b px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.salesOrderCount">净销售单量</OverviewColumnHint>
</th>
<th v-if="isVisible('dealQuantitySum')" class="border-b px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.dealQuantitySum">成交量</OverviewColumnHint>
</th>
<th v-if="isVisible('refundQuantitySum')" class="border-b px-6 py-4 text-rose-600 dark:text-rose-400">
<OverviewColumnHint :title="storeOverviewHints.refundQuantitySum">退款件数</OverviewColumnHint>
</th>
<th v-if="isVisible('salesQuantitySum')" class="border-b px-6 py-4">
<OverviewColumnHint :title="storeOverviewHints.salesQuantitySum">净销量</OverviewColumnHint>
</th>
@@ -278,12 +290,6 @@ const cellRoi = (v: number | null | undefined) =>
>
<OverviewColumnHint :title="storeOverviewHints.orderCost">订单成本</OverviewColumnHint>
</th>
<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
v-if="isVisible('salesTaxAmount')"
class="border-b px-6 py-4 italic text-rose-500 dark:text-rose-400"
@@ -404,18 +410,30 @@ const cellRoi = (v: number | null | undefined) =>
>
<AnimatedMoneyCell :value="shop.dealAmount" />
</td>
<td
v-if="isVisible('refundAmount')"
class="p-6 font-bold text-rose-600 dark:text-rose-400"
>
<AnimatedMoneyCell :value="shop.refundAmount" />
</td>
<td v-if="isVisible('salesAmount')" class="p-6 font-black">
<AnimatedMoneyCell :value="shop.salesAmount" />
</td>
<td v-if="isVisible('dealOrderCount')" class="p-6 font-medium">
{{ formatIntCell(shop.dealOrderCount) }}
</td>
<td v-if="isVisible('refundOrderCount')" class="p-6 font-medium text-rose-600 dark:text-rose-400">
{{ formatIntCell(shop.refundOrderCount) }}
</td>
<td v-if="isVisible('salesOrderCount')" class="p-6 font-medium">
{{ formatIntCell(shop.salesOrderCount) }}
</td>
<td v-if="isVisible('dealQuantitySum')" class="p-6 font-medium">
{{ formatIntCell(shop.dealQuantitySum) }}
</td>
<td v-if="isVisible('refundQuantitySum')" class="p-6 font-medium text-rose-600 dark:text-rose-400">
{{ formatIntCell(shop.refundQuantitySum) }}
</td>
<td v-if="isVisible('salesQuantitySum')" class="p-6 font-medium">
{{ formatIntCell(shop.salesQuantitySum) }}
</td>
@@ -441,12 +459,6 @@ const cellRoi = (v: number | null | undefined) =>
>
<AnimatedMoneyCell :value="shop.orderCost" />
</td>
<td
v-if="isVisible('refundAmount')"
class="p-6 font-bold text-rose-600 dark:text-rose-400"
>
<AnimatedMoneyCell :value="shop.refundAmount" />
</td>
<td
v-if="isVisible('salesTaxAmount')"
class="p-6 italic text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]"
@@ -529,10 +541,13 @@ const cellRoi = (v: number | null | undefined) =>
</td>
<!-- 规模 -->
<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('refundAmount')" class="p-6 text-rose-600 dark:text-rose-400"><AnimatedMoneyCell :value="shopSummary?.total?.refundAmount" /></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('refundOrderCount')" class="p-6 text-rose-600 dark:text-rose-400">{{ formatIntCell(shopSummary?.total?.refundOrderCount) }}</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('refundQuantitySum')" class="p-6 text-rose-600 dark:text-rose-400">{{ formatIntCell(shopSummary?.total?.refundQuantitySum) }}</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" />
@@ -545,7 +560,6 @@ const cellRoi = (v: number | null | undefined) =>
<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>
@@ -8,6 +8,7 @@ import type {
import {
columnsForTable,
defaultVisibleIds,
OVERVIEW_COLUMN_AUTO_APPEND,
OVERVIEW_TABLE_COLUMN_PREFS_KEY,
} from '../constants/overview-table-columns';
@@ -17,11 +18,21 @@ function normalizeIds(
tableKey: OverviewTableKey,
raw: string[] | undefined,
): OverviewColumnId[] {
const allowed = new Set(columnsForTable(tableKey).map((c) => c.id));
const order = columnsForTable(tableKey).map((c) => c.id);
const allowed = new Set(order);
const picked = (raw ?? []).filter((id): id is OverviewColumnId =>
allowed.has(id as OverviewColumnId),
);
return picked.length > 0 ? picked : defaultVisibleIds(tableKey);
if (picked.length === 0) {
return defaultVisibleIds(tableKey);
}
// 新列(如退款单量/件数)历史偏好没有时自动勾选
for (const id of OVERVIEW_COLUMN_AUTO_APPEND) {
if (allowed.has(id) && !picked.includes(id)) {
picked.push(id);
}
}
return order.filter((id) => picked.includes(id));
}
function loadAll(): PrefsMap {
@@ -10,10 +10,13 @@ export type OverviewColumnId =
| 'targetAmount'
| 'salesAmountAchievementRate'
| 'dealAmount'
| 'refundAmount'
| 'salesAmount'
| 'dealOrderCount'
| 'refundOrderCount'
| 'salesOrderCount'
| 'dealQuantitySum'
| 'refundQuantitySum'
| 'salesQuantitySum'
| 'dealAverageOrderValue'
| 'salesAverageOrderValue'
@@ -21,7 +24,6 @@ export type OverviewColumnId =
| 'shippingCost'
| 'otherCost'
| 'orderCost'
| 'refundAmount'
| 'salesTaxAmount'
| 'totalPromotionFee'
| 'brushFee'
@@ -51,17 +53,23 @@ export const OVERVIEW_COL_GROUPS: OverviewColGroupDef[] = [
{ 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: 'refundAmount', label: '退款金额', group: 'scale' },
{ id: 'salesAmount', label: '净销售额', group: 'scale' },
{ id: 'dealOrderCount', label: '成交单量', group: 'scale' },
{ id: 'refundOrderCount', label: '退款单量', group: 'scale' },
{ id: 'salesOrderCount', label: '净销售单量', group: 'scale' },
{ id: 'dealQuantitySum', label: '成交量', group: 'scale' },
{ id: 'refundQuantitySum', label: '退款件数', group: 'scale' },
{ id: 'salesQuantitySum', label: '净销量', group: 'scale' },
{ id: 'dealAverageOrderValue', label: '成交客单价', group: 'scale' },
{ id: 'salesAverageOrderValue', label: '净销售客单价', group: 'scale' },
@@ -69,7 +77,6 @@ export const OVERVIEW_COLUMNS: OverviewColumnDef[] = [
{ 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' },
@@ -80,6 +87,12 @@ export const OVERVIEW_COLUMNS: OverviewColumnDef[] = [
{ id: 'profitAfterTax', label: '税后净利', group: 'profit' },
];
/** 历史偏好升级时自动勾选的新列 */
export const OVERVIEW_COLUMN_AUTO_APPEND: OverviewColumnId[] = [
'refundOrderCount',
'refundQuantitySum',
];
const TARGET_IDS = new Set<OverviewColumnId>(
OVERVIEW_COLUMNS.filter((c) => c.group === 'target').map((c) => c.id),
);
@@ -52,15 +52,19 @@ function aggregateShopTotal(
salesAmountAchievementRate: sum('salesAmountAchievementRate'),
salesAmount,
dealAmount,
refundAmount: sum('refundAmount'),
refundOrderCount: sum('refundOrderCount'),
refundQuantitySum: sum('refundQuantitySum'),
salesOrderCount,
dealOrderCount,
dealQuantitySum: sum('dealQuantitySum'),
salesQuantitySum: sum('salesQuantitySum'),
salesAverageOrderValue,
dealAverageOrderValue,
productCost: sum('productCost'),
shippingCost: sum('shippingCost'),
otherCost: sum('otherCost'),
orderCost: sum('orderCost'),
refundAmount: sum('refundAmount'),
totalPromotionFee,
brushFee: sum('brushFee'),
feeRatio,
@@ -123,15 +127,19 @@ function aggregateCategoryTotal(
categoryName: '合计',
salesAmount,
dealAmount,
refundAmount: sum('refundAmount'),
refundOrderCount: sum('refundOrderCount'),
refundQuantitySum: sum('refundQuantitySum'),
salesOrderCount,
dealOrderCount,
dealQuantitySum: sum('dealQuantitySum'),
salesQuantitySum: sum('salesQuantitySum'),
salesAverageOrderValue,
dealAverageOrderValue,
productCost: sum('productCost'),
shippingCost: sum('shippingCost'),
otherCost: sum('otherCost'),
orderCost: sum('orderCost'),
refundAmount: sum('refundAmount'),
totalPromotionFee,
brushFee: sum('brushFee'),
feeRatio,
@@ -197,15 +205,19 @@ function aggregatePlatformTotal(
salesAmountAchievementRate: sum('salesAmountAchievementRate'),
salesAmount,
dealAmount,
refundAmount: sum('refundAmount'),
refundOrderCount: sum('refundOrderCount'),
refundQuantitySum: sum('refundQuantitySum'),
salesOrderCount,
dealOrderCount,
dealQuantitySum: sum('dealQuantitySum'),
salesQuantitySum: sum('salesQuantitySum'),
salesAverageOrderValue,
dealAverageOrderValue,
productCost: sum('productCost'),
shippingCost: sum('shippingCost'),
otherCost: sum('otherCost'),
orderCost: sum('orderCost'),
refundAmount: sum('refundAmount'),
totalPromotionFee,
brushFee: sum('brushFee'),
feeRatio,