docs: 更新优惠券相关文档- 新增优惠券API集成文档

- 新增优惠券卡片对齐修复文档
- 新增优惠券状态显示调试文档
- 新增优惠券组件警告修复文档- 更新用ShopInfo Hook字段迁移文档
- 更新Arguments关键字修复文档
This commit is contained in:
2025-08-15 01:52:36 +08:00
parent dc87f644c9
commit 1b24a611a8
50 changed files with 6530 additions and 595 deletions

View File

@@ -99,3 +99,42 @@ export async function getShopUserCoupon(id: number) {
}
return Promise.reject(new Error(res.message));
}
/**
* 获取我的可用优惠券
*/
export async function getMyAvailableCoupons() {
const res = await request.get<ApiResult<ShopUserCoupon[]>>(
'/shop/shop-user-coupon/my/available'
);
if (res.code === 0 && res.data) {
return res.data;
}
return Promise.reject(new Error(res.message));
}
/**
* 获取我的已使用优惠券
*/
export async function getMyUsedCoupons() {
const res = await request.get<ApiResult<ShopUserCoupon[]>>(
'/shop/shop-user-coupon/my/used'
);
if (res.code === 0 && res.data) {
return res.data;
}
return Promise.reject(new Error(res.message));
}
/**
* 获取我的已过期优惠券
*/
export async function getMyExpiredCoupons() {
const res = await request.get<ApiResult<ShopUserCoupon[]>>(
'/shop/shop-user-coupon/my/expired'
);
if (res.code === 0 && res.data) {
return res.data;
}
return Promise.reject(new Error(res.message));
}

View File

@@ -32,8 +32,16 @@ export interface ShopUserCoupon {
endTime?: string;
// 使用状态(0未使用 1已使用 2已过期)
status?: number;
// 状态文本描述
statusText?: string;
// 是否过期, 0否, 1是
isExpire?: number;
// 是否即将过期(后端计算)
isExpiringSoon?: boolean;
// 剩余天数(后端计算)
daysRemaining?: number;
// 剩余小时数(后端计算)
hoursRemaining?: number;
// 使用时间
useTime?: string;
// 使用订单ID
@@ -63,5 +71,13 @@ export interface ShopUserCouponParam extends PageParam {
isExpire?: number;
sortBy?: string;
sortOrder?: string;
// 仅查询有效的优惠券
validOnly?: boolean;
// 仅查询已过期的优惠券
expired?: boolean;
// 查询即将过期的优惠券
expiringSoon?: boolean;
// 当前时间(用于测试)
currentTime?: string;
keywords?: string;
}