Commit f9f4e950 authored by 我在何方's avatar 我在何方

收款单金额优化

parent 7ffedc66
...@@ -983,11 +983,10 @@ export default { ...@@ -983,11 +983,10 @@ export default {
// totalAmount // totalAmount
res.data = [...res.data, { res.data = [...res.data, {
type: 'total', type: 'total',
writeOffAmount: res.data.reduce((total, currentValue) => NP.plus(total, currentValue.writeOffAmount || 0), 0), writeOffAmount: res.data.reduce((total, currentValue) => NP.plus(total, currentValue.writeOffAmount || 0), 0).toFixed(2),
collectionAmount: [] collectionAmount: []
}] }]
} }
console.log(res.data)
this.$set(this.form, 'receiptAccountList', res.data) this.$set(this.form, 'receiptAccountList', res.data)
this.$nextTick(() => { this.$nextTick(() => {
...@@ -1010,6 +1009,7 @@ export default { ...@@ -1010,6 +1009,7 @@ export default {
// this.rateChange(item, index) // this.rateChange(item, index)
// }); // });
console.log(111)
if(this.form.receiptAccountList.length>0){ if(this.form.receiptAccountList.length>0){
this.editReceiptAccountList() this.editReceiptAccountList()
} }
...@@ -1071,7 +1071,7 @@ export default { ...@@ -1071,7 +1071,7 @@ export default {
} }
if(row.writeOffRate){ if(row.writeOffRate){
row.writeOffAmount = Math.round(NP.times(row.writeOffRate || 0, NP.minus(row.receivableAmount, row.discountTotal||0))) row.writeOffAmount = NP.times(row.writeOffRate || 0, NP.minus(row.receivableAmount, row.discountTotal||0)).toFixed(2)
}else{ }else{
row.writeOffAmount = '' row.writeOffAmount = ''
} }
...@@ -1101,7 +1101,7 @@ export default { ...@@ -1101,7 +1101,7 @@ export default {
var dollarList = this.form.receiptAccountList.filter(v => v.collectionCurrencyId == item.id) var dollarList = this.form.receiptAccountList.filter(v => v.collectionCurrencyId == item.id)
if(dollarList.length>0){ if(dollarList.length>0){
var dollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.collectionAmount), 0) var dollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.collectionAmount), 0)
amountList.push({currencyId:item.id,currencyNameEn:item.titleEn,currencyNameZh:item.titleZh,amount:dollar}) amountList.push({currencyId:item.id,currencyNameEn:item.titleEn,currencyNameZh:item.titleZh,amount:dollar.toFixed(2)})
} }
}) })
this.form.receiptAccountList[this.form.receiptAccountList.length -1].collectionAmount = amountList this.form.receiptAccountList[this.form.receiptAccountList.length -1].collectionAmount = amountList
...@@ -1228,11 +1228,11 @@ export default { ...@@ -1228,11 +1228,11 @@ export default {
const totalt = this.form.receiptAccountList.reduce((total, currentValue) => NP.plus(total, currentValue.writeOffAmount || 0), 0) const totalt = this.form.receiptAccountList.reduce((total, currentValue) => NP.plus(total, currentValue.writeOffAmount || 0), 0)
this.form.receiptAccountList = [...this.form.receiptAccountList, { this.form.receiptAccountList = [...this.form.receiptAccountList, {
type: 'total', type: 'total',
writeOffAmount: Math.round(totalt), writeOffAmount:totalt.toFixed(2),
collectionAmount: [this.form.receiptAccountList.discountNaira, 0, 0] collectionAmount: []
}] }]
this.form.receivableTotalAmount = totalt this.form.receivableTotalAmount = totalt.toFixed(2)
} }
// receiptAccountList: [ // receiptAccountList: [
// { currencyId: 1, receivableAmount: 0, writeOffRate: 1, writeOffAmount: 999, platformAccountId: '', currencyId: '', rate: 1, collectionAmount: 0 }, // { currencyId: 1, receivableAmount: 0, writeOffRate: 1, writeOffAmount: 999, platformAccountId: '', currencyId: '', rate: 1, collectionAmount: 0 },
...@@ -1272,7 +1272,7 @@ export default { ...@@ -1272,7 +1272,7 @@ export default {
const index = this.form.receiptAccountList.findIndex(v => v.currencyId == type) const index = this.form.receiptAccountList.findIndex(v => v.currencyId == type)
const t = this.form.receiptAccountList[index] const t = this.form.receiptAccountList[index]
if (t) { if (t) {
t.writeOffAmount = Math.round(NP.times(t.writeOffRate || 0, usCount)) t.writeOffAmount = NP.times(t.writeOffRate || 0, usCount).toFixed(2)
this.rateChange(t, index) this.rateChange(t, index)
} }
}, },
......
...@@ -664,6 +664,7 @@ export default { ...@@ -664,6 +664,7 @@ export default {
total = NP.plus(total, item.writeOffAmount) total = NP.plus(total, item.writeOffAmount)
} }
}) })
return total.toFixed(2) return total.toFixed(2)
}, },
//显示反审核反核销弹窗 //显示反审核反核销弹窗
...@@ -741,7 +742,7 @@ export default { ...@@ -741,7 +742,7 @@ export default {
// totalAmount // totalAmount
res.data = [...res.data, { res.data = [...res.data, {
type: 'total', type: 'total',
writeOffAmount: res.data.reduce((total, currentValue) => NP.plus(total, currentValue.writeOffAmount || 0), 0), writeOffAmount: res.data.reduce((total, currentValue) => NP.plus(total, currentValue.writeOffAmount || 0), 0).toFixed(2),
collectionAmount: [] collectionAmount: []
}] }]
} }
...@@ -824,8 +825,8 @@ export default { ...@@ -824,8 +825,8 @@ export default {
this.currencyList.forEach((item,index)=>{ this.currencyList.forEach((item,index)=>{
var dollarList = this.form.receiptAccountList.filter(v => v.collectionCurrencyId == item.id) var dollarList = this.form.receiptAccountList.filter(v => v.collectionCurrencyId == item.id)
if(dollarList.length>0){ if(dollarList.length>0){
var dollar = Math.round(dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.collectionAmount), 0)) var dollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.collectionAmount), 0)
amountList.push({currencyId:item.id,currencyNameEn:item.titleEn,currencyNameZh:item.titleZh,amount:dollar}) amountList.push({currencyId:item.id,currencyNameEn:item.titleEn,currencyNameZh:item.titleZh,amount:dollar.toFixed(2)})
} }
}) })
this.form.receiptAccountList[this.form.receiptAccountList.length -1].collectionAmount = amountList this.form.receiptAccountList[this.form.receiptAccountList.length -1].collectionAmount = amountList
......
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