From f8e18cc4b676c8b6636b931cb586b9c5220418d4 Mon Sep 17 00:00:00 2001 From: "liu.xiaofeng@ebiz-digits.com" Date: Wed, 5 Jul 2023 14:47:01 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=B5=E5=AD=90=E6=8A=95=E4=BF=9D=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E8=A2=AB=E4=BF=9D=E4=BA=BA=E4=BB=A5=E5=8F=8A=E5=8F=97?= =?UTF-8?q?=E7=9B=8A=E4=BA=BA=E8=AF=81=E4=BB=B6=E6=9C=89=E6=95=88=E6=9C=9F?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E8=A7=84=E5=88=99=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ebiz/sale/AddBeneficiaryInfo.vue | 93 ++++----------- src/views/ebiz/sale/InsuredInfo.vue | 10 +- src/views/ebiz/sale/InsuredPerson.vue | 128 ++++----------------- 3 files changed, 53 insertions(+), 178 deletions(-) diff --git a/src/views/ebiz/sale/AddBeneficiaryInfo.vue b/src/views/ebiz/sale/AddBeneficiaryInfo.vue index 6754ab461..1e1e2ef0f 100644 --- a/src/views/ebiz/sale/AddBeneficiaryInfo.vue +++ b/src/views/ebiz/sale/AddBeneficiaryInfo.vue @@ -241,6 +241,7 @@ 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/areaForSale' +import countCredentialValidity from '@/assets/js/utils/countCredentialValidity' import filter from '@/filters/index' import utilsAge from '@/assets/js/utils/age' import IdentityCardScan from '@/components/ebiz/sale/IdentityCardScan' @@ -640,6 +641,9 @@ export default { if (this.userInfo.idType == '1') { let age = utilsAge.getAge(this.userInfo.birthday, new Date()) this.effectiveDateTypeAble = age <= 45 + if(this.userInfo.birthday){ + this.userInfo.certiexpiredate = countCredentialValidity.getEndDate(age,val) + } } } break @@ -664,63 +668,9 @@ export default { if (this.userInfo.idType == '1') { //获取年龄 let age = utilsAge.getAge(this.userInfo.birthday, new Date()) - console.log(age) - //年龄在16周岁以下 - if (age < 16) { - if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 5) { - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' - return this.$toast('16周岁以下的证件有效期为5年') - } - //年龄在16-21周岁之间 - }else if (age >= 16 && age <= 21) { - if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 10 && new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 5) { - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' - return this.$toast('16周岁~21周岁的证件有效期为10年或5年') - } - //年龄在22-25周岁之间 - }else if (age >= 22 && age <= 25) { - if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 10) { - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' - return this.$toast('22周岁~25周岁的证件有效期为10年') - } - //年龄在26-35周岁之间 - }else if (age >= 26 && age <= 35) { - if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 20 && new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 10) { - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' - return this.$toast('26周岁~35周岁的证件有效期为20年或10年') - } - //年龄在36-45周岁之间 - } else if (age >= 36 && age <= 45) { - if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 20) { - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' - return this.$toast('36周岁~45周岁的证件有效期为20年') - } - //年龄在46-65周岁之间 - } else if (age >= 46 && age <= 65) { - if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 20 || this.effectiveDateType == false) { - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' - return this.$toast('46周岁~65周岁的证件有效期为20年或长期') - } - //年龄在65周岁以上 - } else if (age > 65) { - if (this.userInfo.effectiveDateType == false) { - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' - return this.$toast('65周岁以上的证件有效期为长期') - } - } - //此外的年龄段不支持 - // else { - // this.userInfo.certiexpiredate = '' - // this.$refs.certiexpiredate.date = '' - // return this.$toast('身份证不支持此年龄段') - // } + if(this.userInfo.birthday){ + this.userInfo.certificateValidate = countCredentialValidity.getStartDate(age,val) + } } } break @@ -746,6 +696,13 @@ export default { return this.$toast('出生证有效期或出生日期有误') } } + let age = utilsAge.getAge(this.userInfo.birthday, new Date()) + if (this.userInfo.certificateValidate && !this.userInfo.certiexpiredate) { + this.userInfo.certiexpiredate = countCredentialValidity.getEndDate(age,this.userInfo.certificateValidate) + } + if (this.userInfo.certiexpiredate && !this.userInfo.certificateValidate) { + this.userInfo.certificateValidate = countCredentialValidity.getEndDate(age,this.userInfo.certiexpiredate) + } } break } @@ -966,50 +923,36 @@ export default { //年龄在16周岁以下 if (age < 16) { if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 5) { - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' return this.$toast('16周岁以下的证件有效期为5年') } //年龄在16-21周岁之间 }else if (age >= 16 && age <= 21) { if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 10 && new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 5) { - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' return this.$toast('16周岁~21周岁的证件有效期为10年或5年') } //年龄在22-25周岁之间 }else if (age >= 22 && age <= 25) { if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 10) { - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' return this.$toast('22周岁~25周岁的证件有效期为10年') } //年龄在26-35周岁之间 }else if (age >= 26 && age <= 35) { if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 20 && new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 10) { - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' return this.$toast('26周岁~35周岁的证件有效期为20年或10年') } //年龄在36-45周岁之间 } else if (age >= 36 && age <= 45) { if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 20) { - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' return this.$toast('36周岁~45周岁的证件有效期为20年') } //年龄在46-65周岁之间 } else if (age >= 46 && age <= 65) { if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 20 && this.userInfo.effectiveDateType == false) { - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' return this.$toast('46周岁~65周岁的证件有效期为20年或长期') } //年龄在65周岁以上 } else if (age > 65) { if (this.userInfo.effectiveDateType == false) { - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' return this.$toast('65周岁以上的证件有效期为长期') } } @@ -1347,6 +1290,14 @@ export default { } this.effectiveDateTypeAble = false } + //如果选择户口本 + if (this.userInfo.idType == '2') { + let exipreDate = Date.parse(this.userInfo.birthday) + Date.parse('1985-12-31') + this.userInfo.certificateValidate = this.userInfo.birthday + this.userInfo.certiexpiredate = this.timeStampFormat(exipreDate) + this.idLimit = true + //如果选择出生证明 + } } }, filters: { diff --git a/src/views/ebiz/sale/InsuredInfo.vue b/src/views/ebiz/sale/InsuredInfo.vue index c6e3317d6..bd383aa62 100644 --- a/src/views/ebiz/sale/InsuredInfo.vue +++ b/src/views/ebiz/sale/InsuredInfo.vue @@ -860,7 +860,7 @@ export default { // 长期按钮是否禁用 this.effectiveDateTypeAble = age <= 45 if(this.userInfo.birthday){ - // this.userInfo.certiexpiredate = countCredentialValidity.getEndDate(age,val) + this.userInfo.certiexpiredate = countCredentialValidity.getEndDate(age,val) } } } @@ -878,7 +878,7 @@ export default { if (this.userInfo.idType == '1') { let age = utilsAge.getAge(this.userInfo.birthday, new Date()) if(this.userInfo.birthday){ - // this.userInfo.certificateValidate = countCredentialValidity.getStartDate(age,val) + this.userInfo.certificateValidate = countCredentialValidity.getStartDate(age,val) } } } @@ -901,6 +901,12 @@ export default { if (age < 18) { this.userInfo.workcompany = this.userInfo.workcompany || '无' } + if (this.userInfo.certificateValidate && !this.userInfo.certiexpiredate) { + this.userInfo.certiexpiredate = countCredentialValidity.getEndDate(age,this.userInfo.certificateValidate) + } + if (this.userInfo.certiexpiredate && !this.userInfo.certificateValidate) { + this.userInfo.certificateValidate = countCredentialValidity.getEndDate(age,this.userInfo.certiexpiredate) + } } break } diff --git a/src/views/ebiz/sale/InsuredPerson.vue b/src/views/ebiz/sale/InsuredPerson.vue index 02adefe73..e498daac2 100644 --- a/src/views/ebiz/sale/InsuredPerson.vue +++ b/src/views/ebiz/sale/InsuredPerson.vue @@ -452,6 +452,7 @@ import CustomerPicker from '@/components/ebiz/customer/CustomerPicker' import DataDictionary from '@/assets/js/utils/data-dictionary' import areaList from '@/assets/js/utils/areaForSale' import areaLists from '@/assets/js/utils/areaNewForSale' +import countCredentialValidity from '@/assets/js/utils/countCredentialValidity' import { saveOrUpdateOrderInfo, getAuthCode, getOrderDetail } from '@/api/ebiz/sale/sale' import utilsAge from '@/assets/js/utils/age' import getAreaName from '@/assets/js/utils/getAreaNameForSale' @@ -1062,6 +1063,9 @@ export default { let age = utilsAge.getAge(this.userInfo.birthday, new Date()) // 长期按钮是否禁用 this.effectiveDateTypeAble = age <= 45 + if(this.userInfo.birthday){ + this.userInfo.certiexpiredate = countCredentialValidity.getEndDate(age,val) + } } } break @@ -1088,62 +1092,9 @@ export default { //获取年龄 let age = utilsAge.getAge(this.userInfo.birthday, new Date()) console.log(age) - //年龄在16周岁以下 - if (age < 16) { - if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 5) { - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' - return this.$toast('16周岁以下的证件有效期为5年') - } - //年龄在16-21周岁之间 - }else if (age >= 16 && age <= 21) { - if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 10 && new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 5) { - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' - return this.$toast('16周岁~21周岁的证件有效期为10年或5年') - } - //年龄在22-25周岁之间 - }else if (age >= 22 && age <= 25) { - if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 10) { - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' - return this.$toast('22周岁~25周岁的证件有效期为10年') - } - //年龄在26-35周岁之间 - }else if (age >= 26 && age <= 35) { - if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 20 && new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 10) { - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' - return this.$toast('26周岁~35周岁的证件有效期为20年或10年') - } - //年龄在36-45周岁之间 - } else if (age >= 36 && age <= 45) { - if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 20) { - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' - return this.$toast('36周岁~45周岁的证件有效期为20年') - } - //年龄在46-65周岁之间 - } else if (age >= 46 && age <= 65) { - if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 20 && this.userInfo.effectiveDateType == false) { - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' - return this.$toast('46周岁~65周岁的证件有效期为20年或长期') - } - //年龄在65周岁以上 - } else if (age > 65) { - if (this.userInfo.effectiveDateType == false) { - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' - return this.$toast('65周岁以上的证件有效期为长期') - } - } - //此外的年龄段不支持 - // else { - // this.userInfo.certiexpiredate = '' - // this.$refs.certiexpiredate.date = '' - // return this.$toast('身份证不支持此年龄段') - // } + if(this.userInfo.birthday){ + this.userInfo.certificateValidate = countCredentialValidity.getStartDate(age,val) + } } } break @@ -1170,24 +1121,14 @@ export default { this.userInfo.otherSalarySource = '无' this.userInfo.averageAnnualIncome = '0' this.userInfo.liabilitiesMoney = '0' - // this.userInfo.jobStatus = '3' - // this.userInfo.marriage = '2' - } else { - // this.userInfo.salarySource = '' - // this.userInfo.averageAnnualIncome = '' - // this.userInfo.liabilitiesMoney = '' - // this.userInfo.jobStatus = '' - // this.userInfo.marriage = '' } } - //出生证有效期 - // if (this.userInfo.idType == '3') { - // if (Date.parse(this.userInfo.certiexpiredate) - Date.parse(val) > Date.parse('1973-01-01')) { - // this.userInfo.birthday = '' - // this.$refs.birthday.date = '' - // return this.$toast('出生证有效期或出生日期有误') - // } - // } + if (this.userInfo.certificateValidate && !this.userInfo.certiexpiredate) { + this.userInfo.certiexpiredate = countCredentialValidity.getEndDate(age,this.userInfo.certificateValidate) + } + if (this.userInfo.certiexpiredate && !this.userInfo.certificateValidate) { + this.userInfo.certificateValidate = countCredentialValidity.getEndDate(age,this.userInfo.certiexpiredate) + } } break } @@ -1477,53 +1418,39 @@ export default { //年龄在16周岁以下 if (age < 16) { if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 5) { - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' return this.$toast('16周岁以下的证件有效期为5年') } //年龄在16-21周岁之间 }else if (age >= 16 && age <= 21) { if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 10 && new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 5) { - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' return this.$toast('16周岁~21周岁的证件有效期为10年或5年') } //年龄在22-25周岁之间 }else if (age >= 22 && age <= 25) { if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 10) { - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' return this.$toast('22周岁~25周岁的证件有效期为10年') } //年龄在26-35周岁之间 }else if (age >= 26 && age <= 35) { if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 20 && new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 10) { - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' return this.$toast('26周岁~35周岁的证件有效期为20年或10年') } //年龄在36-45周岁之间 } else if (age >= 36 && age <= 45) { if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 20) { - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' return this.$toast('36周岁~45周岁的证件有效期为20年') } //年龄在46-65周岁之间 } else if (age >= 46 && age <= 65) { if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 20 && this.userInfo.effectiveDateType == false) { - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' return this.$toast('46周岁~65周岁的证件有效期为20年或长期') } //年龄在65周岁以上 } else if (age > 65) { - if (this.userInfo.effectiveDateType == false) { - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' + if (this.userInfo.effectiveDateType == false) { return this.$toast('65周岁以上的证件有效期为长期') } - } + } //年龄在0-15周岁之间 // if (age <= 15) { // if (Date.parse(this.userInfo.certiexpiredate) - Date.parse(new Date()) > Date.parse('1975-01-01')) { @@ -2008,36 +1935,27 @@ export default { this.userInfo.otherSalarySource = '无' this.userInfo.averageAnnualIncome = '0' this.userInfo.liabilitiesMoney = '0' - // this.userInfo.jobStatus = '3' - // this.userInfo.marriage = '2' } else { this.userInfo.salarySource = '' this.userInfo.averageAnnualIncome = '' this.userInfo.liabilitiesMoney = '' - // this.userInfo.jobStatus = '' - // this.userInfo.marriage = '' } } if (idToData(val).age > 45) { - // this.idLimit = true - // this.isRequired = false if (from) { this.userInfo.effectiveDateType = true } this.effectiveDateTypeAble = false - } else { - // this.idLimit = false - // this.isRequired = true - // this.userInfo.effectiveDateType = false } //如果选择户口本 - // if (this.userInfo.idType == '2') { - // let exipreDate = Date.parse(this.userInfo.birthday) + Date.parse('1985-12-31') - // this.userInfo.certificateValidate = this.userInfo.birthday - // this.userInfo.certiexpiredate = this.timeStampFormat(exipreDate) - // this.idLimit = true - // //如果选择出生证明 - // } else if (this.userInfo.idType == '3') { + if (this.userInfo.idType == '2') { + let exipreDate = Date.parse(this.userInfo.birthday) + Date.parse('1985-12-31') + this.userInfo.certificateValidate = this.userInfo.birthday + this.userInfo.certiexpiredate = this.timeStampFormat(exipreDate) + this.idLimit = true + //如果选择出生证明 + } + // else if (this.userInfo.idType == '3') { // let exipreDate = Date.parse(this.userInfo.birthday) + Date.parse('1972-12-31') // this.userInfo.certificateValidate = this.userInfo.birthday // this.userInfo.certiexpiredate = this.timeStampFormat(exipreDate)