正在显示
3 个修改的文件
包含
202 行增加
和
22 行删除
@@ -3,12 +3,14 @@ var OSSInit; | @@ -3,12 +3,14 @@ var OSSInit; | ||
3 | var app = getApp(); | 3 | var app = getApp(); |
4 | var baseUrl = app.globalData.baseUrl; | 4 | var baseUrl = app.globalData.baseUrl; |
5 | var format = require('../../../../utils/util.js'); | 5 | var format = require('../../../../utils/util.js'); |
6 | +var province = require('../../../../utils/province.js'); | ||
6 | Page({ | 7 | Page({ |
7 | 8 | ||
8 | /** | 9 | /** |
9 | * Page initial data | 10 | * Page initial data |
10 | */ | 11 | */ |
11 | data: { | 12 | data: { |
13 | + province: [], | ||
12 | name: '', | 14 | name: '', |
13 | bank: '', | 15 | bank: '', |
14 | bank_card_no: '', | 16 | bank_card_no: '', |
@@ -23,11 +25,25 @@ Page({ | @@ -23,11 +25,25 @@ Page({ | ||
23 | this.initOSS() | 25 | this.initOSS() |
24 | var userinfo = app.globalData.userInfo | 26 | var userinfo = app.globalData.userInfo |
25 | console.log("userinfo", userinfo) | 27 | console.log("userinfo", userinfo) |
28 | + this.loadProvince() | ||
26 | this.setData({ | 29 | this.setData({ |
27 | name: userinfo ? userinfo.name : "" | 30 | name: userinfo ? userinfo.name : "" |
28 | }) | 31 | }) |
29 | }, | 32 | }, |
30 | 33 | ||
34 | + loadProvince: function() { | ||
35 | + province.init(this) | ||
36 | + var provincelist = this.data.province | ||
37 | + var province_data = [] | ||
38 | + for (var i = 0; i < provincelist.length; i++) { | ||
39 | + province_data.push(provincelist[i].name) | ||
40 | + } | ||
41 | + console.log("provincedata", province_data) | ||
42 | + this.setData({ | ||
43 | + province: province_data, | ||
44 | + }) | ||
45 | + }, | ||
46 | + | ||
31 | /** | 47 | /** |
32 | * Lifecycle function--Called when page is initially rendered | 48 | * Lifecycle function--Called when page is initially rendered |
33 | */ | 49 | */ |
@@ -81,9 +97,6 @@ Page({ | @@ -81,9 +97,6 @@ Page({ | ||
81 | count: 1, | 97 | count: 1, |
82 | success: function(res) { | 98 | success: function(res) { |
83 | console.log('success', res) | 99 | console.log('success', res) |
84 | - wx.showLoading({ | ||
85 | - title: "识别中" | ||
86 | - }) | ||
87 | wx.getFileSystemManager().readFile({ | 100 | wx.getFileSystemManager().readFile({ |
88 | filePath: res.tempFilePaths[0], // 选择图片返回的相对路径 | 101 | filePath: res.tempFilePaths[0], // 选择图片返回的相对路径 |
89 | encoding: 'base64', // 编码格式 | 102 | encoding: 'base64', // 编码格式 |
@@ -99,6 +112,13 @@ Page({ | @@ -99,6 +112,13 @@ Page({ | ||
99 | ocrBankImage: function(imginfo) { | 112 | ocrBankImage: function(imginfo) { |
100 | var that = this | 113 | var that = this |
101 | this.Authorization = getApp().globalData.Authorization; | 114 | this.Authorization = getApp().globalData.Authorization; |
115 | + setTimeout(function () { | ||
116 | + wx.showLoading({ | ||
117 | + title: "识别银行卡中", | ||
118 | + mask: true | ||
119 | + }) | ||
120 | + }, 1000) | ||
121 | + | ||
102 | wx.request({ | 122 | wx.request({ |
103 | url: baseUrl + "common/v1/ocr/bankcards", | 123 | url: baseUrl + "common/v1/ocr/bankcards", |
104 | method: "POST", | 124 | method: "POST", |
@@ -110,21 +130,27 @@ Page({ | @@ -110,21 +130,27 @@ Page({ | ||
110 | }, | 130 | }, |
111 | success: function(result) { | 131 | success: function(result) { |
112 | console.log("bankinfo", result) | 132 | console.log("bankinfo", result) |
133 | + | ||
113 | if (result.statusCode == 200) { | 134 | if (result.statusCode == 200) { |
114 | - wx.hideLoading() | 135 | + var result_new = result.data.bank.split("银行") |
115 | that.setData({ | 136 | that.setData({ |
116 | - bank: result.data.bank.split("银行")[0] + "银行", | ||
117 | - bank_card_no: result.data.bank_card_no | 137 | + bank: result_new[0] + "银行", |
138 | + bank_card_no: result.data.bank_card_no, | ||
139 | + hideLoading: true, | ||
118 | }) | 140 | }) |
141 | + wx.hideLoading() | ||
119 | } | 142 | } |
120 | }, | 143 | }, |
144 | + complete: function() { | ||
145 | + | ||
146 | + } | ||
121 | }) | 147 | }) |
122 | }, | 148 | }, |
123 | 149 | ||
124 | - bindRegionChange: function (e) { | ||
125 | - console.log('picker发送选择改变,携带值为', e.detail.value) | 150 | + bindRegionChange: function(e) { |
151 | + console.log('picker,携带值为', e.detail.value) | ||
126 | this.setData({ | 152 | this.setData({ |
127 | - region: e.detail.value | 153 | + bank_card_province: this.data.province[e.detail.value] |
128 | }) | 154 | }) |
129 | }, | 155 | }, |
130 | 156 | ||
@@ -147,8 +173,8 @@ Page({ | @@ -147,8 +173,8 @@ Page({ | ||
147 | this.showToast("请输入银行名称") | 173 | this.showToast("请输入银行名称") |
148 | return | 174 | return |
149 | } | 175 | } |
150 | - if (!formdata.bank_card_province.length < 1) { | ||
151 | - this.showToast("请输入开户银行省份") | 176 | + if (this.data.bank_card_province.length < 1) { |
177 | + this.showToast("请选择开户银行省份") | ||
152 | return | 178 | return |
153 | } | 179 | } |
154 | this.setData({ | 180 | this.setData({ |
@@ -177,16 +203,16 @@ Page({ | @@ -177,16 +203,16 @@ Page({ | ||
177 | }, | 203 | }, |
178 | method: "PUT", | 204 | method: "PUT", |
179 | data: { | 205 | data: { |
180 | - 'name': '', | ||
181 | - "bank": '', | ||
182 | - "bank_card_no": '', | ||
183 | - "bank_card_province": '' | 206 | + 'name': that.data.name, |
207 | + "bank": that.data.bank, | ||
208 | + "bank_card_no": that.data.bank_card_no, | ||
209 | + "bank_card_province": that.data.bank_card_province | ||
184 | }, | 210 | }, |
185 | success: function(result) { | 211 | success: function(result) { |
186 | console.log("submit", result) | 212 | console.log("submit", result) |
187 | if (result.statusCode == 200) { | 213 | if (result.statusCode == 200) { |
188 | - that.setData({ | ||
189 | - | 214 | + wx.navigateBack({ |
215 | + delta: 1 | ||
190 | }) | 216 | }) |
191 | } | 217 | } |
192 | }, | 218 | }, |
@@ -22,13 +22,13 @@ | @@ -22,13 +22,13 @@ | ||
22 | <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' name='bank_card_province' value="{{bank_card_province}}"></input> | 22 | <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' name='bank_card_province' value="{{bank_card_province}}"></input> |
23 | </view> --> | 23 | </view> --> |
24 | 24 | ||
25 | - <picker style="height:104rpx;padding:0 30rpx;background-color:#fff" mode="province" bindchange="bindRegionChange" value="{{region}}"> | 25 | + <picker style="height:104rpx;padding:0 30rpx;background-color:#fff" mode="selector" bindchange="bindRegionChange" range="{{province}}" > |
26 | <text class="text_gray7_34">开户银行省份</text> | 26 | <text class="text_gray7_34">开户银行省份</text> |
27 | - <view class="input_wrap rigion_notchoosed}}"> | ||
28 | - 请选择 </view> | ||
29 | - <view class="input_wrap rigion_choosed"> | ||
30 | - {{region[0]}} | 27 | + <view wx:if="{{bank_card_province.length>0}}" class="input_wrap rigion_choosed"> |
28 | + {{bank_card_province}} | ||
31 | </view> | 29 | </view> |
30 | + <view wx:else class="input_wrap rigion_notchoosed}}"> | ||
31 | + 请选择 </view> | ||
32 | </picker> | 32 | </picker> |
33 | 33 | ||
34 | <view class="btn_bottom"> | 34 | <view class="btn_bottom"> |
utils/province.js
0 → 100644
1 | +var province = [{ | ||
2 | + "name": "北京市", | ||
3 | + "code": "110000", | ||
4 | +}, | ||
5 | +{ | ||
6 | + "name": "天津市", | ||
7 | + "code": "120000", | ||
8 | +}, | ||
9 | +{ | ||
10 | + "name": "河北省", | ||
11 | + "code": "130000", | ||
12 | +}, | ||
13 | +{ | ||
14 | + "name": "山西省", | ||
15 | + "code": "140000", | ||
16 | +}, | ||
17 | +{ | ||
18 | + "name": "内蒙古自治区", | ||
19 | + "code": "150000", | ||
20 | +}, | ||
21 | +{ | ||
22 | + "name": "辽宁省", | ||
23 | + "code": "210000", | ||
24 | +}, | ||
25 | +{ | ||
26 | + "name": "吉林省", | ||
27 | + "code": "220000", | ||
28 | +}, | ||
29 | +{ | ||
30 | + "name": "黑龙江省", | ||
31 | + "code": "230000", | ||
32 | +}, | ||
33 | +{ | ||
34 | + "name": "上海市", | ||
35 | + "code": "310000", | ||
36 | +}, | ||
37 | +{ | ||
38 | + "name": "江苏省", | ||
39 | + "code": "320000", | ||
40 | +}, | ||
41 | +{ | ||
42 | + "name": "浙江省", | ||
43 | + "code": "330000", | ||
44 | +}, | ||
45 | +{ | ||
46 | + "name": "安徽省", | ||
47 | + "code": "340000", | ||
48 | +}, | ||
49 | +{ | ||
50 | + "name": "福建省", | ||
51 | + "code": "350000", | ||
52 | +}, | ||
53 | +{ | ||
54 | + "name": "江西省", | ||
55 | + "code": "360000", | ||
56 | +}, | ||
57 | +{ | ||
58 | + "name": "山东省", | ||
59 | + "code": "370000", | ||
60 | +}, | ||
61 | +{ | ||
62 | + "name": "河南省", | ||
63 | + "code": "410000", | ||
64 | +}, | ||
65 | +{ | ||
66 | + "name": "湖北省", | ||
67 | + "code": "420000", | ||
68 | +}, | ||
69 | +{ | ||
70 | + "name": "湖南省", | ||
71 | + "code": "430000", | ||
72 | +}, | ||
73 | +{ | ||
74 | + "name": "广东省", | ||
75 | + "code": "440000", | ||
76 | +}, | ||
77 | +{ | ||
78 | + "name": "广西壮族自治区", | ||
79 | + "code": "450000", | ||
80 | +}, | ||
81 | +{ | ||
82 | + "name": "海南省", | ||
83 | + "code": "460000", | ||
84 | +}, | ||
85 | +{ | ||
86 | + "name": "重庆市", | ||
87 | + "code": "500000", | ||
88 | +}, | ||
89 | +{ | ||
90 | + "name": "四川省", | ||
91 | + "code": "510000", | ||
92 | +}, | ||
93 | +{ | ||
94 | + "name": "贵州省", | ||
95 | + "code": "520000", | ||
96 | +}, | ||
97 | +{ | ||
98 | + "name": "云南省", | ||
99 | + "code": "530000", | ||
100 | +}, | ||
101 | +{ | ||
102 | + "name": "西藏自治区", | ||
103 | + "code": "540000", | ||
104 | +}, | ||
105 | +{ | ||
106 | + "name": "陕西省", | ||
107 | + "code": "610000", | ||
108 | +}, | ||
109 | +{ | ||
110 | + "name": "甘肃省", | ||
111 | + "code": "620000", | ||
112 | +}, | ||
113 | +{ | ||
114 | + "name": "青海省", | ||
115 | + "code": "630000", | ||
116 | +}, | ||
117 | +{ | ||
118 | + "name": "宁夏回族自治区", | ||
119 | + "code": "640000", | ||
120 | +}, | ||
121 | +{ | ||
122 | + "name": "新疆维吾尔自治区", | ||
123 | + "code": "650000", | ||
124 | +}, | ||
125 | +{ | ||
126 | + "name": "台湾省", | ||
127 | + "code": "710000" | ||
128 | +}, | ||
129 | +{ | ||
130 | + "name": "台湾省", | ||
131 | + "code": "710000" | ||
132 | +}, | ||
133 | +{ | ||
134 | + "name": "台湾省", | ||
135 | + "code": "710000" | ||
136 | +}, | ||
137 | +{ | ||
138 | + "name": "香港特别行政区", | ||
139 | + "code": "810000" | ||
140 | +}, | ||
141 | +{ | ||
142 | + "name": "澳门特别行政区", | ||
143 | + "code": "820000" | ||
144 | +}] | ||
145 | + | ||
146 | +function init(that) { | ||
147 | + that.setData({ | ||
148 | + 'province': province | ||
149 | + }); | ||
150 | +} | ||
151 | + | ||
152 | +module.exports = { | ||
153 | + init: init | ||
154 | +} |
请
注册
或
登录
后发表评论