<template>
|
<div>
|
<SectionTitle title="提前部分还款试算"></SectionTitle>
|
<div class="title-input">
|
<div class="title-warp">
|
<div>
|
提前部分还款金额
|
<el-input
|
style="width: 220px; margin: 0 10px"
|
@focus="formatMoney"
|
@blur="checkMoney"
|
@change="checkMoney"
|
placeholder="请输入提前部分还款金额"
|
v-model.trim="trialPartMoneyToPage"
|
></el-input>
|
<div class="blancetips">
|
<div>入账明细:</div>
|
<div v-for="(item, index) in titleLoanInfoList" :key="index">
|
借据编号:{{ item.loanId }} 实还本金:{{
|
$utils.fMoney(item.actualpayprincipalamt)
|
}}
|
实还利息:{{ $utils.fMoney(item.actualpayinterestamt) }}
|
</div>
|
</div>
|
</div>
|
</div>
|
<div>
|
<el-button type="primary" class="comm-button" @click="trialPartbtn"
|
>还款计划试算</el-button
|
>
|
</div>
|
</div>
|
<KeysTable
|
:list="trialPartloanInfoList"
|
:header="trialVDPartPaymentListHeader"
|
:isShowPages="false"
|
title=""
|
></KeysTable>
|
</div>
|
</template>
|
<script>
|
import SectionTitle from "../SectionTitle.vue";
|
import KeysTable from "../KeysTable";
|
import { mapState } from "vuex";
|
import { trialVDPartPaymentListHeader } from "@comprehensive/utils/tableHeaders";
|
import {
|
trialVDPartPayment, //VD部分还款试算
|
} from "@comprehensive/serve/public";
|
export default {
|
props: {
|
// 申请编号
|
serialNo: {
|
type: String,
|
required: true,
|
},
|
objectType: {
|
type: String,
|
default: "",
|
},
|
customerID: {
|
type: String,
|
default: "",
|
},
|
flowno: {
|
type: String,
|
// 默认为主授信人
|
default: "MainCreditFlow",
|
},
|
},
|
components: {
|
KeysTable,
|
SectionTitle,
|
},
|
computed: {
|
...mapState({
|
selectBankWaterList: (state) => state.product.selectBankWaterList,
|
}),
|
},
|
watch: {
|
selectBankWaterList(newVal) {
|
const coreBalanceList = newVal
|
.filter((item) => item.coreBalance !== undefined)
|
.map((item) => this.toFixedMoney(item.coreBalance));
|
const total = coreBalanceList.reduce((accumulator, currentValue) => {
|
return accumulator + currentValue;
|
}, 0);
|
console.log("total", total);
|
this.trialPartMoneyToPage = total;
|
if (typeof total == "number") {
|
this.trialPartMoneyToPage = this.$utils.fMoney(
|
this.trialPartMoneyToPage
|
);
|
}
|
},
|
},
|
data() {
|
return {
|
info: {},
|
transCode: "",
|
applyType: "",
|
query: {},
|
loading: false,
|
tableHeader: [],
|
pageInfo: {
|
currentPage: 1,
|
pageSize: 10,
|
},
|
total: 0,
|
records: [],
|
checkedRecords: [],
|
tableModel: null,
|
codeUrl: "",
|
trialPartDateToPage: "",
|
trialPartMoneyToPage: null,
|
detailModel: null,
|
model: null,
|
selectModel: null,
|
codeRspModel: null,
|
isShowDialog: false,
|
isShowSubmit: false,
|
contentText: "",
|
visible: false,
|
titleLoanInfoList: [], //入账明细汇总list
|
trialPartloanInfoList: [], //每笔明细下面的具体贷款单号汇总
|
trialVDPartPaymentListHeader: [...trialVDPartPaymentListHeader],
|
};
|
},
|
created() {
|
this.init();
|
},
|
methods: {
|
init() {},
|
//请求VD部分还款试算数据
|
async requestTrialVDPartPayment() {
|
const trxnbrArr = this.selectBankWaterList.map((item) => item.trxnBr);
|
const resp = await trialVDPartPayment({
|
applySerialNo: this.serialNo,
|
trxnbrArr: trxnbrArr,
|
});
|
console.log("requestTrialVDPartPayment", resp);
|
if (resp.code == "00") {
|
this.titleLoanInfoList = resp.result.list;
|
this.trialPartloanInfoList = resp.result.list.map((item) => {
|
const mergedItem = { ...item }; // 先复制外层字段
|
// 如果有 acctPaymentSchedule,将其字段覆盖到外层字段
|
if (item.acctPaymentSchedule) {
|
Object.keys(item.acctPaymentSchedule).forEach((key) => {
|
mergedItem[key] = item.acctPaymentSchedule[key];
|
});
|
}
|
return mergedItem;
|
});
|
}
|
},
|
formatMoney() {
|
this.trialPartMoneyToPage = this.toFixedMoney(this.trialPartMoneyToPage);
|
},
|
// 去掉分隔符 最后转成数字 只保留小数点两位
|
toFixedMoney(value) {
|
let result = null;
|
if (value) {
|
value = value.toString();
|
if (typeof value === "string") {
|
result = value.indexOf(",") > -1 ? value.replace(/,/gi, "") : value;
|
result = Number(Number(result).toFixed(2));
|
}
|
if (typeof value === "number") {
|
result = Number(value.toFixed(2));
|
}
|
}
|
return result;
|
},
|
checkMoney() {
|
if (this.trialPartMoneyToPage) {
|
var regNumber =
|
/^(?!0+(?:\.0+)?$)(?:[1-9]\d{0,2}(?:,\d{3})+|\d+)(?:\.\d{1,2})?$/;
|
if (!regNumber.test(this.trialPartMoneyToPage)) {
|
this.$message.error("请输入正确的金额!");
|
this.trialPartMoneyToPage = "";
|
return;
|
}
|
var aa = Number(this.trialPartMoneyToPage);
|
if (typeof aa == "number") {
|
this.trialPartMoneyToPage = this.$utils.fMoney(
|
this.trialPartMoneyToPage
|
);
|
}
|
}
|
},
|
trialPartbtn() {
|
if (!this.trialPartMoneyToPage) {
|
this.$message.error("请输入正确的金额!");
|
return;
|
}
|
if (this.selectBankWaterList.length === 0) {
|
this.$message.error("银行流水不能为空!");
|
return;
|
}
|
this.requestTrialVDPartPayment();
|
},
|
},
|
};
|
</script>
|
|
<style lang="postcss" scoped>
|
.apply-info {
|
}
|
.apply-top-button {
|
& >>> .el-button {
|
margin-left: 20px;
|
}
|
}
|
.title-input {
|
margin: 25px 0;
|
display: flex;
|
padding: 0 10px 0 0;
|
justify-content: space-between;
|
.title-warp {
|
display: flex;
|
justify-content: space-between;
|
.blancetips {
|
font-size: 13px !important;
|
font-weight: normal !important;
|
color: #888888;
|
line-height: 30px;
|
}
|
}
|
}
|
.qrcode-content {
|
text-align: center;
|
& .qrode-close {
|
margin: 0;
|
padding: 0;
|
margin-bottom: 10px;
|
& i {
|
cursor: pointer;
|
font-size: 18px;
|
}
|
/* text-align: right; */
|
}
|
}
|
.section-title {
|
margin: 30px 0 20px 0;
|
padding: 0 0 0 10px;
|
border-left: solid 2px #0081f0;
|
line-height: 16px;
|
font-size: 14px;
|
color: #222222;
|
}
|
</style>
|