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

收款单bug修复

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