|
|
|
@ -3,6 +3,7 @@ import Dialog from '../../../components/dialog/dialog' |
|
|
|
import { pricingOrder, cancelOrder, getFactoryOrderInfo, getPaperList} from "../../../api/saas" |
|
|
|
const event = require('../../../utils/event') |
|
|
|
const util = require('../../../utils/util') |
|
|
|
const math = require('../../../utils/math') |
|
|
|
const app = getApp() |
|
|
|
|
|
|
|
Page({ |
|
|
|
@ -13,7 +14,6 @@ Page({ |
|
|
|
safeBottom: app.globalData.safeBottom, |
|
|
|
paperList: null, |
|
|
|
form: null, |
|
|
|
deductType: 1, |
|
|
|
columns: [], |
|
|
|
focus: 0, |
|
|
|
visible: false, |
|
|
|
@ -39,6 +39,7 @@ Page({ |
|
|
|
}) |
|
|
|
getFactoryOrderInfo(options.id).then(result => { |
|
|
|
wx.hideLoading() |
|
|
|
result.data.sign = 1 |
|
|
|
this.setData({ form: result.data }) |
|
|
|
}).catch(err => { |
|
|
|
wx.hideLoading() |
|
|
|
@ -68,14 +69,23 @@ Page({ |
|
|
|
this.setData({ visible: false }) |
|
|
|
}, |
|
|
|
changeDeductType: function(e){ |
|
|
|
if(Number(e.currentTarget.dataset.type) == 1){ |
|
|
|
this.setData({ deductType: e.currentTarget.dataset.type, ['form.deductPercent']: null, focus: e.currentTarget.dataset.type}) |
|
|
|
} else { |
|
|
|
this.setData({ deductType: e.currentTarget.dataset.type, ['form.deductWeight']: null, focus: e.currentTarget.dataset.type }) |
|
|
|
} |
|
|
|
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.setData({ ['form.deductWeight']: null }) |
|
|
|
} else { |
|
|
|
this.setData({ ['form.deductWeight']: math.divide(math.times(this.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.setData({ ['form.deductPercent']: null }) |
|
|
|
} else { |
|
|
|
this.setData({ ['form.deductPercent']: math.times(math.divide(Number(e.detail.value), this.form.totalWeight), 100).toFixed(2) }) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
paddingOrder: function(){ |
|
|
|
this.setData({ ['form.isWithoutTare']: !this.data.form.isWithoutTare }) |
|
|
|
@ -124,7 +134,8 @@ Page({ |
|
|
|
var data = {id: this.data.form.id} |
|
|
|
if(Number(this.data.form.deductWeight) > 0){ |
|
|
|
data.deductWeight = Number(this.data.form.deductWeight) |
|
|
|
} else if(Number(this.data.form.deductPercent) > 0){ |
|
|
|
} |
|
|
|
if(Number(this.data.form.deductPercent) > 0){ |
|
|
|
data.deductPercent = Number(this.data.form.deductPercent) |
|
|
|
} |
|
|
|
data.plateNumber = this.data.form.plateNumber |
|
|
|
|