<template>
|
<div class="AddApply" v-loading.fullscreen.lock="loading" element-loading-background="transparent">
|
<el-dialog :visible.sync="applyVisible" :title="title" center :close-on-click-modal='false' @close="closeDialog('form')">
|
<el-form :model="form" :rules="rules" ref="form" label-width="100px" inline size="small">
|
<el-form-item label="产品类型" prop="productTypeNo">
|
<el-select v-model="form.productTypeNo" filterable placeholder="请选择" @change="selectProductTypeNo">
|
<el-option
|
v-for="(item,index) in productTypeList"
|
:key="index"
|
:label="item.productTypeName"
|
:value="item.productTypeNo">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="产品名称" prop="productid">
|
<el-select v-model="form.productid" filterable placeholder="请选择" @change="productidChange" >
|
<el-option
|
v-for="(item,index) in productList"
|
:key="index"
|
:label="item.productName"
|
:value="item.productCode">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<!-- 预审批和贷款申请的业务类型要做区别 -->
|
<el-form-item label="业务类型" v-if="title=='预审批申请信息'">
|
<el-input v-model="form.occurtype" readonly v-show="false"></el-input>
|
<el-input v-model="form.occurtypeDesc" readonly></el-input>
|
</el-form-item>
|
<el-form-item label="业务类型" prop="occurtype" v-else>
|
<el-select v-model="form.occurtype" @change="selOccurtype" filterable placeholder="请选择">
|
<el-option
|
v-for="(item,index) in businessTypeList"
|
:key="index"
|
:label="item.itemname"
|
:value="item.itemno"
|
:disabled="item.disabled">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="新增方式" prop="addType" v-show="isTYCJ">
|
<el-select v-model="form.addType" disabled='disabled' placeholder="请选择">
|
<el-option label="新增" value="00"></el-option>
|
<el-option label="复制" value="01"></el-option>
|
</el-select>
|
</el-form-item>
|
<!-- 佣金贷产品才有借款人类型 -->
|
<el-form-item label="借款人类型" prop="borrowerType" v-if="isCFD || isTYCJ" :rules="{
|
required: true, message: '请选择借款人类型', trigger: 'change'
|
}" >
|
<el-select v-model="form.borrowerType" @change="selProject($event,'borrowerType')" filterable placeholder="请选择">
|
<el-option
|
v-for="(item,index) in borrowerTypeList"
|
:key="index"
|
:label="item.itemname"
|
:value="item.itemno">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
|
<!-- 判断如果产品类型是保理,写死证件类型为统一社会信用证件类型并且不可编辑 :disabled="form.productTypeNo == 525"-->
|
<el-form-item label="证件类型" prop="certtype">
|
<el-select v-model="form.certtype" filterable placeholder="请选择" @change="certtypeChange">
|
<el-option
|
v-for="(item,index) in certtypeList"
|
:key="index"
|
:label="item.itemname"
|
:value="item.itemno"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="客户名称" prop="customername">
|
<el-autocomplete
|
style="width:100%"
|
clearable
|
v-model="form.customername"
|
:fetch-suggestions="remoteMethod"
|
placeholder="请输入内容"
|
@select="setCertid"
|
></el-autocomplete>
|
<!-- <el-select
|
style="width:100%"
|
v-model="form.customername"
|
filterable
|
remote
|
allow-create
|
:loading='lodingy'
|
@change="setCertid"
|
@visible-change="editSelect"
|
value-key="creditCode"
|
clearable
|
default-first-option
|
:remote-method="remoteMethod"
|
placeholder="请选择过滤内容">
|
<el-option
|
v-for="item in options"
|
:key="item.creditCode"
|
:label="item.name"
|
:value="item">
|
</el-option>
|
</el-select> -->
|
<!-- <el-input></el-input> -->
|
</el-form-item>
|
<el-form-item label="证件号码" prop="certid">
|
<el-input v-model="form.certid" @input="certidChange"></el-input>
|
</el-form-item>
|
|
<!-- 易贷产品才有申请类型 -->
|
<el-form-item label="申请类型" prop="applytype" v-if="form.productTypeNo==535">
|
<el-select v-model="form.applytype" :disabled="title=='预审批申请信息'" filterable placeholder="请选择">
|
<el-option
|
v-for="(item,index) in applytypeList"
|
:key="index"
|
:label="item.itemname"
|
:value="item.itemno"
|
:disabled="item.disabled">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<!-- 佣金贷产品才有项目名称 -->
|
<!-- <el-form-item label="项目名称" prop="projectSerialno" v-if="form.productid=='CFD'">
|
<el-select v-model="form.projectSerialno" @change="selProject" filterable placeholder="请选择">
|
<el-option
|
v-for="(item,index) in projectList"
|
:key="index"
|
:label="item.projectname"
|
:value="item.serialno">
|
</el-option>
|
</el-select>
|
</el-form-item> -->
|
<!-- 佣金贷产品才有核心企业 -->
|
<el-form-item label="核心企业" prop="enterpriseNo" v-if="isCFD" :rules="{
|
required: true, message: '请选择核心企业', trigger: 'change'
|
}">
|
<el-select v-model="form.enterpriseNo" @change="selProject($event,'enterpriseNo')" filterable placeholder="请选择">
|
<el-option
|
v-for="(item,index) in enpAdmitInList"
|
:key="index"
|
:label="item.enterprisename"
|
:value="item.serialno">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button type="primary" @click="confirm('form')">确定</el-button>
|
</div>
|
</el-dialog>
|
<el-dialog :visible.sync="dialogTableVisible" title="申请编号选择" center :close-on-click-modal='false'>
|
<el-table
|
stripe
|
:data="applyData"
|
:header-cell-style="{background:'#f5f5f5',color:'#222222'}"
|
highlight-current-row
|
@current-change="getCurrentRow"
|
max-height="540"
|
>
|
<el-table-column type="index" width="40" label=" "></el-table-column>
|
<el-table-column property="serialno" label="申请编号" width="160"></el-table-column>
|
<el-table-column property="customername" label="客户名称" width="120"></el-table-column>
|
<el-table-column property="productname" label="产品名称" width="120"></el-table-column>
|
<el-table-column property="projectname" label="项目名称" width="160"></el-table-column>
|
<el-table-column property="operateusername" label="报单人" width="150"></el-table-column>
|
<el-table-column property="inputdate" label="报单日期" width="150"></el-table-column>
|
</el-table>
|
<div slot="footer" class="dialog-footer">
|
<el-button plain @click="back">返回</el-button>
|
<el-button type="primary" @click="submit(form)">确定</el-button>
|
</div>
|
</el-dialog>
|
</div>
|
</template>
|
<script>
|
import {
|
qryProdTypeList,
|
qryProdList,
|
getDictionaryList,
|
qryCopiedApplyList,
|
savePreApplyLoan,
|
saveApplyLoan,
|
listCommissionProjects,
|
qryEnterpriseList,
|
findDataByNameOrCodes,
|
getOccurTypeList
|
} from '@/api/product'
|
|
import { setStorage,getStorage } from '@/utils/storage'
|
import common from "@/utils/common";
|
export default {
|
props:['title','visible'],
|
data () {
|
return {
|
form:{
|
addType:'00',
|
occurtype:'',
|
applytype:'',
|
productTypeNo: '',
|
certtype: '',
|
},
|
lodingy:false,
|
options:[],
|
allowCreate:true,
|
dialogTableVisible:false,
|
applyData:[],
|
productTypeList:[],
|
productList:[],
|
certtypeList:[],
|
applytypeList:[],
|
businessTypeList:[],
|
projectList:[],
|
enpAdmitInList: [],
|
borrowerTypeList: [],
|
rules:{
|
productTypeNo:[{ required: true, message: '请输入产品类型', trigger: 'change' }],
|
productid:[{ required: true, message: '请输入产品名称', trigger: 'change' }],
|
addType:[{ required: true, message: '请输入新增方式', trigger: 'change' }],
|
customername:[
|
{ required: true, message: '请输入客户名称', trigger: 'change' },
|
{ validator: (rule, value, callback) => {
|
if(!(/^[\u4e00-\u9fa5/()()]{2,50}$/.test(value))&&this.form.productTypeNo != '525'){
|
callback(new Error('格式不正确'));
|
}else{
|
callback()
|
}
|
}, trigger: 'change' }
|
],
|
certtype:[{ required: true, message: '请输入证件类型', trigger: 'change' }],
|
certid:[
|
{ required: true, message: '请输入证件号码', trigger: 'change' },
|
{ validator: (rule, value, callback) => {
|
if (value) {
|
common.checkCertid(this.form.certtype,value,callback)
|
}
|
}, trigger: 'change' }
|
],
|
occurtype:[{ required: true, message: '请输入业务类型', trigger: 'change' }],
|
applytype:[{ required: true, message: '请输入申请类型', trigger: 'change' }],
|
},
|
loading:false,
|
isCopy:false
|
}
|
},
|
computed: {
|
applyVisible:{
|
get(){
|
return this.visible
|
},
|
set(){}
|
},
|
isCFD() {
|
// 二手车例外
|
return (this.form.productid && this.form.productid.slice(0, 3) == 'CFD' || this.form.productid && this.form.productid.slice(0, 3) == 'OFF-TYCJ') && this.form.productid !='CFD_ESCKRD'
|
},
|
isTYCJ() {
|
// 二手车例外
|
return (this.form.productid && this.form.productid.indexOf('OFF_') > -1 || this.form.productid && this.form.productid.indexOf('OUT_JGKD') > -1) && this.form.productid !='CFD_ESCKRD'
|
}
|
},
|
async created () {
|
// 预审批申请新增业务类型默认是授信,并且不可编辑
|
if(this.title == '预审批申请信息'){
|
this.form.occurtype = '01'
|
this.form.occurtypeDesc = '授信'
|
}
|
this.getProdTypeList()
|
// 产品列表
|
this.getProdList('')
|
//证件类型
|
this.certtypeList = await this.qryDictionaryList('CertType');
|
// 业务类型
|
// this.businessTypeList = await this.qryDictionaryList('BuildingBusinessTypeCredit');
|
// 借款人类型
|
this.borrowerTypeList = await this.qryDictionaryList('BorrowerType');
|
// 企业核心
|
// this.qryEnterpriseList()
|
// 项目名称
|
// this.listCommissionProjects()
|
|
|
},
|
methods: {
|
// 设置证件号码值
|
setCertid(e){
|
console.log(e)
|
if(e.creditCode){
|
this.$set(this.form, 'certid', e.creditCode)
|
this.$set(this.form, 'customername', e.name)
|
this.qryEnterpriseList()
|
}
|
},
|
editSelect(e){
|
if(!e){
|
this.remoteMethod()
|
}
|
},
|
// 远程搜索枚举值
|
async remoteMethod(columnValue='',cb){
|
this.lodingy=true
|
var results = [];
|
if(!columnValue){
|
this.options=[]
|
this.lodingy=false
|
return
|
}
|
await findDataByNameOrCodes({code:columnValue}).then(res=>{
|
if(res.result){
|
const list = res.result.map(res=>{
|
res.value = res.name
|
res.id = res.creditCode
|
return res
|
})
|
cb(list)
|
}
|
|
}).catch(err=>{
|
this.options=[]
|
this.lodingy=false
|
})
|
},
|
//证件类型修改
|
certtypeChange(val) {
|
this.form.certtype = val
|
this.$forceUpdate()
|
},
|
//借款人类型,核心企业取值变更
|
selProject(val, type){
|
const { projectList } = this
|
console.log(type)
|
if(type == 'borrowerType') {
|
this.form.borrowerType = val
|
//借款人类型 01为企业,证件类型改为统一社会信用代码
|
if (val == '01') {
|
this.form.certtype = '05'
|
}
|
//02为个人,证件类型改为身份证
|
else if (val == '02') {
|
this.form.certtype = '01'
|
}
|
}else if( type == 'enterpriseNo') {
|
this.form.enterpriseNo = val
|
}
|
this.$forceUpdate()
|
for (let i = 0; i < projectList.length; i++) {
|
if(projectList[i].serialno == val){
|
this.form.projectName = projectList[i].projectname
|
break
|
}
|
}
|
},
|
async listCommissionProjects(){
|
const projectList = await listCommissionProjects()
|
this.projectList = projectList.result
|
},
|
async qryEnterpriseList() {
|
|
let {occurtype, certtype, certid, productid} = this.form
|
if(!occurtype || !certtype || !certid || !productid) {
|
return
|
}
|
const enpAdmitInList = await qryEnterpriseList({
|
occurType: occurtype,
|
certType: certtype,
|
certId: certid,
|
productId: productid
|
})
|
this.enpAdmitInList = enpAdmitInList.result
|
},
|
selOccurtype(val){
|
// 当产品类型为对公类新增无论业务类型选择哪个新增方式都是固定新增
|
if(this.form.productTypeNo==530){
|
this.form.addType = '00'
|
this.isCopy = true
|
}else{
|
// 当业务类型为分期或者取现时新增方式固定为新增
|
if((val=='02'||val=='03')&&this.form.productTypeNo!=521){
|
this.form.addType = '00'
|
this.isCopy = true
|
}else{
|
this.isCopy = false
|
}
|
}
|
|
this.qryEnterpriseList()
|
},
|
qryDictionaryList(code){
|
return new Promise(resolve=>{
|
getDictionaryList({
|
codeNo: code
|
}).then(res=>{
|
resolve(res.result)
|
})
|
})
|
},
|
getCurrentRow(row){
|
this.form.copiedSerialNo = row.serialno
|
},
|
// 查询产品类型
|
getProdTypeList(){
|
qryProdTypeList({}).then(res=>{
|
this.productTypeList = res.result
|
this.$nextTick(() => {
|
this.form.productTypeNo = '525'
|
this.selectProductTypeNo(525)
|
})
|
})
|
},
|
// 监听产品类型获取产品名称下拉
|
async selectProductTypeNo(val){
|
// 判断如果是抵押贷,就添加申请类型
|
if(val==535){
|
//申请类型
|
this.applytypeList = await this.qryDictionaryList('applyCode');
|
// 如果是贷款申请,不能选择首次借款
|
if(this.title == '贷款申请信息'){
|
this.applytypeList.forEach(val => {
|
if(val.itemno == 0){
|
val.disabled = true
|
}
|
});
|
}
|
}
|
// 判断如果是抵押贷和预审批阶段,申请类型默认是首次借款
|
if(val==535&&this.title=='预审批申请信息'){
|
this.form.applytype = '0'
|
}else{
|
delete this.form.applytype
|
}
|
// 判断如果是快贷
|
if(val==521){
|
// 新增方式可以选择复制
|
this.isCopy = false
|
//更新业务类型下拉值
|
this.businessTypeList = await this.qryDictionaryList('BuildingBusinessType');
|
}else{
|
this.businessTypeList = await this.qryDictionaryList('BuildingBusinessTypeCredit');
|
}
|
// 判断是招标贷,业务类型的分期不可选
|
if(val==530){
|
this.businessTypeList.forEach(val => {
|
if(val.itemno == '02'){
|
val.disabled = true
|
}
|
});
|
}
|
// 判断是保理证件类型写死是统一社会信用证件类型
|
if(val == 525){
|
this.form.certtype = '05'
|
}
|
// 更新业务类型值,如果是预审批阶段不用置空
|
if(this.title!='预审批申请信息'){
|
this.form.occurtype = ''
|
}
|
// 根据产品类型获取产品名称下拉
|
this.getProdList(val)
|
},
|
// 产品名称
|
getProdList(productTypeNo){
|
const obj = {}
|
obj.productTypeNo=productTypeNo
|
if(this.title == '预审批申请信息'){
|
obj.preApproved='1'
|
}else{
|
obj.preApproved='0'
|
}
|
qryProdList(obj).then(res=>{
|
this.productList = res.result
|
if(this.form.productid){
|
for (let i = 0; i < this.productList.length; i++) {
|
if(this.productList[i].productCode==this.form.productid){
|
return
|
}
|
}
|
this.form.productid = ''
|
}
|
})
|
},
|
// 返回并关闭当前弹窗
|
back(){
|
this.dialogTableVisible = false
|
},
|
closeDialog(formName){
|
this.$refs[formName].resetFields();
|
this.$emit('closeApply',false)
|
},
|
// 提交复制申请单
|
submit(form){
|
if(!form.copiedSerialNo){
|
this.$message.warning('请单击选中数据');
|
return;
|
}
|
this.loading = true
|
if(this.title=='预审批申请信息'){
|
this.submitLoanAndPreApply(savePreApplyLoan)
|
}else{
|
this.submitLoanAndPreApply(saveApplyLoan)
|
}
|
},
|
// 封装预审批和贷款申请提交接口
|
submitLoanAndPreApply(data){
|
data(this.form).then(res=>{
|
this.loading = false
|
if(res.code=='00'){
|
res.result.objectType = res.result.objecttype
|
res.result.phaseNo = res.result.phaseno
|
res.result.productID = res.result.productid
|
delete res.result.objecttype
|
delete res.result.phaseno
|
delete res.result.productid
|
this.$store.commit('SET_applyInfo',res.result)
|
this.$message.success('新增成功')
|
this.$emit('closeApply',false)
|
this.$router.push({path:'/loanApplyEdit'})
|
}
|
})
|
},
|
async productidChange() {
|
this.$refs['form'].clearValidate();
|
//如果借款人类型是企业,则证件类型默认为统一社会信用代码
|
if(this.isCFD || this.isTYCJ) {
|
this.form.borrowerType = '01'
|
this.form.certtype = '05'
|
}
|
//如果借款人类型是企业,则证件类型默认为统一社会信用代码
|
if(this.form.productid == 'YZD') {
|
this.form.certtype = '01'
|
}
|
// 业务类型
|
getOccurTypeList({productid: this.form.productid}).then(res=>{
|
this.businessTypeList = res.result
|
|
const type3 = res.result.find(res=> res.itemno == '03')
|
if(type3) {
|
this.form.occurtype = '03'
|
} else {
|
this.form.occurtype = res.result[0].itemno
|
}
|
})
|
this.qryEnterpriseList()
|
},
|
certidChange() {
|
this.form.certid = this.form.certid.toUpperCase().trim()
|
// 当类型为企业的时候调用天眼查去获取客户名称
|
if(this.form.certid.length == 18 && this.form.borrowerType == '01') {
|
this.qryEnterpriseList()
|
findDataByNameOrCodes({codes:[this.form.certid]}).then((res)=>{
|
if(res.code == '00') {
|
this.$set(this.form, 'customername', res.result.length > 0 ? res.result[0].name : '')
|
// this.form.customername = res.result[0].name
|
}
|
})
|
} else {
|
this.qryEnterpriseList()
|
}
|
},
|
// 提交新增申请单
|
confirm(formName){
|
this.$refs[formName].validate((valid) => {
|
if (valid) {
|
// applychannel预审批和贷款申请有区别
|
if(this.title=='预审批申请信息'){
|
this.form.applychannel='06'
|
}else{
|
this.form.applychannel='03'
|
}
|
if(this.form.addType=='00'){
|
this.loading = true
|
if(this.title=='预审批申请信息'){
|
this.submitLoanAndPreApply(savePreApplyLoan)
|
}else{
|
this.submitLoanAndPreApply(saveApplyLoan)
|
}
|
}else{
|
this.loading = true
|
qryCopiedApplyList(this.form).then(res=>{
|
this.loading = false
|
if(res.result.length){
|
this.applyData = res.result
|
this.dialogTableVisible = true
|
}
|
})
|
}
|
} else {
|
return false;
|
}
|
});
|
}
|
}
|
}
|
</script>
|
<style lang="stylus">
|
.AddApply
|
.el-dialog
|
width auto
|
max-width calc(100% - 180px)
|
min-width 850px
|
max-height 100%
|
overflow hidden
|
margin 0 !important
|
position absolute
|
left 50%
|
top 50%
|
transform translate(-50%,-50%)
|
p
|
text-align: center
|
color: #222222
|
font-size: 18px
|
font-weight:500
|
margin-bottom: 20px
|
.el-dialog__header
|
padding: 40px 0 30px
|
.el-dialog__headerbtn
|
top:12px
|
.el-dialog__body
|
padding 0 20px 26px
|
.el-table
|
td,th
|
height 48px
|
padding 0
|
.cell
|
line-height 18px
|
.el-dialog__footer
|
padding 0
|
.dialog-footer
|
padding 0 0 40px
|
.el-button
|
width: 120px
|
font-size: 14px
|
line-height: 20px
|
padding: 5px 0
|
.el-form
|
display: flex
|
justify-content: flex-start
|
flex-wrap: wrap
|
.el-form-item
|
display: flex
|
width:45%
|
margin: 0 30px 24px 0
|
.el-form-item__label
|
color: #888
|
.el-form-item__content
|
flex:1
|
.el-date-editor
|
width: auto
|
.el-select
|
display: block
|
</style>
|