mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 19:49:19 +08:00
feat(product): 商品详情页对接真实API,替换mock数据
后端: - 重写 ProductOverviewServiceImpl匹配新的扁平化VO结构 - ProductOverviewVO: 新增 totalSalesAmount/monthOverMonthGrowth/totalROI 等扁平KPI字段 - ProductOverviewQueryDTO: 支持 productId/startDate/endDate/taxRate 前端: - types.vo.ts: 适配新VO结构 (KPI字段扁平化+趋势数据+规格汇总) - types.dto.ts: 更新查询DTO - details/index.vue: fetchOverview调用真实API,normalizeOverview保留所有字段 - details/components/: StatCards/SalesTrendChart/FinancialPanel/SpecSummaryTable 适配新数据 - 修复 formatPercentPlain 对 null 值崩溃的问题 - StatCards/SalesTrendChart/FinancialPanel 使用 v-if 保护避免初始渲染报错
This commit is contained in:
@@ -7,5 +7,7 @@ export namespace ProductOverviewDTO {
|
||||
startDate: string;
|
||||
/** 结束日期 */
|
||||
endDate: string;
|
||||
/** 税率(可选,0~1) */
|
||||
taxRate?: number;
|
||||
}
|
||||
}
|
||||
|
||||
+120
-20
@@ -1,39 +1,139 @@
|
||||
export namespace ProductOverviewVO {
|
||||
/** 每日数据项 */
|
||||
export interface DailyData {
|
||||
/** 趋势数据项 */
|
||||
export interface TrendDataItem {
|
||||
/** 日期 */
|
||||
date: string;
|
||||
/** 对应的值 */
|
||||
value: number;
|
||||
}
|
||||
|
||||
/** 每日统计数据 */
|
||||
export interface DailyStatistics {
|
||||
/** 趋势数据 */
|
||||
export interface TrendData {
|
||||
/** 时间范围的总值 */
|
||||
total: number;
|
||||
/** 每日数据列表 */
|
||||
dailyDataList: DailyData[];
|
||||
dailyDataList: TrendDataItem[];
|
||||
}
|
||||
|
||||
/** 商品总览 */
|
||||
/** 规格销售明细项 */
|
||||
export interface SpecSummaryItem {
|
||||
/** 规格ID */
|
||||
specId: number;
|
||||
/** 规格名称 */
|
||||
specName: string;
|
||||
/** 规格编码 */
|
||||
specCode: string;
|
||||
/** 销售额 */
|
||||
salesAmount: number;
|
||||
/** 订单量 */
|
||||
orderCount: number;
|
||||
/** 总件数 */
|
||||
quantity: number;
|
||||
/** 客单价 */
|
||||
averageOrderValue: number;
|
||||
/** 商品成本 */
|
||||
productCost: number;
|
||||
/** 运费 */
|
||||
shippingCost: number;
|
||||
/** 其他成本 */
|
||||
otherCost: number;
|
||||
/** 退款金额 */
|
||||
refundAmount: number;
|
||||
/** 推广费 */
|
||||
promotionFee: number;
|
||||
/** 费比 */
|
||||
feeRatio: number;
|
||||
/** 税前盈亏 */
|
||||
profitBeforeTax: number;
|
||||
/** 销售额×税率的税额 */
|
||||
salesTaxAmount: number;
|
||||
/** ROI */
|
||||
roi: number;
|
||||
/** 税后盈亏 */
|
||||
profitAfterTax: number;
|
||||
}
|
||||
|
||||
/** 规格销售汇总合计行 */
|
||||
export interface SpecSummaryTotal {
|
||||
/** 销售额 */
|
||||
salesAmount: number;
|
||||
/** 订单量 */
|
||||
orderCount: number;
|
||||
/** 总件数 */
|
||||
quantity: number;
|
||||
/** 商品成本 */
|
||||
productCost: number;
|
||||
/** 运费 */
|
||||
shippingCost: number;
|
||||
/** 其他成本 */
|
||||
otherCost: number;
|
||||
/** 退款金额 */
|
||||
refundAmount: number;
|
||||
/** 推广费 */
|
||||
promotionFee: number;
|
||||
/** 费比 */
|
||||
feeRatio: number;
|
||||
/** 税前盈亏 */
|
||||
profitBeforeTax: number;
|
||||
/** 税额 */
|
||||
salesTaxAmount: number;
|
||||
/** ROI */
|
||||
roi: number;
|
||||
/** 税后盈亏 */
|
||||
profitAfterTax: number;
|
||||
}
|
||||
|
||||
/** 规格销售汇总 */
|
||||
export interface SpecSummary {
|
||||
/** 各规格明细列表 */
|
||||
list: SpecSummaryItem[];
|
||||
/** 合计行 */
|
||||
total: SpecSummaryTotal;
|
||||
}
|
||||
|
||||
/** 商品概览响应 */
|
||||
export interface Overview {
|
||||
/** 商品ID */
|
||||
productId: number;
|
||||
/** 商品名称 */
|
||||
productName: string;
|
||||
/** 销售额统计 */
|
||||
salesAmount: DailyStatistics;
|
||||
/** 订单数统计 */
|
||||
orderCount: DailyStatistics;
|
||||
/** 客单价统计 */
|
||||
averageOrderValue: DailyStatistics;
|
||||
/** 成本统计 */
|
||||
costAmount: DailyStatistics;
|
||||
/** 退款金额统计 */
|
||||
refundAmount: DailyStatistics;
|
||||
/** 推广费统计 */
|
||||
promotionFee: DailyStatistics;
|
||||
/** 费比统计 */
|
||||
feeRatio: DailyStatistics;
|
||||
|
||||
// ========== KPI 汇总指标 ==========
|
||||
/** 总销售额 */
|
||||
totalSalesAmount: number;
|
||||
/** 较上月同期增长百分比 */
|
||||
monthOverMonthGrowth: number;
|
||||
/** 总订单量 */
|
||||
totalOrderCount: number;
|
||||
/** 平均费比 */
|
||||
averageFeeRatio: number;
|
||||
/** 总净利润(税后) */
|
||||
totalNetProfitAfterTax: number;
|
||||
/** 扣除总税额 */
|
||||
totalTaxAmount: number;
|
||||
/** 销量目标达成率 */
|
||||
orderCountAchievementRate: number;
|
||||
/** 销售额目标达成率 */
|
||||
salesAmountAchievementRate: number;
|
||||
/** 汇总ROI */
|
||||
totalROI: number;
|
||||
/** 汇总客单价 */
|
||||
averageOrderValue: number;
|
||||
/** 退款金额合计 */
|
||||
refundAmount: number;
|
||||
/** 税前盈亏 */
|
||||
totalProfitBeforeTax: number;
|
||||
/** 总税后盈亏 */
|
||||
totalProfitAfterTax: number;
|
||||
|
||||
// ========== 趋势数据 ==========
|
||||
/** 销售额趋势分析 */
|
||||
salesAmountTrend: TrendData;
|
||||
/** 单量趋势分析 */
|
||||
orderCountTrend: TrendData;
|
||||
|
||||
// ========== 规格销售汇总 ==========
|
||||
/** 规格销售汇总 */
|
||||
specSummaries: SpecSummary;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user