|
@@ -32,12 +32,12 @@ Page({ |
|
@@ -32,12 +32,12 @@ Page({ |
32
|
applicant_name: '',
|
32
|
applicant_name: '',
|
33
|
recognizee_name: '',
|
33
|
recognizee_name: '',
|
34
|
rang_beneficiary: [],
|
34
|
rang_beneficiary: [],
|
35
|
-
|
|
|
36
|
risk_list:[{
|
35
|
risk_list:[{
|
37
|
name:'',
|
36
|
name:'',
|
38
|
- projectlist:[{}],
|
37
|
+ projectlist:[],
|
39
|
project_time:''
|
38
|
project_time:''
|
40
|
}],
|
39
|
}],
|
|
|
40
|
+ main_array:[]
|
41
|
|
41
|
|
42
|
},
|
42
|
},
|
43
|
|
43
|
|
|
@@ -81,12 +81,47 @@ Page({ |
|
@@ -81,12 +81,47 @@ Page({ |
81
|
},
|
81
|
},
|
82
|
|
82
|
|
83
|
//保障项目弹窗
|
83
|
//保障项目弹窗
|
84
|
- ensureProject() {
|
84
|
+ ensureProject(e) {
|
|
|
85
|
+ let that = this;
|
|
|
86
|
+ let type = e.currentTarget.dataset.type;
|
|
|
87
|
+ let index = e.currentTarget.dataset.xulie;
|
|
|
88
|
+ let tempProjectlist = Object.assign(this.data.projectlist, {}) ;
|
|
|
89
|
+ // 已经添加的附加险
|
|
|
90
|
+ let rist_list = Object.assign(this.data.risk_list,{});
|
|
|
91
|
+ let tempRist = rist_list[index].projectlist;
|
|
|
92
|
+ // 已经添加的主险
|
|
|
93
|
+ let tempMain_list = Object.assign(this.data.main_array, {})
|
|
|
94
|
+ if(type=='zhuxian'){
|
|
|
95
|
+ if (tempMain_list.length>0) {
|
|
|
96
|
+ for (let i in tempProjectlist) {
|
|
|
97
|
+ for (let j in tempMain_list) {
|
|
|
98
|
+ if (tempProjectlist[i].id == tempMain_list[j].id) {
|
|
|
99
|
+ tempProjectlist[i] = tempMain_list[j]
|
|
|
100
|
+ }
|
|
|
101
|
+ }
|
|
|
102
|
+ }
|
|
|
103
|
+ }
|
|
|
104
|
+ }else{
|
|
|
105
|
+ if (tempRist.length){
|
|
|
106
|
+ for (let i in tempProjectlist) {
|
|
|
107
|
+ for (let j in tempRist){
|
|
|
108
|
+ if (tempProjectlist[i].id == tempRist[j].id) {
|
|
|
109
|
+ tempProjectlist[i] = tempRist[j]
|
|
|
110
|
+ }
|
|
|
111
|
+ }
|
|
|
112
|
+ }
|
|
|
113
|
+ }
|
|
|
114
|
+
|
|
|
115
|
+ }
|
85
|
wx.setNavigationBarTitle({
|
116
|
wx.setNavigationBarTitle({
|
86
|
title: '选择保障项目',
|
117
|
title: '选择保障项目',
|
87
|
})
|
118
|
})
|
88
|
this.setData({
|
119
|
this.setData({
|
89
|
- popup_state: true
|
120
|
+ popup_state: true,
|
|
|
121
|
+ addType: type,
|
|
|
122
|
+ xulie: index,
|
|
|
123
|
+ projectlist: tempProjectlist
|
|
|
124
|
+
|
90
|
})
|
125
|
})
|
91
|
},
|
126
|
},
|
92
|
|
127
|
|
|
@@ -135,12 +170,12 @@ Page({ |
|
@@ -135,12 +170,12 @@ Page({ |
135
|
|
170
|
|
136
|
//保障项目金额
|
171
|
//保障项目金额
|
137
|
popupNum(e) {
|
172
|
popupNum(e) {
|
138
|
- var main_risk = this.data.main_risk
|
173
|
+ // var main_risk = this.data.main_risk
|
139
|
var index = e.currentTarget.dataset.index;
|
174
|
var index = e.currentTarget.dataset.index;
|
140
|
var projectlist = this.data.projectlist;
|
175
|
var projectlist = this.data.projectlist;
|
141
|
if (projectlist[index].choose_status) {
|
176
|
if (projectlist[index].choose_status) {
|
142
|
projectlist[index].num = e.detail.value
|
177
|
projectlist[index].num = e.detail.value
|
143
|
- main_risk[index].num = projectlist[index].num
|
178
|
+ // main_risk[index].num = projectlist[index].num
|
144
|
}
|
179
|
}
|
145
|
console.log(main_risk)
|
180
|
console.log(main_risk)
|
146
|
this.setData({
|
181
|
this.setData({
|
|
@@ -152,58 +187,60 @@ Page({ |
|
@@ -152,58 +187,60 @@ Page({ |
152
|
popupState(e) {
|
187
|
popupState(e) {
|
153
|
var index = e.currentTarget.dataset.index;
|
188
|
var index = e.currentTarget.dataset.index;
|
154
|
var projectlist = this.data.projectlist;
|
189
|
var projectlist = this.data.projectlist;
|
155
|
- var checkstate = projectlist[index].choose_status;
|
|
|
156
|
- var selectitem = [];
|
|
|
157
|
- var length = this.data.projectlist.length
|
|
|
158
|
- var main_risk = this.data.main_risk
|
|
|
159
|
- var popup_state = this.data.popup_state
|
|
|
160
|
- if (checkstate == false) {
|
|
|
161
|
- projectlist[index].choose_status = true
|
|
|
162
|
- } else {
|
|
|
163
|
- projectlist[index].choose_status = false
|
|
|
164
|
- }
|
190
|
+ projectlist[index].choose_status = !projectlist[index].choose_status;
|
|
|
191
|
+ console.log(projectlist)
|
165
|
this.setData({
|
192
|
this.setData({
|
166
|
projectlist: projectlist
|
193
|
projectlist: projectlist
|
167
|
- })
|
194
|
+ })
|
168
|
},
|
195
|
},
|
169
|
|
196
|
|
170
|
//确认选择的推荐方案
|
197
|
//确认选择的推荐方案
|
171
|
confirmCase() {
|
198
|
confirmCase() {
|
|
|
199
|
+ let index = this.data.xulie;
|
|
|
200
|
+ let type = this.data.addType;
|
172
|
var that = this
|
201
|
var that = this
|
173
|
var main_array = []
|
202
|
var main_array = []
|
174
|
- let dindex = wx.getStorageSync('dindex')
|
|
|
175
|
- var projectlist = this.data.projectlist
|
203
|
+ var projectlist = Object.assign(this.data.projectlist,{})
|
176
|
for (var i = 0; i < projectlist.length; i++) {
|
204
|
for (var i = 0; i < projectlist.length; i++) {
|
177
|
- for (var j = 0; j < projectlist[i].title.length; j++) {
|
|
|
178
|
if (projectlist[i].choose_status) {
|
205
|
if (projectlist[i].choose_status) {
|
179
|
- if (projectlist[i].title[j].label_state) {
|
|
|
180
|
- main_array.push(projectlist[i])
|
|
|
181
|
- }
|
206
|
+ main_array.push(projectlist[i])
|
182
|
}
|
207
|
}
|
183
|
- console.log(main_array)
|
|
|
184
|
- }
|
|
|
185
|
}
|
208
|
}
|
|
|
209
|
+
|
186
|
if (main_array != '') {
|
210
|
if (main_array != '') {
|
187
|
wx.showToast({
|
211
|
wx.showToast({
|
188
|
title: '添加成功',
|
212
|
title: '添加成功',
|
189
|
icon: 'none'
|
213
|
icon: 'none'
|
190
|
})
|
214
|
})
|
191
|
- var temp = main_array
|
|
|
192
|
- for (var i = 0; i < main_array.length; i++) {
|
|
|
193
|
- for (var j = 0; j < main_array[i].title.length; j++) {
|
|
|
194
|
- if (main_array[i].title[j].label_state) {
|
|
|
195
|
- main_array[i].title = main_array[i].title[j].name
|
|
|
196
|
- }
|
|
|
197
|
- console.log(main_array)
|
|
|
198
|
- }
|
215
|
+ if(type=='fujiaxian'){
|
|
|
216
|
+ let tempRist = that.data.risk_list;
|
|
|
217
|
+ tempRist[index]['projectlist'] = main_array;
|
|
|
218
|
+ that.setData({
|
|
|
219
|
+ risk_list: tempRist,
|
|
|
220
|
+ })
|
|
|
221
|
+ }else{
|
|
|
222
|
+ that.setData({
|
|
|
223
|
+ main_array: main_array,
|
|
|
224
|
+ })
|
199
|
}
|
225
|
}
|
200
|
- that.setData({
|
|
|
201
|
- main_array: main_array
|
|
|
202
|
- })
|
226
|
+
|
|
|
227
|
+ // var temp = main_array
|
|
|
228
|
+ // for (var i = 0; i < main_array.length; i++) {
|
|
|
229
|
+ // for (var j = 0; j < main_array[i].title.length; j++) {
|
|
|
230
|
+ // if (main_array[i].title[j].label_state) {
|
|
|
231
|
+ // main_array[i].title = main_array[i].title[j].name
|
|
|
232
|
+ // }
|
|
|
233
|
+ // console.log(main_array)
|
|
|
234
|
+ // }
|
|
|
235
|
+ // }
|
|
|
236
|
+ // that.setData({
|
|
|
237
|
+ // main_array: main_array
|
|
|
238
|
+ // })
|
203
|
}
|
239
|
}
|
204
|
setTimeout(function() {
|
240
|
setTimeout(function() {
|
|
|
241
|
+ that.ensureProjectList()
|
205
|
that.setData({
|
242
|
that.setData({
|
206
|
- popup_state: false,
|
243
|
+ popup_state: false
|
207
|
})
|
244
|
})
|
208
|
wx.setNavigationBarTitle({
|
245
|
wx.setNavigationBarTitle({
|
209
|
title: '添加保单',
|
246
|
title: '添加保单',
|
|
@@ -272,11 +309,11 @@ Page({ |
|
@@ -272,11 +309,11 @@ Page({ |
272
|
|
309
|
|
273
|
//添加附加险
|
310
|
//添加附加险
|
274
|
addRisk(){
|
311
|
addRisk(){
|
275
|
- var risk_list=this.data.risk_list
|
312
|
+ var risk_list = Object.assign(this.data.risk_list,{});
|
276
|
var len=risk_list.length
|
313
|
var len=risk_list.length
|
277
|
risk_list[len] = {
|
314
|
risk_list[len] = {
|
278
|
name: '',
|
315
|
name: '',
|
279
|
- projectlist: [{}],
|
316
|
+ projectlist: [],
|
280
|
project_time: ''
|
317
|
project_time: ''
|
281
|
}
|
318
|
}
|
282
|
this.setData({
|
319
|
this.setData({
|