...
|
...
|
@@ -12,36 +12,38 @@ Page({ |
12
|
12
|
flag_housing02: false,
|
13
|
13
|
legal_entity_id: '',
|
14
|
14
|
legal_entity: '',
|
15
|
|
-
|
|
15
|
+ type: "",
|
|
16
|
+ selectdata: {},
|
16
|
17
|
selectIndex: [{
|
17
|
|
- message: '子女教育',
|
18
|
|
- disable_change: '',
|
19
|
|
- status: "children_education",
|
20
|
|
- sureid: false
|
21
|
|
- }, {
|
22
|
|
- message: '继续教育',
|
23
|
|
- disable_change: '',
|
24
|
|
- status: "continuing_education",
|
25
|
|
- sureid: false
|
26
|
|
- }, {
|
27
|
|
- message: '赡养老人',
|
28
|
|
- disable_change: '',
|
29
|
|
- status: "support_duty",
|
30
|
|
- sureid: false
|
31
|
|
- },
|
32
|
|
- // {
|
33
|
|
- // message: '大病医疗',
|
34
|
|
- // disable_change: '',
|
35
|
|
- // status: "medical_fund",
|
36
|
|
- // sureid: false
|
37
|
|
- // },
|
38
|
|
- {
|
39
|
|
- message: '住房',
|
40
|
|
- sureid: false,
|
41
|
|
- disable_change: '',
|
42
|
|
- status: "",
|
43
|
|
- extra_message: ''
|
44
|
|
- }, ],
|
|
18
|
+ message: '子女教育',
|
|
19
|
+ disable_change: '',
|
|
20
|
+ status: "children_education",
|
|
21
|
+ sureid: false
|
|
22
|
+ }, {
|
|
23
|
+ message: '继续教育',
|
|
24
|
+ disable_change: '',
|
|
25
|
+ status: "continuing_education",
|
|
26
|
+ sureid: false
|
|
27
|
+ }, {
|
|
28
|
+ message: '赡养老人',
|
|
29
|
+ disable_change: '',
|
|
30
|
+ status: "support_duty",
|
|
31
|
+ sureid: false
|
|
32
|
+ },
|
|
33
|
+ // {
|
|
34
|
+ // message: '大病医疗',
|
|
35
|
+ // disable_change: '',
|
|
36
|
+ // status: "medical_fund",
|
|
37
|
+ // sureid: false
|
|
38
|
+ // },
|
|
39
|
+ {
|
|
40
|
+ message: '住房',
|
|
41
|
+ sureid: false,
|
|
42
|
+ disable_change: '',
|
|
43
|
+ status: "",
|
|
44
|
+ extra_message: ''
|
|
45
|
+ },
|
|
46
|
+ ],
|
45
|
47
|
},
|
46
|
48
|
|
47
|
49
|
/**
|
...
|
...
|
@@ -51,9 +53,13 @@ Page({ |
51
|
53
|
console.log("onLoad", options)
|
52
|
54
|
this.setData({
|
53
|
55
|
legal_entity_id: options.legal_entity_id,
|
54
|
|
- legal_entity: options.legal_entity
|
|
56
|
+ legal_entity: options.legal_entity,
|
|
57
|
+ type: options.type,
|
|
58
|
+ selectdata: options.select_data ? JSON.parse(options.select_data) : {}
|
55
|
59
|
})
|
56
|
|
-
|
|
60
|
+ if (options.type == '1' && options.select_data && JSON.parse(options.select_data)) {
|
|
61
|
+ this.handleData(JSON.parse(options.select_data))
|
|
62
|
+ }
|
57
|
63
|
},
|
58
|
64
|
|
59
|
65
|
/**
|
...
|
...
|
@@ -70,6 +76,52 @@ Page({ |
70
|
76
|
|
71
|
77
|
},
|
72
|
78
|
|
|
79
|
+ handleData: function(data) {
|
|
80
|
+ var selectarray = data.addition_items;
|
|
81
|
+ console.log("handleData", data)
|
|
82
|
+ var selectIndex = this.data.selectIndex;
|
|
83
|
+
|
|
84
|
+ if (selectarray.length > 0) {
|
|
85
|
+ wx.showLoading({
|
|
86
|
+ title: '',
|
|
87
|
+ })
|
|
88
|
+ for (var i = 0; i < selectarray.length; i++) {
|
|
89
|
+ if (selectarray[i].addition_category == 'children_education') { //子女教育
|
|
90
|
+ selectIndex[0].sureid = true
|
|
91
|
+ selectIndex[0].disable_change = true
|
|
92
|
+ }
|
|
93
|
+ if (selectarray[i].addition_category == 'continuing_education') { //继续教育
|
|
94
|
+ selectIndex[1].sureid = true
|
|
95
|
+ selectIndex[1].disable_change = true
|
|
96
|
+ }
|
|
97
|
+ if (selectarray[i].addition_category == 'support_duty') { //赡养老人
|
|
98
|
+ selectIndex[2].sureid = true
|
|
99
|
+ selectIndex[2].disable_change = true
|
|
100
|
+ }
|
|
101
|
+ if (selectarray[i].addition_category == 'house_fund_rent') { //住房(租房)
|
|
102
|
+ selectIndex[3].sureid = true
|
|
103
|
+ selectIndex[3].disable_change = true
|
|
104
|
+ this.setData({
|
|
105
|
+ flag_housing01: false,
|
|
106
|
+ flag_housing02: true,
|
|
107
|
+ })
|
|
108
|
+ }
|
|
109
|
+ if (selectarray[i].addition_category == 'house_fund_loan') { //住房(租房)
|
|
110
|
+ selectIndex[3].sureid = true
|
|
111
|
+ selectIndex[3].disable_change = true
|
|
112
|
+ this.setData({
|
|
113
|
+ flag_housing01: true,
|
|
114
|
+ flag_housing02: false,
|
|
115
|
+ })
|
|
116
|
+ }
|
|
117
|
+ }
|
|
118
|
+ this.setData({
|
|
119
|
+ selectIndex: selectIndex
|
|
120
|
+ })
|
|
121
|
+ wx.hideLoading()
|
|
122
|
+ }
|
|
123
|
+ },
|
|
124
|
+
|
73
|
125
|
selectRep: function(e) {
|
74
|
126
|
let index = e.currentTarget.dataset.selectindex;
|
75
|
127
|
let selectIndex = this.data.selectIndex; //取到data里的selectIndex
|
...
|
...
|
@@ -136,7 +188,7 @@ Page({ |
136
|
188
|
} else {
|
137
|
189
|
wx.showToast({
|
138
|
190
|
title: '请选择住房类型',
|
139
|
|
- icon:"none"
|
|
191
|
+ icon: "none"
|
140
|
192
|
})
|
141
|
193
|
return;
|
142
|
194
|
}
|
...
|
...
|
@@ -155,8 +207,11 @@ Page({ |
155
|
207
|
})
|
156
|
208
|
return;
|
157
|
209
|
}
|
158
|
|
- this.goDeclare(stuatusarray)
|
159
|
|
-
|
|
210
|
+ if (this.data.type == '0') {
|
|
211
|
+ this.goDeclare(stuatusarray)
|
|
212
|
+ } else if (this.data.type == '1'){
|
|
213
|
+ this.goUpdate(stuatusarray)
|
|
214
|
+ }
|
160
|
215
|
},
|
161
|
216
|
|
162
|
217
|
goDeclare: function(array) {
|
...
|
...
|
@@ -185,6 +240,32 @@ Page({ |
185
|
240
|
})
|
186
|
241
|
},
|
187
|
242
|
|
|
243
|
+ goUpdate: function (array) {
|
|
244
|
+ var that = this;
|
|
245
|
+ var Authorization = getApp().globalData.Authorization;
|
|
246
|
+ wx.request({
|
|
247
|
+ url: baseUrl + 'persontax/v1/update-addition-setting',
|
|
248
|
+ data: {
|
|
249
|
+ "legal_entity_id": that.data.legal_entity_id,
|
|
250
|
+ "id": that.data.selectdata?that.data.selectdata.id:'',
|
|
251
|
+ "options": array
|
|
252
|
+ },
|
|
253
|
+ method: "PUT",
|
|
254
|
+ header: {
|
|
255
|
+ 'content-type': 'application/json',
|
|
256
|
+ "Authorization": Authorization
|
|
257
|
+ },
|
|
258
|
+ success: function (res) {
|
|
259
|
+ if (res && res.data) {
|
|
260
|
+ console.log("res", res)
|
|
261
|
+ wx.redirectTo({
|
|
262
|
+ url: '../godetail/godetail?datas=' + JSON.stringify(res.data)
|
|
263
|
+ })
|
|
264
|
+ }
|
|
265
|
+ }
|
|
266
|
+ })
|
|
267
|
+ },
|
|
268
|
+
|
188
|
269
|
/**
|
189
|
270
|
* Lifecycle function--Called when page hide
|
190
|
271
|
*/
|
...
|
...
|
|