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

收款单bug修复

parent 7ac3677f
......@@ -131,7 +131,7 @@
<el-table-column :label="$t('总金额')" align="center" prop="totalAmount">
<template slot-scope="scope">
<span>{{ scope.row.totalAmount }}{{getCurrencyLabel(scope.row.currencyId)}}</span>
<!-- <dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="scope.row.currencyId" /> -->
</template>
</el-table-column>
......@@ -267,7 +267,7 @@
<el-table :data="form.receiptAccountList" border :key="form.receiptAccountList.length">
<el-table-column :label="$t('应收币种')" align="center">
<template slot-scope="scope">
{{getCurrencyLabel(scope.row.currencyId)}}
{{getCurrencyLabel(scope.row.currencyId)}}
</template>
</el-table-column>
<el-table-column :label="$t('应收金额')" align="center" prop="receivableAmount">
......@@ -365,12 +365,12 @@
</el-table-column>
<el-table-column :label="$t('期望收款金额')" align="center" prop="collectionAmount">
<template slot-scope="scope">
<span v-if="scope.row.type !== 'total'">{{ scope.row.collectionAmount.toFixed(6) }}</span>
<span v-if="scope.row.type !== 'total'">{{ scope.row.collectionAmount }}</span>
<div v-else>
<div v-if="scope.row.collectionAmount[0]">{{ $t('美元') }}: {{ scope.row.collectionAmount[0].toFixed(6) }}</div>
<div v-if="scope.row.collectionAmount[1]">{{ $t('人民币') }}: {{ scope.row.collectionAmount[1].toFixed(6) }}</div>
<div v-for="itemAmount in scope.row.collectionAmount">{{itemAmount.currencyName}}: {{ itemAmount.amount}}</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[3]">{{ $t('西非法郎') }}: {{ scope.row.collectionAmount[3].toFixed(6) }}</div>
<div v-if="scope.row.collectionAmount[3]">{{ $t('西非法郎') }}: {{ scope.row.collectionAmount[3].toFixed(6) }}</div> -->
</div>
<!-- <dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="scope.row.currencyId" /> -->
</template>
......@@ -620,19 +620,19 @@
</el-table-column>
</el-table>
<el-form-item :label="$t('总金额')">
{{ selectListRow.totalAmount }}{{getCurrencyLabel(sselectListRow.currencyId)}}
{{ selectListRow.totalAmount }}{{getCurrencyLabel(selectListRow.currencyId)}}
</el-form-item>
<el-form-item :label="$t('优惠金额')">
<el-input v-model="discountForm.discountTotal" type="number" min="0" :max="selectListRow.totalAmount" @input="checkDiscount" style="width: 300px" ></el-input>
&nbsp;&nbsp;{{getCurrencyLabel(sselectListRow.currencyId)}}
&nbsp;&nbsp;{{getCurrencyLabel(selectListRow.currencyId)}}
</el-form-item>
<el-form-item :label="$t('优惠原因')">
<el-input v-model="discountForm.discountRemark" type="textarea" style="width: 300px"></el-input>
</el-form-item>
<el-form-item :label="$t('优惠后')">
{{ (selectListRow.totalAmount - (discountForm.discountTotal || 0)).toFixed(2)}}
{{getCurrencyLabel(sselectListRow.currencyId)}}
{{getCurrencyLabel(selectListRow.currencyId)}}
</el-form-item>
<el-form-item v-if="opnotice" :label="$t('操作人')">
{{ discountForm.author }}
......@@ -744,25 +744,25 @@ export default {
res.data = [...res.data, {
type: 'total',
writeOffAmount: res.data.reduce((total, currentValue) => NP.plus(total, currentValue.writeOffAmount || 0), 0),
collectionAmount: [0, 0, 0]
collectionAmount: []
}]
}
this.$set(this.form, 'receiptAccountList', [...res.data])
this.$nextTick(() => {
const dollarList = this.list.filter(v => v.currencyId === 1)
const discountDollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
const d = this.form.receiptAccountList.find(v => v.currencyId == 1)
d && (d.discountTotal = discountDollar)
// const dollarList = this.list.filter(v => v.currencyId === 1)
// const discountDollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
// const d = this.form.receiptAccountList.find(v => v.currencyId == 1)
// d && (d.discountTotal = discountDollar)
const rmbList = this.list.filter(v => v.currencyId === 2)
const discountRmb = rmbList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
const r = this.form.receiptAccountList.find(v => v.currencyId == 2)
r && (r.discountTotal = discountRmb)
// const rmbList = this.list.filter(v => v.currencyId === 2)
// const discountRmb = rmbList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
// const r = this.form.receiptAccountList.find(v => v.currencyId == 2)
// r && (r.discountTotal = discountRmb)
const nairaList = this.list.filter(v => v.currencyId === 3)
const discountNaira = nairaList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
const n = this.form.receiptAccountList.find(v => v.currencyId == 3)
n && (n.discountTotal = discountNaira)
// const nairaList = this.list.filter(v => v.currencyId === 3)
// const discountNaira = nairaList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
// const n = this.form.receiptAccountList.find(v => v.currencyId == 3)
// n && (n.discountTotal = discountNaira)
this.form.receiptAccountList.forEach((item, index) => {
this.rateChange(item, index)
......@@ -878,88 +878,118 @@ export default {
this.form.receiptAccountList[this.form.receiptAccountList.length -1].writeOffAmount = writeOffAmountTotal
},
rateChange(row, index) {
row.receivableAmount && (row.collectionAmount = NP.times(row.collectionRate || 0, NP.minus(row.receivableAmount, row.discountTotal)))
console.log(row)
row.receivableAmount && (row.collectionAmount = NP.times(row.collectionRate || 0, NP.minus(row.receivableAmount, row.discountTotal||0)).toFixed(6))
this.form.receiptAccountList[index] = {...row}
setTimeout(() => {
// 收款总计
const dollarList = this.form.receiptAccountList.filter(v => v.collectionCurrencyId == 1)
const dollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.collectionAmount), 0)
var amountList =[]
this.currencyList.forEach((item,index)=>{
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})
}
})
// 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 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 = [dollar, rmb, naira,fa]
// 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)
},
calculation() {
const copyList = this.form.receiptAccountList
this.form.receiptAccountList = []
const dollarList = this.list.filter(v => v.currencyId === 1)
let dollar,discountDollar
if (dollarList.length > 0) {
dollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.totalAmount || 0), 0)
discountDollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
const t = copyList.find(v => v.currencyId == 1)
this.form.receiptAccountList = [
{
discountTotal: discountDollar,
currencyId: 1,
receivableAmount: dollar,
writeOffRate: t?.writeOffRate || (this.showCurrencyId === 1 ? 1 : this.showCurrencyId === 2 ? this.UStoRMB() : this.UStoNAN()),
platformAccountId: t?.platformAccountId || '',
collectionCurrencyId: t?.collectionCurrencyId || 1,
collectionRate: t?.collectionRate || 1
}
]
this.calculationCount(NP.minus(dollar, discountDollar), 1)
}
const rmbList = this.list.filter(v => v.currencyId === 2)
let rmb,discountRmb
if (rmbList.length > 0) {
rmb = rmbList.reduce((total, currentValue) => NP.plus(total, currentValue.totalAmount || 0), 0)
discountRmb = rmbList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
const t = copyList.find(v => v.currencyId == 2)
this.form.receiptAccountList = [
...this.form.receiptAccountList,
{
discountTotal: discountRmb,
currencyId: 2,
receivableAmount: rmb,
writeOffRate: t?.writeOffRate || (this.showCurrencyId === 1 ? this.RMBtoUS() : this.showCurrencyId === 2 ? 1 : this.RMBtoNAN()),
platformAccountId: t?.platformAccountId || '',
collectionCurrencyId: t?.collectionCurrencyId || '',
collectionRate: t?.collectionRate || ''
}
]
this.calculationCount(NP.minus(rmb, discountRmb), 2)
}
const nairaList = this.list.filter(v => v.currencyId === 3)
let naira,discountNaira
if (nairaList.length > 0) {
naira = nairaList.reduce((total, currentValue) => NP.plus(total, currentValue.totalAmount || 0), 0)
discountNaira = nairaList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
const t = copyList.find(v => v.currencyId == 3)
this.form.receiptAccountList = [
...this.form.receiptAccountList,
{
discountTotal: discountNaira,
currencyId: 3,
receivableAmount: naira,
writeOffRate: t?.writeOffRate || (this.showCurrencyId === 1 ? this.NANtoUS() : this.showCurrencyId === 2 ? this.NANtoRMB() : 1),
platformAccountId: t?.platformAccountId || '',
collectionCurrencyId: t?.collectionCurrencyId || '',
collectionRate: t?.collectionRate || '',
collectionAmount:discountNaira
}
]
this.calculationCount(NP.minus(naira, discountNaira), 3)
}
this.currencyList.forEach((item,index)=>{
var dollarList = this.list.filter(v => v.currencyId === item.id)
if(dollarList.length>0){
let dollar,discountDollar
dollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.totalAmount || 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)
}
})
// let dollar,discountDollar
// if (dollarList.length > 0) {
// dollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.totalAmount || 0), 0)
// discountDollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
// const t = copyList.find(v => v.currencyId == 1)
// this.form.receiptAccountList = [
// {
// discountTotal: discountDollar,
// currencyId: 1,
// receivableAmount: dollar,
// writeOffRate: t?.writeOffRate || (this.showCurrencyId === 1 ? 1 : this.showCurrencyId === 2 ? this.UStoRMB() : this.UStoNAN()),
// platformAccountId: t?.platformAccountId || '',
// collectionCurrencyId: t?.collectionCurrencyId || 1,
// collectionRate: t?.collectionRate || 1
// }
// ]
// this.calculationCount(NP.minus(dollar, discountDollar), 1)
// }
// const rmbList = this.list.filter(v => v.currencyId === 2)
// let rmb,discountRmb
// if (rmbList.length > 0) {
// rmb = rmbList.reduce((total, currentValue) => NP.plus(total, currentValue.totalAmount || 0), 0)
// discountRmb = rmbList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
// const t = copyList.find(v => v.currencyId == 2)
// this.form.receiptAccountList = [
// ...this.form.receiptAccountList,
// {
// discountTotal: discountRmb,
// currencyId: 2,
// receivableAmount: rmb,
// writeOffRate: t?.writeOffRate || (this.showCurrencyId === 1 ? this.RMBtoUS() : this.showCurrencyId === 2 ? 1 : this.RMBtoNAN()),
// platformAccountId: t?.platformAccountId || '',
// collectionCurrencyId: t?.collectionCurrencyId || '',
// collectionRate: t?.collectionRate || ''
// }
// ]
// this.calculationCount(NP.minus(rmb, discountRmb), 2)
// }
// const nairaList = this.list.filter(v => v.currencyId === 3)
// let naira,discountNaira
// if (nairaList.length > 0) {
// naira = nairaList.reduce((total, currentValue) => NP.plus(total, currentValue.totalAmount || 0), 0)
// discountNaira = nairaList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
// const t = copyList.find(v => v.currencyId == 3)
// this.form.receiptAccountList = [
// ...this.form.receiptAccountList,
// {
// discountTotal: discountNaira,
// currencyId: 3,
// receivableAmount: naira,
// writeOffRate: t?.writeOffRate || (this.showCurrencyId === 1 ? this.NANtoUS() : this.showCurrencyId === 2 ? this.NANtoRMB() : 1),
// platformAccountId: t?.platformAccountId || '',
// collectionCurrencyId: t?.collectionCurrencyId || '',
// collectionRate: t?.collectionRate || '',
// collectionAmount:discountNaira
// }
// ]
// this.calculationCount(NP.minus(naira, discountNaira), 3)
// }
if (this.form.receiptAccountList.length > 0) {
// totalAmount
const totalt = this.form.receiptAccountList.reduce((total, currentValue) => NP.plus(total, currentValue.writeOffAmount || 0), 0)
......
......@@ -548,6 +548,7 @@ export default {
});
},
getSummaries(param) {
console.log(param)
const { columns, data } = param;
const sums = new Array(columns.length).map(v => '');
const index = sums.length - 1
......@@ -654,9 +655,8 @@ export default {
},
handleSelectionChange(val) {
this.multipleSelection = val.map(v => {
if(v.currencyId === 1) return Object.assign(v, { exchangeRate: this.UStoRMB() })
if(v.currencyId === 2) return Object.assign(v, { exchangeRate: 1 })
if(v.currencyId === 3) return Object.assign(v, { exchangeRate: this.NANtoRMB() })
var rate = NP.divide(this.currencyList.find(vs => vs.id === v.currencyId).huilv, 100).toFixed(6)
return Object.assign(v, { exchangeRate: rate })
});
},
hiddenDialog() {
......
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