<template>
|
<div class="product">
|
<div class="borrower">
|
<p class="title">
|
<span></span>
|
担保人信息
|
</p>
|
<el-button
|
type="primary"
|
icon="el-icon-circle-plus-outline"
|
v-if="applyInfo.phaseNo <='0060' && !isReadonly"
|
@click="addGuarantor"
|
size="medium"
|
>新增</el-button
|
>
|
<el-table
|
stripe
|
:data="guarantorData"
|
style="margin-top: 30px"
|
highlight-current-row
|
:cell-style="cell"
|
:header-cell-style="{ background: '#f5f5f5', color: '#222222' }"
|
>
|
<el-table-column min-width="100">
|
<template slot="header">
|
<span>
|
<span style="padding-left: 8px">姓名</span>
|
</span>
|
</template>
|
<template slot-scope="{ row }">
|
<span style="padding-left: 15px" v-show="!row.isEdit">{{
|
row.relativecustomername
|
}}</span>
|
<el-input
|
style="padding-left: 15px"
|
size="small"
|
v-show="row.isEdit"
|
v-model="row.relativecustomername"
|
placeholder="请输入"
|
></el-input>
|
</template>
|
</el-table-column>
|
|
<el-table-column min-width="160">
|
<template slot="header">
|
<span>
|
<span style="padding-left: 8px">电话号码</span>
|
</span>
|
</template>
|
<template slot-scope="{ row }">
|
<span style="padding-left: 8px" v-show="!row.isEdit">{{
|
row.phone ? row.phone : '--'
|
}}</span>
|
<el-input
|
style="padding-left: 15px"
|
maxlength="50"
|
size="small"
|
v-show="row.isEdit"
|
v-model.trim="row.phone"
|
placeholder="请输入"
|
></el-input>
|
</template>
|
</el-table-column>
|
|
<el-table-column min-width="200">
|
<template slot="header">
|
<span>
|
<span style="padding-left: 8px">身份证号</span>
|
</span>
|
</template>
|
<template slot-scope="{ row }">
|
<span style="padding-left: 8px" v-show="!row.isEdit">{{
|
row.certid
|
}}</span>
|
<el-input
|
style="padding-left: 15px"
|
maxlength="50"
|
size="small"
|
v-show="row.isEdit"
|
v-model="row.certid"
|
placeholder="请输入"
|
@change="row.certid = row.certid.toUpperCase()"
|
></el-input>
|
</template>
|
</el-table-column>
|
|
<el-table-column min-width="140">
|
<template slot="header">
|
<span>
|
<span style="padding-left: 8px">与借款人关系</span>
|
</span>
|
</template>
|
<template slot-scope="{ row }">
|
<span style="padding-left: 8px" v-if="!row.isEdits">{{
|
row.relationshipDesc ? row.relationshipDesc : '--'
|
}}</span>
|
<div v-else>
|
<el-select
|
v-model="row.relationship"
|
clearable
|
filterable
|
placeholder="请选择"
|
>
|
<el-option
|
v-for="(item,index) in borrowerrelationshiplist"
|
:key="index"
|
:label="item.itemname"
|
:value="item.itemno"
|
></el-option>
|
</el-select>
|
</div>
|
</template>
|
</el-table-column>
|
|
<el-table-column min-width="230">
|
<template slot="header">
|
<span>
|
<span style="padding-left: 8px">联系地址(省市区)</span>
|
</span>
|
</template>
|
<template slot-scope="{ row }">
|
<span style="padding-left: 8px" v-if="!row.isEdits">{{
|
row.permanentprovinceCn ? row.permanentprovinceCn+row.permanentcityCn+row.permanentcountyCn : '--'
|
}}</span>
|
<el-cascader class="permanentprovinceCn" :placeholder="row.permanentprovinceCn+row.permanentcityCn+row.permanentcountyCn" :v-model="row.defaulArea" style="width:100%" v-else :props="props" @change="data=>{setAreaList(data,row)}"></el-cascader>
|
</template>
|
</el-table-column>
|
|
<el-table-column min-width="170">
|
<template slot="header">
|
<span>
|
<span style="padding-left: 8px">详细地址</span>
|
</span>
|
</template>
|
<template slot-scope="{ row }">
|
<span style="padding-left: 8px" v-if="!row.isEdits">{{
|
row.permanentaddress ? row.permanentaddress : '--'
|
}}</span>
|
<el-input
|
v-else
|
size="small"
|
v-model="row.permanentaddress"
|
placeholder="请输入详细地址"
|
></el-input>
|
|
</template>
|
</el-table-column>
|
|
<el-table-column min-width="120" v-if="productID">
|
<template slot="header">
|
<span>
|
<span style="padding-left: 8px">合同签署状态</span>
|
</span>
|
</template>
|
<template slot-scope="{ row }">
|
<span style="padding-left: 8px" v-show="!row.isEdit">{{
|
row.signStatusDesc
|
}}</span>
|
</template>
|
</el-table-column>
|
|
|
<el-table-column v-if="productID" fixed="right" label="操作" min-width="160">
|
<template slot-scope="scope">
|
<el-link size="mini" type="primary" style="margin-right: 8px;" :underline="false"
|
@click="showContract(scope.row)">
|
查看合同</el-link>
|
<template v-if="!isShowDetail">
|
<el-link size="mini" v-if="scope.row.editStatus == 1 && applyInfo.flowno != 'MainCreditFlow'" type="primary" style="margin-right: 8px;" :underline="false"
|
@click="handleDelete(scope.row, scope.$index)">
|
删除</el-link>
|
<el-link size="mini" type="primary" style="margin-right: 8px;" :underline="false"
|
@click="handleEdit(scope.row, scope.$index)" v-if="scope.row.eidtArea && applyInfo.flowno != 'MainCreditFlow'">
|
修改</el-link>
|
<el-button
|
type="text"
|
v-else-if="!scope.row.eidtArea && applyInfo.flowno != 'MainCreditFlow'"
|
@click.native="handleSave(scope.row, scope.$index)"
|
>保存</el-button
|
>
|
</template>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
|
<el-dialog :visible.sync="dialogTableVisible">
|
<el-table :data="signStateList">
|
<el-table-column v-for="(item, idx) in tableColumn1" :key="idx" :prop="item.prop" :label="item.label">
|
</el-table-column>
|
|
<el-table-column label="操作" min-width="110">
|
<template slot-scope="scope">
|
<el-link size="mini" type="primary" style="margin-right: 8px;" :underline="false"
|
:disabled="!(scope.row.contractBucket && scope.row.contractKey)" @click="handleContractView(scope.row)">
|
查看影像资料</el-link>
|
</template>
|
</el-table-column>
|
</el-table>
|
</el-dialog>
|
|
<div class="btn" >
|
<!-- <el-button
|
size="medium"
|
plain
|
@click="saveDraft(guarantorForm)"
|
v-if="applyInfo.phaseNo == '0040' || applyInfo.phaseNo == '0010'"
|
>保存草稿</el-button
|
> -->
|
<!-- <el-button
|
size="medium"
|
type="primary"
|
@click="submitNo(guarantorForm)"
|
v-if="(applyInfo.phaseNo == '0040' || applyInfo.phaseNo == '0010' || applyInfo.phaseNo == '0060') && applyInfo.borrowertype == '02' && !isReadonly"
|
>无担保人</el-button
|
> -->
|
<el-button
|
size="medium"
|
plain
|
@click="prevStep"
|
v-if="(applyInfo.phaseNo == '0040' || applyInfo.phaseNo == '0010') && !isReadonly"
|
>上一步</el-button
|
>
|
<el-button
|
size="medium"
|
plain
|
@click="prevStep"
|
v-else
|
>上一步</el-button
|
>
|
<el-button
|
size="medium"
|
type="primary"
|
@click="submit(guarantorForm)"
|
v-if="(applyInfo.phaseNo == '0040' || applyInfo.phaseNo == '0010' || applyInfo.phaseNo == '0060') && !isReadonly"
|
>下一步</el-button
|
>
|
<el-button
|
size="medium"
|
type="primary"
|
@click="nextPage"
|
v-else
|
>下一步</el-button
|
>
|
</div>
|
</div>
|
</template>
|
<script>
|
import {
|
getDictionaryList,
|
qryGuarantorOrCoBorrower, //查询担保人信息
|
saveGuarantorOrCoBorrower, //新增担保人信息
|
delGuarantorOrCoBorrowerNew, //删除担保人信息
|
submitNoGuarantCoBorrow, // 无担保人提交
|
saveOrUpdateTodo,
|
} from "@api/product";
|
import { getProvinceCodeList, getCityCodeList, getAreaCodeList } from '@/api/area'
|
import common from "@/utils/common";
|
import { CPCHANNELOPTIONS } from "../../../../comprehensiveTransaction/utils/optionsConfig";
|
let phoneExp = new RegExp(/^1(2|3|4|5|6|7|8|9)\d{9}$/);
|
let representativeIDExp = new RegExp(
|
/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|[xX])$/
|
);
|
|
export default {
|
data() {
|
return {
|
// applyInfo: this.$store.state.product.applyInfo,
|
applyMenu: this.$store.state.product.applyMenu,
|
ownerData: [],
|
ownerForm: [],
|
initialArr: [],
|
certtypeList: [],
|
isShowDetail:false,
|
options:[],
|
borrowerrelationshiplist:[],
|
guarantorData: [], //担保人数据本地增删改
|
guarantorForm: [], //服务器返回担保人数据
|
guarantorTypeList: [], //担保人类型
|
signStateList:[],
|
props: {
|
lazy: true,
|
value:'itemno',
|
label: 'itemname',
|
lazyLoad (node, resolve) {
|
const { level } = node;
|
console.log('node',node)
|
if(level == 0){
|
getProvinceCodeList({}).then(res=>{
|
const list = res.result.map(item=>{
|
return item
|
})
|
resolve(list)
|
})
|
}
|
if(level == 1){
|
getCityCodeList({codeNo: "AreaCode",itmeNo: node.value}).then(res=>{
|
const list = res.result.map(item=>{
|
return item
|
})
|
resolve(list)
|
})
|
}
|
if(level == 2){
|
getAreaCodeList({codeNo: "AreaCode",itmeNo: node.value}).then(res=>{
|
const list = res.result.map(item=>{
|
item.leaf = level >= 2
|
return item
|
})
|
resolve(list)
|
})
|
}
|
}
|
},
|
tableColumn1: [
|
{ prop: "contractNo", label: "合同编号" },
|
{ prop: "contractName", label: "合同名称" },
|
{ prop: "startTime", label: "合同签署发起最新时间" },
|
{ prop: "signStatusDesc", label: "合同签署状态" }
|
],
|
dialogTableVisible: false,
|
};
|
},
|
computed: {
|
productID(){
|
return this.$route.query.productID && this.$route.query.productID.indexOf('OUT_') >-1 ? false : true
|
},
|
isReadonly() {
|
return this.$parent._data.applyMenu[this.$parent._data.activeIndex].readonly == 'Y'
|
}
|
// isowner() {
|
// return this.propertyData.isowner;
|
// },
|
},
|
props: {
|
// 申请编号
|
applyInfoProp: {
|
type: Object,
|
defaul: ()=> {
|
return this.$store.state.product.applyInfo
|
}
|
}
|
},
|
watch: {
|
// isowner(val) {
|
// this.getOwnerInfo(val);
|
// },
|
// propertyData() {
|
// this.getEnpGuarantorInfo();
|
// },
|
},
|
created() {
|
if(!this.applyInfoProp) {
|
this.applyInfo= this.$store.state.product.applyInfo
|
} else{
|
this.applyInfo= this.applyInfoProp
|
}
|
const isShowDetail = window.location.href.indexOf('loanDetail') > -1
|
this.isShowDetail = isShowDetail
|
const that = this;
|
//查询担保人信息
|
this.qryGuarantorOrCoBorrowerFn()
|
// 证件类型列表
|
this.qryDictionaryList("BorrowerType", function (arr) {
|
that.guarantorTypeList = arr;
|
});
|
this.qryDictionaryList("CertType", function (arr) {
|
that.certtypeList = arr;
|
});
|
//担保人类别
|
// 获取与借款人关系列表
|
this.qryDictionaryList(
|
"CustomerRelationShip",function(arr){
|
that.borrowerrelationshiplist = arr
|
}
|
);
|
},
|
methods: {
|
setAreaList(node,row){
|
row.permanentprovince = node[0]
|
row.permanentcity = node[1]
|
row.permanentcounty = node[2]
|
},
|
qryGuarantorOrCoBorrowerFn(){
|
qryGuarantorOrCoBorrower({
|
applySerialNo: this.applyInfo.serialNo,
|
customerId: this.applyInfo.customerid,
|
relationtype: '02'
|
}).then((res) => {
|
this.guarantorData = [];
|
this.initialArr = [];
|
this.guarantorForm = res.result;
|
if (res.result.length) {
|
res.result.forEach((val) => {
|
const obj = {};
|
for (const key in val) {
|
obj[key] = val[key];
|
obj.eidtArea = true
|
obj.defaulArea = [val.permanentprovince,val.permanentcounty,val.permanentcity]
|
// obj.certtypeDesc = val["certtype"].valueDesc;
|
}
|
|
this.guarantorData.push(obj);
|
this.initialArr.push(Object.assign({}, obj));
|
});
|
}
|
console.log(this.guarantorData, this.guarantorForm, this.initialArr);
|
});
|
},
|
//单元格css
|
cell({ row, column, rowIndex, columnIndex }) {
|
const { applyInfo, index } = this;
|
const { refuseFlag } = applyInfo;
|
if (refuseFlag == 1) {
|
const { houseInfoBatch } = this.$store.state.product.fields;
|
const { propertyList } = houseInfoBatch[index];
|
for (let i = 0; i < propertyList.length; i++) {
|
const object = propertyList[i];
|
for (const key in object) {
|
if (row[key] != object[key] && column.property == key) {
|
return { color: "#222", "font-weight": "700" };
|
}
|
}
|
}
|
}
|
},
|
|
qryDictionaryList(code, callback) {
|
getDictionaryList({
|
codeNo: code,
|
}).then((res) => {
|
callback(res.result);
|
});
|
},
|
handleBorrowertypeChange(row,val) {
|
if (val === '01') {
|
row.certtype = '05'
|
}else if (val === '02') {
|
row.certtype = '01'
|
}
|
},
|
//查询担保人信息
|
getEnpGuarantorInfo() {
|
if (!this.applyInfo.serialNo) return;
|
qryGuarantorOrCoBorrower({
|
applySerialNo: this.applyInfo.serialNo,
|
customerId: this.applyInfo.customerid,
|
relationtype: '02'
|
}).then((res) => {
|
this.guarantorData = [];
|
this.guarantorForm = res.result;
|
if (res.result.length) {
|
res.result.forEach((val) => {
|
const obj = {};
|
for (const key in val) {
|
obj[key] = val[key];
|
obj.eidtArea = true
|
obj.defaulArea = [val.permanentprovince,val.permanentcounty,val.permanentcity]
|
}
|
|
this.guarantorData.push(obj);
|
});
|
}
|
});
|
},
|
// 新增担保人
|
addGuarantor() {
|
let { customerid, serialNo,} = this.applyInfo
|
common.comfirm('','请确认是否新增担保人?',()=>{
|
saveOrUpdateTodo({
|
relationtype: '02',
|
todoType: "GuarantorAdd",
|
objectNo: serialNo,
|
customerId: customerid
|
}).then(res=> {
|
if (res.code == "00") {
|
this.qryGuarantorOrCoBorrowerFn()
|
this.$message.success("成功");
|
} else {
|
this.$message.warning(res.msg);
|
return;
|
}
|
})
|
})
|
},
|
selcerttype(row) {
|
for (let i = 0; i < this.certtypeList.length; i++) {
|
if (this.certtypeList[i].itemno == row.certtype) {
|
this.$set(row, "certtypedesc", this.certtypeList[i].itemname);
|
break;
|
}
|
}
|
},
|
handleSave(row,index) {
|
if(!this.isShowDetail){
|
if (!row.relativecustomername) {
|
this.$message.warning("担保人姓名不能为空");
|
return;
|
}
|
if (!row.certtype) {
|
this.$message.warning("证件类型不能为空");
|
return;
|
}
|
if (!row.certid) {
|
this.$message.warning("担保人身份证号码不能为空");
|
return;
|
}
|
if (!representativeIDExp.test(row.certid) && row.certtype == "01") {
|
this.$message.warning("证件号码格式不正确");
|
return;
|
}
|
//担保人为企业,添加判断
|
if (row.borrowertype === "01") {
|
if (!row.contactsname) {
|
this.$message.warning("联系人不能为空");
|
return;
|
}
|
if (!representativeIDExp.test(row. contactsidnum)) {
|
this.$message.warning("联系人证件号码格式不正确");
|
return;
|
}
|
|
if (!phoneExp.test(row.contactsphone)) {
|
this.$message.warning("联系人手机号码格式不正确");
|
return;
|
}
|
} else {
|
if (!phoneExp.test(row.phone)) {
|
this.$message.warning("电话号码格式不正确");
|
return;
|
}
|
}
|
}
|
(row.applyserialno = this.applyInfo.serialNo),
|
(row.customerid = this.applyInfo.customerid),
|
(row.relationtype = "02"),
|
saveGuarantorOrCoBorrower(row).then(res => {
|
if (res.code == "00") {
|
this.getEnpGuarantorInfo();
|
} else {
|
// this.$message.warning("系统错误,请重试");
|
return;
|
}
|
});
|
},
|
// 取消
|
handleCancel(row,index){
|
const arr = []
|
for (let i = 0; i < this.initialArr.length; i++) {
|
if(i == index){
|
for (const key in row) {
|
if(key != 'isEdits' && key != 'isCancel' && row[key] != this.initialArr[i][key]){
|
console.log(this.initialArr)
|
arr.push(key)
|
}
|
}
|
}
|
}
|
if(arr.length){
|
common.comfirm('提示','当前有数据未保存,是否放弃保存?',()=>{
|
this.$set(row,'isEdits',false)
|
this.$set(row,'isCancel',false)
|
arr.forEach(val => {
|
for (const key in this.initialArr[index]) {
|
if (this.initialArr[index].hasOwnProperty(val)) {
|
this.guarantorData[index][key] = this.initialArr[index][key]
|
}
|
}
|
});
|
})
|
}else{
|
this.$set(row,'isEdits',false)
|
this.$set(row,'isCancel',false)
|
}
|
},
|
handleDelete(row, index) {
|
if(!row.isEdit){
|
common.comfirm('提示',`请确认是否删除担保人: ${row.relativecustomername}`,async ()=>{
|
if(row.serialno || row.relativeSerialNo){
|
const res = await delGuarantorOrCoBorrowerNew([
|
{
|
serialno:row.serialno,
|
relativeSerialNo:row.relativeSerialNo
|
}
|
])
|
if(res.code!='00')return
|
}
|
this.$message.success("删除成功");
|
this.guarantorData.splice(index, 1);
|
this.initialArr.splice(index, 1);
|
})
|
}else{
|
this.guarantorData.splice(index, 1);
|
this.initialArr.splice(index, 1);
|
}
|
},
|
// 查看合同
|
handleContractView(item) {
|
const url = `${process.env.VUE_APP_API_ORIGIN}/rlc-cts/server/oss?bucket=${item.contractBucket}&ossKey=${item.contractKey}`;
|
var a = document.createElement("a");
|
a.setAttribute("href", url);
|
a.setAttribute("target", "_blank");
|
a.setAttribute("id", "openwin");
|
document.body.appendChild(a);
|
if (!document.getElementById("openwin")) document.body.appendChild(a);
|
a.click();
|
document.getElementById("openwin").remove();
|
},
|
showContract(row) {
|
this.dialogTableVisible = true,
|
this.signStateList = row.loanContactInfoList
|
},
|
// 保存接口
|
save(row) {
|
return new Promise((resolve) => {
|
addOrUpdateGuarantorInfo(row).then((res) => {
|
resolve(res);
|
});
|
});
|
},
|
// 修改
|
handleEdit(row) {
|
for (let i = 0; i < this.guarantorData.length; i++) {
|
if (this.guarantorData.length > 1 && this.guarantorData[i].isEdit) {
|
this.$message.warning("请先保存当前担保人信息");
|
return;
|
}
|
}
|
row.eidtArea = false
|
this.$set(row, "isEdits", true);
|
this.$set(row, "isCancel", true);
|
},
|
// 取消
|
handleCancel(row, index) {
|
const arr = [];
|
for (let i = 0; i < this.initialArr.length; i++) {
|
if (i == index) {
|
for (const key in row) {
|
if (
|
key != "isEdits" &&
|
key != "isCancel" &&
|
row[key] != this.initialArr[i][key]
|
) {
|
arr.push(key);
|
}
|
}
|
}
|
}
|
if (arr.length) {
|
common.comfirm("提示", "当前有数据未保存,是否放弃保存?", () => {
|
this.$set(row, "isEdits", false);
|
this.$set(row, "isCancel", false);
|
arr.forEach((val) => {
|
for (const key in this.initialArr[index]) {
|
if (this.initialArr[index].hasOwnProperty(val)) {
|
this.guarantorData[index][key] = this.initialArr[index][key];
|
}
|
}
|
});
|
});
|
} else {
|
this.$set(row, "isEdits", false);
|
this.$set(row, "isCancel", false);
|
}
|
},
|
//保存草稿
|
async saveDraft(arr) {
|
},
|
// 上一步
|
prevStep() {
|
this.applyMenu.forEach((val, index) => {
|
if (val.tabname == "担保人信息") {
|
common.tabInfo(
|
this.applyMenu[index - 1].tabname,
|
this.applyInfo.flowno,
|
this
|
);
|
}
|
});
|
},
|
//提交下一步
|
async submit(arr) {
|
console.log(arr);
|
// arr.length > 0?
|
// this.nextPage():
|
// this.$message.warning("请添加担保人信息");
|
|
this.nextPage()
|
},
|
async submitNo() {
|
await submitNoGuarantCoBorrow({applyserialno:this.applyInfo.serialNo,relationtype:'02'})
|
this.nextPage()
|
},
|
// 下一页
|
nextPage() {
|
// 调用父组件的查询左侧tab的方法
|
this.$parent.updateApplyTabTree('担保人信息');
|
},
|
},
|
};
|
</script>
|
<style lang="stylus">
|
.owner {
|
width: 100%;
|
padding-left: 10px;
|
|
.red-star {
|
width: 7px;
|
display: inline-block;
|
vertical-align: middle;
|
color: #FF4300;
|
}
|
|
>.el-button {
|
padding: 9px 12px;
|
}
|
|
>p {
|
height: 20px;
|
color: #222222;
|
font-weight: 500;
|
font-size: 14px;
|
position: relative;
|
margin-bottom: 30px;
|
|
span {
|
width: 2px;
|
height: 14px;
|
background-color: #0081F0;
|
position: absolute;
|
left: -10px;
|
top: 50%;
|
transform: translateY(-50%);
|
}
|
}
|
}
|
.permanentprovinceCn .el-input__inner::placeholder{
|
color: #333
|
}
|
</style>
|