Browse Source

bug优化

master
xpz2018 6 years ago
parent
commit
63b4989d31
10 changed files with 46 additions and 211 deletions
  1. 10
      app.js
  2. 2
      colorui/main.wxss
  3. 2
      components/tab/index.wxss
  4. 148
      pages/mall/order-info/index.wxs
  5. 83
      pages/mall/order-offer/index.js
  6. 2
      pages/mall/order-offer/index.wxml
  7. 1
      pages/mall/search-list/index.js
  8. 2
      pages/mall/search-list/index.wxml
  9. 5
      pages/mall/shops/index.js
  10. 2
      pages/mall/shops/index.wxml

10
app.js

@ -1,7 +1,7 @@
//app.js //app.js
App({ App({
release: false,
release: true,
httpUrl: 'https://api-test.qniao.cn', httpUrl: 'https://api-test.qniao.cn',
tmplIds: ['kg0T1ve0FpYrEtZ4ExbypHm8mtS7OJaehvqN_T9ypoI'], tmplIds: ['kg0T1ve0FpYrEtZ4ExbypHm8mtS7OJaehvqN_T9ypoI'],
globalData: { globalData: {
@ -15,14 +15,8 @@
if (this.release) { if (this.release) {
this.httpUrl = 'https://api.qniao.cn' this.httpUrl = 'https://api.qniao.cn'
} else { } else {
this.httpUrl = 'https://api-test.qniao.cn'
this.httpUrl = 'http://api-test.qniao.cn'
} }
// wx.loadFontFace({
// family: 'DINAlternate',
// source: 'url("https://medou.oss-cn-shenzhen.aliyuncs.com/ttf/DIN-BoldAlternate.otf")',
// success: function (res) {
// }
// })
wx.getSystemInfo({ wx.getSystemInfo({
success: e => { success: e => {
this.globalData.StatusBar = e.statusBarHeight; this.globalData.StatusBar = e.statusBarHeight;

2
colorui/main.wxss

@ -756,7 +756,7 @@ button.icon.lg {
padding-right: 30rpx; padding-right: 30rpx;
height: 72rpx; height: 72rpx;
line-height: 72rpx; line-height: 72rpx;
font-size: 32rpx;
font-size: 30rpx;
background-color: transparent; background-color: transparent;
} }

2
components/tab/index.wxss

@ -39,7 +39,7 @@
} }
.tabs__item--cur { .tabs__item--cur {
color: #008AFF; color: #008AFF;
font-size: 32rpx;
font-size: 30rpx;
} }
.tabs__item-child { .tabs__item-child {
display: inline-block; display: inline-block;

148
pages/mall/order-info/index.wxs

@ -1,148 +0,0 @@
function getDispatchDetailByIndex(form, index) {
if (index === 5) {
if (!isEmpty(form.schedulingNotesVehicleVos) && form.schedulingNotesVehicleVos.length >= 1) {
var centerName = '外部'
if (!isEmpty(form.schedulingNotesVehicleVos[0].vehicleOperationCenterName)) {
centerName = form.schedulingNotesVehicleVos[0].vehicleOperationCenterName.replace('工厂', '')
}
return '[' + centerName + ']' + form.schedulingNotesVehicleVos[0].driver
}
} else if (index === 6) {
if (!isEmpty(form.schedulingNotesVehicleVos) && form.schedulingNotesVehicleVos.length >= 1) {
return form.schedulingNotesVehicleVos[0].phone
}
} else if (index === 7) {
if (!isEmpty(form.schedulingNotesVehicleVos) && form.schedulingNotesVehicleVos.length >= 1) {
return form.schedulingNotesVehicleVos[0].plateNumber
}
} else if (index === 8) {
if (!isEmpty(form.schedulingNotesVehicleVos) && form.schedulingNotesVehicleVos.length >= 1) {
return (form.schedulingNotesVehicleVos[0].wheelBase / 10 ).toFixed(1)
}
} else if (index === 9) {
if (!isEmpty(form.schedulingNotesVehicleVos) && form.schedulingNotesVehicleVos.length >= 2) {
var wai = ''
if (form.schedulingNotesVehicleVos[1].isSelfSupport !== 1 ) {
wai = '/外'
}
return (
form.schedulingNotesVehicleVos[1].plateNumber +
'(' + getTruckString(form.schedulingNotesVehicleVos[1].vehicleType) + ')' + wai
)
}
} else if (index === 10) {
if (!isEmpty(form.schedulingNotesVehicleVos) && form.schedulingNotesVehicleVos.length >= 2) {
return form.schedulingNotesVehicleVos[1].driver
}
} else if (index === 11) {
if (!isEmpty(form.schedulingNotesVehicleVos) && form.schedulingNotesVehicleVos.length > 2) {
var wai2 = ''
if (form.schedulingNotesVehicleVos[2].isSelfSupport !== 1) {
wai2 = '/外'
}
return (
form.schedulingNotesVehicleVos[2].plateNumber +
'(' + getTruckString(form.schedulingNotesVehicleVos[2].vehicleType) + ')' + wai2
)
}
} else if (index === 12) {
if (!isEmpty(form.schedulingNotesVehicleVos) && form.schedulingNotesVehicleVos.length > 2) {
return form.schedulingNotesVehicleVos[2].driver
}
} else if (index === 13) {
var loaderString = ''
if (!isEmpty(form.loaders)) {
for (var i = 0; i < form.loaders.length; i++) {
if (isEmpty(loaderString)) {
loaderString += toLoaderString( form.loaders[i])
} else {
loaderString += ';' + toLoaderString(form.loaders[i])
}
}
}
return loaderString
}
return ''
}
function isEmpty(val) {
return typeof val === 'undefined' || val === '' || val === null
}
function getTruckString(type){
if (type == 1) {
return '抱车'
} else if (type == 2) {
return '铲车'
} else if (type == 3) {
return '叉拖车'
} else if (type == 4) {
return '货车'
}
return ''
}
function toLoaderString(loader) {
var ldString = ''
var centerName = '外部'
if (!isEmpty(loader.operationCenterName)) {
centerName = loader.operationCenterName.replace('工厂', '')
}
ldString += '[' + centerName + ']'
if (!isEmpty(loader.name)) {
ldString += loader.name
}
if (loader.isEmployee === 0) {
ldString += '/外'
}
return ldString
}
function showLayoutByIndex(form, index){
if (index === 1) {
if (!isEmpty(form.schedulingNotesVehicleVos) && form.schedulingNotesVehicleVos.length >= 2) {
return ( form.schedulingNotesVehicleVos[1].vehicleType === 1 || form.schedulingNotesVehicleVos[1].vehicleType === 2)
}
} else if (index === 2) {
if (!isEmpty(form.schedulingNotesVehicleVos) && form.schedulingNotesVehicleVos.length >= 3) {
return (form.schedulingNotesVehicleVos[2].vehicleType === 3 )
}
} else if (index === 3) {
if (!isEmpty(form.loaders) && form.loaders.length >= 1) {
return true
}
}
return false
}
function getSchedulingDate(form){
if (isEmpty(form.schedulingDate)) {
return ''
}
var date = getDate(form.schedulingDate.trim())
var today = getDate()
var dayCode = 24 * 60 * 60 * 1000
console.log((date.getTime() - today.getTime()) / dayCode)
var week = ''
if (date.getTime() === today.getTime()) {
week = '(今天)'
} else if (date.getTime() === today.getTime() + dayCode) {
week = '(明天)'
} else if (date.getTime() === today.getTime() - dayCode) {
week = '(昨天)'
} else if (date.getTime() === today.getTime() + dayCode * 2) {
week = '(后天)'
} else {
week = ['(周日)', '(周一)', '(周二)', '(周三)', '(周四)', '(周五)', '(周六)'][date.getDay()]
}
if (isEmpty(week)) {
week = ''
}
return form.schedulingDate + week
}
module.exports = {
getSchedulingDate: getSchedulingDate,
getDispatchDetailByIndex: getDispatchDetailByIndex,
showLayoutByIndex: showLayoutByIndex
}

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

@ -1,9 +1,7 @@
// pages/task/task-detail/index.js // pages/task/task-detail/index.js
import { $wuxDialog } from '../../../components/index'
const request = require('../../../utils/request'); //导入模块 const request = require('../../../utils/request'); //导入模块
const util = require('../../../utils/util'); const util = require('../../../utils/util');
const float = require('../../../utils/floatObj'); const float = require('../../../utils/floatObj');
const event = require('../../../utils/event.js')
const app = getApp() const app = getApp()
Page({ Page({
@ -21,7 +19,6 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
event.on('EventMessage', this, this.onEvent)
if (options.json) { if (options.json) {
var form = JSON.parse(options.json) var form = JSON.parse(options.json)
form.payType = 1 form.payType = 1
@ -34,12 +31,6 @@ Page({
}) })
} }
}, },
// 事件处理
onEvent: function (message) {
if (message.what == 10 && message.arg == 1) {
wx.navigateBack()
}
},
chooseAddress() { chooseAddress() {
wx.chooseAddress({ wx.chooseAddress({
@ -53,9 +44,9 @@ Page({
checkMode: function (e) { checkMode: function (e) {
var preAmount = 0 var preAmount = 0
if(e.currentTarget.dataset.index == 1){
if (e.currentTarget.dataset.index == 1) {
preAmount = float.accMul(float.accMul(this.data.form.unitPrice, this.data.form.number), 0.1).toFixed(2) preAmount = float.accMul(float.accMul(this.data.form.unitPrice, this.data.form.number), 0.1).toFixed(2)
} else if(e.currentTarget.dataset.index == 2){
} else if (e.currentTarget.dataset.index == 2) {
preAmount = float.accMul(this.data.form.unitPrice, this.data.form.number).toFixed(2) preAmount = float.accMul(this.data.form.unitPrice, this.data.form.number).toFixed(2)
} }
this.setData({ this.setData({
@ -83,44 +74,19 @@ Page({
}] }]
}) })
}, },
// 创建订单
offerProject: function (e) { offerProject: function (e) {
if (!this.data.addressInfo) { if (!this.data.addressInfo) {
util.showToast('请选择收货地址') util.showToast('请选择收货地址')
return return
} }
if (Number(this.data.form.payType) == 1) {
// 微信支付
// wx.requestPayment({
// 'timeStamp': '',
// 'nonceStr': '',
// 'package': '',
// 'signType': 'MD5',
// 'paySign': '',
// 'success': function (res) {
// },
// 'fail': function (res) {
// },
// 'complete': function (res) {
// }
// })
util.showToast('进行中,请选择货到付款')
} else {
this.postOrder(0)
}
},
// 创建订单
postOrder: function(realPrice){
var data = {} var data = {}
data.productId = Number(this.data.form.productId) data.productId = Number(this.data.form.productId)
data.skuId = this.data.form.skuId data.skuId = this.data.form.skuId
data.number = this.data.form.number data.number = this.data.form.number
data.sellMode = Number(this.data.form.sellMode) data.sellMode = Number(this.data.form.sellMode)
data.payType = Number(this.data.form.payType) data.payType = Number(this.data.form.payType)
data.realPrice = realPrice
data.realPrice = data.payType == 1 ? this.data.form.preAmount : 0
data.unitPrice = this.data.form.unitPrice data.unitPrice = this.data.form.unitPrice
data.totalPrice = this.data.form.totalPrice data.totalPrice = this.data.form.totalPrice
data.mobile = this.data.addressInfo.telNumber data.mobile = this.data.addressInfo.telNumber
@ -134,22 +100,39 @@ Page({
request.post('/bxe-mall/order', data).then(result => { request.post('/bxe-mall/order', data).then(result => {
//成功回调 //成功回调
wx.hideLoading() wx.hideLoading()
wx.requestSubscribeMessage({
tmplIds: app.tmplIds,
complete (res) {
wx.redirectTo({url: '/pages/mall/order-result/index?type=1'})
}
})
if (data.payType == 1) {
this.requestPayment(result.data.wxpay)
} else {
wx.requestSubscribeMessage({
tmplIds: app.tmplIds,
complete(res) {
wx.redirectTo({
url: '/pages/mall/order-result/index?type=1'
})
}
})
}
}).catch(err => { }).catch(err => {
//异常回调 //异常回调
wx.hideLoading() wx.hideLoading()
wx.redirectTo({
url: '/pages/mall/order-result/index?type=0&message=' + err
})
if (data.payType == 2) {
wx.redirectTo({
url: '/pages/mall/order-result/index?type=0&message=' + err
})
}
}) })
}, },
// event的unregister
onUnload: function () {
event.remove('EventMessage', this)
// 微信支付流程
requestPayment: function (data) {
data.success = function(res){
util.showToast('订单支付成功')
wx.redirectTo({
url: '/pages/mall/order-result/index?type=1'
})
}
data.fail = function(res){
util.showToast('订单支付失败')
}
wx.requestPayment(data)
} }
}) })

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

@ -8,7 +8,7 @@
<view wx:if="{{addressInfo}}" class="header-box flex flex-justify" style="padding:32rpx" bindtap="chooseAddress"> <view wx:if="{{addressInfo}}" class="header-box flex flex-justify" style="padding:32rpx" bindtap="chooseAddress">
<view class="flex flex-center"> <view class="flex flex-center">
<image style="width:60rpx;height:60rpx" src="/assets/image/icon_address.png"></image>
<image style="width:60rpx;height:60rpx" src="/assets/image/icon_address.svg"></image>
<view style="margin-left:18rpx"> <view style="margin-left:18rpx">
<view style="color:black;font-size:28rpx">{{addressInfo.userName}}</view> <view style="color:black;font-size:28rpx">{{addressInfo.userName}}</view>
<view style="color:gray;font-size:24rpx">{{addressInfo.provinceName + addressInfo.cityName + addressInfo.countyName + addressInfo.detailInfo}}</view> <view style="color:gray;font-size:24rpx">{{addressInfo.provinceName + addressInfo.cityName + addressInfo.countyName + addressInfo.detailInfo}}</view>

1
pages/mall/search-list/index.js

@ -144,6 +144,7 @@ Page({
this.setData({ this.setData({
rearchStringList: strList, rearchStringList: strList,
focus: false, focus: false,
finished: true,
loading: false loading: false
}) })
} }

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

@ -31,7 +31,7 @@
<view class="load-spinner text-gray" /> <view class="load-spinner text-gray" />
<view class="text-empty" style="margin-top:48rpx">加载中...</view> <view class="text-empty" style="margin-top:48rpx">加载中...</view>
</view> </view>
<view class="flex list-empty" wx:elif="{{!taskList.length}}" style="height:{{height}}rpx">
<view class="list-empty" wx:elif="{{!taskList.length}}" style="height:{{height}}rpx">
<image class="img-empty" src="/assets/image/list_empty.png"></image> <image class="img-empty" src="/assets/image/list_empty.png"></image>
<view class="text-empty">暂无数据</view> <view class="text-empty">暂无数据</view>
</view> </view>

5
pages/mall/shops/index.js

@ -120,6 +120,7 @@ Page({
if (this.data.requesting || this.data.finished) { if (this.data.requesting || this.data.finished) {
return return
} }
console.log('fetchTaskList>>>')
if(this.data.loading){ if(this.data.loading){
this.data.requesting = true this.data.requesting = true
} else { } else {
@ -140,6 +141,10 @@ Page({
['form.pageNum']: (num + 1), ['form.pageNum']: (num + 1),
finished finished
}) })
} else {
this.setData({
finished: true
})
} }
}).catch(err => { }).catch(err => {
//异常回调 //异常回调

2
pages/mall/shops/index.wxml

@ -96,7 +96,7 @@
</wux-skeleton> </wux-skeleton>
</view> </view>
<view class="flex list-empty" wx:elif="{{!taskList.length && !cheapList.length}}" style="height:{{height}}rpx">
<view class="list-empty" wx:elif="{{!taskList.length && !cheapList.length}}" style="height:{{height}}rpx">
<image class="img-empty" src="/assets/image/list_empty.png"></image> <image class="img-empty" src="/assets/image/list_empty.png"></image>
<view class="text-empty">暂无数据</view> <view class="text-empty">暂无数据</view>
</view> </view>

Loading…
Cancel
Save