From 307be86cb4fb70cad3a1c568f1f396db60f1a089 Mon Sep 17 00:00:00 2001 From: qiaomu <3520484422@qq.com> Date: Mon, 9 Dec 2024 16:35:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A7=AF=E5=88=86=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/discountCoupon/index.js | 20 +++++++++++--------- pages/integralRecord/index.js | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) 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;