From 489211bccdcdd56e58fce7550b0a3314ffa138eb Mon Sep 17 00:00:00 2001 From: xpz2018 <107107461@qq.com> Date: Thu, 9 Apr 2020 20:03:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/mall/order-info/index.js | 21 +++++++++++++++------ pages/mall/order-offer/index.js | 7 +++++-- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/pages/mall/order-info/index.js b/pages/mall/order-info/index.js index a603fee..78ed9f1 100644 --- a/pages/mall/order-info/index.js +++ b/pages/mall/order-info/index.js @@ -27,6 +27,11 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { + if(getCurrentPages().length == 1){ + this.setData({ + backStr: '首页' + }) + } this.setData({ token: app.globalData.token }) event.on('EventMessage', this, this.onEvent) if (options.id) { @@ -37,22 +42,17 @@ Page({ // /product/{id}产品详情 request.get('/bxe-mall/product/' + options.id).then(result => { //成功回调 + wx.hideLoading() this.setData({ ['form.productId']: options.id, orderInfo: result.data }) - wx.hideLoading() }).catch(err => { //异常回调 wx.hideLoading() util.showToast(err) }) } - if(getCurrentPages().length == 1){ - this.setData({ - backStr: '首页' - }) - } }, // 事件处理 onEvent: function (message) { @@ -207,5 +207,14 @@ Page({ // event的unregister onUnload: function(){ event.remove('EventMessage', this) + if(getCurrentPages().length == 1){ + this.toHome() + } + }, + // 返回到主页 + toHome(){ + wx.reLaunch({ + url: '/pages/mall/shops/index', + }) } }) \ No newline at end of file diff --git a/pages/mall/order-offer/index.js b/pages/mall/order-offer/index.js index f0dbd09..9ddd873 100644 --- a/pages/mall/order-offer/index.js +++ b/pages/mall/order-offer/index.js @@ -124,8 +124,11 @@ Page({ request.post('/bxe-mall/order', data).then(result => { //成功回调 wx.hideLoading() - wx.navigateTo({ - url: '/pages/mall/order-result/index?type=1' + wx.requestSubscribeMessage({ + tmplIds: ['cEHKFWCuzOz-QsPsMbyo7Q_Xjnf2EShCEKJzPnLPFYA'], + complete (res) { + wx.navigateTo({url: '/pages/mall/order-result/index?type=1'}) + } }) }).catch(err => { //异常回调