Commit f72cabfa authored by 我在何方's avatar 我在何方

收款单页面优化

parent eb666c55
...@@ -58,32 +58,14 @@ ...@@ -58,32 +58,14 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-descriptions :column="2" border class="card"> <el-descriptions :column="2" border class="card">
<!-- <el-descriptions-item v-for="(v, index) in form.platformAccountIdList" :label="`收款账户${index + 1}`" :key="index">
<div style="display: flex">
<el-button type="text" v-if="index === 0" @click="form.platformAccountIdList = [...form.platformAccountIdList, {}]">{{ $t('添加收款账户') }}</el-button>
<el-button type="text" v-if="index > 0" @click="subtractItem(index)"><span style="color: red">{{ $t('删除') }}</span></el-button>
</div>
</el-descriptions-item>
-->
<el-descriptions-item :label="$t('是否需要开票')"> <el-descriptions-item :label="$t('是否需要开票')">
<span>{{ form.openInvoice == 1 ? $t('需要') : $t('不需要') }}</span> <span>{{ form.openInvoice == 1 ? $t('需要') : $t('不需要') }}</span>
<!-- <el-select
v-model="form.openInvoice"
:placeholder="$t('请选择是否需要开票')"
>
<el-option :value="1" :label="$t('需要')"></el-option>
<el-option :value="0" :label="$t('不需要')"></el-option>
</el-select> -->
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label"> <template slot="label">
{{$t('核销基准币种')}} {{$t('核销基准币种')}}
<span :title="$t('应收可能出现多个币种的情况,多个币种没法计算整个收款单的核销比例,所以增加一个中间币种,如果应收只有一个币种就使用应收币种,如果有多个币种就以美元为核销基准币种')"><i class="el-icon-question"></i></span> <span :title="$t('应收可能出现多个币种的情况,多个币种没法计算整个收款单的核销比例,所以增加一个中间币种,如果应收只有一个币种就使用应收币种,如果有多个币种就以美元为核销基准币种')"><i class="el-icon-question"></i></span>
<!-- <el-tooltip class="item" effect="light" :content="$t('应收可能出现多个币种的情况,多个币种没法计算整个收款单的核销比例,所以增加一个中间币种,如果应收只有一个币种就使用应收币种,如果有多个币种就以美元为核销基准币种')" placement="top">
<el-button icon="el-icon-question"></el-button>
</el-tooltip> -->
</template> </template>
{{getCurrencyLabel(showCurrencyId)}} {{getCurrencyLabel(showCurrencyId)}}
</el-descriptions-item> </el-descriptions-item>
</el-descriptions> </el-descriptions>
...@@ -93,31 +75,24 @@ ...@@ -93,31 +75,24 @@
<el-descriptions :column="3" border> <el-descriptions :column="3" border>
<el-descriptions-item :label="$t('发票抬头')"> <el-descriptions-item :label="$t('发票抬头')">
{{ form.invoice }} {{ form.invoice }}
<!-- <el-input v-model="form.invoice"></el-input> -->
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item :label="$t('纳税人识别号')"> <el-descriptions-item :label="$t('纳税人识别号')">
{{ form.taxpayer }} {{ form.taxpayer }}
<!-- <el-input v-model="form.taxpayer"></el-input> -->
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item :label="$t('开户行')"> <el-descriptions-item :label="$t('开户行')">
{{ form.accountBank }} {{ form.accountBank }}
<!-- <el-input v-model="form.accountBank"></el-input> -->
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item :label="$t('账号')"> <el-descriptions-item :label="$t('账号')">
{{ form.accountName }} {{ form.accountName }}
<!-- <el-input v-model="form.accountName"></el-input> -->
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item :label="$t('项目')"> <el-descriptions-item :label="$t('项目')">
{{ form.projectName }} {{ form.projectName }}
<!-- <el-input v-model="form.projectName"></el-input> -->
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item :label="$t('税率')+'%'"> <el-descriptions-item :label="$t('税率')+'%'">
{{ form.taxRate }} {{ form.taxRate }}
<!-- <el-input v-model="form.taxRate"></el-input> -->
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item :label="$t('开票地址/电话')"> <el-descriptions-item :label="$t('开票地址/电话')">
{{ form.addressPhone }} {{ form.addressPhone }}
<!-- <el-input v-model="form.addressPhone"></el-input> -->
</el-descriptions-item> </el-descriptions-item>
</el-descriptions> </el-descriptions>
</el-card> </el-card>
...@@ -130,7 +105,6 @@ ...@@ -130,7 +105,6 @@
{{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"> <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&&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>
...@@ -163,21 +137,11 @@ ...@@ -163,21 +137,11 @@
<el-table-column :label="$t('期望收款币种')" align="center"> <el-table-column :label="$t('期望收款币种')" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<!-- <dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="scope.row.collectionCurrencyId" /> -->
{{getCurrencyLabel(scope.row.collectionCurrencyId)}} {{getCurrencyLabel(scope.row.collectionCurrencyId)}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('期望收款汇率')" align="center"> <el-table-column :label="$t('期望收款汇率')" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<!-- <el-form-item
v-if="scope.row.type !== 'total'"
label=""
label-width="0"
style="margin-bottom: 0"
:prop="`receiptAccountList.${scope.$index}.collectionRate`"
>
<el-input v-model="scope.row.collectionRate" @input="() => rateChange(scope.row, scope.$index)"></el-input>
</el-form-item> -->
<span v-if="scope.row.type !== 'total'">{{ scope.row.collectionRate }}</span> <span v-if="scope.row.type !== 'total'">{{ scope.row.collectionRate }}</span>
<span v-else>{{ $t('期望收费金额') }} <span v-else>{{ $t('期望收费金额') }}
<span :title="$t('导出账单给客户时显示的收款金额与币种')"><i class="el-icon-question"></i></span> <span :title="$t('导出账单给客户时显示的收款金额与币种')"><i class="el-icon-question"></i></span>
...@@ -190,36 +154,19 @@ ...@@ -190,36 +154,19 @@
<span v-if="scope.row.type !== 'total'">{{ scope.row.collectionAmount||0 }}</span> <span v-if="scope.row.type !== 'total'">{{ scope.row.collectionAmount||0 }}</span>
<div v-else> <div v-else>
<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-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[1]">{{ $t('人民币') }}: {{ scope.row.collectionAmount[1] }}</div>
<div v-if="scope.row.collectionAmount[2]">{{ $t('奈拉') }}: {{ scope.row.collectionAmount[2] }}</div> -->
</div> </div>
<!-- <dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="scope.row.currencyId" /> -->
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-descriptions :column="2" border class="card"> <el-descriptions :column="2" border class="card">
<el-descriptions-item :label="$t('账单汇率有效期')"> <el-descriptions-item :label="$t('账单汇率有效期')">
{{ parseTime(form.rateValidateDate) }} {{ parseTime(form.rateValidateDate) }}
<!-- <el-form-item
label=""
label-width="0"
style="margin-bottom: 0"
prop="rateValidateDate"
>
<el-date-picker
v-model="form.rateValidateDate"
type="datetime"
:placeholder="$t('选择日期时间')">
</el-date-picker>
</el-form-item> -->
</el-descriptions-item> </el-descriptions-item>
</el-descriptions> </el-descriptions>
</el-card> </el-card>
<el-card class="card"> <el-card class="card">
<div slot="header" class="card-title">{{ $t('银行收款明细') }}</div> <div slot="header" class="card-title">{{ $t('银行收款明细') }}</div>
<div> <div>
<!-- <el-button type="primary" v-if="form.state!=7&&form.state!=0" plain size="mini" @click="batchVerification" v-hasPermi="['ecw:payment:detail:batchWriteOff']" style="padding: 10px; margin-bottom: 10px">{{ $t('批量核销') }}</el-button> -->
<el-button type="primary" v-if="form.state!=7&&form.state!=0" plain size="mini" @click="handleAddReceiptItem" v-hasPermi="['ecw:payment:detail:addBank']" style="padding: 10px; margin-bottom: 10px">{{ $t('添加收款明细') }}</el-button> <el-button type="primary" v-if="form.state!=7&&form.state!=0" plain size="mini" @click="handleAddReceiptItem" v-hasPermi="['ecw:payment:detail:addBank']" style="padding: 10px; margin-bottom: 10px">{{ $t('添加收款明细') }}</el-button>
</div> </div>
<el-table ref="multipleTable" :data="detailed" border row-key="id" @selection-change="handleSelectionChange"> <el-table ref="multipleTable" :data="detailed" border row-key="id" @selection-change="handleSelectionChange">
...@@ -233,16 +180,12 @@ ...@@ -233,16 +180,12 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('汇率')" align="center" prop="rate" /> <el-table-column :label="$t('汇率')" align="center" prop="rate" />
<!-- <el-table-column :label="$t('核销货币金额')" align="center" prop="writeOffAmount" />-->
<el-table-column align="center" prop="writeOffAmount" > <el-table-column align="center" prop="writeOffAmount" >
<template #header> <template #header>
{{ $t('兑核销基准金额') }}{{getCurrencyLabel(showCurrencyId)}} {{ $t('兑核销基准金额') }}{{getCurrencyLabel(showCurrencyId)}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('实收日期')" align="center" prop="amountDate"> <el-table-column :label="$t('实收日期')" align="center" prop="amountDate">
<!-- <template slot-scope="scope">
<span>{{ parseTime(scope.row.amountDate, '{y}-{m}-{d}') }}</span>
</template> -->
</el-table-column> </el-table-column>
<el-table-column :label="$t('水单号')" align="center" prop="billNo" /> <el-table-column :label="$t('水单号')" align="center" prop="billNo" />
<el-table-column :label="$t('水单附件')" align="center" prop="attr"> <el-table-column :label="$t('水单附件')" align="center" prop="attr">
...@@ -275,13 +218,8 @@ ...@@ -275,13 +218,8 @@
<el-card class="card hexiaoCard"> <el-card class="card hexiaoCard">
<el-descriptions :column="3" border> <el-descriptions :column="3" border>
<el-descriptions-item > <el-descriptions-item >
<!-- <el-tag>{{ verificationData.usCount.toFixed(6) }}{{$t('美元')}}</el-tag>
<el-tag>{{ verificationData.rmbCount.toFixed(6) }}{{$t('人民币')}}</el-tag>
<el-tag>{{ verificationData.nairaCount.toFixed(6) }}{{$t('奈拉')}}</el-tag> -->
<template slot="label"> <template slot="label">
{{ $t('实收已核销总金额') }} <span :title="$t('所有银行收款明细中状态为已核销的实收金额,币种根据实收币种分类统计')"><i class="el-icon-question"></i></span> {{ $t('实收已核销总金额') }}<span :title="$t('所有银行收款明细中状态为已核销的实收金额,币种根据实收币种分类统计')"><i class="el-icon-question"></i></span>
</template> </template>
<template v-if="!Object.keys(writeOffTotal).length"> <template v-if="!Object.keys(writeOffTotal).length">
0 0
...@@ -291,22 +229,18 @@ ...@@ -291,22 +229,18 @@
{{amount}}{{getCurrencyLabel(currency)}} {{amount}}{{getCurrencyLabel(currency)}}
</div> </div>
</div> </div>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label"> <template slot="label">
{{ $t('核销基准币种已核销总金额') }}{{getCurrencyLabel(showCurrencyId)}} {{ $t('核销基准币种已核销总金额') }}{{getCurrencyLabel(showCurrencyId)}}
<span :title="$t('为了方便统计收款单核销比例,将所有银行收款明细中状态为已核销的实收金额,转换为核销基准币种的金额累加')"><i class="el-icon-question"></i></span> <span :title="$t('为了方便统计收款单核销比例,将所有银行收款明细中状态为已核销的实收金额,转换为核销基准币种的金额累加')"><i class="el-icon-question"></i></span>
</template> </template>
{{ writeOffAmount}} {{ writeOffAmount}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label"> <template slot="label">
{{ $t('总核销比例') }}{{getCurrencyLabel(showCurrencyId)}} {{ $t('总核销比例') }}{{getCurrencyLabel(showCurrencyId)}}
<span :title="$t('总核销比例=核销基准币种已核销总金额/核销基准币种应收总金额')"><i class="el-icon-question"></i></span> <span :title="$t('总核销比例=核销基准币种已核销总金额/核销基准币种应收总金额')"><i class="el-icon-question"></i></span>
</template> </template>
{{ WriteOffProportion }}% {{ WriteOffProportion }}%
</el-descriptions-item> </el-descriptions-item>
...@@ -443,9 +377,6 @@ ...@@ -443,9 +377,6 @@
:value="item.id" :value="item.id"
/> />
</el-select> </el-select>
<!-- <dict-selector v-if="!isView" :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" v-model="addForm.currencyId" @change="val => currencyIdChange(val)"/> -->
<!-- <span v-else>{{ addForm.currencyId }}</span> -->
<!-- <dict-tag v-else :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="addForm.currencyId" /> -->
</el-form-item> </el-form-item>
</div> </div>
<el-form-item <el-form-item
...@@ -454,9 +385,6 @@ ...@@ -454,9 +385,6 @@
:rules="{ required: true, trigger: ['blur', 'change'], message: $t('兑核销基准币种汇率不能为空') }" :rules="{ required: true, trigger: ['blur', 'change'], message: $t('兑核销基准币种汇率不能为空') }"
> >
<template slot="label"> <template slot="label">
<!-- <el-tooltip class="item" effect="light" :content="$t('实收币种与核销基准币种一样时,无需填写汇率,不一样需要填写汇率')" placement="top-start">
<el-button> {{ $t('兑核销基准币种汇率') }}{{getCurrencyLabel(showCurrencyId)}}</el-button>
</el-tooltip> -->
<span :title="$t('实收币种与核销基准币种一样时,无需填写汇率,不一样需要填写汇率')">{{ $t('兑核销基准币种汇率') }}{{getCurrencyLabel(showCurrencyId)}}</span> <span :title="$t('实收币种与核销基准币种一样时,无需填写汇率,不一样需要填写汇率')">{{ $t('兑核销基准币种汇率') }}{{getCurrencyLabel(showCurrencyId)}}</span>
</template> </template>
<el-input v-if="!isView" v-model="addForm.rate" style="width: 220px"></el-input> <el-input v-if="!isView" v-model="addForm.rate" style="width: 220px"></el-input>
...@@ -685,7 +613,6 @@ export default { ...@@ -685,7 +613,6 @@ export default {
if(item.status){ if(item.status){
total = NP.plus(total, item.writeOffAmount) total = NP.plus(total, item.writeOffAmount)
} }
// total = NP.plus(total, item.writeOffAmount)
}) })
let portion = NP.divide(total,amountTotal) let portion = NP.divide(total,amountTotal)
...@@ -695,9 +622,6 @@ export default { ...@@ -695,9 +622,6 @@ export default {
} }
}, },
watch: { watch: {
// 'addForm.currencyId'(newVal) {
// this.currencyIdChange(newVal)
// },
'addForm.rate'() { 'addForm.rate'() {
this.setWriteOffAmount() this.setWriteOffAmount()
}, },
...@@ -724,21 +648,6 @@ export default { ...@@ -724,21 +648,6 @@ export default {
await getExchangeRatePage(this.params).then(res => this.rateList = res.data.list) await getExchangeRatePage(this.params).then(res => this.rateList = res.data.list)
await listSimpleDepts().then((res) => { await listSimpleDepts().then((res) => {
this.deptData = res.data this.deptData = res.data
// res.data.forEach((item) => {
// if (item.parentId == 0) {
// this.deptArr.push(item);
// } else {
// this.deptData.push(item);
// }
// });
// this.deptData.forEach((value) => {
// var dept = this.deptArr.filter((itt) => itt.id == value.parentId);
// if (dept.length > 0) {
// value.name = dept[0].name + " | " + value.name;
// }
// });
// console.log(this.deptData)
}); });
await getBankAccountPage(this.codePage).then((res) => { await getBankAccountPage(this.codePage).then((res) => {
this.bankData = res.data.list this.bankData = res.data.list
...@@ -748,11 +657,7 @@ export default { ...@@ -748,11 +657,7 @@ export default {
this.id = this.$route.query.id; this.id = this.$route.query.id;
await getReceiptInfoByIds({ id: this.id }).then(res => { await getReceiptInfoByIds({ id: this.id }).then(res => {
this.form = res.data this.form = res.data
// getCustomer(this.form.customerId).then(res => { let dept = this.deptData.filter((itt) => itt.id == res.data.departmentId);
// this.form.customerName = res?.data?.name
// })
var dept = this.deptData.filter((itt) => itt.id == res.data.departmentId);
// console.log(dept)
if(dept.length>0){ if(dept.length>0){
this.form.departmentName = dept[0].name this.form.departmentName = dept[0].name
} }
...@@ -762,7 +667,6 @@ export default { ...@@ -762,7 +667,6 @@ export default {
}) })
getReceiptAccountList({ id: this.id }).then(res => { getReceiptAccountList({ id: this.id }).then(res => {
if (res.data.length > 0) { if (res.data.length > 0) {
// totalAmount
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).toFixed(2), writeOffAmount: res.data.reduce((total, currentValue) => NP.plus(total, currentValue.writeOffAmount || 0), 0).toFixed(2),
...@@ -771,43 +675,19 @@ export default { ...@@ -771,43 +675,19 @@ export default {
} }
this.$set(this.form, 'receiptAccountList', res.data) this.$set(this.form, 'receiptAccountList', res.data)
// 收款总计 // 收款总计
// const dollarList = res.data.filter(v => v.collectionCurrencyId == 1)
// const dollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.collectionAmount || 0), 0)
// const rmbList = res.data.filter(v => v.collectionCurrencyId == 3)
// const rmb = rmbList.reduce((total, currentValue) => NP.plus(total, currentValue.collectionAmount || 0), 0)
// const nairaList = res.data.filter(v => v.collectionCurrencyId == 2) let num
// const naira = nairaList.reduce((total, currentValue) => NP.plus(total, currentValue.collectionAmount || 0), 0) let amountList =[]
// res.data[res.data.length -1].collectionAmount = [dollar, rmb, naira]
// this.$set(this.form, 'receiptAccountList', [...this.form.receiptAccountList])
// const dollarListByList = this.list.filter(v => v.currencyId === 1)
// const discountDollar = dollarListByList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
// const d = res.data.find(v => v.currencyId == 1)
// d && (d.discountTotal = discountDollar)
// const rmbListByList = this.list.filter(v => v.currencyId === 3)
// const discountRmb = rmbListByList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
// const r = res.data.find(v => v.currencyId == 3)
// r && (r.discountTotal = discountRmb)
var n
// 收款总计
var amountList =[]
this.currencyList.forEach((item,index)=>{ this.currencyList.forEach((item,index)=>{
var nairaListByList = this.list.filter(v => v.currencyId === item.id) let nairaListByList = this.list.filter(v => v.currencyId === item.id)
if(nairaListByList.length>0){ if(nairaListByList.length>0){
var discountNaira = nairaListByList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0) let discountNaira = nairaListByList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
n = res.data.find(v => v.currencyId == item.id) num = res.data.find(v => v.currencyId == item.id)
n && (n.discountTotal = discountNaira) num && (num.discountTotal = discountNaira)
} }
var dollarList = this.form.receiptAccountList.filter(v => v.collectionCurrencyId == item.id) let 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), 0).toFixed(2) let dollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.collectionAmount || 0), 0).toFixed(2)
// if(n && n.discountTotal&&n.discountTotal>0){ // if(n && n.discountTotal&&n.discountTotal>0){
// amountList.push({currencyName:item.titleZh, currencyId: item.id, amount:(dollar-n.discountTotal).toFixed(2)}) // amountList.push({currencyName:item.titleZh, currencyId: item.id, amount:(dollar-n.discountTotal).toFixed(2)})
// }else{ // }else{
...@@ -821,9 +701,6 @@ export default { ...@@ -821,9 +701,6 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
// this.form.receiptAccountList.forEach((item, index) => {
// this.rateChange(item, index)
// });
if(this.form.receiptAccountList.length>0){ if(this.form.receiptAccountList.length>0){
this.editReceiptAccountList() this.editReceiptAccountList()
} }
...@@ -862,11 +739,11 @@ export default { ...@@ -862,11 +739,11 @@ export default {
this.form.receiptAccountList[index] = {...row} this.form.receiptAccountList[index] = {...row}
}, },
editReceiptAccountList(){ editReceiptAccountList(){
var amountList =[] let amountList =[]
this.currencyList.forEach((item,index)=>{ this.currencyList.forEach((item,index)=>{
var dollarList = this.form.receiptAccountList.filter(v => v.collectionCurrencyId == item.id) let 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), 0) let dollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.collectionAmount || 0), 0)
amountList.push({currencyId:item.id,currencyNameEn:item.titleEn,currencyNameZh:item.titleZh,amount:dollar.toFixed(2)}) amountList.push({currencyId:item.id,currencyNameEn:item.titleEn,currencyNameZh:item.titleZh,amount:dollar.toFixed(2)})
} }
}) })
...@@ -874,14 +751,12 @@ export default { ...@@ -874,14 +751,12 @@ export default {
this.$set(this.form, 'receiptAccountList', [...this.form.receiptAccountList]) this.$set(this.form, 'receiptAccountList', [...this.form.receiptAccountList])
}, },
setWriteOffAmount() { setWriteOffAmount() {
var pointArr = [] let pointArr = []
var regs=/^[0-9]+\d*(\.\d*)?$|^0?\.\d*[0-9]\d*$/; let regs=/^[0-9]+\d*(\.\d*)?$|^0?\.\d*[0-9]\d*$/;
if(this.addForm.amount&&!regs.test(this.addForm.amount)){ if(this.addForm.amount&&!regs.test(this.addForm.amount)){
this.addForm.amount = '' this.addForm.amount = ''
this.$modal.msgError(this.$t('输入金额不对')); this.$modal.msgError(this.$t('输入金额不对'));
}else{ }else{
// console.log(this.addForm.amount)
// this.addForm.amount = this.addForm.amount.toFixed(2)
if(this.addForm&&this.addForm.amount){ if(this.addForm&&this.addForm.amount){
pointArr = this.addForm.amount.toString().split('.') pointArr = this.addForm.amount.toString().split('.')
if(pointArr.length>1&&pointArr[1]){ if(pointArr.length>1&&pointArr[1]){
...@@ -892,7 +767,7 @@ export default { ...@@ -892,7 +767,7 @@ export default {
this.$set(this.addForm, 'writeOffAmount', NP.times(this.addForm.rate || 0, this.addForm.amount || 0)) this.$set(this.addForm, 'writeOffAmount', NP.times(this.addForm.rate || 0, this.addForm.amount || 0))
}, },
getCurrencyLabel(id){ getCurrencyLabel(id){
var label = this.currencyList.filter(item=>item.id == id) let label = this.currencyList.filter(item=>item.id == id)
if(label.length>0) return this.$i18n.locale=='zh_CN'?label[0].titleZh:label[0].titleEn if(label.length>0) return this.$i18n.locale=='zh_CN'?label[0].titleZh:label[0].titleEn
return '' return ''
}, },
...@@ -933,82 +808,8 @@ export default { ...@@ -933,82 +808,8 @@ export default {
} }
}) })
}, },
calculation() {
// 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))
// const nairaCount = NP.plus(naira, NP.times(this.UStoNAN(), dollar), NP.times(this.RMBtoNAN(), rmb))
// this.verificationData.usCount = usCount
// this.verificationData.rmbCount = rmbCount
// this.verificationData.nairaCount = nairaCount
// 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)
// 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: 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 = {
// usAmount: NP.times(this.NANtoUS(), remaining),
// rmbAmount: NP.times(this.NANtoRMB(), remaining),
// nairaAmount: remaining
// }
// this.remainingAmount.nairaAmount = remaining
// }
},
accountChange(val){ accountChange(val){
var data = this.bankData.find(item=>item.id==val) let data = this.bankData.find(item=>item.id==val)
this.$set(this.addForm,'accountName',data.baAccountName||'') this.$set(this.addForm,'accountName',data.baAccountName||'')
this.$set(this.addForm,'accountNo',data.baAccountNum||'') this.$set(this.addForm,'accountNo',data.baAccountNum||'')
this.$set(this.addForm,'accountBankName',data.baBankName||'') this.$set(this.addForm,'accountBankName',data.baBankName||'')
...@@ -1102,7 +903,7 @@ export default { ...@@ -1102,7 +903,7 @@ export default {
getCustomer(this.form.customerId).then(res => { getCustomer(this.form.customerId).then(res => {
this.form.customerName = res?.data?.name this.form.customerName = res?.data?.name
}) })
var dept = this.deptData.filter((itt) => itt.id == res.data.departmentId); let dept = this.deptData.filter((itt) => itt.id == res.data.departmentId);
// console.log(dept) // console.log(dept)
if(dept.length>0){ if(dept.length>0){
this.form.departmentName = dept[0].name this.form.departmentName = dept[0].name
...@@ -1115,7 +916,7 @@ export default { ...@@ -1115,7 +916,7 @@ export default {
this.$modal.msgError(this.$t('请输入申请理由')); this.$modal.msgError(this.$t('请输入申请理由'));
return return
} }
var receiptItemId = this.detailed[this.selectIndex].id let receiptItemId = this.detailed[this.selectIndex].id
if(this.cancelType==1){ if(this.cancelType==1){
cancelFinanceReceiptItemWriteOff({receiptItemId:receiptItemId,remark:this.cancelReason}).then(res=>{ cancelFinanceReceiptItemWriteOff({receiptItemId:receiptItemId,remark:this.cancelReason}).then(res=>{
this.cancelShow = false this.cancelShow = false
...@@ -1139,19 +940,13 @@ export default { ...@@ -1139,19 +940,13 @@ export default {
if(val === this.showCurrencyId) { if(val === this.showCurrencyId) {
rate = 1 rate = 1
} else { } else {
// if (this.showCurrencyId === 1 && val === 3) rate = this.RMBtoUS()
// else if (this.showCurrencyId === 1 && val === 2) rate = this.NANtoUS()
// else if (this.showCurrencyId === 3 && val === 1) rate = this.UStoRMB()
// else if (this.showCurrencyId === 3 && val === 2) rate = this.NANtoRMB()
// else if (this.showCurrencyId === 2 && val === 1) rate = this.UStoNAN()
// else if (this.showCurrencyId === 2 && val === 3) rate = this.RMBtoNAN()
rate = this.getRate(val,this.showCurrencyId) rate = this.getRate(val,this.showCurrencyId)
} }
this.$set(this.addForm, 'rate', rate) this.$set(this.addForm, 'rate', rate)
}, },
//获取汇率 //获取汇率
getRate(sourceCurrencyId,targetCurrencyId){ getRate(sourceCurrencyId,targetCurrencyId){
var rate = this.rateList.find(v=>(v.sourceCurrencyId === sourceCurrencyId&&v.targetCurrencyId===targetCurrencyId)) let rate = this.rateList.find(v=>(v.sourceCurrencyId === sourceCurrencyId&&v.targetCurrencyId===targetCurrencyId))
if(rate) return rate.currencyRate if(rate) return rate.currencyRate
return '' return ''
}, },
...@@ -1163,7 +958,6 @@ export default { ...@@ -1163,7 +958,6 @@ export default {
rate:parseFloat(v.rate), rate:parseFloat(v.rate),
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()
}) })
}, },
saveFrom() { saveFrom() {
...@@ -1212,7 +1006,7 @@ export default { ...@@ -1212,7 +1006,7 @@ export default {
this.isView = false this.isView = false
setTimeout(() => { setTimeout(() => {
this.addForm = { ...row } this.addForm = { ...row }
var bank = this.bankData.find(v=>v.baAccountNum==this.addForm.accountNo) let bank = this.bankData.find(v=>v.baAccountNum==this.addForm.accountNo)
if(bank) this.addForm.accountId = bank.id if(bank) this.addForm.accountId = bank.id
this.setWriteOffAmount() this.setWriteOffAmount()
}, 0) }, 0)
...@@ -1308,7 +1102,7 @@ export default { ...@@ -1308,7 +1102,7 @@ export default {
this.saveBtnText = this.$t('添加') this.saveBtnText = this.$t('添加')
}, },
handleUploadSuccess(res, file, fileList) { handleUploadSuccess(res, file, fileList) {
var arr = []; let arr = [];
setTimeout(() => { setTimeout(() => {
fileList.forEach((item) => { fileList.forEach((item) => {
arr.push({ name: item.name, url: item.response ? item.response.data : item.url }); arr.push({ name: item.name, url: item.response ? item.response.data : item.url });
......
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