作者 刘晓艳

测试

1 -const app = getApp()  
2 -Page({  
3 - /**  
4 - * 页面的初始数据  
5 - */  
6 - data: {  
7 - recognizee: ['被保人', '被保人2'],  
8 - recognizee_index: 0,  
9 - period_time: ['10年', '20年'],  
10 - period_index: -1,  
11 - compact_time: '',  
12 - impletion_time: '',  
13 - popup_state: false,  
14 - projectlist: [],  
15 - label_state: false,  
16 - insure: ['投保人', '投保人2'],  
17 - insureindex: -1,  
18 - beneficiary_list: [{  
19 - // name_array: ['受益人1', '受益人2'],  
20 - // beneficiary_name:'',  
21 - name: '',  
22 - unit: ''  
23 - }],  
24 - beneficiaryindex: -1,  
25 - tempfavoree: [], // 已选择的受益人  
26 - beneficiaryList: [],  
27 - name: '', //受益人的名字,  
28 - beneficiary_name: '',  
29 - imgs: [],  
30 - main_risk: [],  
31 - unit: '',  
32 - unit2: '',  
33 - unit3: '',  
34 - unit4: '',  
35 - applicant_name: '',  
36 - recognizee_name: '',  
37 - rang_beneficiary: [],  
38 - risk_list: [{  
39 - name: '',  
40 - mo: [],  
41 - // project_time: '',  
42 - title: '',  
43 - num: ''  
44 - }],  
45 - main_array: [],  
46 - warranty_one: '',  
47 - warranty_two: {},  
48 - guarantee_name: '',  
49 - long_money: {},  
50 - time_name: '',  
51 - type_money: '',  
52 - more: [],  
53 - guarantee: [],  
54 - InfoId: 0,  
55 - def_id: '',  
56 - // edit_state: false,  
57 - // edit_state2: false,  
58 - // risk_listitm: '',  
59 - storge_state: false,  
60 - warranty_info: '请输入',  
61 - warranty_state: false,  
62 - warranty_info1: '请输入',  
63 - warranty_state1: false,  
64 - edit_state3: false,  
65 - coverage: '',  
66 - focus: false,  
67 - sub_index: ''  
68 - },  
69 -  
70 - //回到顶部  
71 - goTop: function(e) { // 一键回到顶部  
72 - if (wx.pageScrollTo) {  
73 - wx.pageScrollTo({  
74 - scrollTop: 0  
75 - })  
76 - } else {  
77 - wx.showModal({  
78 - title: '提示',  
79 - content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'  
80 - })  
81 - }  
82 - },  
83 -  
84 -  
85 - cancleMask() {  
86 - // if (this.data.inforid != 0) {  
87 - // if (this.data.edit_state3) {  
88 - // this.setData({  
89 - // edit_state: false,  
90 - // edit_state2: false  
91 - // })  
92 - // } else {  
93 - // this.setData({  
94 - // edit_state: true,  
95 - // edit_state2: true  
96 - // })  
97 - // }  
98 - // } else {  
99 - // this.setData({  
100 - // edit_state: false,  
101 - // edit_state2: false  
102 - // })  
103 - // }  
104 - // console.log(this.data.edit_state)  
105 -  
106 - this.setData({  
107 - popup_state: false,  
108 - })  
109 - },  
110 - //保单号  
111 - policyNum(e) {  
112 - this.setData({  
113 - in_num: e.detail.value,  
114 - })  
115 - },  
116 -  
117 - //保单号  
118 - setFirm(e) {  
119 - this.setData({  
120 - firm: e.detail.value,  
121 - })  
122 - },  
123 -  
124 - //投保人  
125 - insureSelect(e) {  
126 - var insure = this.data.insure  
127 - this.setData({  
128 - insureindex: e.detail.value,  
129 - applicant_name: insure[e.detail.value],  
130 - })  
131 - },  
132 -  
133 - //选择被保险人  
134 - recognizeeSelect(e) {  
135 - var recognizee = this.data.recognizee  
136 - this.setData({  
137 - recognizeeindex: e.detail.value,  
138 - recognizee_name: recognizee[e.detail.value]  
139 - })  
140 - },  
141 -  
142 - //主险名称  
143 - setRiskName(e) {  
144 - this.setData({  
145 - main_risks: e.detail.value,  
146 - })  
147 - },  
148 -  
149 - //主险名称  
150 - setRiskMoney(e) {  
151 - this.setData({  
152 - coverage: e.detail.value,  
153 - })  
154 - },  
155 -  
156 -  
157 - //保费  
158 - yearMoney(e) {  
159 - this.setData({  
160 - year_money: e.detail.value,  
161 - })  
162 - },  
163 -  
164 - //设置银行  
165 - setBank(e) {  
166 - this.setData({  
167 - bank: e.detail.value,  
168 - })  
169 - },  
170 -  
171 - //设置账号  
172 - setBankNum(e) {  
173 - this.setData({  
174 - bank_num: e.detail.value,  
175 - })  
176 - },  
177 -  
178 - //合同生效日  
179 - compactTime(e) {  
180 - this.setData({  
181 - compact_time: e.detail.value,  
182 - })  
183 - this.countImpletionTime()  
184 - this.countImpletionTime2()  
185 - },  
186 -  
187 - //缴费期满日  
188 - impletionTime(e) {  
189 - this.setData({  
190 - impletion_time: e.detail.value,  
191 - })  
192 - },  
193 -  
194 - //主险保障期  
195 - periodTime(e) {  
196 - this.setData({  
197 - period_index: e.detail.value,  
198 - })  
199 - },  
200 -  
201 - //保障项目弹窗  
202 - ensureProject(e) {  
203 - let that = this;  
204 - let type = e.currentTarget.dataset.type;  
205 - let index = e.currentTarget.dataset.xulie;  
206 - // 复制保障项目模板  
207 - // let tempProjectlist = Object.assign({}, this.data.projectlist);  
208 - let tempProjectlist = JSON.parse(JSON.stringify(this.data.projectlist));  
209 - console.log(tempProjectlist)  
210 - var sub_index = that.data.sub_index  
211 - var edit_state3 = that.data.edit_state3  
212 -  
213 - // 已经添加的附加险  
214 - let risk_list = Object.assign({},this.data.risk_list);  
215 - let tempRist = risk_list[index].mo;  
216 - this.setData({  
217 - type: type,  
218 - xielie: index  
219 - })  
220 -  
221 - if (type == 'fujiaxian') {  
222 - this.setData({  
223 - focus: true  
224 - })  
225 - }  
226 - // 已经添加的主险  
227 - let tempMain_list = Object.assign({},this.data.main_array)  
228 - this.data.inforid != 0 && this.data.inforid != undefined  
229 - //编辑/缓存状态  
230 -<<<<<<< HEAD  
231 - if (that.data.temp_state) {  
232 - console.log('edit')  
233 - //edit_state3:代表是刚获取到信息是的结构,还是重新选择之后的数据结构  
234 - if (edit_state3) {  
235 - //获取到的信息结构  
236 - if (type == 'zhuxian') {  
237 - console.log('zx')  
238 - this.setData({  
239 - focus: false  
240 - })  
241 - if (tempMain_list.length > 0) {  
242 - for (let i in tempProjectlist) {  
243 - for (let j in tempMain_list) {  
244 - if (tempProjectlist[i].id == tempMain_list[j].id) {  
245 - tempProjectlist[i].choose_status = true  
246 - tempProjectlist[i].num = tempMain_list[j].num  
247 - for (let g in tempProjectlist[i].title) {  
248 - if (tempProjectlist[i].title[g].t_id == tempMain_list[j].t_id) {  
249 - tempProjectlist[i].title[g].label_state = true  
250 - if (tempProjectlist[i].title[g].name == tempMain_list[j].title) {  
251 - tempProjectlist[i].title[g].current = parseInt(g)  
252 - sub_index = parseInt(g)  
253 - }  
254 - }  
255 - }  
256 - }  
257 - }  
258 - }  
259 - }  
260 - } else {  
261 - console.log('fjx')  
262 - if (tempRist.length) {  
263 - for (let i in tempProjectlist) {  
264 - for (let j in tempRist) {  
265 - if (tempProjectlist[i].id == tempRist[j].id) {  
266 - tempProjectlist[i].choose_status = true  
267 - tempProjectlist[i].num = tempRist[j].num  
268 - for (let g in tempProjectlist[i].title) {  
269 - if (tempProjectlist[i].title[g].t_id == tempRist[j].t_id) {  
270 - tempProjectlist[i].title[g].label_state = true  
271 - if (tempProjectlist[i].title[g].name == tempRist[j].title) {  
272 - tempProjectlist[i].title[g].current = parseInt(g)  
273 - sub_index = parseInt(g)  
274 - }  
275 - }  
276 - }  
277 - }  
278 - }  
279 - }  
280 - }  
281 - }  
282 - } else {  
283 - console.log('已修改保障项目')  
284 - if (type == 'zhuxian') {  
285 - if (tempMain_list.length > 0) {  
286 - for (let i in tempProjectlist) {  
287 - for (let j in tempMain_list) {  
288 - if (tempProjectlist[i].id == tempMain_list[j].id) {  
289 - tempProjectlist[i].choose_status = true  
290 - tempProjectlist[i].num = tempMain_list[j].num  
291 - for (let g in tempProjectlist[i].title) {  
292 - for (let k in tempMain_list[j].title) {  
293 - if (tempMain_list[j].title[k].label_state) {  
294 - if (tempProjectlist[i].title[g].t_id == tempMain_list[j].title[k].t_id) {  
295 - tempProjectlist[i].title[g].label_state = true  
296 - tempProjectlist[i].title[g].current = tempMain_list[j].title[k].current  
297 - sub_index = tempMain_list[j].title[k].current  
298 - }  
299 - }  
300 - }  
301 - }  
302 - }  
303 - }  
304 - }  
305 - }  
306 - } else {  
307 - if (tempRist.length) {  
308 - for (let i in tempProjectlist) {  
309 - for (let j in tempRist) {  
310 - if (tempProjectlist[i].id == tempRist[j].id) {  
311 - tempProjectlist[i].choose_status = true  
312 - tempProjectlist[i].num = tempRist[j].num  
313 - for (let g in tempProjectlist[i].title) {  
314 - for (let k in tempRist[j].title) {  
315 - if (tempRist[j].title[k].label_state) {  
316 - if (tempProjectlist[i].title[g].t_id == tempRist[j].title[k].t_id) {  
317 - tempProjectlist[i].title[g].label_state = true  
318 - tempProjectlist[i].title[g].current = tempRist[j].title[k].current  
319 - sub_index = tempRist[j].title[k].current  
320 - }  
321 - }  
322 - }  
323 - }  
324 - }  
325 - }  
326 - }  
327 - }  
328 - }  
329 - }  
330 - } else {  
331 - console.log('add')  
332 -=======  
333 - // if (that.data.temp_state) {  
334 - // console.log('edit')  
335 - // //edit_state3:代表是刚获取到信息是的结构,还是重新选择之后的数据结构  
336 - // if (edit_state3) {  
337 - // //获取到的信息结构  
338 - // if (type == 'zhuxian') {  
339 - // this.setData({  
340 - // focus: false  
341 - // })  
342 - // if (tempMain_list.length > 0) {  
343 - // for (let i in tempProjectlist) {  
344 - // for (let j in tempMain_list) {  
345 - // if (tempProjectlist[i].id == tempMain_list[j].id) {  
346 - // tempProjectlist[i].choose_status = true  
347 - // tempProjectlist[i].num = tempMain_list[j].num  
348 - // for (let g in tempProjectlist[i].title) {  
349 - // if (tempProjectlist[i].title[g].t_id == tempMain_list[j].t_id) {  
350 - // tempProjectlist[i].title[g].label_state = true  
351 - // if (tempProjectlist[i].title[g].name == tempMain_list[j].title) {  
352 - // tempProjectlist[i].title[g].current = parseInt(g)  
353 - // sub_index = parseInt(g)  
354 - // }  
355 - // }  
356 - // }  
357 - // }  
358 - // }  
359 - // }  
360 - // }  
361 - // } else {  
362 - // console.log('fjx')  
363 - // if (tempRist.length) {  
364 - // for (let i in tempProjectlist) {  
365 - // for (let j in tempRist) {  
366 - // if (tempProjectlist[i].id == tempRist[j].id) {  
367 - // console.log(tempRist[j])  
368 - // console.log(tempProjectlist[i])  
369 - // tempProjectlist[i].choose_status = true  
370 - // tempProjectlist[i].num = tempRist[j].num  
371 - // for (let g in tempProjectlist[i].title) {  
372 - // if (tempProjectlist[i].title[g].t_id == tempRist[j].t_id) {  
373 - // tempProjectlist[i].title[g].label_state = true  
374 - // if (tempProjectlist[i].title[g].name == tempRist[j].title) {  
375 - // tempProjectlist[i].title[g].current = parseInt(g)  
376 - // sub_index = parseInt(g)  
377 - // }  
378 - // }  
379 - // }  
380 - // }  
381 - // }  
382 - // }  
383 - // }  
384 - // }  
385 - // } else {  
386 - // if (type == 'zhuxian') {  
387 - // if (tempMain_list.length > 0) {  
388 - // for (let i in tempProjectlist) {  
389 - // for (let j in tempMain_list) {  
390 - // if (tempProjectlist[i].id == tempMain_list[j].id) {  
391 - // tempProjectlist[i].choose_status = true  
392 - // tempProjectlist[i].num = tempMain_list[j].num  
393 - // for (let g in tempProjectlist[i].title) {  
394 - // for (let k in tempMain_list[j].title) {  
395 - // if (tempMain_list[j].title[k].label_state) {  
396 - // if (tempProjectlist[i].title[g].t_id == tempMain_list[j].title[k].t_id) {  
397 - // tempProjectlist[i].title[g].label_state = true  
398 - // tempProjectlist[i].title[g].current = tempMain_list[j].title[k].current  
399 - // sub_index = tempMain_list[j].title[k].current  
400 - // }  
401 - // }  
402 - // }  
403 - // }  
404 - // }  
405 - // }  
406 - // }  
407 - // }  
408 - // } else {  
409 - // if (tempRist.length) {  
410 - // for (let i in tempProjectlist) {  
411 - // for (let j in tempRist) {  
412 - // if (tempProjectlist[i].id == tempRist[j].id) {  
413 - // tempProjectlist[i].choose_status = true  
414 - // tempProjectlist[i].num = tempRist[j].num  
415 - // for (let g in tempProjectlist[i].title) {  
416 - // for (let k in tempRist[j].title) {  
417 - // if (tempRist[j].title[k].label_state) {  
418 - // if (tempProjectlist[i].title[g].t_id == tempRist[j].title[k].t_id) {  
419 - // tempProjectlist[i].title[g].label_state = true  
420 - // tempProjectlist[i].title[g].current = tempRist[j].title[k].current  
421 - // sub_index = tempRist[j].title[k].current  
422 - // }  
423 - // }  
424 - // }  
425 - // }  
426 - // }  
427 - // }  
428 - // }  
429 - // }  
430 - // }  
431 - // }  
432 - // } else {  
433 - // console.log('add')  
434 ->>>>>>> 08e3891927bfc37dbaf7242cae1b43e3d3b308c5  
435 - if (type == 'zhuxian') {  
436 - if (tempMain_list.length > 0) {  
437 - for (let i in tempProjectlist) {  
438 - for (let j in tempMain_list) {  
439 - if (tempProjectlist[i].id == tempMain_list[j].id) {  
440 - console.log(tempProjectlist[i])  
441 - console.log(tempMain_list[j].id)  
442 - tempProjectlist[i].choose_status = true  
443 - tempProjectlist[i].num = tempMain_list[j].num  
444 - for (let g in tempProjectlist[i].title) {  
445 - for (let k in tempMain_list[j].title) {  
446 - if (tempMain_list[j].title[k].label_state) {  
447 - if (tempProjectlist[i].title[g].t_id == tempMain_list[j].title[k].t_id) {  
448 - tempProjectlist[i].title[g].label_state = true  
449 - tempProjectlist[i].title[g].current = tempMain_list[j].title[k].current  
450 - sub_index = tempMain_list[j].title[k].current  
451 - }  
452 - }  
453 - }  
454 - }  
455 - }  
456 - }  
457 - }  
458 - }  
459 - } else {  
460 - if (tempRist.length) {  
461 - for (let i in tempProjectlist) {  
462 - for (let j in tempRist) {  
463 - if (tempProjectlist[i].id == tempRist[j].id) {  
464 - tempProjectlist[i].choose_status = true  
465 - tempProjectlist[i].num = tempRist[j].num  
466 - console.log(tempProjectlist[i])  
467 - console.log(tempRist[j])  
468 - for (let g in tempProjectlist[i].title) {  
469 - // for (let k in tempRist[j].title) {  
470 - // if (tempRist[j].title[k].label_state) {  
471 - if (tempProjectlist[i].title[g].t_id == tempRist[j].t_id) {  
472 - tempProjectlist[i].title[g].label_state = true  
473 - // tempProjectlist[i].title[g].current = tempRist[j].title[k].current  
474 - // sub_index = tempRist[j].title[k].current  
475 - }  
476 - // }  
477 - // }  
478 - }  
479 - }  
480 - }  
481 - }  
482 - }  
483 - }  
484 - // }  
485 - wx.setNavigationBarTitle({  
486 - title: '选择保障项目',  
487 - })  
488 - console.log(tempProjectlist)  
489 - this.setData({  
490 - popup_state: true,  
491 - addType: type,  
492 - xulie: index,  
493 - showProjectlist: tempProjectlist,  
494 - sub_index: sub_index  
495 - })  
496 - },  
497 -  
498 - // 调取保障项目接口  
499 - ensureProjectList() {  
500 - var main_risk = this.data.main_risk  
501 - let url = 'counselor/sageguard'  
502 - let params = {}  
503 - app.post(url, params).then((res) => {  
504 - if (res.data.code == 200) {  
505 - var projectlist = res.data.data.def;  
506 - for (var i = 0; i < projectlist.length; i++) {  
507 - projectlist[i].choose_status = false  
508 - for (var j = 0; j < projectlist[i].title.length; j++) {  
509 - projectlist[i].title[j].label_state = false  
510 - }  
511 - // projectlist[i].title[0].current = 0  
512 - // projectlist[i].title[0].label_state = true  
513 - }  
514 - this.setData({  
515 - projectlist: res.data.data.def,  
516 - showProjectlist: res.data.data.def  
517 - })  
518 - }  
519 - })  
520 - },  
521 -  
522 - //保障项目单位  
523 - getUnit(e) {  
524 - var main_risk = this.data.main_risk  
525 - var index = e.currentTarget.dataset.index;  
526 - var sindex = e.currentTarget.dataset.sindex;  
527 - var projectlist = JSON.parse(JSON.stringify(this.data.showProjectlist));  
528 - var title = projectlist[index].title  
529 - for (var i = 0; i < title.length; i++) {  
530 - title[i].current = ''  
531 - if (title[i].current == '') {  
532 - title[i].label_state = false  
533 - }  
534 - }  
535 - projectlist[index].title[sindex].current = sindex  
536 - if (projectlist[index].title[sindex].current == sindex) {  
537 - projectlist[index].title[sindex].label_state = true  
538 - }  
539 - this.setData({  
540 - showProjectlist: projectlist,  
541 - sub_index: sindex  
542 - })  
543 - },  
544 -  
545 - //保障项目金额  
546 - popupNum(e) {  
547 - var index = e.currentTarget.dataset.index;  
548 - var projectlist = JSON.parse(JSON.stringify(this.data.showProjectlist))  
549 - if (projectlist[index].choose_status) {  
550 - projectlist[index].num = e.detail.value  
551 - }  
552 - this.setData({  
553 - showProjectlist: projectlist  
554 - })  
555 - },  
556 -  
557 - //选择保障项目  
558 - popupState(e) {  
559 - var index = e.currentTarget.dataset.index;  
560 - var projectlist = JSON.parse(JSON.stringify(this.data.showProjectlist))  
561 - projectlist[index].choose_status = !projectlist[index].choose_status;  
562 -  
563 - this.setData({  
564 - showProjectlist: projectlist,  
565 - })  
566 - if (this.data.inforid != 0) {  
567 - edit_state: false;  
568 - edit_state2: false  
569 - }  
570 - },  
571 -  
572 - //确认选择的推荐方案  
573 - confirmCase() {  
574 - // if (this.data.type == 'fujiaxian') {  
575 - // this.setData({  
576 - // edit_state2: false  
577 - // })  
578 - // } else {  
579 - // this.setData({  
580 - // edit_state: false  
581 - // })  
582 - // }  
583 -  
584 - this.setData({  
585 - edit_state3:false  
586 - })  
587 -  
588 - let index = this.data.xulie;  
589 - let type = this.data.addType;  
590 - var that = this  
591 - var main_array = []  
592 -  
593 - var projectlist = Object.assign({}, this.data.projectlist)  
594 - for (var i = 0; i < projectlist.length; i++) {  
595 - if (projectlist[i].choose_status) {  
596 - main_array.push(projectlist[i])  
597 - }  
598 - }  
599 -  
600 - if (main_array != '') {  
601 - wx.showToast({  
602 - title: '添加成功',  
603 - icon: 'none'  
604 - })  
605 -  
606 - if (type == 'fujiaxian') {  
607 - let tempRist = that.data.risk_list;  
608 - console.log(tempRist)  
609 - tempRist[index]['mo'] = main_array;  
610 - that.setData({  
611 - risk_list: tempRist,  
612 - })  
613 - } else {  
614 - that.setData({  
615 - main_array: main_array,  
616 - })  
617 - }  
618 - }  
619 - setTimeout(function() {  
620 - that.ensureProjectList()  
621 - that.setData({  
622 - popup_state: false  
623 - })  
624 - wx.setNavigationBarTitle({  
625 - title: '添加保单',  
626 - })  
627 - }, 800)  
628 - },  
629 -  
630 - //重组主险的保障项目  
631 - tempMain() {  
632 - var main_array = this.data.main_array  
633 - var warranty_one1 = []  
634 - for (var i = 0; i < main_array.length; i++) {  
635 - var temp = {}  
636 - for (var j = 0; j < main_array[i].title.length; j++) {  
637 - if (main_array[i].choose_status) {  
638 - if (main_array[i].title[j].label_state) {  
639 - temp.id = main_array[i].id  
640 - temp.name = main_array[i].name  
641 - temp.num = main_array[i].num  
642 - temp.title = main_array[i].title[j].name  
643 - temp.t_id = main_array[i].title[j].t_id  
644 - }  
645 - }  
646 - }  
647 - warranty_one1.push(temp)  
648 - this.setData({  
649 - guarantee: warranty_one1  
650 - })  
651 - }  
652 -  
653 - },  
654 -  
655 - //主险名称  
656 - addRiskName(e) {  
657 - var risk_list = this.data.risk_list  
658 - var index = e.currentTarget.dataset.index  
659 - risk_list[index].name = e.detail.value  
660 - this.setData({  
661 - risk_list: risk_list  
662 - })  
663 - },  
664 -  
665 - //主险保障其  
666 - addRiskUnit(e) {  
667 - var risk_list = this.data.risk_list  
668 - var index = e.currentTarget.dataset.index  
669 - risk_list[index].num = e.detail.value  
670 - this.setData({  
671 - risk_list: risk_list  
672 - })  
673 - },  
674 -  
675 - //重组附加险整体数据结构  
676 - tempAddRisk() {  
677 - var risk_list = this.data.risk_list  
678 - var sub_array = []  
679 - var temp_risk = this.data.risk_list;  
680 - var temp = this.data.risk_list;  
681 -  
682 - for (var i = 0; i < temp.length; i++) {  
683 - for (var j = 0; j < temp[i].mo.length; j++) {  
684 - for (var k = 0; k < temp[i].mo[j].title.length; k++) {  
685 - if (temp[i].name != '') {  
686 - if (temp[i].mo[j].choose_status) {  
687 - if (temp[i].mo[j].title[k].label_state) {  
688 - temp_risk[i].name = temp[i].name  
689 - temp_risk[i].num = temp[i].num  
690 - temp_risk[i].title = temp[i].title  
691 - temp_risk[i].mo[j].t_id = temp[i].mo[j].title[k].t_id  
692 - temp_risk[i].mo[j].id = temp[i].mo[j].id  
693 - temp_risk[i].mo[j].name = temp[i].mo[j].name  
694 - temp_risk[i].mo[j].num = temp[i].mo[j].num  
695 - temp_risk[i].mo[j].title = temp[i].mo[j].title[k].name  
696 - }  
697 - }  
698 - }  
699 - }  
700 - }  
701 - console.log(temp_risk)  
702 - this.setData({  
703 - more: temp_risk  
704 - })  
705 - }  
706 -  
707 - },  
708 -  
709 - //选择受益人姓名  
710 - beneficiarySelect(e) {  
711 - if (this.data.inforid != 0) {  
712 - // this.setData({  
713 - // edit_state: true,  
714 - // edit_state2: true  
715 - // })  
716 - }  
717 - var index = e.currentTarget.dataset.mindex  
718 - var beneficiary_list = Object.assign({}, this.data.projectlist)  
719 - // 获取当前已选择的收益人  
720 - let tempBenefice = Object.assign({}, this.data.projectlist)  
721 - // 当前选择的收益人  
722 - // let nowPerson = beneficiary_list[index].name_array[e.detail.value];  
723 - // let nowPerson = beneficiary_list[index].beneficiary_name  
724 - let nowPerson = beneficiary_list[index].name  
725 - // 判断受益人是否已经添加  
726 - const add = tempBenefice.every((tempBenefice) => {  
727 - return tempBenefice != nowPerson  
728 - })  
729 - if (add) {  
730 - // beneficiary_list[index].beneficiary_name = nowPerson;  
731 - beneficiary_list[index].name = nowPerson;  
732 - tempBenefice.push(nowPerson)  
733 - console.log(tempBenefice)  
734 - } else {  
735 - wx.showToast({  
736 - title: '请不要重复添加受益人',  
737 - icon: 'none'  
738 - })  
739 - }  
740 -  
741 - this.setData({  
742 - beneficiary_list: beneficiary_list,  
743 - beneficiaryList: tempBenefice  
744 - })  
745 -  
746 - },  
747 -  
748 - //添加收益比例  
749 - addUnit(e) {  
750 - var beneficiary_list = this.data.beneficiary_list;  
751 - beneficiary_list[beneficiary_list.length - 1].unit = e.detail.value;  
752 - if (beneficiary_list[beneficiary_list.length - 1].unit > 100) {  
753 - wx.showToast({  
754 - title: '请重新输入收益比例',  
755 - icon: 'none'  
756 - })  
757 - beneficiary_list[beneficiary_list.length - 1].unit = 0  
758 - }  
759 - this.setData({  
760 - beneficiary_list: beneficiary_list,  
761 - })  
762 - },  
763 - //添加收益比例  
764 - addUnit2(e) {  
765 - var beneficiary_list = this.data.beneficiary_list;  
766 - var index = e.currentTarget.dataset.index  
767 - beneficiary_list[index].unit = e.detail.value;  
768 - if (beneficiary_list[index].unit > 100) {  
769 - wx.showToast({  
770 - title: '请重新输入收益比例',  
771 - icon: 'none'  
772 - })  
773 - beneficiary_list[index].unit = 0  
774 - }  
775 - this.setData({  
776 - beneficiary_list: beneficiary_list,  
777 - })  
778 - },  
779 -  
780 - //添加受益人名字  
781 - addPeople(e) {  
782 - var beneficiary_list = this.data.beneficiary_list;  
783 - var index = e.currentTarget.dataset.index  
784 - // beneficiary_list[beneficiary_list.length - 1].beneficiary_name = e.detail.value;  
785 - beneficiary_list[index].name = e.detail.value;  
786 -  
787 - this.setData({  
788 - beneficiary_list: beneficiary_list,  
789 - })  
790 -  
791 - },  
792 -  
793 - //添加受益人  
794 - addPersons(e) {  
795 - var list = this.data.beneficiary_list;  
796 - var len = list.length  
797 - // if (list[len - 1].beneficiary_name == undefined) {  
798 - if (list[len - 1].name == undefined) {  
799 - wx.showToast({  
800 - title: '请输入受益人',  
801 - icon: 'none'  
802 - })  
803 - } else if (list[len - 1].unit == '') {  
804 - wx.showToast({  
805 - title: '请输入收益比',  
806 - icon: 'none'  
807 - })  
808 - } else {  
809 - list[len] = {  
810 - // name_array: this.data.insure,  
811 - // beneficiary_name:'',  
812 - name: '',  
813 - unit: ''  
814 - }  
815 - }  
816 - this.setData({  
817 - beneficiary_list: list  
818 - })  
819 - },  
820 -  
821 - //添加受益人  
822 - addPersons2(e) {  
823 - var list = this.data.beneficiary_list;  
824 - var len = list.length  
825 - if (list[len - 1].name == undefined) {  
826 - wx.showToast({  
827 - title: '请输入受益人',  
828 - icon: 'none'  
829 - })  
830 - } else if (list[len - 1].unit == '') {  
831 - console.log('unit')  
832 - wx.showToast({  
833 - title: '请输入收益比',  
834 - icon: 'none'  
835 - })  
836 - } else {  
837 - list[len] = {  
838 - // name_array: this.data.insure,  
839 - name: '',  
840 - unit: ''  
841 - }  
842 - }  
843 - this.setData({  
844 - beneficiary_list: list  
845 - })  
846 - console.log(this.data.beneficiary_list)  
847 - },  
848 -  
849 - //重组添加受益人  
850 - tempBeneficiary() {  
851 - var beneficiary_list = this.data.beneficiary_list  
852 - var len = beneficiary_list.length;  
853 - var tempfavoree1 = [];  
854 - for (var i = 0; i < beneficiary_list.length; i++) {  
855 - var temp = {}  
856 - if (beneficiary_list[i].unit != '') {  
857 - temp.name = beneficiary_list[i].name  
858 - temp.unit = beneficiary_list[i].unit;  
859 - }  
860 - tempfavoree1.push(temp)  
861 - this.setData({  
862 - tempfavoree: tempfavoree1  
863 - })  
864 -  
865 - }  
866 - },  
867 -  
868 - //删除收益人  
869 - deletebenefict(e) {  
870 - let index = e.currentTarget.dataset.index;  
871 - let tempbenefict = Object.assign({},this.data.beneficiary_list);  
872 - let beneficiaryList = Object.assign({},this.data.beneficiaryList);  
873 - // 获取当前选项的受益人  
874 - // let person = tempbenefict[index].beneficiary_name;  
875 - let person = tempbenefict[index].name;  
876 - tempbenefict.splice(index, 1);  
877 - if (person) beneficiaryList.splice(beneficiaryList.indexOf(person), 1)  
878 -  
879 - this.setData({  
880 - beneficiaryList: beneficiaryList,  
881 - beneficiary_list: tempbenefict  
882 - })  
883 - },  
884 -  
885 - //添加附加险  
886 - addRisk() {  
887 - if (this.data.inforid != 0) {  
888 - // this.setData({  
889 - // edit_state: false,  
890 - // edit_state2: false  
891 - // })  
892 - }  
893 - var risk_list = Object.assign({},this.data.risk_list);  
894 - var len = risk_list.length  
895 - risk_list[len] = {  
896 - name: '',  
897 - mo: [],  
898 - // project_time: '',  
899 - title: '',  
900 - num: ''  
901 - }  
902 - this.setData({  
903 - risk_list: risk_list  
904 - })  
905 - },  
906 -  
907 - //删除附加险  
908 - deleteRisk(e) {  
909 - let index = e.currentTarget.dataset.index;  
910 - let risk_list = Object.assign({},this.data.risk_list);  
911 - risk_list.splice(index, 1);  
912 - this.setData({  
913 - risk_list: risk_list  
914 - })  
915 - },  
916 -  
917 - //上传图片  
918 - uploadImage() {  
919 - let that = this;  
920 - wx.chooseImage({  
921 - count: 6,  
922 - sizeType: ['original', 'compressed'],  
923 - success: function(res) {  
924 - let successUp = 0; //成功个数  
925 - let failUp = 0; //失败个数  
926 - let i = 0; //第几个  
927 - let tempFilePaths = res.tempFilePaths //总文件  
928 - let length = res.tempFilePaths.length //总共个数  
929 - wx.showNavigationBarLoading()  
930 - wx.showLoading({  
931 - title: '上传中',  
932 - })  
933 - that.uploadAllfile(tempFilePaths, successUp, failUp, i, length)  
934 - },  
935 - fail: function(res) {}  
936 - })  
937 - },  
938 -  
939 - //上传图片接口调取  
940 - uploadAllfile(filePaths, successUp, failUp, i, length) {  
941 - let that = this  
942 - let strtime = +new Date()  
943 - wx.uploadFile({  
944 - url: 'https://insurance.w.broteam.cn/pubilc/upload', //仅为示例,非真实的接口地址  
945 - filePath: filePaths[i],  
946 - name: 'picurl',  
947 - formData: {  
948 - 'strtime': strtime,  
949 - 'token': app.strTime(strtime)  
950 - },  
951 - success: function(res) {  
952 - wx.hideNavigationBarLoading()  
953 - wx.hideLoading()  
954 - if (res.statusCode == '200') {  
955 - let imgTemp = that.data.imgs;  
956 - let curImg = JSON.parse(res.data).data.picurl;  
957 - if (imgTemp.length < 6) {  
958 - imgTemp.push("http://" + curImg)  
959 - that.setData({  
960 - imgs: imgTemp  
961 - })  
962 - wx.showToast({  
963 - title: '上传成功',  
964 - icon: 'none',  
965 - duration: 2000,  
966 - })  
967 - } else {  
968 - wx.showToast({  
969 - title: '图片上限6张',  
970 - icon: 'none',  
971 - duration: 2000,  
972 - })  
973 - }  
974 - } else {  
975 - wx.showModal({  
976 - title: '提示',  
977 - content: res.msg,  
978 - showCancel: false  
979 - })  
980 - }  
981 - },  
982 - fail: function(res) {  
983 - wx.hideNavigationBarLoading()  
984 - wx.hideLoading()  
985 - },  
986 - complete: () => {  
987 - i++;  
988 - if (i == length) {  
989 -  
990 - } else { //递归调用uploadDIY函数  
991 -  
992 - this.uploadAllfile(filePaths, successUp, failUp, i, length);  
993 - }  
994 - },  
995 - })  
996 - },  
997 -  
998 - //预览图片  
999 - viewImg(e) {  
1000 - var imgs = this.data.imgs  
1001 - var current = e.currentTarget.dataset.index  
1002 - wx.previewImage({  
1003 - //当前显示图片  
1004 - current: imgs[current],  
1005 - //所有图片  
1006 - urls: imgs  
1007 - })  
1008 - },  
1009 -  
1010 - //删除图片  
1011 - deleteImg(e) {  
1012 - var imgs = this.data.imgs;  
1013 - var index = e.currentTarget.dataset.index;  
1014 - imgs.splice(index, 1);  
1015 - this.setData({  
1016 - imgs: imgs  
1017 - });  
1018 - },  
1019 -  
1020 - //保障期  
1021 - warrantyTwo(e) {  
1022 - if (this.data.inforid != 0) {  
1023 - // this.setData({  
1024 - // edit_state: false,  
1025 - // edit_state2: false  
1026 - // })  
1027 - }  
1028 - var guarantee_name = e.detail.value  
1029 - var warranty_two = this.data.warranty_two  
1030 - var impletion_time = this.data.impletion_time  
1031 - warranty_two.num = guarantee_name  
1032 - this.setData({  
1033 - guarantee_name: e.detail.value,  
1034 - warranty_two: warranty_two  
1035 - })  
1036 - this.countImpletionTime2()  
1037 - },  
1038 -  
1039 - //选择各项单位  
1040 - selectUnit(e) {  
1041 - var unit = e.currentTarget.dataset.unit  
1042 - this.setData({  
1043 - unit: unit,  
1044 - })  
1045 - var warranty_two = this.data.warranty_two  
1046 - if (unit == '终身') {  
1047 - warranty_two.num = ''  
1048 - this.setData({  
1049 - warranty_info: '',  
1050 - warranty_state: true  
1051 - })  
1052 - } else {  
1053 - this.setData({  
1054 - warranty_state: false  
1055 - })  
1056 - }  
1057 - this.setData({  
1058 - warranty_two: warranty_two  
1059 - })  
1060 - this.countImpletionTime2()  
1061 - },  
1062 -  
1063 - //重组保障期数据格式  
1064 - tempWarranty() {  
1065 - var guarantee_name = this.data.guarantee_name  
1066 - var unit = this.data.unit  
1067 - var warranty_two = this.data.warranty_two  
1068 - warranty_two.num = guarantee_name  
1069 - warranty_two.title = unit  
1070 - this.setData({  
1071 - warranty_two: warranty_two  
1072 - })  
1073 - },  
1074 -  
1075 -  
1076 - //计算缴费期满日,主线保障其  
1077 - countImpletionTime2() {  
1078 - var guarantee_name = parseInt(this.data.guarantee_name)  
1079 - var unit = this.data.unit  
1080 - var compact_time = this.data.compact_time  
1081 - var year = parseInt(new Date(compact_time).getFullYear())  
1082 - var month = parseInt(new Date(compact_time).getMonth() + 1)  
1083 - var day = parseInt(new Date(compact_time).getDate())  
1084 - var warranty_one = this.data.warranty_one  
1085 - var tempbirth_time = ''  
1086 - var birthday = ''  
1087 - var birthday_year = parseInt(new Date(birthday).getFullYear())  
1088 -  
1089 - if (compact_time == '') {  
1090 - wx.showToast({  
1091 - title: '请选择合同生效日',  
1092 - icon: 'none'  
1093 - })  
1094 - } else {  
1095 - if (unit == '年') {  
1096 - var temp_year = (year + guarantee_name)  
1097 - var temp_day = day - 1  
1098 - if (month < 10) month = "0" + month;  
1099 - if (temp_day < 10) temp_day = "0" + temp_day;  
1100 - warranty_one = temp_year + '-' + month + '-' + temp_day  
1101 - } else if (unit == '岁') {  
1102 - var temp_year = (birthday_year + guarantee_name - 1)  
1103 - var temp_year2 = (birthday_year + guarantee_name)  
1104 - var temp_month = month  
1105 - if (temp_month < 10) temp_month = "0" + temp_month;  
1106 - if (month < 10) month = "0" + month;  
1107 - if (day < 10) day = "0" + day;  
1108 - warranty_one = temp_year2 + '-' + month + '-' + day  
1109 - } else if (unit == '终身') {  
1110 - warranty_one = '终身'  
1111 - }  
1112 - this.setData({  
1113 - warranty_one: warranty_one  
1114 - })  
1115 - }  
1116 - },  
1117 -  
1118 - //缴费时长  
1119 - burningTime(e) {  
1120 - if (this.data.inforid != 0) {  
1121 - // this.setData({  
1122 - // edit_state: false,  
1123 - // edit_state2: false,  
1124 - // })  
1125 - }  
1126 - var time_name = e.detail.value  
1127 - var long_money = this.data.long_money  
1128 - long_money.num = time_name  
1129 -  
1130 - this.setData({  
1131 - time_name: time_name,  
1132 - long_money: long_money  
1133 - })  
1134 - this.countImpletionTime()  
1135 - },  
1136 -  
1137 - selectUnit2(e) {  
1138 - var unit = e.currentTarget.dataset.unit  
1139 - this.setData({  
1140 - unit2: unit  
1141 - })  
1142 - var long_money = this.data.long_money  
1143 - if (unit == '终身') {  
1144 - long_money.num = ''  
1145 - this.setData({  
1146 - warranty_info1: '',  
1147 - warranty_state1: true  
1148 - })  
1149 - } else {  
1150 - this.setData({  
1151 - warranty_state1: false  
1152 - })  
1153 - }  
1154 - this.setData({  
1155 - long_money: long_money  
1156 - })  
1157 - this.countImpletionTime()  
1158 - },  
1159 -  
1160 - //重组缴费时长数据格式  
1161 - tempburningTime() {  
1162 - var time_name = this.data.time_name  
1163 - var unit = this.data.unit2  
1164 - var long_money = this.data.long_money  
1165 - long_money.num = time_name  
1166 - long_money.title = unit  
1167 - this.setData({  
1168 - long_money: long_money  
1169 - })  
1170 - },  
1171 -  
1172 -  
1173 - //计算缴费期满日,主线保障其  
1174 - countImpletionTime() {  
1175 - var time_name = parseInt(this.data.time_name)  
1176 - var unit = this.data.unit2  
1177 - var compact_time = this.data.compact_time  
1178 - var year = parseInt(new Date(compact_time).getFullYear())  
1179 - var month = parseInt(new Date(compact_time).getMonth() + 1)  
1180 - var day = parseInt(new Date(compact_time).getDate())  
1181 - var impletion_time = this.data.impletion_time  
1182 - var tempbirth_time = ''  
1183 - var birthday = ''  
1184 - var birthday_year = parseInt(new Date(birthday).getFullYear())  
1185 -  
1186 - if (compact_time == '') {  
1187 - wx.showToast({  
1188 - title: '请选择合同生效日',  
1189 - icon: 'none'  
1190 - })  
1191 - } else {  
1192 - if (unit == '年') {  
1193 - var temp_year = (year + time_name)  
1194 - var temp_day = day - 1  
1195 - if (month < 10) month = "0" + month;  
1196 - if (temp_day < 10) temp_day = "0" + temp_day;  
1197 - impletion_time = temp_year + '-' + month + '-' + temp_day  
1198 - } else if (unit == '岁') {  
1199 - var temp_year = (birthday_year + time_name - 1)  
1200 - var temp_year2 = (birthday_year + time_name)  
1201 - var temp_month = month  
1202 - if (temp_month < 10) temp_month = "0" + temp_month;  
1203 - if (month < 10) month = "0" + month;  
1204 - if (day < 10) day = "0" + day;  
1205 - impletion_time = temp_year + '-' + temp_month + '-' + day  
1206 - } else if (unit == '终身') {  
1207 - impletion_time = '终身缴费'  
1208 - }  
1209 - this.setData({  
1210 - impletion_time: impletion_time,  
1211 - })  
1212 - }  
1213 - },  
1214 -  
1215 - //缴费方式  
1216 - selectUnit3(e) {  
1217 - var unit = e.currentTarget.dataset.unit  
1218 - this.setData({  
1219 - unit3: unit,  
1220 - type_money: unit  
1221 - })  
1222 - },  
1223 -  
1224 - //附加险保障其  
1225 - selectUnit4(e) {  
1226 - var unit = e.currentTarget.dataset.unit;  
1227 - let index = e.currentTarget.dataset.index;  
1228 - let risk_list = Object.assign({},this.data.risk_list);  
1229 - risk_list[index].title = unit  
1230 - if (risk_list[index].title == '终身') {  
1231 - risk_list[index].num = ''  
1232 - this.setData({  
1233 - risk_state: true  
1234 - })  
1235 - } else {  
1236 - this.setData({  
1237 - risk_state: false  
1238 - })  
1239 - }  
1240 -  
1241 - this.setData({  
1242 - risk_list: risk_list  
1243 - })  
1244 - },  
1245 -  
1246 - //家庭成员  
1247 - familyMember(id) {  
1248 - var FamilyId = this.data.FamilyId  
1249 - let url = 'counselor/familyname'  
1250 - let params = {  
1251 - FamilyId: FamilyId || id,  
1252 - }  
1253 - app.post(url, params).then((res) => {  
1254 - // 受益人数组  
1255 - // var beneficiary_list = this.data.beneficiary_list  
1256 - // for (var i in beneficiary_list) {  
1257 - // beneficiary_list[i].name_array = res.data.data.list  
1258 - // }  
1259 -  
1260 -  
1261 - if (res.data.code == 200) {  
1262 - this.setData({  
1263 - insure: res.data.data.list,  
1264 - recognizee: res.data.data.list,  
1265 - // beneficiary_list: beneficiary_list,  
1266 - })  
1267 - }  
1268 - })  
1269 - },  
1270 -  
1271 - //设置缓存  
1272 - setStorge(e) {  
1273 - this.tempBeneficiary()  
1274 - this.tempWarranty()  
1275 - this.tempburningTime()  
1276 - this.tempMain()  
1277 - this.tempAddRisk()  
1278 - var favoree = JSON.stringify(this.data.tempfavoree)  
1279 - var warranty_two = JSON.stringify(this.data.warranty_two)  
1280 - var long_money = JSON.stringify(this.data.long_money)  
1281 - var more = JSON.stringify(this.data.more)  
1282 - var guarantee = JSON.stringify(this.data.guarantee)  
1283 - var warn = ""; //弹框时提示的内容  
1284 - var in_num = this.data.in_num  
1285 - var firm = this.data.firm  
1286 - var applicant = this.data.applicant_name  
1287 - var recognizee = this.data.recognizee_name  
1288 - var main_risks = this.data.main_risks  
1289 - var coverage = this.data.coverage  
1290 - var year_money = this.data.year_money  
1291 - var compact_time = this.data.compact_time  
1292 - var impletion_time = this.data.impletion_time  
1293 - var warranty_one = JSON.stringify(this.data.warranty_one)  
1294 - var type_money = this.data.type_money  
1295 - var bank = this.data.bank  
1296 - var bank_num = this.data.bank_num  
1297 - var picurl = JSON.stringify(this.data.imgs)  
1298 - let url = 'counselor/inforsave'  
1299 - let params = {  
1300 - // InfoId: this.data.inforid,  
1301 - def_id: this.data.def_id,  
1302 - in_num: in_num,  
1303 - firm: firm,  
1304 - applicant: applicant,  
1305 - recognizee: recognizee,  
1306 - favoree: favoree,  
1307 - main_risks: main_risks,  
1308 - coverage: coverage,  
1309 - guarantee: guarantee,  
1310 - year_money: year_money,  
1311 - warranty_two: warranty_two,  
1312 - compact_time: compact_time,  
1313 - impletion_time: impletion_time,  
1314 - warranty_one: warranty_one,  
1315 - long_money: long_money,  
1316 - type_money: type_money,  
1317 - bank: bank,  
1318 - bank_num: bank_num,  
1319 - more: more,  
1320 - picurl: picurl,  
1321 - }  
1322 - app.post(url, params).then((res) => {  
1323 - if (res.data.code == 200) {  
1324 - wx.navigateBack({  
1325 - delta: 1,  
1326 - })  
1327 - this.setData({  
1328 - storge_state: true  
1329 - })  
1330 - var storge_state = true  
1331 - wx.setStorageSync('storge_state', storge_state)  
1332 - }  
1333 - })  
1334 - },  
1335 -  
1336 - //获取缓存内容  
1337 - getStorage() {  
1338 - let url = 'counselor/inforCopy'  
1339 - let params = {  
1340 - def_id: this.data.def_id,  
1341 - }  
1342 - app.post(url, params).then((res) => {  
1343 - console.log(res)  
1344 - if (res.data.code == 200) {  
1345 - var warranty_two = res.data.data.def.warranty_two  
1346 - var unit = this.data.unit  
1347 - unit = warranty_two.title  
1348 - var long_money = res.data.data.def.long_money  
1349 - var unit2 = this.data.unit2  
1350 - unit2 = long_money.title  
1351 - var type_money = res.data.data.def.type_money  
1352 - var unit3 = this.data.unit3  
1353 - unit3 = type_money  
1354 - var beneficiary_list = res.data.data.def.favoree  
1355 - for (var obj in beneficiary_list) {  
1356 - if (beneficiary_list[obj] != '') {  
1357 - beneficiary_list[obj].name = beneficiary_list[obj].name  
1358 - beneficiary_list[obj].unit = beneficiary_list[obj].unit  
1359 - // beneficiary_list[obj].name_array = this.data.insure  
1360 - } else {  
1361 - beneficiary_list[0].name = ''  
1362 - beneficiary_list[0].unit = ''  
1363 - // beneficiary_list[obj].name_array = this.data.insure  
1364 - }  
1365 - }  
1366 -  
1367 - this.setData({  
1368 - imgs: res.data.data.def.picurl,  
1369 - type_money: res.data.data.def.type_money,  
1370 - unit3: unit3,  
1371 - year_money: res.data.data.def.year_money,  
1372 - long_money: res.data.data.def.long_money,  
1373 - unit2: unit2,  
1374 - in_num: res.data.data.def.in_num,  
1375 - firm: res.data.data.def.firm,  
1376 - main_risks: res.data.data.def.main_risks,  
1377 - coverage: res.data.data.def.coverage,  
1378 - main_array: res.data.data.def.guarantee,  
1379 - applicant_name: res.data.data.def.applicant,  
1380 - recognizee_name: res.data.data.def.recognizee,  
1381 - warranty_one: res.data.data.def.warranty_one,  
1382 - warranty_two: res.data.data.def.warranty_two,  
1383 - unit: unit,  
1384 - compact_time: res.data.data.def.compact_time,  
1385 - impletion_time: res.data.data.def.impletion_time,  
1386 - bank: res.data.data.def.bank,  
1387 - bank_num: res.data.data.def.bank_num,  
1388 - risk_list: res.data.data.def.more,  
1389 - beneficiary_list: beneficiary_list,  
1390 - // edit_state: true,  
1391 - // edit_state2: true,  
1392 - // edit_state3: true,  
1393 - temp_state: true  
1394 - })  
1395 - }  
1396 - })  
1397 - },  
1398 -  
1399 - //完成保单添加  
1400 - listVerify(e) {  
1401 - if (this.data.inforid == 0 || this.data.inforid == undefined) {  
1402 - this.tempBeneficiary()  
1403 - this.tempWarranty()  
1404 - this.tempburningTime()  
1405 - this.tempMain()  
1406 - this.tempAddRisk()  
1407 - if (this.data.tempfavoree.length == 1) {  
1408 - var favoree = JSON.stringify(this.data.beneficiary_list)  
1409 - } else {  
1410 - var favoree = JSON.stringify(this.data.tempfavoree)  
1411 - }  
1412 - var warranty_two = JSON.stringify(this.data.warranty_two)  
1413 - var long_money = JSON.stringify(this.data.long_money)  
1414 - var more = JSON.stringify(this.data.more)  
1415 - var guarantee = JSON.stringify(this.data.guarantee)  
1416 - } else if (this.data.edit_state || this.data.edit_state2 || wx.getStorageSync('storge_state')) {  
1417 - var favoree = JSON.stringify(this.data.beneficiary_list)  
1418 - var warranty_two = JSON.stringify(this.data.warranty_two)  
1419 - var long_money = JSON.stringify(this.data.long_money)  
1420 - var more = JSON.stringify(this.data.risk_list)  
1421 - var guarantee = JSON.stringify(this.data.main_array)  
1422 - } else {  
1423 - this.tempBeneficiary()  
1424 - this.tempWarranty()  
1425 - this.tempburningTime()  
1426 - this.tempMain()  
1427 - this.tempAddRisk()  
1428 - if (this.data.tempfavoree.length == 1) {  
1429 - var favoree = JSON.stringify(this.data.beneficiary_list)  
1430 - } else {  
1431 - var favoree = JSON.stringify(this.data.tempfavoree)  
1432 - }  
1433 - var warranty_two = JSON.stringify(this.data.warranty_two)  
1434 - var long_money = JSON.stringify(this.data.long_money)  
1435 - var more = JSON.stringify(this.data.more)  
1436 - var guarantee = JSON.stringify(this.data.guarantee)  
1437 - }  
1438 -  
1439 - var warn = ""; //弹框时提示的内容  
1440 - var flag = true; //判断信息输入是否完整判断弹窗  
1441 - var in_num = e.detail.value.policy_num  
1442 - var firm = e.detail.value.company;  
1443 - var applicant = this.data.applicant_name  
1444 - var recognizee = this.data.recognizee_name  
1445 - var main_risks = e.detail.value.main_risks  
1446 - var coverage = e.detail.value.coverage  
1447 - var year_money = e.detail.value.year_money  
1448 - var compact_time = this.data.compact_time  
1449 - var impletion_time = this.data.impletion_time  
1450 - var warranty_one = JSON.stringify(this.data.warranty_one)  
1451 - var type_money = this.data.type_money  
1452 - var bank = e.detail.value.bank  
1453 - var bank_num = e.detail.value.bank_num  
1454 - var picurl = JSON.stringify(this.data.imgs)  
1455 -  
1456 - var continue1 = e.detail.target.dataset.type  
1457 - var complete = e.detail.target.dataset.type  
1458 -  
1459 - // else if(firm == '') {  
1460 - // warn = '请输入所属公司!'  
1461 - // } else if (applicant == '') {  
1462 - // warn = '请输入投保人!'  
1463 - // } else if (recognizee == '') {  
1464 - // warn = '请输入被保险人!'  
1465 - // } else if (favoree == '') {  
1466 - // warn = '请输入受益人!'  
1467 - // } else if (bank_num == '') {  
1468 - // warn = '请输入续费账号!'  
1469 - // } else if (!(/^[0-9]+.?[0-9]*/.test(bank_num))) {  
1470 - // warn = '请输入正确续费账号!'  
1471 - // } else if (impletion_time == '') {  
1472 - // warn = '请输入缴费期满日!'  
1473 - // } else if (warranty_one == '') {  
1474 - // warn = '请输入主险保障期!'  
1475 - // } else if (more == '') {  
1476 - // warn = '请输入附加险!'  
1477 - // } else if (picurl.length == 2) {  
1478 - // warn = '请选择图片!'  
1479 - // } else if (compact_time == '') {  
1480 - // warn = '请输入合同生效日!'  
1481 - // } else if (warranty_two.num == '') {  
1482 - // warn = '请输入保障期!'  
1483 - // } else if (long_money.num == '') {  
1484 - // warn = '请输入缴费时长!'  
1485 - // } else if (type_money == '') {  
1486 - // warn = '请输入缴费方式!'  
1487 - // } else if (bank == '') {  
1488 - // warn = '请输入续费银行!'  
1489 - // }  
1490 -  
1491 - if (in_num == '') {  
1492 - warn = '请输入保单号!'  
1493 - } else if (main_risks == '') {  
1494 - warn = '请输入主险名称!'  
1495 - } else if (coverage == '') {  
1496 - warn = '请输入主险基本保额!'  
1497 - } else if (year_money == '') {  
1498 - warn = '请输入保费!'  
1499 - } else {  
1500 - flag = false  
1501 - // 添加、修改保单接口调取  
1502 - let url = 'counselor/inforuodate'  
1503 - let params = {  
1504 - InfoId: this.data.inforid,  
1505 - def_id: this.data.def_id,  
1506 - in_num: in_num,  
1507 - firm: firm,  
1508 - applicant: applicant,  
1509 - recognizee: recognizee,  
1510 - favoree: favoree,  
1511 - main_risks: main_risks,  
1512 - coverage: coverage,  
1513 - guarantee: guarantee,  
1514 - year_money: year_money,  
1515 - warranty_two: warranty_two,  
1516 - compact_time: compact_time,  
1517 - impletion_time: impletion_time,  
1518 - warranty_one: warranty_one,  
1519 - long_money: long_money,  
1520 - type_money: type_money,  
1521 - bank: bank,  
1522 - bank_num: bank_num,  
1523 - more: more,  
1524 - picurl: picurl,  
1525 - }  
1526 - app.post(url, params).then((res) => {  
1527 - if (res.data.code == 200) {  
1528 - if (continue1 == 'continue1') {  
1529 - this.goTop()  
1530 - wx.showToast({  
1531 - title: '添加成功',  
1532 - icon: 'none',  
1533 - duration: 2000,  
1534 - })  
1535 - this.setData({  
1536 - inforid: 0,  
1537 - in_num: '',  
1538 - firm: '',  
1539 - applicant_name: '',  
1540 - // recognizee_name: '',  
1541 - beneficiary_list: [{  
1542 - // name_array: [],  
1543 - name: '',  
1544 - unit: ''  
1545 - }],  
1546 - coverage: '',  
1547 - main_risks: '',  
1548 - main_array: '',  
1549 - year_money: '',  
1550 - compact_time: '',  
1551 - warranty_two: '',  
1552 - long_money: '',  
1553 - bank: '',  
1554 - bank_num: '',  
1555 - impletion_time: '',  
1556 - warranty_one: '',  
1557 - risk_list: [{  
1558 - name: '',  
1559 - mo: [],  
1560 - // project_time: '',  
1561 - title: '',  
1562 - num: ''  
1563 - }],  
1564 - imgs: '',  
1565 - unit: '',  
1566 - unit2: '',  
1567 - unit3: '',  
1568 - unit4: '',  
1569 - })  
1570 - } else if (complete == 'complete') {  
1571 - wx.showToast({  
1572 - title: '添加成功',  
1573 - icon: 'none',  
1574 - duration: 2000,  
1575 - })  
1576 - wx.navigateBack({  
1577 - delta: 1,  
1578 - })  
1579 - }  
1580 - }  
1581 - })  
1582 - }  
1583 -  
1584 - if (flag == true) {  
1585 - wx.showToast({  
1586 - title: warn,  
1587 - icon: 'none'  
1588 - })  
1589 - }  
1590 -  
1591 - },  
1592 -  
1593 -  
1594 - //获取编辑保单接口  
1595 - getlistVerify(id) {  
1596 - let url = 'counselor/infordef'  
1597 - let params = {  
1598 - InfoId: this.data.inforid || id,  
1599 - }  
1600 - app.post(url, params).then((res) => {  
1601 - console.log(res)  
1602 - if (res.data.code == 200) {  
1603 - var warranty_two = res.data.data.def.warranty_two  
1604 - var unit = this.data.unit  
1605 - unit = warranty_two.title  
1606 - var long_money = res.data.data.def.long_money  
1607 - var unit2 = this.data.unit2  
1608 - unit2 = long_money.title  
1609 - var type_money = res.data.data.def.type_money  
1610 - var unit3 = this.data.unit3  
1611 - unit3 = type_money  
1612 - var beneficiary_list = res.data.data.def.favoree  
1613 - for (var obj in beneficiary_list) {  
1614 - if (beneficiary_list[obj] != '') {  
1615 - beneficiary_list[obj].name = beneficiary_list[obj].name  
1616 - beneficiary_list[obj].unit = beneficiary_list[obj].unit  
1617 - // beneficiary_list[obj].name_array = this.data.insure  
1618 - }  
1619 - }  
1620 -  
1621 - var risk_list = res.data.data.def.more  
1622 - var projectlist = Object.assign({},this.data.projectlist)  
1623 -  
1624 - for (var i = 0; i < risk_list.length; i++) {  
1625 - for (var j = 0; j < projectlist.length; j++) {  
1626 - for (var k = 0; k < projectlist[j].title.length; k++) {  
1627 - if (risk_list[i].id == projectlist[j].id) {  
1628 - if (risk_list[i].title == projectlist[j].title[k].name) {  
1629 - var title = {}  
1630 - title.name = projectlist[j].title[k]  
1631 - }  
1632 - }  
1633 - }  
1634 - }  
1635 - }  
1636 -  
1637 - var warranty_two = res.data.data.def.warranty_two  
1638 - var guarantee_name = warranty_two.num  
1639 -  
1640 - var long_money = res.data.data.def.long_money  
1641 - var time_name = long_money.num  
1642 -  
1643 - this.setData({  
1644 - imgs: res.data.data.def.picurl,  
1645 - type_money: res.data.data.def.type_money,  
1646 - unit3: unit3,  
1647 - year_money: res.data.data.def.year_money,  
1648 - long_money: res.data.data.def.long_money,  
1649 - unit2: unit2,  
1650 - in_num: res.data.data.def.in_num,  
1651 - firm: res.data.data.def.firm,  
1652 - main_risks: res.data.data.def.main_risks,  
1653 - coverage: res.data.data.def.coverage,  
1654 - main_array: res.data.data.def.guarantee,  
1655 - applicant_name: res.data.data.def.applicant,  
1656 - recognizee_name: res.data.data.def.recognizee,  
1657 - warranty_one: res.data.data.def.warranty_one,  
1658 - warranty_two: res.data.data.def.warranty_two,  
1659 - unit: unit,  
1660 - compact_time: res.data.data.def.compact_time,  
1661 - impletion_time: res.data.data.def.impletion_time,  
1662 - bank: res.data.data.def.bank,  
1663 - bank_num: res.data.data.def.bank_num,  
1664 - risk_list: risk_list,  
1665 - beneficiary_list: beneficiary_list,  
1666 - // edit_state: true,  
1667 - // edit_state2: true,  
1668 - // edit_state3: true,  
1669 - temp_state: true,  
1670 - guarantee_name: guarantee_name,  
1671 - time_name: time_name,  
1672 - })  
1673 - }  
1674 - })  
1675 - },  
1676 -  
1677 - /**  
1678 - * 生命周期函数--监听页面加载  
1679 - */  
1680 - onLoad: function(options) {  
1681 - this.ensureProjectList()  
1682 - let that = this;  
1683 - options.inforid ? (that.getlistVerify(options.inforid), that.setData({  
1684 - inforid: options.inforid,  
1685 - // edit_state: true,  
1686 - // edit_state2: true,  
1687 - }), wx.setNavigationBarTitle({  
1688 - title: '编辑保单',  
1689 - })) : ""  
1690 - options.def_id ? that.setData({  
1691 - def_id: options.def_id,  
1692 - }) : ""  
1693 - options.name ? (that.setData({  
1694 - recognizee_name: options.name  
1695 - })) : '';  
1696 - options.FamilyId ? (that.familyMember(options.FamilyId), that.setData({  
1697 - FamilyId: options.FamilyId  
1698 - })) : '';  
1699 -  
1700 - if (wx.getStorageSync('storge_state') && options.inforid == undefined) {  
1701 - this.getStorage()  
1702 - }  
1703 -  
1704 - },  
1705 -  
1706 - /**  
1707 - * 生命周期函数--监听页面初次渲染完成  
1708 - */  
1709 - onReady: function() {  
1710 -  
1711 - },  
1712 -  
1713 - /**  
1714 - * 生命周期函数--监听页面显示  
1715 - */  
1716 - onShow: function() {  
1717 -  
1718 - },  
1719 -  
1720 - /**  
1721 - * 生命周期函数--监听页面隐藏  
1722 - */  
1723 - onHide: function() {  
1724 -  
1725 - },  
1726 -  
1727 - /**  
1728 - * 生命周期函数--监听页面卸载  
1729 - */  
1730 - onUnload: function() {  
1731 -  
1732 - },  
1733 -  
1734 - /**  
1735 - * 页面相关事件处理函数--监听用户下拉动作  
1736 - */  
1737 - onPullDownRefresh: function() {  
1738 -  
1739 - },  
1740 -  
1741 - /**  
1742 - * 页面上拉触底事件的处理函数  
1743 - */  
1744 - onReachBottom: function() {  
1745 -  
1746 - },  
1747 -  
1748 - /**  
1749 - * 用户点击右上角分享  
1750 - */  
1751 - onShareAppMessage: function() {  
1752 -  
1753 - }  
1754 -})