|
|
|
@ -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) { |
|
|
|
|