From 818b1712115f8a8cc3c2462bc50b18ac39a95dcb Mon Sep 17 00:00:00 2001 From: xpz2018 <107107461@qq.com> Date: Fri, 14 May 2021 15:31:25 +0800 Subject: [PATCH] no message --- api/saas.js | 13 +- pages/home/index/index.js | 1 - pages/process/outside-add/index.js | 67 ++++--- pages/process/outside-add/index.wxml | 21 +- pages/process/outside-check/index.js | 13 +- pages/process/outside-info/index.js | 66 +------ pages/process/outside-info/index.json | 3 - pages/process/outside-info/index.wxml | 256 ++++++++++++------------- pages/process/outside-item/index.js | 103 ++++++++++ pages/process/outside-item/index.json | 8 + pages/process/outside-item/index.wxml | 100 ++++++++++ pages/process/outside-item/index.wxss | 23 +++ pages/process/outside-list/index.js | 30 ++- pages/process/outside-list/index.wxml | 68 ++----- pages/process/outside-price/index.js | 130 +++++++++---- pages/process/outside-price/index.json | 1 + pages/process/outside-price/index.wxml | 186 +++++------------- 17 files changed, 605 insertions(+), 484 deletions(-) create mode 100644 pages/process/outside-item/index.js create mode 100644 pages/process/outside-item/index.json create mode 100644 pages/process/outside-item/index.wxml create mode 100644 pages/process/outside-item/index.wxss diff --git a/api/saas.js b/api/saas.js index 916d7d2..e0a01f1 100644 --- a/api/saas.js +++ b/api/saas.js @@ -66,8 +66,13 @@ const bindBankCard = (params) => mPost(`/ztb-factory/factory/binding/bank-card`, const getBankCardList = () => mGet(`/ztb-factory/get/factory-bank-card-list`, null, sconfig) const deleteBankcard = (params) => mPost(`/ztb-factory/delete/factory-bank-card`, params, sconfig) +const getSideOrderList = (params) => mGet(`/ztb-factory/get/scrap-paper-offsite-receipt-order-list`, params, sconfig) const createSideOrder = (params) => mPost(`/ztb-factory/create/scrap-paper-offsite-receipt-order`, params, sconfig) -const getSideOrderInfo = (params) => mPost(`/ztb-factory/get/scrap-paper-offsite-receipt-order-detail`, params, sconfig) +const getSideOrderInfo = (params) => mGet(`/ztb-factory/get/scrap-paper-offsite-receipt-order-detail`, params, sconfig) +const editSideOrder = (params) => mPost(`/ztb-factory/modify/scrap-paper-offsite-receipt-order`, params, sconfig) +const poundSideOrder = (params) => mPost(`/ztb-factory/submit/scrap-paper-offsite-receipt-weight-note`, params, sconfig) +const priceSideOrder = (params) => mPost(`/ztb-factory/submit/scrap-paper-offsite-receipt-order-price`, params, sconfig) + export { sconfig, @@ -127,5 +132,9 @@ export { getBankCardList, deleteBankcard, createSideOrder, - getSideOrderInfo + getSideOrderInfo, + editSideOrder, + getSideOrderList, + poundSideOrder, + priceSideOrder } \ No newline at end of file diff --git a/pages/home/index/index.js b/pages/home/index/index.js index c6fa0af..e667d98 100644 --- a/pages/home/index/index.js +++ b/pages/home/index/index.js @@ -61,7 +61,6 @@ Component({ userInfo: app.userInfo, userName: nickname, isAdmin: app.userInfo.type && app.userInfo.type.indexOf('ADMIN') >= 0, - }) }, toUserInfo: function(){ diff --git a/pages/process/outside-add/index.js b/pages/process/outside-add/index.js index 157b8b0..39fbde5 100644 --- a/pages/process/outside-add/index.js +++ b/pages/process/outside-add/index.js @@ -1,7 +1,7 @@ // pages/process/order-check/index.js import Scene from '../../index/scene' import Dialog from '../../../components/dialog/dialog' -import { createSideOrder, getSideOrderInfo, getPaperList} from "../../../api/saas" +import { createSideOrder, getSideOrderInfo, editSideOrder, getPaperList, cancelOrder} from "../../../api/saas" const event = require('../../../utils/event') const util = require('../../../utils/util') const app = getApp() @@ -14,7 +14,7 @@ Scene({ safeBottom: app.globalData.safeBottom, paperList: null, form: { - productCategoryInfo: [{ id: '', productName: '', price: ''}], + productCategoryInfos: [{ productId: '', productCategoryName: '', unitPrice: ''}], predictDeliveryToFactoryTime: null }, columns: [], @@ -118,35 +118,35 @@ Scene({ this.setData({ visible: false, ['form.predictDeliveryToFactoryTime']: (detail.value[0] + ' ' + detail.value[1]) }) } else { var nowItem = this.data.paperList[detail.index] - for (var i = 0; i < this.data.form.productCategoryInfo.length; i++) { - if (this.data.form.productCategoryInfo[i].productId == nowItem.id){ + for (var i = 0; i < this.data.form.productCategoryInfos.length; i++) { + if (this.data.form.productCategoryInfos[i].productId == nowItem.id){ this.setData({ visible: false }) util.showToast('纸品已经存在,请不要重复添加') return } } - var product = {id: nowItem.id, productName: detail.value, price: nowItem.defaultUnitPrice} + var product = {productId: nowItem.id, productCategoryName: detail.value, unitPrice: nowItem.defaultUnitPrice} product.highestUnitPrice = nowItem.highestUnitPrice product.lowestUnitPrice = nowItem.lowestUnitPrice - this.setData({ visible: false, ['form.productCategoryInfo[' + this.data.cateIndex + ']']: product }) + this.setData({ visible: false, ['form.productCategoryInfos[' + this.data.cateIndex + ']']: product }) } }, onHide: function(){ this.setData({ visible: false }) }, bindInput: function (e) { - this.data.form.productCategoryInfo[e.currentTarget.dataset.index].price = e.detail.value + this.data.form.productCategoryInfos[e.currentTarget.dataset.index].unitPrice = e.detail.value }, onChange: function({detail}) { this.data.form.equipmentRemark = detail }, addCate: function(e){ - this.data.form.productCategoryInfo.push({ id: '', productName: '', price: ''}) - this.setData({ ['form.productCategoryInfo']: this.data.form.productCategoryInfo }) + this.data.form.productCategoryInfos.push({ productId: '', productCategoryName: '', unitPrice: ''}) + this.setData({ ['form.productCategoryInfos']: this.data.form.productCategoryInfos }) }, deleteCate: function(e){ - this.data.form.productCategoryInfo.splice(e.currentTarget.dataset.index, 1) - this.setData({ ['form.productCategoryInfo']: this.data.form.productCategoryInfo }) + this.data.form.productCategoryInfos.splice(e.currentTarget.dataset.index, 1) + this.setData({ ['form.productCategoryInfos']: this.data.form.productCategoryInfos }) }, findCateById: function(productId){ for (let index = 0; index < this.data.paperList.length; index++) { @@ -160,7 +160,7 @@ Scene({ cancelOrder: function(e){ Dialog.confirm({ title: '温馨提示', message: '确定取消该订单?' }).then(() => { wx.showLoading({ title: '处理中', mask: true }) - cancelOrder(this.data.form.id).then(result => { + cancelOrder(this.data.form.scrapPaperReceiptId).then(result => { wx.hideLoading() util.showBackToast('订单已经删除') event.emit('OrderMessage', { what: 12, desc: 'cancelOrder' }) @@ -183,36 +183,49 @@ Scene({ util.showToast('请选择司机') return } - for (let index = 0; index < this.data.form.productCategoryInfo.length; index++) { - const element = this.data.form.productCategoryInfo[index] - if(util.isEmpty(element.id)){ + for (let index = 0; index < this.data.form.productCategoryInfos.length; index++) { + const element = this.data.form.productCategoryInfos[index] + if(util.isEmpty(element.productId)){ util.showToast('请选择第' + (index + 1) + '项废纸品类') return } - if(!util.isEmpty(this.data.form.id)){ - var cate = this.findCateById(element.id) + if(!util.isEmpty(this.data.form.scrapPaperReceiptId)){ + var cate = this.findCateById(element.productId) if(cate){ element.highestUnitPrice = cate.highestUnitPrice element.lowestUnitPrice = cate.lowestUnitPrice } } - if(element.highestUnitPrice && Number(element.price) > Number(element.highestUnitPrice)){ + if(element.highestUnitPrice && Number(element.unitPrice) > Number(element.highestUnitPrice)){ util.showToast('第' + (index + 1) + '项废纸品类单价过高,价格范围:' + element.lowestUnitPrice + '元/公斤-'+ element.highestUnitPrice + '元/公斤') return } - if(element.lowestUnitPrice && Number(element.price) < Number(element.lowestUnitPrice)){ + if(element.lowestUnitPrice && Number(element.unitPrice) < Number(element.lowestUnitPrice)){ util.showToast('第' + (index + 1) + '项废纸品类单价过低,价格范围:' + element.lowestUnitPrice + '元/公斤-'+ element.highestUnitPrice + '元/公斤') return } } wx.showLoading({ title: '处理中', mask: true }) - createSideOrder(this.data.form).then(result => { - wx.hideLoading() - util.showBackToast('创建订单成功!') - event.emit('OrderMessage', { what: 12, desc: 'createSideOrder' }) - }).catch(err => { - wx.hideLoading() - util.showToast(err) - }) + if(this.data.form.scrapPaperReceiptId){ + editSideOrder(this.data.form).then(result => { + wx.hideLoading() + util.showToast('修改订单成功') + wx.redirectTo({ url: `/pages/process/outside-price/index?id=${this.data.form.scrapPaperReceiptId}` }) + event.emit('OrderMessage', { what: 12, desc: 'createSideOrder' }) + }).catch(err => { + wx.hideLoading() + util.showToast(err) + }) + } else { + createSideOrder(this.data.form).then(result => { + wx.hideLoading() + util.showBackToast('创建订单成功') + event.emit('OrderMessage', { what: 12, desc: 'createSideOrder' }) + }).catch(err => { + wx.hideLoading() + util.showToast(err) + }) + } + } }) \ No newline at end of file diff --git a/pages/process/outside-add/index.wxml b/pages/process/outside-add/index.wxml index d88e3a0..0a3e0ce 100644 --- a/pages/process/outside-add/index.wxml +++ b/pages/process/outside-add/index.wxml @@ -1,6 +1,6 @@ - 新增厂外收货 + {{form.scrapPaperReceiptId ? '修改订单' : '新增厂外收货'}} @@ -34,13 +34,13 @@ - + 品类 {{index + 1}} - + @@ -48,7 +48,7 @@ * 废纸品类 - {{item.productName || '请选择废纸品类'}} + {{item.productCategoryName || '请选择废纸品类'}} @@ -58,7 +58,7 @@ 单价(元/公斤) + placeholder="请输入单价" value="{{item.unitPrice || ''}}" bindinput="bindInput" /> @@ -83,11 +83,12 @@ - - 取消 - 保存 - - 保存 + + 取消 + 保存 + + + 保存 diff --git a/pages/process/outside-check/index.js b/pages/process/outside-check/index.js index 181d668..604e9c1 100644 --- a/pages/process/outside-check/index.js +++ b/pages/process/outside-check/index.js @@ -1,6 +1,6 @@ // pages/process/order-check/index.js import Scene from '../../index/scene' -import { checkingOrder, getFactoryOrderInfo, getPaperList} from "../../../api/saas" +import { checkingOrder, getPaperList, getSideOrderInfo} from "../../../api/saas" const event = require('../../../utils/event') const util = require('../../../utils/util') const math = require('../../../utils/math') @@ -39,7 +39,7 @@ Scene({ this.setData({ safeBottom: app.globalData.safeBottom }) util.showToast(err) }) - getFactoryOrderInfo(options.id).then(result => { + getSideOrderInfo({ id: options.id }).then(result => { wx.hideLoading() result.data.sign = 1 if(Number(result.data.deductPercent) <= 0){ @@ -53,15 +53,6 @@ Scene({ }) } }, - 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 }) }, diff --git a/pages/process/outside-info/index.js b/pages/process/outside-info/index.js index 44ad042..a307856 100644 --- a/pages/process/outside-info/index.js +++ b/pages/process/outside-info/index.js @@ -1,7 +1,6 @@ // pages/process/order-check/index.js import Scene from '../../index/scene' -import Dialog from '../../../components/dialog/dialog' -import { pricingOrder, getFactoryOrderInfo} from "../../../api/saas" +import { pricingOrder, getSideOrderInfo} from "../../../api/saas" const event = require('../../../utils/event') const util = require('../../../utils/util') const app = getApp() @@ -11,18 +10,17 @@ Scene({ * 页面的初始数据 */ data: { - form: { - orderPapers: [{ productId: '', productName: '', unitPrice: ''}], - appointDate: null - } + id: null, + form: null }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { if(options.id){ + this.data.id = options.id wx.showLoading({ title: '正在获取', mask: true }) - getFactoryOrderInfo(options.id).then(result => { + getSideOrderInfo({id: options.id}).then(result => { wx.hideLoading() this.setData({ form: result.data, admin: app.userInfo.type && app.userInfo.type.indexOf('ADMIN') >= 0 }) }).catch(err => { @@ -31,60 +29,10 @@ Scene({ }) } }, - bindInput: function (e) { - this.data.form.orderPapers[e.currentTarget.dataset.index].unitPrice = e.detail.value - }, - cancelOrder: function(e){ - Dialog.confirm({ title: '温馨提示', message: '确定取消该订单?' }).then(() => { - wx.showLoading({ title: '处理中', mask: true }) - cancelOrder(this.data.form.id).then(result => { - wx.hideLoading() - util.showBackToast('订单已经删除') - event.emit('OrderMessage', { what: 12, desc: 'cancelOrder' }) - }).catch(err => { - wx.hideLoading() - util.showToast(err) - }) - }) - }, - fileChange: function({detail}){ - console.log(detail) + checkForm: function(){ + wx.redirectTo({url: `/pages/process/outside-check/index?id=${this.data.id}` }) }, submitForm: function(){ - if(util.isEmpty(this.data.form.factoryCustomerName)){ - util.showToast('请选择客户') - return - } - if(util.isEmpty(this.data.form.plateNumber)){ - util.showToast('请输入车牌号码') - return - } - if(util.isEmpty(this.data.form.driverName)){ - util.showToast('请选择司机') - return - } - for (let index = 0; index < this.data.form.orderPapers.length; index++) { - const element = this.data.form.orderPapers[index] - if(util.isEmpty(element.productId)){ - util.showToast('请选择第' + (index + 1) + '项废纸品类') - return - } - if(!util.isEmpty(this.data.form.id)){ - var cate = this.findCateById(element.productId) - if(cate){ - element.highestUnitPrice = cate.highestUnitPrice - element.lowestUnitPrice = cate.lowestUnitPrice - } - } - if(element.highestUnitPrice && Number(element.unitPrice) > Number(element.highestUnitPrice)){ - util.showToast('第' + (index + 1) + '项废纸品类单价过高,价格范围:' + element.lowestUnitPrice + '元/公斤-'+ element.highestUnitPrice + '元/公斤') - return - } - if(element.lowestUnitPrice && Number(element.unitPrice) < Number(element.lowestUnitPrice)){ - util.showToast('第' + (index + 1) + '项废纸品类单价过低,价格范围:' + element.lowestUnitPrice + '元/公斤-'+ element.highestUnitPrice + '元/公斤') - return - } - } wx.showLoading({ title: '处理中', mask: true }) pricingOrder(this.data.form).then(result => { wx.hideLoading() diff --git a/pages/process/outside-info/index.json b/pages/process/outside-info/index.json index 076d4a4..b1e44b4 100644 --- a/pages/process/outside-info/index.json +++ b/pages/process/outside-info/index.json @@ -7,9 +7,6 @@ "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", - "van-dialog": "/components/dialog/index", "van-field": "/components/field/index", "van-switch": "/components/switch/index", "van-uploader": "/components/uploader/index", diff --git a/pages/process/outside-info/index.wxml b/pages/process/outside-info/index.wxml index 50acb30..d93ca15 100644 --- a/pages/process/outside-info/index.wxml +++ b/pages/process/outside-info/index.wxml @@ -3,154 +3,155 @@ 厂外收货 - - - - 客户姓名 - {{form.factoryCustomerName || '请选择客户'}} - - - - - 车牌号码 - {{form.plateNumber || '请输入车牌号码'}} - - - - - 司机 - {{form.driverName || '请选择司机'}} - - - - - 操作员 - {{form.operatorName || '请选择操作员'}} - - - - - 预计到厂时间 - {{form.appointDate || '请选择预计到厂时间'}} - - - - - - + + - 废纸品类{{index + 1}} - {{item.productName || '请选择废纸品类'}} - - - - - 预估单价(元/公斤) - {{item.unitPrice || '请输入单价'}} + 客户姓名 + {{form.factoryCustomerName || '请选择客户'}} - + - - * - 毛重(公斤) - - + 车牌号码 + {{form.plateNumber || '请输入车牌号码'}} - + - - * - 皮重(公斤) - - + 司机 + {{form.driverName || '请选择司机'}} - + - 净重(公斤) - {{item.netWeight || ''}} + 操作员 + {{form.operatorName || '请选择操作员'}} - + - 预估金额(元) - {{item.price || ''}} + 预计到厂时间 + {{form.appointDate || '请选择预计到厂时间'}} - - - - * - 过磅凭证 + + + + + + + 废纸品类{{index + 1}} + {{item.productName || '请选择废纸品类'}} - 最多3张,每图片大小限制5M - - - - - - - * - 结算单价(元/公斤) + + + + 预估单价(元/公斤) + {{item.unitPrice || '请输入单价'}} - - - - - - - - 扣重(公斤) + + + + + * + 毛重(公斤) + + - - - - - - - - 扣点(%) + + + + + * + 皮重(公斤) + + + + + + + 净重(公斤) + {{item.netWeight || ''}} + + + + + 预估金额(元) + {{item.price || ''}} - + + + + + * + 过磅凭证 + + 最多3张,每图片大小限制5M + + - - + + + + * + 结算单价(元/公斤) + + + + + + + + + 扣重(公斤) + + + + + + + + + 扣点(%) + + + + + + + 结算重量(公斤) + {{form.settleWeight || '- -'}} + + + + + 结算金额(元) + {{form.settleWeight || '- -'}} + + + + + - 结算重量(公斤) - {{form.settleWeight || '- -'}} + 总净重(公斤) + {{form.driverName || '请选择司机'}} - + - 结算金额(元) - {{form.settleWeight || '- -'}} + 预计总金额(元) + {{form.driverName || '请选择司机'}} - - - - - 总净重(公斤) - {{form.driverName || '请选择司机'}} - - - - - 预计总金额(元) - {{form.driverName || '请选择司机'}} - - - + * @@ -170,15 +171,10 @@ placeholder="请输入厂外毛重" value="{{item.unitPrice || ''}}" bindinput="bindInput" /> - - - 取消 - 修改订单 - - - 保存 - 提交订单 + + + 重新定价 + 审核通过 - \ No newline at end of file diff --git a/pages/process/outside-item/index.js b/pages/process/outside-item/index.js new file mode 100644 index 0000000..36cbf20 --- /dev/null +++ b/pages/process/outside-item/index.js @@ -0,0 +1,103 @@ +// pages/message/index.js +const util = require('../../../utils/util') +const math = require('../../../utils/math') + +Component({ + options: { + addGlobalClass: true, + multipleSlots: true + }, + properties: { + item: { + type: Object, + value: null, + observer(value) { + this.setValues(value); + }}, + index: { type: Number, value: 0 }, + status: { type: Number, value: 0 } + }, + data: { + focus: 0, + fileList: [] + }, + methods: { + setValues: function(value){ + if(value && value.weightNoteImage){ + this.data.fileList = [] + for (let index = 0; index < value.weightNoteImage.length; index++) { + this.data.fileList.push({url: value.weightNoteImage[index]}) + } + this.setData({fileList: this.data.fileList}) + } + }, + bindInput: function (e) { + this.data.item[e.currentTarget.id] = e.detail.value + if(e.currentTarget.id == 'grossWeight' || e.currentTarget.id == 'tareWeight'){ + if(Number(this.data.item.grossWeight) > 0){ + if(Number(this.data.item.tareWeight) > 0){ + if(Number(this.data.item.grossWeight) > Number(this.data.item.tareWeight)){ + var netWeight = math.minus(this.data.item.grossWeight, this.data.item.tareWeight) + var estimatedAmount = math.times(netWeight, this.data.item.unitPrice).toFixed(2) + this.setData({['item.netWeight']: netWeight, ['item.estimatedAmount']: estimatedAmount}) + } else { + this.setData({['item.netWeight']: null, ['item.estimatedAmount']: null}) + } + } else { + this.setData({['item.netWeight']: Number(this.data.item.grossWeight), ['item.estimatedAmount']: null}) + } + } else { + this.setData({['item.netWeight']: null, ['item.estimatedAmount']: null}) + } + } else if(e.currentTarget.id == 'deductPercent'){ + if(util.isEmpty(e.detail.value) || Number(e.detail.value) <= 0){ + this.data.item.deductWeight = null + this.data.item.deductPercent = null + } else { + this.data.item.deductWeight = math.divide(math.times(this.data.item.totalWeight, Number(e.detail.value)), 100).toFixed(2) + } + this.statAmount() + } else if(e.currentTarget.id == 'deductWeight'){ + if(util.isEmpty(e.detail.value) || Number(e.detail.value) <= 0){ + this.data.item.deductWeight = null + this.data.item.deductPercent = null + } else { + this.data.item.deductPercent = math.times(math.divide(Number(e.detail.value), this.data.item.totalWeight), 100).toFixed(2) + } + this.statAmount() + } else if(e.currentTarget.id == 'settleUnitPrice'){ + this.statAmount() + } + wx.nextTick(() => { + this.triggerEvent('change', {index: this.data.index, item: this.data.item}); + }) + }, + statAmount: function(){ + this.data.item.settleWeight = this.data.item.netWeight + if(!util.isEmpty(this.data.item.deductWeight)){ + this.data.item.settleWeight = math.minus(this.data.item.netWeight, this.data.item.deductWeight) + } + if(!util.isEmpty(this.data.item.settleUnitPrice) && Number(this.data.item.settleUnitPrice) > 0){ + this.data.item.settlePrice = math.times(this.data.item.settleWeight, this.data.item.settleUnitPrice) + } else { + this.data.item.settlePrice = null + } + this.setData({ item: this.data.item }) + }, + changeDeductType: function(e){ + this.setData({ ['item.sign']: e.currentTarget.dataset.type, focus: e.currentTarget.dataset.type }) + }, + fileChange: function({detail}){ + this.data.fileList = detail.fileList + var imageUrls = [] + for (let index = 0; index < this.data.fileList.length; index++) { + imageUrls.push(this.data.fileList[index].url) + } + this.data.item.weightNoteImage = imageUrls + wx.nextTick(() => { + this.triggerEvent('change', {index: this.data.index, item: this.data.item}); + }) + } + } + +}) \ No newline at end of file diff --git a/pages/process/outside-item/index.json b/pages/process/outside-item/index.json new file mode 100644 index 0000000..e5922ae --- /dev/null +++ b/pages/process/outside-item/index.json @@ -0,0 +1,8 @@ +{ + "component": true, + "usingComponents": { + "van-cell": "/components/cell/index", + "van-checkbox": "/components/checkbox/index", + "van-uploader": "/components/uploader/index" + } +} \ No newline at end of file diff --git a/pages/process/outside-item/index.wxml b/pages/process/outside-item/index.wxml new file mode 100644 index 0000000..327a3d3 --- /dev/null +++ b/pages/process/outside-item/index.wxml @@ -0,0 +1,100 @@ + + + + 废纸品类{{index + 1}} + {{item.productCategoryName || '请选择废纸品类'}} + + + + + 预估单价(元/公斤) + {{item.unitPrice || '请输入单价'}} + + + + + + * + 毛重(公斤) + + + + + + + + * + 皮重(公斤) + + + + + + + 净重(公斤) + {{item.netWeight || ''}} + + + + + 预估金额(元) + {{item.estimatedAmount || ''}} + + + + + + * + 过磅凭证 + + 3-6张,每图片大小限制5M + + + + + + + * + 结算单价(元/公斤) + + + + + + + + + 扣重(公斤) + + + + + + + + + 扣点(%) + + + + + + + 结算重量(公斤) + {{form.settleWeight || '- -'}} + + + + + 结算金额(元) + {{form.settlePrice || '- -'}} + + \ No newline at end of file diff --git a/pages/process/outside-item/index.wxss b/pages/process/outside-item/index.wxss new file mode 100644 index 0000000..d39e71b --- /dev/null +++ b/pages/process/outside-item/index.wxss @@ -0,0 +1,23 @@ +/* pages/mall/shops/index.wxss */ +.item-content { + background: rgba(255, 255, 255, 1); + padding: 32rpx; +} + +.item-cate { + flex: 5; + padding: 10rpx 30rpx; + border-radius: 10rpx; + border: 1rpx solid #f3f3f3; + background-color: #f3f3f3; +} + +.cate-tag { + background-color: #e6f7ff; + border: 1rpx solid #1890ff; +} + +.transform { + transform-origin: 50% 50%; + transform: rotate(180deg); +} diff --git a/pages/process/outside-list/index.js b/pages/process/outside-list/index.js index 105a997..3d40754 100644 --- a/pages/process/outside-list/index.js +++ b/pages/process/outside-list/index.js @@ -1,7 +1,7 @@ // pages/process/order-list/index.js import Scene from '../../index/scene' import Dialog from '../../../components/dialog/dialog' -import { getFactoryOrderList, cancelOrder } from "../../../api/saas" +import { getSideOrderList, cancelOrder } from "../../../api/saas" const event = require('../../../utils/event') const util = require('../../../utils/util') const app = getApp() @@ -14,15 +14,14 @@ Scene({ tabIndex: 0, tabList: [ {id: 0, name: '全部', badge: 0, status: '' }, - {id: 1, name: '待收货', badge: 0, status: 1 }, - {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: 41 }, - {id: 6, name: '待结算', badge: 0, status: 42 }, - {id: 7, name: '已完成', badge: 0, status: 5 }, - // {id: 8, name: '已取消', badge: 0, status: 6 } + {id: 1, name: '待收货', badge: 0, status: 0 }, + {id: 2, name: '待定价', badge: 0, status: 1 }, + {id: 4, name: '待过榜审核', badge: 0, status: 3 }, + {id: 5, name: '待付款', badge: 0, status: 4 }, + {id: 6, name: '代付中', badge: 0, status: 41 }, + {id: 7, name: '待结算', badge: 0, status: 42 }, + {id: 8, name: '已完成', badge: 0, status: 5 }, + {id: 9, name: '已取消', badge: 0, status: 6 } ], loading: true, requesting: false, @@ -91,7 +90,7 @@ Scene({ } else { this.setData({ requesting: true }) } - getFactoryOrderList(this.data.form).then(result => { + getSideOrderList(this.data.form).then(result => { if (result.data && result.data.records && result.data.records.length) { var respList = result.data.records // 对返回的消息列表进行处理,将同一天的消息显示在一起 @@ -143,15 +142,12 @@ Scene({ }, lookItem: function (e) { var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index] - if(item.status == 1){ - wx.navigateTo({ url: `/pages/process/order-price/index?id=${item.id}` }) + if(item.orderStatus == 0 || item.orderStatus == 1){ + wx.navigateTo({ url: `/pages/process/outside-price/index?id=${item.orderId}` }) } else { - wx.navigateTo({ url: `/pages/process/order-info/index?id=${item.id}` }) + wx.navigateTo({ url: `/pages/process/outside-info/index?id=${item.orderId}` }) } }, - priceOrder: function(e){ - wx.navigateTo({ url: '/pages/process/order-price/index?id=' + e.currentTarget.dataset.id }) - }, addOutside: function(e){ wx.navigateTo({ url: '/pages/process/outside-add/index' }) }, diff --git a/pages/process/outside-list/index.wxml b/pages/process/outside-list/index.wxml index 93ae758..11a8d0a 100644 --- a/pages/process/outside-list/index.wxml +++ b/pages/process/outside-list/index.wxml @@ -21,54 +21,26 @@ {{item.tipsTime}} - - - - 客户名称:{{item.factoryCustomerName}} - ({{item.factoryCustomerMobile}}) - - 毛重:{{item.totalWeight}}公斤 - - 品类:{{item.productName}} - 毛重:{{item.totalWeight}}公斤 - - - 品类:{{item.productName}} - 金额:{{item.settlePrice}}元 - + + + 客户名称:{{item.factoryCustomerName}} + ({{item.factoryCustomerMobile}}) - - 取消 - 定价 - - - 待过皮重 - - - 审核 + + 待收货 + 待定价 + 过磅待审核 + 待付款 + 代付中 + 待结算 + 已完成 + 已取消 - - - - 客户名称:{{item.factoryCustomerName}} - ({{item.factoryCustomerMobile}}) - - - 待付款 - 代付中 - 待结算 - 已完成 - - - - 品类:{{item.productName}} - 重量:{{item.settleWeight}}公斤 - 金额:{{item.settlePrice}}元 - + + 车牌号码:{{item.plateNumber}} + 品类:{{item.productCategoryName}} + 金额:{{item.settlePrice}}元 @@ -80,10 +52,8 @@ - - - - + + diff --git a/pages/process/outside-price/index.js b/pages/process/outside-price/index.js index 44ad042..077dabb 100644 --- a/pages/process/outside-price/index.js +++ b/pages/process/outside-price/index.js @@ -1,9 +1,10 @@ // pages/process/order-check/index.js import Scene from '../../index/scene' import Dialog from '../../../components/dialog/dialog' -import { pricingOrder, getFactoryOrderInfo} from "../../../api/saas" +import { poundSideOrder, getSideOrderInfo} from "../../../api/saas" const event = require('../../../utils/event') const util = require('../../../utils/util') +const math = require('../../../utils/math') const app = getApp() Scene({ @@ -11,9 +12,12 @@ Scene({ * 页面的初始数据 */ data: { - form: { - orderPapers: [{ productId: '', productName: '', unitPrice: ''}], - appointDate: null + id: null, + form: null, + param: { + scrapPaperReceiptId: null, + offsiteGrossWeight: null, + offsiteTareWeight: null, } }, /** @@ -21,20 +25,41 @@ Scene({ */ onLoad: function (options) { if(options.id){ - wx.showLoading({ title: '正在获取', mask: true }) - getFactoryOrderInfo(options.id).then(result => { - wx.hideLoading() - this.setData({ form: result.data, admin: app.userInfo.type && app.userInfo.type.indexOf('ADMIN') >= 0 }) - }).catch(err => { - wx.hideLoading() - util.showToast(err) - }) + this.data.id = options.id + this.fetchOrderInfo() + } + }, + fetchOrderInfo: function(){ + wx.showLoading({ title: '正在获取', mask: true }) + getSideOrderInfo({id: this.data.id}).then(result => { + wx.hideLoading() + this.data.param.offsiteGrossWeight = result.data.offsiteGrossWeight + this.data.param.offsiteTareWeight = result.data.offsiteTareWeight + this.setData({ form: result.data, admin: app.userInfo.type && app.userInfo.type.indexOf('ADMIN') >= 0 }) + }).catch(err => { + wx.hideLoading() + util.showToast(err) + }) + }, + onProductChange: function({detail}){ + this.data.form.productCategoryInfos[detail.index] = detail.item + var netWeight = 0 + var estimatedAmount = 0 + for (let index = 0; index < this.data.form.productCategoryInfos.length; index++) { + const element = this.data.form.productCategoryInfos[index] + if(!util.isEmpty(element.netWeight) && Number(element.netWeight) > 0){ + netWeight = math.plus(netWeight, element.netWeight) + } + if(!util.isEmpty(element.estimatedAmount) && Number(element.estimatedAmount) > 0){ + estimatedAmount = math.plus(estimatedAmount, element.estimatedAmount) + } } + this.setData({ ['form.netWeight']: netWeight, ['form.estimatedAmount']: estimatedAmount.toFixed(2) }) }, bindInput: function (e) { - this.data.form.orderPapers[e.currentTarget.dataset.index].unitPrice = e.detail.value + this.data.param[e.currentTarget.id] = e.detail.value }, - cancelOrder: function(e){ + cancelForm: function(e){ Dialog.confirm({ title: '温馨提示', message: '确定取消该订单?' }).then(() => { wx.showLoading({ title: '处理中', mask: true }) cancelOrder(this.data.form.id).then(result => { @@ -47,52 +72,75 @@ Scene({ }) }) }, - fileChange: function({detail}){ - console.log(detail) + eidtForm: function(){ + wx.redirectTo({url: `/pages/process/outside-add/index?id=${this.data.id}` }) }, - submitForm: function(){ - if(util.isEmpty(this.data.form.factoryCustomerName)){ - util.showToast('请选择客户') - return + saveForm: function(){ + var weightNoteList = [] + for (let index = 0; index < this.data.form.productCategoryInfos.length; index++) { + const element = this.data.form.productCategoryInfos[index] + var item = {grossWeight: element.grossWeight, tareWeight: element.tareWeight,weightNoteImage: element.weightNoteImage } + item.scrapPaperPurchaseOrderId = element.scrapPaperPurchaseOrderId + weightNoteList.push(item) } - if(util.isEmpty(this.data.form.plateNumber)){ - util.showToast('请输入车牌号码') + this.data.param.weightNoteList = weightNoteList + wx.showLoading({ title: '处理中', mask: true }) + poundSideOrder(this.data.param).then(result => { + wx.hideLoading() + util.showBackToast('保存成功') + event.emit('OrderMessage', { what: 12, desc: 'pricingOrder' }) + }).catch(err => { + wx.hideLoading() + util.showToast(err) + }) + }, + submitForm: function(){ + if(util.isEmpty(this.data.param.offsiteGrossWeight)){ + util.showToast('请输入厂外毛重') return } - if(util.isEmpty(this.data.form.driverName)){ - util.showToast('请选择司机') + if(util.isEmpty(this.data.param.offsiteTareWeight)){ + util.showToast('请输入厂外皮重') return } - for (let index = 0; index < this.data.form.orderPapers.length; index++) { - const element = this.data.form.orderPapers[index] - if(util.isEmpty(element.productId)){ - util.showToast('请选择第' + (index + 1) + '项废纸品类') + var weightNoteList = [] + for (let index = 0; index < this.data.form.productCategoryInfos.length; index++) { + const element = this.data.form.productCategoryInfos[index] + if(util.isEmpty(element.grossWeight)){ + util.showToast('请输入第' + (index + 1) + '项废纸品类毛重') return } - if(!util.isEmpty(this.data.form.id)){ - var cate = this.findCateById(element.productId) - if(cate){ - element.highestUnitPrice = cate.highestUnitPrice - element.lowestUnitPrice = cate.lowestUnitPrice - } - } - if(element.highestUnitPrice && Number(element.unitPrice) > Number(element.highestUnitPrice)){ - util.showToast('第' + (index + 1) + '项废纸品类单价过高,价格范围:' + element.lowestUnitPrice + '元/公斤-'+ element.highestUnitPrice + '元/公斤') + if(util.isEmpty(element.weightNoteImage)){ + util.showToast('请上传第' + (index + 1) + '项废纸品类过磅凭证') return } - if(element.lowestUnitPrice && Number(element.unitPrice) < Number(element.lowestUnitPrice)){ - util.showToast('第' + (index + 1) + '项废纸品类单价过低,价格范围:' + element.lowestUnitPrice + '元/公斤-'+ element.highestUnitPrice + '元/公斤') + if(element.weightNoteImage.length < 3){ + util.showToast('每个品类过磅凭证图片必须3张以上') return } + var item = {grossWeight: element.grossWeight, tareWeight: element.tareWeight,weightNoteImage: element.weightNoteImage } + item.scrapPaperPurchaseOrderId = element.scrapPaperPurchaseOrderId + weightNoteList.push(item) } + this.data.param.scrapPaperReceiptId = this.data.form.scrapPaperReceiptId + this.data.param.weightNoteList = weightNoteList wx.showLoading({ title: '处理中', mask: true }) - pricingOrder(this.data.form).then(result => { + poundSideOrder(this.data.param).then(result => { wx.hideLoading() - util.showBackToast('定价成功') + util.showBackToast('提交成功') event.emit('OrderMessage', { what: 12, desc: 'pricingOrder' }) }).catch(err => { wx.hideLoading() util.showToast(err) }) + }, + repeatForm: function(){ + wx.redirectTo({url: `/pages/process/outside-check/index?id=${this.data.id}` }) + }, + priceForm: function(){ + + }, + checkForm: function(){ + } }) \ No newline at end of file diff --git a/pages/process/outside-price/index.json b/pages/process/outside-price/index.json index 076d4a4..1be317f 100644 --- a/pages/process/outside-price/index.json +++ b/pages/process/outside-price/index.json @@ -12,6 +12,7 @@ "van-dialog": "/components/dialog/index", "van-field": "/components/field/index", "van-switch": "/components/switch/index", + "outside-item": "/pages/process/outside-item/index", "van-uploader": "/components/uploader/index", "submit-layout": "/components/submit-layout/index", "notification": "/pages/message/notification/index" diff --git a/pages/process/outside-price/index.wxml b/pages/process/outside-price/index.wxml index 50acb30..8819d39 100644 --- a/pages/process/outside-price/index.wxml +++ b/pages/process/outside-price/index.wxml @@ -3,161 +3,68 @@ 厂外收货 - - - - 客户姓名 - {{form.factoryCustomerName || '请选择客户'}} - - - - - 车牌号码 - {{form.plateNumber || '请输入车牌号码'}} - - - - - 司机 - {{form.driverName || '请选择司机'}} - - - - - 操作员 - {{form.operatorName || '请选择操作员'}} - - - - - 预计到厂时间 - {{form.appointDate || '请选择预计到厂时间'}} - - - - - - + + - 废纸品类{{index + 1}} - {{item.productName || '请选择废纸品类'}} - - - - - 预估单价(元/公斤) - {{item.unitPrice || '请输入单价'}} - - - - - - * - 毛重(公斤) + 客户姓名 + {{form.factoryCustomerName || '请选择客户'}} - - + - - * - 皮重(公斤) - - + 车牌号码 + {{form.plateNumber || '请输入车牌号码'}} - + - 净重(公斤) - {{item.netWeight || ''}} + 司机 + {{form.driverName || '请选择司机'}} - + - 预估金额(元) - {{item.price || ''}} + 操作员 + {{form.operatorName || '请选择操作员'}} - - - - * - 过磅凭证 - - 最多3张,每图片大小限制5M - - - - + - - * - 结算单价(元/公斤) - - + 预计到厂时间 + {{form.appointDate || '请选择预计到厂时间'}} - + + + + + + + + - - - 扣重(公斤) - - + 总净重(公斤) + {{form.netWeight || ''}} - - - - - 扣点(%) - - - - - + - 结算重量(公斤) - {{form.settleWeight || '- -'}} + 预计总金额(元) + {{form.estimatedAmount || ''}} - - 结算金额(元) - {{form.settleWeight || '- -'}} - - - - - - - 总净重(公斤) - {{form.driverName || '请选择司机'}} - - - - - 预计总金额(元) - {{form.driverName || '请选择司机'}} - - - * 厂外皮重(公斤) - + @@ -166,19 +73,30 @@ * 厂外毛重(公斤) - + - - - 取消 - 修改订单 + + + 取消 + 修改订单 + 保存 + 提交订单 - + 保存 提交订单 + + 取消 + 确认 + + + 重新定价 + 审核 + - \ No newline at end of file + \ No newline at end of file