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