提交 c7f66f373226795c4c4c927d253ba6265bda0b59

作者 wangyu
1 个父辈 256a0d01

身份证识别 自然人添加等相关优化

1 1 <template name="picker_cell_normal">
2 2 <view class='item_body'>
3   - <text style='color:red;font-size: 28rpx;line-height: 80rpx;float:left'>*</text>
4   - <text class='text_black_28 float_left'>{{label}}</text>
  3 + <text hidden='{{!isrequre}}' style='color:red;font-size: 28rpx;line-height: 80rpx;float:left'>*</text>
  4 + <view wx:if='{{isrequre}}'>
  5 + <text class='text_black_28 float_left'>{{label}}</text>
  6 + </view>
  7 + <view wx:else>
  8 + <text class='text_666_28 float_left'>{{label}}</text>
  9 + </view>
5 10 <image class='arrow_wrap' src='/images/arrow_right.png'></image>
6 11
7 12 <view class="weui-cell__bd">
8 13 <picker mode="{{mode?mode:'selector'}}" range-key="{{range_key}}" range="{{values}}" fields="{{fields}}" start="{{start}}" end="{{end}}" bindchange="{{onChange}}" bindcolumnchange="{{onColumnChange}}" disabled="{{disabled}}">
9 14 <view wx:if="{{selected}}" class="text_333_28 float_right">{{selected}}</view>
10   - <view wx:elif="{{placeholder}}" class="cell_right_label">{{placeholder}}</view>
  15 + <view wx:elif="{{placeholder}}" class="text_333_28 float_right">{{placeholder}}</view>
11 16 </picker>
12 17 </view>
13 18
... ...
1 1 // pages/main//editinfo/editinfo.js
  2 +var app = getApp();
  3 +var baseUrl = app.globalData.baseUrl;
2 4 Page({
3 5
4 6 /**
... ... @@ -8,27 +10,37 @@ Page({
8 10 isshow01: false,
9 11 isshow02: false,
10 12 isshow03: false,
11   - singleDatas: [],
  13 + taxInfo:{},
  14 + proffessiondata:{},
  15 + bankinfo:{},
  16 + name:'',
  17 + id_card_number:'',
  18 +
  19 +
12 20 relativeData: {
  21 + isrequre: true,
13 22 label: '关系',
14 23 selected: '请选择关系',
15 24 values: ["子女", "配偶"],
16 25 onChange: 'onPickerSelect'
17 26 },
18 27 personstatusData: {
  28 + isrequre: true,
19 29 label: '纳税人状态',
20 30 selected: '请选择纳税人状态',
21 31 values: ["正常(在职)", "非正常"],
22 32 onChange: 'onPickerSelect'
23 33 },
24 34 cardtypeData: {
  35 + isrequre: true,
25 36 label: '证照类型',
26 37 selected: '居民身份证',
27 38 values: ["居民身份证", "军官证",'士兵证','武警警官证','港澳居民来往大陆通行证','外交官证','中国护照',
28 39 '外国护照','香港永久性居民身份证','澳门特别行政区永久性居民身份证','台湾身份证','外国人永久居留证'],
29 40 onChange: 'onPickerSelect'
30 41 },
31   - relativeData: {
  42 + forignerInfo: {
  43 + isrequre: true,
32 44 label: '是否境外人员',
33 45 selected: '否',
34 46 values: ["否", "是"],
... ... @@ -46,36 +58,72 @@ Page({
46 58 values: ["研究生", "大学本科",'大学本科以下'],
47 59 onChange: 'onPickerSelect'
48 60 },
49   - deformityData: {
  61 + deformityInfo: {
50 62 label: '是否残疾',
51   - selected: '',
  63 + selected: '请选择是否残疾',
52 64 values: ["否", "是"],
53 65 onChange: 'onPickerSelect'
54 66 },
55   - lieshuData: {
  67 + lieshuInfo: {
56 68 label: '是否烈属',
57   - selected: '',
  69 + selected: '请选择是否烈属',
58 70 values: ["否", "是"],
59 71 onChange: 'onPickerSelect'
60 72 },
61   - lonelyolderData: {
  73 + lonelyolderInfo: {
62 74 label: '是否孤老',
63   - selected: '',
  75 + selected: '请选择是否孤老',
64 76 values: ["否", "是"],
65 77 onChange: 'onPickerSelect'
66 78 },
67   - employeeData: {
  79 + investInfo: {
  80 + isrequre: true,
  81 + label: '是否股东、投资者',
  82 + selected: '请选择是否股东、投资者',
  83 + values: ["否", "是"],
  84 + onChange: 'onPickerSelect'
  85 + },
  86 + professionInfo: {
  87 + isrequre: true,
  88 + label: '是否特定行业',
  89 + selected: '请选择是否特定行业',
  90 + values: ["否", "是"],
  91 + onChange: 'onPickerSelect'
  92 + },
  93 + employeeInfo: {
68 94 label: '是否雇员',
69   - selected: '',
  95 + selected: '请选择是否雇员',
70 96 values: ["否", "是"],
71 97 onChange: 'onPickerSelect'
72 98 },
73   - investpersonData: {
  99 + investpersonalInfo: {
74 100 label: '是否天使投资个人',
75   - selected: '',
  101 + selected: '请选择是否天使投资个人',
76 102 values: ["否", "是"],
77 103 onChange: 'onPickerSelect'
78 104 },
  105 + // 时间picker
  106 + birthDate: {
  107 + label: '出生年月',
  108 + placeholder: '请选择出生日期',
  109 + mode: "date",
  110 + fields: "day",
  111 + onChange: 'birthdayChange',
  112 + },
  113 + startDate: {
  114 + label: '在职受雇日期',
  115 + placeholder: '请选择受雇日期',
  116 + mode: "date",
  117 + fields: "day",
  118 + onChange: 'startChange',
  119 + },
  120 + endDate: {
  121 + label: '离职日期',
  122 + placeholder: '请选择离职日期',
  123 + mode: "date",
  124 + fields: "day",
  125 + onChange: 'endChange',
  126 + },
79 127 condition: false
80 128 },
81 129
... ... @@ -83,7 +131,76 @@ Page({
83 131 * 生命周期函数--监听页面加载
84 132 */
85 133 onLoad: function(options) {
  134 + console.log(options.id)
  135 + this.getpersonalTax(options.id)
  136 + this.getproffessiondata()
  137 + this.getbanklist()
  138 + },
86 139
  140 + getpersonalTax:function(id){
  141 + var that = this
  142 + var Authorization = app.globalData.Authorization;
  143 + wx.request({
  144 + url: baseUrl + 'persontax/v1/personal-taxes/'+id,
  145 + method: "GET",
  146 + header: {
  147 + 'content-type': 'application/json', // 默认值
  148 + "Authorization": Authorization
  149 + },
  150 + success: function (res) {
  151 + console.log(res)
  152 + that.setData({
  153 + taxInfo: res.data
  154 + })
  155 + },
  156 + fail(res) {
  157 + console.log(res)
  158 + }
  159 + })
  160 + },
  161 +
  162 + getproffessiondata:function(){
  163 + var that = this
  164 + var Authorization = app.globalData.Authorization;
  165 + wx.request({
  166 + url: baseUrl + 'common/v1/professions',
  167 + method: "GET",
  168 + header: {
  169 + 'content-type': 'application/json', // 默认值
  170 + "Authorization": Authorization
  171 + },
  172 + success: function (res) {
  173 + console.log(res)
  174 + that.setData({
  175 + proffessiondata:res.data
  176 + })
  177 + },
  178 + fail(res) {
  179 + console.log(res)
  180 + }
  181 + })
  182 + },
  183 +
  184 + getbanklist: function () {
  185 + var that = this
  186 + var Authorization = app.globalData.Authorization;
  187 + wx.request({
  188 + url: baseUrl + 'walletmgm/v1/bankinfos',
  189 + method: "GET",
  190 + header: {
  191 + 'content-type': 'application/json', // 默认值
  192 + "Authorization": Authorization
  193 + },
  194 + success: function (res) {
  195 + console.log(res)
  196 + that.setData({
  197 + bankinfo: res.data
  198 + })
  199 + },
  200 + fail(res) {
  201 + console.log(res)
  202 + }
  203 + })
87 204 },
88 205
89 206 /**
... ... @@ -97,7 +214,17 @@ Page({
97 214 * 生命周期函数--监听页面显示
98 215 */
99 216 onShow: function() {
100   - console.log(this.data.isshow01)
  217 + var that = this
  218 + wx.getStorage({
  219 + key: 'id_info',
  220 + success: function(res) {
  221 + console.log(res.data)
  222 + that.setData({
  223 + name:res.data.name,
  224 + id_card_number: res.data.id_card_number
  225 + })
  226 + },
  227 + })
101 228 },
102 229
103 230 span: function(e) {
... ...
1 1 <!--pages/main//editinfo/editinfo.wxml-->
2   -<import src="../../common/picker_cell_normal"/>
  2 +<import src="../../common/picker_cell_normal" />
3 3
4 4 <view class='page'>
5 5 <form bindsubmit='formBindSubmit'>
6 6
7 7 <!-- 成员关系 -->
8   - <view class='head_wrap'>
  8 + <view class='head_wrap' hidden="{{taxInfo.family_ties?false:true}}">
9 9 <text class='head_text_wrap1'>成员关系</text>
10 10 </view>
11   - <view class='data_list'>
  11 + <view class='data_list' hidden="{{taxInfo.family_ties?false:true}}">
12 12 <view class='data_item'>
13 13 <view class='item_body'>
14 14 <text style='color:red;font-size: 28rpx;line-height: 80rpx;float:left'>*</text>
15 15 <text class='text_black_28 float_left'>姓名</text>
16   - <input class='input_wrap float_right' placeholder='请填写姓名'></input>
  16 + <input class='input_wrap float_right' placeholder='请填写姓名' value='{{name}}'></input>
17 17 </view>
18 18 <view class="divide_line"></view>
19 19 <!-- <view class='item_body' bindtap='openpicker'>
... ... @@ -23,8 +23,8 @@
23 23 <text class='text_333_28 float_right'>请选择关系</text>
24 24 </view> -->
25 25
26   - <template is="picker_cell_normal" data="{{...relativeData}}"/>
27   - </view>
  26 + <template is="picker_cell_normal" data="{{...relativeData}}" />
  27 + </view>
28 28 </view>
29 29
30 30 <!-- 基本信息 -->
... ... @@ -42,65 +42,70 @@
42 42
43 43 <view class='data_list'>
44 44 <view class='data_item'>
45   - <view class='item_body'>
  45 + <view class='item_body' hidden="{{taxInfo.family_ties?true:false}}">
46 46 <text style='color:red;font-size: 28rpx;line-height: 80rpx;float:left'>*</text>
47 47 <text class='text_black_28 float_left'>姓名</text>
48   - <input class='input_wrap float_right' placeholder='请填写姓名'></input>
  48 + <input class='input_wrap float_right' placeholder='请填写姓名' value='{{taxInfo.name}}'></input>
49 49 </view>
50 50 <view class="divide_line"></view>
51 51
52 52 <view class='item_body'>
53 53 <text style='color:red;font-size: 28rpx;line-height: 80rpx;float:left'>*</text>
54 54 <text class='text_black_28 float_left'>国籍(地区)</text>
55   - <input class='input_wrap float_right'></input>
  55 + <input class='input_wrap float_right' value='中国'></input>
56 56 </view>
57 57 <view class="divide_line"></view>
58 58
59   - <view class='item_body'>
  59 + <!-- <view class='item_body'>
60 60 <text style='color:red;font-size: 28rpx;line-height: 80rpx;float:left'>*</text>
61 61 <text class='text_black_28 float_left'>纳税人状态</text>
62 62 <image class='arrow_wrap' src='/images/arrow_right.png'></image>
63 63 <text class='text_333_28 float_right'>在职</text>
64   - </view>
  64 + </view> -->
  65 + <template is="picker_cell_normal" data="{{...personstatusData}}" />
65 66 <view class="divide_line"></view>
66 67
67   - <view class='item_body'>
  68 + <!-- <view class='item_body'>
68 69 <text style='color:red;font-size: 28rpx;line-height: 80rpx;float:left'>*</text>
69 70 <text class='text_black_28 float_left'>证照类型</text>
70 71 <image class='arrow_wrap' src='/images/arrow_right.png'></image>
71 72 <text class='text_333_28 float_right'>居民身份证</text>
72   - </view>
  73 + </view> -->
  74 + <template is="picker_cell_normal" data="{{...cardtypeData}}" />
73 75 <view class="divide_line"></view>
74 76
75 77 <view class='item_body' bindtap='getIdInfo'>
76 78 <text style='color:red;font-size: 28rpx;line-height: 80rpx;float:left'>*</text>
77 79 <text class='text_black_28 float_left'>证照号码</text>
78 80 <image class='image_camera float_right' src='/images/camera.png'></image>
79   - <text class='text_333_28 float_right'></text>
  81 + <text class='text_333_28 float_right'>{{id_card_number}}</text>
80 82 </view>
81 83 <view class="divide_line"></view>
82 84
83   - <view class='item_body'>
  85 + <!-- <view class='item_body'>
84 86 <text class='head_red_star float_left'>*</text>
85 87 <text class='text_black_28 float_left'>是否境外人员</text>
86 88 <image class='arrow_wrap' src='/images/arrow_right.png'></image>
87 89 <text class='text_333_28 float_right'>否</text>
88   - </view>
  90 + </view> -->
  91 + <template is="picker_cell_normal" data="{{...forignerInfo}}" />
89 92 <!-- 非必填部分 -->
90 93 <view hidden='{{!isshow01}}'>
91 94 <view class="divide_line"></view>
92 95
93   - <view class='item_body'>
  96 + <!-- <view class='item_body'>
94 97 <text class='text_666_28 float_left'>性别</text>
95 98 <image class='arrow_wrap' src='/images/arrow_right.png'></image>
96 99 <text class='text_333_28 float_right'>男</text>
97   - </view>
  100 + </view> -->
  101 + <template is="picker_cell_normal" data="{{...genderData}}" />
98 102 <view class="divide_line"></view>
99   - <view class='item_body'>
  103 + <!-- <view class='item_body'>
100 104 <text class='text_666_28 float_left'>出生年月</text>
101 105 <image class='arrow_wrap' src='/images/arrow_right.png'></image>
102 106 <text class='text_333_28 float_right'></text>
103   - </view>
  107 + </view> -->
  108 + <template is="picker_cell_normal" data="{{...birthDate}}" />
104 109 <view class="divide_line"></view>
105 110 <view class='item_body'>
106 111 <text class='text_666_28 float_left'>职业</text>
... ... @@ -108,44 +113,48 @@
108 113 <text class='text_333_28 float_right'>经理</text>
109 114 </view>
110 115 <view class="divide_line"></view>
111   - <view class='item_body'>
  116 + <!-- <view class='item_body'>
112 117 <text class='text_666_28 float_left'>学历</text>
113 118 <image class='arrow_wrap' src='/images/arrow_right.png'></image>
114 119 <text class='text_333_28 float_right'></text>
115   - </view>
  120 + </view> -->
  121 + <template is="picker_cell_normal" data="{{...degreeData}}" />
116 122 <view class="divide_line"></view>
117 123 <view class='item_body'>
118 124 <text class='text_666_28 float_left'>纳税人识别号</text>
119 125 <input class='input_wrap float_right'></input>
120 126 </view>
121 127 <view class="divide_line"></view>
122   - <view class='item_body'>
  128 + <!-- <view class='item_body'>
123 129 <text class='text_666_28 float_left'>是否残疾</text>
124 130 <image class='arrow_wrap' src='/images/arrow_right.png'></image>
125 131 <text class='text_333_28 float_right'></text>
126   - </view>
  132 + </view> -->
  133 + <template is="picker_cell_normal" data="{{...deformityInfo}}" />
127 134 <view class="divide_line"></view>
128 135 <view class='item_body'>
129 136 <text class='text_666_28 float_left'>残疾证号</text>
130 137 <input class='input_wrap float_right'></input>
131 138 </view>
132 139 <view class="divide_line"></view>
133   - <view class='item_body'>
  140 + <!-- <view class='item_body'>
134 141 <text class='text_666_28 float_left'>是否烈属</text>
135 142 <image class='arrow_wrap' src='/images/arrow_right.png'></image>
136 143 <text class='text_333_28 float_right'></text>
137   - </view>
  144 + </view> -->
  145 + <template is="picker_cell_normal" data="{{...lieshuInfo}}" />
138 146 <view class="divide_line"></view>
139 147 <view class='item_body'>
140 148 <text class='text_666_28 float_left'>烈属证号</text>
141 149 <input class='input_wrap float_right'></input>
142 150 </view>
143 151 <view class="divide_line"></view>
144   - <view class='item_body'>
  152 + <!-- <view class='item_body'>
145 153 <text class='text_666_28 float_left'>是否孤老</text>
146 154 <image class='arrow_wrap' src='/images/arrow_right.png'></image>
147 155 <text class='text_333_28 float_right'></text>
148   - </view>
  156 + </view> -->
  157 + <template is="picker_cell_normal" data="{{...lonelyolderInfo}}" />
149 158 </view>
150 159 </view>
151 160 </view>
... ... @@ -167,7 +176,7 @@
167 176 <view class='item_body'>
168 177 <text style='color:red;font-size: 28rpx;line-height: 80rpx;float:left'>*</text>
169 178 <text class='text_black_28 float_left'>联系电话</text>
170   - <input class='input_wrap float_right' placeholder='请填写电话'></input>
  179 + <input class='input_wrap float_right' placeholder='请填写电话' value='{{taxInfo.mobile}}'></input>
171 180 </view>
172 181 <!-- 非必填部分02 -->
173 182 <view hidden='{{!isshow02}}'>
... ... @@ -266,11 +275,13 @@
266 275 <input class='input_wrap float_right'></input>
267 276 </view>
268 277 <view class="divide_line"></view>
269   - <view class='item_body'>
  278 + <!-- <view class='item_body'>
270 279 <text class='text_666_28 float_left'>在职受雇日期</text>
271 280 <image class='arrow_wrap' src='/images/arrow_right.png'></image>
272 281 <text class='text_333_28 float_right'></text>
273   - </view>
  282 + </view> -->
  283 + <template is="picker_cell_normal" data="{{...startDate}}" />
  284 +
274 285 <view class="divide_line"></view>
275 286 <view class='item_body'>
276 287 <text class='text_666_28 float_left'>离职日期</text>
... ... @@ -311,4 +322,4 @@
311 322 </form>
312 323 </view>
313 324
314   -<!-- 普通选择器 -->
  325 +<!-- 普通选择器 -->
\ No newline at end of file
... ...
... ... @@ -61,7 +61,7 @@
61 61 width: 500rpx;
62 62 height: 80rpx;
63 63 font-size: 28rpx;
64   - color: #999;
  64 + color: #333;
65 65 text-align: right;
66 66 overflow: hidden;
67 67 text-overflow: ellipsis;
... ...
... ... @@ -35,7 +35,7 @@ Page({
35 35 var that = this;
36 36 var Authorization = app.globalData.Authorization;
37 37 wx.request({
38   - url: baseUrl + 'payroll/v1/personal-taxes',
  38 + url: baseUrl + 'persontax/v1/personal-taxes',
39 39 method: "GET",
40 40 header: {
41 41 'content-type': 'application/json', // 默认值
... ... @@ -53,10 +53,10 @@ Page({
53 53 })
54 54 },
55 55
56   - goadd:function(){
57   - console.log("goadd")
  56 + goadd:function(e){
  57 + console.log(e)
58 58 wx.navigateTo({
59   - url: '../editinfo/editinfo',
  59 + url: '../editinfo/editinfo?id=' + e.currentTarget.id,
60 60 })
61 61 },
62 62
... ...
1 1 <view class='page'>
2 2
3 3 <view wx:if="{{taxlist.length>0}}">
4   - <block wx:for="{{taxlist}}" wx:key="">
5   - <view class='rectangle_solid_bg' bindtap='goadd'>
  4 + <block wx:for="{{taxlist}}" wx:key="" indx='index'>
  5 + <view class='rectangle_solid_bg' bindtap='goadd' id='{{item.id}}' >
6 6 <view style='padding:12rpx 22rpx'>
7 7 <text class='text_black_28'>{{item.name}}</text>
8   - <text class='rectangle_orange_bg text_red_20' hidden="true">子女</text>
  8 + <text class='rectangle_orange_bg text_red_20' hidden="{{item.family_ties?false:true}}">{{item.family_ties}}</text>
9 9 <image class='arrow_wrap' src='/images/arrow_right.png'> </image>
10 10 <text class='text_light_blue_28' style='float:right'>去完善</text>
11 11
... ... @@ -21,7 +21,7 @@
21 21 </block>
22 22 </view>
23 23
24   - <view class='rectangle_dashed_bg' bindtap="goadd">
  24 + <view class='rectangle_dashed_bg' bindtap="goadd" id='add'>
25 25 <view class='text_blue_28' style='padding:14rpx'>
26 26 十 添加家庭成员
27 27 </view>
... ...
1   -// pages/main/idinfo/idinfo.js
  1 +var OSSInit;
  2 +var baseUrl = getApp().globalData.baseUrl;
  3 +var OSSUrl = getApp().globalData.OSSUrl;
2 4 Page({
3 5
4 6 /**
5 7 * 页面的初始数据
6 8 */
7 9 data: {
8   -
  10 + facepath: '',
  11 + front_card_info: {},
  12 + backpath: '',
  13 + back_card_info: {},
  14 + idInfo: {},
  15 + flag: ''
9 16 },
10 17
11 18 /**
12 19 * 生命周期函数--监听页面加载
13 20 */
14   - onLoad: function (options) {
15   -
  21 + onLoad: function(options) {
  22 + this.initOSS()
  23 + },
  24 +
  25 + initOSS: function() {
  26 + var that = this
  27 + var Authorization = getApp().globalData.Authorization;
  28 + //OSS 上传前init
  29 + wx.showLoading()
  30 + wx.request({
  31 + url: baseUrl + "filemeta/v1/inits",
  32 + header: {
  33 + 'Authorization': Authorization
  34 + },
  35 + method: 'POST',
  36 + data: {
  37 + "access_type": "web_upload",
  38 + "action ": "put_object",
  39 + "instance_id": "",
  40 + "object_type": "wx_image"
  41 + },
  42 + success: function(result) {
  43 +
  44 + OSSInit = result.data
  45 + console.log(' OSS init 成功', OSSInit)
  46 + },
  47 + fail: function(res) {
  48 + console.log('OSS init 失败', res)
  49 + },
  50 + complete: function() {
  51 + wx.hideLoading()
  52 + }
  53 + })
16 54 },
17 55
18 56 /**
19 57 * 生命周期函数--监听页面初次渲染完成
20 58 */
21   - onReady: function () {
22   -
  59 + onReady: function() {
  60 +
23 61 },
24 62
25 63 /**
26 64 * 生命周期函数--监听页面显示
27 65 */
28   - onShow: function () {
29   -
  66 + onShow: function() {
  67 +
  68 + },
  69 +
  70 + chooseImage: function(e) {
  71 + console.log(e)
  72 + var that = this
  73 + wx.chooseImage({
  74 + sourceType: ['camera', 'album'],
  75 + sizeType: ['original'],
  76 + count: 1,
  77 + success: function(res) {
  78 + console.log('success', res)
  79 + if ("id_face" == e.currentTarget.id) {
  80 + that.setData({
  81 + facepath: res.tempFilePaths[0]
  82 + })
  83 + that.uploadImage(that.data.facepath, 'id_face')
  84 + } else if ("id_back" == e.currentTarget.id) {
  85 + that.setData({
  86 + backpath: res.tempFilePaths[0]
  87 + })
  88 + that.uploadImage(that.data.backpath, 'id_back')
  89 + }
  90 + }
  91 + })
  92 + },
  93 +
  94 + uploadImage: function(path, str) {
  95 + var that = this
  96 + wx.showLoading({
  97 + title: '上传图片中...',
  98 + })
  99 + wx.uploadFile({
  100 + url: OSSUrl,
  101 + filePath: path,
  102 + name: 'file',
  103 + formData: {
  104 + 'key': 'imagepath_' + path.substring(path.length - 10, path.length),
  105 + 'OSSAccessKeyId': OSSInit.access_key_id,
  106 + 'policy': OSSInit.policy,
  107 + 'signature': OSSInit.signature,
  108 + 'callback': OSSInit.callback_body,
  109 + 'x:access_token': OSSInit.callback_token,
  110 + 'success_action_status': '200',
  111 + },
  112 + success: function(res) {
  113 + if (res.statusCode == 200) {
  114 + var data = JSON.parse(res.data)
  115 + console.log('上传成功', res)
  116 + that.oss_bucket = data.bucket
  117 + if ("id_face" == str) {
  118 + that.setData({
  119 + front_card_info: data
  120 + })
  121 + } else if ("id_back" == str) {
  122 + that.setData({
  123 + back_card_info: data
  124 + })
  125 + }
  126 + that.checkAndupload()
  127 + wx.hideLoading()
  128 + } else {
  129 + var title = '图片上传失败,请重新上传'
  130 + if (res.statusCode == 413) {
  131 + title = '图片体积过大,请选择较小图片上传'
  132 + }
  133 + wx.showModal({
  134 + title: '上传失败',
  135 + content: title,
  136 + showCancel: false,
  137 + confirmColor: '#4E8FE7'
  138 + })
  139 + }
  140 + },
  141 + fail: function(err) {
  142 + wx.showModal({
  143 + title: '上传失败',
  144 + content: '图片上传失败,请重新上传',
  145 + showCancel: false,
  146 + confirmColor: '#4E8FE7'
  147 + })
  148 + },
  149 + })
  150 + },
  151 +
  152 + checkAndupload: function() {
  153 + wx.showLoading({
  154 + title: '解析图片中...',
  155 + })
  156 + var that = this
  157 + var frontdata = that.data.front_card_info
  158 + var backdata = that.data.back_card_info
  159 + console.log('frontdata', frontdata)
  160 + console.log('backdata', backdata)
  161 + if (!frontdata || !frontdata.object_id) {
  162 + return;
  163 + }
  164 + if (!backdata || !backdata.object_id) {
  165 + return;
  166 + }
  167 + var Authorization = getApp().globalData.Authorization;
  168 + wx.request({
  169 + url: baseUrl + 'common/v1/ocr/id-card-verify',
  170 + method: "POST",
  171 + header: {
  172 + 'content-type': 'application/json', // 默认值
  173 + "Authorization": Authorization
  174 + },
  175 + data: {
  176 + front_card_copy: that.data.front_card_info,
  177 + back_card_copy: backdata
  178 + },
  179 + success: function(res) {
  180 + console.log('suc', res)
  181 + if (res.statusCode < 300) {
  182 + that.setData({
  183 + idInfo: res.data.item
  184 + })
  185 + console.log('suc', that.data.idInfo)
  186 + } else {
  187 + wx.showToast({
  188 + image: "/images/warn.png",
  189 + duration: 1000,
  190 + title: res.data.message?res.data.message:"数据错误"
  191 + });
  192 + }
  193 + wx.hideLoading()
  194 + },
  195 + fail(res) {
  196 + console.log('fail', res.data)
  197 + wx.hideLoading()
  198 + }
  199 + })
  200 + },
  201 +
  202 + savedata:function(){
  203 + wx.setStorage({
  204 + key: 'id_info',
  205 + data: JSON.stringify(this.data.idInfo),
  206 + })
  207 + wx.navigateBack({
  208 + delta:1
  209 + })
30 210 },
31 211
32 212 /**
33 213 * 生命周期函数--监听页面隐藏
34 214 */
35   - onHide: function () {
36   -
  215 + onHide: function() {
  216 +
37 217 },
38 218
39 219 /**
40 220 * 生命周期函数--监听页面卸载
41 221 */
42   - onUnload: function () {
43   -
  222 + onUnload: function() {
  223 + wx.showModal({
  224 + title: '',
  225 + content: '\n您的信息还未保存是否确认返回?\n',
  226 + })
44 227 },
45 228
46 229 /**
47 230 * 页面相关事件处理函数--监听用户下拉动作
48 231 */
49   - onPullDownRefresh: function () {
50   -
  232 + onPullDownRefresh: function() {
  233 +
51 234 },
52 235
53 236 /**
54 237 * 页面上拉触底事件的处理函数
55 238 */
56   - onReachBottom: function () {
57   -
  239 + onReachBottom: function() {
  240 +
58 241 },
59 242
60 243 /**
61 244 * 用户点击右上角分享
62 245 */
63   - onShareAppMessage: function () {
64   -
  246 + onShareAppMessage: function() {
  247 +
65 248 }
66 249 })
\ No newline at end of file
... ...
1 1 <!--pages/main/idinfo/idinfo.wxml-->
2 2 <view class='page'>
3 3 <view class='text_999_24'>身份证正面</view>
4   - <view class='id_background'>
5   - <image class='id_image_wrap' src='/images/id_face.png'></image>
  4 + <view class='id_background' bindtap="chooseImage" id='id_face'>
  5 + <image class='id_image_wrap' src="{{facepath?facepath:'/images/id_face.png'}}"></image>
6 6 </view>
7 7 <view class='text_999_24'>身份证反面</view>
8   - <view class='id_background'>
9   - <image class='id_image_wrap' src='/images/id_back.png'></image>
  8 + <view class='id_background' bindtap="chooseImage" id='id_back'>
  9 + <image class='id_image_wrap' src="{{backpath?backpath:'/images/id_back.png'}}"></image>
10 10 </view>
11 11
12 12 <view style='background-color:#fff;padding:0 32rpx ;margin-top:20rpx'>
13 13 <view class='item_body'>
14 14 <text class='text_666_28 float_left'>性别</text>
15   - <text class='text_333_28 float_right'></text>
  15 + <text class='text_333_28 float_right'>{{idInfo.gender}}</text>
16 16 </view>
17 17 <view class="divide_line"></view>
18 18 <view class='item_body'>
19 19 <text class='text_666_28 float_left'>出生年月</text>
20   - <text class='text_333_28 float_right'>2000-01-01</text>
  20 + <text class='text_333_28 float_right'>{{idInfo.birthday.year}}-{{idInfo.birthday.month}}-{{idInfo.birthday.day}}</text>
21 21 </view>
22 22 <view class="divide_line"></view>
23 23 <view class='item_body'>
24 24 <text class='text_666_28 float_left'>身份证号码</text>
25   - <text class='text_333_28 float_right'>001</text>
  25 + <text class='text_333_28 float_right'>{{idInfo.id_card_number}}</text>
26 26 </view>
27 27 <view class="divide_line"></view>
28 28 <view class='item_body'>
29 29 <text class='text_666_28 float_left'>户籍所在地</text>
30   - <text class='text_333_28 float_right'>北京</text>
  30 + <text class='text_333_28 float_right'>{{idInfo.address}}</text>
31 31 </view>
32 32 </view>
33   -
  33 +
34 34 <view style='height:120rpx'></view>
35   - <button class="btn_bottom" > 保存</button>
  35 + <button class="btn_bottom" bindtap='savedata'> 保存</button>
36 36 </view>
\ No newline at end of file
... ...
注册登录 后发表评论