diff --git a/app.js b/app.js index 1835ef2..689eeb7 100644 --- a/app.js +++ b/app.js @@ -3,7 +3,7 @@ App({ release: false, httpUrl: 'http://192.168.0.106:9000', - + tmplIds: ['kg0T1ve0FpYrEtZ4ExbypHm8mtS7OJaehvqN_T9ypoI'], globalData: { userInfo: {}, openId: null, diff --git a/pages/index/index.js b/pages/index/index.js index c801249..0541672 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -82,6 +82,6 @@ Page({ event.emit('EventMessage', { what: 1, desc: 'Login' }) } }) - }, + } }) diff --git a/pages/mall/order-info/index.wxml b/pages/mall/order-info/index.wxml index 9e6b5ef..4780257 100644 --- a/pages/mall/order-info/index.wxml +++ b/pages/mall/order-info/index.wxml @@ -53,7 +53,7 @@ 送货说明 - {{orderInfo.summary}} + {{orderInfo.deliverTips}} diff --git a/pages/mall/order-offer/index.js b/pages/mall/order-offer/index.js index 9ddd873..55f2ce4 100644 --- a/pages/mall/order-offer/index.js +++ b/pages/mall/order-offer/index.js @@ -33,7 +33,6 @@ Page({ }, // 事件处理 onEvent: function (message) { - console.log('mall>>offer>>onEvent', message) if (message.what == 10 && message.arg == 1) { wx.navigateBack() } @@ -82,22 +81,23 @@ Page({ } if (Number(this.data.form.payType) == 1) { // 微信支付 - wx.requestPayment({ - 'timeStamp': '', - 'nonceStr': '', - 'package': '', - 'signType': 'MD5', - 'paySign': '', - 'success': function (res) { + // wx.requestPayment({ + // 'timeStamp': '', + // 'nonceStr': '', + // 'package': '', + // 'signType': 'MD5', + // 'paySign': '', + // 'success': function (res) { - }, - 'fail': function (res) { + // }, + // 'fail': function (res) { - }, - 'complete': function (res) { + // }, + // 'complete': function (res) { - } - }) + // } + // }) + util.showToast('进行中,请选择货到付款') } else { this.postOrder(0) } @@ -125,15 +125,15 @@ Page({ //成功回调 wx.hideLoading() wx.requestSubscribeMessage({ - tmplIds: ['cEHKFWCuzOz-QsPsMbyo7Q_Xjnf2EShCEKJzPnLPFYA'], + tmplIds: app.tmplIds, complete (res) { - wx.navigateTo({url: '/pages/mall/order-result/index?type=1'}) + wx.redirectTo({url: '/pages/mall/order-result/index?type=1'}) } }) }).catch(err => { //异常回调 wx.hideLoading() - wx.navigateTo({ + wx.redirectTo({ url: '/pages/mall/order-result/index?type=0&message=' + err }) }) diff --git a/pages/mall/search-list/index.wxml b/pages/mall/search-list/index.wxml index 3f12165..e533ec6 100644 --- a/pages/mall/search-list/index.wxml +++ b/pages/mall/search-list/index.wxml @@ -36,7 +36,7 @@ 暂无数据 - + diff --git a/pages/mall/shops/index.js b/pages/mall/shops/index.js index eda180a..4fc915d 100644 --- a/pages/mall/shops/index.js +++ b/pages/mall/shops/index.js @@ -29,6 +29,7 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { + this.checkLogin() this.setData({ height: app.globalData.fragmentHeight, CustomBar: app.globalData.CustomBar @@ -59,7 +60,7 @@ Page({ request.get('/bxe-mall/product/cheapList').then(result => { //成功回调 this.setData({ loading: false, cheapList: result.data }) - console.log(this.data.cheapList.length > 0) + }).catch(err => { //异常回调 this.setData({ loading: false }) @@ -68,6 +69,7 @@ Page({ }, fetchTaskList: function () { + console.log('fetchTaskList>>>>') if (this.data.requesting || this.data.finished) { return } @@ -117,7 +119,45 @@ Page({ url: '/pages/mall/order-info/index?id=' + item.id }) }, - + // 进行登录,同时获取到openId,为下一步的微信登录做准备, + checkLogin: function () { + wx.login({ + success: res => { + wx.request({ + url: app.httpUrl + '/user-centre/wx/bxe/session', + data: { code: res.code }, + method: 'POST', + success: function (result) { + if (result.data.code != 0) { + event.emit('EventMessage', { what: 1, desc: 'Login' }) + return + } + app.globalData.openId = result.data.data.openid + // /commonLogin/login通用登录 + wx.request({ + url: app.httpUrl + '/user-centre/commonLogin/login', + data: { openid: app.globalData.openId }, + method: 'POST', + success: function (result) { + if (result.data.code == 0 && result.data.data.token) { + app.globalData.token = result.data.data.token + } + }, + complete: function () { + event.emit('EventMessage', { what: 1, desc: 'Login' }) + } + }) + }, + fail: function () { + event.emit('EventMessage', { what: 1, desc: 'Login' }) + } + }) + }, + fail: function () { + event.emit('EventMessage', { what: 1, desc: 'Login' }) + } + }) + }, /** * 生命周期函数--监听页面卸载 */ diff --git a/pages/mall/shops/index.wxml b/pages/mall/shops/index.wxml index 96f8c28..706c102 100644 --- a/pages/mall/shops/index.wxml +++ b/pages/mall/shops/index.wxml @@ -86,7 +86,7 @@ - +