Browse Source

no message

feature/v2.3
xpz2018 4 years ago
parent
commit
f01122e499
1 changed files with 10 additions and 2 deletions
  1. 12
      pages/storage/order-settlement/index.js

12
pages/storage/order-settlement/index.js

@ -135,24 +135,29 @@ Scene({
if(e.target.id == 'netWeight'){
if(!util.isEmpty(this.data.form.deductPercent) && Number(this.data.form.deductPercent) > 0){
var deductWeight = math.divide(math.times(this.data.form.netWeight, this.data.form.deductPercent), 100)
this.data.form.deductWeight = deductWeight
this.setData({ ['form.settleWeight']: math.minus(this.data.form.netWeight, deductWeight) })
} else {
this.data.form.deductWeight = 0
this.setData({ ['form.settleWeight']: e.detail })
}
} else if(e.target.id == 'deductPercent'){
if(!util.isEmpty(this.data.form.netWeight) && Number(this.data.form.netWeight) > 0){
if(Number(this.data.form.deductPercent) < 100){
var deductWeight = math.divide(math.times(this.data.form.netWeight, this.data.form.deductPercent), 100)
this.data.form.deductWeight = deductWeight
this.setData({ ['form.settleWeight']: math.minus(this.data.form.netWeight, deductWeight) })
} else {
this.data.form.deductWeight = 0
this.setData({ ['form.settleWeight']: '' })
}
}
} else if(e.target.id == 'settleWeight'){
if(!util.isEmpty(this.data.form.netWeight) && Number(this.data.form.netWeight) > 0){
if(Number(this.data.form.netWeight) > Number(this.data.form.settleWeight)){
this.data.form.deductWeight = math.minus(this.data.form.netWeight, this.data.form.settleWeight)
this.setData({ ['form.deductPercent']: math.times(math.divide(this.data.form.deductWeight, this.data.form.netWeight), 100).toFixed(2) })
var deductWeight = math.minus(this.data.form.netWeight, this.data.form.settleWeight)
this.data.form.deductWeight = deductWeight
this.setData({ ['form.deductPercent']: math.times(math.divide(deductWeight, this.data.form.netWeight), 100).toFixed(2) })
} else {
this.data.form.deductWeight = 0
this.setData({ ['form.deductPercent']: '' })
@ -230,6 +235,9 @@ Scene({
if(this.data.form.netWeight && Number(this.data.form.netWeight) > 0){
params.netWeight = math.times(this.data.form.netWeight, 1000)
}
if(this.data.form.deductPercent && Number(this.data.form.deductPercent) > 0){
params.deductPercent = this.data.form.deductPercent
}
if(this.data.form.deductWeight && Number(this.data.form.deductWeight) > 0){
params.deductWeight = math.times(this.data.form.deductWeight, 1000)
}

Loading…
Cancel
Save