正在显示
4 个修改的文件
包含
105 行增加
和
43 行删除
... | ... | @@ -40,7 +40,7 @@ Page({ |
40 | 40 | loanAddress_haschanged: false, |
41 | 41 | rentAddress_haschanged: false, |
42 | 42 | extrainfo_arr: ["请上传子女出生证明、学籍信息凭证、学费凭证、本人结婚证和分摊协议", "请上传学历学籍凭证", "请上传出生证明或关系证明、独生子女证、分摊协议、其他法定赡养人赡养证明", "请上传诊断书和医疗费用收据", "请上传首套房证明、还款证明、不动产登记证、结婚证和夫妻约定抵扣协议"], |
43 | - cur_index: 'support_duty', | |
43 | + cur_index: 'continuing_education', | |
44 | 44 | lovercardtypeData: { |
45 | 45 | label: '配偶证照类型', |
46 | 46 | bindtype: 'lovercardtype', |
... | ... | @@ -1284,7 +1284,66 @@ Page({ |
1284 | 1284 | }) |
1285 | 1285 | } |
1286 | 1286 | }, |
1287 | - | |
1287 | + idChange: function (e) { | |
1288 | + console.log('idCardNoChange',e, e.detail.value) | |
1289 | + var idCardNo = e.detail.value | |
1290 | + if (e.detail.value.length == 18) { | |
1291 | + if (!format.isIDCardNum(idCardNo)) { | |
1292 | + wx.showToast({ | |
1293 | + image: "../../../../images/warn.png", | |
1294 | + title: '身份证格式有误' | |
1295 | + }) | |
1296 | + return; | |
1297 | + } | |
1298 | + this.dealIdInfo(idCardNo, e.currentTarget.id) | |
1299 | + } | |
1300 | + }, | |
1301 | + //根据身份证号码,获取相关信息 | |
1302 | + dealIdInfo: function (idCardNum, idcard_belong) { | |
1303 | + var info = format.analyzeIDCard(idCardNum) | |
1304 | + console.log('info', info.age, info.sex, info.birthDay, (Date.parse(new Date(info.birthDay)) / 1000)) | |
1305 | + var data | |
1306 | + if (idcard_belong == 'children_id_card_no_input') { | |
1307 | + this.data.commonbirthDate.selected = info.birthDay | |
1308 | + this.data.commonbirthDate.datelong = (Date.parse(new Date(info.birthDay)) / 1000) | |
1309 | + data = { | |
1310 | + commonbirthDate: this.data.commonbirthDate | |
1311 | + } | |
1312 | + } else if (idcard_belong == 'spouse_id_card_no_input') { | |
1313 | + this.data.loverbirthDate.selected = info.birthDay | |
1314 | + this.data.loverbirthDate.datelong = (Date.parse(new Date(info.birthDay)) / 1000) | |
1315 | + data = { | |
1316 | + loverbirthDate: this.data.loverbirthDate | |
1317 | + } | |
1318 | + } else if (idcard_belong == 'medical_id_card_no_input') { | |
1319 | + this.data.commonbirthDate.selected = info.birthDay | |
1320 | + this.data.commonbirthDate.datelong = (Date.parse(new Date(info.birthDay)) / 1000) | |
1321 | + data = { | |
1322 | + commonbirthDate: this.data.commonbirthDate | |
1323 | + } | |
1324 | + } else if (idcard_belong == 'older_id_card_no_input') { | |
1325 | + this.data.olderbirthDate.selected = info.birthDay | |
1326 | + this.data.olderbirthDate.datelong = (Date.parse(new Date(info.birthDay)) / 1000) | |
1327 | + data = { | |
1328 | + olderbirthDate: this.data.olderbirthDate | |
1329 | + } | |
1330 | + } else if (idcard_belong == 'owner_id_cartd_no_input') { | |
1331 | + // this.data.olderbirthDate.selected = info.birthDay | |
1332 | + // this.data.olderbirthDate.datelong = (Date.parse(new Date(info.birthDay)) / 1000) | |
1333 | + // data = { | |
1334 | + // owner_id_cartd_no: idCardNum, | |
1335 | + // } | |
1336 | + } | |
1337 | + if (info.age) { | |
1338 | + // data.age = info.age | |
1339 | + } | |
1340 | + if (info.sex) { | |
1341 | + // var gender_data = this.data.genderData | |
1342 | + // gender_data.selected = info.sex | |
1343 | + // data.genderData = gender_data | |
1344 | + } | |
1345 | + this.setData(data) | |
1346 | + }, | |
1288 | 1347 | onPickerSelect: function(e) { |
1289 | 1348 | console.log('picker发送选择改变,携带值为', e) |
1290 | 1349 | switch (e.currentTarget.id) { | ... | ... |
... | ... | @@ -13,7 +13,7 @@ |
13 | 13 | <text class='text_black_30 float_left' style='line-height: 90rpx'>子女证件号码</text> |
14 | 14 | <view wx:if="{{isIdCard}}"> |
15 | 15 | <image class='image_camera float_right' src='/images/camera.png' bindtap='getIdInfo' id="children_id_card_no"></image> |
16 | - <input class='input_wrap01 float_right' placeholder='请输入证件号码' placeholder-class='text_999_30' name='children_id_card_no' maxlength='18' type='idcard' value='{{children_id_card_no}}'></input> | |
16 | + <input class='input_wrap01 float_right' placeholder='请输入证件号码' placeholder-class='text_999_30' name='children_id_card_no' maxlength='18' type='idcard' value='{{children_id_card_no}}' bindinput="idChange" id='children_id_card_no_input'></input> | |
17 | 17 | </view> |
18 | 18 | <!-- <view wx:else> |
19 | 19 | <input class='input_wrap float_right' placeholder='请输入证件号码' placeholder-class='text_999_30' name='children_id_card_no' maxlength='18' type='idcard' value='{{children_id_card_no}}'></input> |
... | ... | @@ -131,7 +131,7 @@ |
131 | 131 | <text class='text_black_30 float_left'>被赡养人证照号码</text> |
132 | 132 | <view wx:if="{{isIdCard}}"> |
133 | 133 | <image class='image_camera float_right' src='/images/camera.png' bindtap='getIdInfo' id="older_id_card_no"></image> |
134 | - <input class='input_wrap float_right' placeholder-class='text_999_30 float_right' style='line-height: 90rpx;text-align: right;width:420rpx;' placeholder='请输入证件号码' maxlength='18' type='idcard' name='id_card_no' value='{{id_card_no}}'></input> | |
134 | + <input class='input_wrap float_right' placeholder-class='text_999_30 float_right' style='line-height: 90rpx;text-align: right;width:380rpx;' placeholder='请输入证件号码' maxlength='18' type='idcard' name='id_card_no' value='{{id_card_no}}' bindinput="idChange" id="older_id_card_no_input"></input> | |
135 | 135 | </view> |
136 | 136 | </view> |
137 | 137 | <view class='divide_line_f5f5f5'></view> |
... | ... | @@ -173,7 +173,7 @@ |
173 | 173 | <view style='height:90rpx'> |
174 | 174 | <text style='color:red;font-size: 30rpx;line-height: 90rpx;float:left'>*</text> |
175 | 175 | <text class='text_black_30 float_left'>病人证照号码</text> |
176 | - <input class='input_wrap float_right' placeholder-class='text_999_30 float_right' style='line-height: 90rpx;text-align: right' placeholder='请输入证照号码' name='id_card_no' type='idcard' value='{{id_card_no}}'></input> | |
176 | + <input class='input_wrap float_right' placeholder-class='text_999_30 float_right' style='line-height: 90rpx;text-align: right' placeholder='请输入证照号码' name='id_card_no' type='idcard' value='{{id_card_no}}' bindinput="idChange" id="medical_id_card_no_input"></input> | |
177 | 177 | </view> |
178 | 178 | <view class='divide_line_f5f5f5'></view> |
179 | 179 | <template is="picker_cell_normal" data="{{...commonbirthDate}}" /> |
... | ... | @@ -269,7 +269,7 @@ |
269 | 269 | <text class='text_black_30 float_left'>证件号码</text> |
270 | 270 | <view wx:if="{{isIdCard}}"> |
271 | 271 | <image class='image_camera float_right' src='/images/camera.png' bindtap='getIdInfo' id="owner_id_cartd_no"></image> |
272 | - <input class='input_wrap float_right' placeholder-class='text_999_30 float_right' style='line-height: 90rpx;text-align: right;width:420rpx;' placeholder='请输入证件号码' maxlength='18' type='idcard' name='owner_id_cartd_no' value='{{owner_id_cartd_no}}'></input> | |
272 | + <input class='input_wrap float_right' placeholder-class='text_999_30 float_right' style='line-height: 90rpx;text-align: right;width:380rpx;' placeholder='请输入证件号码' maxlength='18' type='idcard' name='owner_id_cartd_no' value='{{owner_id_cartd_no}}' bindinput="idChange" id='owner_id_cartd_no_input'></input> | |
273 | 273 | </view> |
274 | 274 | </view> |
275 | 275 | </view> |
... | ... | @@ -326,7 +326,7 @@ |
326 | 326 | <text class='text_black_30 float_left'>配偶证件号码</text> |
327 | 327 | <view wx:if="{{isIdCard}}"> |
328 | 328 | <image class='image_camera float_right' src='/images/camera.png' bindtap='getIdInfo' id="lover"></image> |
329 | - <input class='input_wrap01 float_right' placeholder='请输入证件号码' placeholder-class='text_999_30' name='spouse_id_card_no' maxlength='18' type='idcard' value='{{spouse_id_card_no}}'></input> | |
329 | + <input class='input_wrap01 float_right' placeholder='请输入证件号码' placeholder-class='text_999_30' name='spouse_id_card_no' maxlength='18' type='idcard' value='{{spouse_id_card_no}}' bindinput="idChange" id='spouse_id_card_no_input'></input> | |
330 | 330 | </view> |
331 | 331 | </view> |
332 | 332 | <view class='divide_line_f5f5f5'></view> |
... | ... | @@ -351,7 +351,7 @@ |
351 | 351 | <text class='text_black_30 float_left'>配偶证件号码</text> |
352 | 352 | <view wx:if="{{isIdCard}}"> |
353 | 353 | <image class='image_camera float_right' src='/images/camera.png' bindtap='getIdInfo' id="lover"></image> |
354 | - <input class='input_wrap01 float_right' placeholder='请输入证件号码' placeholder-class='text_999_30' name='lover_idno' maxlength='18' type='idcard' value='{{lover_idno}}'></input> | |
354 | + <input class='input_wrap01 float_right' placeholder='请输入证件号码' placeholder-class='text_999_30' name='lover_idno' maxlength='18' type='idcard' value='{{lover_idno}}' bindinput="idChange" id='spouse_id_card_no_input'></input> | |
355 | 355 | </view> |
356 | 356 | </view> |
357 | 357 | <view class='divide_line_f5f5f5'></view> | ... | ... |
... | ... | @@ -372,7 +372,7 @@ Page({ |
372 | 372 | }, |
373 | 373 | |
374 | 374 | dealIdInfo: function (idCardNum) { |
375 | - var info = this.analyzeIDCard(idCardNum) | |
375 | + var info = format.analyzeIDCard(idCardNum) | |
376 | 376 | console.log('info', info.age, info.sex) |
377 | 377 | if (info.age) { |
378 | 378 | this.setData({ |
... | ... | @@ -422,39 +422,6 @@ Page({ |
422 | 422 | |
423 | 423 | }, |
424 | 424 | |
425 | - analyzeIDCard: function(IDCard){ | |
426 | - var sexAndAge = {} | |
427 | - //获取用户身份证号码 | |
428 | - var userCard = IDCard; | |
429 | - //如果身份证号码为undefind则返回空 | |
430 | - if(!userCard) { | |
431 | - return sexAndAge; | |
432 | - } | |
433 | - //获取性别 | |
434 | - if(parseInt(userCard.substr(16, 1)) % 2 == 1){ | |
435 | - sexAndAge.sex = '男' | |
436 | - }else { | |
437 | - sexAndAge.sex = '女' | |
438 | - } | |
439 | - //获取出生年月日 | |
440 | - //userCard.substring(6,10) + "-" + userCard.substring(10,12) + "-" + userCard.substring(12,14); | |
441 | - var yearBirth = userCard.substring(6, 10); | |
442 | - var monthBirth = userCard.substring(10, 12); | |
443 | - var dayBirth = userCard.substring(12, 14); | |
444 | - //获取当前年月日并计算年龄 | |
445 | - var myDate = new Date(); | |
446 | - var monthNow = myDate.getMonth() + 1; | |
447 | - var dayNow = myDate.getDay(); | |
448 | - var age = myDate.getFullYear() - yearBirth; | |
449 | - if (monthNow < monthBirth || (monthNow == monthBirth && dayNow < dayBirth)) { | |
450 | - age--; | |
451 | - } | |
452 | - //得到年龄 | |
453 | - sexAndAge.age = age; | |
454 | - //返回性别和年龄 | |
455 | - return sexAndAge; | |
456 | -}, | |
457 | - | |
458 | 425 | /** |
459 | 426 | * 生命周期函数--监听页面隐藏 |
460 | 427 | */ | ... | ... |
... | ... | @@ -100,6 +100,41 @@ function isIDCardNum(idCardNo) { |
100 | 100 | return false; |
101 | 101 | } |
102 | 102 | } |
103 | +function analyzeIDCard(IDCard){ | |
104 | + var sexAndAge = {} | |
105 | + //获取用户身份证号码 | |
106 | + var userCard = IDCard; | |
107 | + //如果身份证号码为undefind则返回空 | |
108 | + if (!userCard) { | |
109 | + return sexAndAge; | |
110 | + } | |
111 | + //获取性别 | |
112 | + if (parseInt(userCard.substr(16, 1)) % 2 == 1) { | |
113 | + sexAndAge.sex = '男' | |
114 | + } else { | |
115 | + sexAndAge.sex = '女' | |
116 | + } | |
117 | + //获取出生年月日 | |
118 | + //userCard.substring(6,10) + "-" + userCard.substring(10,12) + "-" + userCard.substring(12,14); | |
119 | + var yearBirth = userCard.substring(6, 10); | |
120 | + var monthBirth = userCard.substring(10, 12); | |
121 | + var dayBirth = userCard.substring(12, 14); | |
122 | + //出生日期 | |
123 | + sexAndAge.birthDay = yearBirth + '-' + monthBirth + '-' + dayBirth; | |
124 | + | |
125 | + //获取当前年月日并计算年龄 | |
126 | + var myDate = new Date(); | |
127 | + var monthNow = myDate.getMonth() + 1; | |
128 | + var dayNow = myDate.getDay(); | |
129 | + var age = myDate.getFullYear() - yearBirth; | |
130 | + if (monthNow < monthBirth || (monthNow == monthBirth && dayNow < dayBirth)) { | |
131 | + age--; | |
132 | + } | |
133 | + //得到年龄 | |
134 | + sexAndAge.age = age; | |
135 | + //返回性别和年龄 | |
136 | + return sexAndAge; | |
137 | +} | |
103 | 138 | |
104 | 139 | module.exports = { |
105 | 140 | formatTime: formatTime, |
... | ... | @@ -110,5 +145,6 @@ module.exports = { |
110 | 145 | monthFormString: monthFormString, |
111 | 146 | dayFormString: dayFormString, |
112 | 147 | isIDCardNum: isIDCardNum, |
113 | - curDateTime: curDateTime | |
148 | + curDateTime: curDateTime, | |
149 | + analyzeIDCard: analyzeIDCard | |
114 | 150 | } | ... | ... |
请
注册
或
登录
后发表评论