修改积分显示异常

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

View File

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