|
@@ -21,6 +21,7 @@ Page({ |
|
@@ -21,6 +21,7 @@ Page({ |
21
|
name: ['受益人1', '受益人2'],
|
21
|
name: ['受益人1', '受益人2'],
|
22
|
unit: ''
|
22
|
unit: ''
|
23
|
}],
|
23
|
}],
|
|
|
24
|
+ tempfavoree: [],
|
24
|
beneficiaryindex: -1,
|
25
|
beneficiaryindex: -1,
|
25
|
beneficiary_name: '',
|
26
|
beneficiary_name: '',
|
26
|
imgs: [],
|
27
|
imgs: [],
|
|
@@ -32,13 +33,18 @@ Page({ |
|
@@ -32,13 +33,18 @@ Page({ |
32
|
applicant_name: '',
|
33
|
applicant_name: '',
|
33
|
recognizee_name: '',
|
34
|
recognizee_name: '',
|
34
|
rang_beneficiary: [],
|
35
|
rang_beneficiary: [],
|
35
|
- risk_list:[{
|
|
|
36
|
- name:'',
|
|
|
37
|
- projectlist:[],
|
|
|
38
|
- project_time:''
|
36
|
+ risk_list: [{
|
|
|
37
|
+ name: '',
|
|
|
38
|
+ projectlist: [],
|
|
|
39
|
+ project_time: ''
|
39
|
}],
|
40
|
}],
|
40
|
- main_array:[]
|
|
|
41
|
-
|
41
|
+ main_array: [],
|
|
|
42
|
+ warranty_one: [],
|
|
|
43
|
+ warranty_two: [],
|
|
|
44
|
+ guarantee_name: '',
|
|
|
45
|
+ long_money: [],
|
|
|
46
|
+ time_name: '',
|
|
|
47
|
+ type_money: '',
|
42
|
},
|
48
|
},
|
43
|
|
49
|
|
44
|
//投保人
|
50
|
//投保人
|
|
@@ -85,14 +91,14 @@ Page({ |
|
@@ -85,14 +91,14 @@ Page({ |
85
|
let that = this;
|
91
|
let that = this;
|
86
|
let type = e.currentTarget.dataset.type;
|
92
|
let type = e.currentTarget.dataset.type;
|
87
|
let index = e.currentTarget.dataset.xulie;
|
93
|
let index = e.currentTarget.dataset.xulie;
|
88
|
- let tempProjectlist = Object.assign(this.data.projectlist, {}) ;
|
94
|
+ let tempProjectlist = Object.assign(this.data.projectlist, {});
|
89
|
// 已经添加的附加险
|
95
|
// 已经添加的附加险
|
90
|
- let rist_list = Object.assign(this.data.risk_list,{});
|
96
|
+ let rist_list = Object.assign(this.data.risk_list, {});
|
91
|
let tempRist = rist_list[index].projectlist;
|
97
|
let tempRist = rist_list[index].projectlist;
|
92
|
// 已经添加的主险
|
98
|
// 已经添加的主险
|
93
|
let tempMain_list = Object.assign(this.data.main_array, {})
|
99
|
let tempMain_list = Object.assign(this.data.main_array, {})
|
94
|
- if(type=='zhuxian'){
|
|
|
95
|
- if (tempMain_list.length>0) {
|
100
|
+ if (type == 'zhuxian') {
|
|
|
101
|
+ if (tempMain_list.length > 0) {
|
96
|
for (let i in tempProjectlist) {
|
102
|
for (let i in tempProjectlist) {
|
97
|
for (let j in tempMain_list) {
|
103
|
for (let j in tempMain_list) {
|
98
|
if (tempProjectlist[i].id == tempMain_list[j].id) {
|
104
|
if (tempProjectlist[i].id == tempMain_list[j].id) {
|
|
@@ -101,10 +107,10 @@ Page({ |
|
@@ -101,10 +107,10 @@ Page({ |
101
|
}
|
107
|
}
|
102
|
}
|
108
|
}
|
103
|
}
|
109
|
}
|
104
|
- }else{
|
|
|
105
|
- if (tempRist.length){
|
110
|
+ } else {
|
|
|
111
|
+ if (tempRist.length) {
|
106
|
for (let i in tempProjectlist) {
|
112
|
for (let i in tempProjectlist) {
|
107
|
- for (let j in tempRist){
|
113
|
+ for (let j in tempRist) {
|
108
|
if (tempProjectlist[i].id == tempRist[j].id) {
|
114
|
if (tempProjectlist[i].id == tempRist[j].id) {
|
109
|
tempProjectlist[i] = tempRist[j]
|
115
|
tempProjectlist[i] = tempRist[j]
|
110
|
}
|
116
|
}
|
|
@@ -144,7 +150,7 @@ Page({ |
|
@@ -144,7 +150,7 @@ Page({ |
144
|
this.setData({
|
150
|
this.setData({
|
145
|
projectlist: res.data.data.def
|
151
|
projectlist: res.data.data.def
|
146
|
})
|
152
|
})
|
147
|
- console.log(this.data.projectlist)
|
153
|
+ // console.log(this.data.projectlist)
|
148
|
}
|
154
|
}
|
149
|
})
|
155
|
})
|
150
|
},
|
156
|
},
|
|
@@ -170,12 +176,10 @@ Page({ |
|
@@ -170,12 +176,10 @@ Page({ |
170
|
|
176
|
|
171
|
//保障项目金额
|
177
|
//保障项目金额
|
172
|
popupNum(e) {
|
178
|
popupNum(e) {
|
173
|
- // var main_risk = this.data.main_risk
|
|
|
174
|
var index = e.currentTarget.dataset.index;
|
179
|
var index = e.currentTarget.dataset.index;
|
175
|
var projectlist = this.data.projectlist;
|
180
|
var projectlist = this.data.projectlist;
|
176
|
if (projectlist[index].choose_status) {
|
181
|
if (projectlist[index].choose_status) {
|
177
|
projectlist[index].num = e.detail.value
|
182
|
projectlist[index].num = e.detail.value
|
178
|
- // main_risk[index].num = projectlist[index].num
|
|
|
179
|
}
|
183
|
}
|
180
|
console.log(main_risk)
|
184
|
console.log(main_risk)
|
181
|
this.setData({
|
185
|
this.setData({
|
|
@@ -188,7 +192,7 @@ Page({ |
|
@@ -188,7 +192,7 @@ Page({ |
188
|
var index = e.currentTarget.dataset.index;
|
192
|
var index = e.currentTarget.dataset.index;
|
189
|
var projectlist = this.data.projectlist;
|
193
|
var projectlist = this.data.projectlist;
|
190
|
projectlist[index].choose_status = !projectlist[index].choose_status;
|
194
|
projectlist[index].choose_status = !projectlist[index].choose_status;
|
191
|
- console.log(projectlist)
|
195
|
+ // console.log(projectlist)
|
192
|
this.setData({
|
196
|
this.setData({
|
193
|
projectlist: projectlist
|
197
|
projectlist: projectlist
|
194
|
})
|
198
|
})
|
|
@@ -200,7 +204,7 @@ Page({ |
|
@@ -200,7 +204,7 @@ Page({ |
200
|
let type = this.data.addType;
|
204
|
let type = this.data.addType;
|
201
|
var that = this
|
205
|
var that = this
|
202
|
var main_array = []
|
206
|
var main_array = []
|
203
|
- var projectlist = Object.assign(this.data.projectlist,{})
|
207
|
+ var projectlist = Object.assign(this.data.projectlist, {})
|
204
|
for (var i = 0; i < projectlist.length; i++) {
|
208
|
for (var i = 0; i < projectlist.length; i++) {
|
205
|
if (projectlist[i].choose_status) {
|
209
|
if (projectlist[i].choose_status) {
|
206
|
main_array.push(projectlist[i])
|
210
|
main_array.push(projectlist[i])
|
|
@@ -212,18 +216,18 @@ Page({ |
|
@@ -212,18 +216,18 @@ Page({ |
212
|
title: '添加成功',
|
216
|
title: '添加成功',
|
213
|
icon: 'none'
|
217
|
icon: 'none'
|
214
|
})
|
218
|
})
|
215
|
- if(type=='fujiaxian'){
|
219
|
+ if (type == 'fujiaxian') {
|
216
|
let tempRist = that.data.risk_list;
|
220
|
let tempRist = that.data.risk_list;
|
217
|
tempRist[index]['projectlist'] = main_array;
|
221
|
tempRist[index]['projectlist'] = main_array;
|
218
|
that.setData({
|
222
|
that.setData({
|
219
|
risk_list: tempRist,
|
223
|
risk_list: tempRist,
|
220
|
})
|
224
|
})
|
221
|
- }else{
|
225
|
+ } else {
|
222
|
that.setData({
|
226
|
that.setData({
|
223
|
main_array: main_array,
|
227
|
main_array: main_array,
|
224
|
})
|
228
|
})
|
225
|
}
|
229
|
}
|
226
|
-
|
230
|
+ console.log(this.data.main_array)
|
227
|
// var temp = main_array
|
231
|
// var temp = main_array
|
228
|
// for (var i = 0; i < main_array.length; i++) {
|
232
|
// for (var i = 0; i < main_array.length; i++) {
|
229
|
// for (var j = 0; j < main_array[i].title.length; j++) {
|
233
|
// for (var j = 0; j < main_array[i].title.length; j++) {
|
|
@@ -248,6 +252,30 @@ Page({ |
|
@@ -248,6 +252,30 @@ Page({ |
248
|
}, 1000)
|
252
|
}, 1000)
|
249
|
},
|
253
|
},
|
250
|
|
254
|
|
|
|
255
|
+ //主线保障期
|
|
|
256
|
+ tempMain() {
|
|
|
257
|
+ // var main_array = this.data.main_array
|
|
|
258
|
+ // var warranty_one = this.data.warranty_one
|
|
|
259
|
+ // var temp = {}
|
|
|
260
|
+ // var len = main_array.length
|
|
|
261
|
+ // for (var i = 0; i < main_array.length; i++) {
|
|
|
262
|
+ // if (main_array[i].choose_status) {
|
|
|
263
|
+ // temp.num = main_array[i].beneficiary_name
|
|
|
264
|
+ // temp.title = main_array[i].name
|
|
|
265
|
+ // warranty_one.push(temp)
|
|
|
266
|
+ // }
|
|
|
267
|
+ // var hash = {};
|
|
|
268
|
+ // var temrecommend = warranty_one.reduce(function (item, next) {
|
|
|
269
|
+ // hash[next.name] ? '' : hash[next.name] = true && item.push(next);
|
|
|
270
|
+ // return item
|
|
|
271
|
+ // }, [])
|
|
|
272
|
+ // console.log(temrecommend)
|
|
|
273
|
+ // this.setData({
|
|
|
274
|
+ // warranty_one: temrecommend
|
|
|
275
|
+ // })
|
|
|
276
|
+ // }
|
|
|
277
|
+ },
|
|
|
278
|
+
|
251
|
//选择受益人姓名
|
279
|
//选择受益人姓名
|
252
|
beneficiarySelect(e) {
|
280
|
beneficiarySelect(e) {
|
253
|
// console.log(e)
|
281
|
// console.log(e)
|
|
@@ -269,8 +297,10 @@ Page({ |
|
@@ -269,8 +297,10 @@ Page({ |
269
|
beneficiaryindex: e.detail.value,
|
297
|
beneficiaryindex: e.detail.value,
|
270
|
beneficiary_list: beneficiary_list
|
298
|
beneficiary_list: beneficiary_list
|
271
|
})
|
299
|
})
|
|
|
300
|
+
|
272
|
},
|
301
|
},
|
273
|
|
302
|
|
|
|
303
|
+
|
274
|
//添加收益比例
|
304
|
//添加收益比例
|
275
|
addUnit(e) {
|
305
|
addUnit(e) {
|
276
|
// console.log(e)
|
306
|
// console.log(e)
|
|
@@ -305,12 +335,39 @@ Page({ |
|
@@ -305,12 +335,39 @@ Page({ |
305
|
this.setData({
|
335
|
this.setData({
|
306
|
beneficiary_list: list
|
336
|
beneficiary_list: list
|
307
|
})
|
337
|
})
|
|
|
338
|
+ console.log(this.data.beneficiary_list)
|
|
|
339
|
+ },
|
|
|
340
|
+
|
|
|
341
|
+ //重组添加受益人
|
|
|
342
|
+ tempBeneficiary() {
|
|
|
343
|
+ var beneficiary_list = this.data.beneficiary_list
|
|
|
344
|
+ var tempfavoree = this.data.tempfavoree
|
|
|
345
|
+ var temp = {}
|
|
|
346
|
+ var len = beneficiary_list.length
|
|
|
347
|
+ for (var i = 0; i < beneficiary_list.length; i++) {
|
|
|
348
|
+ if (beneficiary_list[i].unit != '') {
|
|
|
349
|
+ temp.name = beneficiary_list[i].beneficiary_name
|
|
|
350
|
+ temp.unit = beneficiary_list[i].unit
|
|
|
351
|
+ tempfavoree.push(temp)
|
|
|
352
|
+ }
|
|
|
353
|
+ var hash = {};
|
|
|
354
|
+ var temrecommend = tempfavoree.reduce(function(item, next) {
|
|
|
355
|
+ hash[next.name] ? '' : hash[next.name] = true && item.push(next);
|
|
|
356
|
+ return item
|
|
|
357
|
+ }, [])
|
|
|
358
|
+ // console.log(temrecommend)
|
|
|
359
|
+ this.setData({
|
|
|
360
|
+ tempfavoree: temrecommend
|
|
|
361
|
+ })
|
|
|
362
|
+
|
|
|
363
|
+ }
|
308
|
},
|
364
|
},
|
309
|
|
365
|
|
310
|
-//添加附加险
|
|
|
311
|
- addRisk(){
|
|
|
312
|
- var risk_list = Object.assign(this.data.risk_list,{});
|
|
|
313
|
- var len=risk_list.length
|
366
|
+
|
|
|
367
|
+ //添加附加险
|
|
|
368
|
+ addRisk() {
|
|
|
369
|
+ var risk_list = Object.assign(this.data.risk_list, {});
|
|
|
370
|
+ var len = risk_list.length
|
314
|
risk_list[len] = {
|
371
|
risk_list[len] = {
|
315
|
name: '',
|
372
|
name: '',
|
316
|
projectlist: [],
|
373
|
projectlist: [],
|
|
@@ -321,9 +378,6 @@ Page({ |
|
@@ -321,9 +378,6 @@ Page({ |
321
|
})
|
378
|
})
|
322
|
},
|
379
|
},
|
323
|
|
380
|
|
324
|
-
|
|
|
325
|
-
|
|
|
326
|
-
|
|
|
327
|
//上传图片
|
381
|
//上传图片
|
328
|
uploadImage() {
|
382
|
uploadImage() {
|
329
|
let that = this;
|
383
|
let that = this;
|
|
@@ -426,6 +480,14 @@ Page({ |
|
@@ -426,6 +480,14 @@ Page({ |
426
|
});
|
480
|
});
|
427
|
},
|
481
|
},
|
428
|
|
482
|
|
|
|
483
|
+ //保障期
|
|
|
484
|
+ warrantyTwo(e) {
|
|
|
485
|
+ var guarantee_name = e.detail.value
|
|
|
486
|
+ this.setData({
|
|
|
487
|
+ guarantee_name: guarantee_name
|
|
|
488
|
+ })
|
|
|
489
|
+ },
|
|
|
490
|
+
|
429
|
//选择各项单位
|
491
|
//选择各项单位
|
430
|
selectUnit(e) {
|
492
|
selectUnit(e) {
|
431
|
var unit = e.currentTarget.dataset.unit
|
493
|
var unit = e.currentTarget.dataset.unit
|
|
@@ -434,17 +496,88 @@ Page({ |
|
@@ -434,17 +496,88 @@ Page({ |
434
|
})
|
496
|
})
|
435
|
},
|
497
|
},
|
436
|
|
498
|
|
|
|
499
|
+ //重组保障期数据格式
|
|
|
500
|
+ tempWarranty() {
|
|
|
501
|
+ var guarantee_name = this.data.guarantee_name
|
|
|
502
|
+ var unit = this.data.unit
|
|
|
503
|
+ var warranty_two = this.data.warranty_two
|
|
|
504
|
+ warranty_two.num = guarantee_name
|
|
|
505
|
+ warranty_two.title = unit
|
|
|
506
|
+ // console.log(warranty_two)
|
|
|
507
|
+ this.setData({
|
|
|
508
|
+ warranty_two: warranty_two
|
|
|
509
|
+ })
|
|
|
510
|
+ },
|
|
|
511
|
+
|
|
|
512
|
+ //缴费时长
|
|
|
513
|
+ burningTime(e) {
|
|
|
514
|
+ var time_name = e.detail.value
|
|
|
515
|
+ this.setData({
|
|
|
516
|
+ time_name: time_name
|
|
|
517
|
+ })
|
|
|
518
|
+ this.countImpletionTime()
|
|
|
519
|
+ },
|
|
|
520
|
+
|
437
|
selectUnit2(e) {
|
521
|
selectUnit2(e) {
|
438
|
var unit = e.currentTarget.dataset.unit
|
522
|
var unit = e.currentTarget.dataset.unit
|
439
|
this.setData({
|
523
|
this.setData({
|
440
|
unit2: unit
|
524
|
unit2: unit
|
441
|
})
|
525
|
})
|
|
|
526
|
+ this.countImpletionTime()
|
442
|
},
|
527
|
},
|
443
|
|
528
|
|
|
|
529
|
+ //重组缴费时长数据格式
|
|
|
530
|
+ tempburningTime() {
|
|
|
531
|
+ var time_name = this.data.time_name
|
|
|
532
|
+ var unit = this.data.unit2
|
|
|
533
|
+ var long_money = this.data.long_money
|
|
|
534
|
+ long_money.num = time_name
|
|
|
535
|
+ long_money.title = unit
|
|
|
536
|
+ console.log(long_money)
|
|
|
537
|
+ this.setData({
|
|
|
538
|
+ long_money: long_money
|
|
|
539
|
+ })
|
|
|
540
|
+ },
|
|
|
541
|
+
|
|
|
542
|
+
|
|
|
543
|
+ //计算缴费期满日
|
|
|
544
|
+ countImpletionTime() {
|
|
|
545
|
+ var time_name = parseInt(this.data.time_name)
|
|
|
546
|
+ var unit = this.data.unit2
|
|
|
547
|
+ var compact_time = this.data.compact_time
|
|
|
548
|
+ var year = parseInt(new Date(compact_time).getFullYear())
|
|
|
549
|
+ var month = parseInt(new Date(compact_time).getMonth())
|
|
|
550
|
+ var day = parseInt(new Date(compact_time).getDate())
|
|
|
551
|
+ var runnian = ''
|
|
|
552
|
+ var cha=''
|
|
|
553
|
+
|
|
|
554
|
+ var birthday='1995-04-20'
|
|
|
555
|
+ var birthday_year = parseInt(new Date(birthday).getFullYear())
|
|
|
556
|
+
|
|
|
557
|
+ if (unit == '年') {
|
|
|
558
|
+ runnian = parseInt(time_name / 4)
|
|
|
559
|
+ cha = time_name - runnian
|
|
|
560
|
+ var dateTemp = compact_time.split("-");
|
|
|
561
|
+ var nDate = new Date(dateTemp[1] + '-' + dateTemp[2] + '-' + dateTemp[0]);
|
|
|
562
|
+ var millSeconds = Math.abs(nDate) + (((cha * 365) + (runnian*366) )* 24 * 60 * 60 * 1000) - (1 * 24 * 60 * 60 * 1000);
|
|
|
563
|
+ var rDate = new Date(millSeconds);
|
|
|
564
|
+ var year = rDate.getFullYear();
|
|
|
565
|
+ var month = rDate.getMonth() + 1;
|
|
|
566
|
+ if (month < 10) month = "0" + month;
|
|
|
567
|
+ var date = rDate.getDate();
|
|
|
568
|
+ if (date < 10) date = "0" + date;
|
|
|
569
|
+ console.log(year + "-" + month + "-" + date);
|
|
|
570
|
+ }else if(unit=='岁'){
|
|
|
571
|
+
|
|
|
572
|
+ }
|
|
|
573
|
+ },
|
|
|
574
|
+
|
|
|
575
|
+ //缴费方式
|
444
|
selectUnit3(e) {
|
576
|
selectUnit3(e) {
|
445
|
var unit = e.currentTarget.dataset.unit
|
577
|
var unit = e.currentTarget.dataset.unit
|
446
|
this.setData({
|
578
|
this.setData({
|
447
|
- unit3: unit
|
579
|
+ unit3: unit,
|
|
|
580
|
+ type_money: unit
|
448
|
})
|
581
|
})
|
449
|
},
|
582
|
},
|
450
|
|
583
|
|
|
@@ -455,39 +588,32 @@ Page({ |
|
@@ -455,39 +588,32 @@ Page({ |
455
|
})
|
588
|
})
|
456
|
},
|
589
|
},
|
457
|
|
590
|
|
458
|
-
|
|
|
459
|
-
|
|
|
460
|
// 保单验证&&上传保单
|
591
|
// 保单验证&&上传保单
|
461
|
listVerify(e) {
|
592
|
listVerify(e) {
|
462
|
- // this.insureItem()
|
|
|
463
|
- // var addlist = this.data.addlist
|
|
|
464
|
- // if (addlist[0].name != '') {
|
|
|
465
|
- // var name = addlist[addlist.length - 1].name
|
|
|
466
|
- // var num = addlist[addlist.length - 1].num
|
|
|
467
|
- // var title = addlist[addlist.length - 1].title
|
|
|
468
|
- // if (name == '' || num == '' || title == '') {
|
|
|
469
|
- // addlist.pop()
|
|
|
470
|
- // this.setData({
|
|
|
471
|
- // addlist: addlist
|
|
|
472
|
- // })
|
|
|
473
|
- // }
|
|
|
474
|
- // }
|
593
|
+ this.tempBeneficiary()
|
|
|
594
|
+ this.tempWarranty()
|
|
|
595
|
+ this.tempburningTime()
|
475
|
var warn = ""; //弹框时提示的内容
|
596
|
var warn = ""; //弹框时提示的内容
|
476
|
var flag = true; //判断信息输入是否完整判断弹窗
|
597
|
var flag = true; //判断信息输入是否完整判断弹窗
|
477
|
var in_num = e.detail.value.policy_num
|
598
|
var in_num = e.detail.value.policy_num
|
478
|
var firm = e.detail.value.company;
|
599
|
var firm = e.detail.value.company;
|
479
|
var applicant = this.data.applicant_name
|
600
|
var applicant = this.data.applicant_name
|
480
|
var recognizee = this.data.recognizee_name
|
601
|
var recognizee = this.data.recognizee_name
|
|
|
602
|
+ var favoree = this.data.tempfavoree
|
|
|
603
|
+ var main_risks = e.detail.value.main_risks
|
|
|
604
|
+ var year_money = e.detail.value.year_money
|
|
|
605
|
+ var compact_time = this.data.compact_time
|
|
|
606
|
+ var warranty_two = this.data.warranty_two
|
|
|
607
|
+ var type_money = this.data.type_money
|
481
|
|
608
|
|
482
|
- var favoree = this.data.favoreename
|
|
|
483
|
|
609
|
|
484
|
- var compact_time = this.data.compact_time
|
610
|
+ var warranty_one = this.data.main_array
|
485
|
var impletion_time = this.data.impletion_time
|
611
|
var impletion_time = this.data.impletion_time
|
486
|
var warranty = e.detail.value.Guarantee_period
|
612
|
var warranty = e.detail.value.Guarantee_period
|
487
|
var bank = e.detail.value.Renew_bank
|
613
|
var bank = e.detail.value.Renew_bank
|
488
|
var bank_num = e.detail.value.renew_num
|
614
|
var bank_num = e.detail.value.renew_num
|
489
|
- var year_money = e.detail.value.year_money
|
|
|
490
|
- var main_risks = e.detail.value.main_risks
|
615
|
+
|
|
|
616
|
+
|
491
|
var coverage = e.detail.value.base_money
|
617
|
var coverage = e.detail.value.base_money
|
492
|
var picurl = JSON.stringify(this.data.imgs)
|
618
|
var picurl = JSON.stringify(this.data.imgs)
|
493
|
var guarantee = JSON.stringify(this.data.selectitem) //保障项目
|
619
|
var guarantee = JSON.stringify(this.data.selectitem) //保障项目
|