提交 172c2d973adcb7546cb2714d0b748981f9e805f7

作者 wangyu
2 个父辈 0c3f51af 976dab13

Merge branch 'dev2.0' into dev_wy

... ... @@ -32,7 +32,7 @@ App({
32 32 }
33 33 },
34 34
35   - getTokenByCode: function (code) {
  35 + getTokenByCode: function (code, relaunch) {
36 36 var that = this;
37 37 var baseUrl = that.globalData.baseUrl;
38 38 wx.request({
... ... @@ -63,6 +63,11 @@ App({
63 63 })
64 64 } else if (user && user.type == "1") {//注册用户
65 65 that.configOssUrl()
  66 + if (relaunch) {
  67 + wx.reLaunch({
  68 + url: '../guide/guide'
  69 + })
  70 + }
66 71 }
67 72 },
68 73 fail: function (res) {
... ...
... ... @@ -21,6 +21,7 @@ const Deduce_amounts_month = {
21 21 const Deduce_amounts_year = {
22 22 'children_education': 12000,
23 23 'continuing_education': 4800,
  24 + 'continuing_education_non': 3600,
24 25 'support_duty': 24000,
25 26 'medical_fund': 0,
26 27 'house_fund': 0
... ... @@ -40,7 +41,7 @@ Page({
40 41 loanAddress_haschanged: false,
41 42 rentAddress_haschanged: false,
42 43 extrainfo_arr: ["请上传子女出生证明、学籍信息凭证、学费凭证、本人结婚证和分摊协议", "请上传学历学籍凭证", "请上传出生证明或关系证明、独生子女证、分摊协议、其他法定赡养人赡养证明", "请上传诊断书和医疗费用收据", "请上传首套房证明、还款证明、不动产登记证、结婚证和夫妻约定抵扣协议"],
43   - cur_index: 'support_duty',
  44 + cur_index: 'continuing_education',
44 45 lovercardtypeData: {
45 46 label: '配偶证照类型',
46 47 bindtype: 'lovercardtype',
... ... @@ -858,6 +859,18 @@ Page({
858 859 spouse_name: id_info.name,
859 860 loverbirthDate: this.data.loverbirthDate
860 861 }
  862 + } else if (this.idcard_belong == 'older_id_card_no') {
  863 + this.data.olderbirthDate.selected = birth_day
  864 + data = {
  865 + id_card_no: id_info.id_card_number,
  866 + supported_name: id_info.name,
  867 + olderbirthDate: this.data.olderbirthDate
  868 + }
  869 + } else if (this.idcard_belong == 'owner_id_cartd_no') {
  870 + this.data.olderbirthDate.selected = birth_day
  871 + data = {
  872 + owner_id_cartd_no: id_info.id_card_number,
  873 + }
861 874 }
862 875 this.setData(data)
863 876 console.log('-cardtypeData--', that.data.cardtypeData)
... ... @@ -1251,6 +1264,10 @@ Page({
1251 1264 wx.navigateBack({
1252 1265 delta: 1
1253 1266 })
  1267 + }else{
  1268 + wx.showToast({
  1269 + title: res.message
  1270 + })
1254 1271 }
1255 1272 }
1256 1273 })
... ... @@ -1268,7 +1285,66 @@ Page({
1268 1285 })
1269 1286 }
1270 1287 },
1271   -
  1288 + idChange: function (e) {
  1289 + console.log('idCardNoChange',e, e.detail.value)
  1290 + var idCardNo = e.detail.value
  1291 + if (e.detail.value.length == 18) {
  1292 + if (!format.isIDCardNum(idCardNo)) {
  1293 + wx.showToast({
  1294 + image: "../../../../images/warn.png",
  1295 + title: '身份证格式有误'
  1296 + })
  1297 + return;
  1298 + }
  1299 + this.dealIdInfo(idCardNo, e.currentTarget.id)
  1300 + }
  1301 + },
  1302 + //根据身份证号码,获取相关信息
  1303 + dealIdInfo: function (idCardNum, idcard_belong) {
  1304 + var info = format.analyzeIDCard(idCardNum)
  1305 + console.log('info', info.age, info.sex, info.birthDay, (Date.parse(new Date(info.birthDay)) / 1000))
  1306 + var data
  1307 + if (idcard_belong == 'children_id_card_no_input') {
  1308 + this.data.commonbirthDate.selected = info.birthDay
  1309 + this.data.commonbirthDate.datelong = (Date.parse(new Date(info.birthDay)) / 1000)
  1310 + data = {
  1311 + commonbirthDate: this.data.commonbirthDate
  1312 + }
  1313 + } else if (idcard_belong == 'spouse_id_card_no_input') {
  1314 + this.data.loverbirthDate.selected = info.birthDay
  1315 + this.data.loverbirthDate.datelong = (Date.parse(new Date(info.birthDay)) / 1000)
  1316 + data = {
  1317 + loverbirthDate: this.data.loverbirthDate
  1318 + }
  1319 + } else if (idcard_belong == 'medical_id_card_no_input') {
  1320 + this.data.commonbirthDate.selected = info.birthDay
  1321 + this.data.commonbirthDate.datelong = (Date.parse(new Date(info.birthDay)) / 1000)
  1322 + data = {
  1323 + commonbirthDate: this.data.commonbirthDate
  1324 + }
  1325 + } else if (idcard_belong == 'older_id_card_no_input') {
  1326 + this.data.olderbirthDate.selected = info.birthDay
  1327 + this.data.olderbirthDate.datelong = (Date.parse(new Date(info.birthDay)) / 1000)
  1328 + data = {
  1329 + olderbirthDate: this.data.olderbirthDate
  1330 + }
  1331 + } else if (idcard_belong == 'owner_id_cartd_no_input') {
  1332 + // this.data.olderbirthDate.selected = info.birthDay
  1333 + // this.data.olderbirthDate.datelong = (Date.parse(new Date(info.birthDay)) / 1000)
  1334 + // data = {
  1335 + // owner_id_cartd_no: idCardNum,
  1336 + // }
  1337 + }
  1338 + if (info.age) {
  1339 + // data.age = info.age
  1340 + }
  1341 + if (info.sex) {
  1342 + // var gender_data = this.data.genderData
  1343 + // gender_data.selected = info.sex
  1344 + // data.genderData = gender_data
  1345 + }
  1346 + this.setData(data)
  1347 + },
1272 1348 onPickerSelect: function(e) {
1273 1349 console.log('picker发送选择改变,携带值为', e)
1274 1350 switch (e.currentTarget.id) {
... ... @@ -1390,7 +1466,7 @@ Page({
1390 1466 if (e.detail.value == '0') {
1391 1467 deduction_amount = Deduce_amounts_month[this.data.cur_index]
1392 1468 } else {
1393   - deduction_amount = Deduce_amounts_year[this.data.cur_indexfan]
  1469 + deduction_amount = Deduce_amounts_year[this.data.cur_index]
1394 1470 }
1395 1471 reduce_typeData.selected = reduce_typeData.values[e.detail.value]
1396 1472 this.setData({
... ... @@ -1401,9 +1477,22 @@ Page({
1401 1477 case 'edu_type':
1402 1478 var edutypee_data = this.data.edutypeData
1403 1479 edutypee_data.selected = edutypee_data.values[e.detail.value]
  1480 + var reducetypeData = this.data.reducetypeData
  1481 + var deduction_amount
  1482 + if (e.detail.value == '1') {//非学历教育
  1483 + reducetypeData.selected = '年度'
  1484 + reducetypeData.disabled = true
  1485 + deduction_amount = Deduce_amounts_year['continuing_education_non']
  1486 + }else {
  1487 + reducetypeData.disabled = false
  1488 + reducetypeData.selected = '月度'
  1489 + deduction_amount = Deduce_amounts_month['continuing_education']
  1490 + }
1404 1491 this.setData({
1405 1492 edu_lable: e.detail.value == 0 ? 'school' : 'tech',
1406   - edutypeData: edutypee_data
  1493 + edutypeData: edutypee_data,
  1494 + reducetypeData: reducetypeData,
  1495 + deduction_amount: deduction_amount
1407 1496 })
1408 1497 break;
1409 1498 case 'edu_style':
... ...
... ... @@ -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>
... ... @@ -129,7 +129,10 @@
129 129 <view style='height:90rpx'>
130 130 <text style='color:red;font-size: 30rpx;line-height: 90rpx;float:left'>*</text>
131 131 <text class='text_black_30 float_left'>被赡养人证照号码</text>
132   - <input class='input_wrap float_right' placeholder-class='text_999_30 float_right' style='line-height: 90rpx;text-align: right;width:420rpx;' placeholder='请输入证件号码' type='idcard' name='id_card_no' value='{{id_card_no}}'></input>
  132 + <view wx:if="{{isIdCard}}">
  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:380rpx;' placeholder='请输入证件号码' maxlength='18' type='idcard' name='id_card_no' value='{{id_card_no}}' bindinput="idChange" id="older_id_card_no_input"></input>
  135 + </view>
133 136 </view>
134 137 <view class='divide_line_f5f5f5'></view>
135 138 <template is="picker_cell_normal" data="{{...olderbirthDate}}" />
... ... @@ -170,7 +173,7 @@
170 173 <view style='height:90rpx'>
171 174 <text style='color:red;font-size: 30rpx;line-height: 90rpx;float:left'>*</text>
172 175 <text class='text_black_30 float_left'>病人证照号码</text>
173   - <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>
174 177 </view>
175 178 <view class='divide_line_f5f5f5'></view>
176 179 <template is="picker_cell_normal" data="{{...commonbirthDate}}" />
... ... @@ -264,7 +267,10 @@
264 267 <view style='height:90rpx'>
265 268 <text style='color:red;font-size: 30rpx;line-height: 90rpx;float:left'>*</text>
266 269 <text class='text_black_30 float_left'>证件号码</text>
267   - <input class='input_wrap float_right' placeholder-class='text_999_30 float_right' style='line-height: 90rpx;text-align: right' placeholder='请输入证件号码' name='owner_id_cartd_no'></input>
  270 + <view wx:if="{{isIdCard}}">
  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: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 + </view>
268 274 </view>
269 275 </view>
270 276 <view style='height:20rpx;width:100%;background:#F8F8F8;'></view>
... ... @@ -320,7 +326,7 @@
320 326 <text class='text_black_30 float_left'>配偶证件号码</text>
321 327 <view wx:if="{{isIdCard}}">
322 328 <image class='image_camera float_right' src='/images/camera.png' bindtap='getIdInfo' id="lover"></image>
323   - <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>
324 330 </view>
325 331 </view>
326 332 <view class='divide_line_f5f5f5'></view>
... ... @@ -345,7 +351,7 @@
345 351 <text class='text_black_30 float_left'>配偶证件号码</text>
346 352 <view wx:if="{{isIdCard}}">
347 353 <image class='image_camera float_right' src='/images/camera.png' bindtap='getIdInfo' id="lover"></image>
348   - <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>
349 355 </view>
350 356 </view>
351 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 }
... ...
注册登录 后发表评论