feat: 添加店铺概览统计功能及退款状态支持

This commit is contained in:
ah--desktop
2026-01-15 00:02:38 +08:00
parent 290223fdba
commit 0056f2bb11
21 changed files with 2052 additions and 6 deletions
@@ -1,7 +1,7 @@
import type { ShopDTO, ShopVO } from './types';
import type { PageQueryDTO, PageResultVO } from '#/types/common';
import type { ProductVO } from '#/api/ecommerce/product/types';
import type { PageQueryDTO, PageResultVO } from '#/types/common';
import { requestClient } from '#/api/request';
@@ -68,3 +68,15 @@ export async function getShopProductPageApi(
params,
);
}
/**
* 获取店铺概览统计数据
*/
export async function getShopOverviewStatisticsApi(
params: ShopDTO.OverviewQuery,
) {
return requestClient.post<ShopVO.OverviewStatistics>(
'/ec/shop/overview-statistics',
params,
);
}
@@ -46,4 +46,12 @@ export namespace ShopDTO {
/** 店铺ID */
shopId: number;
}
/** 店铺概览查询参数 */
export interface OverviewQuery {
/** 店铺ID */
shopId: number;
/** 日期范围数组(第一个是开始日期,第二个是结束日期,只有一个日期则返回当天数据) */
dateRange: string[];
}
}
@@ -104,4 +104,90 @@ export namespace ShopVO {
/** 费比统计 */
feeRatio: DailyStatistics;
}
/** 店铺概览统计信息 */
export interface OverviewStatistics {
/** 店铺总销售额 */
totalSalesAmount: number;
/** 较上月同期增长百分比 */
monthOverMonthGrowth?: number;
/** 店铺总单量 */
totalOrderCount: number;
/** 总推广费支出 */
totalPromotionFee: number;
/** 平均费比(推广费/销售额) */
averageFeeRatio?: number;
/** 店铺总净利(税后) */
totalNetProfitAfterTax: number;
/** 扣除总税额 */
totalTaxAmount?: number;
/** 店铺总销量目标(目标订单数) */
totalTargetOrderCount?: number;
/** 店铺总销售额目标 */
totalTargetAmount?: number;
/** 销量目标达成率 */
orderCountAchievementRate?: number;
/** 销售额目标达成率 */
salesAmountAchievementRate?: number;
/** 汇总ROI */
totalROI?: number;
/** 总税后盈亏 */
totalProfitAfterTax?: number;
/** 销售额趋势分析 */
salesAmountTrend?: TrendData;
/** 单量趋势分析 */
orderCountTrend?: TrendData;
/** 多商品数据横向对比 */
productComparisons?: ProductComparison[];
}
/** 商品对比数据 */
export interface ProductComparison {
/** 商品ID */
productId: number;
/** 商品名称 */
productName: string;
/** 商品编码 */
productCode?: string;
/** 销售额 */
salesAmount: number;
/** 单量 */
orderCount?: number;
/** 客单价 */
averageOrderValue?: number;
/** 成本运费 */
shippingCost?: number;
/** 退款金额 */
refundAmount?: number;
/** 推广费 */
totalPromotionFee?: number;
/** 刷单费用 */
brushFee?: number;
/** 费比 */
feeRatio?: number;
/** 税前盈亏 */
totalProfitBeforeTax?: number;
/** 销售额4%税额 */
salesTaxAmount?: number;
/** 税后盈亏 */
profitAfterTax?: number;
/** ROI */
roi?: number;
}
/** 趋势数据 */
export interface TrendData {
/** 时间范围的总值 */
total: number;
/** 每日数据列表 */
dailyDataList: TrendDataItem[];
}
/** 趋势数据项 */
export interface TrendDataItem {
/** 日期 */
date: string;
/** 对应的值 */
value: number;
}
}