提交 4e7a15431af6a99a8a30e08f4317c0e0d7f9391d

作者 pangy
1 个父辈 7dafaf4a

家庭成员 非居民逻辑 + 出生日期

... ... @@ -2,8 +2,8 @@
2 2 var app = getApp();
3 3 var format = require('../../../../utils/util.js');
4 4 var baseUrl = app.globalData.baseUrl;
5   -const cardTypeArray8 = ['居民身份证', '中国护照', '港澳居民居住证', '台湾居民居住证', '外国人永久居留身份证', '外国人工作许可证(A类)', '外国人工作许可证(B类)', '外国人工作许可证(C类)'];
6   -
  5 +// const cardTypeArray8 = ['居民身份证', '中国护照', '港澳居民居住证', '台湾居民居住证', '外国人永久居留身份证', '外国人工作许可证(A类)', '外国人工作许可证(B类)', '外国人工作许可证(C类)'];
  6 +const cardTypeArray = ['居民身份证', '中国护照', '港澳居民来往内地通行证', '港澳居民居住证', '台湾居民来往大陆通行证', '台湾居民居住证', '外国护照', '外国人永久居留身份证', '外国人工作许可证(A类)', '外国人工作许可证(B类)', '外国人工作许可证(C类)'];
7 7 Page({
8 8 cur_id:null,
9 9 /**
... ... @@ -41,7 +41,7 @@ Page({
41 41 label: '证照类型',
42 42 bindtype: 'cardtype',
43 43 placeholder: '请选择证照类型',
44   - values: cardTypeArray8,
  44 + values: cardTypeArray,
45 45 // values: ["居民身份证", "军官证", '士兵证', '武警警官证', '港澳居民来往内地通行证', '外交官证', '中国护照','外国护照', '香港永久性居民身份证', '澳门特别行政区永久性居民身份证', '台湾身份证', '台湾居民来往大陆通行证', '外国人永久居留证'],
46 46 // range_key: 'name',
47 47 onChange: 'onPickerSelect'
... ... @@ -76,6 +76,17 @@ Page({
76 76 placeholder: '请选择国籍',
77 77 onChange: 'onPickerSelect',
78 78 },
  79 + birthDate: {
  80 + label: '出生日期',
  81 + isrequre: true,
  82 + bindtype: 'birthday',
  83 + placeholder: '出生日期',
  84 + selected: '',
  85 + mode: "date",
  86 + fields: "day",
  87 + end: format.curDateTime(),
  88 + onChange: 'birthdayChange',
  89 + },
79 90 },
80 91
81 92 /**
... ... @@ -118,7 +129,7 @@ Page({
118 129 countrys.splice(countrys.indexOf('澳门'), 1);
119 130 }
120 131 that.countrys = countrys
121   - if (that.data.cardtypeData.selected && that.data.cardtypeData.selected.indexOf("外国") != -1) {
  132 + if (that.data.cardtypeData.selected && that.data.cardtypeData.selected.indexOf("外国") != -1) {
122 133 that.data.countryData.values = countrys
123 134 that.setData({
124 135 countryData: that.data.countryData,
... ... @@ -174,14 +185,24 @@ Page({
174 185 this.data.relativeData.selected = tax_info.family_ties
175 186 this.data.genderData.selected = tax_info.gender
176 187 this.data.countryData.selected = tax_info.native
177   - // this.data.genderData.disabled = isDisable
  188 + if (isDisable){//否的话受证照类型控制
  189 + this.data.birthDate.disabled = true
  190 + this.data.genderData.disabled = true
  191 + }
178 192 this.data.forignerInfo.selected = tax_info.is_overseas_personnel
  193 + if (tax_info.birth_date == -62135596800 || tax_info.birth_date == 0) {
  194 + this.data.birthDate.selected = ''
  195 + } else {
  196 + this.data.birthDate.selected = tax_info.birth_date_str //format.formatTime_date(tax_info.birth_date)
  197 + }
179 198 this.setData({
180 199 isDisable: isDisable,
181 200 relativeData: this.data.relativeData,
182 201 name: tax_info.name,
183 202 cardtypeData: this.data.cardtypeData,
184   - age: tax_info.age,
  203 + // age: tax_info.age,
  204 + long_birth_date: tax_info.birth_date,
  205 + birthDate: this.data.birthDate,
185 206 mobile: tax_info.mobile,
186 207 genderData: this.data.genderData,
187 208 isIdCard: '居民身份证' == tax_info.id_card_type ? true : false,
... ... @@ -227,7 +248,7 @@ Page({
227 248 var gender_Data = that.data.genderData
228 249 gender_Data.selected = id_info.gender
229 250
230   - // that.data.birthDate.selected = birth_day
  251 + that.data.birthDate.selected = birth_day
231 252
232 253 // if (that.data.name.length > 0 && id_info.name != that.data.name) {
233 254 // that.showtoast("姓名冲突")
... ... @@ -240,11 +261,11 @@ Page({
240 261 that.setData({
241 262 idInfoData: id_info,
242 263 name: id_info.name,
243   - // birthday: birth_day,
  264 + birthday: birth_day,
244 265 cardtypeData: cardtype_Data,
245 266 genderData: gender_Data,
246   - // long_birth_date: Date.parse(new Date(birth_day)) / 1000,
247   - // birthDate: that.data.birthDate,
  267 + long_birth_date: Date.parse(new Date(birth_day)) / 1000,
  268 + birthDate: that.data.birthDate,
248 269 card_number: id_info.id_card_number
249 270 })
250 271 that.dealIdInfo(id_info.id_card_number)
... ... @@ -266,9 +287,11 @@ Page({
266 287 if ('居民身份证' == new_type) {
267 288 is_idcard = true
268 289 this.data.genderData.disabled = true
  290 + this.data.birthDate.disabled = true
269 291 } else {
270 292 is_idcard = false
271 293 this.data.genderData.disabled = false
  294 + this.data.birthDate.disabled = false
272 295 }
273 296 this.data.forignerInfo.selected = '是'
274 297 if ('居民身份证' == new_type || '中国护照' == new_type) {
... ... @@ -289,6 +312,7 @@ Page({
289 312 }
290 313 this.setData({
291 314 isIdCard: is_idcard,
  315 + birthDate: this.data.birthDate,
292 316 genderData: this.data.genderData,
293 317 countryData: this.data.countryData,
294 318 cardtypeData: this.data.cardtypeData,
... ... @@ -298,7 +322,15 @@ Page({
298 322
299 323 },
300 324
301   -
  325 + birthdayChange: function (e) {
  326 + var birth_date = this.data.birthDate;
  327 + birth_date.selected = e.detail.value
  328 + console.log('birthdayChange', Date.parse(new Date(e.detail.value)))
  329 + this.setData({
  330 + long_birth_date: Date.parse(new Date(e.detail.value)) / 1000,
  331 + birthDate: birth_date
  332 + })
  333 + },
302 334 // =============普通单列picker选中处理==============
303 335 onPickerSelect: function(e) {
304 336 console.log('picker发送选择改变,携带值为', e)
... ... @@ -414,18 +446,23 @@ Page({
414 446 return
415 447 }
416 448 }
417   - if (!formdata.age) {
418   - this.showtoast('请填写年龄');
  449 + // if (!formdata.age) {
  450 + // this.showtoast('请填写年龄');
  451 + // return
  452 + // }
  453 + if (this.data.birthDate.selected.length < 1) {
  454 + this.showtoast('请选择出生日期');
419 455 return
420 456 } else {
  457 + var age = format.getAge(this.data.birthDate.selected)
421 458 var host_birth = format.formatTime_date(app.globalData.hostInfo.birth_date)
422 459 var host_age = format.getAge(host_birth)
423 460 console.log('host_age',host_age,'hostInfo', app.globalData.hostInfo)
424   - if ((rel == '子' || rel == '女') && formdata.age > host_age) {
  461 + if ((rel == '子' || rel == '女') && age > host_age) {
425 462 this.showtoast('子女年龄有误');
426 463 return
427 464 }
428   - if (rel == '父母' && formdata.age < host_age) {
  465 + if (rel == '父母' && age < host_age) {
429 466 this.showtoast('父母年龄有误');
430 467 return
431 468 }
... ... @@ -462,8 +499,8 @@ Page({
462 499 "name": name,
463 500 "gender": that.data.genderData.selected,
464 501 "mobile": formdata.mobile,
465   - //"age": formdata.age ? formdata.age : '',//不传
466   - "age": formdata.age ? formdata.age : '',
  502 + // "age": formdata.age ? formdata.age : '',
  503 + "birth_date": that.data.long_birth_date,
467 504 "native": that.data.countryData.selected,
468 505 "is_overseas_personnel": that.data.forignerInfo.selected,
469 506 },
... ... @@ -499,8 +536,8 @@ Page({
499 536 var cardtype = this.data.cardtypeData.selected;
500 537 var card_no = formdata.id_card_no ? formdata.id_card_no : this.data.card_number;
501 538 var gender = this.data.genderData.selected;
502   - //var birth_day = this.data.birthDate.selected;
503   - if (name == iddata.name && cardtype == '居民身份证' && card_no == iddata.id_card_number && gender == iddata.gender ){// && birth_day == this.data.birthday) {
  539 + var birth_day = this.data.birthDate.selected;
  540 + if (name == iddata.name && cardtype == '居民身份证' && card_no == iddata.id_card_number && gender == iddata.gender && birth_day == this.data.birthday) {
504 541 return 'active'
505 542 } else {
506 543 return ''
... ... @@ -520,8 +557,11 @@ Page({
520 557 var info = format.analyzeIDCard(idCardNum)
521 558 console.log('info', info.age, info.sex)
522 559 if (info.age) {
  560 + this.data.birthDate.selected = info.birthDay
523 561 this.setData({
524   - age: info.age
  562 + age: info.age,
  563 + long_birth_date: Date.parse(new Date(info.birthDay)) / 1000,
  564 + birthDate: this.data.birthDate
525 565 })
526 566 }
527 567 if (info.sex) {
... ...
注册登录 后发表评论