正在显示
4 个修改的文件
包含
136 行增加
和
58 行删除
| 1 | 1 | // pages/main/addtionalreduce/addextrainfo/addextrainfo.js |
| 2 | 2 | var format = require('../../../../utils/util.js'); |
| 3 | 3 | // var countryInfo = require('../../../../utils/country.js'); |
| 4 | +const reg_18_Number = /^[0-9]{18}$/; | |
| 5 | +const reg_9_n_a = /^([a-zA-z]|[0-9]){9}$/; | |
| 4 | 6 | const cardTypeArray = ['居民身份证', '中国护照', '港澳居民来往内地通行证', '港澳居民居住证', '台湾居民来往大陆通行证', '台湾居民居住证', '外国护照', '外国人永久居留身份证', '外国人工作许可证(A类)', '外国人工作许可证(B类)', '外国人工作许可证(C类)']; |
| 5 | 7 | var OSSInit; |
| 6 | 8 | var app = getApp(); |
| ... | ... | @@ -1437,6 +1439,7 @@ Page({ |
| 1437 | 1439 | // return bank_name |
| 1438 | 1440 | // }, |
| 1439 | 1441 | |
| 1442 | + | |
| 1440 | 1443 | formSubmit: function(e) { |
| 1441 | 1444 | console.log("formSubmit", e); |
| 1442 | 1445 | var formdata = e.detail.value |
| ... | ... | @@ -1454,7 +1457,15 @@ Page({ |
| 1454 | 1457 | return |
| 1455 | 1458 | } |
| 1456 | 1459 | if (this.data.isIdCard_child && !format.isIDCardNum(formdata.children_id_card_no)) { |
| 1457 | - this.showToast('身份证格式有误') | |
| 1460 | + this.showToast('子女证照号码有误') | |
| 1461 | + return | |
| 1462 | + } | |
| 1463 | + if (this.data.childrencardtypeData.selected.indexOf('居住证') > -1 && !reg_18_Number.test(formdata.children_id_card_no)) { | |
| 1464 | + this.showToast('子女证照号码有误'); | |
| 1465 | + return | |
| 1466 | + } | |
| 1467 | + if (this.data.childrencardtypeData.selected.indexOf('中国护照') > -1 && !reg_9_n_a.test(formdata.children_id_card_no)) { | |
| 1468 | + this.showToast('子女证照号码有误'); | |
| 1458 | 1469 | return |
| 1459 | 1470 | } |
| 1460 | 1471 | if (format.getAge(this.data.commonbirthDate.selected) < 3) { |
| ... | ... | @@ -1537,9 +1548,18 @@ Page({ |
| 1537 | 1548 | this.showToast('请填写配偶证照号码') |
| 1538 | 1549 | return |
| 1539 | 1550 | } else if (this.data.isIdCard_lover && !format.isIDCardNum(formdata.spouse_id_card_no)) { |
| 1540 | - this.showToast('配偶身份证格式有误') | |
| 1551 | + this.showToast('配偶证照号码有误') | |
| 1541 | 1552 | return |
| 1542 | - }else if (this.data.loverbirthDate.selected.length < 1) { | |
| 1553 | + } | |
| 1554 | + if (this.data.lovercardtypeData.selected.indexOf('居住证') > -1 && !reg_18_Number.test(formdata.spouse_id_card_no)) { | |
| 1555 | + this.showToast('配偶证照号码有误'); | |
| 1556 | + return | |
| 1557 | + } | |
| 1558 | + if (this.data.lovercardtypeData.selected.indexOf('中国护照') > -1 && !reg_9_n_a.test(formdata.spouse_id_card_no)) { | |
| 1559 | + this.showToast('配偶证照号码有误'); | |
| 1560 | + return | |
| 1561 | + } | |
| 1562 | + if (this.data.loverbirthDate.selected.length < 1) { | |
| 1543 | 1563 | this.showToast('请选择配偶出生日期') |
| 1544 | 1564 | return |
| 1545 | 1565 | } |
| ... | ... | @@ -1658,6 +1678,14 @@ Page({ |
| 1658 | 1678 | this.showToast('被赡养人身份证格式有误') |
| 1659 | 1679 | return |
| 1660 | 1680 | } |
| 1681 | + if (this.data.oldercardtypeData.selected.indexOf('居住证') > -1 && !reg_18_Number.test(formdata.id_card_no)) { | |
| 1682 | + this.showToast('被赡养人证照号码有误'); | |
| 1683 | + return | |
| 1684 | + } | |
| 1685 | + if (this.data.oldercardtypeData.selected.indexOf('中国护照') > -1 && !reg_9_n_a.test(formdata.id_card_no)) { | |
| 1686 | + this.showToast('被赡养人证照号码有误'); | |
| 1687 | + return | |
| 1688 | + } | |
| 1661 | 1689 | if (this.data.olderbirthDate.selected.length < 1) { |
| 1662 | 1690 | this.showToast('请选择出生日期') |
| 1663 | 1691 | return |
| ... | ... | @@ -1840,9 +1868,17 @@ Page({ |
| 1840 | 1868 | // this.showToast('请填写证照号码') |
| 1841 | 1869 | // return |
| 1842 | 1870 | } else if (this.data.isIdCard_owner && !format.isIDCardNum(formdata.owner_id_card_no)) { |
| 1843 | - this.showToast('身份证格式有误') | |
| 1871 | + this.showToast('证照号码有误') | |
| 1844 | 1872 | return |
| 1845 | 1873 | } |
| 1874 | + if (this.data.cardtypeData.selected.indexOf('居住证') > -1 && !reg_18_Number.test(formdata.owner_id_card_no)) { | |
| 1875 | + this.showToast('证照号码有误'); | |
| 1876 | + return | |
| 1877 | + } | |
| 1878 | + if (this.data.cardtypeData.selected.indexOf('中国护照') > -1 && !reg_9_n_a.test(formdata.owner_id_card_no)) { | |
| 1879 | + this.showToast('证照号码有误'); | |
| 1880 | + return | |
| 1881 | + } | |
| 1846 | 1882 | newdata.owner_id_card_type = this.data.cardtypeData.selected |
| 1847 | 1883 | } |
| 1848 | 1884 | // if (this.data.rentLocateInfo.address_value[0].length < 1) { |
| ... | ... | @@ -1900,7 +1936,16 @@ Page({ |
| 1900 | 1936 | } else if (this.data.isIdCard_lover && !format.isIDCardNum(formdata.spouse_id_card_no)) { |
| 1901 | 1937 | this.showToast('配偶身份证格式有误') |
| 1902 | 1938 | return |
| 1903 | - } else if (this.data.loverbirthDate.selected.length < 1) { | |
| 1939 | + } | |
| 1940 | + if (this.data.lovercardtypeData.selected.indexOf('居住证') > -1 && !reg_18_Number.test(formdata.spouse_id_card_no)) { | |
| 1941 | + this.showToast('证照号码有误'); | |
| 1942 | + return | |
| 1943 | + } | |
| 1944 | + if (this.data.lovercardtypeData.selected.indexOf('中国护照') > -1 && !reg_9_n_a.test(formdata.spouse_id_card_no)) { | |
| 1945 | + this.showToast('证照号码有误'); | |
| 1946 | + return | |
| 1947 | + } | |
| 1948 | + if (this.data.loverbirthDate.selected.length < 1) { | |
| 1904 | 1949 | this.showToast('请选择配偶出生日期') |
| 1905 | 1950 | return |
| 1906 | 1951 | } | ... | ... |
| ... | ... | @@ -2,6 +2,8 @@ |
| 2 | 2 | var app = getApp(); |
| 3 | 3 | var format = require('../../../../utils/util.js'); |
| 4 | 4 | var baseUrl = app.globalData.baseUrl; |
| 5 | +const reg_18_Number = /^[0-9]{18}$/; | |
| 6 | +const reg_9_n_a = /^([a-zA-z]|[0-9]){9}$/; | |
| 5 | 7 | // const cardTypeArray8 = ['居民身份证', '中国护照', '港澳居民居住证', '台湾居民居住证', '外国人永久居留身份证', '外国人工作许可证(A类)', '外国人工作许可证(B类)', '外国人工作许可证(C类)']; |
| 6 | 8 | const cardTypeArray = ['居民身份证', '中国护照', '港澳居民来往内地通行证', '港澳居民居住证', '台湾居民来往大陆通行证', '台湾居民居住证', '外国护照', '外国人永久居留身份证', '外国人工作许可证(A类)', '外国人工作许可证(B类)', '外国人工作许可证(C类)']; |
| 7 | 9 | Page({ |
| ... | ... | @@ -418,7 +420,13 @@ Page({ |
| 418 | 420 | if (this.data.card_number.length < 1) { |
| 419 | 421 | this.showtoast('请填写证照号码'); |
| 420 | 422 | return |
| 421 | - } else if (this.data.isIdCard && this.data.card_number.length > 0 && !format.isIDCardNum(this.data.card_number)) { | |
| 423 | + } else if (this.data.isIdCard && !format.isIDCardNum(this.data.card_number)) { | |
| 424 | + this.showtoast('证照号码有误'); | |
| 425 | + return | |
| 426 | + } else if (this.data.cardtypeData.selected.indexOf('居住证') > -1 && !reg_18_Number.test(this.data.card_number)) { | |
| 427 | + this.showtoast('证照号码有误'); | |
| 428 | + return | |
| 429 | + } else if (this.data.cardtypeData.selected.indexOf('中国护照') > -1 && !reg_9_n_a.test(this.data.card_number)) { | |
| 422 | 430 | this.showtoast('证照号码有误'); |
| 423 | 431 | return |
| 424 | 432 | } |
| ... | ... | @@ -577,63 +585,73 @@ Page({ |
| 577 | 585 | // }) |
| 578 | 586 | // } |
| 579 | 587 | }, |
| 580 | - | |
| 588 | + | |
| 581 | 589 | idChange: function (e) { |
| 582 | - console.log('idCardNoChange', e.detail.value) | |
| 583 | 590 | var idCardNo = e.detail.value |
| 584 | 591 | this.setData({ |
| 585 | 592 | card_number: idCardNo |
| 586 | 593 | }) |
| 587 | - if (!this.data.isIdCard) { | |
| 588 | - return; | |
| 589 | - } | |
| 590 | - if (e.detail.value.length == 18){ | |
| 591 | - if (!format.isIDCardNum(idCardNo)) { | |
| 592 | - wx.showToast({ | |
| 593 | - image: "../../../../images/warn.png", | |
| 594 | - title: '身份证格式有误' | |
| 595 | - }) | |
| 594 | + if (e.detail.value.length == 18) { | |
| 595 | + if (this.data.isIdCard && !format.isIDCardNum(idCardNo)) { | |
| 596 | + this.showtoast('证照号码有误'); | |
| 596 | 597 | return; |
| 597 | 598 | } |
| 598 | - this.dealIdInfo(idCardNo) | |
| 599 | + if (this.data.isIdCard) { | |
| 600 | + this.dealIdInfo(idCardNo) | |
| 601 | + return; | |
| 602 | + } | |
| 603 | + if (this.data.cardtypeData.selected.indexOf('居住证') > -1 && !reg_18_Number.test(idCardNo)) { | |
| 604 | + this.showtoast('证照号码有误'); | |
| 605 | + return | |
| 606 | + } | |
| 607 | + } | |
| 608 | + if (e.detail.value.length == 9) { | |
| 609 | + if (this.data.cardtypeData.selected.indexOf('中国护照') > -1 && !reg_9_n_a.test(idCardNo)) { | |
| 610 | + this.showtoast('证照号码有误'); | |
| 611 | + return | |
| 612 | + } | |
| 599 | 613 | } |
| 614 | + | |
| 600 | 615 | }, |
| 601 | 616 | idDone: function (e) { |
| 602 | 617 | var idCardNo = e.detail.value |
| 603 | 618 | this.setData({ |
| 604 | 619 | card_number: idCardNo |
| 605 | 620 | }) |
| 606 | - if (!this.data.isIdCard) { | |
| 607 | - return; | |
| 608 | - } | |
| 609 | 621 | if (!idCardNo.length) { |
| 610 | - wx.showToast({ | |
| 611 | - image: "../../../../images/warn.png", | |
| 612 | - title: '请输入身份证号' | |
| 613 | - }) | |
| 622 | + this.showtoast('请输入证照号码'); | |
| 614 | 623 | return; |
| 615 | 624 | } |
| 616 | - if (!format.isIDCardNum(idCardNo)) { | |
| 617 | - wx.showToast({ | |
| 618 | - image: "../../../../images/warn.png", | |
| 619 | - title: '身份证格式有误' | |
| 620 | - }) | |
| 625 | + if (this.data.isIdCard && !format.isIDCardNum(idCardNo)) { | |
| 626 | + this.showtoast('证照号码有误'); | |
| 621 | 627 | return; |
| 622 | 628 | } |
| 629 | + if (this.data.cardtypeData.selected.indexOf('居住证') > -1 && !reg_18_Number.test(idCardNo)) { | |
| 630 | + this.showtoast('证照号码有误'); | |
| 631 | + return | |
| 632 | + } | |
| 633 | + if (this.data.cardtypeData.selected.indexOf('中国护照') > -1 && !reg_9_n_a.test(idCardNo)) { | |
| 634 | + this.showtoast('证照号码有误'); | |
| 635 | + return | |
| 636 | + } | |
| 623 | 637 | }, |
| 624 | - delet: function() { | |
| 625 | - console.log('delet') | |
| 626 | - return | |
| 638 | + delete: function() { | |
| 639 | + if (!this.cur_id || this.cur_id.length<1) { | |
| 640 | + wx.navigateBack({ | |
| 641 | + delta: 1 | |
| 642 | + }) | |
| 643 | + return | |
| 644 | + } | |
| 645 | + console.log('delete') | |
| 627 | 646 | var that = this |
| 628 | 647 | var Authorization = app.globalData.Authorization; |
| 629 | - var url = baseUrl + 'persontax/v1/personal-taxes', method = "DELET" | |
| 648 | + var url = baseUrl + 'persontax/v1/personal-taxes/' + this.cur_id, method = "DELETE" | |
| 630 | 649 | wx.showLoading({ |
| 631 | 650 | title: '', |
| 632 | 651 | }) |
| 633 | 652 | wx.request({ |
| 634 | 653 | url: url, |
| 635 | 654 | method: method, |
| 636 | - data: {}, | |
| 637 | 655 | header: { |
| 638 | 656 | 'content-type': 'application/json', // 默认值 |
| 639 | 657 | "Authorization": Authorization | ... | ... |
| 1 | 1 | var format = require('../../../../utils/util.js'); |
| 2 | 2 | var app = getApp(); |
| 3 | 3 | var baseUrl = app.globalData.baseUrl; |
| 4 | +const reg_18_Number = /^[0-9]{18}$/; | |
| 5 | +const reg_9_n_a = /^([a-zA-z]|[0-9]){9}$/; | |
| 4 | 6 | // var countryInfo = require('../../../../utils/country.js'); |
| 5 | 7 | // const cardTypeArray = ['居民身份证', '中国护照', '港澳居民来往内地通行证', '港澳居民居住证', '台湾居民来往大陆通行证', '台湾居民居住证', '外国护照', '外国人永久居留身份证', '外国人工作许可证(A类)', '外国人工作许可证(B类)', '外国人工作许可证(C类)']; |
| 6 | 8 | const cardTypeArray8 = ['居民身份证', '中国护照', '港澳居民居住证', '台湾居民居住证', '外国人永久居留身份证', '外国人工作许可证(A类)', '外国人工作许可证(B类)', '外国人工作许可证(C类)']; |
| ... | ... | @@ -1077,41 +1079,48 @@ Page({ |
| 1077 | 1079 | this.setData({ |
| 1078 | 1080 | card_number: idCardNo |
| 1079 | 1081 | }) |
| 1080 | - if (!this.data.isIdCard) { | |
| 1081 | - return; | |
| 1082 | - } | |
| 1083 | 1082 | if (!idCardNo.length) { |
| 1084 | - wx.showToast({ | |
| 1085 | - image: "../../../../images/warn.png", | |
| 1086 | - title: '请输入身份证号' | |
| 1087 | - }) | |
| 1083 | + this.showtoast('请输入证照号码'); | |
| 1088 | 1084 | return; |
| 1089 | 1085 | } |
| 1090 | - if (!format.isIDCardNum(idCardNo)) { | |
| 1091 | - wx.showToast({ | |
| 1092 | - image: "../../../../images/warn.png", | |
| 1093 | - title: '身份证格式有误' | |
| 1094 | - }) | |
| 1086 | + if (this.data.isIdCard && !format.isIDCardNum(idCardNo)) { | |
| 1087 | + this.showtoast('证照号码有误'); | |
| 1095 | 1088 | return; |
| 1096 | 1089 | } |
| 1090 | + if (this.data.cardtypeData.selected.indexOf('居住证') > -1 && !reg_18_Number.test(idCardNo)) { | |
| 1091 | + this.showtoast('证照号码有误'); | |
| 1092 | + return | |
| 1093 | + } | |
| 1094 | + if (this.data.cardtypeData.selected.indexOf('中国护照') > -1 && !reg_9_n_a.test(idCardNo)) { | |
| 1095 | + this.showtoast('证照号码有误'); | |
| 1096 | + return | |
| 1097 | + } | |
| 1098 | + | |
| 1097 | 1099 | }, |
| 1098 | 1100 | bindinputcardnum: function(e) { |
| 1099 | 1101 | var idCardNo = e.detail.value |
| 1100 | 1102 | this.setData({ |
| 1101 | 1103 | card_number: idCardNo |
| 1102 | 1104 | }) |
| 1103 | - if (!this.data.isIdCard) { | |
| 1104 | - return; | |
| 1105 | - } | |
| 1106 | 1105 | if (e.detail.value.length == 18) { |
| 1107 | - if (!format.isIDCardNum(idCardNo)) { | |
| 1108 | - wx.showToast({ | |
| 1109 | - image: "../../../../images/warn.png", | |
| 1110 | - title: '身份证格式有误' | |
| 1111 | - }) | |
| 1106 | + if (this.data.isIdCard && !format.isIDCardNum(idCardNo)) { | |
| 1107 | + this.showtoast('证照号码有误'); | |
| 1108 | + return; | |
| 1109 | + } | |
| 1110 | + if (this.data.isIdCard){ | |
| 1111 | + this.dealIdInfo(idCardNo) | |
| 1112 | 1112 | return; |
| 1113 | 1113 | } |
| 1114 | - this.dealIdInfo(idCardNo) | |
| 1114 | + if (this.data.cardtypeData.selected.indexOf('居住证') > -1 && !reg_18_Number.test(idCardNo)) { | |
| 1115 | + this.showtoast('证照号码有误'); | |
| 1116 | + return | |
| 1117 | + } | |
| 1118 | + } | |
| 1119 | + if (e.detail.value.length == 9){ | |
| 1120 | + if (this.data.cardtypeData.selected.indexOf('中国护照') > -1 && !reg_9_n_a.test(idCardNo)) { | |
| 1121 | + this.showtoast('证照号码有误'); | |
| 1122 | + return | |
| 1123 | + } | |
| 1115 | 1124 | } |
| 1116 | 1125 | }, |
| 1117 | 1126 | //根据身份证号码,获取相关信息 |
| ... | ... | @@ -1166,7 +1175,13 @@ Page({ |
| 1166 | 1175 | if (this.data.card_number.length < 1) { |
| 1167 | 1176 | this.showtoast('请填写证照号码'); |
| 1168 | 1177 | return |
| 1169 | - } else if (this.data.isIdCard && this.data.card_number.length > 0 && !format.isIDCardNum(this.data.card_number)) { | |
| 1178 | + } else if (this.data.isIdCard && !format.isIDCardNum(this.data.card_number)) { | |
| 1179 | + this.showtoast('证照号码有误'); | |
| 1180 | + return | |
| 1181 | + } else if (this.data.cardtypeData.selected.indexOf('居住证') > -1 && !reg_18_Number.test(this.data.card_number)) { | |
| 1182 | + this.showtoast('证照号码有误'); | |
| 1183 | + return | |
| 1184 | + } else if (this.data.cardtypeData.selected.indexOf('中国护照') > -1 && !reg_9_n_a.test(this.data.card_number)) { | |
| 1170 | 1185 | this.showtoast('证照号码有误'); |
| 1171 | 1186 | return |
| 1172 | 1187 | } | ... | ... |
请
注册
或
登录
后发表评论