home.js
10.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
// pages/main/finalpay/home.js
var app = getApp();
var baseUrl = app.globalData.baseUrl;
var format = require('../../../utils/util.js');
Page({
data: {
year: "2019",
declare_status: "", //申报状态"0" //待申报 "1" //申报成功 “2” 申报中
refund_status: "", //退税状态 "0" 无需退税; "1" 待退税;"2" 退税中"3" 退税成功;"4"退税失败;"5"放弃退税;
pay_status: "", //补税状态 "0" 豁免; "1" 待补税;"2" 补税成功
declaring_unit_status: "", //1:本单位申报,2:本单位其他申报,3:其他单位申报,4:待确认申报//5用户自行申报
payinfo: {},
unitInfo: [],
showUnit: false,
declaring_unit_id: "",
declaring_unit:"",
showModal_selfDeclare: false,
uniqual_title01:"",
uniqual_content01: "",
declare_text_extra: "",//请等候申报结果
new_refund_tax:0,
declare_end_date:"",
declare_end_days: 0,
other_end_date: "",
other_end_days: 0,
refund_end_date: "",
refund_end_days: 0,
show_other_unit_view:false,
exempt_status:""
},
onLoad: function(options) {
},
onReady: function() {
},
onShow: function() {
this.getPayInfo();
},
yearPick: function() {
},
getPayInfo: function() {
var that = this
this.Authorization = getApp().globalData.Authorization;
wx.request({
url: baseUrl + "payroll/v1/settlement-tax/declare-detail",
header: {
'Authorization': this.Authorization
},
data: {
'years': that.data.year
},
success: function(result) {
console.log("payinfo", result)
if (result.statusCode == 200) {
that.updateText(result.data)
that.setData({
declare_status: result.data.declare_status,
refund_status: result.data.refund_status,
pay_status: result.data.pay_status,
declaring_unit: result.data.declaring_unit,
declaring_unit_status: result.data.declaring_unit_status,
new_refund_tax: Math.abs(result.data.refund_tax),
declare_end_date: format.getDateString(result.data.declare_end_time) ,
declare_end_days: format.daysTillNow(Date.parse(new Date())/1000,result.data.declare_end_time),
other_end_date: format.getDateString(result.data.other_end_time),
other_end_days: format.daysTillNow(Date.parse(new Date()) / 1000, result.data.other_end_time),
refund_end_date: format.getDateString(result.data.refund_end_time),
refund_end_days: format.daysTillNow(Date.parse(new Date()) / 1000, result.data.refund_end_time),
exempt_status: result.data.exempt,
payinfo: result.data
})
}
},
})
},
getUnitInfo: function() { //获取申报单位
var that = this
this.Authorization = getApp().globalData.Authorization;
that.setData({
showUnit: true
})
wx.request({
url: baseUrl + "payroll/v1/settlement-tax/declare-unit",
header: {
'Authorization': this.Authorization
},
data: {},
success: function(result) {
console.log("unitInfo", result.data)
if (result.statusCode == 200) {
that.setData({
unitInfo: result.data.items
})
}
},
complete: function(e) {
that.setData({
showUnit: true
})
}
})
},
updateDeclareState: function(id) { //是否在本单位申报
var that = this
this.Authorization = getApp().globalData.Authorization;
wx.request({
url: baseUrl + "payroll/v1/settlement-tax/record",
header: {
'Authorization': this.Authorization
},
method: "PUT",
data: {
"years":that.data.year,
'declaring_unit_id': id,
"declaring_unit_status": id?'':'5',
},
success: function(result) {
console.log("declareinfo", result)
if (result.statusCode == 200) {
that.setData({
})
that.getPayInfo();
}
},
})
},
// 是否放弃退税,(是:"5",否:"")
forgiveRefund: function(s) {
var that = this
this.Authorization = getApp().globalData.Authorization;
wx.request({
url: baseUrl + "payroll/v1/settlement-tax/record",
header: {
'Authorization': this.Authorization
},
method: "PUT",
data: {
"years": that.data.year,
'refund_status': s
},
success: function(result) {
console.log("refund", result)
if (result.statusCode == 200) {
that.getPayInfo();
that.setData({
})
}
},
})
},
// 确认提交申请退税
commitRefund: function() {
var that = this
this.Authorization = getApp().globalData.Authorization;
wx.request({
url: baseUrl + "payroll/v1/settlement-tax/record",
header: {
'Authorization': this.Authorization
},
method: "PUT",
data: {
"years": that.data.year,
"name": "xxxx", //姓名,
"bank": "xxxx", //开户行,
"bank_card_no": "xxxx", //银行卡号,
"bank_province": "xxxx", //银行省份,
},
success: function(result) {
console.log("refund", result)
if (result.statusCode == 200) {
that.setData({
})
}
},
})
},
// 跳转到H5页面测试
skipH5_01: function() {
wx.navigateTo({
url: '../../common/webview?type=1',
})
},
skipH5_02: function() {
wx.navigateTo({
url: '../../common/webview?type=2',
})
},
finalpay_detail: function() {//
wx.navigateTo({
url: 'incomeDetail/incomeDetail',
})
},
declareHere: function() {
if(this.data.declaring_unit_status==''){
wx.showToast({
icon:"none",
title: '单位还没有启用汇算清缴申报,请等候单位通知',
})
return
}
this.getUnitInfo()
},
declareNotHere: function() {
if (this.data.declaring_unit_status == '') {
wx.showToast({
icon: "none",
title: '单位还没有启用汇算清缴申报,请等候单位通知',
})
return
}
var that = this
wx.showModal({
title: '',
content: '确认不在本单位进行汇算清缴申报吗?',
confirmColor: '#357aeb',
success(res) {
if (res.confirm) {
console.log('用户点击确定')
that.updateDeclareState("")
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
},
unitPick: function(e) { //选择申报单位
console.log("unitPick", e)
var info_arr = e.currentTarget.id.split("~")
this.setData({
declaring_unit_id: info_arr[1] ,
declaring_unit: info_arr[0],
showUnit: false,
show_other_unit_view:true,
})
},
selfdeclare_close() { //关闭自行申报弹窗
this.setData({
showModal_selfDeclare: false
})
},
declareBySelf: function() { //查看自行申报方式
this.setData({
showModal_selfDeclare: true
})
},
godeclareHistory: function() {
wx.redirectTo({
url: '../advancepayment/adPayHome',
})
},
noOtherUnitInfo: function() { //没有其他单位个税申报
this.updateDeclareState(this.data.declaring_unit_id)
this.setData({
show_other_unit_view:false
})
},
otherUnitInfo: function() { //有其他单位个税申报
wx.navigateTo({
url: 'addUnitInfo/addUnitInfo?unit_id='+this.data.declaring_unit_id,
})
this.setData({
show_other_unit_view: false
})
},
// 申请退税
doRefund: function() {
wx.navigateTo({
url: 'refundInfo/refundInfo',
})
},
// 放弃退税
doNotRefund: function() {
var that = this
wx.showModal({
title: '确认放弃退税吗?',
content: '',
confirmColor: '#357aeb',
success(res) {
if (res.confirm) {
console.log('用户点击确定')
that.forgiveRefund("5")
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
},
refundDetail:function(){//退税详情
wx.navigateTo({
url: 'refundDetail/refundDetail?status=' + this.data.refund_status,
})
},
updateText:function(data){
var text = ""
var text_status = ""
var text_title = "应补退税额"
if (data.declare_status=='2'){//申报中
text = "请等候申报结果"
} else {//申报成功
if (data.declare_result=='0') {//申报结果0:退税,1:补税,2:无需补退税
text_title = "应退税额"
if (data.refund_status == "1") {
text = "请确认是否申请退款?"
} else if (data.refund_status == '2') {
text = "申请退税中"
text_status = "退税中"
} else if (data.refund_status == '4') {
text = "退税失败,请确认您的银行卡信息是否正确?"
text_status = "退税失败"
} else if (data.refund_status == '5') {
text = "您已放弃退税"
text_status = "已放弃"
}
} else if (data.declare_result == '1'){//补税
text_title = "应补税额"
if (data.exempt == 'yes') {
text = "您已享受豁免"
text_status = "豁免"
} else if (data.pay_status == '1') {
text = "请等待企业为您代缴税款"
text_status = "待缴款"
} else if (data.pay_status == '2') {
text = "单位已为您代缴税款"
text_status = "已缴款"
}
}
// if (data.refund_tax > 0 || data.refund_tax == 0) {
// text_title = "应补税额"
// } else {
// text_title = "应退税额"
// }
}
this.setData({
declare_text_extra:text,
uniqual_content01:text_status,
uniqual_title01: text_title,
})
},
onHide: function() {
},
onUnload: function() {
},
onPullDownRefresh: function() {
},
onReachBottom: function() {
},
onShareAppMessage: function() {
}
})