调整优惠券部分

This commit is contained in:
2024-12-09 10:36:16 +08:00
parent 9bc3cb5584
commit fd7777e4f4
6 changed files with 48 additions and 10 deletions

View File

@@ -25,9 +25,6 @@ Component({
* 组件的方法列表
*/
methods: {
handleUse() {
alertInfo("敬请期待")
},
handleChange() {
const { data } = this.data;
const that = this;
@@ -42,6 +39,18 @@ Component({
alertSuccess("兑换成功")
this.triggerEvent("change", { id, type: 2 })
})
},
handleUseIt() {
alertInfo("敬请期待")
},
async handleUse(e) {
const { data } = this.data;
const { code, message } = await redeemCoupons({ id: data.id, type: 2 })
if (code !== OK) {
alertInfo(message)
return;
}
this.triggerEvent("get", { id, type: 1 })
}
}
})

View File

@@ -32,6 +32,7 @@
<view class="right">
<van-button wx:if="{{type === 1}}" type="info" size="small" bind:tap="handleUse">去领取</van-button>
<van-button wx:if="{{type === 2}}" type="info" size="small" bind:tap="handleChange">去兑换</van-button>
<van-button wx:if="{{type === 3}}" type="info" size="small" bind:tap="handleUseIt">去使用</van-button>
</view>
</view>
</view>