From 2544d5d89a93dd6e0d9a63fc90b2b2340e171858 Mon Sep 17 00:00:00 2001 From: Enzo <1284707383@qq.com> Date: Fri, 17 Sep 2021 18:03:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=94=AF=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/order/confirm_atonce.vue | 55 ++++++++++++++++------------------ 1 file changed, 26 insertions(+), 29 deletions(-) diff --git a/pages/order/confirm_atonce.vue b/pages/order/confirm_atonce.vue index eb4605a..a4cc86a 100644 --- a/pages/order/confirm_atonce.vue +++ b/pages/order/confirm_atonce.vue @@ -10,21 +10,27 @@ timesIndex: 0, userInfo: {}, payErr: {}, - paySuccecc: {} + paySuccecc: {}, + count: 0 } }, onShow(e) { // this.order_id = uni.getStorageSync('order_id') - let that = this - uni.$once('order_id',function(data){ - that.order_id = data.msg - if (that.order_id) { - that.getUserProfile() - } else { - that.$msg('获取订单失败'); - } - }) - + let that = this; + that.count++; + if(that.count == 1) { + uni.$on('order_id',function(data){ + that.order_id = data.msg + if (that.order_id) { + that.getUserProfile() + } else { + that.$msg('获取订单失败'); + } + }) + } + }, + onUnload() { + uni.$off('order_id'); }, methods: { // 获取用户信息 @@ -78,29 +84,20 @@ }) }, fail: (err) => { - uni.showModal({ - title: '提示', - content: JSON.stringify(err), - confirmColor: '#1998FE', - showCancel: false, - success(res2) { - if (res2.confirm) { - wx.navigateBackMiniProgram({ - extraData: { - backPayState: false, - payorder_id: that.order_id - }, - success(res) {} - }) - } - } - }); + wx.navigateBackMiniProgram({ + extraData: { + backPayState: false, + payorder_id: that.order_id + }, + success(res) {} + }) }, }) }).catch(err => { + let that = this; uni.showModal({ title: '提示', - content: JSON.stringify(err), + content: '支付订单失败', showCancel: false, confirmColor: '#1998FE', success(res2) {