[FIX]解决dev代码合并问题

This commit is contained in:
yuweiqi
2020-04-21 13:12:50 +08:00
parent 6a72af0dbe
commit a918abba3e

View File

@@ -204,9 +204,9 @@ import FieldDatePicter from '@/components/ebiz/FieldDatePicter'
import OccupationPicker from '@/components/ebiz/occipation/OccupationPicker'
import DataDictionary from '@/assets/js/utils/data-dictionary'
import areaList from '@/assets/js/utils/area'
import { getOrderDetail } from '@/api/ebiz/sale/sale'
// import { getOrderDetail } from '@/api/ebiz/sale/sale'
import filter from '@/filters/index'
import getAreaName from '@/assets/js/utils/get-area-name'
// import getAreaName from '@/assets/js/utils/get-area-name'
import utilsAge from '@/assets/js/utils/age'
import IdentityCardScan from '@/components/ebiz/sale/IdentityCardScan'
import CustomerPicker from '@/components/ebiz/customer/CustomerPicker'
@@ -214,7 +214,11 @@ import idNoCheck from '@/assets/js/utils/idNoCheck'
import { idToData } from './js/verification'
import { selectComp } from './js/methods'
// let relationToInsured = [{ id: 2, text: '配偶' }, { id: 3, text: '父母' }, { id: 4, text: '子女' }, { id: 5, text: '其他' }]
let relationToInsured = [{ id: 2, text: '配偶' }, { id: 3, text: '父母' }, { id: 4, text: '子女' }]
let relationToInsured = [
{ id: 2, text: '配偶' },
{ id: 3, text: '父母' },
{ id: 4, text: '子女' }
]
export default {
name: 'insuredInfo',
@@ -408,7 +412,10 @@ export default {
} else if (pickerType == '3') {
this.columns = DataDictionary.degree
} else if (pickerType == '4') {
this.columns = [{ id: 0, text: '有' }, { id: 1, text: '无' }]
this.columns = [
{ id: 0, text: '有' },
{ id: 1, text: '无' }
]
} else if (pickerType == '5') {
this.columns = DataDictionary.taxIdentity
} else if (pickerType == '6') {
@@ -659,271 +666,271 @@ export default {
// 页面跳转
let valid = await this.$validator.validate()
// .then(valid => {
if (true === valid) {
// 受益人是被保险人的配偶
if (this.userInfo.relationToInsured == '2') {
// 受益人与投保人都是被保险人的配偶时
if (this.userInfo.relationToInsured == '2' && relationToAppnt == '2') {
if (this.userInfo.name != insuredDetail.name || this.userInfo.sex != insuredDetail.sex || this.userInfo.idNo != insuredDetail.idNo) {
return this.$toast('受益人数据不合法,请重新输入')
}
}
//与被保人关系是配偶
let insuredInfo = this.saleInsuredPersonInfo
//如果投保人不是已婚
if (insuredInfo.marriage != '1') {
return this.$toast('亲,受益人与被保险人关系为配偶,被保险人婚姻状况必须为已婚哦~')
}
//如果被保险人与投保人性别相同
if (insuredInfo.sex == this.userInfo.sex) {
return this.$toast('额,受益人与被保险人关系为配偶,性别不能相同哦~')
}
//如果性别男小于22岁 或者 性别女小于20岁
if ((this.userInfo.sex == '0' && age < 22) || (this.userInfo.sex == '1' && age < 20)) {
return this.$toast('年龄与婚姻状况不符')
if (true === valid) {
// 受益人是被保险人的配偶
if (this.userInfo.relationToInsured == '2') {
// 受益人与投保人都是被保险人的配偶时
if (this.userInfo.relationToInsured == '2' && relationToAppnt == '2') {
if (this.userInfo.name != insuredDetail.name || this.userInfo.sex != insuredDetail.sex || this.userInfo.idNo != insuredDetail.idNo) {
return this.$toast('受益人数据不合法,请重新输入')
}
}
//与被保人关系是配偶
let insuredInfo = JSON.parse(this.saleInsuredPersonInfo)
//如果投保人不是已婚
if (insuredInfo.marriage != '1') {
return this.$toast('亲,受益人与被保险人关系为配偶,被保险人婚姻状况必须为已婚哦~')
}
//如果被保险人与投保人性别相同
if (insuredInfo.sex == this.userInfo.sex) {
return this.$toast('额,受益人与被保险人关系为配偶,性别不能相同哦~')
}
// 受益人是被保险人的父母,被保险人是投保人的子女时
if (this.userInfo.relationToInsured == '3' && relationToAppnt == '4') {
if (this.userInfo.sex == insuredDetail.sex) {
if (this.userInfo.name != insuredDetail.name || this.userInfo.idNo != insuredDetail.idNo) {
return this.$toast('受益人数据不合法,请重新输入')
}
}
//如果性别男小于22岁 或者 性别女小于20岁
if ((this.userInfo.sex == '0' && age < 22) || (this.userInfo.sex == '1' && age < 20)) {
return this.$toast('年龄与婚姻状况不符')
}
let insuredInfo = JSON.parse(localStorage.saleInsuredPersonInfo)
// 受益人与被保险人关系为父母时,受益人年龄必须大于被保险人年龄
if (this.userInfo.relationToInsured == '3') {
if (age < insuredInfo.age) {
await this.$dialog.confirm({
title: '提示',
message: '亲,请确认受益人与被保险人关系哦',
confirmButtonText: '继续填写',
cancelButtonText: '返回修改'
})
}
}
// 受益人与被保险人关系为子女时,受益人年龄必须小于被保险人年龄
if (this.userInfo.relationToInsured == '4') {
if (age > insuredInfo.age) {
await this.$dialog.confirm({
title: '提示',
message: '亲,请确认受益人与被保险人关系哦',
confirmButtonText: '继续填写',
cancelButtonText: '返回修改'
})
}
}
//如果证件类型是身份证
if (this.userInfo.idType == '1') {
if (this.userInfo.nativeplace != '1') {
return this.$toast('证件类型”为“身份证,国籍必须为中国哦')
}
//校验性别是否与身份证号码位相符
if (this.userInfo.idNo.length == '15') {
//15位身份证第15位是性别位, 奇男偶女
let sexSign = this.userInfo.idNo.substr(14, 1)
if ((parseInt(sexSign) % 2 == 0 && this.userInfo.sex != 1) || (parseInt(sexSign) % 2 != 0 && this.userInfo.sex != 0)) {
return this.$toast('性别录入与身份证不符')
}
//15位身份证第7-12位是生日位, 年月日
let birthSign = this.userInfo.idNo.substr(6, 6)
if (
this.userInfo.birthday.substr(2, 2) != birthSign.substr(0, 2) ||
this.userInfo.birthday.substr(5, 2) != birthSign.substr(2, 2) ||
this.userInfo.birthday.substr(8, 2) != birthSign.substr(4, 2)
) {
return this.$toast('生日录入与身份证不符')
}
} else if (this.userInfo.idNo.length == '18') {
//18位身份证第17位是性别位, 奇男偶女
let sexSign = this.userInfo.idNo.substr(16, 1)
if ((parseInt(sexSign) % 2 == 0 && this.userInfo.sex != 1) || (parseInt(sexSign) % 2 != 0 && this.userInfo.sex != 0)) {
return this.$toast('性别录入与身份证不符')
}
//18位身份证第7-14位是生日位, 年月日
let birthSign = this.userInfo.idNo.substr(6, 8)
if (
this.userInfo.birthday.substr(0, 4) != birthSign.substr(0, 4) ||
this.userInfo.birthday.substr(5, 2) != birthSign.substr(4, 2) ||
this.userInfo.birthday.substr(8, 2) != birthSign.substr(6, 2)
) {
return this.$toast('生日录入与身份证不符')
}
}
// 证件号码规则校验
if (!idNoCheck.isIdno(this.userInfo.idNo)) {
console.log('证件号码校验有误')
return this.$toast('您填写的证件号码有误')
}
//年龄在0-15周岁之间
if (age <= 15) {
if (Date.parse(this.userInfo.certiexpiredate) - Date.parse(new Date()) > Date.parse('1975-01-01')) {
this.userInfo.certiexpiredate = ''
this.$refs.certiexpiredate.date = ''
// this.effectiveDateTypeAble = true
return this.$toast('证件有效期不正常未满16周岁的公民身份证有效期应小于等于5年')
}
//年龄在 16-25 周岁之间
} else if (age >= 16 && age <= 25) {
if (Date.parse(this.userInfo.certiexpiredate) - Date.parse(new Date()) > Date.parse('1980-01-01')) {
this.userInfo.certiexpiredate = ''
this.$refs.certiexpiredate.date = ''
// this.effectiveDateTypeAble = true
return this.$toast('证件有效期不正常16周岁至25周岁公民身份证有效期应小于等于10年')
}
//年龄在 26-45 周岁之间
} else if (age >= 26 && age <= 45) {
if (Date.parse(this.userInfo.certiexpiredate) - Date.parse(new Date()) > Date.parse('1990-01-01')) {
this.userInfo.certiexpiredate = ''
this.$refs.certiexpiredate.date = ''
// this.effectiveDateTypeAble = true
return this.$toast('证件有效期不正常26周岁至45周岁公民身份证有效期应小于等于20年')
}
}
//证件类型是户口本
} else if (this.userInfo.idType == '2') {
if (age > 16) {
return this.$toast('客户年龄在16周岁以上不能使用户口本作为有效证件')
}
// else if (this.userInfo.idNo.length != 18) {
// return this.$toast('户口本的证件号码长度应等于18位')
// }
//证件类型是出生证明
} else if (this.userInfo.idType == '3') {
if (age >= 2) {
return this.$toast('客户年龄在2周岁及以上不能使用出生证作为有效证件')
}
// else if (this.userInfo.idNo.length < 3) {
// return this.$toast('出生证须大于等于3个字符')
// }
//证件类型是护照
} else if (this.userInfo.idType == '4') {
if (this.userInfo.nativeplace == '1') {
return this.$toast('“证件类型”为“外国人护照”,“国籍”不能选择为“中国”哦~')
}
}
// else if (this.userInfo.idType == '4' && this.userInfo.idNo.length < 3) {
// return this.$toast('护照须大于等于3个字符')
// //证件是港澳居民通行证
// } else if (this.userInfo.idType == '5') {
// if (this.userInfo.idNo.length != 9) {
// return this.$toast('证件类型为港澳居民通行证的证件号码须为9位')
// } else if (!/^(H|M)[0-9]{8}$/.test(this.userInfo.idNo)) {
// return this.$toast('证件类型为港澳居民通行证的,证件号码首位字母为"H"/"M",证件号码第2位至第9位为阿拉伯数字')
// }
// //证件是台湾居民通行证
// } else if (this.userInfo.idType == '6' && this.userInfo.idNo.length != 8) {
// return this.$toast('证件类型为台湾居民通行证的证件号码须为8位数字')
// }
// 通过国籍判断 证件是否符合要求
// 如果是国籍选择中国大陆
if (this.userInfo.nativeplace == '1') {
// “身份证”或“台湾居民来往大陆通行证”或“港澳居民来往内地通行证”
let obj = {
'1': true,
'5': true,
'6': true
}
let idType = this.userInfo.idType
// 通过年龄 判断证件是否符合要求
// 小于2岁
if (age < 2) {
// “出生证”,"户口本"
obj['2'] = true
obj['3'] = true
if (obj[idType] === undefined) {
return this.$toast('亲国籍为中国且未满2周岁儿童证件类型必须“身份证”或“户口本”或“出生证”或“台湾居民来往大陆通行证”或“港澳居民来往内地通行证”')
}
} else if (age < 16) {
// 小于16岁
// “户口本”
obj['2'] = true
if (obj[idType] === undefined) {
return this.$toast(
'亲国籍为中国且大于2周岁小于16周岁的未成年人证件类型必须为“身份证”或“户口本”或“台湾居民来往大陆通行证”或“港澳居民来往内地通行证”'
)
}
} else {
// 大于16岁
if (obj[idType] === undefined) {
return this.$toast('亲,国籍为中国,证件类型必须为“身份证”或“台湾居民来往大陆通行证”或“港澳居民来往内地通行证”')
}
}
} else {
// 非大陆人员按外籍人员
let obj = {
'4': true,
'8': true
}
let idType = this.userInfo.idType
if (obj[idType] === undefined) {
return this.$toast('亲,国籍为外籍,证件类型必须为护照或外国人永久居留身份证投保')
}
}
let beneficiaries = []
if (localStorage.beneficiaryInfo) {
// 从 localStorage 取出数据
beneficiaries = JSON.parse(localStorage.beneficiaryInfo)
// 收益份额不超过 100%
let ratio = 0
beneficiaries.forEach(item => {
ratio += parseInt(item.bnfLot)
})
ratio += parseInt(this.userInfo.bnfLot)
console.log(ratio)
if (ratio > 100) {
return this.$toast('受益份额有误,请重新输入~')
}
if (this.userInfo.idNo != '') {
// 受益人不能重复添加 (证件号码为基准)
let isDbAdd = beneficiaries.some(item => {
return item.idNo == this.userInfo.idNo
})
console.log(isDbAdd)
if (isDbAdd) {
return this.$toast('受益人不支持重复添加')
}
}
} else {
if (this.userInfo.bnfLot > 100) {
return this.$toast('受益份额不能超过100~')
}
}
beneficiaries.push(this.userInfo)
// console.log(beneficiaries)
// 保存 新增的受益人信息 以及页面跳转字段
localStorage.beneficiaryInfo = JSON.stringify(beneficiaries)
localStorage.fromAddBeneficiaryInfo = true
if (this.userInfo.asAppntAddress == true) {
localStorage.applicant = '1'
}
this.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#/sale/beneficiary',
needRefresh: '1'
},
routerInfo: {
path: '/sale/beneficiary'
}
})
} else {
this.$toast(this.$validator.errors.all()[0])
}
// 受益人是被保险人的父母,被保险人是投保人的子女时
if (this.userInfo.relationToInsured == '3' && relationToAppnt == '4') {
if (this.userInfo.sex == insuredDetail.sex) {
if (this.userInfo.name != insuredDetail.name || this.userInfo.idNo != insuredDetail.idNo) {
return this.$toast('受益人数据不合法,请重新输入')
}
}
}
let insuredInfo = JSON.parse(localStorage.saleInsuredPersonInfo)
// 受益人与被保险人关系为父母时,受益人年龄必须大于被保险人年龄
if (this.userInfo.relationToInsured == '3') {
if (age < insuredInfo.age) {
await this.$dialog.confirm({
title: '提示',
message: '亲,请确认受益人与被保险人关系哦',
confirmButtonText: '继续填写',
cancelButtonText: '返回修改'
})
}
}
// 受益人与被保险人关系为子女时,受益人年龄必须小于被保险人年龄
if (this.userInfo.relationToInsured == '4') {
if (age > insuredInfo.age) {
await this.$dialog.confirm({
title: '提示',
message: '亲,请确认受益人与被保险人关系哦',
confirmButtonText: '继续填写',
cancelButtonText: '返回修改'
})
}
}
//如果证件类型是身份证
if (this.userInfo.idType == '1') {
if (this.userInfo.nativeplace != '1') {
return this.$toast('证件类型”为“身份证,国籍必须为中国哦')
}
//校验性别是否与身份证号码位相符
if (this.userInfo.idNo.length == '15') {
//15位身份证第15位是性别位, 奇男偶女
let sexSign = this.userInfo.idNo.substr(14, 1)
if ((parseInt(sexSign) % 2 == 0 && this.userInfo.sex != 1) || (parseInt(sexSign) % 2 != 0 && this.userInfo.sex != 0)) {
return this.$toast('性别录入与身份证不符')
}
//15位身份证第7-12位是生日位, 年月日
let birthSign = this.userInfo.idNo.substr(6, 6)
if (
this.userInfo.birthday.substr(2, 2) != birthSign.substr(0, 2) ||
this.userInfo.birthday.substr(5, 2) != birthSign.substr(2, 2) ||
this.userInfo.birthday.substr(8, 2) != birthSign.substr(4, 2)
) {
return this.$toast('生日录入与身份证不符')
}
} else if (this.userInfo.idNo.length == '18') {
//18位身份证第17位是性别位, 奇男偶女
let sexSign = this.userInfo.idNo.substr(16, 1)
if ((parseInt(sexSign) % 2 == 0 && this.userInfo.sex != 1) || (parseInt(sexSign) % 2 != 0 && this.userInfo.sex != 0)) {
return this.$toast('性别录入与身份证不符')
}
//18位身份证第7-14位是生日位, 年月日
let birthSign = this.userInfo.idNo.substr(6, 8)
if (
this.userInfo.birthday.substr(0, 4) != birthSign.substr(0, 4) ||
this.userInfo.birthday.substr(5, 2) != birthSign.substr(4, 2) ||
this.userInfo.birthday.substr(8, 2) != birthSign.substr(6, 2)
) {
return this.$toast('生日录入与身份证不符')
}
}
// 证件号码规则校验
if (!idNoCheck.isIdno(this.userInfo.idNo)) {
console.log('证件号码校验有误')
return this.$toast('您填写的证件号码有误')
}
//年龄在0-15周岁之间
if (age <= 15) {
if (Date.parse(this.userInfo.certiexpiredate) - Date.parse(new Date()) > Date.parse('1975-01-01')) {
this.userInfo.certiexpiredate = ''
this.$refs.certiexpiredate.date = ''
// this.effectiveDateTypeAble = true
return this.$toast('证件有效期不正常未满16周岁的公民身份证有效期应小于等于5年')
}
//年龄在 16-25 周岁之间
} else if (age >= 16 && age <= 25) {
if (Date.parse(this.userInfo.certiexpiredate) - Date.parse(new Date()) > Date.parse('1980-01-01')) {
this.userInfo.certiexpiredate = ''
this.$refs.certiexpiredate.date = ''
// this.effectiveDateTypeAble = true
return this.$toast('证件有效期不正常16周岁至25周岁公民身份证有效期应小于等于10年')
}
//年龄在 26-45 周岁之间
} else if (age >= 26 && age <= 45) {
if (Date.parse(this.userInfo.certiexpiredate) - Date.parse(new Date()) > Date.parse('1990-01-01')) {
this.userInfo.certiexpiredate = ''
this.$refs.certiexpiredate.date = ''
// this.effectiveDateTypeAble = true
return this.$toast('证件有效期不正常26周岁至45周岁公民身份证有效期应小于等于20年')
}
}
//证件类型是户口本
} else if (this.userInfo.idType == '2') {
if (age > 16) {
return this.$toast('客户年龄在16周岁以上不能使用户口本作为有效证件')
}
// else if (this.userInfo.idNo.length != 18) {
// return this.$toast('户口本的证件号码长度应等于18位')
// }
//证件类型是出生证明
} else if (this.userInfo.idType == '3') {
if (age >= 2) {
return this.$toast('客户年龄在2周岁及以上不能使用出生证作为有效证件')
}
// else if (this.userInfo.idNo.length < 3) {
// return this.$toast('出生证须大于等于3个字符')
// }
//证件类型是护照
} else if (this.userInfo.idType == '4') {
if (this.userInfo.nativeplace == '1') {
return this.$toast('“证件类型”为“外国人护照”,“国籍”不能选择为“中国”哦~')
}
}
// else if (this.userInfo.idType == '4' && this.userInfo.idNo.length < 3) {
// return this.$toast('护照须大于等于3个字符')
// //证件是港澳居民通行证
// } else if (this.userInfo.idType == '5') {
// if (this.userInfo.idNo.length != 9) {
// return this.$toast('证件类型为港澳居民通行证的证件号码须为9位')
// } else if (!/^(H|M)[0-9]{8}$/.test(this.userInfo.idNo)) {
// return this.$toast('证件类型为港澳居民通行证的,证件号码首位字母为"H"/"M",证件号码第2位至第9位为阿拉伯数字')
// }
// //证件是台湾居民通行证
// } else if (this.userInfo.idType == '6' && this.userInfo.idNo.length != 8) {
// return this.$toast('证件类型为台湾居民通行证的证件号码须为8位数字')
// }
// 通过国籍判断 证件是否符合要求
// 如果是国籍选择中国大陆
if (this.userInfo.nativeplace == '1') {
// “身份证”或“台湾居民来往大陆通行证”或“港澳居民来往内地通行证”
let obj = {
'1': true,
'5': true,
'6': true
}
let idType = this.userInfo.idType
// 通过年龄 判断证件是否符合要求
// 小于2岁
if (age < 2) {
// “出生证”,"户口本"
obj['2'] = true
obj['3'] = true
if (obj[idType] === undefined) {
return this.$toast(
'亲国籍为中国且未满2周岁儿童证件类型必须“身份证”或“户口本”或“出生证”或“台湾居民来往大陆通行证”或“港澳居民来往内地通行证”'
)
}
} else if (age < 16) {
// 小于16岁
// “户口本”
obj['2'] = true
if (obj[idType] === undefined) {
return this.$toast(
'亲国籍为中国且大于2周岁小于16周岁的未成年人证件类型必须为“身份证”或“户口本”或“台湾居民来往大陆通行证”或“港澳居民来往内地通行证”'
)
}
} else {
// 大于16岁
if (obj[idType] === undefined) {
return this.$toast('亲,国籍为中国,证件类型必须为“身份证”或“台湾居民来往大陆通行证”或“港澳居民来往内地通行证”')
}
}
} else {
// 非大陆人员按外籍人员
let obj = {
'4': true,
'8': true
}
let idType = this.userInfo.idType
if (obj[idType] === undefined) {
return this.$toast('亲,国籍为外籍,证件类型必须为护照或外国人永久居留身份证投保')
}
}
let beneficiaries = []
if (localStorage.beneficiaryInfo) {
// 从 localStorage 取出数据
beneficiaries = JSON.parse(localStorage.beneficiaryInfo)
// 收益份额不超过 100%
let ratio = 0
beneficiaries.forEach(item => {
ratio += parseInt(item.bnfLot)
})
ratio += parseInt(this.userInfo.bnfLot)
console.log(ratio)
if (ratio > 100) {
return this.$toast('受益份额有误,请重新输入~')
}
if (this.userInfo.idNo != '') {
// 受益人不能重复添加 (证件号码为基准)
let isDbAdd = beneficiaries.some(item => {
return item.idNo == this.userInfo.idNo
})
console.log(isDbAdd)
if (isDbAdd) {
return this.$toast('受益人不支持重复添加')
}
}
} else {
if (this.userInfo.bnfLot > 100) {
return this.$toast('受益份额不能超过100~')
}
}
beneficiaries.push(this.userInfo)
// console.log(beneficiaries)
// 保存 新增的受益人信息 以及页面跳转字段
localStorage.beneficiaryInfo = JSON.stringify(beneficiaries)
localStorage.fromAddBeneficiaryInfo = true
if (this.userInfo.asAppntAddress == true) {
localStorage.applicant = '1'
}
this.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#/sale/beneficiary',
needRefresh: '1'
},
routerInfo: {
path: '/sale/beneficiary'
}
})
} else {
this.$toast(this.$validator.errors.all()[0])
}
// })
},
// //区域选择