<template>
|
<div class="product">
|
<div v-for="(item,index) in financeArr" :key="index">
|
<div class="_block">
|
<p class="title">
|
<span></span>
|
财务信息
|
</p>
|
<el-form :model="financeForm[index]" :rules="rules" ref="financeForm" label-width="165px" size="small" inline>
|
<el-form-item label="回款账户开户银行名称" prop="repaymentbankno" v-if="item.repaymentbankno.visible">
|
<el-select
|
v-model="financeForm[index].repaymentbankno"
|
:disabled="!item.repaymentbankno.writeAble"
|
@change="selRepaymentbank"
|
clearable
|
filterable
|
placeholder="支持输入搜索选择"
|
>
|
<el-option
|
v-for="(item,index) in repaymentbankList"
|
:key="index"
|
:label="item.itemname"
|
:value="item.itemno"
|
></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item
|
label="回款账户开户银行分支行名称"
|
v-if="item.repaymentranchbankno.visible"
|
prop="repaymentranchbankno"
|
>
|
<el-input
|
v-model="financeForm[index].repaymentranchbankname"
|
readonly
|
class="input-with-select"
|
>
|
<el-button slot="append" icon="el-icon-search" v-if="item.repaymentranchbankno.writeAble" @click="getBankBranch"></el-button>
|
</el-input>
|
</el-form-item>
|
<el-form-item
|
label="回款账户户名"
|
v-if="item.repaymentaccountsname.visible"
|
prop="repaymentaccountsname"
|
>
|
<el-input
|
v-model="financeForm[index].repaymentaccountsname"
|
:disabled="!item.repaymentaccountsname.writeAble"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
label="回款账户账号"
|
v-if="item.repaymentaccountsno.visible"
|
prop="repaymentaccountsno"
|
>
|
<el-input
|
v-model="financeForm[index].repaymentaccountsno"
|
:disabled="!item.repaymentaccountsno.writeAble"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
label="鹏友收款对公户开户行"
|
v-if="item.balancebankname.visible"
|
prop="balancebankname"
|
>
|
<el-input
|
v-model="financeForm[index].balancebankname"
|
:disabled="!item.balancebankname.writeAble"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
label="鹏友收款对公户账号"
|
v-if="item.balanceaccount.visible"
|
prop="balanceaccount"
|
>
|
<el-input
|
v-model="financeForm[index].balanceaccount"
|
:disabled="!item.balanceaccount.writeAble"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
label="客户还款虚拟账号"
|
v-if="item.balancefictitiousaccount.visible"
|
prop="balancefictitiousaccount"
|
>
|
<el-input
|
v-model="financeForm[index].balancefictitiousaccount"
|
:disabled="!item.balancefictitiousaccount.writeAble"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
label="应回款金额"
|
v-if="item.paymentAmt.visible"
|
prop="paymentAmt"
|
>
|
<el-input
|
v-model="financeForm[index].paymentAmt"
|
:disabled="!item.paymentAmt.writeAble"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
label="已回款金额"
|
v-if="item.repaymentTotalAmt.visible"
|
prop="repaymentTotalAmt"
|
>
|
<el-input
|
v-model="financeForm[index].repaymentTotalAmt"
|
:disabled="!item.repaymentTotalAmt.writeAble"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
label="仍需回款金额"
|
v-if="item.surplusTotalAmt.visible"
|
prop="surplusTotalAmt"
|
>
|
<el-input
|
v-model="financeForm[index].surplusTotalAmt"
|
:disabled="!item.surplusTotalAmt.writeAble"
|
></el-input>
|
</el-form-item>
|
</el-form>
|
</div>
|
<WaitFunds
|
v-if="isclaimed == '0'"
|
@sendClaimResult='sendClaimResult'
|
:balancefictitiousaccount='financeForm[index].balancefictitiousaccount'
|
:surplusTotalAmt='financeForm[index].surplusTotalAmt'
|
operationType='0'
|
></WaitFunds>
|
<ClaimedFunds
|
:claimedFunds="receivableData"
|
operationType='0'
|
>
|
</ClaimedFunds>
|
</div>
|
<div class="fixedBtn">
|
<el-button
|
size="medium"
|
plain
|
@click="refuse"
|
v-if="applyInfo.phaseNo=='0220'"
|
>驳回/拒绝</el-button>
|
<el-button
|
size="medium"
|
plain
|
@click="prevStep"
|
>上一页</el-button>
|
<el-button
|
size="medium"
|
type="primary"
|
@click="submit(financeForm[0])"
|
v-if="applyInfo.phaseNo=='0220'"
|
>下一步</el-button>
|
<el-button
|
size="medium"
|
type="primary"
|
@click="nextPage()"
|
v-else
|
>下一页</el-button>
|
</div>
|
<Branch
|
v-if="showBranch"
|
:visible="showBranch"
|
:bank="bankNo"
|
@closeBranch="closeDialog"
|
@sendBranch="sendBranch"
|
></Branch>
|
</div>
|
</template>
|
<script>
|
import {
|
qryReceivableInfo,
|
qryBuildAccountDetail,
|
getBankList,
|
qryBankBranchList,
|
saveBuildAccountInfo
|
} from '@api/product'
|
import Branch from "@views/product/components/Branch";
|
import WaitFunds from '../../../components/WaitFunds'
|
import ClaimedFunds from '../../../components/ClaimedFunds'
|
import common from "@/utils/common";
|
export default {
|
data () {
|
return {
|
applyInfo:this.$store.state.product.applyInfo,
|
applyMenu: this.$store.state.product.applyMenu,
|
financeForm:[],
|
financeArr:[],
|
initialArr:[],
|
repaymentbankList:[],
|
receivableData:[],
|
rules:{},
|
bankNo: "",
|
isclaimed: '',
|
showBranch: false,
|
}
|
},
|
async created () {
|
this.$parent._data.loading = true;
|
const result = await this.qryBuildAccountDetail()
|
this.qryBuildAccountData(result)
|
this.getBankList()
|
const data = await this.qryReceivableInfo()
|
this.isclaimed = data.isclaimed.value
|
this.qryReceivableData(data.claimBankWaterMessageRes.receivableManage)
|
this.$parent._data.loading = false;
|
},
|
components: {
|
Branch,
|
WaitFunds,
|
ClaimedFunds
|
},
|
methods: {
|
// 接受子组件的传值并且更新已认领资金列表
|
async sendClaimResult(){
|
this.$parent._data.loading = true;
|
const buildAccountDetail = await this.qryBuildAccountDetail()
|
for (const key in buildAccountDetail) {
|
// 更新部分字段
|
if (
|
key == "paymentAmt" ||
|
key == "repaymentTotalAmt" ||
|
key == "surplusTotalAmt"
|
) {
|
buildAccountDetail[key].value = this.formatMoney(buildAccountDetail[key].value);
|
this.financeForm[0][key] = buildAccountDetail[key].value;
|
this.initialArr[0][key] = buildAccountDetail[key].value;
|
}
|
}
|
const receivableInfo = await this.qryReceivableInfo()
|
this.isclaimed = receivableInfo.isclaimed.value
|
this.qryReceivableData(receivableInfo.claimBankWaterMessageRes.receivableManage)
|
this.$parent._data.loading = false;
|
},
|
// 本金回款信息查询
|
qryReceivableInfo(){
|
return new Promise(resolve=>{
|
qryReceivableInfo({applySerialno:this.applyInfo.serialNo,receivableType:'07'}).then(res=>{
|
resolve(res.result)
|
})
|
})
|
},
|
// 对已认领资金数据进行处理
|
qryReceivableData(array){
|
this.receivableData = []
|
array.forEach(val => {
|
const obj = {}
|
for (const key in val) {
|
if(key == 'receivabletype'){
|
obj[key] = val[key].valueDesc
|
}else{
|
obj[key] = val[key].value
|
}
|
}
|
this.receivableData.push(obj)
|
});
|
},
|
// 财务信息查询
|
qryBuildAccountDetail(){
|
return new Promise(resolve=>{
|
qryBuildAccountDetail({objectNo:this.applyInfo.serialNo}).then(res=>{
|
resolve(res.result)
|
})
|
})
|
},
|
// 根据选中的银行获取银行名称和对应分支行
|
selRepaymentbank(val){
|
if(!val)return;
|
// 获取银行名称
|
for (let i = 0; i < this.repaymentbankList.length; i++) {
|
if(this.repaymentbankList[i].itemno == val){
|
this.financeForm[0].repaymentbankname = this.repaymentbankList[i].itemname
|
}
|
}
|
},
|
// 获取回款银行列表
|
getBankList(){
|
getBankList({itmeNo:'2,3',codeNo:'BankCode'}).then(res=>{
|
this.repaymentbankList = res.result
|
})
|
},
|
// 对财务信息数据进行排列
|
qryBuildAccountData(result){
|
this.financeArr = [result]
|
this.financeForm = []
|
this.initialArr = []
|
this.financeArr.forEach((val,index) => {
|
// 将数据重新排列
|
let obj = {};
|
for (const key in val) {
|
// 格式化金额并初始校验规则
|
if (
|
key == "paymentAmt" ||
|
key == "repaymentTotalAmt" ||
|
key == "surplusTotalAmt"
|
) {
|
val[key].value = this.formatMoney(val[key].value);
|
}
|
this.rules[key] = [];
|
if (val[key].required) {
|
this.rules[key].push({
|
required: true,
|
message: `请输入${val[key].filedDescription}`,
|
trigger: "change"
|
});
|
}
|
obj[key] = val[key].value;
|
}
|
this.financeForm.push(obj);
|
this.initialArr.push(Object.assign({},obj));
|
});
|
},
|
// 获取回款银行分支行
|
getBankBranch() {
|
if (!this.financeForm[0].repaymentbankno) {
|
this.$message.warning("回款账户开户银行名称不能为空");
|
return;
|
}
|
this.bankNo = this.financeForm[0].repaymentbankno;
|
this.showBranch = true;
|
},
|
// 接收子组件的传值
|
sendBranch(data) {
|
this.financeForm[0].repaymentranchbankno = data.bankno;
|
this.financeForm[0].repaymentranchbankname = data.bankname;
|
},
|
closeDialog(data) {
|
this.showBranch = data;
|
},
|
// 驳回/拒绝
|
refuse() {
|
this.$parent._data.showCredit = true;
|
this.applyMenu.forEach((val, index) => {
|
if (val.tabname == "本金回款信息") {
|
common.tabInfo(
|
this.applyMenu[index + 1].tabname,
|
this.applyInfo.flowno,
|
this
|
);
|
}
|
});
|
},
|
// 金额格式化
|
formatMoney(value) {
|
if (value) {
|
value =
|
parseFloat((value + "").replace(/[^\d\.-]/g, "")).toFixed(2) + "";
|
if (value == "NaN") return;
|
let l = value
|
.split(".")[0]
|
.split("")
|
.reverse();
|
let r = value.split(".")[1];
|
let t = "";
|
for (let i = 0; i < l.length; i++) {
|
t += l[i] + ((i + 1) % 3 === 0 && i + 1 !== l.length ? "," : "");
|
}
|
return (
|
t
|
.split("")
|
.reverse()
|
.join("") +
|
"." +
|
r
|
);
|
}
|
},
|
// 上一页
|
prevStep(){
|
this.applyMenu.forEach((val, index) => {
|
if (val.tabname == "本金回款信息") {
|
common.tabInfo(this.applyMenu[index - 1].tabname,this.applyInfo.flowno,this);
|
}
|
});
|
},
|
// 下一步校验必填
|
nextPage(){
|
// 调用父组件的查询左侧tab的方法
|
this.$parent.updateApplyTabTree('本金回款信息');
|
},
|
// 下一步
|
submit(form){
|
if(!common.validateForm(this.$refs.financeForm).flag)return;
|
saveBuildAccountInfo(form).then(async res=>{
|
if(res.code == '00'){
|
const result = await this.qryBuildAccountDetail()
|
this.qryBuildAccountData(result)
|
this.nextPage()
|
}
|
})
|
},
|
},
|
// 路由离开需要校验比较数据是否发生变化
|
beforeRouteLeave(to, from, next) {
|
for (let i = 0; i < this.financeForm.length; i++) {
|
for (const key in this.financeForm[i]) {
|
if (this.initialArr[i].hasOwnProperty(key)) {
|
if (this.financeForm[i][key] != this.initialArr[i][key]) {
|
// 页面有数据未保存
|
common.comfirm("提示", "当前页面有数据未保存,是否放弃保存?", () => {
|
next();
|
});
|
return;
|
}
|
}
|
}
|
}
|
next();
|
}
|
}
|
</script>
|