addUnitInfo.js
4.9 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
// pages/main/finalpay/addUnitInfo/addUnitInfo.js
var app = getApp();
var baseUrl = app.globalData.baseUrl;
Page({
data: {
year: "2019",
unit_id:"",
},
onLoad: function(options) {
this.setData({
unit_id:options.unit_id
})
},
onReady: function() {
},
onShow: function() {
},
formSubmit: function(e) { //提交
console.log("formSubmit", e);
var formdata = e.detail.value
if (formdata.total_salary || formdata.total_salary || formdata.remuneration_labor || formdata.author_payment || formdata.special_manage_cost || formdata.other_free_income || formdata.personal_endowment || formdata.personal_medical || formdata.personal_unemployment || formdata.personal_house_fund || formdata.childrens_education || formdata.continuing_education || formdata.housing_loan_interest || formdata.housing_rent || formdata.caring_old_people || formdata.serious_illness_medical || formdata.annuity || formdata.commercial_insurance || formdata.tax_extension || formdata.other_fee || formdata.donation_deducted || formdata.year_donation_deducted || formdata.years_bouns || formdata.tax_savings || formdata.accumulated_withholding_tax){
this.submitRequest(formdata)
}else{
this.showToast("其他收入内容不能为空")
return
}
},
submitRequest: function(request_data) {
var that = this
this.Authorization = getApp().globalData.Authorization;
wx.request({
url: baseUrl + "payroll/v1/settlement-tax/record",
header: {
'Authorization': this.Authorization
},
method: "POST",
data: {
"declaring_unit_id":that.data.unit_id,
"item": {
"total_salary": that.parseToFloat(request_data.total_salary), //工资薪金,
"remuneration_labor": that.parseToFloat(request_data.remuneration_labor), //劳务报酬,
"author_payment": that.parseToFloat(request_data.author_payment), //稿酬,
"special_manage_cost": that.parseToFloat(request_data.special_manage_cost), //特许经营权使用费,
"other_free_income": that.parseToFloat(request_data.other_free_income), //其他免税收入,
"personal_endowment": that.parseToFloat(request_data.personal_endowment), //基本养老保险,
"personal_medical": that.parseToFloat(request_data.personal_medical), //基本医疗保险,
"personal_unemployment": that.parseToFloat(request_data.personal_unemployment), //失业险,
"personal_house_fund": that.parseToFloat(request_data.personal_house_fund), //住房公积金,
"childrens_education": that.parseToFloat(request_data.childrens_education), //子女教育支出,
"caring_old_people": that.parseToFloat(request_data.caring_old_people), //赡养老人
"housing_loan_interest": that.parseToFloat(request_data.housing_loan_interest), //住房贷款利息支出
"housing_rent": that.parseToFloat(request_data.housing_rent), //住房租金支出
"serious_illness_medical": that.parseToFloat(request_data.serious_illness_medical),//大病医疗支出
"continuing_education": that.parseToFloat(request_data.continuing_education), //继续教育支出
"annuity": that.parseToFloat(request_data.annuity), //年金
"commercial_insurance": that.parseToFloat(request_data.commercial_insurance), //商业健康保险
"tax_extension": that.parseToFloat(request_data.tax_extension), //税延养老保险
"other_fee": that.parseToFloat(request_data.other_fee),//其他税前扣除额
"year_donation_deducted": that.parseToFloat(request_data.year_donation_deducted), //准予扣除的捐赠
"years_bouns": that.parseToFloat(request_data.years_bouns), //全年一次性奖金
"donation_deducted": that.parseToFloat(request_data.donation_deducted), //准予扣除的捐赠
"tax_savings": that.parseToFloat(request_data.tax_savings), //减免税额
"accumulated_withholding_tax": that.parseToFloat(request_data.accumulated_withholding_tax), //应扣缴税额
},
"years": that.data.year
},
success: function(result) {
console.log("refund", result)
if (result.statusCode == 200) {
that.showToast("提交成功!")
wx.navigateBack({
delta:1
})
}else{
that.showToast(result.data.message)
}
},
})
},
parseToFloat(s){
if(s&&s.length>0){
var num = parseFloat(s)
return Math.round(num*100)/100
}else{
return 0
}
},
showToast: function(data) {
if (data && data.length > 0) {
wx.showToast({
title: data,
icon: "none",
duration: 2000
})
}
},
onHide: function() {
},
onUnload: function() {
},
onPullDownRefresh: function() {
},
onReachBottom: function() {
},
onShareAppMessage: function() {
}
})