<template>
|
<div class="product">
|
<div class="borrower" v-for="(item, index) in borrowerArr" :key="index">
|
<p class="title">
|
<span></span>
|
和解信息
|
</p>
|
<el-form
|
:model="borrowerForm[index]"
|
:rules="rules"
|
:ref="`borrowerForm${index}`"
|
size="small"
|
inline
|
label-width="165px"
|
>
|
<div class="form">
|
<el-form-item
|
label="委外律所"
|
v-if="borrowerArr[index].lawName.visible"
|
prop="lawName"
|
>
|
<el-select
|
v-model="borrowerForm[index].lawName"
|
filterable
|
placeholder="请选择"
|
:disabled="!borrowerArr[index].lawName.writeAble"
|
>
|
<el-option
|
v-for="(item, index) in lawNameList"
|
:key="index"
|
:label="item.itemname"
|
:value="item.itemname"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item
|
label="委外律所时间"
|
v-if="borrowerArr[index].outsourcingTime.visible"
|
prop="outsourcingTime"
|
>
|
<el-date-picker
|
v-model="borrowerForm[index].outsourcingTime"
|
type="date"
|
format="yyyy/MM/dd"
|
value-format="yyyy/MM/dd"
|
placeholder="选择日期"
|
:disabled="!borrowerArr[index].outsourcingTime.writeAble"
|
/>
|
</el-form-item>
|
<el-form-item
|
label="还款期限"
|
v-if="borrowerArr[index].repayTerm.visible"
|
prop="repayTerm"
|
>
|
<el-select
|
v-model="borrowerForm[index].repayTerm"
|
filterable
|
placeholder="请选择"
|
:disabled="!borrowerArr[index].repayTerm.writeAble"
|
>
|
<el-option
|
v-for="(item, index) in repayTermList"
|
:key="index"
|
:label="item.repayTermName"
|
:value="item.repayTermNo"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item
|
label="是否增加直系亲属担保"
|
v-if="borrowerArr[index].havingKin.visible"
|
prop="havingKin"
|
>
|
<el-select
|
v-model="borrowerForm[index].havingKin"
|
filterable
|
placeholder="请选择"
|
:disabled="!borrowerArr[index].havingKin.writeAble"
|
>
|
<el-option
|
v-for="(item, index) in havingKinList"
|
:key="index"
|
:label="item.havingKinName"
|
:value="item.havingKinNo"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item
|
label="贷款利率(%)"
|
v-if="borrowerArr[index].loanRate.visible"
|
prop="loanRate"
|
>
|
<el-input
|
v-model="borrowerForm[index].loanRate"
|
:disabled="!borrowerArr[index].loanRate.writeAble"
|
placeholder="请输入"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
label="是否完成回款账户变更流程"
|
v-if="borrowerArr[index].changedAccountFlow.visible"
|
prop="changedAccountFlow"
|
>
|
<el-select
|
v-model="borrowerForm[index].changedAccountFlow"
|
filterable
|
placeholder="请选择"
|
:disabled="!borrowerArr[index].changedAccountFlow.writeAble"
|
>
|
<el-option
|
v-for="(item, index) in changedAccountFlowList"
|
:key="index"
|
:label="item.changedAccountFlowName"
|
:value="item.changedAccountFlowNo"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item
|
label="是否绑卡"
|
v-if="borrowerArr[index].bindBankStatus.visible"
|
prop="bindBankStatus"
|
>
|
<el-select
|
v-model="borrowerForm[index].bindBankStatus"
|
filterable
|
placeholder="请选择"
|
:disabled="!borrowerArr[index].bindBankStatus.writeAble"
|
>
|
<el-option
|
v-for="(item, index) in bindBankStatusList"
|
:key="index"
|
:label="item.bindBankStatusName"
|
:value="item.bindBankStatusNo"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item
|
label="和解协议签署日期"
|
v-if="borrowerArr[index].reconcileSignDate.visible"
|
prop="reconcileSignDate"
|
>
|
<el-date-picker
|
v-model="borrowerForm[index].reconcileSignDate"
|
type="date"
|
format="yyyy/MM/dd"
|
value-format="yyyy/MM/dd"
|
placeholder="选择日期"
|
:disabled="!borrowerArr[index].reconcileSignDate.writeAble"
|
/>
|
</el-form-item>
|
<el-form-item
|
label="首次还款日期"
|
v-if="borrowerArr[index].firstRepayDate.visible"
|
prop="firstRepayDate"
|
>
|
<el-date-picker
|
v-model="borrowerForm[index].firstRepayDate"
|
type="date"
|
format="yyyy/MM/dd"
|
value-format="yyyy/MM/dd"
|
placeholder="选择日期"
|
:disabled="!borrowerArr[index].firstRepayDate.writeAble"
|
/>
|
</el-form-item>
|
<el-form-item
|
label="和解状态"
|
v-if="borrowerArr[index].reconcileStatus.visible"
|
prop="reconcileStatus"
|
>
|
<el-select
|
v-model="borrowerForm[index].reconcileStatus"
|
filterable
|
placeholder="请选择"
|
:disabled="!borrowerArr[index].reconcileStatus.writeAble"
|
>
|
<el-option
|
v-for="(item, index) in reconcileStatusList"
|
:key="index"
|
:label="item.reconcileStatusName"
|
:value="item.reconcileStatusNo"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</div>
|
</el-form>
|
<el-button
|
size="small"
|
type="primary"
|
style="margin: 0 0 20px 10px"
|
@click="saveLawInfo()"
|
>保存律所信息</el-button
|
>
|
<p class="title">
|
<span></span>
|
律所沟通记录
|
</p>
|
<el-form ref="lawForm" size="small" inline label-width="165px">
|
<el-form-item
|
label="律所沟通记录"
|
class="content-input"
|
style="width: 100%"
|
prop="memo"
|
>
|
<el-input
|
:rows="3"
|
type="textarea"
|
placeholder="请输入"
|
v-model="currentLawCom"
|
style="width: 1000px"
|
></el-input>
|
<el-button
|
size="small"
|
type="primary"
|
style="margin: 0 0 0 10px"
|
@click="saveLawCommunication()"
|
>保存</el-button
|
>
|
</el-form-item>
|
</el-form>
|
<KeysTable
|
:list="lawCommunHistoryList"
|
:header="lawCommunHistoryListHeader"
|
:isShowPages="false"
|
title="律所沟通历史记录"
|
></KeysTable>
|
<p class="title" style="margin: 20px 0 20px 0">
|
<span></span>
|
首次还款试算
|
</p>
|
<el-button
|
size="small"
|
type="primary"
|
style="margin: 0 0 0 10px"
|
@click="firstRepaymentTrialCalculation()"
|
>首次还款试算</el-button
|
>
|
<FormInfo
|
:info="firstRepaymentInfo"
|
:keys="firstRepaymentHeader"
|
title="首次还款试算"
|
:loading="firstRepaymentLoading"
|
></FormInfo>
|
<KeysTable
|
:list="vLoanReconcileRepaymentTrialList"
|
:header="vLoanReconcileRepaymentTrialListHeader"
|
:isShowPages="false"
|
title=""
|
@doAction="doAction"
|
></KeysTable>
|
<KeysTable
|
:list="first5DayScheduledRepaymentList"
|
:header="first5DayScheduledRepaymentHeader"
|
:isShowPages="false"
|
title="首次还款预计金额"
|
></KeysTable>
|
</div>
|
|
<ListDetailDialog
|
v-if="showDetailList"
|
v-on:closeApply="closeApply"
|
:visible="showDetailList"
|
title="还款明细"
|
:showList="detailList"
|
:showListHeader="detailListHeader"
|
/>
|
<div class="btn">
|
<el-button size="medium" plain @click="prevPage()">上一页</el-button>
|
<el-button
|
size="medium"
|
:loading="submitLoading"
|
type="primary"
|
@click="nextPage()"
|
>下一页</el-button
|
>
|
</div>
|
</div>
|
</template>
|
<script>
|
import FormInfo from "../../../../comprehensiveTransaction/components/FormInfo.vue";
|
import ListDetailDialog from "../../../components/ListDetailDialog.vue";
|
import KeysTable from "../../../../comprehensiveTransaction/components/KeysTable.vue";
|
import common from "@/utils/common";
|
import {
|
qryMainCreditInfo, //查询主授信人信息
|
qryReconcileInfoMap, //查询和解信息
|
qryCommunicationInfo, //查询律所历史沟通信息
|
saveCommunicationInfo, // 保存律所沟通记录
|
saveReconcileInfo, //保存律所信息
|
trialFirstPayment, //V贷首次还款试算
|
queryPaymentCalcLog, //查询首次还款试算明细
|
queryPaymentCalcResult, //查询首次还款试算结果
|
getDictionaryList, //获取律所字典项
|
trialFirst5DaysPayment, //V贷首次5天内还款试算
|
saveFulfillment, //首次还款试算需要调这个接口生成履约数据
|
} from "@comprehensive/serve/public";
|
import {
|
lawCommunHistoryListHeader,
|
vLoanReconcileRepaymentTrialListHeader,
|
vLoanReconcileRepaymentDetailListHeader,
|
first5DayScheduledRepaymentHeader,
|
} from "@comprehensive/utils/tableHeaders";
|
import { firstRepaymentHeader } from "@comprehensive/utils/formHeaders";
|
export default {
|
data() {
|
return {
|
mainCredit: this.$store.state.product.mainCredit,
|
applyMenu: this.$store.state.product.applyMenu,
|
mainCreditInfo: {}, //主授信人信息
|
borrowerForm: [],
|
borrowerArr: [],
|
initialArr: [], //初始化数据
|
rules: {},
|
repayTermList: [
|
{ repayTermName: "6个月", repayTermNo: "6" },
|
{ repayTermName: "12个月", repayTermNo: "12" },
|
{ repayTermName: "24个月", repayTermNo: "24" },
|
{ repayTermName: "36个月", repayTermNo: "36" },
|
], //还款期限
|
havingKinList: [
|
{ havingKinName: "无", havingKinNo: "0" },
|
{ havingKinName: "有", havingKinNo: "1" },
|
], //是否有直系亲属
|
reconcileStatusList: [
|
{ reconcileStatusName: "未和解", reconcileStatusNo: "0" },
|
{ reconcileStatusName: "已和解", reconcileStatusNo: "1" },
|
{ reconcileStatusName: "沟通中", reconcileStatusNo: "2" },
|
{ reconcileStatusName: "拒绝和解", reconcileStatusNo: "3" },
|
{ reconcileStatusName: "已诉讼", reconcileStatusNo: "5" },
|
{ reconcileStatusName: "结清", reconcileStatusNo: "4" },
|
], //和解状态
|
changedAccountFlowList: [
|
{ changedAccountFlowName: "是", changedAccountFlowNo: "1" },
|
{ changedAccountFlowName: "否", changedAccountFlowNo: "0" },
|
], //是否完成回款账户变更流程
|
bindBankStatusList: [
|
{ bindBankStatusName: "已绑卡", bindBankStatusNo: "1" },
|
{ bindBankStatusName: "未绑卡", bindBankStatusNo: "0" },
|
], //是否绑卡
|
lawCommunHistoryList: [], //律所和解数据
|
lawCommunHistoryListHeader: [...lawCommunHistoryListHeader], //律所和解title
|
vLoanReconcileRepaymentTrialList: [], // v贷试算还款明细列表
|
vLoanReconcileRepaymentTrialListHeader: [
|
...vLoanReconcileRepaymentTrialListHeader,
|
], //v贷试算还款明细列表title
|
currentLawCom: "",
|
firstRepaymentLoading: false,
|
submitLoading: false,
|
firstRepaymentInfo: {
|
totalFirstPrincipalAmt: "0",
|
totalFirstInterestAmt: "0",
|
totalFirstAmt: "0",
|
totalLatestPayAmt: "0",
|
}, //项目信息
|
firstRepaymentHeader: [...firstRepaymentHeader],
|
//是否展示还款明细列表
|
showDetailList: false,
|
//还款试算中,每笔还款的明细list
|
detailList: [],
|
//还款试算中,每笔还款的明细header
|
detailListHeader: [...vLoanReconcileRepaymentDetailListHeader],
|
//委外律所列表
|
lawNameList: [],
|
//首次还款预计金额,5-6天内
|
first5DayScheduledRepaymentList: [],
|
first5DayScheduledRepaymentHeader: [...first5DayScheduledRepaymentHeader],
|
};
|
},
|
computed: {},
|
components: {
|
FormInfo,
|
KeysTable,
|
ListDetailDialog,
|
},
|
async created() {
|
this.init();
|
},
|
methods: {
|
init() {
|
this.requestQryReconcileInfoMap();
|
this.requestQryCommunicationInfo();
|
this.requestQryMainCreditInfo();
|
this.requestQueryPaymentCalcResult();
|
this.initLawList();
|
},
|
//获取主授信人信息
|
async requestQryReconcileInfoMap() {
|
const resp = await qryReconcileInfoMap({
|
applySerialNo: this.mainCredit.serialNo,
|
});
|
if (resp.result) {
|
this.getBorrowerData(resp.result);
|
}
|
},
|
//查询律所历史沟通信息
|
async requestQryCommunicationInfo() {
|
const resp = await qryCommunicationInfo({
|
applySerialNo: this.mainCredit.serialNo,
|
});
|
if (resp.result) {
|
this.lawCommunHistoryList = resp.result;
|
}
|
},
|
//查询主授信人id
|
async requestQryMainCreditInfo() {
|
const { mainCredit } = this;
|
const resp = await qryMainCreditInfo({
|
applySerialNo: mainCredit.serialNo,
|
});
|
if (resp.code == "00") {
|
this.mainCreditInfo = resp.result;
|
}
|
},
|
//查询首次还款试算结果
|
async requestQueryPaymentCalcResult() {
|
const { mainCredit } = this;
|
const resp = await queryPaymentCalcResult({
|
serialNo: mainCredit.customerid,
|
});
|
if (resp.code == "00") {
|
this.firstRepaymentInfo = {
|
totalFirstAmt: resp.result.totalFirstAmt,
|
totalFirstInterestAmt: resp.result.totalFirstInterestAmt,
|
totalFirstPrincipalAmt: resp.result.totalFirstPrincipalAmt,
|
totalLatestPayAmt: resp.result.totalLatestPayAmt,
|
};
|
this.vLoanReconcileRepaymentTrialList = resp.result.resultList;
|
}
|
},
|
//查询V贷首次5天内还款试算
|
async requestTrialFirst5DaysPayment() {
|
const { mainCredit } = this;
|
if (
|
!this.borrowerForm[0].loanRate ||
|
!this.borrowerForm[0].firstRepayDate
|
) {
|
return;
|
}
|
const resp = await trialFirst5DaysPayment({
|
businessRate: this.borrowerForm[0].loanRate, //贷款利率
|
creditCustomerId: mainCredit.customerid, //主授信人id
|
firstPayDate: this.borrowerForm[0].firstRepayDate, //首次还款日
|
});
|
if (resp.result) {
|
// 将首次还款日期字符串转换为日期对象
|
const firstRepaymentDateObj = new Date(
|
this.borrowerForm[0].firstRepayDate
|
);
|
this.first5DayScheduledRepaymentList = resp.result.list.map(
|
(item, index) => {
|
const newDateObj = new Date(firstRepaymentDateObj);
|
newDateObj.setDate(firstRepaymentDateObj.getDate() + index + 1); // 加上 index 天
|
// 将日期对象转换回字符串格式
|
const firstRepaymentDateString = newDateObj
|
.toISOString()
|
.split("T")[0]; // 转换为 yyyy-MM-dd 格式
|
return {
|
...item,
|
firstRepaymentDate: firstRepaymentDateString,
|
};
|
}
|
);
|
}
|
},
|
// 查询律所
|
async initLawList() {
|
let params = { codeNo: "LawNameCode" };
|
let res = await getDictionaryList(params);
|
this.lawNameList = res.result;
|
},
|
// 处理数据,将数据重新排列
|
async getBorrowerData(result) {
|
// 初始化数据
|
this.borrowerArr = [];
|
this.borrowerForm = [];
|
this.initialArr = [];
|
this.borrowerArr.push(result);
|
this.borrowerArr.forEach(async (val, index) => {
|
// 取数组第一个作为校验规则
|
if (index == 0) {
|
for (const key in val) {
|
this.rules[key] = [];
|
// 自定义规则校验
|
switch (key) {
|
case "loanRate":
|
this.rules[key].push(common.validate("ratePattern"));
|
break;
|
}
|
// 必填校验
|
if (val[key].required) {
|
this.rules[key].push({
|
required: true,
|
message: `请输入${val[key].filedDescription}`,
|
trigger: "change",
|
});
|
}
|
}
|
}
|
// 将数据重新排列
|
const obj = {};
|
for (const key in val) {
|
obj[key] = val[key].value;
|
val[key].value = "";
|
}
|
this.borrowerForm.push(obj);
|
this.initialArr.push(Object.assign({}, obj));
|
this.requestTrialFirst5DaysPayment();
|
});
|
},
|
|
//保存律所沟通记录
|
async saveLawCommunication() {
|
console.log(
|
"currentLawCom",
|
this.currentLawCom,
|
this.borrowerForm[0].lawName
|
);
|
if (!this.currentLawCom) {
|
this.$message({
|
type: "warning",
|
message: "请输入沟通记录",
|
});
|
return;
|
}
|
if (!this.borrowerForm[0].lawName) {
|
this.$message({
|
type: "warning",
|
message: "请输入委外律所",
|
});
|
return;
|
}
|
const resp = await saveCommunicationInfo({
|
applySerialNo: this.mainCredit.serialNo,
|
content: this.currentLawCom,
|
objectName: this.borrowerForm[0].lawName,
|
});
|
if (resp.code == "00") {
|
this.requestQryCommunicationInfo();
|
}
|
},
|
//首次还款试算
|
async firstRepaymentTrialCalculation() {
|
const formRef = this.$refs[`borrowerForm${0}`];
|
if (formRef) {
|
return new Promise((resolve, reject) => {
|
formRef[0].validate(async (valid) => {
|
if (valid) {
|
// 验证通过
|
if (this.mainCreditInfo.customerid) {
|
this.firstRepaymentLoading = true;
|
const params = {
|
businessRate: this.borrowerForm[0].loanRate,
|
creditCustomerId: this.mainCreditInfo.customerid,
|
firstPayDate: this.borrowerForm[0].firstRepayDate,
|
};
|
const saveFulfillmentResp = await saveFulfillment(params);
|
const resp = await trialFirstPayment(params);
|
this.firstRepaymentLoading = false;
|
if (resp.code == "00") {
|
this.firstRepaymentInfo = {
|
totalFirstAmt: resp.result.totalFirstAmt,
|
totalFirstInterestAmt: resp.result.totalFirstInterestAmt,
|
totalFirstPrincipalAmt: resp.result.totalFirstPrincipalAmt,
|
totalLatestPayAmt: resp.result.totalLatestPayAmt,
|
};
|
this.vLoanReconcileRepaymentTrialList =
|
resp.result.resultList;
|
|
this.requestTrialFirst5DaysPayment();
|
}
|
} else {
|
this.$message.error("未获取到主授信人id,请退出重试");
|
}
|
resolve();
|
} else {
|
// 验证失败
|
// 这里可以给出提示或者阻止下一步操作
|
reject();
|
}
|
});
|
});
|
}
|
},
|
// 表单事件回调
|
async doAction(name, item, { label }) {
|
const resp = await queryPaymentCalcLog({ serialNo: item.serialno });
|
if (resp.result) {
|
this.detailList = resp.result;
|
}
|
this.showDetailList = true;
|
},
|
|
//保存律所信息
|
async saveLawInfo() {
|
const formRef = this.$refs[`borrowerForm${0}`];
|
if (formRef) {
|
return new Promise((resolve, reject) => {
|
formRef[0].validate(async (valid) => {
|
if (valid) {
|
// 验证通过
|
console.log("this.borrowerForm[0] resolve", this.borrowerForm[0]);
|
const resp = await saveReconcileInfo({
|
...this.borrowerForm[0],
|
applySerialNo: this.mainCredit.serialNo,
|
termUnit: "M",
|
});
|
if (resp.code == "00") {
|
this.$message.success("保存律所信息成功");
|
}
|
resolve();
|
} else {
|
// 验证失败
|
// 这里可以给出提示或者阻止下一步操作
|
reject();
|
}
|
});
|
});
|
}
|
},
|
|
prevPage() {
|
this.applyMenu.forEach((val, index) => {
|
if (val.tabname == "和解信息") {
|
common.vLoanTabInfo(
|
this.applyMenu[index - 1].tabname,
|
"CreditFlowPublic",
|
this
|
);
|
}
|
});
|
},
|
nextPage() {
|
const formRef = this.$refs[`borrowerForm${0}`];
|
if (formRef) {
|
return new Promise((resolve, reject) => {
|
formRef[0].validate(async (valid) => {
|
if (valid) {
|
// 验证通过
|
if (this.mainCreditInfo.customerid) {
|
this.saveLawInfo();
|
this.$parent.updateApplyTabTree("和解信息");
|
} else {
|
this.$message.error("未获取到主授信人id,请退出重试");
|
}
|
resolve();
|
} else {
|
// 验证失败
|
// 这里可以给出提示或者阻止下一步操作
|
reject();
|
}
|
});
|
});
|
}
|
},
|
// 关闭弹窗
|
closeApply(data) {
|
this.showDetailList = data;
|
},
|
},
|
beforeRouteLeave(to, from, next) {
|
next();
|
},
|
};
|
</script>
|