Browse Source

优化

master
xpz2018 6 years ago
parent
commit
8e631d3f3f
7 changed files with 64 additions and 24 deletions
  1. 2
      app.js
  2. 2
      pages/index/index.js
  3. 2
      pages/mall/order-info/index.wxml
  4. 34
      pages/mall/order-offer/index.js
  5. 2
      pages/mall/search-list/index.wxml
  6. 44
      pages/mall/shops/index.js
  7. 2
      pages/mall/shops/index.wxml

2
app.js

@ -3,7 +3,7 @@ App({
release: false,
httpUrl: 'http://192.168.0.106:9000',
tmplIds: ['kg0T1ve0FpYrEtZ4ExbypHm8mtS7OJaehvqN_T9ypoI'],
globalData: {
userInfo: {},
openId: null,

2
pages/index/index.js

@ -82,6 +82,6 @@ Page({
event.emit('EventMessage', { what: 1, desc: 'Login' })
}
})
},
}
})

2
pages/mall/order-info/index.wxml

@ -53,7 +53,7 @@
</view>
<view class="bg-white" style="padding:32rpx;">
<view class="text-black" style="font-size:16px">送货说明</view>
<view class="text-gray" style="font-size:14px;margin-top:32rpx">{{orderInfo.summary}}</view>
<view class="text-gray" style="font-size:14px;margin-top:32rpx">{{orderInfo.deliverTips}}</view>
</view>
<view style="height:150rpx;"></view>

34
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
})
})

2
pages/mall/search-list/index.wxml

@ -36,7 +36,7 @@
<image class="img-empty" src="/assets/image/list_empty.png"></image>
<view class="text-empty">暂无数据</view>
</view>
<scroll-view scroll-y style="height: 100%;padding: 0rpx 24rpx" wx:else bindscrolltolower="fetchTaskList">
<scroll-view scroll-y style="height:{{height}}rpx;padding: 0rpx 24rpx" wx:else bindscrolltolower="fetchTaskList">
<view wx:for-item="pageItem" wx:for-index="pageIndex" wx:for="{{taskList}}" wx:key="pageIndex">
<view class="flex content" wx:for="{{pageItem}}" wx:key="index" data-page="{{pageIndex}}" data-index="{{index}}" bindtap="lookItem">
<wux-image width="{{120}}" height="{{120}}" wux-class="page-icon" src="{{item.litimgUrl}}" mode="{{aspectFill}}">

44
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' })
}
})
},
/**
* 生命周期函数--监听页面卸载
*/

2
pages/mall/shops/index.wxml

@ -86,7 +86,7 @@
<input type="text" disabled="true" placeholder="请输入要搜索的商品" confirm-type="search"></input>
</view>
</view>
<scroll-view scroll-y style="height:100%;margin-top: 100rpx;padding: 0rpx 24rpx" bindscrolltolower="fetchTaskList">
<scroll-view scroll-y style="height:{{height}}rpx;margin-top: 100rpx;padding: 0rpx 24rpx" bindscrolltolower="fetchTaskList">
<image src="https://image.weilanwl.com/img/4x3-1.jpg" class="swiper-image" mode="aspectFill" lazy-load="{{true}}" style="margin-top:24rpx"></image>
<view wx:if="{{cheapList.length}}">
<view class="flex nav-li">

Loading…
Cancel
Save