正在显示
5 个修改的文件
包含
205 行增加
和
60 行删除
| 1 | // pages/main/addtionalreduce/addextrainfo/addextrainfo.js | 1 | // pages/main/addtionalreduce/addextrainfo/addextrainfo.js |
| 2 | var format = require('../../../../utils/util.js'); | 2 | var format = require('../../../../utils/util.js'); |
| 3 | // var countryInfo = require('../../../../utils/country.js'); | 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 | const cardTypeArray = ['居民身份证', '中国护照', '港澳居民来往内地通行证', '港澳居民居住证', '台湾居民来往大陆通行证', '台湾居民居住证', '外国护照', '外国人永久居留身份证', '外国人工作许可证(A类)', '外国人工作许可证(B类)', '外国人工作许可证(C类)']; | 6 | const cardTypeArray = ['居民身份证', '中国护照', '港澳居民来往内地通行证', '港澳居民居住证', '台湾居民来往大陆通行证', '台湾居民居住证', '外国护照', '外国人永久居留身份证', '外国人工作许可证(A类)', '外国人工作许可证(B类)', '外国人工作许可证(C类)']; |
| 5 | var OSSInit; | 7 | var OSSInit; |
| 6 | var app = getApp(); | 8 | var app = getApp(); |
| @@ -1437,6 +1439,7 @@ Page({ | @@ -1437,6 +1439,7 @@ Page({ | ||
| 1437 | // return bank_name | 1439 | // return bank_name |
| 1438 | // }, | 1440 | // }, |
| 1439 | 1441 | ||
| 1442 | + | ||
| 1440 | formSubmit: function(e) { | 1443 | formSubmit: function(e) { |
| 1441 | console.log("formSubmit", e); | 1444 | console.log("formSubmit", e); |
| 1442 | var formdata = e.detail.value | 1445 | var formdata = e.detail.value |
| @@ -1454,7 +1457,15 @@ Page({ | @@ -1454,7 +1457,15 @@ Page({ | ||
| 1454 | return | 1457 | return |
| 1455 | } | 1458 | } |
| 1456 | if (this.data.isIdCard_child && !format.isIDCardNum(formdata.children_id_card_no)) { | 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 | return | 1469 | return |
| 1459 | } | 1470 | } |
| 1460 | if (format.getAge(this.data.commonbirthDate.selected) < 3) { | 1471 | if (format.getAge(this.data.commonbirthDate.selected) < 3) { |
| @@ -1537,9 +1548,18 @@ Page({ | @@ -1537,9 +1548,18 @@ Page({ | ||
| 1537 | this.showToast('请填写配偶证照号码') | 1548 | this.showToast('请填写配偶证照号码') |
| 1538 | return | 1549 | return |
| 1539 | } else if (this.data.isIdCard_lover && !format.isIDCardNum(formdata.spouse_id_card_no)) { | 1550 | } else if (this.data.isIdCard_lover && !format.isIDCardNum(formdata.spouse_id_card_no)) { |
| 1540 | - this.showToast('配偶身份证格式有误') | 1551 | + this.showToast('配偶证照号码有误') |
| 1541 | return | 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 | this.showToast('请选择配偶出生日期') | 1563 | this.showToast('请选择配偶出生日期') |
| 1544 | return | 1564 | return |
| 1545 | } | 1565 | } |
| @@ -1658,6 +1678,14 @@ Page({ | @@ -1658,6 +1678,14 @@ Page({ | ||
| 1658 | this.showToast('被赡养人身份证格式有误') | 1678 | this.showToast('被赡养人身份证格式有误') |
| 1659 | return | 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 | if (this.data.olderbirthDate.selected.length < 1) { | 1689 | if (this.data.olderbirthDate.selected.length < 1) { |
| 1662 | this.showToast('请选择出生日期') | 1690 | this.showToast('请选择出生日期') |
| 1663 | return | 1691 | return |
| @@ -1840,9 +1868,17 @@ Page({ | @@ -1840,9 +1868,17 @@ Page({ | ||
| 1840 | // this.showToast('请填写证照号码') | 1868 | // this.showToast('请填写证照号码') |
| 1841 | // return | 1869 | // return |
| 1842 | } else if (this.data.isIdCard_owner && !format.isIDCardNum(formdata.owner_id_card_no)) { | 1870 | } else if (this.data.isIdCard_owner && !format.isIDCardNum(formdata.owner_id_card_no)) { |
| 1843 | - this.showToast('身份证格式有误') | 1871 | + this.showToast('证照号码有误') |
| 1844 | return | 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 | newdata.owner_id_card_type = this.data.cardtypeData.selected | 1882 | newdata.owner_id_card_type = this.data.cardtypeData.selected |
| 1847 | } | 1883 | } |
| 1848 | // if (this.data.rentLocateInfo.address_value[0].length < 1) { | 1884 | // if (this.data.rentLocateInfo.address_value[0].length < 1) { |
| @@ -1900,7 +1936,16 @@ Page({ | @@ -1900,7 +1936,16 @@ Page({ | ||
| 1900 | } else if (this.data.isIdCard_lover && !format.isIDCardNum(formdata.spouse_id_card_no)) { | 1936 | } else if (this.data.isIdCard_lover && !format.isIDCardNum(formdata.spouse_id_card_no)) { |
| 1901 | this.showToast('配偶身份证格式有误') | 1937 | this.showToast('配偶身份证格式有误') |
| 1902 | return | 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 | this.showToast('请选择配偶出生日期') | 1949 | this.showToast('请选择配偶出生日期') |
| 1905 | return | 1950 | return |
| 1906 | } | 1951 | } |
| @@ -2,6 +2,8 @@ | @@ -2,6 +2,8 @@ | ||
| 2 | var app = getApp(); | 2 | var app = getApp(); |
| 3 | var format = require('../../../../utils/util.js'); | 3 | var format = require('../../../../utils/util.js'); |
| 4 | var baseUrl = app.globalData.baseUrl; | 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 | // const cardTypeArray8 = ['居民身份证', '中国护照', '港澳居民居住证', '台湾居民居住证', '外国人永久居留身份证', '外国人工作许可证(A类)', '外国人工作许可证(B类)', '外国人工作许可证(C类)']; | 7 | // const cardTypeArray8 = ['居民身份证', '中国护照', '港澳居民居住证', '台湾居民居住证', '外国人永久居留身份证', '外国人工作许可证(A类)', '外国人工作许可证(B类)', '外国人工作许可证(C类)']; |
| 6 | const cardTypeArray = ['居民身份证', '中国护照', '港澳居民来往内地通行证', '港澳居民居住证', '台湾居民来往大陆通行证', '台湾居民居住证', '外国护照', '外国人永久居留身份证', '外国人工作许可证(A类)', '外国人工作许可证(B类)', '外国人工作许可证(C类)']; | 8 | const cardTypeArray = ['居民身份证', '中国护照', '港澳居民来往内地通行证', '港澳居民居住证', '台湾居民来往大陆通行证', '台湾居民居住证', '外国护照', '外国人永久居留身份证', '外国人工作许可证(A类)', '外国人工作许可证(B类)', '外国人工作许可证(C类)']; |
| 7 | Page({ | 9 | Page({ |
| @@ -418,7 +420,13 @@ Page({ | @@ -418,7 +420,13 @@ Page({ | ||
| 418 | if (this.data.card_number.length < 1) { | 420 | if (this.data.card_number.length < 1) { |
| 419 | this.showtoast('请填写证照号码'); | 421 | this.showtoast('请填写证照号码'); |
| 420 | return | 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 | this.showtoast('证照号码有误'); | 430 | this.showtoast('证照号码有误'); |
| 423 | return | 431 | return |
| 424 | } | 432 | } |
| @@ -577,55 +585,93 @@ Page({ | @@ -577,55 +585,93 @@ Page({ | ||
| 577 | // }) | 585 | // }) |
| 578 | // } | 586 | // } |
| 579 | }, | 587 | }, |
| 580 | - | 588 | + |
| 581 | idChange: function (e) { | 589 | idChange: function (e) { |
| 582 | - console.log('idCardNoChange', e.detail.value) | ||
| 583 | var idCardNo = e.detail.value | 590 | var idCardNo = e.detail.value |
| 584 | this.setData({ | 591 | this.setData({ |
| 585 | card_number: idCardNo | 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 | return; | 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 | idDone: function (e) { | 616 | idDone: function (e) { |
| 602 | var idCardNo = e.detail.value | 617 | var idCardNo = e.detail.value |
| 603 | this.setData({ | 618 | this.setData({ |
| 604 | card_number: idCardNo | 619 | card_number: idCardNo |
| 605 | }) | 620 | }) |
| 606 | - if (!this.data.isIdCard) { | ||
| 607 | - return; | ||
| 608 | - } | ||
| 609 | if (!idCardNo.length) { | 621 | if (!idCardNo.length) { |
| 610 | - wx.showToast({ | ||
| 611 | - image: "../../../../images/warn.png", | ||
| 612 | - title: '请输入身份证号' | ||
| 613 | - }) | 622 | + this.showtoast('请输入证照号码'); |
| 614 | return; | 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 | return; | 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 | - | ||
| 625 | - /** | ||
| 626 | - * 生命周期函数--监听页面隐藏 | ||
| 627 | - */ | ||
| 628 | - onHide: function() { | 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') | ||
| 646 | + var that = this | ||
| 647 | + var Authorization = app.globalData.Authorization; | ||
| 648 | + var url = baseUrl + 'persontax/v1/personal-taxes/' + this.cur_id, method = "DELETE" | ||
| 649 | + wx.showLoading({ | ||
| 650 | + title: '', | ||
| 651 | + }) | ||
| 652 | + wx.request({ | ||
| 653 | + url: url, | ||
| 654 | + method: method, | ||
| 655 | + header: { | ||
| 656 | + 'content-type': 'application/json', // 默认值 | ||
| 657 | + "Authorization": Authorization | ||
| 658 | + }, | ||
| 659 | + success: function (res) { | ||
| 660 | + console.log(res) | ||
| 661 | + wx.hideLoading() | ||
| 662 | + if (res.statusCode == 200) { | ||
| 663 | + wx.navigateBack({ | ||
| 664 | + delta: 1 | ||
| 665 | + }) | ||
| 666 | + } else { | ||
| 667 | + that.showtoast(res.data.message) | ||
| 668 | + } | ||
| 669 | + }, | ||
| 670 | + fail(res) { | ||
| 671 | + console.log(res) | ||
| 672 | + wx.hideLoading() | ||
| 673 | + } | ||
| 674 | + }) | ||
| 629 | 675 | ||
| 630 | }, | 676 | }, |
| 631 | 677 |
| @@ -63,9 +63,10 @@ | @@ -63,9 +63,10 @@ | ||
| 63 | </view> | 63 | </view> |
| 64 | </view> | 64 | </view> |
| 65 | </view> | 65 | </view> |
| 66 | - | ||
| 67 | - <view class="btn_bottom"> | ||
| 68 | - <button class="btn_bottom" formType="submit"> 保存</button> | 66 | + |
| 67 | + <view class="btn_left" bindtap='delete'>删除</view> | ||
| 68 | + <view class="btn_bottom_wrap"> | ||
| 69 | + <button class="btn_right" formType="submit">保存</button> | ||
| 69 | </view> | 70 | </view> |
| 70 | </form> | 71 | </form> |
| 71 | </view> | 72 | </view> |
| @@ -127,4 +127,42 @@ input[disabled]{ | @@ -127,4 +127,42 @@ input[disabled]{ | ||
| 127 | height: 40rpx; | 127 | height: 40rpx; |
| 128 | float: right; | 128 | float: right; |
| 129 | margin-top:24rpx; | 129 | margin-top:24rpx; |
| 130 | +} | ||
| 131 | + | ||
| 132 | +.btn_left{ | ||
| 133 | + width: 40%; | ||
| 134 | + z-index: 10000; | ||
| 135 | + height: 82rpx; | ||
| 136 | + text-align: center; | ||
| 137 | + position: fixed; | ||
| 138 | + color: #357aeb; | ||
| 139 | + bottom: 0; | ||
| 140 | + line-height: 82rpx; | ||
| 141 | + border: 1rpx solid #357aeb; | ||
| 142 | + | ||
| 143 | +} | ||
| 144 | +.btn_bottom_wrap{ | ||
| 145 | + width: 60%; | ||
| 146 | + z-index: 10000; | ||
| 147 | + height: 84rpx; | ||
| 148 | + text-align: center; | ||
| 149 | + position: fixed; | ||
| 150 | + background: #357aeb; | ||
| 151 | + /* border: 1rpx solid #357aeb; */ | ||
| 152 | + bottom: 0; | ||
| 153 | + line-height: 84rpx; | ||
| 154 | + right: 0; | ||
| 155 | +} | ||
| 156 | +.btn_right{ | ||
| 157 | + width: 60%; | ||
| 158 | + z-index: 10000; | ||
| 159 | + height: 84rpx; | ||
| 160 | + background: #357aeb; | ||
| 161 | + text-align: center; | ||
| 162 | + position: fixed; | ||
| 163 | + color: #fff; | ||
| 164 | + bottom: 0; | ||
| 165 | + right: 0; | ||
| 166 | + line-height: 84rpx; | ||
| 167 | + border-color: #357aeb; | ||
| 130 | } | 168 | } |
| 1 | var format = require('../../../../utils/util.js'); | 1 | var format = require('../../../../utils/util.js'); |
| 2 | var app = getApp(); | 2 | var app = getApp(); |
| 3 | var baseUrl = app.globalData.baseUrl; | 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 | // var countryInfo = require('../../../../utils/country.js'); | 6 | // var countryInfo = require('../../../../utils/country.js'); |
| 5 | // const cardTypeArray = ['居民身份证', '中国护照', '港澳居民来往内地通行证', '港澳居民居住证', '台湾居民来往大陆通行证', '台湾居民居住证', '外国护照', '外国人永久居留身份证', '外国人工作许可证(A类)', '外国人工作许可证(B类)', '外国人工作许可证(C类)']; | 7 | // const cardTypeArray = ['居民身份证', '中国护照', '港澳居民来往内地通行证', '港澳居民居住证', '台湾居民来往大陆通行证', '台湾居民居住证', '外国护照', '外国人永久居留身份证', '外国人工作许可证(A类)', '外国人工作许可证(B类)', '外国人工作许可证(C类)']; |
| 6 | const cardTypeArray8 = ['居民身份证', '中国护照', '港澳居民居住证', '台湾居民居住证', '外国人永久居留身份证', '外国人工作许可证(A类)', '外国人工作许可证(B类)', '外国人工作许可证(C类)']; | 8 | const cardTypeArray8 = ['居民身份证', '中国护照', '港澳居民居住证', '台湾居民居住证', '外国人永久居留身份证', '外国人工作许可证(A类)', '外国人工作许可证(B类)', '外国人工作许可证(C类)']; |
| @@ -1077,41 +1079,48 @@ Page({ | @@ -1077,41 +1079,48 @@ Page({ | ||
| 1077 | this.setData({ | 1079 | this.setData({ |
| 1078 | card_number: idCardNo | 1080 | card_number: idCardNo |
| 1079 | }) | 1081 | }) |
| 1080 | - if (!this.data.isIdCard) { | ||
| 1081 | - return; | ||
| 1082 | - } | ||
| 1083 | if (!idCardNo.length) { | 1082 | if (!idCardNo.length) { |
| 1084 | - wx.showToast({ | ||
| 1085 | - image: "../../../../images/warn.png", | ||
| 1086 | - title: '请输入身份证号' | ||
| 1087 | - }) | 1083 | + this.showtoast('请输入证照号码'); |
| 1088 | return; | 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 | return; | 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 | bindinputcardnum: function(e) { | 1100 | bindinputcardnum: function(e) { |
| 1099 | var idCardNo = e.detail.value | 1101 | var idCardNo = e.detail.value |
| 1100 | this.setData({ | 1102 | this.setData({ |
| 1101 | card_number: idCardNo | 1103 | card_number: idCardNo |
| 1102 | }) | 1104 | }) |
| 1103 | - if (!this.data.isIdCard) { | ||
| 1104 | - return; | ||
| 1105 | - } | ||
| 1106 | if (e.detail.value.length == 18) { | 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 | return; | 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,7 +1175,13 @@ Page({ | ||
| 1166 | if (this.data.card_number.length < 1) { | 1175 | if (this.data.card_number.length < 1) { |
| 1167 | this.showtoast('请填写证照号码'); | 1176 | this.showtoast('请填写证照号码'); |
| 1168 | return | 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 | this.showtoast('证照号码有误'); | 1185 | this.showtoast('证照号码有误'); |
| 1171 | return | 1186 | return |
| 1172 | } | 1187 | } |
请
注册
或
登录
后发表评论