diff --git a/app.js b/app.js index 409ed81..b60a441 100644 --- a/app.js +++ b/app.js @@ -1,6 +1,6 @@ //app.js App({ - evn: 2, // 0: 开发版本;1:测试版本;2:生产版本 + evn: 0, // 0: 开发版本;1:测试版本;2:生产版本 tmplIds: ['AFoM5TOfsgERsfcetNSB0UlmEixnLF1ySXr54Bqno2M', 'lOQ8Gvyy_dTk68bYGpRVnVA0M7DsYYrV81Gd39GUPBA'], version: '1.5.0', xAppId: '503258978847953926', diff --git a/app.json b/app.json index 806975f..904d700 100644 --- a/app.json +++ b/app.json @@ -17,6 +17,10 @@ "pages/process/order-info/index", "pages/process/payment-list/index", "pages/process/payment/index", + "pages/process/outside-list/index", + "pages/process/outside-add/index", + "pages/process/outside-price/index", + "pages/process/outside-info/index", "pages/htmls/agreement/index", "pages/htmls/auths/index", "pages/htmls/banner/index", diff --git a/pages/home/customer-list/index.wxml b/pages/home/customer-list/index.wxml index d42e59f..3db2056 100644 --- a/pages/home/customer-list/index.wxml +++ b/pages/home/customer-list/index.wxml @@ -2,6 +2,7 @@ 客户列表 + 搜索 diff --git a/pages/process/index/index.js b/pages/process/index/index.js index ebdc927..de84f57 100644 --- a/pages/process/index/index.js +++ b/pages/process/index/index.js @@ -129,6 +129,13 @@ Component({ wx.navigateTo({ url: '/pages/storage/order-list/index' }) } }, + outsideList: function(e){ + if(e.currentTarget.dataset.status){ + wx.navigateTo({ url: `/pages/process/outside-list/index?status=${e.currentTarget.dataset.status}` }) + } else { + wx.navigateTo({ url: `/pages/process/outside-list/index` }) + } + }, fetchStatisticsInfo: function(vdate, loading){ var param = {startTime: util.formatTime(new Date(vdate[0]), 'Y-M-D'), endTime: util.formatTime(new Date(vdate[1]), 'Y-M-D')} getStatisticsInfo(param).then(result => { diff --git a/pages/process/index/index.wxml b/pages/process/index/index.wxml index dd6bea5..3ff6924 100644 --- a/pages/process/index/index.wxml +++ b/pages/process/index/index.wxml @@ -58,34 +58,22 @@ - + diff --git a/pages/process/order-check/index.json b/pages/process/order-check/index.json index a394fc8..5abef9c 100644 --- a/pages/process/order-check/index.json +++ b/pages/process/order-check/index.json @@ -9,6 +9,7 @@ "van-picker": "/components/picker/index", "van-popup": "/components/popup/index", "vehicle-keyboard": "/components/vehicle-keyboard/index", + "submit-layout": "/components/submit-layout/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 index c535e25..dc550f4 100644 --- a/pages/process/order-check/index.wxml +++ b/pages/process/order-check/index.wxml @@ -46,7 +46,7 @@ 单价(元/公斤) + placeholder="请输入单价" value="{{form.unitPrice || ''}}" bindinput="bindInput" /> @@ -78,14 +78,14 @@ - - - + + + 金额: {{amout}} 通过审核 - + diff --git a/pages/process/order-price/index.wxml b/pages/process/order-price/index.wxml index 98c1028..ad4037d 100644 --- a/pages/process/order-price/index.wxml +++ b/pages/process/order-price/index.wxml @@ -61,7 +61,7 @@ 单价(元/公斤) + placeholder="请输入单价" value="{{form.unitPrice || ''}}" bindinput="bindInput" /> diff --git a/pages/process/outside-add/index.js b/pages/process/outside-add/index.js new file mode 100644 index 0000000..23c7e25 --- /dev/null +++ b/pages/process/outside-add/index.js @@ -0,0 +1,218 @@ +// pages/process/order-check/index.js +import Scene from '../../index/scene' +import Dialog from '../../../components/dialog/dialog' +import { pricingOrder, getFactoryOrderInfo, getPaperList} from "../../../api/saas" +const event = require('../../../utils/event') +const util = require('../../../utils/util') +const app = getApp() + +Scene({ + /** + * 页面的初始数据 + */ + data: { + safeBottom: app.globalData.safeBottom, + paperList: null, + form: { + orderPapers: [{ productId: '', productName: '', unitPrice: ''}], + appointDate: null + }, + columns: [], + visible: false, + cateIndex: -1, + nowItem: null, + column1: [], + column4: [ + { + values: [], + className: 'column1' + }, + { + values: ['8:00~10:00', '10:00~12:00', '12:00~14:00', '14:00~16:00', '16:00~18:00', '18:00~20:00'], + className: 'column2' + } + ] + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + wx.showLoading({ title: '正在获取', mask: true }) + var day = new Date() + for (let i = 0; i < 3; i++) { + day.setDate(day.getDate() + (i > 1 ? 1 : i)) + this.data.column4[0].values.push(util.formatDate(day, 'Y-M-D')) + } + getPaperList({pageNum: 1, pageSize: 100}).then(result => { + this.data.paperList = result.data.records + this.data.column1 = [] + for (let index = 0; index < this.data.paperList.length; index++) { + this.data.column1.push(this.data.paperList[index].name) + } + this.setData({ safeBottom: app.globalData.safeBottom }) + if(!options.id){ + wx.hideLoading() + } + }).catch(err => { + this.setData({ safeBottom: app.globalData.safeBottom }) + util.showToast(err) + if(!options.id){ + wx.hideLoading() + } + }) + if(options.id){ + getFactoryOrderInfo(options.id).then(result => { + wx.hideLoading() + this.setData({ form: result.data }) + }).catch(err => { + wx.hideLoading() + util.showToast(err) + }) + } + }, + chooseCustomer: function (e) { + var that = this + var events = {} + events.onCallback = function(data){ + if (data.what == 130) { + that.data.form.factoryCustomerId = data.detail.id + that.setData({ ['form.factoryCustomerName']: data.detail.name }) + } + } + wx.navigateTo({url: `/pages/home/customer-list/index?type=1`, events}) + }, + chooseEmploy: function (e) { + var that = this + var events = {} + events.onCallback = function(data){ + if (data.what == 121 && e.currentTarget.id == 'driverName') { + that.data.form.driverId = data.detail.id + that.setData({ ['form.driverName']: data.detail.enterpriseMemberName }) + } else if (data.what == 121 && e.currentTarget.id == 'operatorName') { + that.data.form.operatorId = data.detail.id + that.setData({ ['form.operatorName']: data.detail.enterpriseMemberName }) + } + } + wx.navigateTo({url: `/pages/home/employee/index?type=1`, events}) + }, + 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(e){ + if(e.currentTarget.dataset.index >= 0){ + this.data.cateIndex = e.currentTarget.dataset.index + this.setData({ visible: true, columns: this.data.column1 }) + } else { + this.data.cateIndex = -1 + this.setData({ visible: true, columns: this.data.column4 }) + } + }, + onConfirm: function({detail}){ + if(Array.isArray(detail.index)){ + this.setData({ visible: false, ['form.appointDate']: (detail.value[0] + ' ' + detail.value[1]) }) + } else { + var nowItem = this.data.paperList[detail.index] + for (var i = 0; i < this.data.form.orderPapers.length; i++) { + if (this.data.form.orderPapers[i].productId == nowItem.id){ + this.setData({ visible: false }) + util.showToast('纸品已经存在,请不要重复添加') + return + } + } + var product = {productId: nowItem.id, productName: detail.value, unitPrice: nowItem.defaultUnitPrice} + product.highestUnitPrice = nowItem.highestUnitPrice + product.lowestUnitPrice = nowItem.lowestUnitPrice + this.setData({ visible: false, ['form.orderPapers[' + this.data.cateIndex + ']']: product }) + } + }, + onHide: function(){ + this.setData({ visible: false }) + }, + bindInput: function (e) { + this.data.form.orderPapers[e.currentTarget.dataset.index].unitPrice = e.detail.value + }, + onChange: function(e) { + this.data.form.inspectionRemark = e.detail + }, + addCate: function(e){ + this.data.form.orderPapers.push({ productId: '', productName: '', unitPrice: ''}) + this.setData({ ['form.orderPapers']: this.data.form.orderPapers }) + }, + deleteCate: function(e){ + this.data.form.orderPapers.splice(e.currentTarget.dataset.index, 1) + this.setData({ ['form.orderPapers']: this.data.form.orderPapers }) + }, + findCateById: function(productId){ + for (let index = 0; index < this.data.paperList.length; index++) { + const element = this.data.paperList[index] + if(element.id == productId){ + return element + } + } + return null + }, + 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) + }) + }) + }, + 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() + util.showBackToast('定价成功') + event.emit('OrderMessage', { what: 12, desc: 'pricingOrder' }) + }).catch(err => { + wx.hideLoading() + util.showToast(err) + }) + } +}) \ No newline at end of file diff --git a/pages/process/outside-add/index.json b/pages/process/outside-add/index.json new file mode 100644 index 0000000..684c471 --- /dev/null +++ b/pages/process/outside-add/index.json @@ -0,0 +1,19 @@ +{ + "usingComponents": { + "van-index-anchor": "/components/index-anchor/index", + "van-cell": "/components/cell/index", + "van-icon": "/components/icon/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", + "van-dialog": "/components/dialog/index", + "van-field": "/components/field/index", + "van-switch": "/components/switch/index", + "vehicle-keyboard": "/components/vehicle-keyboard/index", + "submit-layout": "/components/submit-layout/index", + "notification": "/pages/message/notification/index" + } +} \ No newline at end of file diff --git a/pages/process/outside-add/index.wxml b/pages/process/outside-add/index.wxml new file mode 100644 index 0000000..3fb5b95 --- /dev/null +++ b/pages/process/outside-add/index.wxml @@ -0,0 +1,98 @@ + + + 新增厂外收货 + + + + + + + * + 客户姓名 + + {{form.factoryCustomerName || '请选择客户'}} + + + + + + * + 车牌号码 + + {{form.plateNumber || '请输入车牌号码'}} + + + + + + * + 司机 + + {{form.driverName || '请选择司机'}} + + + + + + + + + 品类 + {{index + 1}} + + + + + + + * + 废纸品类 + + {{item.productName || '请选择废纸品类'}} + + + + + + * + 单价(元/公斤) + + + + + + + + + 添加品类 + + + + + + 操作员 + {{form.operatorName || '请选择操作员'}} + + + + + 预计到厂时间 + {{form.appointDate || '请选择预计到厂时间'}} + + + + + + 取消 + 保存 + + 保存 + + + + + + + + \ No newline at end of file diff --git a/pages/process/outside-add/index.wxss b/pages/process/outside-add/index.wxss new file mode 100644 index 0000000..14a8a3a --- /dev/null +++ b/pages/process/outside-add/index.wxss @@ -0,0 +1,21 @@ +/* pages/process/order-check/index.wxss */ +.cate-list { + margin: 24rpx 30rpx; + border: 1rpx solid #dcdcdc; +} + +.cate-header { + min-height: 76rpx; + background-color: #dcdcdc; + padding: 0rpx 30rpx; +} + +.cate-index { + width: 32rpx; + height: 32rpx; + line-height: 32rpx; + text-align: center; + border-radius: 5000rpx; + border: 1px solid #666666; + margin-left: 12rpx +} diff --git a/pages/process/outside-check/index.js b/pages/process/outside-check/index.js new file mode 100644 index 0000000..181d668 --- /dev/null +++ b/pages/process/outside-check/index.js @@ -0,0 +1,177 @@ +// 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: { + orderPapers: [{ productId: '', productName: '', unitPrice: ''}], + appointDate: null + }, + columns: [], + focus: 0, + visible: false, + amout: 20 + }, + /** + * 生命周期函数--监听页面加载 + */ + 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({ id: this.data.form.id, editOrderPriceDto: 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/outside-check/index.json b/pages/process/outside-check/index.json new file mode 100644 index 0000000..f20c784 --- /dev/null +++ b/pages/process/outside-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", + "submit-layout": "/components/submit-layout/index", + "notification": "/pages/message/notification/index" + } +} \ No newline at end of file diff --git a/pages/process/outside-check/index.wxml b/pages/process/outside-check/index.wxml new file mode 100644 index 0000000..ff64920 --- /dev/null +++ b/pages/process/outside-check/index.wxml @@ -0,0 +1,102 @@ + + + 重新定价 + + + + + + + 客户姓名 + {{form.factoryCustomerName || '请选择客户'}} + + + + + 车牌号码 + {{form.plateNumber || '请输入车牌号码'}} + + + + + 司机 + {{form.driverName || '请选择司机'}} + + + + + + + + + * + 废纸品类{{index + 1}} + + {{item.productName || '请选择废纸品类'}} + + + + + + * + 结算单价(元/公斤) + + + + + + + 净重(公斤) + {{item.netWeight || ''}} + + + + + + + 扣重(公斤) + + + + + + + + + 扣点(%) + + + + + + + 结算重量(公斤) + {{form.settleWeight || '- -'}} + + + + + 结算金额(元) + {{form.settleWeight || '- -'}} + + + + + + + + 金额: + {{amout}} + + 通过审核 + + + + + + \ No newline at end of file diff --git a/pages/process/outside-check/index.wxss b/pages/process/outside-check/index.wxss new file mode 100644 index 0000000..5a0d819 --- /dev/null +++ b/pages/process/outside-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/outside-info/index.js b/pages/process/outside-info/index.js new file mode 100644 index 0000000..44ad042 --- /dev/null +++ b/pages/process/outside-info/index.js @@ -0,0 +1,98 @@ +// pages/process/order-check/index.js +import Scene from '../../index/scene' +import Dialog from '../../../components/dialog/dialog' +import { pricingOrder, getFactoryOrderInfo} from "../../../api/saas" +const event = require('../../../utils/event') +const util = require('../../../utils/util') +const app = getApp() + +Scene({ + /** + * 页面的初始数据 + */ + data: { + form: { + orderPapers: [{ productId: '', productName: '', unitPrice: ''}], + appointDate: null + } + }, + /** + * 生命周期函数--监听页面加载 + */ + 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) + }) + } + }, + 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) + }, + 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() + util.showBackToast('定价成功') + event.emit('OrderMessage', { what: 12, desc: 'pricingOrder' }) + }).catch(err => { + wx.hideLoading() + util.showToast(err) + }) + } +}) \ No newline at end of file diff --git a/pages/process/outside-info/index.json b/pages/process/outside-info/index.json new file mode 100644 index 0000000..076d4a4 --- /dev/null +++ b/pages/process/outside-info/index.json @@ -0,0 +1,19 @@ +{ + "usingComponents": { + "van-index-anchor": "/components/index-anchor/index", + "van-cell": "/components/cell/index", + "van-icon": "/components/icon/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", + "van-dialog": "/components/dialog/index", + "van-field": "/components/field/index", + "van-switch": "/components/switch/index", + "van-uploader": "/components/uploader/index", + "submit-layout": "/components/submit-layout/index", + "notification": "/pages/message/notification/index" + } +} \ No newline at end of file diff --git a/pages/process/outside-info/index.wxml b/pages/process/outside-info/index.wxml new file mode 100644 index 0000000..50acb30 --- /dev/null +++ b/pages/process/outside-info/index.wxml @@ -0,0 +1,184 @@ + + + 厂外收货 + + + + + + 客户姓名 + {{form.factoryCustomerName || '请选择客户'}} + + + + + 车牌号码 + {{form.plateNumber || '请输入车牌号码'}} + + + + + 司机 + {{form.driverName || '请选择司机'}} + + + + + 操作员 + {{form.operatorName || '请选择操作员'}} + + + + + 预计到厂时间 + {{form.appointDate || '请选择预计到厂时间'}} + + + + + + + + + 废纸品类{{index + 1}} + {{item.productName || '请选择废纸品类'}} + + + + + 预估单价(元/公斤) + {{item.unitPrice || '请输入单价'}} + + + + + + * + 毛重(公斤) + + + + + + + + * + 皮重(公斤) + + + + + + + 净重(公斤) + {{item.netWeight || ''}} + + + + + 预估金额(元) + {{item.price || ''}} + + + + + + * + 过磅凭证 + + 最多3张,每图片大小限制5M + + + + + + + * + 结算单价(元/公斤) + + + + + + + + + 扣重(公斤) + + + + + + + + + 扣点(%) + + + + + + + 结算重量(公斤) + {{form.settleWeight || '- -'}} + + + + + 结算金额(元) + {{form.settleWeight || '- -'}} + + + + + + + 总净重(公斤) + {{form.driverName || '请选择司机'}} + + + + + 预计总金额(元) + {{form.driverName || '请选择司机'}} + + + + + + * + 厂外皮重(公斤) + + + + + + + + * + 厂外毛重(公斤) + + + + + + + 取消 + 修改订单 + + + 保存 + 提交订单 + + + + \ No newline at end of file diff --git a/pages/process/outside-info/index.wxss b/pages/process/outside-info/index.wxss new file mode 100644 index 0000000..14a8a3a --- /dev/null +++ b/pages/process/outside-info/index.wxss @@ -0,0 +1,21 @@ +/* pages/process/order-check/index.wxss */ +.cate-list { + margin: 24rpx 30rpx; + border: 1rpx solid #dcdcdc; +} + +.cate-header { + min-height: 76rpx; + background-color: #dcdcdc; + padding: 0rpx 30rpx; +} + +.cate-index { + width: 32rpx; + height: 32rpx; + line-height: 32rpx; + text-align: center; + border-radius: 5000rpx; + border: 1px solid #666666; + margin-left: 12rpx +} diff --git a/pages/process/outside-list/index.js b/pages/process/outside-list/index.js new file mode 100644 index 0000000..f40bee0 --- /dev/null +++ b/pages/process/outside-list/index.js @@ -0,0 +1,164 @@ +// pages/process/order-list/index.js +import Scene from '../../index/scene' +import Dialog from '../../../components/dialog/dialog' +import { getFactoryOrderList, cancelOrder } from "../../../api/saas" +const event = require('../../../utils/event') +const util = require('../../../utils/util') +const app = getApp() + +//1-定价 2-待过皮重 3-待过榜审核 4-待付款 41-代付中 42-待结算 5-已完成 6-已关闭 +Scene({ + // * 页面的初始数据 + data: { + height: app.globalData.fragmentHeight - 90, + 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: 41 }, + {id: 6, name: '待结算', badge: 0, status: 42 }, + {id: 7, name: '已完成', badge: 0, status: 5 }, + // {id: 8, name: '已取消', badge: 0, status: 6 } + ], + loading: true, + requesting: false, + finished: false, + top: 0, + orderList: [], + form: { + funcType: 0, + pageNum: 1, + pageSize: 10 + }, + title: '全部', + lastTime: null + }, + // * 生命周期函数--监听页面加载 + onLoad: function (options) { + if(options.status){ + this.data.form.funcType = Number(options.status) + if(this.data.form.funcType == 1){ + this.data.title = '待定价订单' + } else if(this.data.form.funcType == 2){ + this.data.title = '过磅审核订单' + } else if(this.data.form.funcType == 3){ + this.data.title = '待付款订单' + } else if(this.data.form.funcType == 4){ + this.data.title = '已完成订单' + this.data.form.funcType = 6 + this.data.form.status = 5 + this.data.tabIndex = 7 + } else if(this.data.form.funcType == 5){ + this.data.title = '已关闭订单' + } + } + event.on('OrderMessage', this, this.onEvent) + this.setData({ height: app.globalData.fragmentHeight - 90, title: this.data.title, tabIndex: this.data.tabIndex }) + this.fetchOrderList() + }, + onEvent: function(message){ + if (message.what == 12) { + this.onRefreshList() + } + }, + onTabChange: function ({detail}) { + if (this.data.tabIndex == Number(detail.index)) { + return + } + this.setData({ tabIndex: detail.index, requesting: false }) + this.data.form.status = this.data.tabList[detail.index].status + this.onRefreshList() + }, + onRefreshList: function () { + if (this.data.requesting) { + return + } + this.setData({ orderList: [], ['form.pageNum']: 1, loading: true, finished: false }) + this.data.lastTime = null + this.fetchOrderList() + }, + //1:待定价,2:待过皮重,3:待过磅审核,4:待付款,5:已完成 + fetchOrderList: function () { + if (this.data.requesting || this.data.finished) { + return + } + if (this.data.loading) { + this.data.requesting = true + } else { + this.setData({ requesting: true }) + } + getFactoryOrderList(this.data.form).then(result => { + this.handResult(result) + }).catch(err => { + this.setData({ requesting: false, loading: false }) + util.showToast(err) + }).finally(() => { + this.refresh = this.refresh || this.selectComponent('#refresh') + this.refresh.setRefresh(false) + }) + }, + handResult: function(result){ + if (result.data && result.data.records && result.data.records.length) { + var respList = result.data.records + // 对返回的消息列表进行处理,将同一天的消息显示在一起 + for (let i = 0; i < respList.length; i++) { + if (util.isEmpty(this.data.lastTime)) { + this.data.lastTime = respList[i].createTime + if (this.data.lastTime.length > 10) { + this.data.lastTime = this.data.lastTime.substring(0, 10) + } + respList[i].tipsTime = this.data.lastTime + } else { + var itemTime = respList[i].createTime + if (itemTime.length > 10) { + itemTime = itemTime.substring(0, 10) + } + if (this.data.lastTime !== itemTime) { + respList[i].tipsTime = itemTime + } + this.data.lastTime = itemTime + } + } + 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 + this.setData({ [nowList]: respList, ['form.pageNum']: (num + 1), finished, requesting: false, loading: false }) + } else { + this.setData({ finished: true, requesting: false, loading: false }) + } + }, + cancelOrder: function(e){ + Dialog.confirm({ title: '温馨提示', message: '确定取消该订单?' }).then(() => { + wx.showLoading({ title: '正在获取', mask: true }) + cancelOrder(e.currentTarget.dataset.id).then(result => { + wx.hideLoading() + util.showToast('订单已经删除') + this.onRefreshList() + }).catch(err => { + wx.hideLoading() + util.showToast(err) + }) + }) + }, + 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}` }) + } else { + wx.navigateTo({ url: `/pages/process/order-info/index?id=${item.id}` }) + } + }, + 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-check/index' }) + }, + onUnload: function(){ + event.remove('OrderMessage', this) + } + +}) \ No newline at end of file diff --git a/pages/process/outside-list/index.json b/pages/process/outside-list/index.json new file mode 100644 index 0000000..5cc328a --- /dev/null +++ b/pages/process/outside-list/index.json @@ -0,0 +1,15 @@ +{ + "usingComponents": { + "refresh-view": "/components/refresh-view/index", + "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", + "van-dialog": "/components/dialog/index", + "notification": "/pages/message/notification/index" + } +} \ No newline at end of file diff --git a/pages/process/outside-list/index.wxml b/pages/process/outside-list/index.wxml new file mode 100644 index 0000000..93ae758 --- /dev/null +++ b/pages/process/outside-list/index.wxml @@ -0,0 +1,90 @@ + + + {{title}} + + + + + + + + + + + + + {{loading? '正在加载' : '暂无数据'}} + + + + + {{item.tipsTime}} + + + + + + 客户名称:{{item.factoryCustomerName}} + ({{item.factoryCustomerMobile}}) + + 毛重:{{item.totalWeight}}公斤 + + 品类:{{item.productName}} + 毛重:{{item.totalWeight}}公斤 + + + 品类:{{item.productName}} + 金额:{{item.settlePrice}}元 + + + + 取消 + 定价 + + + 待过皮重 + + + 审核 + + + + + + 客户名称:{{item.factoryCustomerName}} + ({{item.factoryCustomerMobile}}) + + + 待付款 + 代付中 + 待结算 + 已完成 + + + + 品类:{{item.productName}} + 重量:{{item.settleWeight}}公斤 + 金额:{{item.settlePrice}}元 + + + + + + + + + {{finished?'到底啦~':'加载中...'}} + + + + + + + + + + + \ No newline at end of file diff --git a/pages/process/outside-list/index.wxss b/pages/process/outside-list/index.wxss new file mode 100644 index 0000000..bc19567 --- /dev/null +++ b/pages/process/outside-list/index.wxss @@ -0,0 +1,7 @@ +/* pages/process/order-list/index.wxss */ +.item-content{ + padding: 20rpx 32rpx 20rpx 0rpx; + border-bottom:1rpx solid #f3f3f3; + margin-left:32rpx; + align-items: flex-start; +} \ No newline at end of file diff --git a/pages/process/outside-price/index.js b/pages/process/outside-price/index.js new file mode 100644 index 0000000..44ad042 --- /dev/null +++ b/pages/process/outside-price/index.js @@ -0,0 +1,98 @@ +// pages/process/order-check/index.js +import Scene from '../../index/scene' +import Dialog from '../../../components/dialog/dialog' +import { pricingOrder, getFactoryOrderInfo} from "../../../api/saas" +const event = require('../../../utils/event') +const util = require('../../../utils/util') +const app = getApp() + +Scene({ + /** + * 页面的初始数据 + */ + data: { + form: { + orderPapers: [{ productId: '', productName: '', unitPrice: ''}], + appointDate: null + } + }, + /** + * 生命周期函数--监听页面加载 + */ + 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) + }) + } + }, + 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) + }, + 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() + util.showBackToast('定价成功') + event.emit('OrderMessage', { what: 12, desc: 'pricingOrder' }) + }).catch(err => { + wx.hideLoading() + util.showToast(err) + }) + } +}) \ No newline at end of file diff --git a/pages/process/outside-price/index.json b/pages/process/outside-price/index.json new file mode 100644 index 0000000..076d4a4 --- /dev/null +++ b/pages/process/outside-price/index.json @@ -0,0 +1,19 @@ +{ + "usingComponents": { + "van-index-anchor": "/components/index-anchor/index", + "van-cell": "/components/cell/index", + "van-icon": "/components/icon/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", + "van-dialog": "/components/dialog/index", + "van-field": "/components/field/index", + "van-switch": "/components/switch/index", + "van-uploader": "/components/uploader/index", + "submit-layout": "/components/submit-layout/index", + "notification": "/pages/message/notification/index" + } +} \ No newline at end of file diff --git a/pages/process/outside-price/index.wxml b/pages/process/outside-price/index.wxml new file mode 100644 index 0000000..50acb30 --- /dev/null +++ b/pages/process/outside-price/index.wxml @@ -0,0 +1,184 @@ + + + 厂外收货 + + + + + + 客户姓名 + {{form.factoryCustomerName || '请选择客户'}} + + + + + 车牌号码 + {{form.plateNumber || '请输入车牌号码'}} + + + + + 司机 + {{form.driverName || '请选择司机'}} + + + + + 操作员 + {{form.operatorName || '请选择操作员'}} + + + + + 预计到厂时间 + {{form.appointDate || '请选择预计到厂时间'}} + + + + + + + + + 废纸品类{{index + 1}} + {{item.productName || '请选择废纸品类'}} + + + + + 预估单价(元/公斤) + {{item.unitPrice || '请输入单价'}} + + + + + + * + 毛重(公斤) + + + + + + + + * + 皮重(公斤) + + + + + + + 净重(公斤) + {{item.netWeight || ''}} + + + + + 预估金额(元) + {{item.price || ''}} + + + + + + * + 过磅凭证 + + 最多3张,每图片大小限制5M + + + + + + + * + 结算单价(元/公斤) + + + + + + + + + 扣重(公斤) + + + + + + + + + 扣点(%) + + + + + + + 结算重量(公斤) + {{form.settleWeight || '- -'}} + + + + + 结算金额(元) + {{form.settleWeight || '- -'}} + + + + + + + 总净重(公斤) + {{form.driverName || '请选择司机'}} + + + + + 预计总金额(元) + {{form.driverName || '请选择司机'}} + + + + + + * + 厂外皮重(公斤) + + + + + + + + * + 厂外毛重(公斤) + + + + + + + 取消 + 修改订单 + + + 保存 + 提交订单 + + + + \ No newline at end of file diff --git a/pages/process/outside-price/index.wxss b/pages/process/outside-price/index.wxss new file mode 100644 index 0000000..14a8a3a --- /dev/null +++ b/pages/process/outside-price/index.wxss @@ -0,0 +1,21 @@ +/* pages/process/order-check/index.wxss */ +.cate-list { + margin: 24rpx 30rpx; + border: 1rpx solid #dcdcdc; +} + +.cate-header { + min-height: 76rpx; + background-color: #dcdcdc; + padding: 0rpx 30rpx; +} + +.cate-index { + width: 32rpx; + height: 32rpx; + line-height: 32rpx; + text-align: center; + border-radius: 5000rpx; + border: 1px solid #666666; + margin-left: 12rpx +}