Commit 5875783c authored by 我在何方's avatar 我在何方

收款单汇率2.2

parent 65d8dc0c
...@@ -393,7 +393,7 @@ ...@@ -393,7 +393,7 @@
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.type !== 'total'">{{ scope.row.collectionAmount }}</span> <span v-if="scope.row.type !== 'total'">{{ scope.row.collectionAmount }}</span>
<div v-else> <div v-else>
<div v-for="itemAmount in scope.row.collectionAmount">{{$i18n.locale=='zh_CN'?(itemAmount?itemAmount.currencyNameZh:''):(itemAmount?itemAmount.currencyNameEn:'')}}: {{ itemAmount?itemAmount.amount:''}}</div> <div v-for="itemAmount in scope.row.collectionAmount">{{$i18n.locale=='zh_CN'?(itemAmount?itemAmount.currencyNameZh:''):(itemAmount?itemAmount.currencyNameEn:'')}}: {{ itemAmount&&itemAmount.amount?itemAmount.amount:0}}</div>
<!-- <div v-if="scope.row.collectionAmount[1]">{{ $t('人民币') }}: {{ scope.row.collectionAmount[1].toFixed(6) }}</div> <!-- <div v-if="scope.row.collectionAmount[1]">{{ $t('人民币') }}: {{ scope.row.collectionAmount[1].toFixed(6) }}</div>
<div v-if="scope.row.collectionAmount[2]">{{ $t('奈拉') }}: {{ scope.row.collectionAmount[2].toFixed(6) }}</div> <div v-if="scope.row.collectionAmount[2]">{{ $t('奈拉') }}: {{ scope.row.collectionAmount[2].toFixed(6) }}</div>
<div v-if="scope.row.collectionAmount[3]">{{ $t('西非法郎') }}: {{ scope.row.collectionAmount[3].toFixed(6) }}</div> --> <div v-if="scope.row.collectionAmount[3]">{{ $t('西非法郎') }}: {{ scope.row.collectionAmount[3].toFixed(6) }}</div> -->
...@@ -1048,7 +1048,7 @@ export default { ...@@ -1048,7 +1048,7 @@ export default {
getRate(sourceCurrencyId,targetCurrencyId){ getRate(sourceCurrencyId,targetCurrencyId){
var rate = this.rateList.find(v=>(v.sourceCurrencyId === sourceCurrencyId&&v.targetCurrencyId===targetCurrencyId)) var rate = this.rateList.find(v=>(v.sourceCurrencyId === sourceCurrencyId&&v.targetCurrencyId===targetCurrencyId))
if(rate) return rate.currencyRate if(rate) return rate.currencyRate
return 1 return 0
}, },
writeOffRateChange(row, index) { writeOffRateChange(row, index) {
row.writeOffAmount = Math.round(NP.times(row.writeOffRate || 0, NP.minus(row.receivableAmount, row.discountTotal))) row.writeOffAmount = Math.round(NP.times(row.writeOffRate || 0, NP.minus(row.receivableAmount, row.discountTotal)))
...@@ -1057,7 +1057,11 @@ export default { ...@@ -1057,7 +1057,11 @@ 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) {
if(row.collectionRate){
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))))
}else{
row.collectionAmount = 0
}
this.form.receiptAccountList[index] = {...row} this.form.receiptAccountList[index] = {...row}
setTimeout(() => { setTimeout(() => {
......
...@@ -189,7 +189,7 @@ ...@@ -189,7 +189,7 @@
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.type !== 'total'">{{ scope.row.collectionAmount }}</span> <span v-if="scope.row.type !== 'total'">{{ scope.row.collectionAmount }}</span>
<div v-else> <div v-else>
<div v-for="itemAmount in scope.row.collectionAmount">{{$i18n.locale=='zh_CN'?itemAmount.currencyNameZh:itemAmount.currencyNameEn}}: {{ itemAmount.amount}}</div> <div v-for="itemAmount in scope.row.collectionAmount">{{$i18n.locale=='zh_CN'?itemAmount.currencyNameZh:itemAmount.currencyNameEn}}: {{ itemAmount&&itemAmount.amount?itemAmount.amount:0}}</div>
<!-- <div v-if="scope.row.collectionAmount[0]">{{ $t('美元') }}: {{ scope.row.collectionAmount[0] }}</div> <!-- <div v-if="scope.row.collectionAmount[0]">{{ $t('美元') }}: {{ scope.row.collectionAmount[0] }}</div>
<div v-if="scope.row.collectionAmount[1]">{{ $t('人民币') }}: {{ scope.row.collectionAmount[1] }}</div> <div v-if="scope.row.collectionAmount[1]">{{ $t('人民币') }}: {{ scope.row.collectionAmount[1] }}</div>
<div v-if="scope.row.collectionAmount[2]">{{ $t('奈拉') }}: {{ scope.row.collectionAmount[2] }}</div> --> <div v-if="scope.row.collectionAmount[2]">{{ $t('奈拉') }}: {{ scope.row.collectionAmount[2] }}</div> -->
...@@ -744,7 +744,7 @@ export default { ...@@ -744,7 +744,7 @@ export default {
collectionAmount: [] collectionAmount: []
}] }]
} }
this.$set(this.form, 'receiptAccountList', [...res.data]) this.$set(this.form, 'receiptAccountList', res.data)
// 收款总计 // 收款总计
// const dollarList = res.data.filter(v => v.collectionCurrencyId == 1) // const dollarList = res.data.filter(v => v.collectionCurrencyId == 1)
// const dollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.collectionAmount || 0), 0) // const dollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.collectionAmount || 0), 0)
...@@ -796,9 +796,12 @@ export default { ...@@ -796,9 +796,12 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.form.receiptAccountList.forEach((item, index) => { // this.form.receiptAccountList.forEach((item, index) => {
this.rateChange(item, index) // this.rateChange(item, index)
}); // });
if(this.form.receiptAccountList.length>0){
this.editReceiptAccountList()
}
}) })
}) })
} }
...@@ -807,10 +810,26 @@ export default { ...@@ -807,10 +810,26 @@ export default {
}, },
methods: { methods: {
rateChange(row, index) { rateChange(row, index) {
console.log(row) if(row.collectionRate){
row.receivableAmount && (row.collectionAmount = NP.times(row.collectionRate || 0, NP.minus(row.receivableAmount, row.discountTotal||0)).toFixed(2)) row.receivableAmount && (row.collectionAmount = Math.round(NP.times(row.collectionRate || 0, NP.minus(row.receivableAmount, row.discountTotal||0))))
}else{
row.collectionAmount = 0
}
// 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}
}, },
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])
},
setWriteOffAmount() { setWriteOffAmount() {
var pointArr = [] var pointArr = []
var regs=/^[0-9]+\d*(\.\d*)?$|^0?\.\d*[0-9]\d*$/; var regs=/^[0-9]+\d*(\.\d*)?$|^0?\.\d*[0-9]\d*$/;
......
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