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

收款单金额数据修复

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