Commit 287dce52 authored by 我在何方's avatar 我在何方

新建收款单优化

parent 06ec585a
...@@ -972,7 +972,9 @@ export default { ...@@ -972,7 +972,9 @@ export default {
collectionAmount: [] collectionAmount: []
}] }]
} }
this.$set(this.form, 'receiptAccountList', [...res.data]) console.log(res.data)
this.$set(this.form, 'receiptAccountList', res.data)
this.$nextTick(() => { this.$nextTick(() => {
// const dollarList = this.list.filter(v => v.currencyId === 1) // const dollarList = this.list.filter(v => v.currencyId === 1)
// const discountDollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0) // const discountDollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
...@@ -989,11 +991,14 @@ export default { ...@@ -989,11 +991,14 @@ export default {
// const n = this.form.receiptAccountList.find(v => v.currencyId == 3) // const n = this.form.receiptAccountList.find(v => v.currencyId == 3)
// n && (n.discountTotal = discountNaira) // n && (n.discountTotal = discountNaira)
this.form.receiptAccountList.forEach((item, index) => { // this.form.receiptAccountList.forEach((item, index) => {
this.rateChange(item, index) // this.rateChange(item, index)
}); // });
this.calculation() if(this.form.receiptAccountList.length>0){
this.editReceiptAccountList()
}
// this.calculation()
}) })
}) })
}, },
...@@ -1052,34 +1057,26 @@ export default { ...@@ -1052,34 +1057,26 @@ export default {
this.form.receiptAccountList[this.form.receiptAccountList.length -1].writeOffAmount = writeOffAmountTotal this.form.receiptAccountList[this.form.receiptAccountList.length -1].writeOffAmount = writeOffAmountTotal
}, },
rateChange(row, index) { rateChange(row, index) {
console.log(row)
row.receivableAmount && (row.collectionAmount = Math.round(NP.times(row.collectionRate || 0, NP.minus(row.receivableAmount, row.discountTotal||0)))) row.receivableAmount && (row.collectionAmount = Math.round(NP.times(row.collectionRate || 0, NP.minus(row.receivableAmount, row.discountTotal||0))))
this.form.receiptAccountList[index] = {...row} this.form.receiptAccountList[index] = {...row}
setTimeout(() => { setTimeout(() => {
// 收款总计 // 收款总计
var amountList =[] this.editReceiptAccountList()
this.currencyList.forEach((item,index)=>{
var dollarList = this.form.receiptAccountList.filter(v => v.collectionCurrencyId == item.id)
if(dollarList.length>0){
var dollar = Math.round(dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.collectionAmount), 0))
amountList.push({currencyId:item.id,currencyNameEn:item.titleEn,currencyNameZh:item.titleZh,amount:dollar})
}
})
// const dollarList = this.form.receiptAccountList.filter(v => v.collectionCurrencyId == 1)
// const dollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.collectionAmount), 0)
// const rmbList = this.form.receiptAccountList.filter(v => v.collectionCurrencyId == 3)
// const rmb = rmbList.reduce((total, currentValue) => NP.plus(total, currentValue.collectionAmount), 0)
// const nairaList = this.form.receiptAccountList.filter(v => v.collectionCurrencyId == 2)
// const naira = nairaList.reduce((total, currentValue) => NP.plus(total, currentValue.collectionAmount), 0)
// const faList = this.form.receiptAccountList.filter(v => v.collectionCurrencyId == 6)
// const fa = faList.reduce((total, currentValue) => NP.plus(total, currentValue.collectionAmount), 0)
this.form.receiptAccountList[this.form.receiptAccountList.length -1].collectionAmount = amountList
this.$set(this.form, 'receiptAccountList', [...this.form.receiptAccountList])
}, 100) }, 100)
}, },
editReceiptAccountList(){
var amountList =[]
this.currencyList.forEach((item,index)=>{
var dollarList = this.form.receiptAccountList.filter(v => v.collectionCurrencyId == item.id)
if(dollarList.length>0){
var dollar = Math.round(dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.collectionAmount), 0))
amountList.push({currencyId:item.id,currencyNameEn:item.titleEn,currencyNameZh:item.titleZh,amount:dollar})
}
})
this.form.receiptAccountList[this.form.receiptAccountList.length -1].collectionAmount = amountList
this.$set(this.form, 'receiptAccountList', [...this.form.receiptAccountList])
},
//明细改变税率 //明细改变税率
changeTaxRate(row,index){ changeTaxRate(row,index){
var pointArr = [] var pointArr = []
......
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