From 1cd4a7b9034e1c32b0d62aa26c5de39ac1bceed4 Mon Sep 17 00:00:00 2001
From: xpz2018 <107107461@qq.com>
Date: Fri, 5 Mar 2021 15:18:01 +0800
Subject: [PATCH] no message
---
pages/process/check-list/index.js | 7 +---
pages/process/order-info/index.js | 44 +++++++++++++++++--------
pages/process/order-info/index.wxml | 9 ++---
pages/process/order-list/index.js | 18 ++++++++++
pages/process/order-list/index.json | 2 ++
pages/process/order-list/index.wxml | 8 ++++-
pages/process/payment-list/index.js | 22 ++++++-------
pages/process/payment/index.js | 51 ++++++++++++++++-------------
pages/process/payment/index.wxml | 2 +-
9 files changed, 104 insertions(+), 59 deletions(-)
diff --git a/pages/process/check-list/index.js b/pages/process/check-list/index.js
index 4e23a33..39da943 100644
--- a/pages/process/check-list/index.js
+++ b/pages/process/check-list/index.js
@@ -50,12 +50,7 @@ Page({
}
},
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.fetchOrderList()
},
diff --git a/pages/process/order-info/index.js b/pages/process/order-info/index.js
index 917cce7..69c7b1f 100644
--- a/pages/process/order-info/index.js
+++ b/pages/process/order-info/index.js
@@ -20,22 +20,25 @@ Page({
*/
onLoad: function (options) {
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) {
this.keyboard = this.keyboard || this.selectComponent('#wux-keyboard')
this.keyboard.show(this.data.form.plateNumber, 0)
@@ -55,6 +58,19 @@ Page({
paddingOrder: function(){
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){
Dialog.confirm({ title: '温馨提示', message: '确定重新过皮重?' }).then(() => {
wx.showLoading({ title: '正在获取', mask: true })
diff --git a/pages/process/order-info/index.wxml b/pages/process/order-info/index.wxml
index 48d946a..3347bd1 100644
--- a/pages/process/order-info/index.wxml
+++ b/pages/process/order-info/index.wxml
@@ -141,11 +141,12 @@
-
+
\ No newline at end of file
diff --git a/pages/process/order-list/index.js b/pages/process/order-list/index.js
index 4e23a33..dd67fc6 100644
--- a/pages/process/order-list/index.js
+++ b/pages/process/order-list/index.js
@@ -9,6 +9,16 @@ Page({
// * 页面的初始数据
data: {
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,
requesting: false,
finished: false,
@@ -49,6 +59,14 @@ Page({
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 () {
this.setData({
orderList: [],
diff --git a/pages/process/order-list/index.json b/pages/process/order-list/index.json
index 83b51ac..c111c1c 100644
--- a/pages/process/order-list/index.json
+++ b/pages/process/order-list/index.json
@@ -4,6 +4,8 @@
"van-button": "/components/button/index",
"van-index-bar": "/components/index-bar/index",
"van-index-anchor": "/components/index-anchor/index",
+ "van-tabs": "/components/tabs/index",
+ "van-tab": "/components/tab/index",
"van-cell": "/components/cell/index",
"van-divider": "/components/divider/index",
"van-loading": "/components/loading/index",
diff --git a/pages/process/order-list/index.wxml b/pages/process/order-list/index.wxml
index 818942c..c4c815b 100644
--- a/pages/process/order-list/index.wxml
+++ b/pages/process/order-list/index.wxml
@@ -3,7 +3,13 @@
{{title}}
-
+
+
+
+
+
+
+
diff --git a/pages/process/payment-list/index.js b/pages/process/payment-list/index.js
index 6cbdc8a..a59cab3 100644
--- a/pages/process/payment-list/index.js
+++ b/pages/process/payment-list/index.js
@@ -1,6 +1,5 @@
// pages/process/order-list/index.js
import { getPeymentList } from "../../../api/saas"
-const event = require('../../../utils/event')
const util = require('../../../utils/util')
const app = getApp()
@@ -24,15 +23,9 @@ Page({
},
// * 生命周期函数--监听页面加载
onLoad: function (options) {
- event.on('OrderMessage', this, this.onEvent)
this.setData({ height: app.globalData.fragmentHeight })
this.fetchOrderList()
},
- onEvent: function(message){
- if (message.what == 12) {
- this.onRefreshList(this.data.form.isSameCustomer)
- }
- },
checkSame: function(){
this.onRefreshList(this.data.form.isSameCustomer ? 0 : 1)
},
@@ -113,10 +106,17 @@ Page({
},
lookItem: function (e) {
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)
+ }
+ }
+ }
+ })
}
})
\ No newline at end of file
diff --git a/pages/process/payment/index.js b/pages/process/payment/index.js
index 23cc3d2..f2704d0 100644
--- a/pages/process/payment/index.js
+++ b/pages/process/payment/index.js
@@ -32,32 +32,37 @@ Page({
onLoad: function (options) {
if(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 })
- util.showToast(err)
- console.log(err)
- })
+ }
},
onTypeChange: function({detail}){
this.setData({ ['params.settleType']: detail })
@@ -100,6 +105,8 @@ Page({
paymentOrder(this.data.params).then(result => {
wx.hideLoading()
util.showBackToast('订单已经付款')
+ const channel = this.getOpenerEventChannel()
+ channel.emit('onOrderChange', { what: 12, desc: 'PaymentOrder' })
event.emit('OrderMessage', { what: 12, desc: 'PaymentOrder' })
}).catch(err => {
wx.hideLoading()
diff --git a/pages/process/payment/index.wxml b/pages/process/payment/index.wxml
index 65e31c6..53aae47 100644
--- a/pages/process/payment/index.wxml
+++ b/pages/process/payment/index.wxml
@@ -53,7 +53,7 @@
- {{item.factoryCustomerName}} {{item.factoryCustomerMobile}}
+ {{item.factoryCustomerName}} {{item.factoryCustomerMobile || ''}}
{{item.bangTime}}