diff --git a/app.json b/app.json index dbe8ce7..26593c1 100644 --- a/app.json +++ b/app.json @@ -7,6 +7,7 @@ "pages/home/employee-info/index", "pages/home/customer-list/index", "pages/home/factory-list/index", + "pages/home/factory-info/index", "pages/home/customer-info/index", "pages/home/qrcode-info/index", "pages/home/factory-qrcode/index", @@ -15,6 +16,7 @@ "pages/ztbvip/payment/index", "pages/process/agent-list/index", "pages/process/order-list/index", + "pages/process/order-add/index", "pages/process/order-price/index", "pages/process/order-check/index", "pages/process/order-info/index", diff --git a/pages/home/customer-info/index.wxml b/pages/home/customer-info/index.wxml index 5fdb4cb..d60748c 100644 --- a/pages/home/customer-info/index.wxml +++ b/pages/home/customer-info/index.wxml @@ -3,7 +3,7 @@ - + diff --git a/pages/home/customer-list/index.wxml b/pages/home/customer-list/index.wxml index 50fb96e..f10e373 100644 --- a/pages/home/customer-list/index.wxml +++ b/pages/home/customer-list/index.wxml @@ -25,16 +25,14 @@ {{loading? '正在搜索' : '暂无数据'}} - + - - {{item.name || ''}} - - {{'电话号码:' + item.mobile}} - {{'卡号:' + item.cardNo}} - + {{item.name || ''}} + + {{'电话号码:' + item.mobile}} + {{'IC卡号:' + item.cardNo}} - 注册纸通宝 + @@ -45,17 +43,15 @@ {{pageItem.sign}} - + - - {{item.name || ''}} - - {{'电话号码:' + item.mobile}} - {{'卡号:' + item.cardNo}} - + {{item.name || ''}} + + {{'电话号码:' + item.mobile}} + {{'IC卡号:' + item.cardNo}} - 注册纸通宝 + diff --git a/pages/home/factory-info/index.js b/pages/home/factory-info/index.js new file mode 100644 index 0000000..0ff587c --- /dev/null +++ b/pages/home/factory-info/index.js @@ -0,0 +1,37 @@ +// pages/home/qrcode/index.js +import Scene from '../../index/scene' +import { getCustomerList } from "../../../api/saas" +const util = require('../../../utils/util') +const app = getApp() + +Scene({ + /** + * 页面的初始数据 + */ + data: { + settleType: '1', + paymentType: '1', + userInfo: {} + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ userInfo: app.userInfo}) + }, + onTypeChange: function({detail}){ + this.setData({ settleType: detail }) + }, + onTypeClick(e) { + this.setData({ settleType: e.currentTarget.dataset.name }) + }, + onPaymentChange: function({detail}){ + this.setData({ paymentType: detail }) + }, + onPaymentClick(e) { + this.setData({ paymentType: e.currentTarget.dataset.name }) + }, + submitForm: function () { + + } +}) \ No newline at end of file diff --git a/pages/home/factory-info/index.json b/pages/home/factory-info/index.json new file mode 100644 index 0000000..7988da0 --- /dev/null +++ b/pages/home/factory-info/index.json @@ -0,0 +1,10 @@ +{ + "usingComponents": { + "van-cell": "/components/cell/index", + "van-button": "/components/button/index", + "van-checkbox": "/components/checkbox/index", + "van-radio": "/components/radio/index", + "van-radio-group": "/components/radio-group/index", + "notification": "/pages/message/notification/index" + } +} \ No newline at end of file diff --git a/pages/home/factory-info/index.wxml b/pages/home/factory-info/index.wxml new file mode 100644 index 0000000..4df15b1 --- /dev/null +++ b/pages/home/factory-info/index.wxml @@ -0,0 +1,51 @@ + + + 工厂设置 + + + + + 收货结算金额设置 + + + + + + + + + + + + + + + + + 客户支付方式 + + + + + + + + + + + + + + + + + + + + + + + 保存 + + + diff --git a/pages/home/factory-info/index.wxss b/pages/home/factory-info/index.wxss new file mode 100644 index 0000000..65eec81 --- /dev/null +++ b/pages/home/factory-info/index.wxss @@ -0,0 +1 @@ +/* pages/home/qrcode/index.wxss */ \ No newline at end of file diff --git a/pages/home/index/index.wxml b/pages/home/index/index.wxml index af5fb67..71da03a 100644 --- a/pages/home/index/index.wxml +++ b/pages/home/index/index.wxml @@ -65,12 +65,18 @@ 银行卡 - + 出货渠道 + + + + 工厂设置 + + diff --git a/pages/home/qrcode-info/index.json b/pages/home/qrcode-info/index.json index 3a8753a..976edc8 100644 --- a/pages/home/qrcode-info/index.json +++ b/pages/home/qrcode-info/index.json @@ -1,5 +1,6 @@ { "usingComponents": { + "van-notice-bar": "/components/notice-bar/index", "van-button": "/components/button/index", "van-cell": "/components/cell/index", "van-image": "/components/image/index", diff --git a/pages/home/qrcode-info/index.wxml b/pages/home/qrcode-info/index.wxml index cdc84a4..35f23c1 100644 --- a/pages/home/qrcode-info/index.wxml +++ b/pages/home/qrcode-info/index.wxml @@ -2,13 +2,17 @@ {{type == 0 ? '客户' : '员工'}}电子卡 - + + {{form.name || form.enterpriseMemberName || ''}} - + + IC卡号:{{form.cardNo}} + + 联系电话:{{form.mobile || form.phone}} @@ -19,7 +23,7 @@ - + {{factoryName}} diff --git a/pages/home/user-info/index.wxml b/pages/home/user-info/index.wxml index ef07a31..0ebd891 100644 --- a/pages/home/user-info/index.wxml +++ b/pages/home/user-info/index.wxml @@ -34,9 +34,7 @@ @@ -65,7 +63,7 @@ 退出当前账号 - + 当前版本:{{version}} diff --git a/pages/process/order-add/index.js b/pages/process/order-add/index.js new file mode 100644 index 0000000..fc58a9a --- /dev/null +++ b/pages/process/order-add/index.js @@ -0,0 +1,215 @@ +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: { deductType: 1 }, + paperList: [], + imageList: [], + focus: 0, + visible: false, + amout: 0, + nowItem: null + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + wx.showLoading({ title: '正在获取', mask: true }) + getPaperList({pageNum: 1, pageSize: 100}).then(result => { + this.setData({ safeBottom: app.globalData.safeBottom, paperList: result.data.records }) + wx.hideLoading() + }).catch(err => { + wx.hideLoading() + this.setData({ safeBottom: app.globalData.safeBottom }) + util.showToast(err) + }) + }, + selectCustomer: function(){ + var that = this + wx.navigateTo({ + url: `/pages/home/customer-list/index?type=1`, + events: { + onCallback: (data) => { + if (data.what == 130) { + that.data.form.factoryCustomerId = data.detail.id + that.setData({ ['form.factoryCustomerName']: data.detail.name }) + } + } + } + }) + }, + 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(e){ + this.data.cIndex = e.currentTarget.dataset.index + this.data.nowItem = this.data.paperList[this.data.cIndex] + if(this.data.form.productId == this.data.nowItem.id){ + this.onHide() + return + } + this.data.form.productId = this.data.nowItem.id + // this.data.form.unitPrice = this.data.nowItem.defaultUnitPrice + this.data.form.konePrice = '指导价格:' + this.data.nowItem.defaultUnitPrice + this.data.form.unitPrice = '' + this.data.form.productName = this.data.nowItem.name + if(util.isEmpty(this.data.form.netWeight) || Number(this.data.form.netWeight) <= 0){ + this.setData({ visible: false, form: this.data.form, amout: null }) + return + } + this.statAmount() + }, + onHide: function(){ + this.setData({ visible: false }) + }, + changeDeductType: function(e){ + var type = Number(e.currentTarget.dataset.type) + this.setData({ ['form.deductType']: type, focus: type }) + }, + bindInput: function (e) { + this.data.form[e.target.id] = e.detail + if(e.target.id == 'totalWeight' || e.target.id == 'emptyWeight'){ + if(!util.isEmpty(this.data.form.totalWeight) && !util.isEmpty(this.data.form.emptyWeight)){ + this.setData({ ['form.netWeight']: math.minus(this.data.form.totalWeight, this.data.form.emptyWeight) }) + } + } else if(e.target.id == 'deductPercent'){ + if(util.isEmpty(e.detail)){ + this.data.form.deductWeight = null + this.data.form.deductPercent = null + } else { + this.data.form.deductWeight = math.divide(math.times(this.data.form.netWeight, Number(e.detail)), 100).toFixed(2) + } + } else if(e.target.id == 'deductWeight'){ + if(util.isEmpty(e.detail)){ + this.data.form.deductWeight = null + this.data.form.deductPercent = null + } else { + this.data.form.deductPercent = math.times(math.divide(Number(e.detail), this.data.form.netWeight), 100).toFixed(2) + } + } + this.statAmount() + }, + statAmount: function(){ + if(util.isEmpty(this.data.form.netWeight)){ + return + } + 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, cIndex: this.data.cIndex }) + }, + fileChange: function({detail}){ + this.data.imageList = detail.fileList + var imageUrls = [] + for (let index = 0; index < this.data.imageList.length; index++) { + imageUrls.push(this.data.imageList[index].url) + } + this.data.form.orderImageList = imageUrls + }, + checkOrder: function(){ + if(util.isEmpty(this.data.form.factoryCustomerId)){ + util.showToast('请选择客户') + return + } + if(util.isEmpty(this.data.form.netWeight)){ + util.showToast('请输入净重') + return + } + if(Number(this.data.form.netWeight) <= 0){ + util.showToast('净重不能小于零') + return + } + 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 + } + + 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.deductType = this.data.form.deductType + data.unitPrice = Number(this.data.form.unitPrice) + var factoryCustomerId = this.data.form.factoryCustomerId + + var that = this + wx.requestSubscribeMessage({ + tmplIds: ['DJaSy0a5TNp9v_ICQ0ZY5-hkZ91dEXZuKq_hQVBTnOA', '4IWtlcg1HhLN7AFepB3VeZF-4D0b9gbjwWBruKMhAJM'], + complete(res) { + wx.showLoading({ title: '处理中', mask: true }) + checkingOrder({ id: that.data.form.id, factoryCustomerId, 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/order-add/index.json b/pages/process/order-add/index.json new file mode 100644 index 0000000..1b50c29 --- /dev/null +++ b/pages/process/order-add/index.json @@ -0,0 +1,19 @@ +{ + "usingComponents": { + "van-field": "/components/field/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-grid": "/components/grid/index", + "van-grid-item": "/components/grid-item/index", + "van-icon": "/components/icon/index", + "van-popup": "/components/popup/index", + "vehicle-keyboard": "/components/vehicle-keyboard/index", + "submit-layout": "/components/submit-layout/index", + "vip-dialog": "/pages/message/vip-dialog/index", + "van-uploader": "/components/uploader/index", + "notification": "/pages/message/notification/index" + } +} \ No newline at end of file diff --git a/pages/process/order-add/index.wxml b/pages/process/order-add/index.wxml new file mode 100644 index 0000000..5cc8af3 --- /dev/null +++ b/pages/process/order-add/index.wxml @@ -0,0 +1,107 @@ + + + 新增厂内收货订单 + + + + + 磅单信息 + + + + + * + 客户姓名 + + {{form.factoryCustomerName || '请输选择客户'}} + + + + + 车牌号码 + {{form.plateNumber || '请输入车牌号码'}} + + + + + + + + + * + 净重(公斤) + + + + + 定价信息 + + + + + * + 废纸品类 + + {{form.productName || '请选择废纸品类'}} + + + + + * + 单价(元/公斤) + + + + + + 扣重(公斤) + + + + + + 扣点(%) + + + + + 结算重量(公斤) + {{form.settleWeight || '- -'}} + + + + + 订单凭证 + 2张以内,每张图片大小限制5M + + + + + + + 结算金额: + {{amout || '- -'}} + + 提交订单 + + + + + + + 选择纸品 + + + + + + + + {{item.name}} + + + + + + + \ No newline at end of file diff --git a/pages/process/order-add/index.wxss b/pages/process/order-add/index.wxss new file mode 100644 index 0000000..61828e3 --- /dev/null +++ b/pages/process/order-add/index.wxss @@ -0,0 +1,57 @@ +/* pages/process/order-check/index.wxss */ +.page-icon { + margin-right: 24rpx; +} + +.margin-top{ + margin-top: 16rpx; +} + +.big-icon{ + margin-top: 24rpx; +} + +.van-picker__toolbar { + display: -webkit-flex; + display: flex; + -webkit-justify-content: space-between; + justify-content: space-between; + height: 44px; + height: var(--picker-toolbar-height, 44px); + line-height: 44px; + line-height: var(--picker-toolbar-height, 44px) +} + +.van-picker__cancel { + padding: 0 16px; + width: 96rpx; + padding: var(--picker-action-padding, 0 16px); + font-size: 14px; + font-size: var(--picker-action-font-size, 14px); + color: #666666; + color: var(--picker-action-text-color, #666666) +} + +.van-picker__confirm { + padding: 0 24rpx; + padding: var(--picker-action-padding, 0 24rpx); + font-size: 14px; + font-size: var(--picker-action-font-size, 14px); + color: #1989fa; + color: var(--picker-action-text-color, #1989fa) +} + +.van-picker__cancel--hover, +.van-picker__confirm--hover { + background-color: #f2f3f5; + background-color: var(--picker-action-active-color, #f2f3f5) +} + +.van-picker__title { + max-width: 50%; + text-align: center; + font-weight: 500; + font-weight: var(--font-weight-bold, 500); + font-size: 16px; + font-size: var(--picker-option-font-size, 16px) +} \ No newline at end of file diff --git a/pages/process/order-info/index.wxml b/pages/process/order-info/index.wxml index 3b05df9..37ba078 100644 --- a/pages/process/order-info/index.wxml +++ b/pages/process/order-info/index.wxml @@ -175,12 +175,16 @@ 取消订单 - 重新过皮重 - 通过审核 + 取消订单 + 重新过皮重 + 通过审核 - - 进行支付 - 客户结算 + + 取消订单 + 进行支付 + + + 客户结算 diff --git a/pages/process/order-list/index.js b/pages/process/order-list/index.js index b7c5e41..1c92bdd 100644 --- a/pages/process/order-list/index.js +++ b/pages/process/order-list/index.js @@ -136,7 +136,7 @@ Scene({ this.setData({ finished: true, requesting: false, loading: false }) } }, - cancelOrder: function(e){ + cancelItem: function(e){ Dialog.confirm({ title: '温馨提示', message: '确定取消该订单?' }).then(() => { wx.showLoading({ title: '正在获取', mask: true }) cancelOrder(e.currentTarget.dataset.id).then(result => { @@ -169,6 +169,9 @@ Scene({ loggerItem: function(e){ wx.navigateTo({url: `/pages/process/order-logger/index?type=1&orderId=${e.currentTarget.dataset.id}` }) }, + addOrder: function(){ + wx.navigateTo({ url: '/pages/process/order-add/index' }) + }, paymentItem: function (e) { var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index] if(!this.data.admin) { diff --git a/pages/process/order-list/index.wxml b/pages/process/order-list/index.wxml index 7ed5585..734edfa 100644 --- a/pages/process/order-list/index.wxml +++ b/pages/process/order-list/index.wxml @@ -64,8 +64,8 @@ - 取消订单 + 定价 + + + + + \ No newline at end of file diff --git a/pages/process/outside-info/index.js b/pages/process/outside-info/index.js index fbda558..4b8572b 100644 --- a/pages/process/outside-info/index.js +++ b/pages/process/outside-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 { repeatSideOrder, getSideOrderInfo, printOrder} from "../../../api/saas" +import { repeatSideOrder, getSideOrderInfo, printOrder, cancelOrder} from "../../../api/saas" const event = require('../../../utils/event') const util = require('../../../utils/util') const math = require('../../../utils/math') @@ -76,15 +76,39 @@ Scene({ result.data.paymentOrderInfo.lessPrice = 0.00 } } - this.setData({ form: result.data, admin: app.userInfo.type && app.userInfo.type.indexOf('ADMIN') >= 0, agent: this.data.agent, imageList,safeBottom: app.globalData.safeBottom }) + this.setData({ + form: result.data, + admin: app.userInfo.type && app.userInfo.type.indexOf('ADMIN') >= 0, + agent: this.data.agent, + imageList,safeBottom: app.globalData.safeBottom + }) }).catch(err => { wx.hideLoading() util.showToast(err) }) }, + repeatOrder: function(){ + wx.navigateTo({url: `/pages/process/outside-check/index?id=${this.data.id}` }) + }, orderLogger: function(){ wx.navigateTo({url: `/pages/process/order-logger/index?type=1&orderId=${this.data.id}` }) }, + cancelOrderInfo: function(e){ + Dialog.confirm({ title: '温馨提示', message: '确定取消该订单?' }).then(() => { + this.cancelOrder() + }) + }, + cancelOrder: function(){ + wx.showLoading({ title: '正在处理', mask: true }) + cancelOrder(this.data.form.scrapPaperReceiptId).then(result => { + wx.hideLoading() + util.showBackToast('订单已经取消') + event.emit('OrderMessage', { what: 12, desc: 'cancelOrder' }) + }).catch(err => { + wx.hideLoading() + util.showToast(err) + }) + }, printOrderInfo: function(){ wx.showLoading({ title: '正在处理', mask: true }) printOrder({id: this.data.id, printType: 2}).then(result => { diff --git a/pages/process/outside-info/index.wxml b/pages/process/outside-info/index.wxml index c640127..dbd2500 100644 --- a/pages/process/outside-info/index.wxml +++ b/pages/process/outside-info/index.wxml @@ -218,18 +218,19 @@ - - 金额: - {{formate.formateAmount(form.settleTotalAmount, 2)}} - - 通过审核 + 取消订单 + 重新定价 + 通过审核 + + + 取消订单 + 进行支付 - + 金额: {{formate.formateAmount(form.settleTotalAmount, 2)}} - 进行支付 客户结算 diff --git a/pages/process/outside-list/index.js b/pages/process/outside-list/index.js index 87aed83..cf0755b 100644 --- a/pages/process/outside-list/index.js +++ b/pages/process/outside-list/index.js @@ -125,7 +125,7 @@ Scene({ this.refresh.setRefresh(false) }) }, - cancelOrder: function(e){ + cancelItem: function(e){ Dialog.confirm({ title: '温馨提示', message: '确定取消该订单?' }).then(() => { wx.showLoading({ title: '正在获取', mask: true }) cancelOrder(e.currentTarget.dataset.id).then(result => { @@ -146,16 +146,14 @@ Scene({ var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index] if(item.orderStatus == 0 || item.orderStatus == 1){ wx.navigateTo({ url: `/pages/process/outside-price/index?id=${item.orderId}` }) - } else if(item.orderStatus == 4 || item.orderStatus == 42){ - if(this.data.admin) { - wx.navigateTo({ url: `/pages/process/payment/index?id=${item.orderId}` }) - } else { - wx.navigateTo({ url: `/pages/process/outside-info/index?id=${item.orderId}` }) - } } else { wx.navigateTo({ url: `/pages/process/outside-info/index?id=${item.orderId}` }) } }, + paymentItem: function(e){ + var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index] + wx.navigateTo({ url: `/pages/process/payment/index?id=${item.orderId}` }) + }, orderLogger: function(e){ wx.navigateTo({url: `/pages/process/order-logger/index?type=1&orderId=${e.currentTarget.dataset.id}` }) }, diff --git a/pages/process/outside-list/index.wxml b/pages/process/outside-list/index.wxml index 718f784..1852a67 100644 --- a/pages/process/outside-list/index.wxml +++ b/pages/process/outside-list/index.wxml @@ -60,8 +60,8 @@ - 取消订单 + 修改订单 审核订单 去支付 + bind:click="paymentItem" wx:if="{{item.orderStatus == 4 && admin}}">去支付 去结算 + bind:click="paymentItem" wx:if="{{item.orderStatus == 42 && admin}}">去结算 查看日志 diff --git a/pages/process/payment/index.wxml b/pages/process/payment/index.wxml index f59a2bf..528bf45 100644 --- a/pages/process/payment/index.wxml +++ b/pages/process/payment/index.wxml @@ -22,15 +22,15 @@ - - - + + + diff --git a/pages/storage/order-create/index.js b/pages/storage/order-create/index.js index 3782c88..e233efd 100644 --- a/pages/storage/order-create/index.js +++ b/pages/storage/order-create/index.js @@ -17,7 +17,8 @@ Scene({ activeNames: ['1'], paperList: [], visible: false, - cIndex: -1 + cIndex: -1, + imageList: [] }, /** * 生命周期函数--监听页面加载 @@ -53,6 +54,16 @@ Scene({ wx.hideLoading() util.showToast(err) }) + } else { + wx.showLoading({ title: '正在获取', mask: true }) + getPaperList({pageNum: 1, pageSize: 100}).then(result => { + this.setData({ safeBottom: app.globalData.safeBottom, paperList: result.data.records }) + wx.hideLoading() + }).catch(err => { + wx.hideLoading() + this.setData({ safeBottom: app.globalData.safeBottom }) + util.showToast(err) + }) } }, chooseList: function(e){ @@ -100,7 +111,9 @@ Scene({ wx.showLoading({ title: '正在获取', mask: true }) getPaperList({pageNum: 1, pageSize: 100}).then(result => { this.setData({ visible: true, paperList: result.data.records }) + wx.hideLoading() }).catch(err => { + wx.hideLoading() util.showToast(err) }) } else { @@ -114,32 +127,49 @@ Scene({ this.data.cIndex = e.currentTarget.dataset.index this.data.nowItem = this.data.paperList[this.data.cIndex] this.data.form.productId = this.data.nowItem.id - var unitPrice = this.data.nowItem.defaultUnitPrice - var amount = '' - if(!util.isEmpty(unitPrice) && Number(unitPrice) > 0){ - this.data.form.unitPrice = math.times(unitPrice, 1000) - amount = math.times(unitPrice, this.data.poundInfo.netWeight) - } - this.setData({ visible: false, - ['form.productName']: this.data.nowItem.name, - ['form.unitPrice']: this.data.form.unitPrice, ['form.estimatedAmount']: amount, cIndex: this.data.cIndex }) + this.data.form.productName = this.data.nowItem.name + this.data.form.konePrice = '指导价格:' + math.times(this.data.nowItem.defaultUnitPrice, 1000) + this.data.form.unitPrice = '' + this.statAmount() }, onChange: function({detail}) { this.setData({ activeNames: detail }) }, bindInput: function (e) { this.data.form[e.currentTarget.id] = e.detail - if(e.currentTarget.id == 'unitPrice'){ - var amount = '' - if(!util.isEmpty(this.data.form.unitPrice) && Number(this.data.form.unitPrice) > 0){ - amount = math.divide(math.times(this.data.form.unitPrice, this.data.poundInfo.netWeight), 1000) + if(e.target.id == 'totalWeight' || e.target.id == 'emptyWeight'){ + if(!util.isEmpty(this.data.form.totalWeight) && !util.isEmpty(this.data.form.emptyWeight)){ + this.data.form.netWeight = math.minus(this.data.form.totalWeight, this.data.form.emptyWeight) } - this.setData({ visible: false, ['form.estimatedAmount']: amount }) - } + } + this.statAmount() + }, + statAmount: function(){ + if(util.isEmpty(this.data.form.netWeight) && util.isEmpty(this.data.poundInfo)){ + this.setData({ visible: false, form: this.data.form, cIndex: this.data.cIndex }) + return + } + this.data.form.settleWeight = this.data.form.netWeight + if(!util.isEmpty(this.data.form.unitPrice) && Number(this.data.form.unitPrice) > 0 && !util.isEmpty(this.data.form.settleWeight)){ + this.data.form.estimatedAmount = math.divide(math.times(this.data.form.unitPrice, this.data.form.settleWeight), 1000) + } else if(!util.isEmpty(this.data.form.unitPrice) && Number(this.data.form.unitPrice) > 0 && !util.isEmpty(this.data.poundInfo.netWeight)){ + this.data.form.estimatedAmount = math.divide(math.times(this.data.form.unitPrice, this.data.poundInfo.netWeight), 1000) + } else { + this.data.form.estimatedAmount = null + } + this.setData({ visible: false, form: this.data.form, cIndex: this.data.cIndex }) }, onInputChange: function(e){ this.data.form[e.currentTarget.id] = e.detail }, + fileChange: function({detail}){ + this.data.imageList = detail.fileList + var imageUrls = [] + for (let index = 0; index < this.data.imageList.length; index++) { + imageUrls.push(this.data.imageList[index].url) + } + this.data.form.orderImageList = imageUrls + }, submitForm: function(){ if(util.isEmpty(this.data.form.consigneeName)){ util.showToast('请选择出货方名称') @@ -153,6 +183,14 @@ Scene({ util.showToast('请输入车牌号码') return } + if(util.isEmpty(this.data.form.netWeight)){ + util.showToast('请输入净重') + return + } + if(Number(this.data.form.netWeight) <= 0){ + util.showToast('净重不能小于零') + return + } this.data.form.weightNoteId = this.data.poundInfo.id wx.showLoading({ title: '正在处理', mask: true }) createOutOrder(this.data.form).then(result => { diff --git a/pages/storage/order-create/index.json b/pages/storage/order-create/index.json index 576c3b7..7db5740 100644 --- a/pages/storage/order-create/index.json +++ b/pages/storage/order-create/index.json @@ -14,6 +14,7 @@ "vehicle-keyboard": "/components/vehicle-keyboard/index", "van-collapse": "/components/collapse/index", "van-collapse-item": "/components/collapse-item/index", + "van-uploader": "/components/uploader/index", "submit-layout": "/components/submit-layout/index", "vip-dialog": "/pages/message/vip-dialog/index", "notification": "/pages/message/notification/index" diff --git a/pages/storage/order-create/index.wxml b/pages/storage/order-create/index.wxml index 20aea60..2d7e77f 100644 --- a/pages/storage/order-create/index.wxml +++ b/pages/storage/order-create/index.wxml @@ -46,10 +46,10 @@ + + - - - + @@ -103,8 +103,31 @@ + + + + 磅单信息 + + + + + + + + * + 净重(公斤) + + + + + 出货凭证 + 4张以内,每张图片大小限制5M + + + + - + 提交 diff --git a/pages/storage/order-info/index.wxml b/pages/storage/order-info/index.wxml index 8eceb3e..bd828f8 100644 --- a/pages/storage/order-info/index.wxml +++ b/pages/storage/order-info/index.wxml @@ -162,6 +162,30 @@ {{ form.settlePrice}} + + + 代卖费(元) + {{ form.settlePrice}} + + + + + 运费(元) + {{ form.settlePrice}} + + + + + 其他费用(元) + {{ form.settlePrice}} + + + + + 补贴(元) + {{ form.settlePrice}} + + 纸厂磅单 diff --git a/pages/storage/order-list/index.js b/pages/storage/order-list/index.js index 9ad6dc6..9821a19 100644 --- a/pages/storage/order-list/index.js +++ b/pages/storage/order-list/index.js @@ -35,15 +35,16 @@ Scene({ onLoad: function (options) { if(!util.isEmpty(options.status) || Number(options.status) == 0){ this.data.form.status = Number(options.status) + var tabIndex = this.data.tabIndex for (let index = 0; index < this.data.tabList.length; index++) { if(this.data.tabList[index].status === Number(options.status)){ - this.data.tabIndex = index + tabIndex = index break } } - this.setData({ height: app.globalData.fragmentHeight - 90, tabIndex: this.data.tabIndex }) + this.setData({ height: app.globalData.fragmentHeight - 90, tabIndex, admin: app.userInfo.type && app.userInfo.type.indexOf('ADMIN') >= 0}) } else { - this.setData({ height: app.globalData.fragmentHeight - 90 }) + this.setData({ height: app.globalData.fragmentHeight - 90, admin: app.userInfo.type && app.userInfo.type.indexOf('ADMIN') >= 0 }) } event.on('OrderMessage', this, this.onEvent) this.fetchOrderList() @@ -125,11 +126,11 @@ Scene({ } }, cancelOrder: function(e){ - Dialog.confirm({ title: '温馨提示', message: '确定取消该订单?' }).then(() => { + Dialog.confirm({ title: '温馨提示', message: '确定取消该磅单?' }).then(() => { wx.showLoading({ title: '正在获取', mask: true }) cancelOrder(e.currentTarget.dataset.id).then(result => { wx.hideLoading() - util.showToast('订单已经取消') + util.showToast('磅单已经取消') this.onRefreshList() }).catch(err => { wx.hideLoading() @@ -145,6 +146,9 @@ Scene({ wx.navigateTo({ url: `/pages/storage/order-info/index?id=${item.id}` }) ] }, + addStorageOrder: function(){ + wx.navigateTo({ url: `/pages/storage/order-create/index` }) + }, onUnload: function(){ event.remove('OrderMessage', this) } diff --git a/pages/storage/order-list/index.wxml b/pages/storage/order-list/index.wxml index fd20bd7..8c89842 100644 --- a/pages/storage/order-list/index.wxml +++ b/pages/storage/order-list/index.wxml @@ -66,6 +66,10 @@ + + + + diff --git a/pages/storage/order-settlement/index.js b/pages/storage/order-settlement/index.js index 454362a..ccc36b2 100644 --- a/pages/storage/order-settlement/index.js +++ b/pages/storage/order-settlement/index.js @@ -177,6 +177,9 @@ Scene({ wx.hideLoading() util.showToast(err) }) + }, + saveForm: function(){ + }, settlementForm: function(){ if(util.isEmpty(this.data.form.categoryId) || Number(this.data.form.categoryId) <= 0){ diff --git a/pages/storage/order-settlement/index.wxml b/pages/storage/order-settlement/index.wxml index 84c1179..27c30c1 100644 --- a/pages/storage/order-settlement/index.wxml +++ b/pages/storage/order-settlement/index.wxml @@ -34,6 +34,10 @@ + + + + @@ -156,8 +160,9 @@ - 关闭订单 - 确认收款 + 关闭订单 + 保存 + 确认收款 diff --git a/pages/storage/pound-info/index.js b/pages/storage/pound-info/index.js index 695add4..09ed745 100644 --- a/pages/storage/pound-info/index.js +++ b/pages/storage/pound-info/index.js @@ -65,11 +65,11 @@ Scene({ }) }, deleteForm: function(){ - Dialog.confirm({ title: '温馨提示', message: '确定删除该磅单?' }).then(() => { + Dialog.confirm({ title: '温馨提示', message: '确定取消该磅单?' }).then(() => { wx.showLoading({ title: '正在处理', mask: true }) deletePound({id: this.data.form.id}).then(result => { wx.hideLoading() - util.showBackToast('磅单已经删除') + util.showBackToast('磅单已经取消') event.emit('OrderMessage', { what: 20, desc: 'cancelPound' }) }).catch(err => { wx.hideLoading() diff --git a/pages/storage/pound-list/index.wxml b/pages/storage/pound-list/index.wxml index fe42503..2f90a32 100644 --- a/pages/storage/pound-list/index.wxml +++ b/pages/storage/pound-list/index.wxml @@ -46,7 +46,7 @@ {{item.operaterName}} - 取消磅单 关联出货单 diff --git a/utils/util.js b/utils/util.js index bbbfbf2..056d399 100644 --- a/utils/util.js +++ b/utils/util.js @@ -101,16 +101,18 @@ function showBackToast(content) { }, 500) return } - wx.showToast({ - title: content, - icon: 'none', - duration: 500, - success: function () { - setTimeout(function () { - wx.navigateBack() - }, 500) - } - }) + setTimeout(function () { + wx.showToast({ + title: content, + icon: 'none', + duration: 500, + success: function () { + setTimeout(function () { + wx.navigateBack() + }, 500) + } + }) + }, 20) } /* 验证手机号 */