mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 17:09:20 +08:00
feat: 商品概览新增规格销量 Top10 榜单,替换冗余财务面板
- ProductOverviewVO: 新增 specSalesTop10(规格销量 Top10)字段,调整统计口径 - ProductOverviewServiceImpl: 新增 fillSpecSalesTop10(),按单量取 Top10 规格 - StatCards: 税前盈亏/税额展示样式调整(与店铺概览一致) - 前端:移除 FinancialPanel,新增 SpecSalesTop10Panel 规格销量榜单组件
This commit is contained in:
+41
-20
@@ -83,29 +83,13 @@ public class ProductOverviewVO {
|
|||||||
@Schema(description = "汇总ROI")
|
@Schema(description = "汇总ROI")
|
||||||
private BigDecimal totalROI;
|
private BigDecimal totalROI;
|
||||||
|
|
||||||
/**
|
// ========== 各规格销量 Top10 ==========
|
||||||
* 汇总客单价
|
|
||||||
*/
|
|
||||||
@Schema(description = "汇总客单价")
|
|
||||||
private BigDecimal averageOrderValue;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退款金额合计
|
* 各规格销量 Top10(按单量降序,最多10条)
|
||||||
*/
|
*/
|
||||||
@Schema(description = "退款金额合计")
|
@Schema(description = "各规格销量 Top10")
|
||||||
private BigDecimal refundAmount;
|
private List<SpecSalesRankItem> specSalesTop10;
|
||||||
|
|
||||||
/**
|
|
||||||
* 税前盈亏
|
|
||||||
*/
|
|
||||||
@Schema(description = "税前盈亏")
|
|
||||||
private BigDecimal totalProfitBeforeTax;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 总税后盈亏(与 totalNetProfitAfterTax 一致)
|
|
||||||
*/
|
|
||||||
@Schema(description = "总税后盈亏")
|
|
||||||
private BigDecimal totalProfitAfterTax;
|
|
||||||
|
|
||||||
// ========== 趋势数据 ==========
|
// ========== 趋势数据 ==========
|
||||||
|
|
||||||
@@ -394,4 +378,41 @@ public class ProductOverviewVO {
|
|||||||
@Schema(description = "税后盈亏")
|
@Schema(description = "税后盈亏")
|
||||||
private BigDecimal profitAfterTax;
|
private BigDecimal profitAfterTax;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规格销量排名项
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Schema(description = "规格销量排名项")
|
||||||
|
public static class SpecSalesRankItem {
|
||||||
|
/**
|
||||||
|
* 规格ID
|
||||||
|
*/
|
||||||
|
@Schema(description = "规格ID")
|
||||||
|
private Long specId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规格名称
|
||||||
|
*/
|
||||||
|
@Schema(description = "规格名称")
|
||||||
|
private String specName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规格编码
|
||||||
|
*/
|
||||||
|
@Schema(description = "规格编码")
|
||||||
|
private String specCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单量
|
||||||
|
*/
|
||||||
|
@Schema(description = "订单量")
|
||||||
|
private Integer orderCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销售额
|
||||||
|
*/
|
||||||
|
@Schema(description = "销售额")
|
||||||
|
private BigDecimal salesAmount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+81
-17
@@ -156,17 +156,10 @@ public class ProductOverviewServiceImpl implements ProductOverviewService {
|
|||||||
.count();
|
.count();
|
||||||
vo.setTotalOrderCount(totalOrderCount);
|
vo.setTotalOrderCount(totalOrderCount);
|
||||||
|
|
||||||
// 汇总客单价
|
// 总退款金额(用于 ROI 计算)
|
||||||
BigDecimal avgOrderValue = totalOrderCount > 0
|
|
||||||
? totalSalesAmount.divide(BigDecimal.valueOf(totalOrderCount), 2, RoundingMode.HALF_UP)
|
|
||||||
: BigDecimal.ZERO;
|
|
||||||
vo.setAverageOrderValue(avgOrderValue);
|
|
||||||
|
|
||||||
// 总退款金额(按状态「计入退款」维度的实收金额)
|
|
||||||
BigDecimal totalRefundAmount = orders.stream()
|
BigDecimal totalRefundAmount = orders.stream()
|
||||||
.map(stat::receivedForRefund)
|
.map(stat::receivedForRefund)
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
vo.setRefundAmount(totalRefundAmount);
|
|
||||||
|
|
||||||
// 总成本(商品/运费/其他成本按各维度开关,含数量)
|
// 总成本(商品/运费/其他成本按各维度开关,含数量)
|
||||||
BigDecimal totalCostAmount = orders.stream()
|
BigDecimal totalCostAmount = orders.stream()
|
||||||
@@ -191,21 +184,17 @@ public class ProductOverviewServiceImpl implements ProductOverviewService {
|
|||||||
vo.setAverageFeeRatio(avgFeeRatio.multiply(new BigDecimal("100"))
|
vo.setAverageFeeRatio(avgFeeRatio.multiply(new BigDecimal("100"))
|
||||||
.setScale(2, RoundingMode.HALF_UP)); // 转为百分比
|
.setScale(2, RoundingMode.HALF_UP)); // 转为百分比
|
||||||
|
|
||||||
// 税前盈亏 = Σ(计入销售额的实收 - 按维度统计的成本) - 推广费
|
|
||||||
BigDecimal totalProfitBeforeTax = orders.stream()
|
|
||||||
.map(o -> stat.receivedForSales(o).subtract(stat.totalCostForStats(o)))
|
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add)
|
|
||||||
.subtract(totalPromotionFee);
|
|
||||||
vo.setTotalProfitBeforeTax(totalProfitBeforeTax);
|
|
||||||
|
|
||||||
// 税额 = 销售额 × 税率
|
// 税额 = 销售额 × 税率
|
||||||
BigDecimal totalTaxAmount = totalSalesAmount.multiply(taxRate)
|
BigDecimal totalTaxAmount = totalSalesAmount.multiply(taxRate)
|
||||||
.setScale(2, RoundingMode.HALF_UP);
|
.setScale(2, RoundingMode.HALF_UP);
|
||||||
vo.setTotalTaxAmount(totalTaxAmount);
|
vo.setTotalTaxAmount(totalTaxAmount);
|
||||||
|
|
||||||
// 税后盈亏
|
// 税后盈亏
|
||||||
BigDecimal totalProfitAfterTax = totalProfitBeforeTax.subtract(totalTaxAmount);
|
BigDecimal totalProfitAfterTax = totalSalesAmount
|
||||||
vo.setTotalProfitAfterTax(totalProfitAfterTax);
|
.subtract(totalCostAmount)
|
||||||
|
.subtract(totalRefundAmount)
|
||||||
|
.subtract(totalPromotionFee)
|
||||||
|
.subtract(totalTaxAmount);
|
||||||
vo.setTotalNetProfitAfterTax(totalProfitAfterTax);
|
vo.setTotalNetProfitAfterTax(totalProfitAfterTax);
|
||||||
|
|
||||||
// ROI = (销售额 - 退款金额) / 推广费(与店铺概览 calculateSalesROI 口径一致)
|
// ROI = (销售额 - 退款金额) / 推广费(与店铺概览 calculateSalesROI 口径一致)
|
||||||
@@ -278,6 +267,9 @@ public class ProductOverviewServiceImpl implements ProductOverviewService {
|
|||||||
// ---------- 规格销售汇总 ----------
|
// ---------- 规格销售汇总 ----------
|
||||||
vo.setSpecSummaries(buildSpecSummary(orders, promotionFees, stat, taxRate, shopIds));
|
vo.setSpecSummaries(buildSpecSummary(orders, promotionFees, stat, taxRate, shopIds));
|
||||||
|
|
||||||
|
// ---------- 各规格销量 Top10 ----------
|
||||||
|
vo.setSpecSalesTop10(buildSpecSalesTop10(orders, stat, shopIds));
|
||||||
|
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -585,4 +577,76 @@ public class ProductOverviewServiceImpl implements ProductOverviewService {
|
|||||||
summary.setTotal(total);
|
summary.setTotal(total);
|
||||||
return summary;
|
return summary;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建各规格销量 Top10
|
||||||
|
*/
|
||||||
|
private List<ProductOverviewVO.SpecSalesRankItem> buildSpecSalesTop10(List<OrderPO> orders,
|
||||||
|
OrderStatusStatSets stat,
|
||||||
|
List<Long> shopIds) {
|
||||||
|
if (orders.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
OrderPO firstOrder = orders.get(0);
|
||||||
|
Long companyId = firstOrder.getCompanyId();
|
||||||
|
Long productId = null;
|
||||||
|
if (firstOrder.getProductSpecId() != null) {
|
||||||
|
ProductSpecPO firstSpec = productSpecMapper.selectById(firstOrder.getProductSpecId());
|
||||||
|
if (firstSpec != null) {
|
||||||
|
productId = firstSpec.getProductId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (productId == null) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
LambdaQueryWrapper<ProductSpecPO> specWrapper = new LambdaQueryWrapper<>();
|
||||||
|
specWrapper.eq(ProductSpecPO::getCompanyId, companyId)
|
||||||
|
.eq(ProductSpecPO::getProductId, productId);
|
||||||
|
List<ProductSpecPO> allSpecs = productSpecMapper.selectList(specWrapper);
|
||||||
|
Map<Long, ProductSpecPO> specMap = allSpecs.stream()
|
||||||
|
.collect(Collectors.toMap(ProductSpecPO::getId, s -> s, (a, b) -> a));
|
||||||
|
|
||||||
|
// 按规格分组计算
|
||||||
|
Map<Long, List<OrderPO>> ordersBySpec = orders.stream()
|
||||||
|
.collect(Collectors.groupingBy(o -> {
|
||||||
|
Long specId = o.getProductSpecId();
|
||||||
|
return specId != null ? specId : 0L;
|
||||||
|
}));
|
||||||
|
|
||||||
|
List<ProductOverviewVO.SpecSalesRankItem> rankItems = new ArrayList<>();
|
||||||
|
|
||||||
|
for (Map.Entry<Long, List<OrderPO>> entry : ordersBySpec.entrySet()) {
|
||||||
|
Long specId = entry.getKey();
|
||||||
|
if (specId == 0L) continue;
|
||||||
|
|
||||||
|
List<OrderPO> specOrders = entry.getValue();
|
||||||
|
ProductSpecPO spec = specMap.get(specId);
|
||||||
|
|
||||||
|
// 订单量(计入销售额维度)
|
||||||
|
int orderCount = (int) specOrders.stream()
|
||||||
|
.filter(o -> stat.includesSales(o.getStatusId()))
|
||||||
|
.count();
|
||||||
|
|
||||||
|
// 销售额
|
||||||
|
BigDecimal salesAmount = specOrders.stream()
|
||||||
|
.map(stat::receivedForSales)
|
||||||
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
|
||||||
|
ProductOverviewVO.SpecSalesRankItem item = new ProductOverviewVO.SpecSalesRankItem();
|
||||||
|
item.setSpecId(specId);
|
||||||
|
item.setSpecName(spec != null ? spec.getName() : "未知规格");
|
||||||
|
item.setSpecCode(spec != null ? spec.getSpecCode() : null);
|
||||||
|
item.setOrderCount(orderCount);
|
||||||
|
item.setSalesAmount(salesAmount);
|
||||||
|
rankItems.add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 按订单量降序排序,取前10
|
||||||
|
return rankItems.stream()
|
||||||
|
.sorted(Comparator.comparing(ProductOverviewVO.SpecSalesRankItem::getOrderCount).reversed())
|
||||||
|
.limit(10)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-8
@@ -15,6 +15,20 @@ export namespace ProductOverviewVO {
|
|||||||
dailyDataList: TrendDataItem[];
|
dailyDataList: TrendDataItem[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 规格销量排名项 */
|
||||||
|
export interface SpecSalesRankItem {
|
||||||
|
/** 规格ID */
|
||||||
|
specId?: number;
|
||||||
|
/** 规格名称 */
|
||||||
|
specName?: string;
|
||||||
|
/** 规格编码 */
|
||||||
|
specCode?: string;
|
||||||
|
/** 订单量 */
|
||||||
|
orderCount?: number;
|
||||||
|
/** 销售额 */
|
||||||
|
salesAmount?: number;
|
||||||
|
}
|
||||||
|
|
||||||
/** 规格销售明细项 */
|
/** 规格销售明细项 */
|
||||||
export interface SpecSummaryItem {
|
export interface SpecSummaryItem {
|
||||||
/** 规格ID */
|
/** 规格ID */
|
||||||
@@ -121,14 +135,10 @@ export namespace ProductOverviewVO {
|
|||||||
salesAmountAchievementRate: number;
|
salesAmountAchievementRate: number;
|
||||||
/** 汇总ROI */
|
/** 汇总ROI */
|
||||||
totalROI: number;
|
totalROI: number;
|
||||||
/** 汇总客单价 */
|
|
||||||
averageOrderValue: number;
|
// ========== 各规格销量 Top10 ==========
|
||||||
/** 退款金额合计 */
|
/** 各规格销量 Top10 */
|
||||||
refundAmount: number;
|
specSalesTop10: SpecSalesRankItem[];
|
||||||
/** 税前盈亏 */
|
|
||||||
totalProfitBeforeTax: number;
|
|
||||||
/** 总税后盈亏 */
|
|
||||||
totalProfitAfterTax: number;
|
|
||||||
|
|
||||||
// ========== 趋势数据 ==========
|
// ========== 趋势数据 ==========
|
||||||
/** 销售额趋势分析 */
|
/** 销售额趋势分析 */
|
||||||
|
|||||||
-100
@@ -1,100 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
interface Props {
|
|
||||||
data: {
|
|
||||||
totalSalesAmount?: number;
|
|
||||||
totalOrderCount?: number;
|
|
||||||
averageOrderValue?: number;
|
|
||||||
totalPromotionFee?: number;
|
|
||||||
totalCostAmount?: number;
|
|
||||||
totalRefundAmount?: number;
|
|
||||||
totalProfitAfterTax?: number;
|
|
||||||
totalNetProfitAfterTax?: number;
|
|
||||||
totalTaxAmount?: number;
|
|
||||||
monthOverMonthGrowth?: number;
|
|
||||||
} | null;
|
|
||||||
taxRate: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
const props = defineProps<Props>();
|
|
||||||
|
|
||||||
const formatAmount = (amount: number | undefined) => {
|
|
||||||
if (amount === undefined) return '-';
|
|
||||||
return `¥${amount.toLocaleString('zh-CN')}`;
|
|
||||||
};
|
|
||||||
|
|
||||||
const formatPercent = (value: number | undefined) => {
|
|
||||||
if (value === undefined) return '-';
|
|
||||||
return `${value > 0 ? '+' : ''}${value.toFixed(1)}%`;
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div
|
|
||||||
class="flex flex-col rounded-[20px] border border-slate-200/80 dark:border-[hsl(240deg_3.7%_22%)] bg-white/85 dark:bg-[hsl(222.34deg_10.43%_12.27%)] p-8 shadow-[0_4px_20px_rgba(0,0,0,0.02)] dark:shadow-none backdrop-blur-[12px]"
|
|
||||||
>
|
|
||||||
<h3 class="mb-6 text-lg font-black text-slate-800 dark:text-[hsl(0deg_0%_95%)]">
|
|
||||||
商品财务损益 (P&L)
|
|
||||||
</h3>
|
|
||||||
<div class="flex flex-1 flex-col space-y-4 text-sm">
|
|
||||||
<div class="flex justify-between border-b border-slate-100 dark:border-[hsl(240deg_3.7%_22%)] pb-2">
|
|
||||||
<span class="text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">推广费总支出</span>
|
|
||||||
<span class="font-bold text-slate-800 dark:text-[hsl(0deg_0%_95%)]">
|
|
||||||
{{ data?.totalPromotionFee ? `-${formatAmount(data.totalPromotionFee)}` : '-' }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="flex justify-between border-b border-slate-100 dark:border-[hsl(240deg_3.7%_22%)] pb-2">
|
|
||||||
<span class="text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">成本总支出</span>
|
|
||||||
<span class="font-bold text-rose-600 dark:text-rose-400">
|
|
||||||
{{ data?.totalCostAmount ? `-${formatAmount(data.totalCostAmount)}` : '-' }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="flex justify-between border-b border-slate-100 dark:border-[hsl(240deg_3.7%_22%)] pb-2">
|
|
||||||
<span class="text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">退款金额</span>
|
|
||||||
<span class="font-bold text-amber-600 dark:text-amber-400">
|
|
||||||
{{ data?.totalRefundAmount ? `-${formatAmount(data.totalRefundAmount)}` : '-' }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="flex justify-between border-b border-slate-100 dark:border-[hsl(240deg_3.7%_22%)] pb-2">
|
|
||||||
<span class="text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">客单价 (AOV)</span>
|
|
||||||
<span class="font-bold text-slate-800 dark:text-[hsl(0deg_0%_95%)]">
|
|
||||||
{{ data?.averageOrderValue ? formatAmount(data.averageOrderValue) : '-' }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="flex justify-between border-b border-slate-100 dark:border-[hsl(240deg_3.7%_22%)] pb-2">
|
|
||||||
<span class="text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">税后盈亏 (Profit)</span>
|
|
||||||
<span class="font-bold text-indigo-600 dark:text-indigo-400">
|
|
||||||
{{ data?.totalNetProfitAfterTax ? formatAmount(data.totalNetProfitAfterTax) : '-' }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 扣除项 -->
|
|
||||||
<div class="mt-4 space-y-3 rounded-2xl bg-slate-50/80 dark:bg-[hsl(240deg_3.7%_15.9%/80)] p-4">
|
|
||||||
<div class="flex justify-between text-xs">
|
|
||||||
<span class="text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">销售额 {{ (props.taxRate * 100).toFixed(0) }}% 税额</span>
|
|
||||||
<span class="font-bold text-rose-500 dark:text-rose-400">
|
|
||||||
{{ data?.totalTaxAmount ? formatAmount(data.totalTaxAmount) : '-' }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="flex justify-between text-xs">
|
|
||||||
<span class="text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">较上月同期增长</span>
|
|
||||||
<span class="font-black text-emerald-500 dark:text-emerald-400">
|
|
||||||
{{ formatPercent(data?.monthOverMonthGrowth) }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 最终结果 -->
|
|
||||||
<div
|
|
||||||
class="mt-auto flex items-center justify-between rounded-2xl bg-slate-900 p-5 text-white shadow-2xl dark:shadow-none"
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
<p class="text-[10px] font-black uppercase opacity-60">Final Net Profit</p>
|
|
||||||
<p class="text-xs font-bold">商品最终净利</p>
|
|
||||||
</div>
|
|
||||||
<div class="text-3xl font-black">
|
|
||||||
{{ data?.totalNetProfitAfterTax ? formatAmount(data.totalNetProfitAfterTax) : '-' }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
+87
@@ -0,0 +1,87 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
interface SpecSalesRankItem {
|
||||||
|
specId?: number;
|
||||||
|
specName?: string;
|
||||||
|
specCode?: string;
|
||||||
|
orderCount?: number;
|
||||||
|
salesAmount?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
data: SpecSalesRankItem[] | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
defineProps<Props>();
|
||||||
|
|
||||||
|
const formatAmount = (amount: number | undefined) => {
|
||||||
|
if (amount === undefined || amount === null) return '-';
|
||||||
|
return `¥${amount.toLocaleString('zh-CN')}`;
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div
|
||||||
|
class="flex flex-col rounded-[20px] border border-slate-200/80 dark:border-[hsl(240deg_3.7%_22%)] bg-white/85 dark:bg-[hsl(222.34deg_10.43%_12.27%)] p-8 shadow-[0_4px_20px_rgba(0,0,0,0.02)] dark:shadow-none backdrop-blur-[12px]"
|
||||||
|
>
|
||||||
|
<h3 class="mb-1 text-lg font-black text-slate-800 dark:text-[hsl(0deg_0%_95%)]">
|
||||||
|
各规格销量 Top10
|
||||||
|
</h3>
|
||||||
|
<p class="mb-5 text-xs font-medium text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||||
|
按单量排序,与上方时间范围一致
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="max-h-[380px] flex-1 space-y-2 overflow-y-auto pr-1">
|
||||||
|
<template v-if="data?.length">
|
||||||
|
<div
|
||||||
|
v-for="(row, idx) in data"
|
||||||
|
:key="row.specId ?? `rank-${idx}`"
|
||||||
|
class="flex items-center gap-3 rounded-xl border border-slate-100/90 bg-slate-50/60 px-3 py-2.5 dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%/50%)]"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-sm font-black tabular-nums"
|
||||||
|
:class="
|
||||||
|
idx === 0
|
||||||
|
? 'bg-amber-100 text-amber-800 dark:bg-amber-900/40 dark:text-amber-200'
|
||||||
|
: idx === 1
|
||||||
|
? 'bg-slate-200 text-slate-700 dark:bg-slate-600 dark:text-slate-100'
|
||||||
|
: idx === 2
|
||||||
|
? 'bg-orange-100 text-orange-900 dark:bg-orange-900/30 dark:text-orange-200'
|
||||||
|
: 'bg-slate-100 text-slate-500 dark:bg-slate-700 dark:text-slate-300'
|
||||||
|
"
|
||||||
|
>
|
||||||
|
{{ idx + 1 }}
|
||||||
|
</span>
|
||||||
|
<div class="min-w-0 flex-1">
|
||||||
|
<div
|
||||||
|
class="truncate text-sm font-bold text-slate-800 dark:text-[hsl(0deg_0%_95%)]"
|
||||||
|
:title="row.specName"
|
||||||
|
>
|
||||||
|
{{ row.specName || '-' }}
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="row.specCode"
|
||||||
|
class="truncate text-[11px] text-slate-400 dark:text-[hsl(240deg_5%_55%)]"
|
||||||
|
>
|
||||||
|
{{ row.specCode }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="shrink-0 text-right">
|
||||||
|
<div class="text-sm font-black tabular-nums text-indigo-600 dark:text-indigo-400">
|
||||||
|
{{ row.orderCount != null ? row.orderCount.toLocaleString('zh-CN') : '-' }}
|
||||||
|
<span class="text-[10px] font-semibold text-slate-400 dark:text-[hsl(240deg_5%_55%)]">单</span>
|
||||||
|
</div>
|
||||||
|
<div class="text-[11px] font-semibold text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">
|
||||||
|
{{ formatAmount(row.salesAmount) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<div
|
||||||
|
v-else
|
||||||
|
class="flex flex-1 items-center justify-center py-16 text-sm text-slate-400 dark:text-[hsl(240deg_5%_55%)]"
|
||||||
|
>
|
||||||
|
暂无规格数据
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
+2
-7
@@ -4,18 +4,13 @@ interface Props {
|
|||||||
productName?: string;
|
productName?: string;
|
||||||
totalSalesAmount?: number;
|
totalSalesAmount?: number;
|
||||||
totalOrderCount?: number;
|
totalOrderCount?: number;
|
||||||
averageOrderValue?: number;
|
|
||||||
totalPromotionFee?: number;
|
|
||||||
totalCostAmount?: number;
|
|
||||||
totalRefundAmount?: number;
|
|
||||||
totalProfitAfterTax?: number;
|
|
||||||
totalNetProfitAfterTax?: number;
|
|
||||||
totalTaxAmount?: number;
|
|
||||||
monthOverMonthGrowth?: number;
|
monthOverMonthGrowth?: number;
|
||||||
salesAmountAchievementRate?: number;
|
salesAmountAchievementRate?: number;
|
||||||
orderCountAchievementRate?: number;
|
orderCountAchievementRate?: number;
|
||||||
averageFeeRatio?: number;
|
averageFeeRatio?: number;
|
||||||
totalROI?: number;
|
totalROI?: number;
|
||||||
|
totalNetProfitAfterTax?: number;
|
||||||
|
totalTaxAmount?: number;
|
||||||
} | null;
|
} | null;
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import dayjs from 'dayjs';
|
|||||||
import TimeRangeBar from './components/TimeRangeBar.vue';
|
import TimeRangeBar from './components/TimeRangeBar.vue';
|
||||||
import StatCards from './components/StatCards.vue';
|
import StatCards from './components/StatCards.vue';
|
||||||
import SalesTrendChart from './components/SalesTrendChart.vue';
|
import SalesTrendChart from './components/SalesTrendChart.vue';
|
||||||
import FinancialPanel from './components/FinancialPanel.vue';
|
import SpecSalesTop10Panel from './components/SpecSalesTop10Panel.vue';
|
||||||
import SpecSummaryTable from './components/SpecSummaryTable.vue';
|
import SpecSummaryTable from './components/SpecSummaryTable.vue';
|
||||||
import { getProductOverviewApi } from '#/api/ecommerce/product-overview';
|
import { getProductOverviewApi } from '#/api/ecommerce/product-overview';
|
||||||
import {
|
import {
|
||||||
@@ -262,7 +262,7 @@ const pageTitle = computed(() => overviewData.value?.productName || '商品概
|
|||||||
<!-- 第二层:趋势与财务拆解 -->
|
<!-- 第二层:趋势与财务拆解 -->
|
||||||
<div class="grid grid-cols-1 gap-6 xl:grid-cols-3">
|
<div class="grid grid-cols-1 gap-6 xl:grid-cols-3">
|
||||||
<SalesTrendChart :data="overviewData" />
|
<SalesTrendChart :data="overviewData" />
|
||||||
<FinancialPanel :data="overviewData" :tax-rate="taxRate" />
|
<SpecSalesTop10Panel :data="overviewData?.specSalesTop10 ?? []" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 第三层:规格销售汇总 -->
|
<!-- 第三层:规格销售汇总 -->
|
||||||
|
|||||||
Reference in New Issue
Block a user