bxs-tools-ui 1.0.21 → 1.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/lib/business-card/index.js +2 -2
  2. package/lib/bxs-utils/index.js +4 -3
  3. package/lib/canvas-poster/index.js +2 -2
  4. package/lib/index.css +2 -2
  5. package/lib/index.js +101 -115
  6. package/lib/insure-calculate/index.css +1 -1
  7. package/lib/insure-calculate/index.js +31 -61
  8. package/lib/person-info/index.css +1 -1
  9. package/lib/person-info/index.js +45 -21
  10. package/lib/product-info/index.css +1 -1
  11. package/lib/product-info/index.js +19 -24
  12. package/package.json +5 -15
  13. package/packages/business-card/demo/index.vue +2 -8
  14. package/packages/business-card/index.vue +6 -28
  15. package/packages/bxs-utils/planbook/common.js +2 -4
  16. package/packages/bxs-utils/planbook/insurance.js +16 -62
  17. package/packages/bxs-utils/planbook/person.js +22 -74
  18. package/packages/bxs-utils/planbook/product.js +65 -233
  19. package/packages/bxs-utils/trade/insureCalculate.js +11 -43
  20. package/packages/canvas-poster/demo/index.vue +2 -7
  21. package/packages/canvas-poster/index.vue +5 -37
  22. package/packages/components/form-item/select-item.vue +5 -17
  23. package/packages/components/form-item/title-item.vue +3 -8
  24. package/packages/insure-calculate/demo/index.vue +1 -4
  25. package/packages/insure-calculate/index.vue +52 -183
  26. package/packages/person-info/index.vue +35 -21
  27. package/packages/planbook-input/components/footer.vue +1 -2
  28. package/packages/planbook-input/components/product-table.vue +7 -17
  29. package/packages/planbook-input/helper.js +19 -75
  30. package/packages/planbook-input/index.vue +8 -28
  31. package/packages/product-info/demo/index.vue +2 -12
  32. package/packages/product-info/index.vue +8 -31
  33. package/src/js/md5Token.js +6 -8
  34. package/src/js/request.js +11 -9
  35. package/src/js/utils.js +3 -7
@@ -15,11 +15,7 @@ import {
15
15
  deepCopy
16
16
  } from './common.js';
17
17
  import { convertPersonData } from './person.js';
18
- import {
19
- initInsuranceData,
20
- insuranceDataHandler,
21
- restrictElementsInInsurance
22
- } from './insurance.js';
18
+ import { initInsuranceData, insuranceDataHandler, restrictElementsInInsurance } from './insurance.js';
23
19
 
24
20
  /**
25
21
  * @Author: lizhao
@@ -85,19 +81,13 @@ export function productDataHandler(prodData, productVerifyData, personData) {
85
81
  let insuranceVerifyData = productVerifyData[ins.key];
86
82
  if (insuranceVerifyData) {
87
83
  // 双豁免是种特殊的投保人豁免。双豁免包含投保人豁免和投保人配偶豁免。如果没有选中配偶信息,则认为是投保人豁免,选中则认为投保人豁免和配偶豁免都选中
88
- let isTouHuomianIns =
89
- ins.huomian == 'touHuomian' || ins.huomian == 'shuangHuomian';
84
+ let isTouHuomianIns = ins.huomian == 'touHuomian' || ins.huomian == 'shuangHuomian';
90
85
  let insuredInfo = personOrderList.find(p => p.key === 'insuredInfo');
91
- let applicantInfo = personOrderList.find(
92
- p => p.key === 'applicantInfo'
93
- );
86
+ let applicantInfo = personOrderList.find(p => p.key === 'applicantInfo');
94
87
  let personType = isTouHuomianIns ? 'applicantInfo' : 'insuredInfo';
95
88
  if (isTouHuomianIns && ins.allowSamePerson) {
96
89
  // 如果豁免险种可以附加被保人,也可以附加投保人。选中投保人,则附加到投保人
97
- personType =
98
- applicantInfo && applicantInfo.title
99
- ? 'applicantInfo'
100
- : 'insuredInfo';
90
+ personType = applicantInfo && applicantInfo.title ? 'applicantInfo' : 'insuredInfo';
101
91
  }
102
92
 
103
93
  // 取当前性别、年龄下的费率条件
@@ -115,14 +105,8 @@ export function productDataHandler(prodData, productVerifyData, personData) {
115
105
  // 当前险种的限制条件
116
106
  curCondition = curCondition.conditionData;
117
107
  //如果险种可以附加被保人,也可以附加投保人。选中投保人,则附加到投保人
118
- if (
119
- isTouHuomianIns &&
120
- ins.allowSamePerson &&
121
- curCondition.key === 'samePerson'
122
- ) {
123
- curCondition = curCondition.samePerson.find(
124
- verify => verify.value == (applicantInfo.title ? 0 : 1)
125
- );
108
+ if (isTouHuomianIns && ins.allowSamePerson && curCondition.key === 'samePerson') {
109
+ curCondition = curCondition.samePerson.find(verify => verify.value == (applicantInfo.title ? 0 : 1));
126
110
  }
127
111
  }
128
112
  }
@@ -135,9 +119,7 @@ export function productDataHandler(prodData, productVerifyData, personData) {
135
119
  //如果险种不存在费率限制条件或者投保人豁免在没有选中投保人信息的条件下,险种不可选
136
120
  if (
137
121
  !curCondition ||
138
- (isTouHuomianIns &&
139
- !ins.allowSamePerson &&
140
- (!curPersonInfo.title || curPersonInfo.applicantAndInsuredSame))
122
+ (isTouHuomianIns && !ins.allowSamePerson && (!curPersonInfo.title || curPersonInfo.applicantAndInsuredSame))
141
123
  ) {
142
124
  eleTitle.isDisabled = true;
143
125
  eleTitle.value = false;
@@ -155,54 +137,34 @@ export function productDataHandler(prodData, productVerifyData, personData) {
155
137
  if (ins.required && (!ins.groupKey || ins.isCheckbox)) {
156
138
  eleTitle.value = true;
157
139
  eleTitle.isDisabled = true;
158
- console.log(
159
- `${eleTitle.labelName}-${ins.key}: 费率存在,险种为必选险且(为非组合险或为多选一险种)`
160
- );
140
+ console.log(`${eleTitle.labelName}-${ins.key}: 费率存在,险种为必选险且(为非组合险或为多选一险种)`);
161
141
  }
162
142
  }
163
143
  if (curCondition) {
164
144
  // 判断是否为通用元素
165
- let eleData = ins.eleOrderList.find(
166
- e => e.key === curCondition.key
167
- );
168
- let commonData = prodData.mulInsOrderList.find(
169
- ins => ins.key === 'common'
170
- );
145
+ let eleData = ins.eleOrderList.find(e => e.key === curCondition.key);
146
+ let commonData = prodData.mulInsOrderList.find(ins => ins.key === 'common');
171
147
  if (!eleData && commonData && commonData.eleOrderList) {
172
- eleData = commonData.eleOrderList.find(
173
- e => e.key === curCondition.key
174
- );
148
+ eleData = commonData.eleOrderList.find(e => e.key === curCondition.key);
175
149
  }
176
150
 
177
151
  let eleCondi = curCondition[curCondition.key];
178
152
  if (eleData) {
179
153
  //元素隐藏且非不可修改状态,取对应关联的险种的值
180
- if (
181
- eleData.isHide &&
182
- !eleData.isDisabled &&
183
- ins.refInsuranceId &&
184
- ins.refInsuranceId != -2
185
- ) {
154
+ if (eleData.isHide && !eleData.isDisabled && ins.refInsuranceId && ins.refInsuranceId != -2) {
186
155
  let refInsData = null;
187
156
  // -1: 关联主险。即险种中key值为非 「common」的第一个险种
188
157
  if (ins.refInsuranceId === -1) {
189
- refInsData =
190
- insList[0].key === 'common' ? insList[1] : insList[0];
158
+ refInsData = insList[0].key === 'common' ? insList[1] : insList[0];
191
159
  } else {
192
- refInsData = insList.find(
193
- ins => ins.key === ins.refInsuranceId
194
- );
160
+ refInsData = insList.find(ins => ins.key === ins.refInsuranceId);
195
161
  }
196
162
  if (refInsData) {
197
163
  // 数据取值来源的元素
198
- let refEleData =
199
- refInsData.eleOrderList &&
200
- refInsData.eleOrderList.find(e => e.key === eleData.key);
164
+ let refEleData = refInsData.eleOrderList && refInsData.eleOrderList.find(e => e.key === eleData.key);
201
165
  if (refEleData) {
202
166
  // 所关联的险种不可选,当前险种也不可选
203
- let refTitleData =
204
- refInsData.eleOrderList &&
205
- refInsData.eleOrderList.find(e => e.key === 'title');
167
+ let refTitleData = refInsData.eleOrderList && refInsData.eleOrderList.find(e => e.key === 'title');
206
168
  if (refInsData && refTitleData.isDisabled) {
207
169
  eleTitle.isDisabled = true;
208
170
  }
@@ -211,17 +173,13 @@ export function productDataHandler(prodData, productVerifyData, personData) {
211
173
  eleData.value = getHuomianPeriodValue(
212
174
  refEleData.value,
213
175
  ins,
214
- ins.huomian === 'touHuomian'
215
- ? insuredInfo
216
- : curPersonInfo
176
+ ins.huomian === 'touHuomian' ? insuredInfo : curPersonInfo
217
177
  );
218
178
  } else {
219
179
  eleData.value = refEleData.value;
220
180
  }
221
181
  } else {
222
- console.log(
223
- `${ins.name}-${ins.key}:关联险种${ins.refInsuranceId}不存在`
224
- );
182
+ console.log(`${ins.name}-${ins.key}:关联险种${ins.refInsuranceId}不存在`);
225
183
  }
226
184
  }
227
185
  } else {
@@ -229,8 +187,7 @@ export function productDataHandler(prodData, productVerifyData, personData) {
229
187
  eleData.opts = [];
230
188
  eleCondi.forEach(condi => {
231
189
  if (condi.value !== undefined && condi.desc !== undefined) {
232
- let backupOpt =
233
- backupOpts && backupOpts.find(o => o.val == condi.value);
190
+ let backupOpt = backupOpts && backupOpts.find(o => o.val == condi.value);
234
191
  eleData.opts.push({
235
192
  val: condi.value,
236
193
  desc: condi.desc,
@@ -245,9 +202,7 @@ export function productDataHandler(prodData, productVerifyData, personData) {
245
202
  if (eleData.opts.every(ele => ele.val != eleData.value)) {
246
203
  //交费期间,默认取最后一个元素的值;其他元素,默认取第一个元素。By Lizh 2020.4.10, From hyw
247
204
  if (eleData.key === 'pPeriod') {
248
- let filterOpts = eleData.opts.filter(
249
- opt => !opt.isHide && !opt.isDisabled
250
- );
205
+ let filterOpts = eleData.opts.filter(opt => !opt.isHide && !opt.isDisabled);
251
206
  if (filterOpts.length) {
252
207
  eleData.value = eleData.opts[filterOpts.length - 1].val;
253
208
  }
@@ -262,21 +217,14 @@ export function productDataHandler(prodData, productVerifyData, personData) {
262
217
  }
263
218
 
264
219
  // 提定下一个元素的限制条件
265
- curCondition = eleCondi.find(
266
- eleCondi => eleCondi.value === eleData.value
267
- );
220
+ curCondition = eleCondi.find(eleCondi => eleCondi.value === eleData.value);
268
221
 
269
222
  // 如果元素的value不存在限制条件。则遍历上一个元素,重新设置上一元素的值,并取对应的限制条件。By Lizao@2020.11.24
270
- let eleIndex = ins.eleOrderList.findIndex(
271
- ele => ele.key === eleData.key
272
- );
223
+ let eleIndex = ins.eleOrderList.findIndex(ele => ele.key === eleData.key);
273
224
  if (!curCondition && backupCondi && eleData && eleIndex >= 1) {
274
225
  let preCondi = backupCondi.find(
275
226
  preCondi =>
276
- preCondi[eleData.key] &&
277
- preCondi[eleData.key].some(
278
- condi => condi.value === eleData.value
279
- )
227
+ preCondi[eleData.key] && preCondi[eleData.key].some(condi => condi.value === eleData.value)
280
228
  );
281
229
  if (preCondi) {
282
230
  curCondition = preCondi[eleData.key];
@@ -285,22 +233,12 @@ export function productDataHandler(prodData, productVerifyData, personData) {
285
233
  }
286
234
 
287
235
  // 如果当前元素是隐藏的且不可修改,则重新设置上一元素的选项(只取包含当前元素值的选项)。By Lizao@2020.11.24
288
- if (
289
- eleData &&
290
- eleData.isHide &&
291
- !eleData.isDisabled &&
292
- eleIndex >= 1 &&
293
- backupCondi
294
- ) {
236
+ if (eleData && eleData.isHide && !eleData.isDisabled && eleIndex >= 1 && backupCondi) {
295
237
  let preEleData = ins.eleOrderList[eleIndex - 1];
296
238
  if (preEleData && preEleData.opts && preEleData.opts.length) {
297
239
  let opts = [];
298
240
  backupCondi.forEach(condi => {
299
- if (
300
- curCondition &&
301
- condi[eleData.key] &&
302
- condi[eleData.key].some(c => c.value == eleData.value)
303
- ) {
241
+ if (curCondition && condi[eleData.key] && condi[eleData.key].some(c => c.value == eleData.value)) {
304
242
  opts.push({
305
243
  val: condi.value,
306
244
  desc: condi.desc
@@ -312,21 +250,13 @@ export function productDataHandler(prodData, productVerifyData, personData) {
312
250
  }
313
251
  backupCondi = eleCondi;
314
252
  } else {
315
- console.log(
316
- `${ins.name} - ${curCondition && curCondition.key}元素不存在:`
317
- );
253
+ console.log(`${ins.name} - ${curCondition && curCondition.key}元素不存在:`);
318
254
  curCondition = null;
319
255
  }
320
256
  }
321
- } while (
322
- curCondition &&
323
- curCondition.key &&
324
- curCondition[curCondition.key]
325
- );
257
+ } while (curCondition && curCondition.key && curCondition[curCondition.key]);
326
258
  } else {
327
- console.log(
328
- `${prodData.titleName}-${prodData.key} -> ${ins.name}-${ins.key}: 当前险种没有费率表`
329
- );
259
+ console.log(`${prodData.titleName}-${prodData.key} -> ${ins.name}-${ins.key}: 当前险种没有费率表`);
330
260
  }
331
261
  });
332
262
  }
@@ -362,9 +292,7 @@ export function setCommonInfo(prodData) {
362
292
  });
363
293
  // 把通用信息当作一个险种,做为产品险种列表的第一个险种
364
294
  if (common.eleOrderList.length) {
365
- prodData.mulInsOrderList = prodData.mulInsOrderList.filter(
366
- ins => ins.key !== 'common'
367
- );
295
+ prodData.mulInsOrderList = prodData.mulInsOrderList.filter(ins => ins.key !== 'common');
368
296
  prodData.mulInsOrderList.unshift(common);
369
297
  // 通用信息,与跟随其后的险种不留间距
370
298
  if (prodData.mulInsOrderList[1]) {
@@ -387,15 +315,11 @@ export function setCommonInfo(prodData) {
387
315
  */
388
316
  export function setGroupInsurance(prodData) {
389
317
  let groupInsuranceList =
390
- prodData &&
391
- prodData.mulInsOrderList &&
392
- prodData.mulInsOrderList.filter(ins => !!ins.groupKey);
318
+ prodData && prodData.mulInsOrderList && prodData.mulInsOrderList.filter(ins => !!ins.groupKey);
393
319
  if (groupInsuranceList && groupInsuranceList.length) {
394
320
  let oGroupInsList = prodData.mulInsOrderList.filter(ins => ins.isGroup);
395
321
  //清空险种列表中的已有的险种组合
396
- prodData.mulInsOrderList = prodData.mulInsOrderList.filter(
397
- ins => !ins.isGroup
398
- );
322
+ prodData.mulInsOrderList = prodData.mulInsOrderList.filter(ins => !ins.isGroup);
399
323
 
400
324
  let nGroupInsList = {};
401
325
  groupInsuranceList.forEach(ins => {
@@ -405,9 +329,7 @@ export function setGroupInsurance(prodData) {
405
329
  let oGroupInsData = oGroupInsList.find(gIns => gIns.key === ins.groupKey);
406
330
  if (oGroupInsData) {
407
331
  oTitle = oGroupInsData.eleOrderList.find(e => e.key === 'title');
408
- oInsuranceId = oGroupInsData.eleOrderList.find(
409
- e => e.key === 'insuranceId'
410
- );
332
+ oInsuranceId = oGroupInsData.eleOrderList.find(e => e.key === 'insuranceId');
411
333
  }
412
334
 
413
335
  nGroupInsList[ins.groupKey] = nGroupInsList[ins.groupKey] || {
@@ -425,12 +347,8 @@ export function setGroupInsurance(prodData) {
425
347
  },
426
348
  {
427
349
  key: 'insuranceId',
428
- value:
429
- (oInsuranceId && oInsuranceId.value) ||
430
- (ins.isCheckbox ? [] : ''),
431
- componentName: ins.isCheckbox
432
- ? 'cmCommonCheckbox'
433
- : 'cmCommonRadio',
350
+ value: (oInsuranceId && oInsuranceId.value) || (ins.isCheckbox ? [] : ''),
351
+ componentName: ins.isCheckbox ? 'cmCommonCheckbox' : 'cmCommonRadio',
434
352
  opts: []
435
353
  }
436
354
  ]
@@ -438,9 +356,7 @@ export function setGroupInsurance(prodData) {
438
356
 
439
357
  // 当险种转换成险种组合的选项
440
358
  let eleTitle = ins.eleOrderList.find(e => e.key === 'title');
441
- let nInsuranceId = nGroupInsList[ins.groupKey].eleOrderList.find(
442
- e => e.key === 'insuranceId'
443
- );
359
+ let nInsuranceId = nGroupInsList[ins.groupKey].eleOrderList.find(e => e.key === 'insuranceId');
444
360
  nInsuranceId.opts.push({
445
361
  val: ins.key,
446
362
  desc: eleTitle.labelName,
@@ -450,12 +366,8 @@ export function setGroupInsurance(prodData) {
450
366
 
451
367
  // 处理组合险中的逻辑,并加入到产品险种列表中
452
368
  for (let k in nGroupInsList) {
453
- let nGroupTitle = nGroupInsList[k].eleOrderList.find(
454
- e => e.key === 'title'
455
- );
456
- let nGroupInsuranceId = nGroupInsList[k].eleOrderList.find(
457
- e => e.key === 'insuranceId'
458
- );
369
+ let nGroupTitle = nGroupInsList[k].eleOrderList.find(e => e.key === 'title');
370
+ let nGroupInsuranceId = nGroupInsList[k].eleOrderList.find(e => e.key === 'insuranceId');
459
371
  if (nGroupTitle && nGroupInsuranceId) {
460
372
  if (nGroupInsuranceId.opts && nGroupInsuranceId.opts.length) {
461
373
  // 所有险种都不可选,则组合险不可修改且不选中。否则,组合险种可选
@@ -467,9 +379,7 @@ export function setGroupInsurance(prodData) {
467
379
  }
468
380
  }
469
381
 
470
- let groupInsList = prodData.mulInsOrderList.filter(
471
- ins => ins.groupKey == k
472
- );
382
+ let groupInsList = prodData.mulInsOrderList.filter(ins => ins.groupKey == k);
473
383
  if (groupInsList && groupInsList.length) {
474
384
  // 如果组合险中有一款是必选的,则整个组合险为选中状态
475
385
  if (
@@ -509,15 +419,11 @@ export function setGroupInsurance(prodData) {
509
419
  if (nGroupInsuranceId.value.constructor === Array) {
510
420
  if (nGroupInsuranceId.opts) {
511
421
  nGroupInsuranceId.opts = nGroupInsuranceId.opts.filter(
512
- opt =>
513
- nGroupInsuranceId.value.indexOf(opt.val) !== -1 &&
514
- !opt.isDisabled
422
+ opt => nGroupInsuranceId.value.indexOf(opt.val) !== -1 && !opt.isDisabled
515
423
  );
516
424
  }
517
425
  } else {
518
- let opt = nGroupInsuranceId.opts.find(
519
- o => o.val === nGroupInsuranceId.value
520
- );
426
+ let opt = nGroupInsuranceId.opts.find(o => o.val === nGroupInsuranceId.value);
521
427
  if (opt && opt.isDisabled) {
522
428
  nGroupInsuranceId.value = '';
523
429
  }
@@ -525,27 +431,14 @@ export function setGroupInsurance(prodData) {
525
431
  }
526
432
 
527
433
  if (nGroupInsuranceId.value) {
528
- let checkedIns = prodData.mulInsOrderList.find(
529
- ins => ins.key === nGroupInsuranceId.value
530
- );
434
+ let checkedIns = prodData.mulInsOrderList.find(ins => ins.key === nGroupInsuranceId.value);
531
435
  if (checkedIns) {
532
436
  //将当前选中险种的部分数据复制到组合险中
533
437
  for (let ck in checkedIns) {
534
- if (
535
- [
536
- 'code',
537
- 'groupKey',
538
- 'groupName',
539
- 'isFollowing',
540
- 'key',
541
- 'name'
542
- ].indexOf(ck) === -1
543
- ) {
438
+ if (['code', 'groupKey', 'groupName', 'isFollowing', 'key', 'name'].indexOf(ck) === -1) {
544
439
  // 定义组件险中的元素:自身eleOrderList + 所选险种的eleOrderList(不包含标题)
545
440
  if (ck === 'eleOrderList') {
546
- nGroupInsList[k][ck] = nGroupInsList[k][ck].concat(
547
- checkedIns[ck].filter(ele => ele.key != 'title')
548
- );
441
+ nGroupInsList[k][ck] = nGroupInsList[k][ck].concat(checkedIns[ck].filter(ele => ele.key != 'title'));
549
442
  } else {
550
443
  nGroupInsList[k][ck] = checkedIns[ck];
551
444
  }
@@ -574,39 +467,25 @@ export function setGroupInsurance(prodData) {
574
467
  */
575
468
  export function isHideProduct(prodData, productVerifyData, personOrderList) {
576
469
  let ageRangeProd = {};
577
- if (
578
- prodData &&
579
- productVerifyData &&
580
- Object.keys(productVerifyData).length &&
581
- personOrderList
582
- ) {
470
+ if (prodData && productVerifyData && Object.keys(productVerifyData).length && personOrderList) {
583
471
  if (prodData.mulInsOrderList) {
584
472
  // 产品中是否有必选险种且有费率
585
- let hasRequiredIns = prodData.mulInsOrderList.some(
586
- ins => !!ins.required && productVerifyData[ins.key]
587
- );
473
+ let hasRequiredIns = prodData.mulInsOrderList.some(ins => !!ins.required && productVerifyData[ins.key]);
588
474
  prodData.mulInsOrderList.forEach(ins => {
589
475
  // 当前险种的限制条件
590
476
  let insuranceVerifyData = productVerifyData[ins.key];
591
477
  if (insuranceVerifyData) {
592
478
  // 产品年龄范围取各险种最大范围
593
- if (
594
- (!ins.huomian || ins.huomian == 'beiHuomian') &&
595
- (!hasRequiredIns || (hasRequiredIns && ins.required))
596
- ) {
479
+ if ((!ins.huomian || ins.huomian == 'beiHuomian') && (!hasRequiredIns || (hasRequiredIns && ins.required))) {
597
480
  insuranceVerifyData.forEach(verify => {
598
481
  ageRangeProd[verify.sex] = ageRangeProd[verify.sex] || [];
599
482
  ageRangeProd[verify.sex] = [
600
483
  Math.min(
601
- ageRangeProd[verify.sex][0] === undefined
602
- ? verify.minAge
603
- : ageRangeProd[verify.sex][0],
484
+ ageRangeProd[verify.sex][0] === undefined ? verify.minAge : ageRangeProd[verify.sex][0],
604
485
  verify.minAge
605
486
  ),
606
487
  Math.max(
607
- ageRangeProd[verify.sex][1] === undefined
608
- ? verify.maxAge
609
- : ageRangeProd[verify.sex][1],
488
+ ageRangeProd[verify.sex][1] === undefined ? verify.maxAge : ageRangeProd[verify.sex][1],
610
489
  verify.maxAge
611
490
  )
612
491
  ];
@@ -617,11 +496,7 @@ export function isHideProduct(prodData, productVerifyData, personOrderList) {
617
496
  }
618
497
 
619
498
  let { sex, age } = personOrderList.find(p => p.key === 'insuredInfo') || {};
620
- if (
621
- ageRangeProd[sex] &&
622
- age >= ageRangeProd[sex][0] &&
623
- age <= ageRangeProd[sex][1]
624
- ) {
499
+ if (ageRangeProd[sex] && age >= ageRangeProd[sex][0] && age <= ageRangeProd[sex][1]) {
625
500
  prodData.hide = false;
626
501
  } else {
627
502
  prodData.hadChoice = false;
@@ -645,12 +520,7 @@ export function isHideProduct(prodData, productVerifyData, personOrderList) {
645
520
  * @param {*} eleData: 可不传。元素数据,当前交互的元素(如:用户修改了该险种的交费期间)
646
521
  * @return {*} 校验结果。空表示校验通过
647
522
  */
648
- export function verifyProductRules({
649
- personData,
650
- productData,
651
- insData,
652
- eleData
653
- } = {}) {
523
+ export function verifyProductRules({ personData, productData, insData, eleData } = {}) {
654
524
  let errorMsg = null;
655
525
  let personOrderList = convertPersonData(
656
526
  personData,
@@ -699,12 +569,7 @@ export function verifyProductRules({
699
569
  * @param {*} eleData: 可不传。元素数据,当前交互的元素(如:用户修改了该险种的交费期间)
700
570
  * @return {*} 校验结果。空表示校验通过
701
571
  */
702
- export function restrictInsurancesInProduct({
703
- personOrderList,
704
- productData,
705
- insData,
706
- eleData
707
- } = {}) {
572
+ export function restrictInsurancesInProduct({ personOrderList, productData, insData, eleData } = {}) {
708
573
  let errorMsg;
709
574
  let restrictList = productData.restrictList;
710
575
  if (restrictList && restrictList.length) {
@@ -719,18 +584,10 @@ export function restrictInsurancesInProduct({
719
584
  productInfo.mulInsOrderList.forEach(ins => {
720
585
  verifyData['i' + ins.key] = ins;
721
586
  });
722
- restrict.rCondition = restrict.rCondition.replace(
723
- /(%)(\d+)(\.*\w*)(%)/g,
724
- 'verifyData.i$2$3'
725
- );
726
- restrict.rCondition = restrict.rCondition.replace(
727
- /(%)(\w*\.*\w*)(%)/g,
728
- 'verifyData.$2'
729
- );
587
+ restrict.rCondition = restrict.rCondition.replace(/(%)(\d+)(\.*\w*)(%)/g, 'verifyData.i$2$3');
588
+ restrict.rCondition = restrict.rCondition.replace(/(%)(\w*\.*\w*)(%)/g, 'verifyData.$2');
730
589
 
731
- let curIns = productData.mulInsOrderList.find(
732
- ins => ins.key === restrict.rInsKey
733
- );
590
+ let curIns = productData.mulInsOrderList.find(ins => ins.key === restrict.rInsKey);
734
591
  let curTitle = null,
735
592
  curEle = null;
736
593
  if (curIns) {
@@ -773,18 +630,15 @@ export function restrictInsurancesInProduct({
773
630
  let rangeSelectNum =
774
631
  rangeSelect.constructor === Array
775
632
  ? [
776
- rangeSelect[0] &&
777
- getNumberFromYear(rangeSelect[0], verifyData.age),
778
- rangeSelect[1] &&
779
- getNumberFromYear(rangeSelect[1], verifyData.age)
633
+ rangeSelect[0] && getNumberFromYear(rangeSelect[0], verifyData.age),
634
+ rangeSelect[1] && getNumberFromYear(rangeSelect[1], verifyData.age)
780
635
  ]
781
636
  : getNumberFromYear(rangeSelect, verifyData.age);
782
637
 
783
638
  if (rangeSelect) {
784
639
  if (rangeSelect.constructor === Array) {
785
640
  opt.isHide =
786
- (rangeSelect[0] && optNum < rangeSelectNum[0]) ||
787
- (rangeSelect[1] && optNum > rangeSelectNum[1]);
641
+ (rangeSelect[0] && optNum < rangeSelectNum[0]) || (rangeSelect[1] && optNum > rangeSelectNum[1]);
788
642
  } else {
789
643
  opt.isHide = optNum > rangeSelectNum;
790
644
  }
@@ -798,41 +652,21 @@ export function restrictInsurancesInProduct({
798
652
  // 全局校验、或者点击的是约束元素、或者点击的是目标元素时,触发校验
799
653
  if (
800
654
  (!insData && !eleData) ||
801
- (restrict.rInsKey === insData.key &&
802
- restrict.rEleKey === eleData.key) ||
803
- restrict.rCondition.search(
804
- `verifyData.i${insData.key}.${eleData.key}`
805
- ) !== -1
655
+ (restrict.rInsKey === insData.key && restrict.rEleKey === eleData.key) ||
656
+ restrict.rCondition.search(`verifyData.i${insData.key}.${eleData.key}`) !== -1
806
657
  ) {
807
658
  let rangeVal = eval(restrict.rCondition);
808
659
  if (rangeVal !== undefined && rangeVal !== null) {
809
660
  if (rangeVal.constructor === Array) {
810
- if (
811
- rangeVal[0] &&
812
- curEle.value &&
813
- curEle.value < rangeVal[0]
814
- ) {
661
+ if (rangeVal[0] && curEle.value && curEle.value < rangeVal[0]) {
815
662
  errorMsg =
816
- restrict.rMsg ||
817
- `${curIns.name}的${
818
- curEle.labelName
819
- }不得小于${converUnit10000(rangeVal[0])}`;
663
+ restrict.rMsg || `${curIns.name}的${curEle.labelName}不得小于${converUnit10000(rangeVal[0])}`;
820
664
  }
821
- if (
822
- rangeVal[1] &&
823
- curEle.value &&
824
- curEle.value > rangeVal[1]
825
- ) {
665
+ if (rangeVal[1] && curEle.value && curEle.value > rangeVal[1]) {
826
666
  errorMsg =
827
- restrict.rMsg ||
828
- `${curIns.name}的${
829
- curEle.labelName
830
- }不得大于${converUnit10000(rangeVal[1])}`;
667
+ restrict.rMsg || `${curIns.name}的${curEle.labelName}不得大于${converUnit10000(rangeVal[1])}`;
831
668
  }
832
- } else if (
833
- rangeVal.constructor === String ||
834
- rangeVal.constructor === Number
835
- ) {
669
+ } else if (rangeVal.constructor === String || rangeVal.constructor === Number) {
836
670
  if (rangeVal) {
837
671
  curEle.value = rangeVal;
838
672
  }
@@ -877,9 +711,7 @@ export function convertProductData(prodData) {
877
711
  if (insuranceData.isGroup) {
878
712
  //组合险,则遍历其所选中的险种,并转换数据
879
713
  let insuranceId =
880
- insuranceData.insuranceId.constructor == Array
881
- ? insuranceData.insuranceId
882
- : [insuranceData.insuranceId];
714
+ insuranceData.insuranceId.constructor == Array ? insuranceData.insuranceId : [insuranceData.insuranceId];
883
715
  insuranceId.forEach(insId => {
884
716
  let checkedIns = prodData.mulInsOrderList.find(p => p.key === insId);
885
717
  if (checkedIns) {