正在显示
2 个修改的文件
包含
41 行增加
和
19 行删除
... | ... | @@ -128,10 +128,11 @@ Page({ |
128 | 128 | commonbirthDate: { |
129 | 129 | label: '出生日期', |
130 | 130 | isrequre: true, |
131 | + disabled:true, | |
131 | 132 | bindtype: 'commonbirthday', |
132 | 133 | selected: '', |
133 | 134 | isblack: 'true', |
134 | - placeholder: '请选择出生日期', | |
135 | + placeholder: '出生日期', | |
135 | 136 | mode: "date", |
136 | 137 | fields: "day", |
137 | 138 | start: '1970-01-01', |
... | ... | @@ -661,6 +662,10 @@ Page({ |
661 | 662 | switch (this.data.cur_index + '') { |
662 | 663 | case 'children_education': |
663 | 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 | 669 | if (data.id_card_no && data.id_card_no.length) { |
665 | 670 | setData.children_id_card_no = data.id_card_no |
666 | 671 | this.dealIdInfo(data.id_card_no, 'children_id_card_no_input') |
... | ... | @@ -668,12 +673,6 @@ Page({ |
668 | 673 | if (data.name && data.name.length) { |
669 | 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 | 676 | if (data.percent && data.percent.length) { |
678 | 677 | var childrenpercentData = this.data.childrenpercentData |
679 | 678 | childrenpercentData.selected = data.percent |
... | ... | @@ -790,6 +789,10 @@ Page({ |
790 | 789 | break; |
791 | 790 | case 'medical_fund': |
792 | 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 | 796 | if (data.name && data.name.length) { |
794 | 797 | setData.name = data.name |
795 | 798 | } |
... | ... | @@ -802,12 +805,6 @@ Page({ |
802 | 805 | taxperson_relativeData.selected = data.family_ties |
803 | 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 | 808 | this.setData(setData) |
812 | 809 | break; |
813 | 810 | case "house_fund": |
... | ... | @@ -963,6 +960,9 @@ Page({ |
963 | 960 | children_name: id_info.name, |
964 | 961 | commonbirthDate: that.data.commonbirthDate |
965 | 962 | } |
963 | + if (format.getAge(birth_day) < 3) { | |
964 | + this.showToast('子女年龄小于3岁,不可申报') | |
965 | + } | |
966 | 966 | } else if (that.idcard_belong == 'spouse_id_card_no') { |
967 | 967 | that.data.loverbirthDate.selected = birth_day |
968 | 968 | that.data.loverbirthDate.datelong = (Date.parse(new Date(birth_day)) / 1000) |
... | ... | @@ -1056,14 +1056,18 @@ Page({ |
1056 | 1056 | this.showToast('身份证格式有误') |
1057 | 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 | 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 | 1065 | return |
1066 | 1066 | } |
1067 | + // if (this.data.commonbirthDate.selected.length < 1) { | |
1068 | + // this.showToast('请选择子女出生日期') | |
1069 | + // return | |
1070 | + // } | |
1067 | 1071 | if (this.data.childrenpercentData.selected.length < 1) { |
1068 | 1072 | this.showToast('请选择分配比例') |
1069 | 1073 | return |
... | ... | @@ -1563,7 +1567,9 @@ Page({ |
1563 | 1567 | data = { |
1564 | 1568 | commonbirthDate: this.data.commonbirthDate |
1565 | 1569 | } |
1566 | - | |
1570 | + if (info.age<3){ | |
1571 | + this.showToast('子女年龄小于3岁,不可申报') | |
1572 | + } | |
1567 | 1573 | } else if (idcard_belong == 'spouse_id_card_no_input') { |
1568 | 1574 | this.data.loverbirthDate.selected = info.birthDay |
1569 | 1575 | this.data.loverbirthDate.datelong = (Date.parse(new Date(info.birthDay)) / 1000) | ... | ... |
... | ... | @@ -150,6 +150,21 @@ function checkNumber(theObj) { |
150 | 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 | 168 | module.exports = { |
154 | 169 | formatTime: formatTime, |
155 | 170 | formatTime_date: formatTime_date, |
... | ... | @@ -162,5 +177,6 @@ module.exports = { |
162 | 177 | curDateTime: curDateTime, |
163 | 178 | analyzeIDCard: analyzeIDCard, |
164 | 179 | checkNumber: checkNumber, |
165 | - isMobile: isMobile | |
180 | + isMobile: isMobile, | |
181 | + getAge: getAge | |
166 | 182 | } | ... | ... |
请
注册
或
登录
后发表评论