|
@@ -21,6 +21,8 @@ Page({ |
|
@@ -21,6 +21,8 @@ Page({ |
21
|
name: ['受益人1', '受益人2'],
|
21
|
name: ['受益人1', '受益人2'],
|
22
|
unit: ''
|
22
|
unit: ''
|
23
|
}],
|
23
|
}],
|
|
|
24
|
+ // 已选择的受益人
|
|
|
25
|
+ beneficiaryList:[],
|
24
|
beneficiaryindex: -1,
|
26
|
beneficiaryindex: -1,
|
25
|
beneficiary_name: '',
|
27
|
beneficiary_name: '',
|
26
|
imgs: [],
|
28
|
imgs: [],
|
|
@@ -35,7 +37,8 @@ Page({ |
|
@@ -35,7 +37,8 @@ Page({ |
35
|
risk_list:[{
|
37
|
risk_list:[{
|
36
|
name:'',
|
38
|
name:'',
|
37
|
projectlist:[],
|
39
|
projectlist:[],
|
38
|
- project_time:''
|
40
|
+ project_time:'',
|
|
|
41
|
+ time: 1
|
39
|
}],
|
42
|
}],
|
40
|
main_array:[]
|
43
|
main_array:[]
|
41
|
|
44
|
|
|
@@ -252,22 +255,41 @@ Page({ |
|
@@ -252,22 +255,41 @@ Page({ |
252
|
beneficiarySelect(e) {
|
255
|
beneficiarySelect(e) {
|
253
|
// console.log(e)
|
256
|
// console.log(e)
|
254
|
var index = e.currentTarget.dataset.mindex
|
257
|
var index = e.currentTarget.dataset.mindex
|
255
|
- var beneficiary_list = this.data.beneficiary_list;
|
|
|
256
|
- for (var i = 0; i < beneficiary_list.length; i++) {
|
|
|
257
|
- for (var j = 0; j < beneficiary_list[i].name.length; j++) {
|
|
|
258
|
- var beneficiary_name = beneficiary_list[i].name[e.detail.value]
|
|
|
259
|
- beneficiary_list[index].beneficiary_name = beneficiary_name
|
|
|
260
|
- // console.log(beneficiary_list)
|
|
|
261
|
- }
|
258
|
+ var beneficiary_list = Object.assign(this.data.beneficiary_list,{});
|
|
|
259
|
+ // 获取当前已选择的收益人
|
|
|
260
|
+ let tempBenefice = Object.assign(this.data.beneficiaryList,{})
|
|
|
261
|
+ // 当前选择的收益人
|
|
|
262
|
+ let nowPerson = beneficiary_list[index].name[e.detail.value];
|
|
|
263
|
+ // 判断受益人是否已经添加
|
|
|
264
|
+ const add = tempBenefice.every((tempBenefice)=>{
|
|
|
265
|
+ return tempBenefice != nowPerson
|
|
|
266
|
+ })
|
|
|
267
|
+ console.log()
|
|
|
268
|
+ if(add){
|
|
|
269
|
+ beneficiary_list[index].beneficiary_name = nowPerson;
|
|
|
270
|
+ tempBenefice.push(nowPerson)
|
|
|
271
|
+ }else{
|
|
|
272
|
+ wx.showToast({
|
|
|
273
|
+ title: '请不要重复添加受益人',
|
|
|
274
|
+ icon: 'none'
|
|
|
275
|
+ })
|
262
|
}
|
276
|
}
|
|
|
277
|
+ // for (var i = 0; i < beneficiary_list.length; i++) {
|
|
|
278
|
+ // for (var j = 0; j < beneficiary_list[i].name.length; j++) {
|
|
|
279
|
+ // var beneficiary_name =
|
|
|
280
|
+
|
|
|
281
|
+ // beneficiary_list[index].beneficiary_name = beneficiary_list[i].name[e.detail.value]
|
|
|
282
|
+ // // console.log(beneficiary_list)
|
|
|
283
|
+ // }
|
|
|
284
|
+ // }
|
263
|
|
285
|
|
264
|
// let tempRangArry = this.data.rang_beneficiary;
|
286
|
// let tempRangArry = this.data.rang_beneficiary;
|
265
|
// tempRangArry[index] = beneficiary_list[index].name[e.detail.value]
|
287
|
// tempRangArry[index] = beneficiary_list[index].name[e.detail.value]
|
266
|
// console.log(tempRangArry)
|
288
|
// console.log(tempRangArry)
|
267
|
|
289
|
|
268
|
this.setData({
|
290
|
this.setData({
|
269
|
- beneficiaryindex: e.detail.value,
|
|
|
270
|
- beneficiary_list: beneficiary_list
|
291
|
+ beneficiary_list: beneficiary_list,
|
|
|
292
|
+ beneficiaryList: tempBenefice
|
271
|
})
|
293
|
})
|
272
|
},
|
294
|
},
|
273
|
|
295
|
|
|
@@ -306,6 +328,21 @@ Page({ |
|
@@ -306,6 +328,21 @@ Page({ |
306
|
beneficiary_list: list
|
328
|
beneficiary_list: list
|
307
|
})
|
329
|
})
|
308
|
},
|
330
|
},
|
|
|
331
|
+ // 删除受益人
|
|
|
332
|
+ deletebenefict(e){
|
|
|
333
|
+ let index = e.currentTarget.dataset.index;
|
|
|
334
|
+ let tempbenefict = Object.assign(this.data.beneficiary_list, {});
|
|
|
335
|
+ let beneficiaryList = Object.assign(this.data.beneficiaryList,{});
|
|
|
336
|
+ // 获取当前选项的受益人
|
|
|
337
|
+ let person = tempbenefict[index].beneficiary_name;
|
|
|
338
|
+ tempbenefict.splice(index, 1);
|
|
|
339
|
+ if (person) beneficiaryList.splice(beneficiaryList.indexOf(person),1)
|
|
|
340
|
+
|
|
|
341
|
+ this.setData({
|
|
|
342
|
+ beneficiaryList: beneficiaryList,
|
|
|
343
|
+ beneficiary_list: tempbenefict
|
|
|
344
|
+ })
|
|
|
345
|
+ },
|
309
|
|
346
|
|
310
|
//添加附加险
|
347
|
//添加附加险
|
311
|
addRisk(){
|
348
|
addRisk(){
|
|
@@ -320,10 +357,15 @@ Page({ |
|
@@ -320,10 +357,15 @@ Page({ |
320
|
risk_list: risk_list
|
357
|
risk_list: risk_list
|
321
|
})
|
358
|
})
|
322
|
},
|
359
|
},
|
323
|
-
|
|
|
324
|
-
|
|
|
325
|
-
|
|
|
326
|
-
|
360
|
+ //删除附加险
|
|
|
361
|
+ deleteRisk(e) {
|
|
|
362
|
+ let index = e.currentTarget.dataset.index;
|
|
|
363
|
+ let risk_list = Object.assign(this.data.risk_list, {});
|
|
|
364
|
+ risk_list.splice(index, 1);
|
|
|
365
|
+ this.setData({
|
|
|
366
|
+ risk_list: risk_list
|
|
|
367
|
+ })
|
|
|
368
|
+ },
|
327
|
//上传图片
|
369
|
//上传图片
|
328
|
uploadImage() {
|
370
|
uploadImage() {
|
329
|
let that = this;
|
371
|
let that = this;
|
|
@@ -449,14 +491,15 @@ Page({ |
|
@@ -449,14 +491,15 @@ Page({ |
449
|
},
|
491
|
},
|
450
|
|
492
|
|
451
|
selectUnit4(e) {
|
493
|
selectUnit4(e) {
|
452
|
- var unit = e.currentTarget.dataset.unit
|
494
|
+ var unit = e.currentTarget.dataset.unit;
|
|
|
495
|
+ let index = e.currentTarget.dataset.index;
|
|
|
496
|
+ let risk_list = Object.assign(this.data.risk_list,{});
|
|
|
497
|
+ risk_list[index].time = unit
|
453
|
this.setData({
|
498
|
this.setData({
|
454
|
- unit4: unit
|
499
|
+ risk_list: risk_list
|
455
|
})
|
500
|
})
|
456
|
},
|
501
|
},
|
457
|
|
502
|
|
458
|
-
|
|
|
459
|
-
|
|
|
460
|
// 保单验证&&上传保单
|
503
|
// 保单验证&&上传保单
|
461
|
listVerify(e) {
|
504
|
listVerify(e) {
|
462
|
// this.insureItem()
|
505
|
// this.insureItem()
|