diff --git a/app.json b/app.json index 82b07e4..806975f 100644 --- a/app.json +++ b/app.json @@ -13,6 +13,7 @@ "pages/process/check-list/index", "pages/process/order-list/index", "pages/process/order-price/index", + "pages/process/order-check/index", "pages/process/order-info/index", "pages/process/payment-list/index", "pages/process/payment/index", diff --git a/pages/agent/index/index.wxml b/pages/agent/index/index.wxml index 466bf25..6c68814 100644 --- a/pages/agent/index/index.wxml +++ b/pages/agent/index/index.wxml @@ -49,7 +49,7 @@ - 未提现余额 + 账户余额 {{banlanceInfo.accountMoney}} diff --git a/pages/process/check-list/index.js b/pages/process/check-list/index.js index f99562a..2cf0ef8 100644 --- a/pages/process/check-list/index.js +++ b/pages/process/check-list/index.js @@ -99,24 +99,7 @@ Scene({ let nowList = `orderList[${this.data.orderList.length}]` var num = this.data.form.pageNum var finished = ((num - 1) * this.data.form.pageSize + respList.length) >= result.data.total - if(this.data.form.pageNum == 1){ - this.setData({ - [nowList]: respList, - ['form.pageNum']: (num + 1), - top: 0, - finished, - requesting: false, - loading: false - }) - } else { - this.setData({ - [nowList]: respList, - ['form.pageNum']: (num + 1), - finished, - requesting: false, - loading: false - }) - } + this.setData({ [nowList]: respList, ['form.pageNum']: (num + 1), finished, requesting: false, loading: false }) } else { this.setData({ finished: true, requesting: false, loading: false }) } diff --git a/pages/process/order-check/index.js b/pages/process/order-check/index.js new file mode 100644 index 0000000..7fb383e --- /dev/null +++ b/pages/process/order-check/index.js @@ -0,0 +1,175 @@ +// pages/process/order-check/index.js +import Scene from '../../index/scene' +import { checkingOrder, getFactoryOrderInfo, getPaperList} from "../../../api/saas" +const event = require('../../../utils/event') +const util = require('../../../utils/util') +const math = require('../../../utils/math') +const app = getApp() + +Scene({ + /** + * 页面的初始数据 + */ + data: { + safeBottom: app.globalData.safeBottom, + paperList: null, + form: null, + columns: [], + focus: 0, + visible: false, + amout: 0, + nowItem: null + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + if(options.id){ + wx.showLoading({ title: '正在获取', mask: true }) + getPaperList({pageNum: 1, pageSize: 100}).then(result => { + this.data.paperList = result.data.records + this.data.columns = [] + for (let index = 0; index < this.data.paperList.length; index++) { + this.data.columns.push(this.data.paperList[index].name) + } + this.setData({ safeBottom: app.globalData.safeBottom, columns: this.data.columns }) + }).catch(err => { + this.setData({ safeBottom: app.globalData.safeBottom }) + util.showToast(err) + }) + getFactoryOrderInfo(options.id).then(result => { + wx.hideLoading() + result.data.sign = 1 + if(Number(result.data.deductPercent) <= 0){ + result.data.deductPercent = null + } + this.data.amout = math.times(result.data.settleWeight, result.data.unitPrice) + this.setData({ form: result.data, amout: this.data.amout }) + }).catch(err => { + wx.hideLoading() + util.showToast(err) + }) + } + }, + showPlate: function (e) { + this.keyboard = this.keyboard || this.selectComponent('#wux-keyboard') + this.keyboard.show(this.data.form.plateNumber, 0) + }, + onPlatenumber: function({detail}){ + if(detail && detail.plateNumber){ + this.setData({ ['form.plateNumber']: detail.plateNumber }) + } + }, + showCategory: function(){ + this.setData({ visible: true }) + }, + onConfirm: function({detail}){ + this.data.nowItem = this.data.paperList[detail.index] + this.data.form.productId = this.data.nowItem.id + this.data.form.unitPrice = this.data.nowItem.defaultUnitPrice + this.data.form.productName = detail.value + this.statAmount() + }, + onHide: function(){ + this.setData({ visible: false }) + }, + changeDeductType: function(e){ + this.setData({ ['form.sign']: e.currentTarget.dataset.type, focus: e.currentTarget.dataset.type }) + }, + bindInput: function (e) { + this.data.form[e.target.id] = e.detail.value + if(e.target.id == 'deductPercent'){ + if(util.isEmpty(e.detail.value) || Number(e.detail.value) <= 0){ + this.data.form.deductWeight = null + this.data.form.deductPercent = null + } else { + this.data.form.deductWeight = math.divide(math.times(this.data.form.totalWeight, Number(e.detail.value)), 100).toFixed(2) + // this.setData({ ['form.deductWeight']: math.divide(math.times(this.data.form.totalWeight, Number(e.detail.value)), 100).toFixed(3) }) + } + } else if(e.target.id == 'deductWeight'){ + if(util.isEmpty(e.detail.value) || Number(e.detail.value) <= 0){ + this.data.form.deductWeight = null + this.data.form.deductPercent = null + } else { + this.data.form.deductPercent = math.times(math.divide(Number(e.detail.value), this.data.form.totalWeight), 100).toFixed(2) + // this.setData({ ['form.deductPercent']: math.times(math.divide(Number(e.detail.value), this.data.form.totalWeight), 100).toFixed(2) }) + } + } + this.statAmount() + }, + onChange: function(e) { + this.data.form.inspectionRemark = e.detail + }, + statAmount: function(){ + this.data.form.settleWeight = this.data.form.netWeight + if(!util.isEmpty(this.data.form.deductWeight)){ + this.data.form.settleWeight = math.minus(this.data.form.netWeight, this.data.form.deductWeight) + } + if(!util.isEmpty(this.data.form.unitPrice) && Number(this.data.form.unitPrice) > 0){ + this.data.amout = math.times(this.data.form.settleWeight, this.data.form.unitPrice) + } else { + this.data.amout = null + } + this.setData({ visible: false, form: this.data.form, amout: this.data.amout }) + }, + checkOrder: function(){ + if(util.isEmpty(this.data.form.productId) || Number(this.data.form.productId) <= 0){ + util.showToast('请选择废纸品类') + return + } + if(util.isEmpty(this.data.form.unitPrice) || Number(this.data.form.unitPrice) <= 0){ + util.showToast('请输入单价') + return + } + if(this.data.nowItem){ + if(this.data.nowItem.highestUnitPrice && Number(this.data.form.unitPrice) > Number(this.data.nowItem.highestUnitPrice)){ + util.showToast('输入单价过高,价格范围:' + this.data.nowItem.lowestUnitPrice + '元/公斤-'+ this.data.nowItem.highestUnitPrice + '元/公斤') + return + } + if(this.data.nowItem.lowestUnitPrice && Number(this.data.form.unitPrice) < Number(this.data.nowItem.lowestUnitPrice)){ + util.showToast('输入单价过低,价格范围:' + this.data.nowItem.lowestUnitPrice + '元/公斤-'+ this.data.nowItem.highestUnitPrice + '元/公斤') + return + } + } + if(!util.isEmpty(this.data.form.deductWeight) && Number(this.data.form.deductWeight) >= Number(this.data.form.totalWeight)){ + util.showToast('扣重不得超过皮重') + return + } + if(!util.isEmpty(this.data.form.deductPercent) && Number(this.data.form.deductPecent) >= 100){ + util.showToast('扣点范围:0-100') + return + } + wx.showLoading({ title: '处理中', mask: true }) + var data = {id: this.data.form.id} + if(Number(this.data.form.deductWeight) > 0){ + data.deductWeight = Number(this.data.form.deductWeight) + } + if(Number(this.data.form.deductPercent) > 0){ + data.deductPercent = Number(this.data.form.deductPercent) + } + data.plateNumber = this.data.form.plateNumber + data.productId = this.data.form.productId + data.sign = this.data.form.sign + data.unitPrice = Number(this.data.form.unitPrice) + checkingOrder(data).then(result => { + wx.hideLoading() + event.emit('OrderMessage', { what: 12, desc: 'checkingOrder' }) + util.showBackToast('订单审核已通过') + }).catch(err => { + wx.hideLoading() + util.showToast(err) + }) + }, + viewImage: function (e) { + var imgList = [] + for (let index = 0; index < this.data.form.totalWeighingPicture.length; index++) { + var url = this.data.form.totalWeighingPicture[index].url + if(!util.isEmpty(url) && 'error' != url){ + imgList.push(url) + } + } + if(imgList.length){ + wx.previewImage({ urls: imgList, current: e.currentTarget.dataset.url }) + } + } +}) \ No newline at end of file diff --git a/pages/process/order-check/index.json b/pages/process/order-check/index.json new file mode 100644 index 0000000..a394fc8 --- /dev/null +++ b/pages/process/order-check/index.json @@ -0,0 +1,14 @@ +{ + "usingComponents": { + "van-index-anchor": "/components/index-anchor/index", + "van-cell": "/components/cell/index", + "van-button": "/components/button/index", + "van-checkbox": "/components/checkbox/index", + "van-loading": "/components/loading/index", + "van-image": "/components/image/index", + "van-picker": "/components/picker/index", + "van-popup": "/components/popup/index", + "vehicle-keyboard": "/components/vehicle-keyboard/index", + "notification": "/pages/message/notification/index" + } +} \ No newline at end of file diff --git a/pages/process/order-check/index.wxml b/pages/process/order-check/index.wxml new file mode 100644 index 0000000..c535e25 --- /dev/null +++ b/pages/process/order-check/index.wxml @@ -0,0 +1,94 @@ + + + 重新定价 + + + + + + + 客户姓名 + {{form.factoryCustomerName}} + + + + + 车牌号码 + {{form.plateNumber || '请输入车牌号码'}} + + + + + 毛重(公斤) + {{form.totalWeight}} + + + + + 皮重(公斤) + {{form.emptyWeight || '- -'}} + + + + + + + * + 废纸品类 + + {{form.productName || '请选择废纸品类'}} + + + + + + * + 单价(元/公斤) + + + + + + + + + 扣重(公斤) + + + + + + + + + 扣点(%) + + + + + + + 结算重量(公斤) + {{form.settleWeight || '- -'}} + + + + + + + 金额: + {{amout}} + + 通过审核 + + + + + + + \ No newline at end of file diff --git a/pages/process/order-check/index.wxss b/pages/process/order-check/index.wxss new file mode 100644 index 0000000..5a0d819 --- /dev/null +++ b/pages/process/order-check/index.wxss @@ -0,0 +1,8 @@ +/* pages/process/order-check/index.wxss */ +.page-icon { + margin-right: 24rpx; +} + +.big-icon{ + margin-top: 24rpx; +} \ No newline at end of file diff --git a/pages/process/order-info/index.js b/pages/process/order-info/index.js index dd4a9cb..395ac08 100644 --- a/pages/process/order-info/index.js +++ b/pages/process/order-info/index.js @@ -1,7 +1,7 @@ // pages/process/order-check/index.js import Scene from '../../index/scene' import Dialog from '../../../components/dialog/dialog' -import { repeatOrder, repeatPrice, getFactoryOrderInfo, checkingOrder, printOrder} from "../../../api/saas" +import { repeatOrder, getFactoryOrderInfo, checkingOrder, printOrder} from "../../../api/saas" const event = require('../../../utils/event') const util = require('../../../utils/util') const app = getApp() @@ -26,6 +26,12 @@ Scene({ if(options.id){ this.fetchOrderInfo(options.id) } + event.on('OrderMessage', this, this.onEvent) + }, + onEvent: function(message){ + if (message.what == 12) { + wx.navigateBack() + } }, fetchOrderInfo(id){ wx.showLoading({ title: '正在获取', mask: true }) @@ -102,15 +108,7 @@ Scene({ }) }, priceOrder: function(e){ - wx.showLoading({ title: '正在处理', mask: true }) - repeatPrice(this.data.form.id).then(result => { - wx.hideLoading() - util.showBackToast('订单已处理') - event.emit('OrderMessage', { what: 12, desc: 'checkingOrder' }) - }).catch(err => { - wx.hideLoading() - util.showToast(err) - }) + wx.navigateTo({ url: `/pages/process/order-check/index?id=${this.data.form.id}` }) }, checkOrder: function(e){ wx.showLoading({ title: '正在处理', mask: true }) @@ -135,5 +133,8 @@ Scene({ } } wx.previewImage({ urls: imgList, current: e.currentTarget.dataset.url }) + }, + onUnload: function(){ + event.remove('OrderMessage', this) } }) \ No newline at end of file diff --git a/pages/process/order-info/index.json b/pages/process/order-info/index.json index 5698066..20f0605 100644 --- a/pages/process/order-info/index.json +++ b/pages/process/order-info/index.json @@ -8,6 +8,7 @@ "van-dialog": "/components/dialog/index", "van-popup": "/components/popup/index", "van-picker": "/components/picker/index", + "vehicle-keyboard": "/components/vehicle-keyboard/index", "notification": "/pages/message/notification/index" } } \ No newline at end of file diff --git a/pages/process/order-info/index.wxml b/pages/process/order-info/index.wxml index 9decbcf..1c0202a 100644 --- a/pages/process/order-info/index.wxml +++ b/pages/process/order-info/index.wxml @@ -9,9 +9,12 @@ 待过皮重 - - - 待过磅审核 + + + + 待过磅审核 + + 重新定价 @@ -157,9 +160,8 @@ - 重新过皮重 - 重新定价 - 通过审核 + 重新过皮重 + 通过审核 进行支付 客户结算 @@ -170,5 +172,9 @@ + + + + \ No newline at end of file