Commit f2f91d77 authored by 李晓兵's avatar 李晓兵

'身份证修改'

parent 3ac61935
......@@ -99,6 +99,26 @@
class="auto"
>
</item>
<item>
<div slot="name" class="required">身份证有效期从</div>
<input
slot="content"
v-model="baseInfo.id_card_date_from"
readonly
placeholder="上传身份证自动填充"
class="auto"
>
</item>
<item>
<div slot="name" class="required">身份证有效期到</div>
<input
slot="content"
v-model="baseInfo.id_card_date_to"
readonly
placeholder="上传身份证自动填充"
class="auto"
>
</item>
<item>
<div slot="name" class="required">户籍地址</div>
<textarea
......@@ -190,10 +210,57 @@
</list-item>
<div v-if="hasSP">
<div class="userInfo">配偶信息</div>
<div class="upload-id-card">
<span>身份证照片上传</span>
<div class="upload-box">
<div v-if="!idCardFrontSp" @click="ocrShow('idCardSp', 'front')">
<img src="@/assets/userBind/front.png" >
<p>正面</p>
</div>
<div v-if="idCardFrontSp && !isApproved" @click="ocrShow('idCardSp', 'front')">
<img :src="idCardFrontSp" style="width: 100%;height: 100%;margin: 0" >
</div>
<div v-if="isApproved && idCardFrontSp">
<img
v-if="idCardFrontSp"
:src="idCardFrontSp"
style="width: 100%;height: 100%;margin: 0"
@click="showBigPicture(idCardFrontSp)"
>
</div>
<div v-if="!idCardBackSp" @click="ocrShow('idCardSp', 'back')">
<img src="@/assets/userBind/back.png" >
<p>反面</p>
</div>
<div v-if="idCardBackSp && !isApproved" @click="ocrShow('idCardSp', 'back')">
<img :src="idCardBackSp" style="width: 100%;height: 100%;margin: 0" >
</div>
<div v-if="isApproved && idCardBackSp">
<img
v-if="idCardBackSp"
:src="idCardBackSp"
style="width: 100%;height: 100%;margin: 0"
@click="showBigPicture(idCardBackSp)"
>
</div>
</div>
</div>
<list-item :item-height="44">
<item>
<div slot="name" class="required">姓名</div>
<input slot="content" v-model="baseInfo.bp_name_sp" placeholder="请输入姓名" >
<input slot="content" v-model="baseInfo.bp_name_sp" readonly placeholder="上传身份证自动填充" >
</item>
<item>
<div slot="name" class="required">配偶身份证号</div>
<input slot="content" v-model="baseInfo.id_card_no_sp" readonly placeholder="上传身份证自动填充" >
</item>
<item>
<div slot="name" class="required">身份证有效期从</div>
<input slot="content" v-model="baseInfo.id_card_date_from_sp" readonly placeholder="上传身份证自动填充" >
</item>
<item>
<div slot="name" class="required">身份证有效期到</div>
<input slot="content" v-model="baseInfo.id_card_date_to_sp" readonly placeholder="上传身份证自动填充" >
</item>
<item>
<div slot="name" class="required">手机号码</div>
......@@ -384,12 +451,17 @@ export default {
city_name: '',
city_id: '',
id_card_no: null,
id_card_date_from: '', // 身份证有效期从
id_card_date_to: '', // 身份证有效期到
cell_phone: null,
living_address: '',
address_on_resident_booklit: '',
marital_status: '',
academic_background: '',
bp_name_sp: '',
id_card_no_sp: '', // 配偶身份证号
id_card_date_from_sp: '', // 配偶身份证有效期从
id_card_date_to_sp: '', // 配偶身份证有效期到
district_id: '',
district_name: '',
spouse_phone: '',
......@@ -404,11 +476,19 @@ export default {
},
idCardFront: '', // 身份证正面图片
idCardBack: '', // 身份证反面图片
idCardFrontSp: '', // 配偶身份证正面图片
idCardBackSp: '', // 配偶身份证反面图片
bankImg: '', // 银行卡图片
cddItemList: [], // 资料清单列表
idCardCheck_id: '', // 身份证check_id
idCardImgList: [], // 存身份证图片列表
idCardEditFlag: false, // 身份证修改标识,为true则标识已修改,后续需要重新上传此照片
idCardFrontCheck_id: '', // 身份证正面check_id
idCardBackCheck_id: '', // 身份证反面check_id
idCardFrontSpCheck_id: '', // 配偶身份证正面check_id
idCardBackSpCheck_id: '', // 配偶身份证反面check_id
// idCardImgList: [], // 存身份证图片列表
idCardFrontEditFlag: false, // 身份证正面修改标识,为true则标识已修改,后续需要重新上传此照片
idCardBackEditFlag: false, // 身份证反面修改标识,为true则标识已修改,后续需要重新上传此照片
idCardFrontSpEditFlag: false, // 配偶身份证正面修改标识,为true则标识已修改,后续需要重新上传此照片
idCardBackSpEditFlag: false, // 配偶身份证反面修改标识,为true则标识已修改,后续需要重新上传此照片
isClear: false,
}
},
......@@ -516,14 +596,17 @@ export default {
item['url'] = process.env.filePath + 'attachment_id=' + item.attachment_id + '&access_token=' + window.localStorage.access_token
})
switch (cdd_item) {
case 'NP_ID_CARD':
res.lists.forEach(item => {
if (item.file_name === 'front.jpg') {
case 'NP_ID_CARD_F': // 承租人身份证正面
vm.idCardFront = item.url
} else {
break
case 'NP_ID_CARD_B': // 承租人身份证背面
vm.idCardBack = item.url
}
})
break
case 'MATE_ID_CARD_F': // 配偶身份证正面
vm.idCardFrontSp = item.url
break
case 'MATE_ID_CARD_B': // 配偶身份证背面
vm.idCardBackSp = item.url
break
default:
vm.dowload_list.push(res.lists)
......@@ -560,8 +643,17 @@ export default {
var listTemp = [...res.lists]
listTemp.forEach(item => {
switch (item.cdd_item) {
case 'NP_ID_CARD':
vm.idCardCheck_id = item.check_id
case 'NP_ID_CARD_F': // 承租人身份证正面
vm.idCardFrontCheck_id = item.check_id
break
case 'NP_ID_CARD_B': // 承租人身份证背面
vm.idCardBackCheck_id = item.check_id
break
case 'MATE_ID_CARD_F': // 配偶身份证正面
vm.idCardFrontSpCheck_id = item.check_id
break
case 'MATE_ID_CARD_B': // 配偶身份证背面
vm.idCardBackSpCheck_id = item.check_id
break
case 'BANK_CARD':
......@@ -574,21 +666,64 @@ export default {
listTemp.forEach((item, index) => {
vm.load_picture(item.check_id, index, item.cdd_item)
})
if (vm.idCardEditFlag) { // 身份证图片已修改,重新上传
if (vm.idCardFrontEditFlag) { // 身份证正面图片已修改,重新上传
var list = []
for (let i = 0; i < vm.idCardImgList.length; i++) {
let obj = {
'pkvalue': vm.idCardCheck_id,
'pkvalue': vm.idCardFrontCheck_id,
'source_type': 'PRJ_CDD_ITEM_CHECK',
'picture': '',
'check_id': vm.idCardCheck_id,
'filePath': vm.idCardImgList[i].url,
'check_id': vm.idCardFrontCheck_id,
'filePath': vm.idCardFront,
'attachment_id': '',
'user_id': 1,
'fileName': vm.idCardImgList[i].fileName,
'fileName': 'front',
}
list.push(obj)
vm.save_picture(list)
}
if (vm.idCardBackEditFlag) { // 身份证反面图片已修改,重新上传
var list = []
let obj = {
'pkvalue': vm.idCardBackCheck_id,
'source_type': 'PRJ_CDD_ITEM_CHECK',
'picture': '',
'check_id': vm.idCardBackCheck_id,
'filePath': vm.idCardBack,
'attachment_id': '',
'user_id': 1,
'fileName': 'back',
}
list.push(obj)
vm.save_picture(list)
}
if (vm.idCardBackEditFlag) { // 配偶身份证正面图片已修改,重新上传
var list = []
let obj = {
'pkvalue': vm.idCardFrontSpCheck_id,
'source_type': 'PRJ_CDD_ITEM_CHECK',
'picture': '',
'check_id': vm.idCardFrontSpCheck_id,
'filePath': vm.idCardFrontSp,
'attachment_id': '',
'user_id': 1,
'fileName': 'front',
}
list.push(obj)
vm.save_picture(list)
}
if (vm.idCardBackEditFlag) { // 配偶身份证背面图片已修改,重新上传
var list = []
let obj = {
'pkvalue': vm.idCardBackSpCheck_id,
'source_type': 'PRJ_CDD_ITEM_CHECK',
'picture': '',
'check_id': vm.idCardBackSpCheck_id,
'filePath': vm.idCardBackSp,
'attachment_id': '',
'user_id': 1,
'fileName': 'back',
}
list.push(obj)
vm.save_picture(list)
}
}
......@@ -628,6 +763,10 @@ export default {
vm.hlsPopup.showLongCenter('客户姓名不能为空!')
} else if (!vm.baseInfo.id_card_no) {
vm.hlsPopup.showLongCenter('身份证号不能为空!')
} else if (!vm.baseInfo.id_card_date_from) {
vm.hlsPopup.showLongCenter('身份证有效期从不能为空!')
} else if (!vm.baseInfo.id_card_date_to) {
vm.hlsPopup.showLongCenter('身份证有效期到不能为空!')
} else if (!vm.baseInfo.cell_phone) {
vm.hlsPopup.showLongCenter('手机号不能为空!')
} else if (!vm.baseInfo.living_address) {
......@@ -640,6 +779,12 @@ export default {
vm.hlsPopup.showLongCenter('婚姻状况不能为空!')
} else if (vm.marital_status_n === '已婚' && !vm.baseInfo.bp_name_sp) {
vm.hlsPopup.showLongCenter('配偶姓名不能为空!')
} else if (vm.marital_status_n === '已婚' && !vm.baseInfo.id_card_no_sp) {
vm.hlsPopup.showLongCenter('配偶身份证号不能为空!')
} else if (vm.marital_status_n === '已婚' && !vm.baseInfo.id_card_date_from_sp) {
vm.hlsPopup.showLongCenter('配偶身份证有效期从不能为空!')
} else if (vm.marital_status_n === '已婚' && !vm.baseInfo.id_card_date_to_sp) {
vm.hlsPopup.showLongCenter('配偶身份证有效期到不能为空!')
} else if (vm.marital_status_n === '已婚' && !vm.baseInfo.spouse_phone) {
vm.hlsPopup.showLongCenter('配偶手机号不能为空!')
} else if (
......@@ -854,8 +999,11 @@ export default {
hlsPopup.showLongCenter('请拍照')
} else {
if (ocrType === 'idCard') {
vm.idCardEditFlag = true // 身份证图片状态已修改
type === 'front' ? (vm.idCardFront = imgdata, vm.idCardIdentify(imgdata), vm.idCardImgList.push({'url': imgdata, 'fileName': 'front'})) : (vm.idCardBack = imgdata, vm.idCardImgList.push({'url': imgdata, 'fileName': 'back'}))
// vm.idCardEditFlag = true // 身份证图片状态已修改
type === 'front' ? (vm.idCardFront = imgdata, vm.idCardIdentify(imgdata,'idCard'),vm.idCardFrontEditFlag = true) : (vm.idCardBack = imgdata,vm.idCardBackIdentify(imgdata,'idCard'),vm.idCardBackEditFlag = true)
} else if (ocrType === 'idCardSp') { // 配偶身份证识别
vm.idCardSpEditFlag = true // 身份证图片状态已修改
type === 'front' ? (vm.idCardFrontSp = imgdata, vm.idCardIdentify(imgdata,'idCardSp'),vm.idCardFrontSpEditFlag = true) : (vm.idCardBackSp = imgdata,vm.idCardBackIdentify(imgdata,'idCardSp'),vm.idCardBackSpEditFlag = true)
} else if (ocrType === 'bankCard') {
vm.bankImg = imgdata
vm.bankCardIdentify(imgdata)
......@@ -881,7 +1029,10 @@ export default {
} else {
if (ocrType === 'idCard') {
vm.idCardEditFlag = true // 身份证图片状态已修改
type === 'front' ? (vm.idCardFront = imgUrl[0], vm.idCardIdentify(imgUrl[0]), vm.idCardImgList.push({'url': imgUrl[0], 'fileName': 'front'})) : (vm.idCardBack = imgUrl[0], vm.idCardImgList.push({'url': imgUrl[0], 'fileName': 'back'}))
type === 'front' ? (vm.idCardFront = imgUrl[0], vm.idCardIdentify(imgUrl[0],'idCard'),vm.idCardFrontEditFlag = true) : (vm.idCardBack = imgUrl[0],vm.idCardBackIdentify(imgUrl[0],'idCard'),vm.idCardBackEditFlag = true)
}else if (ocrType === 'idCardSp') { // 配偶身份证识别
vm.idCardSpEditFlag = true // 身份证图片状态已修改
type === 'front' ? (vm.idCardFrontSp = imgUrl[0], vm.idCardIdentify(imgUrl[0],'idCardSp'),vm.idCardFrontSpEditFlag = true) : (vm.idCardBackSp = imgUrl[0],vm.idCardBackIdentify(imgUrl[0],'idCardSp'),vm.idCardBackSpEditFlag = true)
} else if (ocrType === 'bankCard') {
vm.bankImg = imgUrl[0]
vm.bankCardIdentify(imgUrl[0])
......@@ -894,18 +1045,40 @@ export default {
vm.hlsUtil.takePicture(cameraoptions, success, error)
},
// 身份证识别
idCardIdentify (fileUrl) {
idCardIdentify (fileUrl,cardType) {
let vm = this
hlsPopup.showLoading('正在识别')
let url = process.env.ocrPath + '/baidu/ocr/idCard'
hlsUtil.baiduOcr(fileUrl, url, function (res) {
hlsPopup.hideLoading()
let result = res.result.words_result
if(cardType === 'idCard'){
vm.baseInfo.bp_name = result.姓名.words
vm.baseInfo.id_card_no = result.公民身份号码.words
vm.baseInfo.address_on_resident_booklit = result.住址.words
}else{
vm.baseInfo.bp_name_sp = result.姓名.words
vm.baseInfo.id_card_no_sp = result.公民身份号码.words
}
})
},
// 身份证背面识别
idCardBackIdentify (fileUrl,cardType) {
let vm = this
hlsPopup.showLoading('正在识别')
let url = process.env.ocrPath + '/baidu/ocr/idCardBack'
hlsUtil.baiduOcr(fileUrl, url, function (res) {
hlsPopup.hideLoading()
let result = res.result.words_result
if(cardType === 'idCard'){
vm.baseInfo.id_card_date_from = result.签发日期.words
vm.baseInfo.id_card_date_to = result.失效日期.words
}else{
vm.baseInfo.id_card_date_from_sp = result.签发日期.words
vm.baseInfo.id_card_date_to_sp = result.失效日期.words
}
})
},
// 银行卡识别
bankCardIdentify (fileUrl) {
let vm = this
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment