Browse Source

no message

feature/v1.1
xpz2018 5 years ago
parent
commit
1cd4a7b903
9 changed files with 104 additions and 59 deletions
  1. 7
      pages/process/check-list/index.js
  2. 44
      pages/process/order-info/index.js
  3. 9
      pages/process/order-info/index.wxml
  4. 18
      pages/process/order-list/index.js
  5. 2
      pages/process/order-list/index.json
  6. 8
      pages/process/order-list/index.wxml
  7. 22
      pages/process/payment-list/index.js
  8. 51
      pages/process/payment/index.js
  9. 2
      pages/process/payment/index.wxml

7
pages/process/check-list/index.js

@ -50,12 +50,7 @@ Page({
} }
}, },
onRefreshList: function () { onRefreshList: function () {
this.setData({
orderList: [],
['form.pageNum']: 1,
loading: true,
finished: false
})
this.setData({ orderList: [], ['form.pageNum']: 1, loading: true, finished: false })
this.data.lastTime = null this.data.lastTime = null
this.fetchOrderList() this.fetchOrderList()
}, },

44
pages/process/order-info/index.js

@ -20,22 +20,25 @@ Page({
*/ */
onLoad: function (options) { onLoad: function (options) {
if(options.id){ if(options.id){
wx.showLoading({ title: '正在获取', mask: true })
getFactoryOrderInfo(options.id).then(result => {
wx.hideLoading()
if(result.data.status == 4){
this.data.title = '待付款'
} else if(result.data.status == 5){
this.data.title = '已完成'
}
this.setData({ safeBottom: app.globalData.safeBottom, form: result.data, title: this.data.title })
}).catch(err => {
wx.hideLoading()
this.setData({ safeBottom: app.globalData.safeBottom })
util.showToast(err)
})
this.fetchOrderInfo(options.id)
} }
}, },
fetchOrderInfo(id){
wx.showLoading({ title: '正在获取', mask: true })
getFactoryOrderInfo(id).then(result => {
wx.hideLoading()
if(result.data.status == 4){
this.data.title = '待付款'
} else if(result.data.status == 5){
this.data.title = '已完成'
}
this.setData({ safeBottom: app.globalData.safeBottom, form: result.data, title: this.data.title })
}).catch(err => {
wx.hideLoading()
this.setData({ safeBottom: app.globalData.safeBottom })
util.showToast(err)
})
},
showPlate: function (e) { showPlate: function (e) {
this.keyboard = this.keyboard || this.selectComponent('#wux-keyboard') this.keyboard = this.keyboard || this.selectComponent('#wux-keyboard')
this.keyboard.show(this.data.form.plateNumber, 0) this.keyboard.show(this.data.form.plateNumber, 0)
@ -55,6 +58,19 @@ Page({
paddingOrder: function(){ paddingOrder: function(){
this.setData({ ['form.checking']: !this.data.form.checking }) this.setData({ ['form.checking']: !this.data.form.checking })
}, },
paymentOrder: function(){
const that = this
wx.navigateTo({
url: `/pages/process/payment/index?order=${encodeURIComponent(JSON.stringify(this.data.form))}`,
events: {
onOrderChange: (data) => {
if (data.what == 12) {
that.fetchOrderInfo(that.data.form.id)
}
}
}
})
},
repeatOrder: function(e){ repeatOrder: function(e){
Dialog.confirm({ title: '温馨提示', message: '确定重新过皮重?' }).then(() => { Dialog.confirm({ title: '温馨提示', message: '确定重新过皮重?' }).then(() => {
wx.showLoading({ title: '正在获取', mask: true }) wx.showLoading({ title: '正在获取', mask: true })

9
pages/process/order-info/index.wxml

@ -141,11 +141,12 @@
</van-cell> </van-cell>
</view> </view>
<view style="height:{{16 + safeBottom}}rpx;"></view> <view style="height:{{16 + safeBottom}}rpx;"></view>
<view style="height:120rpx;" wx:if="{{form && form.status == 3}}"></view>
<view style="height:120rpx;" wx:if="{{form && (form.status == 3 || form.status == 4)}}"></view>
<view class="cu-bar bg-white foot" style="height:{{120 + safeBottom}}rpx;padding:0rpx 32rpx {{safeBottom}}rpx 32rpx;" <view class="cu-bar bg-white foot" style="height:{{120 + safeBottom}}rpx;padding:0rpx 32rpx {{safeBottom}}rpx 32rpx;"
wx:if="{{form && form.status == 3}}">
<van-button plain type="default" custom-style="height:88rpx;width:254rpx" bind:click="repeatOrder">重新过皮重</van-button>
<van-button type="info" custom-style="margin-left:32rpx;height:88rpx;width:400rpx" bind:click="checkOrder">通过审核</van-button>
wx:if="{{form && (form.status == 3 || form.status == 4)}}">
<van-button plain type="default" custom-style="height:88rpx;width:254rpx" bind:click="repeatOrder" wx:if="{{form.status == 3}}">重新过皮重</van-button>
<van-button type="info" custom-style="margin-left:32rpx;height:88rpx;width:400rpx" bind:click="checkOrder" wx:if="{{form.status == 3}}">通过审核</van-button>
<van-button type="info" custom-style="height:88rpx;width:686rpx" bind:click="paymentOrder" wx:if="{{form.status == 4}}">进行支付</van-button>
</view> </view>
<van-dialog id="van-dialog" /> <van-dialog id="van-dialog" />

18
pages/process/order-list/index.js

@ -9,6 +9,16 @@ Page({
// * 页面的初始数据 // * 页面的初始数据
data: { data: {
height: app.globalData.fragmentHeight, height: app.globalData.fragmentHeight,
tabIndex: 0,
tabList: [
{id: 0, name: '全部', badge: 0, status: '' },
{id: 1, name: '待定价', badge: 0, status: 1 },
{id: 2, name: '待过皮重', badge: 0, status: 2 },
{id: 3, name: '过磅审核', badge: 0, status: 3 },
{id: 4, name: '待付款', badge: 0, status: 4 },
{id: 5, name: '已完成', badge: 0, status: 5 },
// {id: 6, name: '已取消', badge: 0, status: 6 }
],
loading: true, loading: true,
requesting: false, requesting: false,
finished: false, finished: false,
@ -49,6 +59,14 @@ Page({
this.onRefreshList() this.onRefreshList()
} }
}, },
onTabChange: function ({detail}) {
if (this.data.tabIndex == Number(detail.index)) {
return
}
this.setData({ tabIndex: detail.index})
this.data.form.status = this.data.tabList[detail.index].status
this.onRefreshList()
},
onRefreshList: function () { onRefreshList: function () {
this.setData({ this.setData({
orderList: [], orderList: [],

2
pages/process/order-list/index.json

@ -4,6 +4,8 @@
"van-button": "/components/button/index", "van-button": "/components/button/index",
"van-index-bar": "/components/index-bar/index", "van-index-bar": "/components/index-bar/index",
"van-index-anchor": "/components/index-anchor/index", "van-index-anchor": "/components/index-anchor/index",
"van-tabs": "/components/tabs/index",
"van-tab": "/components/tab/index",
"van-cell": "/components/cell/index", "van-cell": "/components/cell/index",
"van-divider": "/components/divider/index", "van-divider": "/components/divider/index",
"van-loading": "/components/loading/index", "van-loading": "/components/loading/index",

8
pages/process/order-list/index.wxml

@ -3,7 +3,13 @@
<view slot="content">{{title}}</view> <view slot="content">{{title}}</view>
</cu-custom> </cu-custom>
<refresh-view bind:refresh="onRefreshList" height="{{height}}" triggered="{{requesting}}" scrollTop="{{top}}" bind:scrolltolower="fetchOrderList">
<view class="bg-white" style="height:90rpx;" wx:if="{{tabList.length}}">
<van-tabs sticky active="{{tabIndex}}" color="#008AFF" bind:change="onTabChange" line-height="2px" swipe-threshold="4">
<van-tab wx:for="{{tabList}}" wx:key="index" title="{{item.name}}" title-style="color:{{tabIndex==index?'#008AFF':'#333333'}}"></van-tab>
</van-tabs>
</view>
<refresh-view bind:refresh="onRefreshList" height="{{height - 90}}" triggered="{{requesting}}" scrollTop="{{top}}" bind:scrolltolower="fetchOrderList">
<view class="list-empty" style="height:{{height}}rpx" wx:if="{{!orderList.length}}"> <view class="list-empty" style="height:{{height}}rpx" wx:if="{{!orderList.length}}">
<view style="margin-bottom:24px" wx:if="{{loading}}"> <view style="margin-bottom:24px" wx:if="{{loading}}">
<van-loading type="spinner" size="32" /> <van-loading type="spinner" size="32" />

22
pages/process/payment-list/index.js

@ -1,6 +1,5 @@
// pages/process/order-list/index.js // pages/process/order-list/index.js
import { getPeymentList } from "../../../api/saas" import { getPeymentList } from "../../../api/saas"
const event = require('../../../utils/event')
const util = require('../../../utils/util') const util = require('../../../utils/util')
const app = getApp() const app = getApp()
@ -24,15 +23,9 @@ Page({
}, },
// * 生命周期函数--监听页面加载 // * 生命周期函数--监听页面加载
onLoad: function (options) { onLoad: function (options) {
event.on('OrderMessage', this, this.onEvent)
this.setData({ height: app.globalData.fragmentHeight }) this.setData({ height: app.globalData.fragmentHeight })
this.fetchOrderList() this.fetchOrderList()
}, },
onEvent: function(message){
if (message.what == 12) {
this.onRefreshList(this.data.form.isSameCustomer)
}
},
checkSame: function(){ checkSame: function(){
this.onRefreshList(this.data.form.isSameCustomer ? 0 : 1) this.onRefreshList(this.data.form.isSameCustomer ? 0 : 1)
}, },
@ -113,10 +106,17 @@ Page({
}, },
lookItem: function (e) { lookItem: function (e) {
var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index] var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index]
wx.navigateTo({ url: '/pages/process/payment/index?mobile=' + item.factoryCustomerMobile })
},
onUnload: function(){
event.remove('OrderMessage', this)
const that = this
wx.navigateTo({
url: `/pages/process/payment/index?order=${encodeURIComponent(JSON.stringify(item))}`,
events: {
onOrderChange: (data) => {
if (data.what == 12) {
that.onRefreshList(that.data.form.isSameCustomer)
}
}
}
})
} }
}) })

51
pages/process/payment/index.js

@ -32,32 +32,37 @@ Page({
onLoad: function (options) { onLoad: function (options) {
if(options.mobile){ if(options.mobile){
this.data.form.mobile = options.mobile this.data.form.mobile = options.mobile
wx.showLoading({ title: '正在获取', mask: true })
getPeymentList(this.data.form).then(result => {
wx.hideLoading()
this.amountList(result.data.records)
}).catch(err => {
wx.hideLoading()
this.setData({ safeBottom: app.globalData.safeBottom })
util.showToast(err)
})
} else if(options.order){
var list = [JSON.parse(decodeURIComponent(options.order))]
this.amountList(list)
} }
wx.showLoading({ title: '正在获取', mask: true })
getPeymentList(this.data.form).then(result => {
wx.hideLoading()
var amount = 0
this.data.params.ids = []
if (result.data && result.data.records.length) {
for (let index = 0; index < result.data.records.length; index++) {
const element = result.data.records[index]
amount = math.plus(amount, element.settlePrice)
this.data.params.ids.push(element.id)
if(index == 0 && Number(element.settleType) == 2 && !util.isEmpty(element.bankCardNo)){
this.data.params.settleType = '2'
this.data.params.bankCardNo = element.bankCardNo
}
},
amountList: function(orderList){
var amount = 0
this.data.params.ids = []
if (orderList && orderList.length) {
for (let index = 0; index < orderList.length; index++) {
const element = orderList[index]
amount = math.plus(amount, element.settlePrice)
this.data.params.ids.push(element.id)
if(index == 0 && Number(element.settleType) == 2 && !util.isEmpty(element.bankCardNo)){
this.data.params.settleType = '2'
this.data.params.bankCardNo = element.bankCardNo
} }
this.setData({ safeBottom: app.globalData.safeBottom, orderList: result.data.records, amount, params: this.data.params })
} else {
this.setData({ safeBottom: app.globalData.safeBottom })
} }
}).catch(err => {
wx.hideLoading()
this.setData({ safeBottom: app.globalData.safeBottom, orderList, amount, params: this.data.params })
} else {
this.setData({ safeBottom: app.globalData.safeBottom }) this.setData({ safeBottom: app.globalData.safeBottom })
util.showToast(err)
console.log(err)
})
}
}, },
onTypeChange: function({detail}){ onTypeChange: function({detail}){
this.setData({ ['params.settleType']: detail }) this.setData({ ['params.settleType']: detail })
@ -100,6 +105,8 @@ Page({
paymentOrder(this.data.params).then(result => { paymentOrder(this.data.params).then(result => {
wx.hideLoading() wx.hideLoading()
util.showBackToast('订单已经付款') util.showBackToast('订单已经付款')
const channel = this.getOpenerEventChannel()
channel.emit('onOrderChange', { what: 12, desc: 'PaymentOrder' })
event.emit('OrderMessage', { what: 12, desc: 'PaymentOrder' }) event.emit('OrderMessage', { what: 12, desc: 'PaymentOrder' })
}).catch(err => { }).catch(err => {
wx.hideLoading() wx.hideLoading()

2
pages/process/payment/index.wxml

@ -53,7 +53,7 @@
<van-checkbox value="{{ !item.checked }}" custom-class="checkbox" icon-size="36rpx" shape="square"></van-checkbox> <van-checkbox value="{{ !item.checked }}" custom-class="checkbox" icon-size="36rpx" shape="square"></van-checkbox>
<view style="flex:1;margin-left:16rpx"> <view style="flex:1;margin-left:16rpx">
<view class="flex flex-justify"> <view class="flex flex-justify">
<view class="text-black text-lg">{{item.factoryCustomerName}} {{item.factoryCustomerMobile}}</view>
<view class="text-black text-lg">{{item.factoryCustomerName}} {{item.factoryCustomerMobile || ''}}</view>
<view class="text-sm text-gray">{{item.bangTime}}</view> <view class="text-sm text-gray">{{item.bangTime}}</view>
</view> </view>
<view class="text-sm text-gray" style="line-height:54rpx"> <view class="text-sm text-gray" style="line-height:54rpx">

Loading…
Cancel
Save