Browse Source

订单消息

master
xpz2018 6 years ago
parent
commit
489211bccd
2 changed files with 20 additions and 8 deletions
  1. 21
      pages/mall/order-info/index.js
  2. 7
      pages/mall/order-offer/index.js

21
pages/mall/order-info/index.js

@ -27,6 +27,11 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
if(getCurrentPages().length == 1){
this.setData({
backStr: '首页'
})
}
this.setData({ token: app.globalData.token }) this.setData({ token: app.globalData.token })
event.on('EventMessage', this, this.onEvent) event.on('EventMessage', this, this.onEvent)
if (options.id) { if (options.id) {
@ -37,22 +42,17 @@ Page({
// /product/{id}产品详情 // /product/{id}产品详情
request.get('/bxe-mall/product/' + options.id).then(result => { request.get('/bxe-mall/product/' + options.id).then(result => {
//成功回调 //成功回调
wx.hideLoading()
this.setData({ this.setData({
['form.productId']: options.id, ['form.productId']: options.id,
orderInfo: result.data orderInfo: result.data
}) })
wx.hideLoading()
}).catch(err => { }).catch(err => {
//异常回调 //异常回调
wx.hideLoading() wx.hideLoading()
util.showToast(err) util.showToast(err)
}) })
} }
if(getCurrentPages().length == 1){
this.setData({
backStr: '首页'
})
}
}, },
// 事件处理 // 事件处理
onEvent: function (message) { onEvent: function (message) {
@ -207,5 +207,14 @@ Page({
// event的unregister // event的unregister
onUnload: function(){ onUnload: function(){
event.remove('EventMessage', this) event.remove('EventMessage', this)
if(getCurrentPages().length == 1){
this.toHome()
}
},
// 返回到主页
toHome(){
wx.reLaunch({
url: '/pages/mall/shops/index',
})
} }
}) })

7
pages/mall/order-offer/index.js

@ -124,8 +124,11 @@ Page({
request.post('/bxe-mall/order', data).then(result => { request.post('/bxe-mall/order', data).then(result => {
//成功回调 //成功回调
wx.hideLoading() 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 => { }).catch(err => {
//异常回调 //异常回调

Loading…
Cancel
Save