deductOrPayedDetail.js
5.7 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
var app = getApp();
var baseUrl = app.globalData.baseUrl;
Page({
/**
* Page initial data
*/
data: {
year: "2019",
showAddView: false,
infoList: [{}],
project: ["正常工资薪金", "劳务报酬", "稿酬", "特许经营权使用费"],
deductcontent: ["高级专家延长离退休期间工薪免征个人所得税", "解除劳动合同当地工资3倍以内免税", "符合条件的津补贴免征个人所得税", "生育津贴和生育医疗费免税", "工伤保险免税", "符合条件的外交人员免征个人所得税", "外籍个人出差补贴免税", "外籍个人探亲费、语言训练费、子女教育费免税", "外籍个人生活费用免税", "符合条件的外籍来华专家工资薪金所得免征个人所得税", "薪金所得免征个人所得数", "横琴、香港、澳门居民免税", "平潭台湾居民免税", "安家费、退职费、退休工资、离休工资、离休生活补助费免税"],
deductproperty: ["其他"],
income_item: "",
reduction_item: "",
reduction_nature: "",
reduction_tax: "",
},
/**
* Lifecycle function--Called when page load
*/
onLoad: function (options) {
this.getInfoList()
},
/**
* Lifecycle function--Called when page is initially rendered
*/
onReady: function () {
},
getInfoList: function () {
var that = this
this.Authorization = getApp().globalData.Authorization;
wx.request({
url: baseUrl + "payroll/v1/settlement-tax/reduction-tax",
header: {
'Authorization': this.Authorization
},
data: {
"years": that.data.year,
},
success: function (result) {
console.log("infoList", result)
if (result.statusCode == 200) {
that.setData({
infoList: result.data.items,
income_item: "",
reduction_item: "",
reduction_nature: "",
reduction_tax: "",
})
}
},
})
},
/**
* Lifecycle function--Called when page show
*/
onShow: function () {
},
// 所得项目
bindProjectChange: function (e) {
console.log('picker,携带值为', e.detail.value)
this.setData({
income_item: this.data.project[e.detail.value]
})
},
// 减免事项名称
bindDeductContent: function (e) {
console.log('picker,携带值为', e.detail.value)
this.setData({
reduction_item: this.data.deductcontent[e.detail.value]
})
},
// 减免性质名称
bindDeductProperty: function (e) {
console.log('picker,携带值为', e.detail.value)
this.setData({
reduction_nature: this.data.deductproperty[e.detail.value]
})
},
// 减免税额
bindIncome: function (e) {
console.log('输入框', e.detail.value)
this.setData({
reduction_tax: e.detail.value
})
},
addItem: function () { //继续添加
if (!this.data.showAddView) {//是否新增了view
this.setData({
showAddView: true
})
return
}
if (!this.data.income_item || this.data.income_item.length < 1) {
this.showToast("请选择所得项目")
return
}
if (!this.data.reduction_item || this.data.reduction_item.length < 1) {
this.showToast("请选择减免事项名称")
return
}
if (!this.data.reduction_nature || this.data.reduction_nature.length < 1) {
this.showToast("请选择减免性质名称")
return
}
if (!this.data.reduction_tax || this.data.reduction_tax.length < 1) {
this.showToast("请填写减免税额")
return
}
this.goSubmit("1")
},
goSubmit: function (type) {
if (!this.data.income_item || this.data.income_item.length < 1) {
this.showToast("请选择所得项目")
return
}
if (!this.data.reduction_item || this.data.reduction_item.length < 1) {
this.showToast("请选择减免事项名称")
return
}
if (!this.data.reduction_nature || this.data.reduction_nature.length < 1) {
this.showToast("请选择减免性质名称")
return
}
if (!this.data.reduction_tax || this.data.reduction_tax.length < 1) {
this.showToast("请填写减免税额")
return
}
var that = this
this.Authorization = app.globalData.Authorization;
wx.request({
url: baseUrl + "payroll/v1/settlement-tax/reduction-tax",
header: {
'Authorization': this.Authorization
},
method: "POST",
data: {
"years": that.data.year,
"income_item": that.data.income_item,
"reduction_item": that.data.reduction_item,
"reduction_nature": that.data.reduction_nature,
"reduction_tax": parseFloat(that.data.reduction_tax),
},
success: function (result) {
console.log("infoList", result)
if (result.statusCode == 200) {
if (type == '1') {
that.getInfoList()
that.setData({
showAddView: true
})
} else {
wx.navigateBack({
delat: 1
})
}
}
},
})
},
/**
* Lifecycle function--Called when page hide
*/
onHide: function () {
},
/**
* Lifecycle function--Called when page unload
*/
onUnload: function () {
},
showToast: function (data) {
if (data && data.length > 0) {
wx.showToast({
title: data,
icon: "none",
duration: 2000
})
}
},
/**
* Page event handler function--Called when user drop down
*/
onPullDownRefresh: function () {
},
/**
* Called when page reach bottom
*/
onReachBottom: function () {
},
/**
* Called when user click on the top right corner to share
*/
onShareAppMessage: function () {
}
})