bxs-tools-ui 3.2.0 → 3.3.0

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 (148) hide show
  1. package/README.md +20 -20
  2. package/es/add-and-take/index.css +1 -1
  3. package/es/add-and-take/index.js +283 -64
  4. package/es/adjust-baoe/index.css +1 -1
  5. package/es/adjust-baoe/index.js +444 -195
  6. package/es/business-card/index.css +1 -1
  7. package/es/business-card/index.js +1 -0
  8. package/es/canvas-poster/index.css +1 -1
  9. package/es/canvas-poster/index.js +1 -0
  10. package/es/index.css +1 -1
  11. package/es/index.js +936 -824
  12. package/es/insure-calculate/index.css +1 -1
  13. package/es/insure-calculate/index.js +438 -265
  14. package/es/person-info/index.css +1 -1
  15. package/es/person-info/index.js +296 -1370
  16. package/es/product-info/index.css +1 -1
  17. package/es/product-info/index.js +644 -548
  18. package/es/share-sheet/index.css +1 -1
  19. package/es/share-sheet/index.js +313 -21
  20. package/es/utils/index.js +530 -429
  21. package/lib/add-and-take/index.css +1 -1
  22. package/lib/add-and-take/index.js +283 -64
  23. package/lib/adjust-baoe/index.css +1 -1
  24. package/lib/adjust-baoe/index.js +441 -194
  25. package/lib/business-card/index.css +1 -1
  26. package/lib/business-card/index.js +1 -0
  27. package/lib/canvas-poster/index.css +1 -1
  28. package/lib/canvas-poster/index.js +1 -0
  29. package/lib/index.css +1 -1
  30. package/lib/index.js +939 -826
  31. package/lib/insure-calculate/index.css +1 -1
  32. package/lib/insure-calculate/index.js +438 -268
  33. package/lib/person-info/index.css +1 -1
  34. package/lib/person-info/index.js +295 -1372
  35. package/lib/product-info/index.css +1 -1
  36. package/lib/product-info/index.js +645 -550
  37. package/lib/share-sheet/index.css +1 -1
  38. package/lib/share-sheet/index.js +313 -25
  39. package/lib/utils/index.js +531 -433
  40. package/package.json +9 -7
  41. package/packages/add-and-take/components/interest-form.less +144 -0
  42. package/packages/add-and-take/components/interest-form.vue +179 -179
  43. package/packages/add-and-take/components/interest-items.less +87 -0
  44. package/packages/add-and-take/components/interest-items.vue +67 -80
  45. package/packages/add-and-take/components/interest-table.less +111 -0
  46. package/packages/add-and-take/components/interest-table.vue +31 -31
  47. package/packages/add-and-take/constant.ts +2 -2
  48. package/packages/add-and-take/demo/index.vue +89 -86
  49. package/packages/add-and-take/handler.ts +52 -57
  50. package/packages/add-and-take/index.less +69 -0
  51. package/packages/add-and-take/index.vue +156 -156
  52. package/packages/add-and-take/readme.md +87 -98
  53. package/packages/adjust-baoe/demo/index.vue +37 -47
  54. package/packages/adjust-baoe/index.less +125 -0
  55. package/packages/adjust-baoe/index.vue +134 -147
  56. package/packages/adjust-baoe/readme.md +35 -45
  57. package/packages/business-card/demo/index.vue +7 -7
  58. package/packages/business-card/index.less +100 -0
  59. package/packages/business-card/index.vue +18 -21
  60. package/packages/business-card/readme.md +46 -53
  61. package/packages/bxs-utils/demo/index.vue +2 -2
  62. package/packages/bxs-utils/index.ts +5 -5
  63. package/packages/bxs-utils/planbook/common.ts +56 -92
  64. package/packages/bxs-utils/planbook/index.ts +4 -4
  65. package/packages/bxs-utils/planbook/insurance.ts +137 -127
  66. package/packages/bxs-utils/planbook/person.ts +143 -147
  67. package/packages/bxs-utils/planbook/product.ts +473 -509
  68. package/packages/bxs-utils/readme.md +94 -84
  69. package/packages/bxs-utils/trade/index.js +1 -1
  70. package/packages/bxs-utils/trade/insureCalculate.js +91 -204
  71. package/packages/canvas-poster/demo/index.vue +9 -13
  72. package/packages/canvas-poster/index.less +5 -0
  73. package/packages/canvas-poster/index.vue +68 -79
  74. package/packages/canvas-poster/readme.md +106 -109
  75. package/packages/index.ts +1 -1
  76. package/packages/insure-calculate/demo/index.vue +20 -20
  77. package/packages/insure-calculate/index.less +366 -0
  78. package/packages/insure-calculate/index.vue +305 -329
  79. package/packages/insure-calculate/readme.md +99 -106
  80. package/packages/person-info/crm-popup.vue +81 -80
  81. package/packages/person-info/demo/index.vue +25 -37
  82. package/packages/person-info/index-inline.less +11 -0
  83. package/packages/person-info/index.vue +53 -83
  84. package/packages/person-info/readme.md +109 -115
  85. package/packages/planbook-input/components/footer.less +54 -0
  86. package/packages/planbook-input/components/footer.vue +8 -64
  87. package/packages/planbook-input/components/handler.js +33 -44
  88. package/packages/planbook-input/components/product-table.less +235 -0
  89. package/packages/planbook-input/components/product-table.vue +114 -108
  90. package/packages/planbook-input/demo/index.vue +3 -3
  91. package/packages/planbook-input/helper.js +852 -465
  92. package/packages/planbook-input/index.less +30 -0
  93. package/packages/planbook-input/index.vue +86 -103
  94. package/packages/planbook-input/readme.md +72 -90
  95. package/packages/product-info/demo/constant.js +1 -1
  96. package/packages/product-info/demo/index.vue +31 -43
  97. package/packages/product-info/index.less +271 -0
  98. package/packages/product-info/index.vue +198 -210
  99. package/packages/product-info/readme.md +72 -75
  100. package/packages/share-sheet/constant.js +4 -4
  101. package/packages/share-sheet/demo/index.vue +10 -10
  102. package/packages/share-sheet/handler.js +14 -14
  103. package/packages/share-sheet/index.less +201 -0
  104. package/packages/share-sheet/index.vue +39 -39
  105. package/packages/share-sheet/readme.md +121 -127
  106. package/src/api/add-and-take.js +45 -0
  107. package/src/api/adjust-baoe.js +16 -0
  108. package/src/api/index.js +6 -0
  109. package/src/api/planbook.js +93 -0
  110. package/src/api/request.js +211 -0
  111. package/src/api/trade.js +56 -0
  112. package/src/api/user.js +18 -0
  113. package/src/components/common/common-age-birthday.less +66 -0
  114. package/src/components/common/common-age-birthday.vue +27 -95
  115. package/src/components/common/common-popup.less +81 -0
  116. package/src/components/common/common-popup.vue +12 -96
  117. package/src/components/common/common-radio.less +75 -0
  118. package/src/components/common/common-radio.vue +13 -91
  119. package/src/components/common/common-select.less +13 -0
  120. package/src/components/common/common-select.vue +21 -38
  121. package/src/components/common/common-title.less +115 -0
  122. package/src/components/common/common-title.vue +24 -24
  123. package/src/js/loading.js +6 -6
  124. package/src/js/md5Token.js +38 -44
  125. package/src/js/utils.js +45 -53
  126. package/src/js/variables.js +47 -25
  127. package/src/style/base.less +18 -0
  128. package/src/style/color.less +40 -0
  129. package/src/style/variables.less +21 -42
  130. package/packages/add-and-take/api.ts +0 -70
  131. package/packages/add-and-take/components/interest-form.css +0 -146
  132. package/packages/add-and-take/components/interest-items.css +0 -87
  133. package/packages/add-and-take/components/interest-table.css +0 -113
  134. package/packages/add-and-take/index.css +0 -70
  135. package/packages/adjust-baoe/index.css +0 -123
  136. package/packages/business-card/index.css +0 -101
  137. package/packages/canvas-poster/index.css +0 -5
  138. package/packages/insure-calculate/index.css +0 -368
  139. package/packages/planbook-input/api.js +0 -29
  140. package/packages/planbook-input/components/product-table.css +0 -236
  141. package/packages/planbook-input/index.css +0 -31
  142. package/packages/product-info/index.css +0 -264
  143. package/packages/share-sheet/index.css +0 -203
  144. package/src/components/common/common-title.css +0 -116
  145. package/src/js/request.js +0 -64
  146. package/src/style/apply.css +0 -25
  147. package/src/style/base.css +0 -36
  148. package/src/style/color.css +0 -74
@@ -70,8 +70,8 @@
70
70
  clearable
71
71
  :inputmode="ele.inputType || 'text'"
72
72
  @focus="
73
- activeInputKey = ins.key + ele.key;
74
- numberUnitStr = getAmountUnit(ele);
73
+ activeInputKey = ins.key + ele.key
74
+ numberUnitStr = getAmountUnit(ele)
75
75
  "
76
76
  @blur="activeInputKey = ''"
77
77
  @input="numberUnitStr = getAmountUnit(ele)"
@@ -181,25 +181,19 @@
181
181
  </div>
182
182
  </template>
183
183
  <script lang="ts">
184
- import Vue from 'vue';
185
- import { Component, Prop } from 'vue-property-decorator';
186
- import { get as _get } from 'lodash';
187
- import { PLANBOOK_API_HOSTNAME } from '@src/js/variables.js';
188
- import {
189
- productDataHandler,
190
- verifyProductRules,
191
- clearAddAndTakeAndAdjustBaoeData,
192
- initElementValidateRules,
193
- convertEleOrderListToObj
194
- } from 'packages/bxs-utils/index';
195
- import { createdProductDataToCalc } from 'packages/planbook-input/helper.js';
184
+ import Vue from 'vue'
185
+ import { Component, Prop } from 'vue-property-decorator'
186
+ import { get as _get } from 'lodash'
187
+ import { getPlanbookRecommendData } from '../../src/api/planbook.js'
188
+ import { productDataHandler, multipleInsuredHandler, verifyProductRules, initElementValidateRules, convertEleOrderListToObj } from 'packages/bxs-utils/index'
189
+ import { createdProductDataToCalc } from 'packages/planbook-input/helper.js'
196
190
 
197
- import CommonTitle from '@src/components/common/common-title.vue';
198
- import CommonRadio from '@src/components/common/common-radio.vue';
199
- import CommonSelect from '@src/components/common/common-select.vue';
200
- import CommonAgeBirthday from '@src/components/common/common-age-birthday.vue';
191
+ import CommonTitle from '../../src/components/common/common-title.vue'
192
+ import CommonRadio from '../../src/components/common/common-radio.vue'
193
+ import CommonSelect from '../../src/components/common/common-select.vue'
194
+ import CommonAgeBirthday from '../../src/components/common/common-age-birthday.vue'
201
195
 
202
- import './index.css';
196
+ import './index.less'
203
197
 
204
198
  @Component({
205
199
  name: 'BxtProductInfo',
@@ -211,103 +205,108 @@ import './index.css';
211
205
  }
212
206
  })
213
207
  export default class BxtProductInfo extends Vue {
214
- activeInputKey = '';
215
- numberUnitStr = '';
216
- recommendValues = {};
217
- recommendValuesCache = {};
218
- isShowCustomValueTips = true;
208
+ activeInputKey = ''
209
+ numberUnitStr = ''
210
+ recommendValues = {}
211
+ recommendValuesCache = {}
212
+ isShowCustomValueTips = true
219
213
 
220
214
  @Prop({
221
215
  default: () => ({})
222
216
  })
223
- inputData: any;
217
+ user: any
224
218
 
225
219
  @Prop({
226
220
  default: () => ({})
227
221
  })
228
- verifyData: any;
222
+ inputData: any
223
+
224
+ @Prop({
225
+ default: () => ({})
226
+ })
227
+ verifyData: any
229
228
 
230
229
  @Prop({
231
230
  default: null
232
231
  })
233
- groupKey!: number | string;
232
+ groupKey!: number | string
234
233
 
235
234
  @Prop({
236
235
  default: null
237
236
  })
238
- productKey!: number | string;
237
+ productKey!: number | string
239
238
 
240
239
  @Prop({
241
240
  default: true
242
241
  })
243
- showRecommendValue!: boolean;
242
+ showRecommendValue!: boolean
244
243
 
245
244
  @Prop({
246
245
  default: () => ({})
247
246
  })
248
- params: any;
247
+ params: any
249
248
 
250
249
  get personData() {
251
- return this.inputData && this.inputData.personData;
250
+ return this.inputData && this.inputData.personData
252
251
  }
253
252
  get groupData() {
254
- return this.inputData && this.inputData.productGroupList && this.inputData.productGroupList.find(g => g.key === this.groupKey);
253
+ return this.inputData && this.inputData.productGroupList && this.inputData.productGroupList.find(g => g.key === this.groupKey)
255
254
  }
256
255
  get productData() {
257
- return this.groupData && this.groupData.prodOrderList && this.groupData.prodOrderList.find(p => p.key === this.productKey);
256
+ return this.groupData && this.groupData.prodOrderList && this.groupData.prodOrderList.find(p => p.key === this.productKey)
258
257
  }
259
258
  get productForm() {
260
- let productForm: any = {};
259
+ let productForm: any = {}
261
260
  this.productData &&
262
261
  this.productData.mulInsOrderList.map(ins => {
263
- productForm[ins.key] = {};
262
+ productForm[ins.key] = {}
264
263
  ins.eleOrderList.map(ele => {
265
- productForm[ins.key][ele.key] = ele.value;
266
- });
267
- });
268
- return productForm;
264
+ productForm[ins.key][ele.key] = ele.value
265
+ })
266
+ })
267
+ return productForm
269
268
  }
270
269
  get filterInsuranceList() {
271
- const list = this.productData && this.productData.mulInsOrderList.filter(ins => !ins.groupKey);
270
+ const list = this.productData && this.productData.mulInsOrderList.filter(ins => !ins.groupKey)
272
271
  // 下拉框根据条件改单选(按钮)。From hyw
273
272
  if (list) {
274
273
  list.forEach(ins => {
275
274
  if (!ins.eleOrderList) {
276
- return;
275
+ return
277
276
  }
278
277
  ins.eleOrderList.forEach(ele => {
279
278
  if (ele.componentName !== 'cmCommonSelect' || !ele.opts) {
280
- return;
279
+ return
281
280
  }
282
281
  if (ele.opts.length === 1) {
283
- return;
282
+ return
284
283
  }
285
284
  if (ele.opts.length < 6 && !ele.opts.some(o => o.desc && String(o.desc).length >= 10)) {
286
- ele.componentName = 'cmCommonRadioBtn';
285
+ ele.componentName = 'cmCommonRadioBtn'
287
286
  }
288
- });
289
- });
287
+ })
288
+ })
290
289
  }
291
- return list;
290
+ return list
292
291
  }
293
292
 
294
293
  created() {
295
- this.init();
294
+ this.init()
296
295
  }
297
296
  async init() {
298
- const { productData } = this;
299
- this.requiestRecommendValues();
300
- const errorMsg = await this.changeProduct(productData, {});
301
- this.$emit('change', productData, { errorMsg }, this);
297
+ const { productData } = this
298
+ this.requiestRecommendValues()
299
+ const errorMsg = await this.changeProduct(productData, {})
300
+ this.$emit('change', productData, { errorMsg }, this)
302
301
  }
303
302
  onChange(options: any = {}) {
304
- options.type = 'change';
305
- const { type, insData, eleData } = options;
303
+ options.type = 'change'
304
+ const { type, insData, eleData } = options
306
305
  if (!['title'].includes(eleData.key)) {
307
- this.requiestRecommendValues();
306
+ this.requiestRecommendValues()
308
307
  }
309
308
  this.$nextTick(async () => {
310
- const errorMsg = await this.changeProduct(this.productData, options);
309
+ const errorMsg = await this.changeProduct(this.productData, options)
311
310
  this.$emit(
312
311
  'change',
313
312
  this.productData,
@@ -318,36 +317,37 @@ export default class BxtProductInfo extends Vue {
318
317
  errorMsg
319
318
  },
320
319
  this
321
- );
322
- });
320
+ )
321
+ })
323
322
  }
324
323
  onClickIcon(id) {
325
- const inputDom: any = document.querySelector(`#${id}`);
326
- inputDom.focus();
324
+ const inputDom: any = document.querySelector(`#${id}`)
325
+ inputDom.focus()
327
326
  }
328
327
  async changeProduct(productData, options) {
329
- const { $listeners, inputData, verifyData, personData, groupKey, productKey, params } = this;
330
- const { type, insData, eleData } = options;
331
- const planbookId = _get(params, 'planbookId');
332
- const publicPbUuid = _get(params, 'publicPbUuid');
333
- const productVerifyData = _get(verifyData, `[${productKey}]`);
328
+ const { $listeners, user, inputData, verifyData, personData, groupKey, productKey, params } = this
329
+ const { type, insData, eleData } = options
330
+ const planbookId = _get(params, 'planbookId')
331
+ const publicPbUuid = _get(params, 'publicPbUuid')
332
+ const productVerifyData = _get(verifyData, `[${productKey}]`)
334
333
  const eventTarget = {
335
334
  insuranceKey: _get(insData, 'key') || null,
336
335
  insuranceCode: _get(insData, 'code') || null,
337
336
  elementKey: _get(eleData, 'key') || null
338
- };
339
-
340
- if (type === 'change') {
341
- clearAddAndTakeAndAdjustBaoeData(productData);
337
+ }
338
+ if (productData.multipleInsured) {
339
+ multipleInsuredHandler(productData, personData)
342
340
  }
343
341
  await productDataHandler(productData, productVerifyData, personData, {
342
+ user,
344
343
  planbookId,
344
+ executeSource: 'userAction',
345
345
  eventTarget
346
- });
346
+ })
347
347
  if (type === 'change') {
348
- this.createInsuranceInputResultEle(insData, eleData);
348
+ this.createInsuranceInputResultEle(insData, eleData)
349
349
  } else {
350
- this.createInsuranceInputResultEle();
350
+ this.createInsuranceInputResultEle()
351
351
  }
352
352
 
353
353
  let errorMsg: any = verifyProductRules({
@@ -355,263 +355,251 @@ export default class BxtProductInfo extends Vue {
355
355
  productData,
356
356
  insData,
357
357
  eleData
358
- });
358
+ })
359
359
  if (!errorMsg) {
360
360
  await this.validate()
361
361
  .then(async () => {
362
- const hasRevalidateFlag = (_get(productData, 'mulInsOrderList') || []).some(ins => ins.revalidateFlag);
362
+ const hasRevalidateFlag = (_get(productData, 'mulInsOrderList') || []).some(ins => ins.revalidateFlag)
363
363
  if (hasRevalidateFlag && $listeners.reCalculate) {
364
364
  await new Promise<any>((resolve, reject) => {
365
365
  this.$emit(
366
366
  'reCalculate',
367
367
  inputData,
368
368
  {
369
+ user,
369
370
  planbookId,
370
371
  publicPbUuid,
371
372
  groupKey,
372
373
  productKey,
374
+ executeSource: 'userAction',
373
375
  isIgnoreError: true,
374
376
  eventTarget
375
377
  },
376
378
  resolve,
377
379
  reject
378
- );
380
+ )
379
381
  }).catch(err => {
380
- errorMsg = _get(err, '[0].message') || _get(err, 'message');
381
- });
382
+ errorMsg = _get(err, '[0].message') || _get(err, 'message')
383
+ })
382
384
  await productDataHandler(productData, productVerifyData, personData, {
385
+ user,
383
386
  planbookId,
387
+ executeSource: 'userAction',
384
388
  eventTarget
385
- });
389
+ })
386
390
  }
387
391
  })
388
- .catch(() => {});
392
+ .catch(() => {})
389
393
  }
390
- return errorMsg;
394
+ return errorMsg
391
395
  }
392
396
  isInsuranceChecked(ins) {
393
- let titleEle = ins.eleOrderList.find(e => e.key === 'title');
394
- return ins.key === 'common' || (!!titleEle && titleEle.value);
397
+ let titleEle = ins.eleOrderList.find(e => e.key === 'title')
398
+ return ins.key === 'common' || (!!titleEle && titleEle.value)
395
399
  }
396
400
  isNextInsuranceFollow(ins) {
397
- let index = this.productData.mulInsOrderList.findIndex(i => i.key === ins.key);
401
+ let index = this.productData.mulInsOrderList.findIndex(i => i.key === ins.key)
398
402
  return (
399
403
  this.productData.mulInsOrderList[index + 1] &&
400
404
  !this.productData.mulInsOrderList[index + 1].groupKey &&
401
405
  this.productData.mulInsOrderList[index + 1].isFollowing
402
- );
406
+ )
403
407
  }
404
408
  getElementRules(ele) {
405
- let _rules = ele.rules || [];
409
+ let _rules = ele.rules || []
406
410
  if (ele.isIgnoreValidate) {
407
- _rules = [];
411
+ _rules = []
408
412
  }
409
- return _rules;
413
+ return _rules
410
414
  }
411
415
  getElementDisabled(ele) {
412
- const opts = (ele.opts || []).filter(o => !o.isHide && !o.isDisabled && !o.isInvalid);
413
- return ele.isDisabled || (opts.length === 1 && _get(opts, '[0].val') === ele.value);
416
+ const opts = (ele.opts || []).filter(o => !o.isHide && !o.isDisabled && !o.isInvalid)
417
+ return ele.isDisabled || (opts.length === 1 && _get(opts, '[0].val') === ele.value)
414
418
  }
415
419
  genInsuranceHmTag(opt) {
416
- const refInsurance = this.productData.mulInsOrderList.find(ins => ins.key === opt.val);
420
+ const refInsurance = this.productData.mulInsOrderList.find(ins => ins.key === opt.val)
417
421
  if (!refInsurance) {
418
- return '';
422
+ return ''
419
423
  }
420
424
  if (!refInsurance.huomian || refInsurance.isGroup) {
421
- return '';
425
+ return ''
422
426
  }
423
427
  if (refInsurance.huomian === 'beiHuomian') {
424
- return '被保人';
428
+ return '被保人'
425
429
  }
426
- return '投保人';
430
+ return '投保人'
427
431
  }
428
432
  getInsuranceTitleHmTag(insurance) {
429
433
  if (!insurance.huomian || insurance.isGroup) {
430
- return '';
434
+ return ''
431
435
  }
432
436
  if (insurance.huomian === 'beiHuomian') {
433
- return '被保人';
437
+ return '被保人'
434
438
  } else {
435
- return '投保人';
439
+ return '投保人'
436
440
  }
437
441
  }
438
442
  /** params.insuranceSaleStatus: { [insuranceKey]: number },值为 2 表示停售(与 cmCommonTitle、cmCommonRadio 选项 val 一致) */
439
443
  getInsuranceSaleStatusTagByKey(key: string | number) {
440
- const map = _get(this, 'params.insuranceSaleStatus');
444
+ const map = _get(this, 'params.insuranceSaleStatus')
441
445
  if (!map || typeof map !== 'object' || key === undefined || key === null) {
442
- return '';
446
+ return ''
443
447
  }
444
- const status = map[key] ?? map[String(key)];
448
+ const status = map[key] ?? map[String(key)]
445
449
  if (status === undefined || status === null) {
446
- return '';
450
+ return ''
447
451
  }
448
- return Number(status) === 2 ? '停' : '';
452
+ return Number(status) === 2 ? '停' : ''
449
453
  }
450
454
  getInsuranceSaleStatusTag(insurance) {
451
- return this.getInsuranceSaleStatusTagByKey(insurance.key);
455
+ return this.getInsuranceSaleStatusTagByKey(insurance.key)
452
456
  }
453
457
  getHuomianTips(insurance, element) {
454
- const personOrderList = this.inputData.personData.personOrderList;
455
- const applicationInfo = personOrderList.find(p => p.key === 'applicantInfo');
456
- const applicationTitle = applicationInfo && applicationInfo.eleOrderList.find(e => e.key === 'title');
457
- const applicationSame = applicationInfo && applicationInfo.eleOrderList.find(e => e.key === 'applicantAndInsuredSame');
458
+ const personOrderList = this.inputData.personData.personOrderList
459
+ const applicationInfo = personOrderList.find(p => p.key === 'applicantInfo')
460
+ const applicationTitle = applicationInfo && applicationInfo.eleOrderList.find(e => e.key === 'title')
461
+ const applicationSame = applicationInfo && applicationInfo.eleOrderList.find(e => e.key === 'applicantAndInsuredSame')
458
462
  if (!(['touHuomian', 'shuangHuomian'].includes(insurance.huomian) && element.isDisabled)) {
459
- return '';
463
+ return ''
460
464
  }
461
465
  if (!(applicationTitle && applicationTitle.value)) {
462
- return '<em>设置</em>投保人信息后选择';
466
+ return '<em>设置</em>投保人信息后选择'
463
467
  }
464
468
  if (applicationSame && applicationSame.value && !insurance.allowSamePerson) {
465
- return '投被保人为同一人,<em>修改</em>投保人信息后选择';
469
+ return '投被保人为同一人,<em>修改</em>投保人信息后选择'
466
470
  }
467
- return '当前投保人不能加该险种,<em>修改</em>投保人信息后选择';
471
+ return '当前投保人不能加该险种,<em>修改</em>投保人信息后选择'
468
472
  }
469
473
  getAmountUnit(ele) {
470
- let digits = isNaN(ele.value * 1) ? 0 : Math.floor(Math.log10(ele.value) + 1);
474
+ let digits = isNaN(ele.value * 1) ? 0 : Math.floor(Math.log10(ele.value) + 1)
471
475
  switch (digits) {
472
476
  case 5:
473
- return '万';
477
+ return '万'
474
478
  case 6:
475
- return '十万';
479
+ return '十万'
476
480
  case 7:
477
- return '百万';
481
+ return '百万'
478
482
  case 8:
479
- return '千万';
483
+ return '千万'
480
484
  case 9:
481
- return '亿';
485
+ return '亿'
482
486
  default:
483
- return '';
487
+ return ''
484
488
  }
485
489
  }
486
490
  async validate() {
487
- const { $refs, filterInsuranceList } = this;
488
- const insKeys: any = filterInsuranceList.map(ins => ins.key);
491
+ const { $refs, filterInsuranceList } = this
492
+ const insKeys: any = filterInsuranceList.map(ins => ins.key)
489
493
  return new Promise((resolve, reject) => {
490
494
  setTimeout(() => {
491
- const promises = [];
495
+ const promises = []
492
496
  for (const k of insKeys) {
493
- const _ref = _get($refs, `insuranceForm${k}[0]`);
497
+ const _ref = _get($refs, `insuranceForm${k}[0]`)
494
498
  if (_ref) {
495
- promises.push(_ref?.validate());
499
+ promises.push(_ref?.validate())
496
500
  }
497
501
  }
498
502
  Promise.all(promises)
499
503
  .then(() => resolve([]))
500
- .catch(error => reject(error));
501
- }, 200);
502
- });
504
+ .catch(error => reject(error))
505
+ }, 200)
506
+ })
503
507
  }
504
508
  closeKeyBoard() {
505
- const activeElement: any = document.activeElement;
509
+ const activeElement: any = document.activeElement
506
510
  if (!activeElement) {
507
- return false;
511
+ return false
508
512
  }
509
- activeElement.blur();
510
- return false;
513
+ activeElement.blur()
514
+ return false
511
515
  }
512
516
  getRecommendValues(ins, ele) {
513
- if (!['baoe', 'baof'].includes(ele.key)) {
514
- return null;
517
+ if (!['baoe', 'baof'].includes(ele.key) || ele.isDisabled) {
518
+ return null
515
519
  }
516
- const insurance = convertEleOrderListToObj(ins);
517
- return this.recommendValues && this.recommendValues[insurance.isGroup ? insurance.insuranceId : insurance.key];
520
+ const insurance = convertEleOrderListToObj(ins)
521
+ return this.recommendValues && this.recommendValues[insurance.isGroup ? insurance.insuranceId : insurance.key]
518
522
  }
519
523
  async requiestRecommendValues() {
520
- const self = this;
521
- const { showRecommendValue, recommendValuesCache, inputData, groupData, productData } = self;
524
+ const self = this
525
+ const { showRecommendValue, recommendValuesCache, inputData, groupData, productData } = self
522
526
  if (!showRecommendValue) {
523
- return;
527
+ return
524
528
  }
525
- const url = `${PLANBOOK_API_HOSTNAME}/planBook/input/calculate/recommend`;
526
- const calcData = await createdProductDataToCalc(inputData, {
529
+ const requestDataToCalc: any = await createdProductDataToCalc(inputData, {
527
530
  groupKey: groupData.key,
528
531
  productKey: productData.key
529
- }).catch(() => {});
530
-
531
- const reqParams: any = [];
532
- const calcInputData = calcData && JSON.parse(calcData.jd);
533
- const calcProductData = calcInputData && calcInputData.productGroupList[0].prodOrderList[0];
534
- if (calcProductData && calcProductData.mulInsOrderList) {
535
- calcProductData.mulInsOrderList.forEach(ins => {
536
- reqParams.push({
537
- insuranceId: ins.key,
538
- period: ins.pPeriod,
539
- calMethod: ins.calMethod || ins.feeType || ins.feeBaseType
540
- });
541
- });
542
- }
532
+ }).catch(() => {})
533
+ const reqParams: any = []
534
+ const inputDataToCalc = requestDataToCalc && JSON.parse(requestDataToCalc.jd)
535
+ const mulInsOrderList = _get(inputDataToCalc, 'productGroupList[0].prodOrderList[0].mulInsOrderList') || []
536
+ mulInsOrderList.forEach(ins => {
537
+ reqParams.push({
538
+ insuranceId: ins.key,
539
+ period: ins.pPeriod,
540
+ calMethod: ins.calMethod || ins.feeType || ins.feeBaseType
541
+ })
542
+ })
543
543
 
544
544
  if (recommendValuesCache[JSON.stringify(reqParams)]) {
545
- self.recommendValues = recommendValuesCache[JSON.stringify(reqParams)];
546
- return;
545
+ self.recommendValues = recommendValuesCache[JSON.stringify(reqParams)]
546
+ return
547
547
  }
548
548
 
549
- return fetch(url, {
550
- method: 'POST',
551
- credentials: 'include',
552
- headers: {
553
- Accept: 'application/json, text/plain, */*',
554
- 'Content-Type': 'application/json;'
555
- },
556
- body: JSON.stringify(reqParams)
557
- })
558
- .then(response => response.json())
559
- .then(({ success, data, info }: any) => {
560
- if (!success || !data) {
561
- self.$toast(info);
562
- return Promise.reject();
563
- }
564
- let recommendValues = data.reduce((obj, ele) => {
549
+ return getPlanbookRecommendData(reqParams)
550
+ .then((data: any) => {
551
+ const recommendValues = data.reduce((obj, ele) => {
565
552
  return Object.assign(obj, {
566
553
  [ele.insuranceId]: ele.valueList
567
- });
568
- }, {});
554
+ })
555
+ }, {})
569
556
 
570
557
  // 推荐金额,根据最小值和最大值进行过滤。From hyw
571
- const mulInsOrderList = productData && productData.mulInsOrderList ? productData.mulInsOrderList : [];
558
+ const mulInsOrderList = _get(productData, 'mulInsOrderList') || []
572
559
  mulInsOrderList
573
560
  .filter(ins => ins.eleOrderList && ins.eleOrderList.length)
574
561
  .filter(ins => recommendValues[ins.key])
575
562
  .map(ins => {
576
- const calMethod = ins.calMethod || ins.feeType || ins.feeBaseType;
577
- const key = calMethod === 'baof2baoe' ? 'baof' : 'baoe';
578
- const ele = ins.eleOrderList.find(ele => ele.key === key);
563
+ const calMethod = ins.calMethod || ins.feeType || ins.feeBaseType
564
+ const key = calMethod === 'baof2baoe' ? 'baof' : 'baoe'
565
+ const ele = ins.eleOrderList.find(ele => ele.key === key)
579
566
  if (ele) {
580
567
  if (ele.min && !isNaN(Number(ele.min))) {
581
- recommendValues[ins.key] = (recommendValues[ins.key] || []).filter(v => v >= ele.min);
568
+ recommendValues[ins.key] = (recommendValues[ins.key] || []).filter(v => v >= ele.min)
582
569
  }
583
570
  if (ele.max && !isNaN(Number(ele.max))) {
584
- recommendValues[ins.key] = (recommendValues[ins.key] || []).filter(v => v <= ele.max);
571
+ recommendValues[ins.key] = (recommendValues[ins.key] || []).filter(v => v <= ele.max)
585
572
  }
586
573
  }
587
- });
588
- self.recommendValues = recommendValues;
589
- recommendValuesCache[JSON.stringify(reqParams)] = recommendValues;
574
+ })
575
+ self.recommendValues = recommendValues
576
+ recommendValuesCache[JSON.stringify(reqParams)] = recommendValues
577
+ })
578
+ .catch(info => {
579
+ self.$toast(info)
580
+ console.log(info)
590
581
  })
591
- .catch(error => {
592
- console.log(error);
593
- });
594
582
  }
595
583
  onClickRecommendValue(value, ins, ele) {
596
- const self = this;
597
- ele.value = value;
584
+ const self = this
585
+ ele.value = value
598
586
  self.onChange({
599
587
  insData: ins,
600
588
  eleData: ele
601
- });
589
+ })
602
590
 
603
591
  self.$nextTick(() => {
604
- const ref = self.$refs[ins.key + ele.key + 'item'];
605
- const ref0 = ref && ref[0];
592
+ const ref = self.$refs[ins.key + ele.key + 'item']
593
+ const ref0 = ref && ref[0]
606
594
  if (ref0) {
607
- ref0.validate();
595
+ ref0.validate()
608
596
  }
609
- });
597
+ })
610
598
  }
611
599
  createInsuranceInputResultEle(insData?: any, eleData?: any) {
612
- const { params, productData } = this;
600
+ const { params, productData } = this
613
601
  if (!params.allowCustomResult) {
614
- return;
602
+ return
615
603
  }
616
604
 
617
605
  productData.mulInsOrderList
@@ -619,25 +607,25 @@ export default class BxtProductInfo extends Vue {
619
607
  .forEach(ins => {
620
608
  // 需要特别注意组合险的情况
621
609
  if (ins.groupKey) {
622
- return;
610
+ return
623
611
  }
624
612
  if (ins.key === 'common') {
625
- return;
613
+ return
626
614
  }
627
615
  if (insData && eleData && !insData.isGroup && insData.key === ins.key && eleData.key !== 'calMethod') {
628
- return;
616
+ return
629
617
  }
630
618
 
631
- const calMethod = ins.eleOrderList.find(e => e.key === 'calMethod');
632
- const baof = ins.eleOrderList.find(e => e.key === 'baof') || ins.eleOrderList.find(e => e.key === 'payModePremium');
633
- let inputResult = ins.eleOrderList.find(e => e.key === 'inputResult');
634
- const labelName = calMethod ? (calMethod.value === 'baof2baoe' ? '保额' : '保费') : baof ? '保额' : '保费';
635
- let value = ins.inputResult === undefined ? null : ins.inputResult;
619
+ const calMethod = ins.eleOrderList.find(e => e.key === 'calMethod')
620
+ const baof = ins.eleOrderList.find(e => e.key === 'baof') || ins.eleOrderList.find(e => e.key === 'payModePremium')
621
+ let inputResult = ins.eleOrderList.find(e => e.key === 'inputResult')
622
+ const labelName = calMethod ? (calMethod.value === 'baof2baoe' ? '保额' : '保费') : baof ? '保额' : '保费'
623
+ let value = ins.inputResult === undefined ? null : ins.inputResult
636
624
  if (inputResult) {
637
- value = inputResult.value;
625
+ value = inputResult.value
638
626
  }
639
627
  if (insData && eleData && insData.key === ins.key && eleData.key === 'inputResult') {
640
- value = eleData.value;
628
+ value = eleData.value
641
629
  }
642
630
  inputResult = {
643
631
  componentName: 'cmCommonInput',
@@ -650,15 +638,15 @@ export default class BxtProductInfo extends Vue {
650
638
  regExp: '/^\\d{1,}(\\.\\d{1,2})?$/',
651
639
  regExpMessage: '请输入1-2位小数的值',
652
640
  value
653
- };
654
- inputResult.rules = initElementValidateRules(inputResult);
655
- delete ins.inputResult;
656
- ins.eleOrderList = ins.eleOrderList.filter(e => e.key !== 'inputResult');
641
+ }
642
+ inputResult.rules = initElementValidateRules(inputResult)
643
+ delete ins.inputResult
644
+ ins.eleOrderList = ins.eleOrderList.filter(e => e.key !== 'inputResult')
657
645
 
658
646
  if (productData.inputResultSwitch) {
659
- ins.eleOrderList.push(inputResult);
647
+ ins.eleOrderList.push(inputResult)
660
648
  }
661
- });
649
+ })
662
650
  }
663
651
  }
664
652
  </script>