提交 a044f30784d2ad0f63eac2e5d0fb8e1e0de83c0d

作者 wangyu
1 个父辈 48948b58

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

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