1.線上ajax操作
//查詢當前訂單是否送券
getCoupons(orderId){
request({
url: inter.getConsumerCouponStatus,
data: {
orderId: orderId
},
callback: (res) => {
if(res.CODE==-1){
uni.showToast({
title: res.MESSAGE,
icon: false
});
return false;
}
if(!res.RESULT.hasConsumerCoupon){ // true 用戶獲取了優惠券
uni.showToast({
title: '本次消費已獲贈消費券',
icon: 'none',
mask: true,
duration: 1500
});
}
setTimeout(() => {
uni.reLaunch({
url: '/pages/home/home'
})
}, 2000)
}
})
}