<template>
|
<div class="opinion">
|
<div v-for="(item, index) in opinionArr" :key="index">
|
<p>
|
<span></span>
|
审批意见
|
</p>
|
<el-form
|
:model="opinionForm[index]"
|
:rules="rules"
|
ref="opinionForm"
|
size="small"
|
label-width="165px"
|
>
|
<el-form-item label="审批结果" prop="phasechoice">
|
<el-select
|
v-model="opinionForm[index].phasechoice"
|
:disabled="!opinionArr[index].phasechoice.writeAble"
|
clearable
|
filterable
|
placeholder="支持输入搜索选择"
|
@change="selPhasechoice"
|
>
|
<el-option
|
v-for="(item, index) in results"
|
:key="index"
|
:label="item.itemname"
|
:value="item.itemno"
|
:disabled="item.disabled"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item
|
label="外部审批意见分类"
|
:prop="isShow ? 'phaseopinion' : ''"
|
v-if="showPhaseopinion"
|
>
|
<el-select
|
v-model="opinionForm[index].phaseopinion"
|
:disabled="!opinionArr[index].phaseopinion.writeAble"
|
filterable
|
clearable
|
placeholder="支持输入搜索选择"
|
>
|
<el-option
|
v-for="(item, index) in outApprovalOpinions"
|
:key="index"
|
:label="item.itemname"
|
:value="item.itemno"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item
|
label="外部审批意见"
|
:prop="isShow ? 'phaseopinion2' : ''"
|
>
|
<el-input
|
type="textarea"
|
:rows="10"
|
maxlength="1000"
|
v-model="opinionForm[index].phaseopinion2"
|
:disabled="!opinionArr[index].phaseopinion2.writeAble"
|
>
|
</el-input>
|
</el-form-item>
|
<el-form-item
|
label="内部审批意见分类"
|
:prop="required && isShow ? 'opiniontype' : ''"
|
v-if="opinionArr[index].opiniontype.visible"
|
>
|
<el-select
|
v-model="opinionForm[index].opiniontype"
|
:disabled="!opinionArr[index].opiniontype.writeAble"
|
clearable
|
filterable
|
placeholder="支持输入搜索选择"
|
>
|
<el-option
|
v-for="(item, index) in insideResultApproveOpinions"
|
:key="index"
|
:label="item.itemname"
|
:value="item.itemno"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item
|
label="内部审批意见"
|
:prop="required && isShow ? 'phaseopinion3' : ''"
|
v-if="opinionArr[index].phaseopinion3.visible"
|
>
|
<el-input
|
type="textarea"
|
:rows="10"
|
maxlength="1000"
|
v-model="opinionForm[index].phaseopinion3"
|
:disabled="!opinionArr[index].phaseopinion3.writeAble"
|
>
|
</el-input>
|
</el-form-item>
|
</el-form>
|
</div>
|
<div class="fixedBtn">
|
<!-- <el-button size="medium" plain @click="save(opinionForm)">保存</el-button> -->
|
<el-button size="medium" plain @click="prevStep()">上一步</el-button>
|
<el-button size="medium" type="primary" @click="submit(opinionForm)"
|
>提交</el-button
|
>
|
</div>
|
<Success :visible="success" v-on:closeDialog="closeDialog"></Success>
|
<Fail
|
:visible="fail"
|
:reason="reason"
|
v-on:closeDialog="closeDialog"
|
></Fail>
|
</div>
|
</template>
|
<script>
|
import "./index.styl";
|
import {
|
qryOpinionDetailByApplySerialNo,
|
qryOutOpinionCodeDetail,
|
qryOutOpinionCodeList,
|
getDictionaryList,
|
updOpinion,
|
nextSubmit,
|
nextSubmitCheck,
|
qryAuthStatus,
|
saveFieldMarkData,
|
qryProductDetail,
|
} from "@api/product";
|
|
import {
|
zhdwQueryResult,
|
zhdwSubmitRemark,
|
mainCreditNextSubmit,
|
} from "@comprehensive/serve/public";
|
import Success from "../../components/Success";
|
import Fail from "../../components/Fail";
|
import { setStorage, getStorage, removeStorage } from "@/utils/storage";
|
import common from "@/utils/common";
|
export default {
|
data() {
|
return {
|
opinionForm: [],
|
opinionArr: [],
|
initialArr: [],
|
mainCredit: this.$store.state.product.mainCredit,
|
applyInfo: this.$store.state.product.applyInfo,
|
applyMenu: this.$store.state.product.applyMenu,
|
results: [],
|
outApprovalOpinions: [],
|
insideResultApproveOpinions: [],
|
rules: {
|
phasechoice: [
|
{ required: true, message: "请选择审批结果", trigger: "change" },
|
],
|
phaseopinion: [
|
{
|
required: true,
|
message: "请选择外部审批意见分类",
|
trigger: "change",
|
},
|
],
|
opiniontype: [
|
{
|
required: true,
|
message: "请选择内部审批意见分类",
|
trigger: "change",
|
},
|
],
|
phaseopinion2: [
|
{ required: true, message: "请输入外部审批意见", trigger: "change" },
|
],
|
phaseopinion3: [
|
{ required: true, message: "请输入内部审批意见", trigger: "change" },
|
],
|
},
|
isShow: true,
|
success: false,
|
fail: false,
|
showPhaseopinion: true,
|
required: true,
|
reason: "",
|
};
|
},
|
watch: {
|
opinionForm(options) {
|
const { phasechoice } = options[0];
|
if (phasechoice === "03" || phasechoice === "05") {
|
// 审批结果为驳回申请人,驳回上一级时,内部审批意见非必填,否则不变
|
this.required = false;
|
} else {
|
this.required = true;
|
}
|
},
|
deep: true,
|
},
|
async created() {
|
this.$parent._data.loading = true;
|
// 查询审批意见列表
|
const result = await this.qryOpinion();
|
this.qryOpinionData(result);
|
// 获取审批结果
|
this.results = await this.qryOutOpinionList();
|
// 案场产品判断如果是上个阶段点击拒绝驳回进来,审判结果禁选通过
|
if (
|
this.$parent._data.showCredit &&
|
this.mainCredit.flowno == "CreditFlowCase"
|
) {
|
this.results.forEach((val) => {
|
if (val.itemno == "01") {
|
val.disabled = true;
|
}
|
});
|
}
|
// 获取内部审批意见分类下拉
|
this.insideResultApproveOpinions = await this.qryDictionaryList(
|
"InsideResultApproveOpinion"
|
);
|
// 获取外部审批意见分类
|
if (result.phasechoice.value) {
|
this.outApprovalOpinions = await this.qryOutOpinionDetail(
|
result.phasechoice.value
|
);
|
if (!this.outApprovalOpinions.length) {
|
this.isShow = false;
|
} else {
|
this.isShow = true;
|
}
|
}
|
this.$parent._data.loading = false;
|
// if(this.applyInfo.isfinanceAdvance){
|
// let textInfo = `收款账户开户行: ${this.applyInfo.putoutbanknoDesc} \n收款账户名: ${this.applyInfo.putoutbankname} \n收款账户账号: ${this.applyInfo.putoutcardno}`
|
// this.opinionForm[0].phaseopinion2 = textInfo
|
// if(this.opinionArr[0].phaseopinion3.visible){
|
// this.opinionForm[0].phaseopinion3 = textInfo
|
// }
|
// }
|
},
|
methods: {
|
// 处理数据,将数据重新排列
|
qryOpinionData(result) {
|
this.opinionForm = [];
|
this.initialArr = [];
|
this.opinionArr = [];
|
this.opinionArr.push(result);
|
this.opinionArr.forEach((val, index) => {
|
// 将数据重新排列
|
const obj = {};
|
for (const key in val) {
|
obj[key] = val[key].value;
|
}
|
this.opinionForm.push(obj);
|
this.initialArr.push(Object.assign({}, obj));
|
});
|
},
|
// 查询审批意见
|
qryOpinion() {
|
return new Promise((resolve) => {
|
qryOpinionDetailByApplySerialNo({
|
applySerialNo: this.mainCredit.serialNo,
|
objectType: this.mainCredit.objectType,
|
}).then((res) => {
|
resolve(res.result);
|
});
|
});
|
},
|
qryDictionaryList(code) {
|
return new Promise((resolve) => {
|
getDictionaryList({
|
codeNo: code,
|
}).then((res) => {
|
resolve(res.result);
|
});
|
});
|
},
|
// 审批结果
|
qryOutOpinionList() {
|
return new Promise((resolve) => {
|
qryOutOpinionCodeList({
|
applySerialNo: this.mainCredit.serialNo,
|
}).then((res) => {
|
resolve(res.result);
|
});
|
});
|
},
|
// 获取审批结果进行对应操作
|
async selPhasechoice(val) {
|
if (!val) {
|
return;
|
}
|
if (val == "01") {
|
// 审批结果为通过时,外部审批意见非必填,否则不变
|
this.isShow = false;
|
} else {
|
this.isShow = true;
|
}
|
if (val == "03" || val == "05") {
|
// 审批结果为驳回申请人,驳回上一级时,内部审批意见非必填,否则不变
|
this.required = false;
|
} else {
|
this.required = true;
|
}
|
if (val == 15) {
|
// 审批结果为取消赎楼,外部审批意见分类要隐藏
|
this.showPhaseopinion = false;
|
} else {
|
this.showPhaseopinion = true;
|
}
|
this.opinionForm[0].phaseopinion = "";
|
this.outApprovalOpinions = await this.qryOutOpinionDetail(val);
|
},
|
// 根据审批结果查询外部审批意见
|
qryOutOpinionDetail(code) {
|
return new Promise((resolve) => {
|
qryOutOpinionCodeDetail({
|
applySerialNo: this.mainCredit.serialNo,
|
typeCodeValue: code,
|
}).then((res) => {
|
resolve(res.result);
|
});
|
});
|
},
|
saveOpinion(form) {
|
return new Promise((resolve) => {
|
updOpinion(form).then((res) => {
|
resolve(res);
|
});
|
});
|
},
|
queryZhdw() {
|
// 中登网查询结果
|
return new Promise(async (resolve) => {
|
try {
|
const zhdwres = await zhdwQueryResult({
|
applySerialNo: this.mainCredit.serialNo,
|
});
|
if (zhdwres.code == "00") {
|
if (Object.keys(zhdwres.result).length == 0) {
|
this.$prompt("中登网登记未完成,请确认是否继续提交?", "", {
|
customClass: "opinion-message-box",
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
inputPlaceholder: "请输入备注信息",
|
inputPattern: /^.+$/,
|
inputErrorMessage: "请输入备注信息",
|
inputType: "textarea",
|
})
|
.then(({ value }) => {
|
zhdwSubmitRemark({
|
applySerialNo: this.mainCredit.serialNo,
|
remark: value,
|
}).then((data) => {
|
if (data.code == "00") resolve(true);
|
});
|
})
|
.catch(() => {
|
resolve(false);
|
});
|
} else {
|
resolve(true);
|
}
|
}
|
} catch (e) {
|
resolve(false);
|
}
|
});
|
},
|
nextSubmitCheck(form) {
|
this.$parent._data.loading = true;
|
const { mainCredit } = this;
|
const { ftSerialNo, serialNo, objectType, phaseNo, productID } =
|
mainCredit;
|
const { phasechoice } = form;
|
form.ftSerialNo = ftSerialNo;
|
form.objectno = serialNo;
|
form.channel = "00";
|
nextSubmitCheck(form).then(async (res) => {
|
this.$parent._data.loading = false;
|
if (res.code == "00") {
|
this.submitOpinion(form);
|
} else {
|
this.$confirm(res.msg, "提示", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
dangerouslyUseHTMLString: true,
|
type: "warning",
|
center: true,
|
})
|
.then(() => {
|
this.submitOpinion(form);
|
})
|
.catch(() => {});
|
}
|
});
|
},
|
submitOpinion(form) {
|
this.$parent._data.loading = true;
|
const { mainCredit } = this;
|
const { ftSerialNo, serialNo, objectType, phaseNo, productID } =
|
mainCredit;
|
const { phasechoice } = form;
|
form.ftSerialNo = ftSerialNo;
|
form.objectno = serialNo;
|
form.channel = "00";
|
mainCreditNextSubmit(form).then(async (res) => {
|
this.$parent._data.loading = false;
|
if (res.code == "00") {
|
// 打开提交成功弹窗
|
this.success = true;
|
const isLD =
|
(phaseNo == "0060" || phaseNo == "0070" || phaseNo == "0080") &&
|
productID == "LD";
|
const isZBD = phaseNo == "0060" && productID == "ZBD";
|
const isPhasechoice = phasechoice === "03" || phasechoice === "05";
|
if ((isLD || isZBD) && isPhasechoice) {
|
const obj = {};
|
obj.ftSerialNo = ftSerialNo;
|
obj.objectNo = serialNo;
|
obj.objectType = objectType;
|
obj.phaseNo = phaseNo;
|
obj.opinionCode = form.phasechoice;
|
const res = await saveFieldMarkData(obj);
|
const { code } = res;
|
if (code == "00") {
|
removeStorage(`${serialNo}`);
|
}
|
}
|
} else {
|
// 审批意见提交失败
|
this.reason = res.msg;
|
this.fail = true;
|
}
|
});
|
},
|
// 保存
|
async save(arr) {
|
const { mainCredit } = this;
|
arr[0].serialno = mainCredit.ftSerialNo;
|
arr[0].objectno = mainCredit.serialNo;
|
this.$parent._data.loading = true;
|
const res = await this.saveOpinion(arr[0]);
|
if (res.code == "00") {
|
this.$message.success("保存成功");
|
}
|
this.$parent._data.loading = false;
|
},
|
|
// 提交
|
submit(arr) {
|
this.$refs.opinionForm[0].validate(async (valid) => {
|
if (valid) {
|
const {
|
phaseNo,
|
serialNo,
|
customerid,
|
customerName,
|
amountloan,
|
businesssum,
|
flowno,
|
productID,
|
} = this.mainCredit;
|
const { phasechoice } = arr[0];
|
// 当前节点是面签且审批结果为通过的时候,需要查询用户是否认证
|
if (phaseNo == "0100" && !this.isShow) {
|
this.submitOpinion(arr[0]);
|
} else if (phaseNo == "0130") {
|
if (!this.isShow) {
|
// 财务放款阶段提交先弹框确认
|
common.comfirm(
|
"提示",
|
`请确认是否需要提交放款,客户名: ${customerName},是否继续?`,
|
() => {
|
this.submitOpinion(arr[0]);
|
}
|
);
|
} else {
|
this.submitOpinion(arr[0]);
|
}
|
// }
|
} else if (
|
(phaseNo == "0060" || phaseNo == "0070" || phaseNo == "0080") &&
|
(flowno == "CreditFlowCase" || flowno == "CreditFlowCommon") &&
|
phasechoice == 1
|
) {
|
const { result } = await qryProductDetail({
|
productCode: productID,
|
applySerialno: serialNo,
|
});
|
const { productRemanentAmt, mergeCreditLoan } = result;
|
if (
|
parseInt(businesssum) > parseInt(productRemanentAmt) &&
|
mergeCreditLoan == 1
|
) {
|
common.comfirm(
|
"提示",
|
`申请单的“贷款金额”【${this.formatMoney(
|
businesssum
|
)}】大于 “产品剩余可用额度”【${this.formatMoney(
|
productRemanentAmt
|
)}】,请确认是否继续提交?`,
|
() => {
|
this.nextSubmitCheck(arr[0]);
|
}
|
);
|
} else {
|
this.nextSubmitCheck(arr[0]);
|
}
|
}
|
else if (phaseNo == "0060") {
|
if (!this.isShow && this.mainCredit.productID != "CFD_ESCKRD") {
|
// this.queryZhdw().then((res) => {
|
// if(res) {
|
this.submitOpinion(arr[0]);
|
// }
|
// })
|
} else {
|
this.submitOpinion(arr[0]);
|
}
|
} else {
|
// this.nextSubmitCheck(arr[0]);
|
//v贷不需要验证了
|
this.submitOpinion(arr[0]);
|
}
|
} else {
|
return false;
|
}
|
});
|
},
|
// 金额格式化
|
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.vLoanTabInfo(
|
this.applyMenu[index - 1].tabname,
|
this.mainCredit.flowno,
|
this
|
);
|
}
|
});
|
},
|
closeDialog(state) {
|
this.success = state;
|
this.fail = state;
|
},
|
},
|
components: {
|
Success,
|
Fail,
|
},
|
};
|
</script>
|
<style lang="stylus">
|
.opinion-message-box {
|
.el-message-box__input {
|
.invalid {
|
border-color: #f56c6c;
|
}
|
}
|
}
|
</style>
|