diff --git a/api/saas.js b/api/saas.js index 2321c50..c173995 100644 --- a/api/saas.js +++ b/api/saas.js @@ -18,6 +18,7 @@ const getBaseInfo = () => mGet(`/ztb-factory/get/self-enterprise-profile-detail` const getBankList = () => mGet(`/ztb-factory/get/bank-list`, null, sconfig) const getStatisticsInfo = (params) => mGet(`/ztb-factory/get/my-workbench-statistics-info`, params, sconfig) const bindingFactory = (params) => mPost(`/recycle-user-center/bind/factory-admin`, params, sconfig) +const configFactory = (params) => mPost(`/recycle-user-center/save/factory-basic-config`, params, sconfig) const getFactoryLicence = () => mGet(`/recycle-user-center/get/latest-factory-licence`, null, sconfig) const getOrderList = (params) => mGet(`/ztb-factory/factory-customer/get/order-list`, params, sconfig) const getReceiptList = (params) => mGet(`/ztb-factory/factory/get/order-receipt-proof-audit-list`, params, sconfig) @@ -25,6 +26,7 @@ const getPeymentList = (params) => mGet(`/ztb-factory/get/order-pay-list`, param const getOrderInfo = (id) => mGet(`/ztb-factory/factory-customer/get/order-detail/${id}`, null, sconfig) const pricingOrder = (params) => mPost(`/ztb-factory/factory/submit/order-price`, params, sconfig) const cancelOrder = (id) => mPost(`/ztb-factory/factory/cancel/order/${id}`, null, sconfig) +const createInOrder = (params) => mPost(`/ztb-factory/save/scrap-paper-onside-receipt-order`, params, sconfig) const repeatOrder = (id) => mPost(`/ztb-factory/factory/renew/empty-weight/${id}`, null, sconfig) const repeatPrice = (id) => mPost(`/ztb-factory/factory/renew/order-price/${id}`, null, sconfig) const checkingOrder = (params) => mPost(`/ztb-factory/factory/audit-pass/order`, params, sconfig) @@ -73,6 +75,7 @@ const closeOutOrder = (params) => mPost(`/ztb-factory/close/outbound-delivery-or const auditOutOrder = (params) => mPost(`/ztb-factory/audit/outbount-delivery-order`, params, sconfig) const receiptOutOrder = (params) => mPost(`/ztb-factory/confirm/outbound-delivery-order-receipt`, params, sconfig) const createOutOrder = (params) => mPost(`/ztb-factory/relevancy/weight-note/and/outbound-delivery-order`, params, sconfig) +const recordOutOrder = (params) => mPost(`/ztb-factory/save/outbound-delivery-order`, params, sconfig) const bindBankCard = (params) => mPost(`/ztb-factory/factory/binding/bank-card`, params, sconfig) const getBankCardList = () => mGet(`/ztb-factory/get/factory-bank-card-list`, null, sconfig) const deleteBankcard = (params) => mPost(`/ztb-factory/delete/factory-bank-card`, params, sconfig) @@ -99,6 +102,7 @@ export { getBaseInfo, getBankList, getUserInfo, + configFactory, bindingFactory, getFactoryOrderList, getFactoryOrderInfo, @@ -112,6 +116,7 @@ export { pricingOrder, paymentOrder, cancelOrder, + createInOrder, getPaperPrice, getCategoryList, getPaperInfo, @@ -148,6 +153,7 @@ export { auditOutOrder, receiptOutOrder, createOutOrder, + recordOutOrder, bindBankCard, getBankCardList, deleteBankcard, diff --git a/pages/home/factory-info/index.js b/pages/home/factory-info/index.js index 0ff587c..cab3aae 100644 --- a/pages/home/factory-info/index.js +++ b/pages/home/factory-info/index.js @@ -1,6 +1,6 @@ // pages/home/qrcode/index.js import Scene from '../../index/scene' -import { getCustomerList } from "../../../api/saas" +import { configFactory } from "../../../api/saas" const util = require('../../../utils/util') const app = getApp() @@ -9,29 +9,37 @@ Scene({ * 页面的初始数据 */ data: { + settlePriceType: '1', settleType: '1', - paymentType: '1', userInfo: {} }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - this.setData({ userInfo: app.userInfo}) + this.setData({ settlePriceType: String(app.userInfo.factory.settlePriceType), settleType: String(app.userInfo.factory.settleType)}) }, onTypeChange: function({detail}){ - this.setData({ settleType: detail }) + this.setData({ settlePriceType: detail }) }, onTypeClick(e) { - this.setData({ settleType: e.currentTarget.dataset.name }) + this.setData({ settlePriceType: e.currentTarget.dataset.name }) }, onPaymentChange: function({detail}){ - this.setData({ paymentType: detail }) + this.setData({ settleType: detail }) }, onPaymentClick(e) { - this.setData({ paymentType: e.currentTarget.dataset.name }) + this.setData({ settleType: e.currentTarget.dataset.name }) }, submitForm: function () { - + wx.showLoading({ title: '处理中', mask: true }) + var data = {settlePriceType: Number(this.data.settlePriceType), settleType: Number(this.data.settleType) } + configFactory(data).then(result => { + wx.hideLoading() + util.showBackToast('保存成功') + }).catch(err => { + wx.hideLoading() + util.showToast(err) + }) } }) \ No newline at end of file diff --git a/pages/home/factory-info/index.wxml b/pages/home/factory-info/index.wxml index 4df15b1..b37ad24 100644 --- a/pages/home/factory-info/index.wxml +++ b/pages/home/factory-info/index.wxml @@ -7,7 +7,7 @@ 收货结算金额设置 - + @@ -24,7 +24,7 @@ 客户支付方式 - + diff --git a/pages/index/index.js b/pages/index/index.js index 9e64387..33aab77 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -165,6 +165,13 @@ Scene({ } else { app.userInfo.type = element.factoryInfos[detail.index].type || '' } + for (let nIndex = element.factoryInfos.length - 1; nIndex >= 0; nIndex--) { + const item = element.factoryInfos[nIndex] + if(item.factoryId == detail.id){ + app.userInfo.factory = item + break + } + } headerFactoryId(detail.id) var pageView = this.selectComponent('#' + this.data.tabList[this.data.tabIndex].value) if (pageView && this.data.tabIndex != 3) { diff --git a/pages/login/index.js b/pages/login/index.js index 73eb722..8c9fc3a 100644 --- a/pages/login/index.js +++ b/pages/login/index.js @@ -69,11 +69,11 @@ Page({ const item = element.factoryInfos[nIndex] if(storageFactoryId){ if(item.factoryId == storageFactoryId){ - return item.factoryId + return item } } else { if(item.factoryId){ - return item.factoryId + return item } } } @@ -82,14 +82,18 @@ Page({ }, toIndex: function(){ var factoryId = storage.get('X-FACTORY-ID' + app.userInfo.userId) + var factory = null if(factoryId){ // 有可能被移除了,缓存的factoryId还在,那要进行处理 - factoryId = this.checkFactoryId(factoryId) + factory = this.checkFactoryId(factoryId) + if(factory) { + factoryId = factory.factoryId + } } if(!factoryId){ - factoryId = this.checkFactoryId() - if(factoryId){ - storage.put('X-FACTORY-ID' + app.userInfo.userId, factoryId) + factory = this.checkFactoryId() + if(factory) { + factoryId = factory.factoryId } } if(!factoryId){ @@ -98,6 +102,10 @@ Page({ }) return } + if(factoryId){ + storage.put('X-FACTORY-ID' + app.userInfo.userId, factoryId) + } + app.userInfo.factory = factory app.userInfo.factoryId = factoryId headerFactoryId(app.userInfo.factoryId) if(this.data.path) { diff --git a/pages/process/order-add/index.js b/pages/process/order-add/index.js index fc58a9a..980a497 100644 --- a/pages/process/order-add/index.js +++ b/pages/process/order-add/index.js @@ -1,5 +1,5 @@ import Scene from '../../index/scene' -import { checkingOrder, getFactoryOrderInfo, getPaperList} from "../../../api/saas" +import { createInOrder, getPaperList} from "../../../api/saas" const event = require('../../../utils/event') const util = require('../../../utils/util') const math = require('../../../utils/math') @@ -12,7 +12,7 @@ Scene({ data: { safeBottom: app.globalData.safeBottom, paperList: null, - form: { deductType: 1 }, + form: { deductType: 1, isWithoutTare: 0 }, paperList: [], imageList: [], focus: 0, @@ -116,8 +116,8 @@ Scene({ 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) + if(!util.isEmpty(this.data.form.settleUnitPrice) && Number(this.data.form.settleUnitPrice) > 0){ + this.data.amout = math.times(this.data.form.settleWeight, this.data.form.settleUnitPrice) } else { this.data.amout = null } @@ -129,7 +129,7 @@ Scene({ for (let index = 0; index < this.data.imageList.length; index++) { imageUrls.push(this.data.imageList[index].url) } - this.data.form.orderImageList = imageUrls + this.data.form.receiptImageList = imageUrls }, checkOrder: function(){ if(util.isEmpty(this.data.form.factoryCustomerId)){ @@ -148,12 +148,12 @@ Scene({ util.showToast('请选择纸品品类') return } - if(util.isEmpty(this.data.form.unitPrice) || Number(this.data.form.unitPrice) <= 0){ + if(util.isEmpty(this.data.form.settleUnitPrice) || Number(this.data.form.settleUnitPrice) <= 0){ util.showToast('请输入单价') return } if(this.data.nowItem){ - if(this.data.nowItem.highestUnitPrice && Number(this.data.form.unitPrice) > Number(this.data.nowItem.highestUnitPrice)){ + if(this.data.nowItem.highestUnitPrice && Number(this.data.form.settleUnitPrice) > Number(this.data.nowItem.highestUnitPrice)){ util.showToast('输入单价过高,价格范围:' + this.data.nowItem.lowestUnitPrice + '元/公斤-'+ this.data.nowItem.highestUnitPrice + '元/公斤') return } @@ -170,34 +170,20 @@ Scene({ 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) + this.data.form.deductWeight = Number(this.data.form.deductWeight) } if(Number(this.data.form.deductPercent) > 0){ - data.deductPercent = Number(this.data.form.deductPercent) + this.data.form.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) - }) - } + wx.showLoading({ title: '处理中', mask: true }) + createInOrder(this.data.form).then(result => { + wx.hideLoading() + event.emit('OrderMessage', { what: 12, desc: 'createInOrder' }) + util.showBackToast('订单新增成功') + }).catch(err => { + wx.hideLoading() + util.showToast(err) }) }, viewImage: function (e) { diff --git a/pages/process/order-add/index.wxml b/pages/process/order-add/index.wxml index 5cc8af3..5d7a403 100644 --- a/pages/process/order-add/index.wxml +++ b/pages/process/order-add/index.wxml @@ -45,7 +45,7 @@ {{form.productName || '请选择废纸品类'}} - + * 单价(元/公斤) @@ -72,9 +72,9 @@ 订单凭证 - 2张以内,每张图片大小限制5M + 3张以内,每张图片大小限制5M - + diff --git a/pages/process/order-info/index.js b/pages/process/order-info/index.js index 9c2aab5..48ee79f 100644 --- a/pages/process/order-info/index.js +++ b/pages/process/order-info/index.js @@ -16,7 +16,8 @@ Scene({ status: 0, form: null, agent: 0, - title: '过磅详情' + title: '过磅详情', + imageList: [] }, /** * 生命周期函数--监听页面加载 @@ -57,12 +58,20 @@ Scene({ result.data.paymentOrderInfo.lessPrice = 0.00 } } + if(result.data.receiptImageList && result.data.receiptImageList.length){ + this.data.imageList = [] + for (let index = 0; index < result.data.receiptImageList.length; index++) { + const element = result.data.receiptImageList[index] + this.data.imageList.push({ url: element }) + } + } this.setData({ safeBottom: app.globalData.safeBottom, form: result.data, title: this.data.title, admin: app.userInfo.type && app.userInfo.type.indexOf('ADMIN') >= 0, - agent: this.data.agent + agent: this.data.agent, + imageList: this.data.imageList }) }).catch(err => { wx.hideLoading() diff --git a/pages/process/order-info/index.json b/pages/process/order-info/index.json index 308b6a7..97d50a9 100644 --- a/pages/process/order-info/index.json +++ b/pages/process/order-info/index.json @@ -6,6 +6,7 @@ "van-loading": "/components/loading/index", "van-image": "/components/image/index", "van-dialog": "/components/dialog/index", + "van-uploader": "/components/uploader/index", "submit-layout": "/components/submit-layout/index", "notification": "/pages/message/notification/index" } diff --git a/pages/process/order-info/index.wxml b/pages/process/order-info/index.wxml index 37ba078..a2e3a52 100644 --- a/pages/process/order-info/index.wxml +++ b/pages/process/order-info/index.wxml @@ -35,7 +35,8 @@ 已关闭 - + 重新定价 + 查看订单日志 @@ -127,6 +128,12 @@ + + + 订单凭证 + + + 备注 @@ -141,7 +148,7 @@ 单价(元/公斤) - {{formate.formateAmount(form.settleUnitPrice)}} + {{formate.formateAmount(form.settleUnitPrice || form.unitPrice)}} @@ -174,11 +181,15 @@ 取消订单 - + 取消订单 重新过皮重 通过审核 + + 取消订单 + 通过审核 + 取消订单 进行支付 diff --git a/pages/process/payment/index.js b/pages/process/payment/index.js index cdae9fe..7d19fcf 100644 --- a/pages/process/payment/index.js +++ b/pages/process/payment/index.js @@ -73,7 +73,11 @@ Scene({ result.data.productName = productName result.data.settleWeight = settleWeight result.data.settlePrice = this.data.amount - this.setData({ orderList: [result.data], amount: this.data.amount, orderStatus: result.data.orderStatus }) + var settleType = app.userInfo.factory.settleType + if(settleType){ + this.data.settleType = String(settleType) + } + this.setData({ orderList: [result.data], settleType: this.data.settleType, amount: this.data.amount, orderStatus: result.data.orderStatus }) this.fetchCustomerInfo(result.data) }).catch(err => { wx.hideLoading() @@ -85,7 +89,7 @@ Scene({ getCustomerInfo(orderInfo.factoryCustomerId).then(result => { wx.hideLoading() this.data.params.bankCardNo = result.data.bankCardNo - this.data.settleType = '' + result.data.defaultPaymentMethod + // this.data.settleType = '' + result.data.defaultPaymentMethod this.data.params.ids = [] this.data.params.ids.push(orderInfo.scrapPaperReceiptId) this.setData({ params: this.data.params }) @@ -125,10 +129,10 @@ Scene({ this.setData({ settleType: detail }) }, onTypeClick(e) { - if(Number(e.currentTarget.dataset.name) == 2 && util.isEmpty(this.data.params.bankCardNo)){ - util.showToast('暂无客户银行卡信息,无法进行银行卡转账') - return - } + // if(Number(e.currentTarget.dataset.name) == 2 && util.isEmpty(this.data.params.bankCardNo)){ + // util.showToast('暂无客户银行卡信息,无法进行银行卡转账') + // return + // } this.setData({ settleType: e.currentTarget.dataset.name }) }, onChange: function(e){ @@ -160,7 +164,6 @@ Scene({ wx.showLoading({ title: '正在处理', mask: true }) this.data.requesting = true this.data.params.settleType = Number(settleType) - paymentOrder(this.data.params).then(result => { wx.hideLoading() if(!util.isEmpty(result.message)){ diff --git a/pages/process/payment/index.wxml b/pages/process/payment/index.wxml index 528bf45..80a1417 100644 --- a/pages/process/payment/index.wxml +++ b/pages/process/payment/index.wxml @@ -20,7 +20,7 @@ - + diff --git a/pages/storage/order-create/index.js b/pages/storage/order-create/index.js index e233efd..77ce084 100644 --- a/pages/storage/order-create/index.js +++ b/pages/storage/order-create/index.js @@ -1,6 +1,6 @@ // pages/storage/index/index.js import Scene from '../../index/scene' -import { getPoundInfo, getPaperList, createOutOrder } from "../../../api/saas" +import { getPoundInfo, getPaperList, createOutOrder, recordOutOrder } from "../../../api/saas" const util = require('../../../utils/util') const math = require('../../../utils/math') const event = require('../../../utils/event') @@ -168,7 +168,7 @@ Scene({ for (let index = 0; index < this.data.imageList.length; index++) { imageUrls.push(this.data.imageList[index].url) } - this.data.form.orderImageList = imageUrls + this.data.form.weightNoteImageUrls = imageUrls }, submitForm: function(){ if(util.isEmpty(this.data.form.consigneeName)){ @@ -191,16 +191,28 @@ Scene({ util.showToast('净重不能小于零') return } - this.data.form.weightNoteId = this.data.poundInfo.id - wx.showLoading({ title: '正在处理', mask: true }) - createOutOrder(this.data.form).then(result => { - wx.hideLoading() - util.showBackToast('处理成功') - event.emit('OrderMessage', { what: 20, desc: 'cancelOrder' }) - }).catch(err => { - wx.hideLoading() - util.showToast(err) - }) + if(this.data.poundInfo){ + this.data.form.weightNoteId = this.data.poundInfo.id + wx.showLoading({ title: '正在处理', mask: true }) + createOutOrder(this.data.form).then(result => { + wx.hideLoading() + util.showBackToast('处理成功') + event.emit('OrderMessage', { what: 20, desc: 'createOutOrder' }) + }).catch(err => { + wx.hideLoading() + util.showToast(err) + }) + } else { + wx.showLoading({ title: '正在处理', mask: true }) + recordOutOrder(this.data.form).then(result => { + wx.hideLoading() + util.showBackToast('处理成功') + event.emit('OrderMessage', { what: 20, desc: 'recordOutOrder' }) + }).catch(err => { + wx.hideLoading() + util.showToast(err) + }) + } }, viewImage: function (e) { var imgList = [] diff --git a/pages/storage/order-settlement/index.wxml b/pages/storage/order-settlement/index.wxml index 27c30c1..c8d8b91 100644 --- a/pages/storage/order-settlement/index.wxml +++ b/pages/storage/order-settlement/index.wxml @@ -32,12 +32,12 @@ - + - - - - + + + +