<template>
|
<div class="borrower">
|
<p class="title" >
|
<span></span>
|
贷款合同信息
|
</p>
|
<div style="margin-bottom:10px;margin-top: -20px;"
|
v-if="mainCredit.phaseNo == '0060'">
|
<el-button size="small" type="primary" @click="genLoanContract" >重新生成</el-button>
|
<el-button size="small" type="primary" @click="submit" >小贷签章</el-button>
|
<el-button size="small" type="primary" @click="customerSign" >客户签章</el-button>
|
<el-button size="small" type="primary" @click="refresh" >刷新</el-button>
|
<el-button size="small" type="primary" @click="addContract" v-if="isAdmin" >新增</el-button>
|
</div>
|
<el-table stripe highlight-current-row :data="loanContactList" v-loading="loading"
|
:header-cell-style="{ background: '#f5f5f5', color: '#222222' }" style="width: 100%">
|
|
<el-table-column min-width="200" v-for="(item, idx) in tableColumn1" :key="idx" :prop="item.prop" :label="item.label">
|
<template slot="header">
|
<span>
|
<span style="padding-left: 8px">{{item.label}}</span>
|
</span>
|
</template>
|
<template slot-scope="{ row }">
|
<span style="padding-left: 8px" v-show="!row.isEdit">{{
|
row[item.prop]
|
}}</span>
|
<!-- <el-input v-if="item.prop == 'contractNo'"
|
style="padding-left: 15px"
|
maxlength="50"
|
size="small"
|
v-show="row.isEdit"
|
v-model="row.contractNo"
|
placeholder="请输入合同编号"
|
></el-input>
|
|
<el-input v-if="item.prop == 'contractName'"
|
style="padding-left: 15px"
|
maxlength="50"
|
size="small"
|
v-show="row.isEdit"
|
v-model="row.contractName"
|
placeholder="请输入合同名称"
|
></el-input> -->
|
</template>
|
</el-table-column>
|
|
<!-- <el-table-column v-for="(item, idx) in tableColumn1" :key="idx" :prop="item.prop" :label="item.label">
|
</el-table-column> -->
|
<el-table-column label="管理" width="330">
|
<template slot-scope="scope">
|
<!-- <el-link
|
size="mini"
|
type="primary"
|
style="margin-right: 8px;"
|
:underline="false"
|
@click="handleSingStatus(scope.row)"
|
>重新生成</el-link
|
>
|
<el-popover
|
placement="bottom"
|
popper-class="table-buttons-popover"
|
trigger="hover"
|
@show="
|
scope.row.isSwitch = true;
|
$set(loanContactList, scope.$index, scope.row);
|
"
|
@hide="
|
scope.row.isSwitch = false;
|
$set(loanContactList, scope.$index, scope.row);
|
"
|
>
|
<div style="text-align: right; margin: 0">
|
<el-link
|
size="mini"
|
type="primary"
|
style="margin: 0 8px 0 12px;"
|
:underline="false"
|
:disabled="scope.row.contractBucket && scope.row.contractKey"
|
@click="handleContractView(scope.$index)"
|
>查看影像资料</el-link
|
>
|
<el-link
|
size="mini"
|
type="primary"
|
:underline="false"
|
@click="handleSignStateView(scope.row, scope.$index)"
|
>查看签署状态</el-link
|
>
|
</div>
|
<el-link
|
slot="reference"
|
type="primary"
|
size="mini"
|
:underline="false"
|
>查看
|
<i
|
:class="[
|
{ 'e
|
style="margin-right: 8px;"l-icon-arrow-down': !scope.row.isSwitch },
|
{ 'el-icon-arrow-up': scope.row.isSwitch }
|
]"
|
></i>
|
</el-link>
|
</el-popover> -->
|
|
<template v-if="!scope.row.isEdit">
|
<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>
|
<el-link size="mini" type="primary" style="margin-right: 8px;" :underline="false" @click="handleSignStateView(scope.row, scope.$index)">
|
查看签署状态</el-link>
|
<el-link size="mini" type="primary" style="margin-right: 8px;" v-if="isAdmin" @click="editContract(scope.row, scope.$index)">
|
变更</el-link>
|
<el-link size="mini" type="primary" v-if="isAdmin" @click="deleteContract(scope.row, scope.$index)">
|
删除</el-link>
|
</template>
|
<!-- <template v-else>
|
|
<el-upload
|
class="upload-main"
|
action=""
|
:headers="uploadHeader"
|
:http-request="handleUpload"
|
:show-file-list="false"
|
>上传
|
</el-upload>
|
<el-button
|
type="text"
|
@click.native="handleSave(scope.row, scope.$index)"
|
>保存</el-button
|
>
|
<el-button
|
type="text"
|
@click.native="handleCancel(scope.row, scope.$index)"
|
v-if="scope.row.isCancel"
|
>删除</el-button
|
>
|
</template> -->
|
<!-- <el-link
|
size="mini"
|
type="primary"
|
style="margin-left: 8px;"
|
:underline="false"
|
v-if="scope.row.signStatus == '签章失败'"
|
@click="handleSingStatus(scope.row)"
|
>重新生成</el-link
|
> -->
|
</template>
|
</el-table-column>
|
</el-table>
|
|
<el-dialog :visible.sync="dialogTableVisible">
|
<el-table :data="signStateList">
|
<el-table-column v-for="(item, idx) in tableColumn2" :key="idx" :prop="item.prop" :label="item.label">
|
</el-table-column>
|
</el-table>
|
</el-dialog>
|
|
<el-dialog class="contractAddManage" center width="600px" :visible.sync="addShow" :close-on-click-modal="false" :title="title"
|
@close="handleClose1" inlinel>
|
<el-form label-width="100px" ref="formData" :rules="rules" :model="form">
|
<el-form-item label="合同编号">
|
<el-input v-model="form.contractNo" :disabled="title == '修改'"></el-input>
|
</el-form-item>
|
<el-form-item label="合同名称">
|
<el-input v-model="form.contractName" :disabled="title == '修改'"></el-input>
|
</el-form-item>
|
<el-form-item label="附件" prop="fileData">
|
<el-upload class="upload-main" action="" :http-request="handleUpload"
|
:show-file-list="true" :file-list="fileList">
|
<el-button size="small" type="primary">点击上传</el-button>
|
</el-upload>
|
</el-form-item>
|
</el-form>
|
<span slot="footer" class="dialog-footer">
|
<el-button plain @click="handleClose1">取消</el-button>
|
<el-button type="primary" @click="submitContract(form)">确定</el-button>
|
</span>
|
</el-dialog>
|
</div>
|
</template>
|
<script>
|
// 贷款合同信息
|
import {
|
qryLoanContactDetail,
|
submitGenLoanContract,
|
genLoanContract,
|
qryLoanContactList,
|
sealPublicSign,
|
doCustomerSign,
|
syncSealResult,
|
loanContactInfoAdd,
|
loanContactInfoRemove,
|
loanContactInfoReplace
|
} from "@/api/product";
|
import common from "@/utils/common";
|
import qs from 'qs'
|
export default {
|
props: ["mainCredit"],
|
data() {
|
return {
|
uploadHeader: {
|
"Content-Type": "multipart/form-data; boundary=ReaquestHeader"
|
},
|
loading: false,
|
addShow:false,
|
loanContactList: [],
|
signStateList: [],
|
dialogTableVisible: false,
|
haserror: false,
|
fileList: [],
|
form: {},
|
title: '新增',
|
isAdmin:false,
|
rules: {
|
contractNo: [{ required: true, message: '请输入合同编号', trigger: 'blur' }],
|
contractName: [{ required: true, message: '请输入合同名称', trigger: 'blur' }],
|
// signStatus: [{ required: true, message: '请选择签署状态', trigger: 'change' }]
|
},
|
tableColumn1: [
|
{ prop: "contractNo", label: "合同编号" },
|
{ prop: "contractName", label: "合同名称" },
|
{ prop: "startTime", label: "合同签署发起最新时间" },
|
{ prop: "signStatusDesc", label: "合同签署状态" }
|
],
|
tableColumn2: [
|
{ prop: "name", label: "签章名称" },
|
{ prop: "phone", label: "联系方式" },
|
{ prop: "signTime", label: "签署时间" },
|
{ prop: "signUrl", label: "签署链接" },
|
{ prop: "signStatus", label: "签署状态" }
|
]
|
};
|
},
|
async mounted() {
|
let userInfo = localStorage.getItem('userInfo')
|
if(userInfo) {
|
this.isAdmin = JSON.parse(userInfo).jobNum == 'admin'
|
}
|
this.loanContactList = await this.getLoanContactList();
|
},
|
methods: {
|
getSignStatusValue(key) {
|
let value;
|
switch (key) {
|
case "1":
|
value = '待签章'
|
break;
|
case "2":
|
value = '签章中'
|
break;
|
case "3":
|
value = '签章成功'
|
break;
|
case "4":
|
value = '签章失败'
|
break;
|
}
|
return value
|
},
|
getSignStateValue(key) {
|
let value;
|
switch (key) {
|
case "0":
|
value = '初始化'
|
break;
|
case "1":
|
value = '已签'
|
break;
|
case "2":
|
value = '失败'
|
break;
|
}
|
return value
|
|
},
|
async refresh() {
|
this.loading = true
|
const res = await syncSealResult({
|
applySerialNo: this.mainCredit.serialNo
|
})
|
this.loading = false
|
if(res.code == "00"){
|
this.$message({
|
type: "success",
|
message: "刷新成功!"
|
});
|
this.loanContactList = await this.getLoanContactList('refresh');
|
}
|
},
|
|
handleUpload(file, fileList) {
|
if (file.file) {
|
this.$set(this.form, 'fileData', file.file)
|
this.fileList = [file.file]
|
this.$nextTick(() => {
|
this.$refs.formData.validateField('fileData')
|
})
|
}
|
},
|
addContract() {
|
this.form = {
|
applySerialNo: this.mainCredit.serialNo,
|
contractNo: "",
|
contractName: "",
|
fileData: "",
|
}
|
this.rules.fileData = [{ required: true, message: '请上传合同附件', trigger: 'change' }]
|
this.addShow = true
|
this.title = '新增'
|
},
|
editContract(row) {
|
this.title = '修改'
|
this.form = row
|
this.rules.fileData = [{ required: true, message: '请上传合同附件', trigger: 'change' }]
|
this.fileList = []
|
this.addShow = true
|
},
|
submitContract(row,index) {
|
this.$refs.formData.validate(async (validate) => {
|
if (!validate) return
|
let formData = new FormData()
|
if (!this.form.contractId) {
|
formData.append("applySerialNo", this.form.applySerialNo);
|
if (this.form.fileData) formData.append('file', this.form.fileData)
|
formData.append('contractNo', this.form.contractNo)
|
formData.append('contractName', this.form.contractName)
|
await loanContactInfoAdd(formData).then(async res => {
|
if (res.code === "00") {
|
this.$message.success("保存成功");
|
this.loanContactList = await this.getLoanContactList();
|
this.handleClose1()
|
}
|
});
|
} else {
|
formData.append('id', this.form.contractId)
|
if (this.form.fileData) formData.append('file', this.form.fileData)
|
await loanContactInfoReplace(formData).then(async res => {
|
if (res.code === "00") {
|
this.$message.success("保存成功");
|
this.loanContactList = await this.getLoanContactList();
|
this.handleClose1()
|
}
|
});
|
}
|
})
|
},
|
async deleteContract(row) {
|
common.comfirm("提示", "附件删除后不可恢复,请确认是否删除?", () => {
|
loanContactInfoRemove({ id: row.contractId }).then(async res => {
|
if (res.code === "00") {
|
this.$message.success("删除成功");
|
this.loanContactList = await this.getLoanContactList();
|
}
|
});
|
});
|
},
|
handleClose1() {
|
this.fileList = []
|
this.$refs.formData.clearValidate()
|
this.addShow = false
|
},
|
// 查看合同
|
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();
|
},
|
// 查看签署状态
|
handleSignStateView(data) {
|
qryLoanContactDetail({
|
contractId: data.contractId
|
}).then(res => {
|
res.result.map(item => {
|
item.signStatus = this.getSignStateValue(item.signStatus)
|
})
|
this.signStateList = res.result;
|
this.dialogTableVisible = true;
|
});
|
},
|
genLoanContract() {
|
this.$confirm("请确定是否重新生成此合同?", "提示", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning"
|
})
|
.then(() => {
|
genLoanContract({
|
applySerialNo: this.mainCredit.serialNo
|
}).then(async res => {
|
if (res.code == "00") {
|
this.$message({
|
type: "success",
|
message: "重新生成合同请求发送成功!"
|
});
|
this.loanContactList = await this.getLoanContactList();
|
setTimeout(() => {
|
this.refresh()
|
}, 3000);
|
}
|
});
|
})
|
.catch(() => { });
|
},
|
// 重新生成
|
handleSingStatus(data) {
|
this.$confirm("请确定是否重新生成此协议?", "提示", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning"
|
})
|
.then(() => {
|
submitGenLoanContract({
|
contractId: data.contractId
|
}).then(res => {
|
res.code == "00" &&
|
this.$message({
|
type: "success",
|
message: "重新生成成功!"
|
});
|
});
|
})
|
.catch(() => { });
|
},
|
async submit() {
|
sealPublicSign({
|
applySerialNo: this.mainCredit.serialNo
|
}).then(res => {
|
res.code == "00" &&
|
this.$message({
|
type: "success",
|
message: "发起成功!"
|
});
|
});
|
},
|
async customerSign() {
|
this.$confirm("请确认是否客户签章?", "提示", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning"
|
})
|
.then(async () => {
|
const res = await doCustomerSign({
|
applySerialNo: this.mainCredit.serialNo
|
})
|
if(res.code == "00") {
|
this.$message({
|
type: "success",
|
message: "发起成功!"
|
});
|
this.loanContactList = await this.getLoanContactList();
|
}
|
})
|
.catch(() => { });
|
},
|
// 查询贷款合同信息
|
getLoanContactList(type) {
|
return new Promise(resolve => {
|
let singStatusErroe = false
|
let data = {
|
applySerialNo: this.mainCredit.serialNo
|
}
|
this.loading = true
|
if(type == 'refresh') {
|
data.refresh = '1'
|
}
|
qryLoanContactList(data).then(res => {
|
res.result.map(item => {
|
if (item.signStatus == '4') {
|
singStatusErroe = true
|
}
|
// item.signStatus = this.getSignStatusValue(item.signStatus)
|
})
|
this.haserror = singStatusErroe
|
|
this.loading = false
|
|
resolve(res.result);
|
});
|
});
|
}
|
}
|
};
|
</script>
|