Commit 68adb514 authored by 我在何方's avatar 我在何方

收款单金额数据修复

parent d3d73660
...@@ -124,8 +124,8 @@ ...@@ -124,8 +124,8 @@
<!-- <el-table-column label="应收金额" align="center" prop="receivableAmount" /> --> <!-- <el-table-column label="应收金额" align="center" prop="receivableAmount" /> -->
<el-table-column :label="$t('应收金额')" align="center" prop="receivableAmount"> <el-table-column :label="$t('应收金额')" align="center" prop="receivableAmount">
<template slot-scope="scope" v-if="scope.row.type !== 'total'"> <template slot-scope="scope" v-if="scope.row.type !== 'total'">
<span v-if="scope.row.discountTotal>0">{{ `${scope.row.receivableAmount - scope.row.discountTotal }(${scope.row.receivableAmount} - ${scope.row.discountTotal})` }}</span> <span v-if="scope.row.discountTotal&&scope.row.discountTotal>0">{{ `${scope.row.receivableAmount - scope.row.discountTotal }(${scope.row.receivableAmount} - ${scope.row.discountTotal})` }}</span>
<span v-else>{{ `${scope.row.receivableAmount - scope.row.discountTotal }` }}</span> <span v-else>{{ `${scope.row.receivableAmount}` }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" width="220"> <el-table-column align="center" width="220">
...@@ -510,7 +510,7 @@ export default { ...@@ -510,7 +510,7 @@ export default {
this.detailed.forEach(item => { this.detailed.forEach(item => {
total = NP.plus(total, item.writeOffAmount) total = NP.plus(total, item.writeOffAmount)
}) })
return total.toFixed(6) return total.toFixed(2)
}, },
WriteOffProportion(){ WriteOffProportion(){
let total = 0 let total = 0
...@@ -618,9 +618,14 @@ export default { ...@@ -618,9 +618,14 @@ 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).toFixed(6) var dollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.collectionAmount), 0).toFixed(2)
if(n.discountTotal&&n.discountTotal>0){
amountList.push({currencyName:item.titleZh,amount:(dollar-n.discountTotal).toFixed(2)})
}else{
amountList.push({currencyName:item.titleZh,amount:dollar}) amountList.push({currencyName:item.titleZh,amount:dollar})
} }
}
}) })
this.form.receiptAccountList[this.form.receiptAccountList.length -1].collectionAmount = amountList this.form.receiptAccountList[this.form.receiptAccountList.length -1].collectionAmount = amountList
this.$set(this.form, 'receiptAccountList', [...this.form.receiptAccountList]) this.$set(this.form, 'receiptAccountList', [...this.form.receiptAccountList])
...@@ -639,7 +644,7 @@ export default { ...@@ -639,7 +644,7 @@ export default {
methods: { methods: {
rateChange(row, index) { rateChange(row, index) {
console.log(row) 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} this.form.receiptAccountList[index] = {...row}
}, },
setWriteOffAmount() { setWriteOffAmount() {
...@@ -651,13 +656,35 @@ export default { ...@@ -651,13 +656,35 @@ export default {
return '' return ''
}, },
calculation() { calculation() {
const verificationList = this.detailed.filter(v => v.status === 1) // this.currencyList.forEach((item,index)=>{
const dollarList = verificationList.filter(v => v.currencyId === 1) // var verificationList = this.detailed.filter(v => v.status === 1)
const dollar = dollarList.length > 0 ? dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.amount || 0), 0) : 0 // var dollarList = verificationList.filter(v => v.currencyId === item.id)
const rmbList = verificationList.filter(v => v.currencyId === 3) // if(dollarList.length>0){
const rmb = rmbList.length > 0 ? rmbList.reduce((total, currentValue) => NP.plus(total, currentValue.amount || 0), 0) : 0 // let dollar,discountDollar
const nairaList = verificationList.filter(v => v.currencyId === 2) // dollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.amount || 0), 0) : 0
const naira = nairaList.length > 0 ? nairaList.reduce((total, currentValue) => NP.plus(total, currentValue.amount || 0), 0) : 0 // discountDollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
// var t = copyList.find(v => v.currencyId == item.id)
// this.form.receiptAccountList.push(
// {
// discountTotal: discountDollar,
// currencyId: item.id,
// receivableAmount: dollar,
// writeOffRate: t?.writeOffRate || NP.divide(this.currencyList.find(v => v.id === item.id).huilv, this.currencyList.find(v => v.id === this.showCurrencyId).huilv).toFixed(6),
// platformAccountId: t?.platformAccountId || '',
// collectionCurrencyId: t?.collectionCurrencyId || item.id,
// collectionRate: t?.collectionRate || 1
// }
// )
// this.calculationCount(NP.minus(dollar, discountDollar), item.id)
// }
// })
// const verificationList = this.detailed.filter(v => v.status === 1)
// const dollarList = verificationList.filter(v => v.currencyId === 1)
// const dollar = dollarList.length > 0 ? dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.amount || 0), 0) : 0
// const rmbList = verificationList.filter(v => v.currencyId === 3)
// const rmb = rmbList.length > 0 ? rmbList.reduce((total, currentValue) => NP.plus(total, currentValue.amount || 0), 0) : 0
// const nairaList = verificationList.filter(v => v.currencyId === 2)
// const naira = nairaList.length > 0 ? nairaList.reduce((total, currentValue) => NP.plus(total, currentValue.amount || 0), 0) : 0
// const usCount = NP.plus(dollar, NP.times(this.RMBtoUS(), rmb), NP.times(this.NANtoUS(), naira)) // const usCount = NP.plus(dollar, NP.times(this.RMBtoUS(), rmb), NP.times(this.NANtoUS(), naira))
// const rmbCount = NP.plus(rmb, NP.times(this.UStoRMB(), dollar), NP.times(this.NANtoRMB(), naira)) // const rmbCount = NP.plus(rmb, NP.times(this.UStoRMB(), dollar), NP.times(this.NANtoRMB(), naira))
...@@ -666,41 +693,41 @@ export default { ...@@ -666,41 +693,41 @@ export default {
// this.verificationData.usCount = usCount // this.verificationData.usCount = usCount
// this.verificationData.rmbCount = rmbCount // this.verificationData.rmbCount = rmbCount
// this.verificationData.nairaCount = nairaCount // this.verificationData.nairaCount = nairaCount
this.verificationData.usCount = dollar // this.verificationData.usCount = dollar
this.verificationData.rmbCount = rmb // this.verificationData.rmbCount = rmb
this.verificationData.nairaCount = naira // this.verificationData.nairaCount = naira
if (verificationList.indexOf(1)>-1) { // 美元 // if (verificationList.indexOf(1)>-1) { // 美元
this.verificationData.writtenOff = dollar // this.verificationData.writtenOff = dollar
this.verificationData.WriteOffProportion = NP.times(NP.divide(dollar, this.form.receivableTotalAmount), 100) // this.verificationData.WriteOffProportion = NP.times(NP.divide(dollar, this.form.receivableTotalAmount), 100)
const remaining = NP.minus(this.form.receivableTotalAmount, dollar) // const remaining = NP.minus(this.form.receivableTotalAmount, dollar)
// this.remainingAmount = { // this.remainingAmount = {
// usAmount: remaining, // usAmount: remaining,
// rmbAmount: NP.times(this.UStoRMB(), remaining), // rmbAmount: NP.times(this.UStoRMB(), remaining),
// nairaAmount: NP.times(this.UStoNAN(), remaining) // nairaAmount: NP.times(this.UStoNAN(), remaining)
// } // }
this.remainingAmount.usAmount = remaining // this.remainingAmount.usAmount = remaining
} else if (this.showCurrencyId === 2) { // 人民币 // } else if (this.showCurrencyId === 2) { // 人民币
this.verificationData.writtenOff = rmb // this.verificationData.writtenOff = rmb
this.verificationData.WriteOffProportion = NP.times(NP.divide(rmb, this.form.receivableTotalAmount), 100) // this.verificationData.WriteOffProportion = NP.times(NP.divide(rmb, this.form.receivableTotalAmount), 100)
const remaining = NP.minus(this.form.receivableTotalAmount, rmb) // const remaining = NP.minus(this.form.receivableTotalAmount, rmb)
// this.remainingAmount = { // this.remainingAmount = {
// usAmount: NP.times(this.RMBtoUS(), remaining), // usAmount: NP.times(this.RMBtoUS(), remaining),
// rmbAmount: remaining, // rmbAmount: remaining,
// nairaAmount: NP.times(this.RMBtoNAN(), remaining) // nairaAmount: NP.times(this.RMBtoNAN(), remaining)
// } // }
this.remainingAmount.rmbAmount = remaining // this.remainingAmount.rmbAmount = remaining
} else if (this.showCurrencyId === 3) { // 奈拉 // } else if (this.showCurrencyId === 3) { // 奈拉
this.verificationData.writtenOff = naira // this.verificationData.writtenOff = naira
this.verificationData.WriteOffProportion = NP.times(NP.divide(naira, this.form.receivableTotalAmount), 100) // this.verificationData.WriteOffProportion = NP.times(NP.divide(naira, this.form.receivableTotalAmount), 100)
const remaining = NP.minus(this.form.receivableTotalAmount, naira) // const remaining = NP.minus(this.form.receivableTotalAmount, naira)
// this.remainingAmount = { // this.remainingAmount = {
// usAmount: NP.times(this.NANtoUS(), remaining), // usAmount: NP.times(this.NANtoUS(), remaining),
// rmbAmount: NP.times(this.NANtoRMB(), remaining), // rmbAmount: NP.times(this.NANtoRMB(), remaining),
// nairaAmount: remaining // nairaAmount: remaining
// } // }
this.remainingAmount.nairaAmount = remaining // this.remainingAmount.nairaAmount = remaining
} // }
}, },
accountChange(val){ accountChange(val){
var data = this.bankData.find(item=>item.id==val) var data = this.bankData.find(item=>item.id==val)
...@@ -751,7 +778,7 @@ export default { ...@@ -751,7 +778,7 @@ export default {
rate:parseFloat(v.rate).toFixed(6), rate:parseFloat(v.rate).toFixed(6),
attr: v.attr ? v.attr.split(',').map(t => ({ name: t.slice(t.lastIndexOf('/') + 1), url: t })) : [] attr: v.attr ? v.attr.split(',').map(t => ({ name: t.slice(t.lastIndexOf('/') + 1), url: t })) : []
})) }))
this.calculation() // this.calculation()
}) })
}, },
saveFrom() { saveFrom() {
......
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