提交 b1871be472713390b2abfd12547753de485791cc

作者 wangyu
1 个父辈 fb8fefa5

优化

1   -;// pages/main/finalpay/refundDetail/refundDetail.js
  1 +; // pages/main/finalpay/refundDetail/refundDetail.js
2 2 var app = getApp();
3 3 var baseUrl = app.globalData.baseUrl;
4 4 Page({
... ... @@ -7,33 +7,34 @@ Page({
7 7 * Page initial data
8 8 */
9 9 data: {
10   - year:"2019",
  10 + year: "2019",
11 11 refund_status: "", //退税状态 "0" 无需退税; "1" 待退税;"2" 退税中"3" 退税成功;"4"退税失败;"5"放弃退税;
12   - refundInfo:{}
  12 + refundInfo: {},
  13 + refund_tax: 0
13 14 },
14 15
15 16 /**
16 17 * Lifecycle function--Called when page load
17 18 */
18   - onLoad: function (options) {
19   - this.getRefundDetail()
  19 + onLoad: function(options) {
  20 + this.getRefundDetail()
20 21 },
21 22
22 23 /**
23 24 * Lifecycle function--Called when page is initially rendered
24 25 */
25   - onReady: function () {
  26 + onReady: function() {
26 27
27 28 },
28 29
29 30 /**
30 31 * Lifecycle function--Called when page show
31 32 */
32   - onShow: function () {
  33 + onShow: function() {
33 34
34 35 },
35 36
36   - getRefundDetail: function () {//退税明细
  37 + getRefundDetail: function() { //退税明细
37 38 var that = this
38 39 this.Authorization = getApp().globalData.Authorization;
39 40 wx.request({
... ... @@ -42,13 +43,14 @@ Page({
42 43 'Authorization': this.Authorization
43 44 },
44 45 data: {
45   - years:that.data.year,
  46 + years: that.data.year,
46 47 },
47   - success: function (result) {
  48 + success: function(result) {
48 49 console.log("declareinfo", result)
49 50 if (result.statusCode == 200) {
50 51 that.setData({
51   - refundInfo:result.data.item
  52 + refund_tax: Math.abs(result.data.item.accumulated_refund_tax),
  53 + refundInfo: result.data.item
52 54 })
53 55 }
54 56 },
... ... @@ -58,35 +60,35 @@ Page({
58 60 /**
59 61 * Lifecycle function--Called when page hide
60 62 */
61   - onHide: function () {
  63 + onHide: function() {
62 64
63 65 },
64 66
65 67 /**
66 68 * Lifecycle function--Called when page unload
67 69 */
68   - onUnload: function () {
  70 + onUnload: function() {
69 71
70 72 },
71 73
72 74 /**
73 75 * Page event handler function--Called when user drop down
74 76 */
75   - onPullDownRefresh: function () {
  77 + onPullDownRefresh: function() {
76 78
77 79 },
78 80
79 81 /**
80 82 * Called when page reach bottom
81 83 */
82   - onReachBottom: function () {
  84 + onReachBottom: function() {
83 85
84 86 },
85 87
86 88 /**
87 89 * Called when user click on the top right corner to share
88 90 */
89   - onShareAppMessage: function () {
  91 + onShareAppMessage: function() {
90 92
91 93 }
92 94 })
\ No newline at end of file
... ...
... ... @@ -20,7 +20,7 @@
20 20 </view>
21 21 <view>
22 22 <text class="text_black6_32">申请退税金额</text>
23   - <text class="text_black6_32 float_right">{{refundInfo.accumulated_refund_tax}}</text>
  23 + <text class="text_black6_32 float_right">{{refund_tax}}</text>
24 24 </view>
25 25 <view>
26 26 <text class="text_black6_32">银行卡号</text>
... ...
... ... @@ -14,7 +14,7 @@ Page({
14 14 name: '',
15 15 bank: '',
16 16 bank_card_no: '',
17   - bank_card_province: '',
  17 + bank_province: '',
18 18 show_modal: false
19 19 },
20 20
... ... @@ -112,13 +112,13 @@ Page({
112 112 ocrBankImage: function(imginfo) {
113 113 var that = this
114 114 this.Authorization = getApp().globalData.Authorization;
115   - setTimeout(function () {
  115 + setTimeout(function() {
116 116 wx.showLoading({
117 117 title: "识别银行卡中",
118 118 mask: true
119 119 })
120 120 }, 1000)
121   -
  121 +
122 122 wx.request({
123 123 url: baseUrl + "common/v1/ocr/bankcards",
124 124 method: "POST",
... ... @@ -130,7 +130,7 @@ Page({
130 130 },
131 131 success: function(result) {
132 132 console.log("bankinfo", result)
133   -
  133 +
134 134 if (result.statusCode == 200) {
135 135 var result_new = result.data.bank.split("银行")
136 136 that.setData({
... ... @@ -138,11 +138,15 @@ Page({
138 138 bank_card_no: result.data.bank_card_no,
139 139 hideLoading: true,
140 140 })
141   - wx.hideLoading()
  141 + wx.hideLoading()
  142 + } else {
  143 + wx.hideLoading()
  144 + that.showToast("照片无法识别,请重试")
142 145 }
143 146 },
144   - complete: function() {
145   -
  147 + fail: function() {
  148 + wx.hideLoading()
  149 + that.showToast("照片无法识别,请重试")
146 150 }
147 151 })
148 152 },
... ... @@ -150,7 +154,7 @@ Page({
150 154 bindRegionChange: function(e) {
151 155 console.log('picker,携带值为', e.detail.value)
152 156 this.setData({
153   - bank_card_province: this.data.province[e.detail.value]
  157 + bank_province: this.data.province[e.detail.value]
154 158 })
155 159 },
156 160
... ... @@ -173,7 +177,7 @@ Page({
173 177 this.showToast("请输入银行名称")
174 178 return
175 179 }
176   - if (this.data.bank_card_province.length < 1) {
  180 + if (this.data.bank_province.length < 1) {
177 181 this.showToast("请选择开户银行省份")
178 182 return
179 183 }
... ... @@ -206,8 +210,8 @@ Page({
206 210 'name': that.data.name,
207 211 "bank": that.data.bank,
208 212 "bank_card_no": that.data.bank_card_no,
209   - "bank_card_province": that.data.bank_card_province,
210   - "refund_status":"",
  213 + "bank_province": that.data.bank_province,
  214 + "refund_status": "",
211 215 "years": "2019",
212 216
213 217 },
... ...
... ... @@ -25,7 +25,7 @@
25 25 <picker style="height:104rpx;padding:0 30rpx;background-color:#fff" mode="selector" bindchange="bindRegionChange" range="{{province}}" >
26 26 <text class="text_gray7_34">开户银行省份</text>
27 27 <view wx:if="{{bank_card_province.length>0}}" class="input_wrap rigion_choosed">
28   - {{bank_card_province}}
  28 + {{bank_province}}
29 29 </view>
30 30 <view wx:else class="input_wrap rigion_notchoosed}}">
31 31 请选择 </view>
... ...
注册登录 后发表评论