Compare commits

...

11 Commits

Author SHA1 Message Date
liu.xiaofeng@ebiz-digits.com
8bd3044808 证件有效期检验提示语修改 2024-02-25 17:04:09 +08:00
liu.xiaofeng@ebiz-digits.com
4be5c68957 外国人证件有效期计算补零操作 2024-02-25 15:21:45 +08:00
liu.xiaofeng@ebiz-digits.com
cb2ed8ede2 外国人永久居住证校验位检测去掉小写x 2024-02-23 15:02:27 +08:00
liu.xiaofeng@ebiz-digits.com
fd8f17a18f 卡单证件有效期计算增加与当前日期对比的逻辑 2024-02-23 14:02:33 +08:00
liu.xiaofeng@ebiz-digits.com
8974bf9e14 卡单证件有效期计算增加与当前日期对比的逻辑 2024-02-23 13:59:07 +08:00
liu.xiaofeng@ebiz-digits.com
77ebee1efe 外国人永久居住证证件号码长度为15位的时候去掉生日和性别校验 2024-02-23 09:31:25 +08:00
liu.xiaofeng@ebiz-digits.com
04f6a287eb 外国人证件有效期计算逻辑修改 2024-02-22 19:32:20 +08:00
liu.xiaofeng@ebiz-digits.com
9b067a1821 外国人永久居住证15性别校验修改 2024-02-22 16:31:03 +08:00
liu.xiaofeng@ebiz-digits.com
8092c2b2c5 外国人永久居住证15日期校验修改 2024-02-22 15:43:46 +08:00
liu.xiaofeng@ebiz-digits.com
378f9669e1 投被受 增加规则校验 2024-01-22 11:35:01 +08:00
liu.xiaofeng@ebiz-digits.com
264b83f27c 外国人永久居留身份证增加长度校验 2024-01-18 15:08:27 +08:00
5 changed files with 314 additions and 83 deletions

View File

@@ -29,29 +29,29 @@ function getSearchString (key) {
}
return obj[key]
}
let apiVersion = 'v2'
var ua = window.navigator.userAgent.toLowerCase()
//通过正则表达式匹配ua中是否含有MicroMessenger字符串, 在微信
if (localStorage.getItem('apiVersion')) {
apiVersion = localStorage.getItem('apiVersion')
} else {
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
//report/reportList数据报表页面在浏览器可以打开了但在微信或企业微信中打开不了,接口请求不需要token
if (window.location.href.indexOf('apiVersion') > 0) {
apiVersion = getSearchString('apiVersion') == 'V3' ? 'v3' : 'v2';//url中apiVersion没有时为v2
} else {
apiVersion = 'v3'
}
} else {
// 在app
if (navigator.userAgent.indexOf('JZG_') > 0) {
apiVersion = navigator.userAgent.split('JZG_')[1].split('/')[0].split('_')[1] == 'V3' ? 'v3' : 'v2'
}
}
window.localStorage.setItem('apiVersion', apiVersion)
}
// 可以多个接口域名,按需添加
console.log('环境:', process.env.VUE_APP_FLAG)
let apiVersion = 'v1'
// var ua = window.navigator.userAgent.toLowerCase()
// //通过正则表达式匹配ua中是否含有MicroMessenger字符串, 在微信
// if (localStorage.getItem('apiVersion')) {
// apiVersion = localStorage.getItem('apiVersion')
// } else {
// if (ua.match(/MicroMessenger/i) == 'micromessenger') {
// //report/reportList数据报表页面在浏览器可以打开了但在微信或企业微信中打开不了,接口请求不需要token
// if (window.location.href.indexOf('apiVersion') > 0) {
// apiVersion = getSearchString('apiVersion') == 'V3' ? 'v3' : 'v2';//url中apiVersion没有时为v2
// } else {
// apiVersion = 'v3'
// }
// } else {
// // 在app
// if (navigator.userAgent.indexOf('JZG_') > 0) {
// apiVersion = navigator.userAgent.split('JZG_')[1].split('/')[0].split('_')[1] == 'V3' ? 'v3' : 'v2'
// }
// }
// window.localStorage.setItem('apiVersion', apiVersion)
// }
// // 可以多个接口域名,按需添加
// console.log('环境:', process.env.VUE_APP_FLAG)
switch (process.env.VUE_APP_FLAG) {
case 'dev':
apiDomain = 'https://iagentsales-test2.e-guofu.com:5200/api/' + apiVersion // 国富api ///api/v1

View File

@@ -247,7 +247,7 @@ import utilsAge from '@/assets/js/utils/age'
import IdentityCardScan from '@/components/ebiz/sale/IdentityCardScan'
import CustomerPicker from '@/components/ebiz/customer/CustomerPicker'
import idNoCheck from '@/assets/js/utils/idNoCheck'
import { idToData } from './js/verification'
import {idNoCheck8, idToData} from './js/verification'
import { selectComp } from './js/methods'
import getAreaName from '@/assets/js/utils/getAreaNameForSale'
import { getOrderDetail, checkAppointBnf } from '@/api/ebiz/sale/sale'
@@ -961,7 +961,8 @@ export default {
}
}
//证件类型是户口本
} else if (this.userInfo.idType == '2') {
}
else if (this.userInfo.idType == '2') {
if (age >= 16) {
return this.$toast('客户年龄在16周岁以上不能使用户口本作为有效证件')
}
@@ -1009,7 +1010,8 @@ export default {
return this.$toast('您填写的证件号码有误')
}
//证件类型是出生证明
} else if (this.userInfo.idType == '3') {
}
else if (this.userInfo.idType == '3') {
if (age >= 2) {
return this.$toast('客户年龄在2周岁及以上不能使用出生证作为有效证件')
}
@@ -1019,20 +1021,29 @@ export default {
return this.$toast('您填写的证件号码有误')
}
//证件类型是护照
} else if (this.userInfo.idType == '4') {
}
else if (this.userInfo.idType == '4') {
if (this.userInfo.nativeplace == '1') {
return this.$toast('“证件类型”为“外国人护照”,“国籍”不能选择为“中国”哦~')
}
} else if (this.userInfo.idType == '5') {
}
else if (this.userInfo.idType == '5') {
console.log(this.userInfo.nativeplace, 'nativeplace')
if (this.userInfo.nativeplace != '2' && this.userInfo.nativeplace != '3') {
return this.$toast('“证件类型”为“港澳居民来往内地通行证”,“国籍”请选择“中国香港”或“中国澳门”哦~')
}
} else if (this.userInfo.idType == '6') {
}
else if (this.userInfo.idType == '6') {
if (this.userInfo.nativeplace != '4') {
return this.$toast('“证件类型”为“台湾居民来往大陆通行证”,“国籍”请选择“中国台湾”~')
}
} else if (this.userInfo.idType == '9') {
}
else if (this.userInfo.idType == '8') {
if (idNoCheck8(this.userInfo).text){
return this.$toast(idNoCheck8(this.userInfo).text)
}
}
else if (this.userInfo.idType == '9') {
if (this.userInfo.nativeplace != '2' && this.userInfo.nativeplace != '3' && this.userInfo.nativeplace != '4') {
return this.$toast('“证件类型”为“港澳台居民居住证”,“国籍”请选择“中国香港”、“中国澳门”或“中国台湾”~')
}

View File

@@ -460,7 +460,7 @@
import IdentityCardScan from '@/components/ebiz/sale/IdentityCardScan'
import idNoCheck from '@/assets/js/utils/idNoCheck'
import beforeDate from '@/assets/js/utils/getBeforeDate.js'
import { idToData } from './js/verification'
import { idToData, idNoCheck8 } from './js/verification'
import { selectComp, getIdentityInfo } from './js/methods'
import SearchField from '@/components/common/SearchField'
import riskRules from '@/views/ebiz/common/risk-rules'
@@ -773,8 +773,6 @@
this.isNewPeopleFlagTipshow = true
},
workcompanys(list) {
// 单位数据
console.log(list)
this.userWorkcompanys = list
},
setCustomerMarriage(marriageCode) {
@@ -1243,28 +1241,39 @@
}
}
//证件类型是户口本
} else if (this.userInfo.idType == '2') {
}
else if (this.userInfo.idType == '2') {
if (age > 16) {
return this.$toast('客户年龄在16周岁以上不能使用户口本作为有效证件')
}
} else if (this.userInfo.idType == '3') {
}
else if (this.userInfo.idType == '3') {
if (age >= 2) {
return this.$toast('客户年龄在2周岁及以上不能使用出生证作为有效证件')
}
} else if (this.userInfo.idType == '4') {
}
else if (this.userInfo.idType == '4') {
if (this.userInfo.nativeplace == '1') {
return this.$toast('“证件类型”为“外国人护照”,“国籍”不能选择为“中国”哦~')
}
} else if (this.userInfo.idType == '5') {
}
else if (this.userInfo.idType == '5') {
console.log(this.userInfo.nativeplace, 'nativeplace')
if (this.userInfo.nativeplace != 2 && this.userInfo.nativeplace != 3) {
return this.$toast('“证件类型”为“港澳居民来往内地通行证”,“国籍”请选择“中国香港”或“中国澳门”哦~')
}
} else if (this.userInfo.idType == '6') {
}
else if (this.userInfo.idType == '6') {
if (this.userInfo.nativeplace != 4) {
return this.$toast('“证件类型”为“台湾居民来往大陆通行证”,“国籍”请选择“中国台湾”~')
}
} else if (this.userInfo.idType == '9') {
}
else if (this.userInfo.idType == '8') {
if (idNoCheck8(this.userInfo).text){
return this.$toast(idNoCheck8(this.userInfo).text)
}
}
else if (this.userInfo.idType == '9') {
if (this.userInfo.nativeplace != 2 && this.userInfo.nativeplace != 3 && this.userInfo.nativeplace != 4) {
return this.$toast('“证件类型”为“港澳台居民居住证”,“国籍”请选择“中国香港”、“中国澳门”或“中国台湾”~')
}
@@ -1606,35 +1615,37 @@
}
},
getRelatedData(val, source) {
if (this.userInfo.idType != '1') {
if (this.userInfo.idType != '1' && this.userInfo.idType != '8') {
return
}
//如果证件校验不通过,恢复默认值
if (idToData(val).text) {
;[this.userInfo.idNo, this.userInfo.sex, this.userInfo.birthday, this.effectiveDateTypeAble] = ['', '0', '', false]
return this.$toast(idToData(val).text)
}
// // 判断投保人年龄是否大于16周岁
// if (idToData(val).age <= 16) {
// ;[this.userInfo.idNo, this.userInfo.sex, this.userInfo.birthday, this.effectiveDateTypeAble] = ['', '0', '', false]
// return this.$toast('亲投保人年龄必须大于等于16周岁哦~')
// }
this.userInfo.effectiveDateType = false
this.effectiveDateTypeAble = idToData(val).age <= 45
this.userInfo.birthday = idToData(val).birthday
this.userInfo.sex = idToData(val).sex
//年龄小于18周岁工作单位默认值为
if (idToData(val).age < 18) {
this.userInfo.workcompany = this.userInfo.workcompany || '无'
}
if (idToData(val).age > 45) {
if (source) {
this.userInfo.effectiveDateType = true
if(this.userInfo.idType == '1'){
//如果证件校验不通过,恢复默认值
if (idToData(val).text) {
;[this.userInfo.idNo, this.userInfo.sex, this.userInfo.birthday, this.effectiveDateTypeAble] = ['', '0', '', false]
return this.$toast(idToData(val).text)
}
// // 判断投保人年龄是否大于16周岁
// if (idToData(val).age <= 16) {
// ;[this.userInfo.idNo, this.userInfo.sex, this.userInfo.birthday, this.effectiveDateTypeAble] = ['', '0', '', false]
// return this.$toast('亲投保人年龄必须大于等于16周岁哦~')
// }
this.userInfo.effectiveDateType = false
this.effectiveDateTypeAble = idToData(val).age <= 45
this.userInfo.birthday = idToData(val).birthday
this.userInfo.sex = idToData(val).sex
//年龄小于18周岁工作单位默认值为
if (idToData(val).age < 18) {
this.userInfo.workcompany = this.userInfo.workcompany || '无'
}
if (idToData(val).age > 45) {
if (source) {
this.userInfo.effectiveDateType = true
}
this.effectiveDateTypeAble = false
} else {
// this.userInfo.effectiveDateType = false
}
this.effectiveDateTypeAble = false
} else {
// this.userInfo.effectiveDateType = false
}
},
},

View File

@@ -493,7 +493,7 @@
import IdentityCardScan from '@/components/ebiz/sale/IdentityCardScan'
import idNoCheck from '@/assets/js/utils/idNoCheck'
import beforeDate from '@/assets/js/utils/getBeforeDate.js'
import { idToData } from './js/verification'
import {idNoCheck8, idToData} from './js/verification'
import { selectComp, getIdentityInfo } from './js/methods'
import IndexBar from '@/components/ebiz/sale/IndexBar'
import SearchField from '@/components/common/SearchField'
@@ -1540,7 +1540,8 @@
// }
//证件类型是户口本
} else if (this.userInfo.idType == '2') {
}
else if (this.userInfo.idType == '2') {
if (this.userInfo.nativeplace != '1') {
return this.$toast('证件类型”为“身份证,国籍必须为中国哦')
}
@@ -1591,7 +1592,8 @@
// return this.$toast('户口本的证件号码长度应等于18位')
// }
//证件类型是出生证明
} else if (this.userInfo.idType == '3') {
}
else if (this.userInfo.idType == '3') {
if (age >= 2) {
return this.$toast('客户年龄在2周岁及以上不能使用出生证作为有效证件')
}
@@ -1604,20 +1606,29 @@
// return this.$toast('出生证须大于等于3个字符')
// }
//证件类型是护照
} else if (this.userInfo.idType == '4') {
}
else if (this.userInfo.idType == '4') {
if (this.userInfo.nativeplace == '1') {
return this.$toast('“证件类型”为“外国人护照”,“国籍”不能选择为“中国”哦~')
}
} else if (this.userInfo.idType == '5') {
}
else if (this.userInfo.idType == '5') {
console.log(this.userInfo.nativeplace, 'nativeplace')
if (this.userInfo.nativeplace != 2 && this.userInfo.nativeplace != 3) {
return this.$toast('“证件类型”为“港澳居民来往内地通行证”,“国籍”请选择“中国香港”或“中国澳门”哦~')
}
} else if (this.userInfo.idType == '6') {
}
else if (this.userInfo.idType == '6') {
if (this.userInfo.nativeplace != 4) {
return this.$toast('“证件类型”为“台湾居民来往大陆通行证”,“国籍”请选择“中国台湾”~')
}
} else if (this.userInfo.idType == '9') {
}
else if (this.userInfo.idType == '8') {
if (idNoCheck8(this.userInfo).text){
return this.$toast(idNoCheck8(this.userInfo).text)
}
}
else if (this.userInfo.idType == '9') {
if (this.userInfo.nativeplace != 2 && this.userInfo.nativeplace != 3 && this.userInfo.nativeplace != 4) {
return this.$toast('“证件类型”为“港澳台居民居住证”,“国籍”请选择“中国香港”、“中国澳门”或“中国台湾”~')
}

View File

@@ -35,20 +35,218 @@ export function idToData(idNo) {
}
function getBirthById(idNo) {
// 获取生日
var year = idNo.substr(6, 4)
var month = idNo.substr(10, 2)
var day = idNo.substr(12, 2)
return year + '-' + month + '-' + day
if(idNo.length == 15) {
// 获取生日
let year = '19' + idNo.substr(6, 2)
let month = idNo.substr(8, 2)
let day = idNo.substr(10, 2)
return year + '-' + month + '-' + day
}
if(idNo.length == 18) {
// 获取生日
let year = idNo.substr(6, 4)
let month = idNo.substr(10, 2)
let day = idNo.substr(12, 2)
return year + '-' + month + '-' + day
}
}
function getSexById(idNo) {
// 获取性别
if (idNo.charAt(16) >= '0' && idNo.charAt(16) <= '9') {
if (parseInt(idNo.charAt(16)) % 2 == 0) {
return '1'
} else {
return '0'
// if(idNo.length == 15){
// // 获取性别
// if (idNo.charAt(13) >= '0' && idNo.charAt(13) <= '9') {
// if (parseInt(idNo.charAt(13)) % 2 == 0) {
// return '1'
// } else {
// return '0'
// }
// }
// }
if(idNo.length == 18) {
// 获取性别
if (idNo.charAt(16) >= '0' && idNo.charAt(16) <= '9') {
if (parseInt(idNo.charAt(16)) % 2 == 0) {
return '1'
} else {
return '0'
}
}
}
}
function js_date_time(unixtime) {
var dateTime = new Date(parseInt(unixtime))
var year = dateTime.getFullYear();
var month = dateTime.getMonth() + 1;
var day = dateTime.getDate();
var timeSpanStr = year + '-' + month.toString().padStart(2, '0') + '-' + day.toString().padStart(2, '0');
return timeSpanStr;
}
export function idNoCheck8(userInfo,type) {
if(!userInfo.idNo) {
return {
text: '证件号码不能为空'
}
}
if(userInfo.idNo.length != 15 && userInfo.idNo.length != 18) {
return {
text: '外国人永久居留身份证位数有误'
}
}
if(userInfo.idNo.length == 15) {
let reg = /^[A-Za-z]{3}\d{12}$/
if(!reg.test(userInfo.idNo)) {
return {
text: '外国人永久居留身份证位数有误'
}
}
}
if(userInfo.idNo.length == 18) {
let reg = / (^9\d{17}$)|(^9\d{16}(\d|X)$)/
if(!reg.test(userInfo.idNo)) {
return {
text: '外国人永久居留身份证位数有误'
}
}
}
// if(userInfo.idNo.length == 15) {
// // 获取生日
// let year = '19' + userInfo.idNo.substr(7, 2)
// let month = userInfo.idNo.substr(9, 2)
// let day = userInfo.idNo.substr(11, 2)
// let thisBirthday = year + '-' + month + '-' + day
// if(thisBirthday != userInfo.birthday) {
// console.log('12321321321',thisBirthday)
// return {
// text: '出生日期必须与证件号码中的生日一致'
// }
// }
// }
if(userInfo.idNo.length == 18) {
// 获取生日
let year = userInfo.idNo.substr(6, 4)
let month = userInfo.idNo.substr(10, 2)
let day = userInfo.idNo.substr(12, 2)
let thisBirthday = year + '-' + month + '-' + day
if(thisBirthday != userInfo.birthday) {
return {
text: '出生日期必须与证件号码中的生日一致'
}
}
}
if(userInfo.idNo.length == 18){
let thisSex = getSexById(userInfo.idNo)
if(thisSex != userInfo.sex) {
return {
text: '性别必须与证件号码中的一致'
}
}
}
if (userInfo.nativeplace == '1' || userInfo.nativeplace == '2' || userInfo.nativeplace == '3' || userInfo.nativeplace == '4') {
return {
text: '外国人永久居留身份证不能选择中国国籍'
}
}
if(!userInfo.certiexpiredate) {
return {
text: '证件截止日期不能为空'
}
}
if(type == 'cardList') {
let thisAge = utilsAge.getAge(userInfo.birthday, new Date())
if(thisAge < 18) {
let date1 = new Date(userInfo.certiexpiredate.replace(/-/g,'/'));
let date2 = date1.setFullYear(date1.getFullYear() - 5);
let date3 = date2+(1000*60*60*24)
let date4 = js_date_time(date3)
let thisAge = utilsAge.getAge(userInfo.birthday, new Date(date4.replace(/-/g,'/')))
if(thisAge > 18) {
return {
text: '外国人永久居留身份证证件有效期有误'
}
}
if(date3 > new Date().getTime()) {
return {
text: '外国人永久居留身份证证件有效期有误'
}
}
}
if(thisAge >= 18 && thisAge <= 22) {
let date1 = new Date(userInfo.certiexpiredate.replace(/-/g,'/'));
let date2 = date1.setFullYear(date1.getFullYear() - 5);
let date3 = date2+(1000*60*60*24)
let date4 = js_date_time(date3)
let date5 = new Date(userInfo.certiexpiredate.replace(/-/g,'/'));
let date6 = date5.setFullYear(date5.getFullYear() - 10);
let date7 = date6+(1000*60*60*24)
let date8 = js_date_time(date7)
let thisAge1 = utilsAge.getAge(userInfo.birthday, new Date(date4.replace(/-/g,'/')))
let thisAge2 = utilsAge.getAge(userInfo.birthday, new Date(date8.replace(/-/g,'/')))
if(thisAge1 >= 18 && thisAge2 < 18){
return {
text: '外国人永久居留身份证证件有效期有误'
}
}
if(thisAge1 < 18 && date3 > new Date().getTime()) {
return {
text: '外国人永久居留身份证证件有效期有误'
}
}
if(thisAge2 >= 18 &&date7 > new Date().getTime()) {
return {
text: '外国人永久居留身份证证件有效期有误'
}
}
}
if(thisAge >= 23) {
let date1 = new Date(userInfo.certiexpiredate.replace(/-/g,'/'));
let date2 = date1.setFullYear(date1.getFullYear() - 10);
let date3 = date2+(1000*60*60*24)
let date4 = js_date_time(date3)
let thisAge = utilsAge.getAge(userInfo.birthday, new Date(date4.replace(/-/g,'/')))
if(thisAge < 18) {
return {
text: '外国人永久居留身份证证件有效期有误'
}
}
if(date3 > new Date().getTime()) {
return {
text: '外国人永久居留身份证证件有效期有误'
}
}
}
} else {
let thisAge = utilsAge.getAge(userInfo.birthday, new Date(userInfo.certificateValidate))
if(thisAge < 18) {
let date1 = new Date(userInfo.certificateValidate.replace(/-/g,'/'));
let date2 = date1.setFullYear(date1.getFullYear() + 5);
let date3 = date2-(1000*60*60*24)
let date4 = js_date_time(date3)
console.log(date4+'-'+userInfo.certiexpiredate)
if(date4 != userInfo.certiexpiredate) {
return {
text: '外国人永久居留身份证证件有效期有误'
}
}
}
if(thisAge >= 18) {
let date1 = new Date(userInfo.certificateValidate.replace(/-/g,'/'));
let date2 = date1.setFullYear(date1.getFullYear() + 10);
let date3 = date2-(1000*60*60*24)
let date4 = js_date_time(date3)
if(date4 != userInfo.certiexpiredate) {
return {
text: '外国人永久居留身份证证件有效期有误'
}
}
}
}
return {
text:''
}
}