mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-07 01:56:44 +08:00
Compare commits
2 Commits
feature/FM
...
hotfix/【20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d3af0a1f0f | ||
|
|
a69d582732 |
@@ -1,167 +1,88 @@
|
||||
import utilsAge from '@/assets/js/utils/age'
|
||||
export default {
|
||||
//计算身份证起始日期
|
||||
getStartDate: function(age, endDate) {
|
||||
getStartDate: function(birthday, endDate) {
|
||||
let startDate = '' //证件起始日期
|
||||
let thisDate = new Date() //当年日期
|
||||
let thisyear = thisDate.getFullYear() //当前年份
|
||||
let startage = ''
|
||||
let endage = utilsAge.getAge(birthday, new Date(endDate))
|
||||
|
||||
if (age < 16) {
|
||||
/**
|
||||
* @Author: LiuXiaoFeng
|
||||
* @Description: 16周岁以下的证件有效期为5年
|
||||
* @Date: 2023/7/4
|
||||
**/
|
||||
startDate = String(Number(endDate.slice(0,4)) - 5) + endDate.slice(4,11)
|
||||
} else if (age >= 16 && age <= 21) {
|
||||
/**
|
||||
* @Author: LiuXiaoFeng
|
||||
* @Description: 16周岁~21周岁的证件有效期为10年或5年
|
||||
* @Date: 2023/7/4
|
||||
**/
|
||||
if (age - (10 - (endDate.slice(0,4) - thisyear)) < 16 ) {
|
||||
/**
|
||||
* @Author: LiuXiaoFeng
|
||||
* @Description: 如果证件有效期为10年 根据证件截止日期 判断10年前的年龄 如果小于16周岁 那么证件有效期就是5年
|
||||
* @Date: 2023/7/5
|
||||
**/
|
||||
startDate = String(Number(endDate.slice(0,4)) - 5) + endDate.slice(4,11)
|
||||
} else {
|
||||
startDate = String(Number(endDate.slice(0,4)) - 10) + endDate.slice(4,11)
|
||||
}
|
||||
} else if(age >= 22 && age <= 25) {
|
||||
/**
|
||||
* @Author: LiuXiaoFeng
|
||||
* @Description: 22周岁~25周岁的证件有效期为10年
|
||||
* @Date: 2023/7/4
|
||||
**/
|
||||
startDate = String(Number(endDate.slice(0,4)) - 10) + endDate.slice(4,11)
|
||||
} else if (age >= 26 && age <= 35) {
|
||||
/**
|
||||
* @Author: LiuXiaoFeng
|
||||
* @Description: 26周岁~35周岁的证件有效期为20年或10年
|
||||
* @Date: 2023/7/4
|
||||
**/
|
||||
if (age - (20 - (endDate.slice(0,4) - thisyear)) < 26 ) {
|
||||
/**
|
||||
* @Author: LiuXiaoFeng
|
||||
* @Description: 如果证件有效期为20年 根据证件截止日期 判断20年前的年龄 如果小于26周岁 那么证件有效期就是10年
|
||||
* @Date: 2023/7/5
|
||||
**/
|
||||
startDate = String(Number(endDate.slice(0,4)) - 10) + endDate.slice(4,11)
|
||||
} else {
|
||||
startDate = String(Number(endDate.slice(0,4)) - 20) + endDate.slice(4,11)
|
||||
}
|
||||
} else if (age >= 36 && age <= 45) {
|
||||
/**
|
||||
* @Author: LiuXiaoFeng
|
||||
* @Description: 36周岁~45周岁的证件有效期为20年
|
||||
* @Date: 2023/7/4
|
||||
**/
|
||||
startDate = String(Number(endDate.slice(0,4)) + 20) + endDate.slice(4,11)
|
||||
} else if (age >= 46 && age <= 65) {
|
||||
/**
|
||||
* @Author: LiuXiaoFeng
|
||||
* @Description: 46周岁~65周岁的证件有效期为20年或长期
|
||||
* @Date: 2023/7/4
|
||||
**/
|
||||
if (age - (20 - (endDate.slice(0,4) - thisyear)) < 46 ) {
|
||||
/**
|
||||
* @Author: LiuXiaoFeng
|
||||
* @Description: 如果证件有效期为20年 根据证件截止日期 判断20年前的年龄 如果小于46周岁 那么证件有效期就是20年
|
||||
* @Date: 2023/7/5
|
||||
**/
|
||||
startDate = String(Number(endDate.slice(0,4)) - 20) + endDate.slice(4,11)
|
||||
}
|
||||
} else if (age > 65) {
|
||||
/**
|
||||
* @Author: LiuXiaoFeng
|
||||
* @Description: 65周岁以上的证件有效期为长期
|
||||
* @Date: 2023/7/4
|
||||
**/
|
||||
/**
|
||||
* @Author: LiuXiaoFeng
|
||||
* @Description: 未满16周岁的公民申领的居民身份证有效期为5年
|
||||
* @Date: 2023/7/4
|
||||
**/
|
||||
if (endage - 5 < 16) {
|
||||
return startDate = String(Number(endDate.slice(0,4)) - 5) + endDate.slice(4,11)
|
||||
}
|
||||
/**
|
||||
* @Author: LiuXiaoFeng
|
||||
* @Description: 年满16周岁至25周岁的公民申领的居民身份证有效期为10年
|
||||
* @Date: 2023/7/4
|
||||
**/
|
||||
else if (endage - 5 >= 16 && endage - 10 <= 25) {
|
||||
startDate = String(Number(endDate.slice(0,4)) - 10) + endDate.slice(4,11)
|
||||
startage = utilsAge.getAge(birthday, new Date(startDate))
|
||||
if(startage >= 16 && startage <= 25){
|
||||
return startDate
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @Author: LiuXiaoFeng
|
||||
* @Description: 年满26周岁至45周岁的公民申领的居民身份证有效期为20年
|
||||
* @Date: 2023/7/4
|
||||
**/
|
||||
else if(endage - 10 >= 26 && endage - 20 <= 45) {
|
||||
startDate = String(Number(endDate.slice(0,4)) - 20) + endDate.slice(4,11)
|
||||
startage = utilsAge.getAge(birthday, new Date(startDate))
|
||||
if(startage >= 26 && startage <= 45){
|
||||
return startDate
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @Author: LiuXiaoFeng
|
||||
* @Description: 年满46周岁的公民申领居民身份证有效期为长期
|
||||
* @Date: 2023/7/4
|
||||
**/
|
||||
else if (endage - 20 >= 46) {
|
||||
return startDate
|
||||
}
|
||||
return startDate
|
||||
},
|
||||
|
||||
//计算身份证截止日期
|
||||
getEndDate: function(age, startDate) {
|
||||
getEndDate: function(birthday, startDate) {
|
||||
let endDate = '' //证件截止日期
|
||||
let thisDate = new Date() //当年日期
|
||||
let thisyear = thisDate.getFullYear() //当前年份
|
||||
|
||||
if (age < 16) {
|
||||
/**
|
||||
* @Author: LiuXiaoFeng
|
||||
* @Description: 16周岁以下的证件有效期为5年
|
||||
* @Date: 2023/7/4
|
||||
**/
|
||||
endDate = String(Number(startDate.slice(0,4)) + 5) + startDate.slice(4,11)
|
||||
} else if (age >= 16 && age <= 21) {
|
||||
/**
|
||||
* @Author: LiuXiaoFeng
|
||||
* @Description: 16周岁~21周岁的证件有效期为10年或5年
|
||||
* @Date: 2023/7/4
|
||||
**/
|
||||
if (age - (thisyear - startDate.slice(0,4)) < 16 ) {
|
||||
/**
|
||||
* @Author: LiuXiaoFeng
|
||||
* @Description: 根据证件起始日期计算办证时年龄 如果办证时年龄小于16周岁 那么证件有效期就是5年
|
||||
* @Date: 2023/7/5
|
||||
**/
|
||||
endDate = String(Number(startDate.slice(0,4)) + 5) + startDate.slice(4,11)
|
||||
} else {
|
||||
endDate = String(Number(startDate.slice(0,4)) + 10) + startDate.slice(4,11)
|
||||
}
|
||||
} else if(age >= 22 && age <= 25) {
|
||||
/**
|
||||
* @Author: LiuXiaoFeng
|
||||
* @Description: 22周岁~25周岁的证件有效期为10年
|
||||
* @Date: 2023/7/4
|
||||
**/
|
||||
endDate = String(Number(startDate.slice(0,4)) + 10) + startDate.slice(4,11)
|
||||
} else if (age >= 26 && age <= 35) {
|
||||
/**
|
||||
* @Author: LiuXiaoFeng
|
||||
* @Description: 26周岁~35周岁的证件有效期为20年或10年
|
||||
* @Date: 2023/7/4
|
||||
**/
|
||||
if (age - (thisyear - startDate.slice(0,4)) < 26 ) {
|
||||
/**
|
||||
* @Author: LiuXiaoFeng
|
||||
* @Description: 根据证件起始日期计算办证时年龄 如果办证时年龄小于26周岁 那么证件有效期就是10年
|
||||
* @Date: 2023/7/5
|
||||
**/
|
||||
endDate = String(Number(startDate.slice(0,4)) + 10) + startDate.slice(4,11)
|
||||
} else {
|
||||
endDate = String(Number(startDate.slice(0,4)) + 20) + startDate.slice(4,11)
|
||||
}
|
||||
} else if (age >= 36 && age <= 45) {
|
||||
/**
|
||||
* @Author: LiuXiaoFeng
|
||||
* @Description: 36周岁~45周岁的证件有效期为20年
|
||||
* @Date: 2023/7/4
|
||||
**/
|
||||
endDate = String(Number(startDate.slice(0,4)) + 20) + startDate.slice(4,11)
|
||||
} else if (age >= 46 && age <= 65) {
|
||||
/**
|
||||
* @Author: LiuXiaoFeng
|
||||
* @Description: 46周岁~65周岁的证件有效期为20年或长期
|
||||
* @Date: 2023/7/4
|
||||
**/
|
||||
if (age - (thisyear - startDate.slice(0,4)) < 46 ) {
|
||||
/**
|
||||
* @Author: LiuXiaoFeng
|
||||
* @Description: 根据证件起始日期计算办证时年龄 如果办证时年龄小于46周岁 那么证件有效期就是20年
|
||||
* @Date: 2023/7/5
|
||||
**/
|
||||
endDate = String(Number(startDate.slice(0,4)) + 20) + startDate.slice(4,11)
|
||||
}
|
||||
} else if (age > 65) {
|
||||
/**
|
||||
* @Author: LiuXiaoFeng
|
||||
* @Description: 65周岁以上的证件有效期为长期
|
||||
* @Date: 2023/7/4
|
||||
**/
|
||||
let startage = utilsAge.getAge(birthday, new Date(startDate))
|
||||
/**
|
||||
* @Author: LiuXiaoFeng
|
||||
* @Description: 未满16周岁的公民申领的居民身份证有效期为5年
|
||||
* @Date: 2023/7/4
|
||||
**/
|
||||
if (startage < 16) {
|
||||
return endDate = String(Number(startDate.slice(0, 4)) + 5) + startDate.slice(4, 11)
|
||||
}
|
||||
/**
|
||||
* @Author: LiuXiaoFeng
|
||||
* @Description: 年满16周岁至25周岁的公民申领的居民身份证有效期为10年
|
||||
* @Date: 2023/7/4
|
||||
**/
|
||||
else if (startage >= 16 && startage <= 25) {
|
||||
return endDate = String(Number(startDate.slice(0, 4)) + 10) + startDate.slice(4, 11)
|
||||
}
|
||||
/**
|
||||
* @Author: LiuXiaoFeng
|
||||
* @Description: 年满26周岁至45周岁的公民申领的居民身份证有效期为20年
|
||||
* @Date: 2023/7/4
|
||||
**/
|
||||
else if (startage >= 26 && startage <= 45) {
|
||||
return endDate = String(Number(startDate.slice(0, 4)) + 20) + startDate.slice(4, 11)
|
||||
}
|
||||
/**
|
||||
* @Author: LiuXiaoFeng
|
||||
* @Description: 年满46周岁的公民申领居民身份证有效期为长期
|
||||
* @Date: 2023/7/4
|
||||
**/
|
||||
else if (startage > 65) {
|
||||
return endDate
|
||||
}
|
||||
return endDate
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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(this.userInfo.birthday,val)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -876,9 +876,8 @@ 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(this.userInfo.birthday,val)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -902,10 +901,10 @@ export default {
|
||||
this.userInfo.workcompany = this.userInfo.workcompany || '无'
|
||||
}
|
||||
if (this.userInfo.certificateValidate && !this.userInfo.certiexpiredate) {
|
||||
this.userInfo.certiexpiredate = countCredentialValidity.getEndDate(age,this.userInfo.certificateValidate)
|
||||
this.userInfo.certiexpiredate = countCredentialValidity.getEndDate(this.userInfo.birthday,this.userInfo.certificateValidate)
|
||||
}
|
||||
if (this.userInfo.certiexpiredate && !this.userInfo.certificateValidate) {
|
||||
this.userInfo.certificateValidate = countCredentialValidity.getEndDate(age,this.userInfo.certiexpiredate)
|
||||
this.userInfo.certificateValidate = countCredentialValidity.getEndDate(this.userInfo.birthday,this.userInfo.certiexpiredate)
|
||||
}
|
||||
}
|
||||
break
|
||||
|
||||
@@ -1064,7 +1064,7 @@ export default {
|
||||
// 长期按钮是否禁用
|
||||
this.effectiveDateTypeAble = age <= 45
|
||||
if(this.userInfo.birthday){
|
||||
this.userInfo.certiexpiredate = countCredentialValidity.getEndDate(age,val)
|
||||
this.userInfo.certiexpiredate = countCredentialValidity.getEndDate(this.userInfo.birthday,val)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1093,7 +1093,7 @@ export default {
|
||||
let age = utilsAge.getAge(this.userInfo.birthday, new Date())
|
||||
console.log(age)
|
||||
if(this.userInfo.birthday){
|
||||
this.userInfo.certificateValidate = countCredentialValidity.getStartDate(age,val)
|
||||
this.userInfo.certificateValidate = countCredentialValidity.getStartDate(this.userInfo.birthday,val)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1124,10 +1124,10 @@ export default {
|
||||
}
|
||||
}
|
||||
if (this.userInfo.certificateValidate && !this.userInfo.certiexpiredate) {
|
||||
this.userInfo.certiexpiredate = countCredentialValidity.getEndDate(age,this.userInfo.certificateValidate)
|
||||
this.userInfo.certiexpiredate = countCredentialValidity.getEndDate(this.userInfo.birthday,this.userInfo.certificateValidate)
|
||||
}
|
||||
if (this.userInfo.certiexpiredate && !this.userInfo.certificateValidate) {
|
||||
this.userInfo.certificateValidate = countCredentialValidity.getEndDate(age,this.userInfo.certiexpiredate)
|
||||
this.userInfo.certificateValidate = countCredentialValidity.getEndDate(this.userInfo.birthday,this.userInfo.certiexpiredate)
|
||||
}
|
||||
}
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user