Commit 1965cec5 authored by 我在何方's avatar 我在何方

新增收款单金额保留2位小数

parent 38bbadb5
......@@ -926,14 +926,14 @@ export default {
this.rateChange(row, index)
},
writeOffRateChange(row, index) {
row.writeOffAmount = NP.times(row.writeOffRate || 0, NP.minus(row.receivableAmount, row.discountTotal))
row.writeOffAmount = NP.times(row.writeOffRate || 0, NP.minus(row.receivableAmount, row.discountTotal)).toFixed(2)
const writeOffAmountTotal = this.form.receiptAccountList.filter(v => v.type !== 'total').reduce((total, currentValue) => NP.plus(total, currentValue.writeOffAmount || 0), 0)
this.form.receiptAccountList[this.form.receiptAccountList.length -1].writeOffAmount = writeOffAmountTotal
},
rateChange(row, index) {
console.log(row)
row.receivableAmount && (row.collectionAmount = NP.times(row.collectionRate || 0, NP.minus(row.receivableAmount, row.discountTotal||0)).toFixed(6))
row.receivableAmount && (row.collectionAmount = NP.times(row.collectionRate || 0, NP.minus(row.receivableAmount, row.discountTotal||0)).toFixed(2))
this.form.receiptAccountList[index] = {...row}
setTimeout(() => {
......@@ -942,7 +942,7 @@ export default {
this.currencyList.forEach((item,index)=>{
var dollarList = this.form.receiptAccountList.filter(v => v.collectionCurrencyId == item.id)
if(dollarList.length>0){
var dollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.collectionAmount), 0).toFixed(6)
var dollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.collectionAmount), 0).toFixed(2)
amountList.push({currencyId:item.id,currencyNameEn:item.titleEn,currencyNameZh:item.titleZh,amount:dollar})
}
})
......@@ -1081,7 +1081,7 @@ export default {
const totalt = this.form.receiptAccountList.reduce((total, currentValue) => NP.plus(total, currentValue.writeOffAmount || 0), 0)
this.form.receiptAccountList = [...this.form.receiptAccountList, {
type: 'total',
writeOffAmount: totalt,
writeOffAmount: totalt.toFixed(2),
collectionAmount: [this.form.receiptAccountList.discountNaira, 0, 0]
}]
......@@ -1125,7 +1125,7 @@ export default {
const index = this.form.receiptAccountList.findIndex(v => v.currencyId == type)
const t = this.form.receiptAccountList[index]
if (t) {
t.writeOffAmount = NP.times(t.writeOffRate || 0, usCount)
t.writeOffAmount = NP.times(t.writeOffRate || 0, usCount).toFixed(2)
this.rateChange(t, index)
}
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment