feat(coupon): 添加优惠券领取中心功能
- 新增优惠券领取中心页面,包含热门优惠券轮播、优惠券列表、筛选功能等 - 实现优惠券数据加载、搜索、下拉刷新、加载更多等功能 - 添加优惠券领取逻辑,支持用户领取优惠券 - 优化邀请小程序码生成和分享功能 -调整首页和用户订单组件的样式
This commit is contained in:
@@ -96,10 +96,10 @@ export interface InviteRecordParam {
|
||||
* 生成小程序码
|
||||
*/
|
||||
export async function generateMiniProgramCode(data: MiniProgramCodeParam) {
|
||||
const res = await request.post<ApiResult<string>>(
|
||||
SERVER_API_URL + '/invite/generate-miniprogram-code',
|
||||
data
|
||||
const res = await request.get<ApiResult<string>>(
|
||||
'/wx-login/getOrderQRCodeUnlimited/' + data.scene
|
||||
);
|
||||
console.log(res,'res....')
|
||||
if (res.code === 0) {
|
||||
return res.data;
|
||||
}
|
||||
@@ -109,15 +109,15 @@ export async function generateMiniProgramCode(data: MiniProgramCodeParam) {
|
||||
/**
|
||||
* 生成邀请小程序码
|
||||
*/
|
||||
export async function generateInviteCode(inviterId: number, source: string = 'qrcode') {
|
||||
const scene = `inviter=${inviterId}&source=${source}&t=${Date.now()}`;
|
||||
export async function generateInviteCode(inviterId: number) {
|
||||
const scene = `uid_${inviterId}`;
|
||||
|
||||
return generateMiniProgramCode({
|
||||
page: 'pages/index/index',
|
||||
scene: scene,
|
||||
width: 430,
|
||||
width: 180,
|
||||
checkPath: true,
|
||||
envVersion: 'release'
|
||||
envVersion: 'trial'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -99,3 +99,17 @@ export async function getShopCoupon(id: number) {
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 领取优惠券
|
||||
*/
|
||||
export async function receiveCoupon(params: { couponId: number; userId: number }) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/shop/shop-coupon/receive',
|
||||
params
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user