提交 a044f30784d2ad0f63eac2e5d0fb8e1e0de83c0d

作者 wangyu
1 个父辈 48948b58

优化 关于拍照之后认证字段相关问题

... ... @@ -19,9 +19,8 @@ Page({
19 19 card_number: '',
20 20 birthday: '',
21 21 requestBody: {},
22   - is_certified:'',
23   - idInfoData:'',
24   - profession_index:[0,0,0],
  22 + idInfoData: '',
  23 + profession_index: [0, 0, 0],
25 24
26 25 relativeData: {
27 26 isrequre: true,
... ... @@ -224,9 +223,9 @@ Page({
224 223 this.getbanklist()
225 224 },
226 225
227   - handleData:function(){
  226 + handleData: function() {
228 227 var curdate = format.curDateTime()
229   - console.log('curdate', curdate)
  228 + console.log('curdate', curdate)
230 229 this.data.birthDate.end = curdate
231 230 this.data.startDate.end = curdate
232 231 this.data.endDate.end = curdate
... ... @@ -308,7 +307,7 @@ Page({
308 307 new_profession_data = [list, list[0].children, list[0].children[0].children]
309 308 console.log('new_profession_data', new_profession_data)
310 309 return new_profession_data;
311   -
  310 +
312 311 },
313 312
314 313 getbanklist: function() {
... ... @@ -364,7 +363,7 @@ Page({
364 363 key: 'id_info',
365 364 success: function(res) {
366 365 console.log('id_info', res.data)
367   - if (res.data && res.data.length>0) {
  366 + if (res.data && res.data.length > 0) {
368 367 var id_info = JSON.parse(res.data)
369 368
370 369 var birth_day
... ... @@ -383,8 +382,8 @@ Page({
383 382 gender_Data.selected = id_info.gender
384 383
385 384 that.data.birthDate.selected = birth_day
386   -
387   - if (that.data.name.length > 0 && id_info.name != that.data.name){
  385 +
  386 + if (that.data.name.length > 0 && id_info.name != that.data.name) {
388 387 that.showtoast("姓名冲突")
389 388 return
390 389 }
... ... @@ -393,7 +392,6 @@ Page({
393 392 return
394 393 }
395 394 that.setData({
396   - is_certified:'active',
397 395 idInfoData: id_info,
398 396 name: id_info.name,
399 397 birthday: birth_day,
... ... @@ -403,7 +401,7 @@ Page({
403 401 birthDate: that.data.birthDate,
404 402 card_number: id_info.id_card_number
405 403 })
406   -
  404 +
407 405 }
408 406 },
409 407 })
... ... @@ -560,7 +558,7 @@ Page({
560 558 var birth_date = this.data.birthDate;
561 559 birth_date.selected = e.detail.value
562 560 this.setData({
563   - birthday: e.detail.value,
  561 + long_birth_date: Date.parse(new Date(e.detail.value)) / 1000,
564 562 birthDate: birth_date
565 563 })
566 564 },
... ... @@ -636,7 +634,7 @@ Page({
636 634 var regEmail = new RegExp("^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$");
637 635 var formdata = e.detail.value;
638 636 console.log("formdata", formdata);
639   - console.log('idnum', this.data.card_number.length < 1&&!format.isIDCardNum(formdata.id_card_no))
  637 + console.log('idnum', this.data.card_number.length < 1 && !format.isIDCardNum(formdata.id_card_no))
640 638 if (formdata.name.length < 1) {
641 639 this.showtoast('有必填项未填写');
642 640 return
... ... @@ -655,16 +653,16 @@ Page({
655 653 } else if (this.data.isIdCard && (this.data.card_number.length < 1 && formdata.id_card_no.length < 1)) {
656 654 this.showtoast('有必填项未填写');
657 655 return
658   - } else if (this.data.isIdCard &&!format.isIDCardNum(formdata.id_card_no)) {
  656 + } else if (this.data.isIdCard && !format.isIDCardNum(formdata.id_card_no)) {
659 657 this.showtoast('证件号码有误');
660 658 return
661   - }else if (!this.data.isIdCard && (!formdata.id_card_no || formdata.id_card_no.length < 1)) {
  659 + } else if (!this.data.isIdCard && (!formdata.id_card_no || formdata.id_card_no.length < 1)) {
662 660 this.showtoast('有必填项未填写');
663 661 return
664 662 } else if (formdata.mobile.length < 1) {
665 663 this.showtoast('有必填项未填写');
666 664 return
667   - } else if (!regMobile.test(formdata.mobile)){
  665 + } else if (!regMobile.test(formdata.mobile)) {
668 666 this.showtoast('请输入正确手机号');
669 667 return
670 668 } else if (this.data.investInfo.selected.length < 1) {
... ... @@ -673,7 +671,7 @@ Page({
673 671 } else if (this.data.specificIndustryInfo.selected.length < 1) {
674 672 this.showtoast('有必填项未填写');
675 673 return
676   - } else if (formdata.email && formdata.email.length > 0 && !regEmail.test(formdata.email)){
  674 + } else if (formdata.email && formdata.email.length > 0 && !regEmail.test(formdata.email)) {
677 675 this.showtoast('请输入正确邮箱');
678 676 return
679 677 } else if (formdata.company_equity_total && formdata.company_equity_total.length > 0 && !regMoney.test(formdata.company_equity_total)) {
... ... @@ -692,7 +690,7 @@ Page({
692 690 new_card_num = formdata.id_card_no
693 691 }
694 692 }
695   -
  693 +
696 694 if (!this.data.isIdCard && formdata.id_card_no && formdata.id_card_no.length > 0) {
697 695 new_card_num = formdata.id_card_no
698 696 }
... ... @@ -706,22 +704,22 @@ Page({
706 704 var that = this
707 705 var formdata = data
708 706 console.log("form_data", formdata);
  707 + var Authorization = app.globalData.Authorization;
709 708 var pro_index = that.data.profession_index
710 709 var profession_data_info = that.data.professionData.values[pro_index[pro_index[0]]][0]
711 710 console.log('profession_datas', profession_data_info)
712   - var Authorization = app.globalData.Authorization;
713 711 wx.request({
714 712 url: baseUrl + 'persontax/v1/personal-taxes',
715 713 method: "POST",
716 714 data: {
717   - 'certification_status':'',
  715 + 'certification_status': that.getCertifyStatus(formdata),
718 716 "name": that.data.name.length > 0 ? that.data.name : formdata.name,
719 717 "family_ties": that.data.relativeData.selected,
720 718 "native": "中国",
721 719 "id_card_type": that.data.cardtypeData.selected,
722 720 "id_card_no": formdata.id_card_no ? formdata.id_card_no : that.data.card_number,
723 721 "gender": that.data.genderData.selected,
724   - "birth_date": that.data.long_birth_date > 1000 ? that.data.long_birth_date:null,
  722 + "birth_date": that.data.long_birth_date > 1000 ? that.data.long_birth_date : null,
725 723 "profession": {
726 724 "one_level_code": profession_data_info.value,
727 725 "one_level_name": profession_data_info.label,
... ... @@ -787,7 +785,7 @@ Page({
787 785 },
788 786 success: function(res) {
789 787 console.log(res)
790   - if(res.statusCode==200){
  788 + if (res.statusCode == 200) {
791 789 wx.redirectTo({
792 790 url: '../home/home',
793 791 })
... ... @@ -797,7 +795,7 @@ Page({
797 795 content: '',
798 796 })
799 797 }
800   -
  798 +
801 799 },
802 800 fail(res) {
803 801 console.log(res)
... ... @@ -805,10 +803,24 @@ Page({
805 803 })
806 804 },
807 805
  806 + getCertifyStatus: function(formdata) {
  807 + var iddata = this.data.idInfoData;
  808 + var name = this.data.name.length > 0 ? this.data.name : formdata.name;
  809 + var cardtype = this.data.cardtypeData.selected;
  810 + var card_no = formdata.id_card_no ? formdata.id_card_no : this.data.card_number;
  811 + var gender = this.data.genderData.selected;
  812 + var birth_day = this.data.birthDate.selected;
  813 + if (name == iddata.name && cardtype == '居民身份证' && card_no == iddata.id_card_number && gender == iddata.gender && birth_day == this.data.birthday) {
  814 + return 'active'
  815 + } else {
  816 + return ''
  817 + }
  818 + },
  819 +
808 820 showtoast: function(title) {
809 821 wx.showToast({
810 822 title: title,
811   - duration:2000,
  823 + duration: 2000,
812 824 image: '/images/error.png'
813 825 })
814 826 },
... ...
... ... @@ -17,11 +17,11 @@ Page({
17 17 cur_id: '',
18 18 isself: true,
19 19 isIdCard: true,
20   - is_certified:'',
21 20 profession_haschanges: false,
22 21 name: '',
23 22 mobile: '',
24 23 birthday: '',
  24 + idInfoData: '',
25 25 id_error: false,
26 26 curAddress_haschanged: false,
27 27 birthAddress_haschanged: false,
... ... @@ -529,7 +529,7 @@ Page({
529 529 return
530 530 }
531 531 that.setData({
532   - is_certified: 'active',
  532 + idInfoData: id_info,
533 533 name: id_info.name,
534 534 birthday: birth_day,
535 535 cardtypeData: cardtype_Data,
... ... @@ -698,7 +698,6 @@ Page({
698 698 birth_date.selected = e.detail.value
699 699 console.log('birthdayChange', Date.parse(new Date(e.detail.value)))
700 700 this.setData({
701   - birthday: e.detail.value,
702 701 long_birth_date: Date.parse(new Date(e.detail.value)) / 1000,
703 702 birthDate: birth_date
704 703 })
... ... @@ -850,7 +849,7 @@ Page({
850 849 url: baseUrl + 'persontax/v1/personal-taxes/' + that.data.cur_id,
851 850 method: "PUT",
852 851 data: {
853   - 'certification_status': '',
  852 + 'certification_status': that.getCertifyStatus(formdata),
854 853 "name": formdata.name.length > 0 ? formdata.name : that.data.name,
855 854 "family_ties": that.data.relativeData.selected,
856 855 "native": "中国",
... ... @@ -987,6 +986,20 @@ Page({
987 986 })
988 987 },
989 988
  989 + getCertifyStatus: function (formdata) {
  990 + var iddata = this.data.idInfoData;
  991 + var name = this.data.name.length > 0 ? this.data.name : formdata.name;
  992 + var cardtype = this.data.cardtypeData.selected;
  993 + var card_no = formdata.id_card_no ? formdata.id_card_no : this.data.card_number;
  994 + var gender = this.data.genderData.selected;
  995 + var birth_day = this.data.birthDate.selected;
  996 + if (name == iddata.name && cardtype == '居民身份证' && card_no == iddata.id_card_number && gender == iddata.gender && birth_day == this.data.birthday) {
  997 + return 'active'
  998 + } else {
  999 + return ''
  1000 + }
  1001 + },
  1002 +
990 1003 /**
991 1004 * 生命周期函数--监听页面隐藏
992 1005 */
... ...
注册登录 后发表评论