提交 cdd66ab700d8d447c5207a0eb709e286e91c5af9

作者 wangyu
1 个父辈 c8da0456

修改减免附表和免税附表相关逻辑

... ... @@ -7,10 +7,15 @@ Page({
7 7 */
8 8 data: {
9 9 year: "2019",
  10 + showAddView: false,
10 11 infoList: [{}],
11 12 project: ["正常工资薪金", "劳务报酬", "稿酬", "特许经营权使用费"],
12 13 deductcontent: ["高级专家延长离退休期间工薪免征个人所得税", "解除劳动合同当地工资3倍以内免税", "符合条件的津补贴免征个人所得税", "生育津贴和生育医疗费免税", "工伤保险免税", "符合条件的外交人员免征个人所得税", "外籍个人出差补贴免税", "外籍个人探亲费、语言训练费、子女教育费免税", "外籍个人生活费用免税", "符合条件的外籍来华专家工资薪金所得免征个人所得税", "薪金所得免征个人所得数", "横琴、香港、澳门居民免税", "平潭台湾居民免税", "安家费、退职费、退休工资、离休工资、离休生活补助费免税"],
13 14 deductproperty: ["其他"],
  15 + income_item: "",
  16 + reduction_item: "",
  17 + reduction_nature: "",
  18 + reduction_tax: "",
14 19 },
15 20
16 21 /**
... ... @@ -42,7 +47,11 @@ Page({
42 47 console.log("infoList", result)
43 48 if (result.statusCode == 200) {
44 49 that.setData({
45   - infoList: result.data.items
  50 + infoList: result.data.items,
  51 + income_item: "",
  52 + reduction_item: "",
  53 + reduction_nature: "",
  54 + reduction_tax: "",
46 55 })
47 56 }
48 57 },
... ... @@ -57,30 +66,111 @@ Page({
57 66 },
58 67
59 68 // 所得项目
60   - bindProjectChange: function (e) { },
  69 + bindProjectChange: function (e) {
  70 + console.log('picker,携带值为', e.detail.value)
  71 + this.setData({
  72 + income_item: this.data.project[e.detail.value]
  73 + })
  74 + },
61 75
62 76 // 减免事项名称
63   - bindDeductContent: function (e) { },
  77 + bindDeductContent: function (e) {
  78 + console.log('picker,携带值为', e.detail.value)
  79 + this.setData({
  80 + reduction_item: this.data.deductcontent[e.detail.value]
  81 + })
  82 + },
64 83
65 84 // 减免性质名称
66   - bindDeductProperty: function (e) { },
  85 + bindDeductProperty: function (e) {
  86 + console.log('picker,携带值为', e.detail.value)
  87 + this.setData({
  88 + reduction_nature: this.data.deductproperty[e.detail.value]
  89 + })
  90 + },
67 91
68   - // 减免
  92 + // 减免
69 93 bindIncome: function (e) {
70   -
  94 + console.log('输入框', e.detail.value)
  95 + this.setData({
  96 + reduction_tax: e.detail.value
  97 + })
71 98 },
72 99
73   - addItem: function () {//继续添加
74   - var info = this.data.infoList;
75   - console.log(info);
76   - info.push(this.data.infoList.length);
77   - this.setData({
78   - infoList: info
79   - });
  100 + addItem: function () { //继续添加
  101 + if (!this.data.showAddView) {//是否新增了view
  102 + this.setData({
  103 + showAddView: true
  104 + })
  105 + return
  106 + }
  107 + if (!this.data.income_item || this.data.income_item.length < 1) {
  108 + this.showToast("请选择所得项目")
  109 + return
  110 + }
  111 + if (!this.data.reduction_item || this.data.reduction_item.length < 1) {
  112 + this.showToast("请选择减免事项名称")
  113 + return
  114 + }
  115 + if (!this.data.reduction_nature || this.data.reduction_nature.length < 1) {
  116 + this.showToast("请选择减免性质名称")
  117 + return
  118 + }
  119 + if (!this.data.reduction_tax || this.data.reduction_tax.length < 1) {
  120 + this.showToast("请填写减免税额")
  121 + return
  122 + }
  123 + this.goSubmit("1")
80 124 },
81 125
82   - goSubmit: function (e) {
83   - console.log('form发生了submit事件,携带数据为:', e.detail.value)
  126 + goSubmit: function (type) {
  127 + if (!this.data.income_item || this.data.income_item.length < 1) {
  128 + this.showToast("请选择所得项目")
  129 + return
  130 + }
  131 + if (!this.data.reduction_item || this.data.reduction_item.length < 1) {
  132 + this.showToast("请选择减免事项名称")
  133 + return
  134 + }
  135 + if (!this.data.reduction_nature || this.data.reduction_nature.length < 1) {
  136 + this.showToast("请选择减免性质名称")
  137 + return
  138 + }
  139 + if (!this.data.reduction_tax || this.data.reduction_tax.length < 1) {
  140 + this.showToast("请填写减免税额")
  141 + return
  142 + }
  143 + var that = this
  144 + this.Authorization = app.globalData.Authorization;
  145 + wx.request({
  146 + url: baseUrl + "payroll/v1/settlement-tax/reduction-tax",
  147 + header: {
  148 + 'Authorization': this.Authorization
  149 + },
  150 + method: "POST",
  151 + data: {
  152 + "years": that.data.year,
  153 + "income_item": that.data.income_item,
  154 + "reduction_item": that.data.reduction_item,
  155 + "reduction_nature": that.data.reduction_nature,
  156 + "reduction_tax": parseFloat(that.data.reduction_tax),
  157 + },
  158 + success: function (result) {
  159 + console.log("infoList", result)
  160 + if (result.statusCode == 200) {
  161 + if (type == '1') {
  162 + that.getInfoList()
  163 + that.setData({
  164 + showAddView: true
  165 + })
  166 + } else {
  167 + wx.navigateBack({
  168 + delat: 1
  169 + })
  170 + }
  171 + }
  172 + },
  173 + })
84 174 },
85 175
86 176 /**
... ... @@ -97,6 +187,16 @@ Page({
97 187
98 188 },
99 189
  190 + showToast: function (data) {
  191 + if (data && data.length > 0) {
  192 + wx.showToast({
  193 + title: data,
  194 + icon: "none",
  195 + duration: 2000
  196 + })
  197 + }
  198 + },
  199 +
100 200 /**
101 201 * Page event handler function--Called when user drop down
102 202 */
... ...
... ... @@ -4,30 +4,57 @@
4 4 <text class="text_black3_34 float_right">{{3000}}</text>
5 5 </view>
6 6
7   - <view wx:for="{{infoList}}" style="background:#fff;margin-top:20rpx">
8   - <picker style="height:104rpx;padding-left: 30rpx;background-color:#fff" mode="selector" bindchange="bindProjectChange" range="{{project}}">
9   - <text class="text_gray7_34">所得项目</text>
10   - <image class='arrow_wrap float_right' src='/images/arrow_right.png'></image>
11   - <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' name='' value="{{}}"></input>
12   - </picker>
13   - <view class="divide_line_30"></view>
14   - <picker style="height:104rpx;padding-left: 30rpx;background-color:#fff" mode="selector" bindchange="bindDeductContent" range="{{deductcontent}}">
15   - <text class="text_gray7_34">减免事项名称</text>
16   - <image class='arrow_wrap float_right' src='/images/arrow_right.png'></image>
17   - <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' name='' value="{{}}"></input>
18   - </picker>
19   - <view class="divide_line_30"></view>
20   - <picker style="height:104rpx;padding-left: 30rpx;background-color:#fff" mode="selector" bindchange="bindDeductProperty" range="{{deductproperty}}">
21   - <text class="text_gray7_34">减免性质名称</text>
22   - <image class='arrow_wrap float_right' src='/images/arrow_right.png'></image>
23   - <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请选择' name='' value="{{}}"></input>
24   - </picker>
25   - <view class="divide_line_30"></view>
26   - <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
27   - <text class="text_gray7_34">减免税额</text>
28   - <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' name='name' type="digit" bindblur="bindIncome" value="{{}}"></input>
29   - </view>
  7 + <!-- 列表数据,不可修改 -->
  8 + <view wx:for="{{infoList}}" style="background:#fff;margin-top:20rpx">
  9 + <view style="height:104rpx;padding-left: 30rpx;background-color:#fff">
  10 + <text class="text_gray7_34">所得项目</text>
  11 + <image class='arrow_wrap float_right' src='/images/arrow_right.png'></image>
  12 + <input class='input_wrap' style='text-align: right;color:#000;' disabled="true" value="{{item.income_item}}"></input>
30 13 </view>
  14 + <view class="divide_line_30"></view>
  15 + <view style="height:104rpx;padding-left: 30rpx;background-color:#fff" >
  16 + <text class="text_gray7_34">减免事项名称</text>
  17 + <image class='arrow_wrap float_right' src='/images/arrow_right.png'></image>
  18 + <input class='input_wrap' style='text-align: right;color:#000;' disabled="true" value="{{item.reduction_item}}"></input>
  19 + </view>
  20 + <view class="divide_line_30"></view>
  21 + <view style="height:104rpx;padding-left: 30rpx;background-color:#fff">
  22 + <text class="text_gray7_34">减免性质名称</text>
  23 + <image class='arrow_wrap float_right' src='/images/arrow_right.png'></image>
  24 + <input class='input_wrap' style='text-align: right;color:#000;' disabled="true" value="{{item.reduction_nature}}"></input>
  25 + </view>
  26 + <view class="divide_line_30"></view>
  27 + <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
  28 + <text class="text_gray7_34">减免税额</text>
  29 + <input class='input_wrap' style='text-align: right;color:#000;' disabled="true" bindblur="bindIncome" value="{{item.reduction_tax}}"></input>
  30 + </view>
  31 + </view>
  32 +
  33 + <!-- 添加项,可编辑 -->
  34 + <view wx:if="{{showAddView}}" style="background:#fff;margin-top:20rpx">
  35 + <picker style="height:104rpx;padding-left: 30rpx;background-color:#fff" mode="selector" bindchange="bindProjectChange" range="{{project}}">
  36 + <text class="text_gray7_34">所得项目</text>
  37 + <image class='arrow_wrap float_right' src='/images/arrow_right.png'></image>
  38 + <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' value="{{income_item}}"></input>
  39 + </picker>
  40 + <view class="divide_line_30"></view>
  41 + <picker style="height:104rpx;padding-left: 30rpx;background-color:#fff" mode="selector" bindchange="bindDeductContent" range="{{deductcontent}}">
  42 + <text class="text_gray7_34">减免事项名称</text>
  43 + <image class='arrow_wrap float_right' src='/images/arrow_right.png'></image>
  44 + <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' value="{{reduction_item}}"></input>
  45 + </picker>
  46 + <view class="divide_line_30"></view>
  47 + <picker style="height:104rpx;padding-left: 30rpx;background-color:#fff" mode="selector" bindchange="bindDeductProperty" range="{{deductproperty}}">
  48 + <text class="text_gray7_34">减免性质名称</text>
  49 + <image class='arrow_wrap float_right' src='/images/arrow_right.png'></image>
  50 + <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请选择' value="{{reduction_nature}}"></input>
  51 + </picker>
  52 + <view class="divide_line_30"></view>
  53 + <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
  54 + <text class="text_gray7_34">减免税额</text>
  55 + <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' type="digit" bindblur="bindIncome" value="{{reduction_tax}}"></input>
  56 + </view>
  57 + </view>
31 58
32 59 <view style="background:#fff;margin-top:20rpx;height:104rpx;display:flex;align-items:center;justify-content:center;margin-bottom:84rpx" bindtap="addItem">
33 60 <image style="width:28rpx;height:28rpx;margin-right:16rpx" src="/images/add_extra.png"></image>
... ...
... ... @@ -7,7 +7,7 @@ Page({
7 7 */
8 8 data: {
9 9 year: "2019",
10   - show_addview: true,
  10 + showAddView:false,
11 11 infoList: [{}],
12 12 project: ["正常工资薪金", "劳务报酬", "稿酬", "特许经营权使用费"],
13 13 deductcontent: ["高级专家延长离退休期间工薪免征个人所得税", "解除劳动合同当地工资3倍以内免税", "符合条件的津补贴免征个人所得税", "生育津贴和生育医疗费免税", "工伤保险免税", "符合条件的外交人员免征个人所得税", "外籍个人出差补贴免税", "外籍个人探亲费、语言训练费、子女教育费免税", "外籍个人生活费用免税", "符合条件的外籍来华专家工资薪金所得免征个人所得税", "薪金所得免征个人所得数", "横琴、香港、澳门居民免税", "平潭台湾居民免税", "安家费、退职费、退休工资、离休工资、离休生活补助费免税"],
... ... @@ -47,8 +47,11 @@ Page({
47 47 console.log("infoList", result)
48 48 if (result.statusCode == 200) {
49 49 that.setData({
50   - show_addview: true,
51   - infoList: result.data.items
  50 + infoList: result.data.items,
  51 + income_item: "",
  52 + reduction_item: "",
  53 + reduction_nature: "",
  54 + exempt_income: "",
52 55 })
53 56 }
54 57 },
... ... @@ -65,10 +68,7 @@ Page({
65 68 // 所得项目
66 69 bindProjectChange: function(e) {
67 70 console.log('picker,携带值为', e.detail.value)
68   - var list = this.data.infoList
69   - list[list.length - 1].income_item = this.data.project[e.detail.value]
70 71 this.setData({
71   - infoList: list,
72 72 income_item: this.data.project[e.detail.value]
73 73 })
74 74 },
... ... @@ -76,10 +76,7 @@ Page({
76 76 // 减免事项名称
77 77 bindDeductContent: function(e) {
78 78 console.log('picker,携带值为', e.detail.value)
79   - var list = this.data.infoList
80   - list[this.data.infoList.length - 1].reduction_item = this.data.deductcontent[e.detail.value]
81 79 this.setData({
82   - infoList: list,
83 80 reduction_item: this.data.deductcontent[e.detail.value]
84 81 })
85 82 },
... ... @@ -87,10 +84,7 @@ Page({
87 84 // 减免性质名称
88 85 bindDeductProperty: function(e) {
89 86 console.log('picker,携带值为', e.detail.value)
90   - var list = this.data.infoList
91   - list[list.length - 1].reduction_nature = this.data.deductproperty[e.detail.value]
92 87 this.setData({
93   - infoList: list,
94 88 reduction_nature: this.data.deductproperty[e.detail.value]
95 89 })
96 90 },
... ... @@ -98,33 +92,56 @@ Page({
98 92 // 免税收入金额
99 93 bindIncome: function(e) {
100 94 console.log('输入框', e.detail.value)
101   - var list = this.data.infoList
102   - list[list.length - 1].exempt_income = e.detail.value
103 95 this.setData({
104   - infoList: list,
105 96 exempt_income: e.detail.value
106 97 })
107 98 },
108 99
109 100 addItem: function() { //继续添加
110   - var info = this.data.infoList;
111   - console.log(info);
112   - var info_item = {
113   - "income_item": "",
114   - "reduction_item": "",
115   - "reduction_nature": "",
116   - "exempt_income": ""
  101 + if (!this.data.showAddView){//是否新增了view
  102 + this.setData({
  103 + showAddView:true
  104 + })
  105 + return
117 106 }
118   - info.push(info_item);
119   - this.setData({
120   - show_addview: false,
121   - infoList: info
122   - });
  107 + if (!this.data.income_item || this.data.income_item.length < 1) {
  108 + this.showToast("请选择所得项目")
  109 + return
  110 + }
  111 + if (!this.data.reduction_item || this.data.reduction_item.length < 1) {
  112 + this.showToast("请选择减免事项名称")
  113 + return
  114 + }
  115 + if (!this.data.reduction_nature || this.data.reduction_nature.length < 1) {
  116 + this.showToast("请选择减免性质名称")
  117 + return
  118 + }
  119 + if (!this.data.exempt_income || this.data.exempt_income.length < 1) {
  120 + this.showToast("请填写免税收入金额")
  121 + return
  122 + }
  123 + this.goSubmit("1")
123 124 },
124 125
125   - goSubmit: function(e) {
  126 + goSubmit: function(type) {//type=“1”,继续添加(当前页面),type=2保存,返回列表
  127 + if (!this.data.income_item || this.data.income_item.length < 1) {
  128 + this.showToast("请选择所得项目")
  129 + return
  130 + }
  131 + if (!this.data.reduction_item || this.data.reduction_item.length < 1) {
  132 + this.showToast("请选择减免事项名称")
  133 + return
  134 + }
  135 + if (!this.data.reduction_nature || this.data.reduction_nature.length < 1) {
  136 + this.showToast("请选择减免性质名称")
  137 + return
  138 + }
  139 + if (!this.data.exempt_income || this.data.exempt_income.length < 1) {
  140 + this.showToast("请填写免税收入金额")
  141 + return
  142 + }
126 143 var that = this
127   - this.Authorization = getApp().globalData.Authorization;
  144 + this.Authorization = app.globalData.Authorization;
128 145 wx.request({
129 146 url: baseUrl + "payroll/v1/settlement-tax/exempt-income",
130 147 header: {
... ... @@ -141,10 +158,16 @@ Page({
141 158 success: function(result) {
142 159 console.log("infoList", result)
143 160 if (result.statusCode == 200) {
144   - that.setData({
145   - show_addview: true,
146   - infoList: result.data.items
147   - })
  161 + if(type=='1'){
  162 + that.getInfoList()
  163 + that.setData({
  164 + showAddView:true
  165 + })
  166 + }else {
  167 + wx.navigateBack({
  168 + delat:1
  169 + })
  170 + }
148 171 }
149 172 },
150 173 })
... ... @@ -164,6 +187,16 @@ Page({
164 187
165 188 },
166 189
  190 + showToast: function (data) {
  191 + if (data && data.length > 0) {
  192 + wx.showToast({
  193 + title: data,
  194 + icon: "none",
  195 + duration: 2000
  196 + })
  197 + }
  198 + },
  199 +
167 200 /**
168 201 * Page event handler function--Called when user drop down
169 202 */
... ...
... ... @@ -4,32 +4,59 @@
4 4 <text class="text_black3_34 float_right">{{3000}}</text>
5 5 </view>
6 6
  7 + <!-- 列表数据,不可修改 -->
7 8 <view wx:for="{{infoList}}" style="background:#fff;margin-top:20rpx">
  9 + <view style="height:104rpx;padding-left: 30rpx;background-color:#fff">
  10 + <text class="text_gray7_34">所得项目</text>
  11 + <image class='arrow_wrap float_right' src='/images/arrow_right.png'></image>
  12 + <input class='input_wrap' style='text-align: right;color:#000;' disabled="true" value="{{item.income_item}}"></input>
  13 + </view>
  14 + <view class="divide_line_30"></view>
  15 + <view style="height:104rpx;padding-left: 30rpx;background-color:#fff" >
  16 + <text class="text_gray7_34">减免事项名称</text>
  17 + <image class='arrow_wrap float_right' src='/images/arrow_right.png'></image>
  18 + <input class='input_wrap' style='text-align: right;color:#000;' disabled="true" value="{{item.reduction_item}}"></input>
  19 + </view>
  20 + <view class="divide_line_30"></view>
  21 + <view style="height:104rpx;padding-left: 30rpx;background-color:#fff">
  22 + <text class="text_gray7_34">减免性质名称</text>
  23 + <image class='arrow_wrap float_right' src='/images/arrow_right.png'></image>
  24 + <input class='input_wrap' style='text-align: right;color:#000;' disabled="true" value="{{item.reduction_nature}}"></input>
  25 + </view>
  26 + <view class="divide_line_30"></view>
  27 + <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
  28 + <text class="text_gray7_34">免税收入金额</text>
  29 + <input class='input_wrap' style='text-align: right;color:#000;' disabled="true" bindblur="bindIncome" value="{{item.exempt_income}}"></input>
  30 + </view>
  31 + </view>
  32 +
  33 + <!-- 添加项,可编辑 -->
  34 + <view wx:if="{{showAddView}}" style="background:#fff;margin-top:20rpx">
8 35 <picker style="height:104rpx;padding-left: 30rpx;background-color:#fff" mode="selector" bindchange="bindProjectChange" range="{{project}}">
9 36 <text class="text_gray7_34">所得项目</text>
10 37 <image class='arrow_wrap float_right' src='/images/arrow_right.png'></image>
11   - <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' value="{{item.income_item}}"></input>
  38 + <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' value="{{income_item}}"></input>
12 39 </picker>
13 40 <view class="divide_line_30"></view>
14 41 <picker style="height:104rpx;padding-left: 30rpx;background-color:#fff" mode="selector" bindchange="bindDeductContent" range="{{deductcontent}}">
15 42 <text class="text_gray7_34">减免事项名称</text>
16 43 <image class='arrow_wrap float_right' src='/images/arrow_right.png'></image>
17   - <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' name='reduction_item' value="{{item.reduction_item}}"></input>
  44 + <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' value="{{reduction_item}}"></input>
18 45 </picker>
19 46 <view class="divide_line_30"></view>
20 47 <picker style="height:104rpx;padding-left: 30rpx;background-color:#fff" mode="selector" bindchange="bindDeductProperty" range="{{deductproperty}}">
21 48 <text class="text_gray7_34">减免性质名称</text>
22 49 <image class='arrow_wrap float_right' src='/images/arrow_right.png'></image>
23   - <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请选择' name='reduction_nature' value="{{item.reduction_nature}}"></input>
  50 + <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请选择' value="{{reduction_nature}}"></input>
24 51 </picker>
25 52 <view class="divide_line_30"></view>
26 53 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
27 54 <text class="text_gray7_34">免税收入金额</text>
28   - <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' name='name' type="digit" bindblur="bindIncome" value="{{item.exempt_income}}"></input>
  55 + <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' type="digit" bindblur="bindIncome" value="{{exempt_income}}"></input>
29 56 </view>
30 57 </view>
31 58
32   - <view wx:if="{{show_addview}}" style="background:#fff;margin-top:20rpx;height:104rpx;display:flex;align-items:center;justify-content:center;margin-bottom:84rpx" bindtap="addItem">
  59 + <view style="background:#fff;margin-top:20rpx;height:104rpx;display:flex;align-items:center;justify-content:center;margin-bottom:84rpx" bindtap="addItem">
33 60 <image style="width:28rpx;height:28rpx;margin-right:16rpx" src="/images/add_extra.png"></image>
34 61 <text style="font-size:28rpx;color:#4986fe">继续添加</text>
35 62 </view>
... ...
注册登录 后发表评论