| | |
| | | }) |
| | | } |
| | | //积分兑换 |
| | | async function confirm(){ |
| | | await integralConvertApi({userId:userInfo.value.id,goodsId:detailInfo.value.id}).then(async(res) =>{ |
| | | if(res.code == 200){ |
| | | uni.showToast({ |
| | | title:'兑换成功!', |
| | | duration:1000 |
| | | }) |
| | | setTimeout(() =>{ |
| | | uni.navigateTo({ |
| | | url:'/pages/pointsMall/pointsExchangeRecord/index' |
| | | }) |
| | | },1000) |
| | | await getGoodsDetail(goodsId) |
| | | } |
| | | }) |
| | | } |
| | | //打开确认弹窗 |
| | | const alertDialog = ref() |
| | | async function integralConvert(){ |
| | | if(detailInfo.value.useIntegral <= Number(userInfo.value.integral)){ |
| | | await integralConvertApi({userId:userInfo.value.id,goodsId:detailInfo.value.id}).then(async(res) =>{ |
| | | if(res.code == 200){ |
| | | uni.showToast({ |
| | | title:'兑换成功!', |
| | | icon:'none' |
| | | }) |
| | | await getGoodsDetail(goodsId) |
| | | } |
| | | }) |
| | | alertDialog.value.open() |
| | | }else{ |
| | | uni.showToast({ |
| | | title:'积分余额不足!', |
| | |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <!-- 提示窗 --> |
| | | <uni-popup ref="alertDialog" type="dialog"> |
| | | <uni-popup-dialog type="info" title="提示" :showClose = 'true' content="确认兑换该商品!" @confirm="confirm"></uni-popup-dialog> |
| | | </uni-popup> |
| | | </view> |
| | | </template> |
| | | |