修改积分显示异常

This commit is contained in:
qiaomu 2024-12-09 16:35:39 +08:00
parent ebc8cae3c8
commit 307be86cb4
2 changed files with 12 additions and 10 deletions

View File

@ -29,15 +29,13 @@ Component({
const { data } = this.data;
const that = this;
loadingFunc(async () => {
console.log("--------------========", data)
const { code, message } = await redeemCoupons({ id: data.id, type: 2 })
console.log("code", code, 'message', message)
if (code !== OK) {
alertInfo(message)
return
}
alertSuccess("兑换成功")
this.triggerEvent("change", { id, type: 2 })
that.triggerEvent("change", { id, type: 2 })
})
},
handleUseIt() {
@ -45,12 +43,16 @@ Component({
},
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 })
const that = this;
loadingFunc(async () => {
const { code, message } = await redeemCoupons({ id: data.id, type: 2 })
if (code !== OK) {
alertInfo(message)
return;
}
that.triggerEvent("get", { id, type: 1 })
})
}
}
})

View File

@ -31,7 +31,7 @@ Page({
}
this.setData({
list: data?.map(item => {
item.type = ['充值增加', '系统增加', '系统减少', '冲正减少', '退费减少', '兑换优惠券', '积分清零'][item.type]
item.type = ['充值增加', '系统增加', '系统减少', '冲正减少', '退费减少', '兑换优惠券', '积分清零'][item.type - 1]
item.nowBalance = Number(item.nowBalance || 0)
item.lastBalance = Number(item.lastBalance || 0)
item.value = item.nowBalance - item.lastBalance;