feat(shop-zone): 新增专区销量统计功能

- 后端新增专区销量统计相关 VO 并扩展 ShopHomeSection 实体
- 新增批量查询专区销量汇总与商品排行的 Mapper 方法及接口
- Controller 增加获取专区销量统计的接口支持时间范围查询
- 前端接口定义新增专区销量统计类型及请求方法
- 专区管理页面列表新增销量件数、销售额列及销量详情按钮
- 实现专区销量统计弹窗支持时间筛选、汇总展示和排行显示
- 完成前端相关界面和交互设计,保证功能完整可用
- 统计口径基于已支付且未取消/退款订单商品实际成交数据
This commit is contained in:
2026-08-17 12:40:08 +08:00
parent fe97f49afe
commit ced8c7cff7
15 changed files with 1082 additions and 448 deletions
+19 -1
View File
@@ -4,7 +4,8 @@ import type {
HomeSection,
HomeSectionParam,
SectionPermission,
SectionGoods
SectionGoods,
SectionSalesStatsVO
} from './model';
import type { User } from '@/api/system/user/model';
import { MODULES_API_URL } from '@/config/setting';
@@ -238,3 +239,20 @@ export async function getSectionQrcode(
}
return window.URL.createObjectURL(blob);
}
/**
* 专区销量统计(销量件数 + 销售额 + 商品排行), 支持时间范围 start/end(yyyy-MM-dd HH:mm:ss)
*/
export async function getSectionSalesStats(
id: number,
params?: { start?: string; end?: string }
) {
const res = await request.get<ApiResult<SectionSalesStatsVO>>(
MODULES_API_URL + '/shop/shop-home-section/' + id + '/stats',
{ params }
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
+32
View File
@@ -36,6 +36,10 @@ export interface HomeSection {
createTime?: string;
// 修改时间
updateTime?: string;
// 销量件数(统计, 非DB字段)
salesNum?: number;
// 销售额(统计, 非DB字段)
salesAmount?: number;
}
/**
@@ -86,3 +90,31 @@ export interface SectionUser {
sectionId?: number;
userId?: number;
}
/**
* 专区销量统计(含商品排行)
*/
export interface SectionSalesStatsVO {
// 专区ID
sectionId?: number;
// 销量件数
salesNum?: number;
// 销售额
salesAmount?: number;
// 统计开始时间
startTime?: string;
// 统计结束时间
endTime?: string;
// 商品销量排行
goodsRank?: SectionGoodsRankItem[];
}
/**
* 专区商品销量排行项
*/
export interface SectionGoodsRankItem {
goodsId?: number;
goodsName?: string;
salesNum?: number;
salesAmount?: number;
}