提交 61b6ce5f64e76fde94bbbca823434d1f85203f76

作者 wangyu
1 个父辈 4dae7dcb

优化

... ... @@ -603,7 +603,7 @@ Page({
603 603 // var pro_index = this.data.profession_index
604 604 // var profession_datas = this.data.professionData.values[pro_index[pro_index[0]]][0]
605 605 // console.log('profession_datas', profession_datas)
606   -
  606 + var regMobile = /^1[3|4|5|7|8][0-9]{9}$/;
607 607 var formdata = e.detail.value;
608 608 console.log("formdata", formdata);
609 609 if (formdata.name.length < 1) {
... ... @@ -624,8 +624,8 @@ Page({
624 624 } else if (!this.data.isIdCard && (!formdata.id_card_no || formdata.id_card_no.length < 1)) {
625 625 this.showtoast('请输入证件号码');
626 626 return
627   - } else if (formdata.mobile.length < 1) {
628   - this.showtoast('请输入联系电话');
  627 + } else if (formdata.mobile.length < 1 || !regMobile.test(formdata.mobile) ) {
  628 + this.showtoast('请输入有效手机号');
629 629 return
630 630 } else if (this.data.investInfo.selected.length < 1) {
631 631 this.showtoast('请选择是否股东投资者');
... ...
... ... @@ -165,7 +165,7 @@
165 165 <view class="divide_line"></view>
166 166 <view class='item_body'>
167 167 <text class='text_666_28 float_left'>备注</text>
168   - <input class='extra_input float_right' type='number' value='{{taxInfo.comment}}' name='comment' placeholder-class='text_999_28' placeholder='请输入备注' ></input>
  168 + <input class='input_wrap float_right' type='number' value='{{taxInfo.comment}}' name='comment' placeholder-class='text_999_28' placeholder='请输入备注' ></input>
169 169 </view>
170 170 </view>
171 171 </view>
... ...
... ... @@ -20,6 +20,8 @@ Page({
20 20 profession_haschanges: false,
21 21 name: '',
22 22 mobile: '',
  23 + birthday: '',
  24 + id_error:false,
23 25 card_number: '',
24 26 long_birth_date: 0,
25 27 long_start_date: 0,
... ... @@ -438,16 +440,51 @@ Page({
438 440 /**
439 441 * 生命周期函数--监听页面显示
440 442 */
441   - onShow: function() {
  443 + onShow: function () {
442 444 var that = this
  445 + var id_error = this.data.id_error
443 446 wx.getStorage({
444 447 key: 'id_info',
445   - success: function(res) {
446   - console.log(res.data)
447   - that.setData({
448   - name: res.data.name,
449   - card_number: res.data.card_number
450   - })
  448 + success: function (res) {
  449 + console.log('id_info', res.data)
  450 + if (res.data && res.data.length > 0) {
  451 + var id_info = JSON.parse(res.data)
  452 +
  453 + var birth_day = id_info.birthday.year + '-' + id_info.birthday.month + '-' + id_info.birthday.day;
  454 + var cardtype_Data = that.data.cardtypeData
  455 + cardtype_Data.selected = '居民身份证'
  456 + var gender_Data = that.data.genderData
  457 + gender_Data.selected = id_info.gender
  458 +
  459 + that.data.birthDate.selected = birth_day
  460 +
  461 + if (that.data.name.length > 0 && id_info.name != that.data.name) {
  462 + that.showtoast("证照与所填姓名冲突")
  463 + id_error = true
  464 + return
  465 + }
  466 + if (that.data.card_number.length > 0 && id_info.card_number != that.data.id_card_no) {
  467 + that.showtoast("证照与所填证照号码冲突")
  468 + id_error = true
  469 + return
  470 + }
  471 + that.setData({
  472 + name: id_info.name,
  473 + birthday: birth_day,
  474 + cardtypeData: cardtype_Data,
  475 + genderData: gender_Data,
  476 + birthDate: that.data.birthDate,
  477 + card_number: id_info.id_card_number
  478 + })
  479 + console.log('-cardtypeData--', that.data.cardtypeData)
  480 +
  481 + }
  482 + },
  483 + })
  484 + wx.removeStorage({
  485 + key: 'id_info',
  486 + success: function (res) {
  487 + console.log('remove_idinfo', res)
451 488 },
452 489 })
453 490 },
... ...
... ... @@ -165,7 +165,7 @@
165 165 <view class="divide_line"></view>
166 166 <view class='item_body'>
167 167 <text class='text_666_28 float_left'>备注</text>
168   - <input class='extra_input float_right' type='number' value='{{taxInfo.comment}}' name='comment' placeholder-class='text_999_28' placeholder='请输入备注' ></input>
  168 + <input class='input_wrap float_right' type='number' value='{{taxInfo.comment}}' name='comment' placeholder-class='text_999_28' placeholder='请输入备注' ></input>
169 169 </view>
170 170 </view>
171 171 </view>
... ...
... ... @@ -124,7 +124,6 @@ Page({
124 124 })
125 125 }
126 126 that.checkAndupload()
127   - wx.hideLoading()
128 127 } else {
129 128 var title = '图片上传失败,请重新上传'
130 129 if (res.statusCode == 413) {
... ... @@ -146,13 +145,14 @@ Page({
146 145 confirmColor: '#4E8FE7'
147 146 })
148 147 },
  148 + complete(res){
  149 + console.log('complete', res.data)
  150 + wx.hideLoading()
  151 + }
149 152 })
150 153 },
151 154
152 155 checkAndupload: function() {
153   - wx.showLoading({
154   - title: '解析图片中...',
155   - })
156 156 var that = this
157 157 var frontdata = that.data.front_card_info
158 158 var backdata = that.data.back_card_info
... ... @@ -164,6 +164,9 @@ Page({
164 164 if (!backdata || !backdata.object_id) {
165 165 return;
166 166 }
  167 + wx.showLoading({
  168 + title: '解析图片中...',
  169 + })
167 170 var Authorization = getApp().globalData.Authorization;
168 171 wx.request({
169 172 url: baseUrl + 'common/v1/ocr/id-card-verify',
... ... @@ -195,6 +198,10 @@ Page({
195 198 fail(res) {
196 199 console.log('fail', res.data)
197 200 wx.hideLoading()
  201 + },
  202 + complete(res){
  203 + console.log('complete', res.data)
  204 + wx.hideLoading()
198 205 }
199 206 })
200 207 },
... ...
注册登录 后发表评论