diff --git a/components/discountCoupon/index.js b/components/discountCoupon/index.js index 4eae670..ac53312 100644 --- a/components/discountCoupon/index.js +++ b/components/discountCoupon/index.js @@ -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 }) + }) + } } }) \ No newline at end of file diff --git a/pages/integralRecord/index.js b/pages/integralRecord/index.js index 88a5747..c3f43ef 100644 --- a/pages/integralRecord/index.js +++ b/pages/integralRecord/index.js @@ -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;