修改优惠券跳转 bug

This commit is contained in:
2025-04-01 01:25:35 +08:00
parent a184608c32
commit 75f1e6ad96

View File

@ -16,7 +16,9 @@ Page({
isShowModal:false, isShowModal:false,
errorMsg:'' errorMsg:'',
canReceive:false
}, },
/** /**
@ -43,26 +45,22 @@ Page({
getting:true getting:true
}) })
commonApi.activities.receive(this.data.activityId).then((data)=>{ commonApi.activities.receive(this.data.activityId).then((data)=>{
wx.showToast({
title: '领取成功',
});
this.setData({ this.setData({
isShowModal:true, isShowModal:true,
getting:false,
reveivedSuccess:true, reveivedSuccess:true,
errorMsg:'恭喜您已领取成功!' errorMsg:'恭喜您已领取成功!'
}) })
}).catch((e)=>{ }).catch((e)=>{
this.setData({ this.setData({
isShowModal:true, isShowModal:true,
getting:false,
errorMsg:e.message||'领取错误' errorMsg:e.message||'领取错误'
}) })
this.setData({
getting:false
})
}) })
}, },
navToIndex(){ navToIndex(){
if(this.data.hasProduct){ if(this.data.hasProduct&&this.data.canReceive){
wx.reLaunch({ wx.reLaunch({
url: '/pages/my/coupon/index', url: '/pages/my/coupon/index',
}) })
@ -97,6 +95,7 @@ Page({
}); });
return userApi.coupon.check(this.data.activityId); return userApi.coupon.check(this.data.activityId);
}).then((data)=>{ }).then((data)=>{
this.data.canReceive = data.can_receive;
if(!data.can_receive){ if(!data.can_receive){
this.setData({ this.setData({
isShowModal:true, isShowModal:true,