提交 e6155db5484e24a9683425e6855d13a6bc824d7f

作者 pangy
1 个父辈 e28000ee

出生年月不可编辑 靠身份证取

子女教育小于三岁不可申报
@@ -128,10 +128,11 @@ Page({ @@ -128,10 +128,11 @@ Page({
128 commonbirthDate: { 128 commonbirthDate: {
129 label: '出生日期', 129 label: '出生日期',
130 isrequre: true, 130 isrequre: true,
  131 + disabled:true,
131 bindtype: 'commonbirthday', 132 bindtype: 'commonbirthday',
132 selected: '', 133 selected: '',
133 isblack: 'true', 134 isblack: 'true',
134 - placeholder: '请选择出生日期', 135 + placeholder: '出生日期',
135 mode: "date", 136 mode: "date",
136 fields: "day", 137 fields: "day",
137 start: '1970-01-01', 138 start: '1970-01-01',
@@ -661,6 +662,10 @@ Page({ @@ -661,6 +662,10 @@ Page({
661 switch (this.data.cur_index + '') { 662 switch (this.data.cur_index + '') {
662 case 'children_education': 663 case 'children_education':
663 var setData = {} 664 var setData = {}
  665 + var commonbirthDate = this.data.commonbirthDate
  666 + commonbirthDate.selected = format.formatTime_date(data.birth_date)
  667 + commonbirthDate.datelong = data.birth_date
  668 + setData.commonbirthDate = commonbirthDate
664 if (data.id_card_no && data.id_card_no.length) { 669 if (data.id_card_no && data.id_card_no.length) {
665 setData.children_id_card_no = data.id_card_no 670 setData.children_id_card_no = data.id_card_no
666 this.dealIdInfo(data.id_card_no, 'children_id_card_no_input') 671 this.dealIdInfo(data.id_card_no, 'children_id_card_no_input')
@@ -668,12 +673,6 @@ Page({ @@ -668,12 +673,6 @@ Page({
668 if (data.name && data.name.length) { 673 if (data.name && data.name.length) {
669 setData.children_name = data.name 674 setData.children_name = data.name
670 } 675 }
671 - if (data.birth_date && data.birth_date > 0) {  
672 - var commonbirthDate = this.data.commonbirthDate  
673 - commonbirthDate.selected = format.formatTime_date(data.birth_date)  
674 - commonbirthDate.datelong = data.birth_date  
675 - setData.commonbirthDate = commonbirthDate  
676 - }  
677 if (data.percent && data.percent.length) { 676 if (data.percent && data.percent.length) {
678 var childrenpercentData = this.data.childrenpercentData 677 var childrenpercentData = this.data.childrenpercentData
679 childrenpercentData.selected = data.percent 678 childrenpercentData.selected = data.percent
@@ -790,6 +789,10 @@ Page({ @@ -790,6 +789,10 @@ Page({
790 break; 789 break;
791 case 'medical_fund': 790 case 'medical_fund':
792 var setData = {} 791 var setData = {}
  792 + var commonbirthDate = this.data.commonbirthDate
  793 + commonbirthDate.selected = format.formatTime_date(data.patient_birthday)
  794 + commonbirthDate.datelong = data.patient_birthday
  795 + setData.commonbirthDate = commonbirthDate
793 if (data.name && data.name.length) { 796 if (data.name && data.name.length) {
794 setData.name = data.name 797 setData.name = data.name
795 } 798 }
@@ -802,12 +805,6 @@ Page({ @@ -802,12 +805,6 @@ Page({
802 taxperson_relativeData.selected = data.family_ties 805 taxperson_relativeData.selected = data.family_ties
803 setData.taxperson_relativeData = taxperson_relativeData 806 setData.taxperson_relativeData = taxperson_relativeData
804 } 807 }
805 - if (data.patient_birthday && data.patient_birthday > 0) {  
806 - var commonbirthDate = this.data.commonbirthDate  
807 - commonbirthDate.selected = format.formatTime_date(data.patient_birthday)  
808 - commonbirthDate.datelong = data.birth_date  
809 - setData.commonbirthDate = commonbirthDate  
810 - }  
811 this.setData(setData) 808 this.setData(setData)
812 break; 809 break;
813 case "house_fund": 810 case "house_fund":
@@ -963,6 +960,9 @@ Page({ @@ -963,6 +960,9 @@ Page({
963 children_name: id_info.name, 960 children_name: id_info.name,
964 commonbirthDate: that.data.commonbirthDate 961 commonbirthDate: that.data.commonbirthDate
965 } 962 }
  963 + if (format.getAge(birth_day) < 3) {
  964 + this.showToast('子女年龄小于3岁,不可申报')
  965 + }
966 } else if (that.idcard_belong == 'spouse_id_card_no') { 966 } else if (that.idcard_belong == 'spouse_id_card_no') {
967 that.data.loverbirthDate.selected = birth_day 967 that.data.loverbirthDate.selected = birth_day
968 that.data.loverbirthDate.datelong = (Date.parse(new Date(birth_day)) / 1000) 968 that.data.loverbirthDate.datelong = (Date.parse(new Date(birth_day)) / 1000)
@@ -1056,14 +1056,18 @@ Page({ @@ -1056,14 +1056,18 @@ Page({
1056 this.showToast('身份证格式有误') 1056 this.showToast('身份证格式有误')
1057 return 1057 return
1058 } 1058 }
1059 - if (!formdata.children_name || formdata.children_name.length < 1) {  
1060 - this.showToast('请填写子女姓名') 1059 + if (format.getAge(this.data.commonbirthDate.selected) < 3) {
  1060 + this.showToast('子女年龄小于3岁,不可申报')
1061 return 1061 return
1062 } 1062 }
1063 - if (this.data.commonbirthDate.selected.length < 1) {  
1064 - this.showToast('请选择子女出生日期') 1063 + if (!formdata.children_name || formdata.children_name.length < 1) {
  1064 + this.showToast('请填写子女姓名')
1065 return 1065 return
1066 } 1066 }
  1067 + // if (this.data.commonbirthDate.selected.length < 1) {
  1068 + // this.showToast('请选择子女出生日期')
  1069 + // return
  1070 + // }
1067 if (this.data.childrenpercentData.selected.length < 1) { 1071 if (this.data.childrenpercentData.selected.length < 1) {
1068 this.showToast('请选择分配比例') 1072 this.showToast('请选择分配比例')
1069 return 1073 return
@@ -1563,7 +1567,9 @@ Page({ @@ -1563,7 +1567,9 @@ Page({
1563 data = { 1567 data = {
1564 commonbirthDate: this.data.commonbirthDate 1568 commonbirthDate: this.data.commonbirthDate
1565 } 1569 }
1566 - 1570 + if (info.age<3){
  1571 + this.showToast('子女年龄小于3岁,不可申报')
  1572 + }
1567 } else if (idcard_belong == 'spouse_id_card_no_input') { 1573 } else if (idcard_belong == 'spouse_id_card_no_input') {
1568 this.data.loverbirthDate.selected = info.birthDay 1574 this.data.loverbirthDate.selected = info.birthDay
1569 this.data.loverbirthDate.datelong = (Date.parse(new Date(info.birthDay)) / 1000) 1575 this.data.loverbirthDate.datelong = (Date.parse(new Date(info.birthDay)) / 1000)
@@ -150,6 +150,21 @@ function checkNumber(theObj) { @@ -150,6 +150,21 @@ function checkNumber(theObj) {
150 return false; 150 return false;
151 } 151 }
152 152
  153 +function getAge(birthdate) {
  154 + var yearBirth = birthdate.substring(0, 4);
  155 + var monthBirth = birthdate.substring(5, 7);
  156 + var dayBirth = birthdate.substring(8, 10);
  157 + //获取当前年月日并计算年龄
  158 + var myDate = new Date();
  159 + var monthNow = myDate.getMonth() + 1;
  160 + var dayNow = myDate.getDay();
  161 + var age = myDate.getFullYear() - yearBirth;
  162 + if (monthNow < monthBirth || (monthNow == monthBirth && dayNow < dayBirth)) {
  163 + age--;
  164 + }
  165 + return age;
  166 +}
  167 +
153 module.exports = { 168 module.exports = {
154 formatTime: formatTime, 169 formatTime: formatTime,
155 formatTime_date: formatTime_date, 170 formatTime_date: formatTime_date,
@@ -162,5 +177,6 @@ module.exports = { @@ -162,5 +177,6 @@ module.exports = {
162 curDateTime: curDateTime, 177 curDateTime: curDateTime,
163 analyzeIDCard: analyzeIDCard, 178 analyzeIDCard: analyzeIDCard,
164 checkNumber: checkNumber, 179 checkNumber: checkNumber,
165 - isMobile: isMobile 180 + isMobile: isMobile,
  181 + getAge: getAge
166 } 182 }
注册登录 后发表评论