master
271556543@qq.com 3 years ago
parent e661e66975
commit b82af7d62d

@ -115,3 +115,33 @@ export function param2Obj(url) {
})
return obj
}
export function getAgeByIdcard(identityCard){
let len = (identityCard + "").length;
if (len == 0) {
return 0;
} else {
if ((len != 15) && (len != 18))//身份证号码只能为15位或18位其它不合法
{
return 0;
}
}
let strBirthday = "";
if (len == 18)//处理18位的身份证号码从号码中得到生日和性别代码
{
strBirthday = identityCard.substr(6, 4) + "/" + identityCard.substr(10, 2) + "/" + identityCard.substr(12, 2);
}
if (len == 15) {
strBirthday = "19" + identityCard.substr(6, 2) + "/" + identityCard.substr(8, 2) + "/" + identityCard.substr(10, 2);
}
//时间字符串里,必须是“/”
let birthDate = new Date(strBirthday);
let nowDateTime = new Date();
let age = nowDateTime.getFullYear() - birthDate.getFullYear();
//再考虑月、天的因素;.getMonth()获取的是从0开始的这里进行比较不需要加1
if (nowDateTime.getMonth() < birthDate.getMonth() || (nowDateTime.getMonth() == birthDate.getMonth() && nowDateTime.getDate() < birthDate.getDate())) {
age--;
}
return age;
}

@ -155,7 +155,7 @@
<template v-slot:birthday>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>生日
生日
</div>
<div class="xy-table-item-content">
<el-date-picker v-model="form.birthday" placeholder="请选择生日" style="width: 300px;"
@ -514,9 +514,6 @@ export default {
sex: [
{required: true, message: '请选择性别'},
],
birthday: [
{required: true, message: '请选择生日'},
],
level_id: [
{required: true, message: '请选择失能等级'},
]
@ -841,6 +838,7 @@ export default {
this.type = ''
this.map = []
this.flag = 1
this.pickedProduct = {}
this.init()
}
},

@ -370,9 +370,10 @@ export default {
if (val) {
this.getProducts()
} else {
this.pickedProduct = {}
this.products = []
this.$refs['dialog'].reset()
this.initForm()
//this.initForm()
}
}
},

@ -243,7 +243,7 @@ export default {
},
async getCustomers() {
const res = await getList(this.select,false)
const res = await getList(this.select)
this.list = res.data.data
this.total = res.data.total
},
@ -261,11 +261,11 @@ export default {
async getCity(){
let city = await getparameter({number: 'city'},false)
for(let i = 0;i < city.detail.length;i ++){
let area = await getparameter({number : city.detail[i].remark},false)
let area = await getparameter({pid : city.detail[i].id},false)
city.detail[i].children = area.detail
for(let j = 0;j < area.detail.length;j++){
let street = await getparameter({number : area.detail[j].remark},false)
let street = await getparameter({pid : area.detail[j].id},false)
area.detail[j].children = street.detail
}
}

@ -113,7 +113,7 @@
<script>
import moment from 'moment'
import {parseTime} from '@/utils'
import {parseTime,getAgeByIdcard} from '@/utils'
import {customerDetail} from '@/api/schedule'
import timeSelect from "@/views/schedule/component/timeSelect";
@ -198,7 +198,8 @@ export default {
},
computed: {
ageComputed() {
return moment().diff(moment(this.detail.customer.birthday).format(),'year')
return getAgeByIdcard(this.detail.customer.idcard)
//return moment().diff(moment(this.detail.customer.birthday).format(),'year')
},
defaultAddress(){
return function (adds){

@ -164,7 +164,7 @@ export default {
this.select.product_type_id = res.data[0].id
},
async getAreas(){
const res = await getparameter({number:'changzhou'})
const res = await getparameter({number:'serveArea'})
this.areas = res.detail
this.select.area_id = res.detail[0].id
}

Loading…
Cancel
Save