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
package/es/utils/index.js CHANGED
@@ -1,19 +1,10 @@
1
1
  import QS from 'qs';
2
- import { memoize, cloneDeep } from 'lodash';
3
- import axios from 'axios';
2
+ import { memoize, cloneDeep, findLastIndex } from 'lodash';
3
+ import 'vant/lib/dialog/index.css';
4
+ import _Dialog from 'vant/lib/dialog';
4
5
  import 'vant/lib/toast/index.css';
5
6
  import _Toast from 'vant/lib/toast';
6
7
 
7
- function _typeof$1(o) {
8
- "@babel/helpers - typeof";
9
-
10
- return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
11
- return typeof o;
12
- } : function (o) {
13
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
14
- }, _typeof$1(o);
15
- }
16
-
17
8
  var enableLizhaoDebug = document && document.cookie && document.cookie.match('ENABLE_LIZHAO_DEBUG=1');
18
9
  function consoleLogWhenEnable() {
19
10
  if (enableLizhaoDebug) {
@@ -182,45 +173,6 @@ function converUnit10000(value) {
182
173
  return value >= 10000 && !(value % 10000) ? "".concat(value / 10000, "\u4E07") : value;
183
174
  }
184
175
 
185
- /**
186
- * **对象的深拷贝**
187
- * @ignore
188
- * @author Lizhao <lz@winbaoxian.com>
189
- * @date 2022-04-25
190
- * @param {object} obj - 必传
191
- * @param {WeakMap} hash - 可不传
192
- * @returns {object} 拷贝对象
193
- */
194
- function deepCopy(obj) {
195
- var hash = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new WeakMap();
196
- if (!obj || _typeof$1(obj) !== 'object') {
197
- return obj;
198
- }
199
- if (hash.has(obj)) {
200
- return hash.get(obj);
201
- }
202
- var newObj;
203
- var Constructor = obj.constructor;
204
- switch (Constructor) {
205
- case RegExp:
206
- newObj = new Constructor(obj);
207
- break;
208
- case Date:
209
- newObj = new Constructor(obj.getTime());
210
- break;
211
- default:
212
- newObj = new Constructor();
213
- break;
214
- }
215
- hash.set(obj, newObj);
216
- for (var key in obj) {
217
- if (obj.hasOwnProperty(key)) {
218
- newObj[key] = _typeof$1(obj[key]) === 'object' ? deepCopy(obj[key], hash) : obj[key];
219
- }
220
- }
221
- return newObj;
222
- }
223
-
224
176
  /**
225
177
  * **根据生日算年龄**
226
178
  * @author Lizhao <lz@winbaoxian.com>
@@ -306,6 +258,9 @@ function textOverflowEllipsis(str, n) {
306
258
  }
307
259
  function getExpressionParamMap(personData, product, ins, options) {
308
260
  var map = {
261
+ user: {},
262
+ executeSource: null,
263
+ // 执行:init-初始化 import-导入数据 userAction-用户操作 confirm-确认
309
264
  planbookId: null,
310
265
  // 计划书id
311
266
  productId: null,
@@ -379,12 +334,18 @@ function getExpressionParamMap(personData, product, ins, options) {
379
334
  }
380
335
  }
381
336
  if (options) {
337
+ if (options.user) {
338
+ map.user = options.user;
339
+ }
382
340
  if (options.planbookId) {
383
341
  map.planbookId = options.planbookId;
384
342
  }
385
343
  if (options.eventTarget) {
386
344
  map.t = options.eventTarget;
387
345
  }
346
+ if (options.executeSource) {
347
+ map.executeSource = options.executeSource;
348
+ }
388
349
  }
389
350
  if (ins && ins.customVariableExp) {
390
351
  var exp = ins.customVariableExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'map.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'map.$2');
@@ -510,6 +471,15 @@ function initPersonData(inputData, verifyData) {
510
471
  if (!person || !person.eleOrderList) {
511
472
  return;
512
473
  }
474
+
475
+ // 投保人年龄默认范围调整到「16-99岁」。From hyw
476
+ if (person.key === 'applicantInfo') {
477
+ person.eleOrderList.forEach(function (ele) {
478
+ if (ele.key === 'age') {
479
+ ele.opts = [16, 99];
480
+ }
481
+ });
482
+ }
513
483
  person.createArchive = person.createArchive || false;
514
484
  person.cid = person.cid || null;
515
485
  if (!person.eleOrderList.find(function (e) {
@@ -522,7 +492,7 @@ function initPersonData(inputData, verifyData) {
522
492
  placeholder: '请输入姓名',
523
493
  componentName: 'cmCommonInput',
524
494
  maxlength: 16,
525
- isHide: false
495
+ isHide: true
526
496
  });
527
497
  }
528
498
  // 投保人添加元素:投被保人是同一人
@@ -635,7 +605,7 @@ function initPersonData(inputData, verifyData) {
635
605
  }
636
606
  case 'age':
637
607
  {
638
- e.label = '年龄';
608
+ e.label = '投保时年龄';
639
609
  e.componentName = 'cmAgeBirthday';
640
610
  e.placeholder = '请选择年龄';
641
611
  e.options = [];
@@ -895,6 +865,16 @@ function convertPersonData(allPersonsData) {
895
865
  }
896
866
  }
897
867
 
868
+ function _typeof$1(o) {
869
+ "@babel/helpers - typeof";
870
+
871
+ return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
872
+ return typeof o;
873
+ } : function (o) {
874
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
875
+ }, _typeof$1(o);
876
+ }
877
+
898
878
  function toPrimitive(t, r) {
899
879
  if ("object" != _typeof$1(t) || !t) return t;
900
880
  var e = t[Symbol.toPrimitive];
@@ -9344,12 +9324,27 @@ var jaxExports = requireJax();
9344
9324
  const Jax = /*@__PURE__*/getDefaultExportFromCjs(jaxExports);
9345
9325
 
9346
9326
  var getStandardOrigin = Jax.urlUtil.getStandardOrigin;
9327
+ var _Jax$parseUaString = Jax.parseUaString();
9328
+ _Jax$parseUaString.isApp;
9329
+ _Jax$parseUaString.appType;
9330
+ _Jax$parseUaString.appVersion;
9331
+ _Jax$parseUaString.isAndroid;
9332
+ _Jax$parseUaString.isIos;
9333
+ _Jax$parseUaString.isBxsApp;
9334
+ _Jax$parseUaString.isBaoXiaoZhuApp;
9335
+ _Jax$parseUaString.isBrokerApp;
9336
+ _Jax$parseUaString.isYjjApp;
9337
+ _Jax$parseUaString.isToBApp;
9338
+ _Jax$parseUaString.isRongYiBaoApp;
9339
+ _Jax$parseUaString.isWeChat;
9340
+ _Jax$parseUaString.appScheme;
9347
9341
  var hostname = window && window.location && window.location.hostname || '';
9348
9342
  /** 当前页 host 为 cppoc- 前缀时,请求 loading 使用 Vant Toast,否则走 appBridge */
9349
9343
  var IS_CPPOC_HOST = hostname.startsWith('cppoc-');
9350
9344
  var IS_PRODUCT_ENV = hostname.search(/(winbaoxian|ai-baoxiaozhu)\.com/) !== -1;
9351
9345
  hostname.search(/(winbaoxian|ai-baoxiaozhu)\.cn/) !== -1;
9352
9346
  hostname.search(/localhost|192\.168|127\.0\.0\.1|dev\.winbaoxian\.cn/) !== -1;
9347
+ var IS_LOCALHOST_IP_ENV = hostname.search(/192\.168/) !== -1;
9353
9348
  var IS_UAT_ENV = hostname.includes("pbf-uat.");
9354
9349
  var IS_ENABLE_DEBUG = !IS_PRODUCT_ENV;
9355
9350
  if (IS_ENABLE_DEBUG) {
@@ -9357,6 +9352,9 @@ if (IS_ENABLE_DEBUG) {
9357
9352
  }
9358
9353
  hostname.includes('ai-baoxiaozhu') ? 'ai-baoxiaozhu' : 'winbaoxian';
9359
9354
  function getFullOrigin(data) {
9355
+ if (IS_LOCALHOST_IP_ENV) {
9356
+ return "https://".concat(data, ".winbaoxian.cn");
9357
+ }
9360
9358
  var _prefixDomain = IS_CPPOC_HOST ? 'cppoc-' : '';
9361
9359
  if (typeof data === 'string') {
9362
9360
  return getStandardOrigin("".concat(_prefixDomain).concat(data));
@@ -9371,7 +9369,9 @@ function getFullOrigin(data) {
9371
9369
  }
9372
9370
  var APP_HOSTNAME = getFullOrigin('app');
9373
9371
  getFullOrigin('pbf');
9374
- getFullOrigin("bxs-planbook-api".concat(IS_UAT_ENV ? '-uat' : ''));
9372
+ var PLANBOOK_API_HOSTNAME = getFullOrigin("bxs-planbook-api".concat(IS_UAT_ENV ? '-uat' : ''));
9373
+ /** 险种试算等 trade 接口(insurance2a-api) */
9374
+ var INSURANCE2A_API_HOSTNAME = "https://insurance2a-api.wyins.net".concat(IS_PRODUCT_ENV ? '' : '.cn');
9375
9375
  getUrlParams();
9376
9376
  function getUrlParams(url) {
9377
9377
  var _url = location.search || '';
@@ -9379,6 +9379,267 @@ function getUrlParams(url) {
9379
9379
  return _searchStr ? QS.parse(_searchStr) : {};
9380
9380
  }
9381
9381
 
9382
+ function showLoading() {
9383
+ if (IS_CPPOC_HOST) {
9384
+ _Toast.loading({
9385
+ message: '加载中...',
9386
+ forbidClick: true
9387
+ });
9388
+ } else if (window.appBridge && window.appBridge.showLoading) {
9389
+ window.appBridge.showLoading();
9390
+ }
9391
+ }
9392
+ function hideLoading() {
9393
+ if (IS_CPPOC_HOST) {
9394
+ _Toast.clear();
9395
+ } else if (window.appBridge && window.appBridge.hideLoading) {
9396
+ window.appBridge.hideLoading();
9397
+ }
9398
+ }
9399
+
9400
+ function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
9401
+ function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
9402
+ var options = {
9403
+ baseURL: PLANBOOK_API_HOSTNAME,
9404
+ withCredentials: true,
9405
+ timeout: 10000,
9406
+ headers: {
9407
+ 'X-Requested-With': 'XMLHttpRequest'
9408
+ }
9409
+ };
9410
+ var loadingTimer = null;
9411
+ var showRequestLoading = function showRequestLoading() {
9412
+ if (loadingTimer) {
9413
+ clearTimeout(loadingTimer);
9414
+ }
9415
+ loadingTimer = setTimeout(function () {
9416
+ showLoading();
9417
+ }, 300);
9418
+ };
9419
+ var hideRequestLoading = function hideRequestLoading() {
9420
+ if (loadingTimer) {
9421
+ hideLoading();
9422
+ }
9423
+ if (loadingTimer) {
9424
+ clearTimeout(loadingTimer);
9425
+ }
9426
+ };
9427
+ var normalizeMethod = function normalizeMethod(method) {
9428
+ return (method || 'get').toUpperCase();
9429
+ };
9430
+ var serializeParams = function serializeParams(params) {
9431
+ if (!params) {
9432
+ return '';
9433
+ }
9434
+ var queryParts = [];
9435
+ Object.keys(params).forEach(function (key) {
9436
+ var value = params[key];
9437
+ if (value === undefined || value === null) {
9438
+ return;
9439
+ }
9440
+ if (Array.isArray(value)) {
9441
+ value.forEach(function (item) {
9442
+ queryParts.push("".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(item)));
9443
+ });
9444
+ return;
9445
+ }
9446
+ queryParts.push("".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(value)));
9447
+ });
9448
+ return queryParts.join('&');
9449
+ };
9450
+ var isAbsoluteUrl = function isAbsoluteUrl(url) {
9451
+ return /^https?:\/\//.test(url);
9452
+ };
9453
+ var buildUrl = function buildUrl(baseURL, url, params) {
9454
+ var queryString = serializeParams(params);
9455
+ var requestUrl = isAbsoluteUrl(url) ? url : "".concat(baseURL).concat(url);
9456
+ if (!queryString) {
9457
+ return requestUrl;
9458
+ }
9459
+ return "".concat(requestUrl).concat(requestUrl.includes('?') ? '&' : '?').concat(queryString);
9460
+ };
9461
+ var isPlainObject = function isPlainObject(value) {
9462
+ return Object.prototype.toString.call(value) === '[object Object]';
9463
+ };
9464
+ var buildBody = function buildBody(data, headers) {
9465
+ if (data === undefined || data === null) {
9466
+ return undefined;
9467
+ }
9468
+ if (data instanceof FormData || data instanceof Blob || typeof data === 'string') {
9469
+ return data;
9470
+ }
9471
+ if (isPlainObject(data) || Array.isArray(data)) {
9472
+ if (!headers['Content-Type']) {
9473
+ headers['Content-Type'] = 'application/json';
9474
+ }
9475
+ return JSON.stringify(data);
9476
+ }
9477
+ return data;
9478
+ };
9479
+ var parseResponse = /*#__PURE__*/function () {
9480
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(response) {
9481
+ var contentType, text;
9482
+ return _regeneratorRuntime.wrap(function (_context) {
9483
+ while (1) switch (_context.prev = _context.next) {
9484
+ case 0:
9485
+ contentType = response.headers.get('content-type') || '';
9486
+ if (!contentType.includes('application/json')) {
9487
+ _context.next = 1;
9488
+ break;
9489
+ }
9490
+ return _context.abrupt("return", response.json());
9491
+ case 1:
9492
+ _context.next = 2;
9493
+ return response.text();
9494
+ case 2:
9495
+ text = _context.sent;
9496
+ if (text) {
9497
+ _context.next = 3;
9498
+ break;
9499
+ }
9500
+ return _context.abrupt("return", {});
9501
+ case 3:
9502
+ _context.prev = 3;
9503
+ return _context.abrupt("return", JSON.parse(text));
9504
+ case 4:
9505
+ _context.prev = 4;
9506
+ _context["catch"](3);
9507
+ return _context.abrupt("return", {
9508
+ data: text
9509
+ });
9510
+ case 5:
9511
+ case "end":
9512
+ return _context.stop();
9513
+ }
9514
+ }, _callee, null, [[3, 4]]);
9515
+ }));
9516
+ return function parseResponse(_x) {
9517
+ return _ref.apply(this, arguments);
9518
+ };
9519
+ }();
9520
+ var createTimeoutError = function createTimeoutError(timeout) {
9521
+ var error = new Error("timeout of ".concat(timeout, "ms exceeded"));
9522
+ error.name = 'TimeoutError';
9523
+ return error;
9524
+ };
9525
+ var request = /*#__PURE__*/function () {
9526
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(config) {
9527
+ var url, _config$baseURL, baseURL, _config$method, method, params, data, _config$headers, headers, isIgnoreLoading, _config$timeout, timeout, _config$withCredentia, withCredentials, returnFullResponse, requestHeaders, timeoutId, fetchPromise, response, res, error, code, messageMap, message, _t2;
9528
+ return _regeneratorRuntime.wrap(function (_context2) {
9529
+ while (1) switch (_context2.prev = _context2.next) {
9530
+ case 0:
9531
+ url = config.url, _config$baseURL = config.baseURL, baseURL = _config$baseURL === void 0 ? options.baseURL : _config$baseURL, _config$method = config.method, method = _config$method === void 0 ? 'get' : _config$method, params = config.params, data = config.data, _config$headers = config.headers, headers = _config$headers === void 0 ? {} : _config$headers, isIgnoreLoading = config.isIgnoreLoading, _config$timeout = config.timeout, timeout = _config$timeout === void 0 ? options.timeout : _config$timeout, _config$withCredentia = config.withCredentials, withCredentials = _config$withCredentia === void 0 ? options.withCredentials : _config$withCredentia, returnFullResponse = config.returnFullResponse;
9532
+ if (!isIgnoreLoading) {
9533
+ showRequestLoading();
9534
+ }
9535
+ requestHeaders = _objectSpread$2(_objectSpread$2({}, options.headers), headers);
9536
+ timeoutId = null;
9537
+ _context2.prev = 1;
9538
+ fetchPromise = fetch(buildUrl(baseURL, url, params), {
9539
+ method: normalizeMethod(method),
9540
+ headers: requestHeaders,
9541
+ body: normalizeMethod(method) === 'GET' ? undefined : buildBody(data, requestHeaders),
9542
+ credentials: withCredentials ? 'include' : 'same-origin'
9543
+ });
9544
+ _context2.next = 2;
9545
+ return Promise.race([fetchPromise, new Promise(function (resolve, reject) {
9546
+ timeoutId = setTimeout(function () {
9547
+ reject(createTimeoutError(timeout));
9548
+ }, timeout);
9549
+ })]);
9550
+ case 2:
9551
+ response = _context2.sent;
9552
+ _context2.next = 3;
9553
+ return parseResponse(response);
9554
+ case 3:
9555
+ res = _context2.sent;
9556
+ if (response.ok) {
9557
+ _context2.next = 4;
9558
+ break;
9559
+ }
9560
+ error = new Error("Request failed with status code ".concat(response.status));
9561
+ error.response = {
9562
+ status: response.status,
9563
+ data: res
9564
+ };
9565
+ throw error;
9566
+ case 4:
9567
+ code = res.code;
9568
+ if (!['002012', '002013', '002015'].includes(code)) {
9569
+ _context2.next = 5;
9570
+ break;
9571
+ }
9572
+ messageMap = {
9573
+ m002012: '当前账号因操作频繁被限制,请明天再试。感谢理解',
9574
+ m002013: '您的操作频率较高,已达到今日生成上限。请稍后再试或明天继续使用,感谢您的理解!',
9575
+ m002015: '您今天做了太多计划书了,休息一下,明天再来吧'
9576
+ };
9577
+ message = messageMap["m".concat(code)];
9578
+ if (message) {
9579
+ _Dialog.alert({
9580
+ message: message,
9581
+ confirmButtonText: '知道了',
9582
+ confirmButtonColor: '#0A64FE'
9583
+ });
9584
+ }
9585
+ return _context2.abrupt("return", Promise.reject({
9586
+ code: code,
9587
+ message: message
9588
+ }));
9589
+ case 5:
9590
+ if (!(code === 401 || res.status === 401)) {
9591
+ _context2.next = 6;
9592
+ break;
9593
+ }
9594
+ gotoLogin();
9595
+ return _context2.abrupt("return", Promise.reject('status: 401'));
9596
+ case 6:
9597
+ if (!(res.success && res.data === -1)) {
9598
+ _context2.next = 7;
9599
+ break;
9600
+ }
9601
+ gotoLogin();
9602
+ return _context2.abrupt("return", Promise.reject('login: -1'));
9603
+ case 7:
9604
+ return _context2.abrupt("return", returnFullResponse ? res : res.data);
9605
+ case 8:
9606
+ _context2.prev = 8;
9607
+ _t2 = _context2["catch"](1);
9608
+ if (_t2.response && _t2.response.status == 401) {
9609
+ gotoLogin();
9610
+ }
9611
+ return _context2.abrupt("return", Promise.reject(_t2));
9612
+ case 9:
9613
+ _context2.prev = 9;
9614
+ if (timeoutId) {
9615
+ clearTimeout(timeoutId);
9616
+ }
9617
+ hideRequestLoading();
9618
+ return _context2.finish(9);
9619
+ case 10:
9620
+ case "end":
9621
+ return _context2.stop();
9622
+ }
9623
+ }, _callee2, null, [[1, 8, 9, 10]]);
9624
+ }));
9625
+ return function request(_x2) {
9626
+ return _ref2.apply(this, arguments);
9627
+ };
9628
+ }();
9629
+
9630
+ function getPlanbookInsuranceVerifyData(params) {
9631
+ return request({
9632
+ baseURL: APP_HOSTNAME,
9633
+ url: '/planBook/input/insurance/verifyData',
9634
+ method: 'post',
9635
+ data: params,
9636
+ headers: {
9637
+ Accept: 'application/json, text/plain, */*',
9638
+ 'Content-Type': 'application/json;'
9639
+ }
9640
+ });
9641
+ }
9642
+
9382
9643
  function _arrayLikeToArray(r, a) {
9383
9644
  (null == a || a > r.length) && (a = r.length);
9384
9645
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
@@ -9533,6 +9794,26 @@ function initInsuranceData(insData) {
9533
9794
  });
9534
9795
  });
9535
9796
  }
9797
+ if (e.componentName === 'cmCommonInput') {
9798
+ // 输入框,默认打开普通键盘。From hyw
9799
+ if (!e.inputType) {
9800
+ e.inputType = 'text';
9801
+ }
9802
+ if (['baoe', 'baof', 'payModePremium', 'num'].includes(e.key)) {
9803
+ // 输入框,默认2位小数。From hyw
9804
+ if (!e.regExp) {
9805
+ e.regExp = '/^\\d{1,9}(\\.\\d{1,2})?$/';
9806
+ e.regExpMessage = '请输入最多9位整数和最多2位小数';
9807
+ e.maxlength = 12;
9808
+ e.inputType = 'decimal';
9809
+ }
9810
+ // 输入框,整数值,使用数字键盘。From hyw
9811
+ if (e.regExp === '/^\\d{1,}$/') {
9812
+ e.maxlength = 9;
9813
+ e.inputType = 'tel';
9814
+ }
9815
+ }
9816
+ }
9536
9817
  });
9537
9818
  }
9538
9819
 
@@ -9841,6 +10122,7 @@ function initProductData(prodData) {
9841
10122
  prodData.mulInsOrderList.forEach(function (ins) {
9842
10123
  initInsuranceData(ins);
9843
10124
  });
10125
+ setCommonInfo(prodData);
9844
10126
  return prodData;
9845
10127
  }
9846
10128
 
@@ -9874,36 +10156,22 @@ function productDataHandler(_x, _x2, _x3, _x4) {
9874
10156
  */
9875
10157
  function _productDataHandler() {
9876
10158
  _productDataHandler = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(prodData, prodVerifyData, personData, parmas) {
9877
- var productVerifyData, _parmas$eventTarget, insuranceKey, elementKey, groupInsurance, groupInsuranceIdEle, subInsurances, hasProduct, hasVerifyData, hasPersonData, personOrderList, _prodData$mulInsOrder3;
10159
+ var _ref4, eventTarget, productVerifyData, insuranceKey, elementKey, groupInsurance, groupInsuranceIdEle, subInsurances, hasProduct, hasVerifyData, hasPersonData, personOrderList, _prodData$mulInsOrder3;
9878
10160
  return _regeneratorRuntime.wrap(function (_context) {
9879
10161
  while (1) switch (_context.prev = _context.next) {
9880
10162
  case 0:
9881
- if (prodData) {
9882
- _context.next = 1;
10163
+ if (!prodData) {
10164
+ _context.next = 2;
9883
10165
  break;
9884
10166
  }
9885
- return _context.abrupt("return", prodData);
10167
+ _ref4 = parmas || {}, eventTarget = _ref4.eventTarget;
10168
+ _context.next = 1;
10169
+ return getSingleInsurancesVerifyData(prodVerifyData, prodData, personData, parmas).catch(function () {});
9886
10170
  case 1:
9887
- productVerifyData = null;
9888
- if (prodData.multipleInsured) {
9889
- multipleInsuredHandler(personData);
9890
- }
9891
- if (!(prodData.feeValidateMode === 'single' || prodVerifyData && prodVerifyData.feeValidateMode === 'single')) {
9892
- _context.next = 3;
9893
- break;
9894
- }
9895
- _context.next = 2;
9896
- return getSingleInsurancesVerifyData(prodData, personData, parmas).catch(function () {});
9897
- case 2:
9898
10171
  productVerifyData = _context.sent;
9899
- _context.next = 4;
9900
- break;
9901
- case 3:
9902
- productVerifyData = prodVerifyData;
9903
- case 4:
9904
10172
  // 组合险种特殊处理:当用户点击组合险种的子险种选项时,将其他子险种的标题设置为未选中状态
9905
- if (parmas && parmas.eventTarget) {
9906
- _parmas$eventTarget = parmas.eventTarget, insuranceKey = _parmas$eventTarget.insuranceKey, elementKey = _parmas$eventTarget.elementKey;
10173
+ if (eventTarget) {
10174
+ insuranceKey = eventTarget.insuranceKey, elementKey = eventTarget.elementKey;
9907
10175
  if (insuranceKey && elementKey === 'insuranceId') {
9908
10176
  groupInsurance = (prodData.mulInsOrderList || []).find(function (ins) {
9909
10177
  return ins.key === insuranceKey;
@@ -9932,7 +10200,6 @@ function _productDataHandler() {
9932
10200
  personOrderList = convertPersonData(personData, personData.personOrderList.map(function (p) {
9933
10201
  return p.key;
9934
10202
  }));
9935
- setCommonInfo(prodData);
9936
10203
  (_prodData$mulInsOrder3 = prodData.mulInsOrderList) === null || _prodData$mulInsOrder3 === void 0 || _prodData$mulInsOrder3.forEach(function (ins, ii, insList) {
9937
10204
  var _ins$eleOrderList;
9938
10205
  insuranceDataHandler(ins, prodData);
@@ -10166,8 +10433,9 @@ function _productDataHandler() {
10166
10433
  }
10167
10434
  setGroupInsurance(prodData);
10168
10435
  isHideProduct(prodData, productVerifyData, personOrderList);
10436
+ case 2:
10169
10437
  return _context.abrupt("return", prodData);
10170
- case 5:
10438
+ case 3:
10171
10439
  case "end":
10172
10440
  return _context.stop();
10173
10441
  }
@@ -10175,32 +10443,34 @@ function _productDataHandler() {
10175
10443
  }));
10176
10444
  return _productDataHandler.apply(this, arguments);
10177
10445
  }
10178
- function multipleInsuredHandler(personData) {
10179
- var personOrderList = personData.personOrderList;
10180
- if (!(personOrderList && personOrderList.length)) {
10181
- return null;
10182
- }
10183
- var insured2Info = personOrderList.find(function (p) {
10184
- return p.key === 'insured2Info';
10185
- });
10186
- if (!insured2Info) {
10187
- var insuredInfo = personOrderList.find(function (p) {
10188
- return p.key === 'insuredInfo';
10189
- });
10190
- var insuredIndex = personOrderList.findIndex(function (p) {
10191
- return p.key === 'insuredInfo';
10446
+ function multipleInsuredHandler(prodData, personData) {
10447
+ if (prodData && prodData.multipleInsured) {
10448
+ var personOrderList = personData.personOrderList;
10449
+ if (!(personOrderList && personOrderList.length)) {
10450
+ return null;
10451
+ }
10452
+ var insured2Info = personOrderList.find(function (p) {
10453
+ return p.key === 'insured2Info';
10192
10454
  });
10193
- if (insuredIndex >= 0) {
10194
- var person = cloneDeep(insuredInfo);
10195
- person.key = 'insured2Info';
10196
- person.eleOrderList.forEach(function (e) {
10197
- if (e.key === 'title') {
10198
- e.isDisabled = false;
10199
- e.value = true;
10200
- e.label = '第二被保人信息';
10201
- }
10455
+ if (!insured2Info) {
10456
+ var insuredInfo = personOrderList.find(function (p) {
10457
+ return p.key === 'insuredInfo';
10202
10458
  });
10203
- personOrderList.splice(insuredIndex + 1, 0, person);
10459
+ var insuredIndex = personOrderList.findIndex(function (p) {
10460
+ return p.key === 'insuredInfo';
10461
+ });
10462
+ if (insuredIndex >= 0) {
10463
+ var person = cloneDeep(insuredInfo);
10464
+ person.key = 'insured2Info';
10465
+ person.eleOrderList.forEach(function (e) {
10466
+ if (e.key === 'title') {
10467
+ e.isDisabled = false;
10468
+ e.value = true;
10469
+ e.label = '第二被保人信息';
10470
+ }
10471
+ });
10472
+ personOrderList.splice(insuredIndex + 1, 0, person);
10473
+ }
10204
10474
  }
10205
10475
  }
10206
10476
  return personData;
@@ -10215,63 +10485,67 @@ function multipleInsuredHandler(personData) {
10215
10485
  * @param {IPbPersons} personData 必传。人员信息,包括被保人、投保人、投保人配偶
10216
10486
  * @returns 请求函数的 Promise
10217
10487
  */
10218
- function getSingleInsurancesVerifyData(prodData, personData) {
10219
- var _prodData$mulInsOrder, _prodData$mulInsOrder2;
10220
- var parmas = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
10221
- var personOrderList = personData.personOrderList;
10222
- if (!(personOrderList && personOrderList.length)) {
10223
- return null;
10224
- }
10225
- var pbId = prodData.isTemp || prodData.policyType === 'single_insurance' ? null : parmas.planbookId;
10226
- var productId = prodData.policyType === 'single_insurance' ? null : prodData.key;
10227
- // 险种对比,prodData 没有 feeValidateMode 字段。因此需要特殊处理。
10228
- // 险种对比,以险种为维度,其 prodData.key 就是险种id,不能当成正常产品id。因此需要特殊处理。
10229
- if (prodData.feeValidateMode !== 'single') {
10230
- productId = null;
10231
- }
10232
- var insuredList = personOrderList.filter(function (p) {
10233
- return ['insuredInfo', 'insured2Info'].includes(p.key);
10234
- }).filter(function (p) {
10235
- var _p$eleOrderList;
10236
- var title = (_p$eleOrderList = p.eleOrderList) === null || _p$eleOrderList === void 0 ? void 0 : _p$eleOrderList.find(function (e) {
10237
- return e.key === 'title';
10488
+ function getSingleInsurancesVerifyData(verifyData, prodData, personData) {
10489
+ var parmas = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
10490
+ var isSingleFeeValidateMode = prodData && prodData.feeValidateMode === 'single' || verifyData && verifyData.feeValidateMode === 'single';
10491
+ if (isSingleFeeValidateMode) {
10492
+ var _prodData$mulInsOrder, _prodData$mulInsOrder2;
10493
+ var personOrderList = personData.personOrderList;
10494
+ if (!(personOrderList && personOrderList.length)) {
10495
+ return null;
10496
+ }
10497
+ var pbId = prodData.isTemp || prodData.policyType === 'single_insurance' ? null : parmas.planbookId;
10498
+ var productId = prodData.policyType === 'single_insurance' ? null : prodData.key;
10499
+ // 险种对比,prodData 没有 feeValidateMode 字段。因此需要特殊处理。
10500
+ // 险种对比,以险种为维度,其 prodData.key 就是险种id,不能当成正常产品id。因此需要特殊处理。
10501
+ if (prodData.feeValidateMode !== 'single') {
10502
+ productId = null;
10503
+ }
10504
+ var insuredList = personOrderList.filter(function (p) {
10505
+ return ['insuredInfo', 'insured2Info'].includes(p.key);
10506
+ }).filter(function (p) {
10507
+ var _p$eleOrderList;
10508
+ var title = (_p$eleOrderList = p.eleOrderList) === null || _p$eleOrderList === void 0 ? void 0 : _p$eleOrderList.find(function (e) {
10509
+ return e.key === 'title';
10510
+ });
10511
+ return title && title.value || p.title;
10512
+ }).map(function (p) {
10513
+ var person = convertEleOrderListToObj(p);
10514
+ return {
10515
+ key: person.key,
10516
+ sex: person.sex,
10517
+ age: person.age
10518
+ };
10519
+ });
10520
+ var applicant = null;
10521
+ var applicantItem = personData.personOrderList.find(function (p) {
10522
+ return p.key === 'applicantInfo';
10523
+ });
10524
+ if (applicantItem) {
10525
+ var person = convertEleOrderListToObj(applicantItem);
10526
+ applicant = {
10527
+ key: person.key,
10528
+ sex: person.sex,
10529
+ age: person.age
10530
+ };
10531
+ }
10532
+ var insuranceIdList = prodData === null || prodData === void 0 || (_prodData$mulInsOrder = prodData.mulInsOrderList) === null || _prodData$mulInsOrder === void 0 ? void 0 : _prodData$mulInsOrder.map(function (ins) {
10533
+ return ins.key;
10534
+ }).filter(function (k) {
10535
+ return !['common'].includes(k);
10536
+ });
10537
+ prodData === null || prodData === void 0 || (_prodData$mulInsOrder2 = prodData.mulInsOrderList) === null || _prodData$mulInsOrder2 === void 0 || _prodData$mulInsOrder2.reduce(function (list, ins) {
10538
+ return ins.key === 'common' || ins.isGroup ? list : list.concat(ins.key);
10539
+ }, []);
10540
+ return getAndCacheInsurancesVerifyData({
10541
+ pbId: pbId,
10542
+ productId: productId,
10543
+ insuredList: insuredList,
10544
+ applicant: applicant,
10545
+ insuranceIdList: insuranceIdList
10238
10546
  });
10239
- return title && title.value || p.title;
10240
- }).map(function (p) {
10241
- var person = convertEleOrderListToObj(p);
10242
- return {
10243
- key: person.key,
10244
- sex: person.sex,
10245
- age: person.age
10246
- };
10247
- });
10248
- var applicant = null;
10249
- var applicantItem = personData.personOrderList.find(function (p) {
10250
- return p.key === 'applicantInfo';
10251
- });
10252
- if (applicantItem) {
10253
- var person = convertEleOrderListToObj(applicantItem);
10254
- applicant = {
10255
- key: person.key,
10256
- sex: person.sex,
10257
- age: person.age
10258
- };
10259
10547
  }
10260
- var insuranceIdList = prodData === null || prodData === void 0 || (_prodData$mulInsOrder = prodData.mulInsOrderList) === null || _prodData$mulInsOrder === void 0 ? void 0 : _prodData$mulInsOrder.map(function (ins) {
10261
- return ins.key;
10262
- }).filter(function (k) {
10263
- return !['common'].includes(k);
10264
- });
10265
- prodData === null || prodData === void 0 || (_prodData$mulInsOrder2 = prodData.mulInsOrderList) === null || _prodData$mulInsOrder2 === void 0 || _prodData$mulInsOrder2.reduce(function (list, ins) {
10266
- return ins.key === 'common' || ins.isGroup ? list : list.concat(ins.key);
10267
- }, []);
10268
- return getAndCacheInsurancesVerifyData({
10269
- pbId: pbId,
10270
- productId: productId,
10271
- insuredList: insuredList,
10272
- applicant: applicant,
10273
- insuranceIdList: insuranceIdList
10274
- });
10548
+ return Promise.resolve(verifyData);
10275
10549
  }
10276
10550
 
10277
10551
  /**
@@ -10283,25 +10557,7 @@ function getSingleInsurancesVerifyData(prodData, personData) {
10283
10557
  * @returns {Promise<any>} 产品下所有险种的费率
10284
10558
  */
10285
10559
  var getAndCacheInsurancesVerifyData = memoize(function (params) {
10286
- var url = "".concat(APP_HOSTNAME, "/planBook/input/insurance/verifyData");
10287
- return fetch(url, {
10288
- method: 'POST',
10289
- credentials: 'include',
10290
- headers: {
10291
- Accept: 'application/json, text/plain, */*',
10292
- 'Content-Type': 'application/json;'
10293
- },
10294
- body: JSON.stringify(params)
10295
- }).then(function (response) {
10296
- return response.json();
10297
- }).then(function (_ref) {
10298
- var success = _ref.success,
10299
- data = _ref.data;
10300
- if (!success || !data) {
10301
- return Promise.reject();
10302
- }
10303
- return Promise.resolve(data);
10304
- }).catch(function () {});
10560
+ return getPlanbookInsuranceVerifyData(params).catch(function () {});
10305
10561
  }, function (params) {
10306
10562
  return QS.stringify(params);
10307
10563
  });
@@ -10506,7 +10762,7 @@ function setGroupInsurance(prodData) {
10506
10762
  }
10507
10763
  }
10508
10764
  }
10509
- var index = mulInsOrderList.findLastIndex(function (ins) {
10765
+ var index = findLastIndex(mulInsOrderList, function (ins) {
10510
10766
  return ins.groupKey === k;
10511
10767
  });
10512
10768
  if (index >= 0) {
@@ -10528,21 +10784,21 @@ function setGroupInsurance(prodData) {
10528
10784
  * @author Lizhao <lz@winbaoxian.com>
10529
10785
  * @date 2022-04-26
10530
10786
  * @param {IPbProduct} prodData 必传。产品数据(单个)
10531
- * @param {object} productVerifyData 必传。产品限制条件(单个)
10787
+ * @param {object} prodVerifyData 必传。产品限制条件(单个)
10532
10788
  * @param {IPbPerson} personOrderList 必传。转换后的人员信息,包括被保人、投保人、投保人配偶
10533
10789
  * @returns {object} 产品数据(单个)
10534
10790
  */
10535
- function isHideProduct(prodData, productVerifyData, personOrderList) {
10791
+ function isHideProduct(prodData, prodVerifyData, personOrderList) {
10536
10792
  var ageRangeProd = {};
10537
- if (prodData && productVerifyData && Object.keys(productVerifyData).length && personOrderList) {
10793
+ if (prodData && prodVerifyData && Object.keys(prodVerifyData).length && personOrderList) {
10538
10794
  if (prodData.mulInsOrderList) {
10539
10795
  // 产品中是否有必选险种且有费率
10540
10796
  var hasRequiredIns = prodData.mulInsOrderList.some(function (ins) {
10541
- return !!ins.required && productVerifyData[ins.key];
10797
+ return !!ins.required && prodVerifyData[ins.key];
10542
10798
  });
10543
10799
  prodData.mulInsOrderList.forEach(function (ins) {
10544
10800
  // 当前险种的限制条件
10545
- var insuranceVerifyData = productVerifyData[ins.key];
10801
+ var insuranceVerifyData = prodVerifyData[ins.key];
10546
10802
  if (insuranceVerifyData) {
10547
10803
  // 产品年龄范围取各险种最大范围
10548
10804
  if ((!ins.huomian || ins.huomian == 'beiHuomian') && (!hasRequiredIns || hasRequiredIns && ins.required)) {
@@ -10554,11 +10810,11 @@ function isHideProduct(prodData, productVerifyData, personOrderList) {
10554
10810
  }
10555
10811
  });
10556
10812
  }
10557
- var _ref2 = personOrderList.find(function (p) {
10813
+ var _ref = personOrderList.find(function (p) {
10558
10814
  return p.key === 'insuredInfo';
10559
10815
  }),
10560
- sex = _ref2.sex,
10561
- age = _ref2.age;
10816
+ sex = _ref.sex,
10817
+ age = _ref.age;
10562
10818
  if (ageRangeProd[sex] && age >= ageRangeProd[sex][0] && age <= ageRangeProd[sex][1]) {
10563
10819
  prodData.hide = false;
10564
10820
  } else {
@@ -10584,11 +10840,11 @@ function isHideProduct(prodData, productVerifyData, personOrderList) {
10584
10840
  * @param {IInsElement} params.eleData 可不传。元素数据,当前交互的元素(如:用户修改了该险种的交费期间)
10585
10841
  * @returns {string} 校验结果。空表示校验通过
10586
10842
  */
10587
- function verifyProductRules(_ref3) {
10588
- var personData = _ref3.personData,
10589
- productData = _ref3.productData,
10590
- insData = _ref3.insData,
10591
- eleData = _ref3.eleData;
10843
+ function verifyProductRules(_ref2) {
10844
+ var personData = _ref2.personData,
10845
+ productData = _ref2.productData,
10846
+ insData = _ref2.insData,
10847
+ eleData = _ref2.eleData;
10592
10848
  var errorMsg = '';
10593
10849
  var personOrderList = convertPersonData(personData, personData.personOrderList.map(function (p) {
10594
10850
  return p.key;
@@ -10634,11 +10890,11 @@ function verifyProductRules(_ref3) {
10634
10890
  * @param {eleData} params.eleData 可不传。元素数据,当前交互的元素(如:用户修改了该险种的交费期间)
10635
10891
  * @returns {string} 校验结果。空表示校验通过
10636
10892
  */
10637
- function restrictInsurancesInProduct(_ref4) {
10638
- var personOrderList = _ref4.personOrderList,
10639
- productData = _ref4.productData,
10640
- insData = _ref4.insData,
10641
- eleData = _ref4.eleData;
10893
+ function restrictInsurancesInProduct(_ref3) {
10894
+ var personOrderList = _ref3.personOrderList,
10895
+ productData = _ref3.productData,
10896
+ insData = _ref3.insData,
10897
+ eleData = _ref3.eleData;
10642
10898
  var errorMsg = '';
10643
10899
  var restrictList = productData.restrictList;
10644
10900
  if (restrictList && restrictList.length) {
@@ -10647,16 +10903,16 @@ function restrictInsurancesInProduct(_ref4) {
10647
10903
  return p.key === 'insuredInfo';
10648
10904
  });
10649
10905
  var productInfo = convertProductData(productData);
10650
- var prodVerifyData = {
10906
+ var evalVerifyMap = {
10651
10907
  age: insuredInfo.age,
10652
10908
  sex: insuredInfo.sex,
10653
10909
  common: productInfo.common
10654
10910
  };
10655
10911
  productInfo.mulInsOrderList.forEach(function (ins) {
10656
- prodVerifyData['i' + ins.key] = ins;
10912
+ evalVerifyMap['i' + ins.key] = ins;
10657
10913
  });
10658
- restrict.rCondition = restrict.rCondition.replace(/(%)(\d+)(\.*\w*)(%)/g, 'prodVerifyData.i$2$3');
10659
- restrict.rCondition = restrict.rCondition.replace(/(%)(\w*\.*\w*)(%)/g, 'prodVerifyData.$2');
10914
+ restrict.rCondition = restrict.rCondition.replace(/(%)(\d+)(\.*\w*)(%)/g, 'evalVerifyMap.i$2$3');
10915
+ restrict.rCondition = restrict.rCondition.replace(/(%)(\w*\.*\w*)(%)/g, 'evalVerifyMap.$2');
10660
10916
  var curIns = productData.mulInsOrderList.find(function (ins) {
10661
10917
  return ins.key === restrict.rInsKey;
10662
10918
  });
@@ -10706,8 +10962,8 @@ function restrictInsurancesInProduct(_ref4) {
10706
10962
  var rangeSelect = eval(restrict.rCondition);
10707
10963
  if (rangeSelect !== undefined && rangeSelect !== null) {
10708
10964
  curEle.opts.forEach(function (opt) {
10709
- var optNum = getNumberFromYear(opt.val, prodVerifyData.age);
10710
- var rangeSelectNum = rangeSelect.constructor === Array ? [rangeSelect[0] && getNumberFromYear(rangeSelect[0], prodVerifyData.age), rangeSelect[1] && getNumberFromYear(rangeSelect[1], prodVerifyData.age)] : getNumberFromYear(rangeSelect, prodVerifyData.age);
10965
+ var optNum = getNumberFromYear(opt.val, evalVerifyMap.age);
10966
+ var rangeSelectNum = rangeSelect.constructor === Array ? [rangeSelect[0] && getNumberFromYear(rangeSelect[0], evalVerifyMap.age), rangeSelect[1] && getNumberFromYear(rangeSelect[1], evalVerifyMap.age)] : getNumberFromYear(rangeSelect, evalVerifyMap.age);
10711
10967
  if (rangeSelect) {
10712
10968
  if (rangeSelect.constructor === Array) {
10713
10969
  opt.isHide = rangeSelect[0] && optNum < rangeSelectNum[0] || rangeSelect[1] && optNum > rangeSelectNum[1];
@@ -10734,7 +10990,7 @@ function restrictInsurancesInProduct(_ref4) {
10734
10990
  case 3:
10735
10991
  {
10736
10992
  // 全局校验、或者点击的是约束元素、或者点击的是目标元素时,触发校验
10737
- if (!insData && !eleData || restrict.rInsKey === insData.key && restrict.rEleKey === eleData.key || restrict.rCondition.search("prodVerifyData.i".concat(insData.key, ".").concat(eleData.key)) !== -1) {
10993
+ if (!insData && !eleData || restrict.rInsKey === insData.key && restrict.rEleKey === eleData.key || restrict.rCondition.search("evalVerifyMap.i".concat(insData.key, ".").concat(eleData.key)) !== -1) {
10738
10994
  var rangeVal = eval(restrict.rCondition);
10739
10995
  if (rangeVal !== undefined && rangeVal !== null) {
10740
10996
  if (rangeVal.constructor === Array) {
@@ -10803,7 +11059,7 @@ function convertProductData(prodData) {
10803
11059
  checkedInsData[ele.key] = insuranceData[ele.key];
10804
11060
  }
10805
11061
  });
10806
- productData.mulInsOrderList.push(deepCopy(checkedInsData));
11062
+ productData.mulInsOrderList.push(cloneDeep(checkedInsData));
10807
11063
  }
10808
11064
  });
10809
11065
  return;
@@ -10822,32 +11078,28 @@ function convertProductData(prodData) {
10822
11078
  * @returns {IPbProduct} 产品数据
10823
11079
  */
10824
11080
  function clearAddAndTakeAndAdjustBaoeData(productData) {
10825
- if (!productData) {
10826
- return productData;
10827
- }
10828
- if (!productData.mulInsOrderList) {
10829
- return productData;
10830
- }
10831
- productData.adjustBaoeData = null;
10832
- productData.mulInsOrderList.forEach(function (ins) {
10833
- if (ins.accountData && ins.accountData.addAndTakeData) {
10834
- ins.accountData.addAndTakeData.forEach(function (aat) {
10835
- aat.adjustData = [];
10836
- });
10837
- }
10838
- if (ins.reduceBaof) {
10839
- if (ins.reduceBaofData) {
10840
- ins.reduceBaofData.addAndTakeData.forEach(function (aat) {
11081
+ if (productData && Array.isArray(productData.mulInsOrderList)) {
11082
+ productData.adjustBaoeData = null;
11083
+ productData.mulInsOrderList.forEach(function (ins) {
11084
+ if (ins.accountData && ins.accountData.addAndTakeData) {
11085
+ ins.accountData.addAndTakeData.forEach(function (aat) {
10841
11086
  aat.adjustData = [];
10842
11087
  });
10843
11088
  }
10844
- if (ins.duplicateReduceBaofData) {
10845
- ins.duplicateReduceBaofData.addAndTakeData.forEach(function (aat) {
10846
- aat.adjustData = [];
10847
- });
11089
+ if (ins.reduceBaof) {
11090
+ if (ins.reduceBaofData) {
11091
+ ins.reduceBaofData.addAndTakeData.forEach(function (aat) {
11092
+ aat.adjustData = [];
11093
+ });
11094
+ }
11095
+ if (ins.duplicateReduceBaofData) {
11096
+ ins.duplicateReduceBaofData.addAndTakeData.forEach(function (aat) {
11097
+ aat.adjustData = [];
11098
+ });
11099
+ }
10848
11100
  }
10849
- }
10850
- });
11101
+ });
11102
+ }
10851
11103
  return productData;
10852
11104
  }
10853
11105
 
@@ -10860,7 +11112,6 @@ const planbook = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
10860
11112
  convertEleOrderListToObj,
10861
11113
  convertPersonData,
10862
11114
  convertProductData,
10863
- deepCopy,
10864
11115
  enableLizhaoDebug,
10865
11116
  executeElementRule,
10866
11117
  formatNumberToThousand,
@@ -10876,6 +11127,7 @@ const planbook = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
10876
11127
  initProductData,
10877
11128
  insuranceDataHandler,
10878
11129
  isHideProduct,
11130
+ multipleInsuredHandler,
10879
11131
  personDataHandler,
10880
11132
  productDataHandler,
10881
11133
  restrictElementsInInsurance,
@@ -10887,125 +11139,30 @@ const planbook = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
10887
11139
  verifyProductRules
10888
11140
  }, Symbol.toStringTag, { value: 'Module' }));
10889
11141
 
10890
- function showLoading() {
10891
- if (IS_CPPOC_HOST) {
10892
- _Toast.loading({
10893
- message: '加载中...',
10894
- forbidClick: true
10895
- });
10896
- } else if (window.appBridge && window.appBridge.showLoading) {
10897
- window.appBridge.showLoading();
10898
- }
10899
- }
10900
- function hideLoading() {
10901
- if (IS_CPPOC_HOST) {
10902
- _Toast.clear();
10903
- } else if (window.appBridge && window.appBridge.hideLoading) {
10904
- window.appBridge.hideLoading();
10905
- }
10906
- }
10907
-
10908
- // 创建axios实例
10909
- var service = axios.create({
10910
- baseURL: APP_HOSTNAME,
10911
- withCredentials: true,
10912
- timeout: 10000,
10913
- // 请求超时时间
10914
- headers: {
10915
- 'X-Requested-With': 'XMLHttpRequest'
10916
- }
10917
- });
10918
- var loadingTimer = null;
10919
- var loading = function loading(show) {
10920
- if (show) {
10921
- showLoading();
10922
- } else {
10923
- hideLoading();
10924
- }
10925
- };
10926
-
10927
- // request拦截器
10928
- service.interceptors.request.use(function (config) {
10929
- if (loadingTimer) clearTimeout(loadingTimer);
10930
- loadingTimer = setTimeout(function () {
10931
- loading(true);
10932
- }, 300);
10933
- return config;
10934
- }, function (error) {
10935
- // Do something with request error
10936
- console.log(error); // for debug
10937
- Promise.reject(error);
10938
- });
10939
-
10940
- // respone拦截器
10941
- service.interceptors.response.use(function (response) {
10942
- if (loadingTimer) clearTimeout(loadingTimer);
10943
- loading(false);
10944
- var res = response.data;
10945
- if (res.code === 401 || res.status === 401) {
10946
- // gotoLogin()
10947
- return Promise.reject('login');
10948
- }
10949
- return res;
10950
- }, function (error) {
10951
- if (loadingTimer) clearTimeout(loadingTimer);
10952
- loading(false);
10953
- if (error.response && error.response.status == 401) {
10954
- // gotoLogin()
10955
- return Promise.reject('login');
10956
- }
10957
- console.log('err' + error); // for debug
10958
- return Promise.reject(error);
10959
- });
10960
-
10961
- var baseURL = "https://insurance2a-api.wyins.net".concat(IS_PRODUCT_ENV ? '' : '.cn');
10962
-
10963
11142
  /**
10964
- * **获取地址信息**
10965
- * @ignore
10966
- * @author watson
10967
- * @date 2022-04-26
10968
- * @param {string} fetchUrl api url
10969
- * @param {object} data 接口传参
10970
- * @returns {object} addressData
11143
+ * 险种保费试算 `/api/product/data/calculate`
10971
11144
  */
10972
- function getAddress(fetchUrl, data) {
10973
- return new Promise(function (resolve, reject) {
10974
- service({
10975
- baseURL: fetchUrl,
10976
- url: undefined,
10977
- method: 'POST',
10978
- urlParams: undefined,
10979
- data: data
10980
- }).then(function (res) {
10981
- resolve(res);
10982
- }).catch(function (err) {
10983
- reject(err);
10984
- });
10985
- });
10986
- }
10987
-
10988
- /**
10989
- * **获取用户信息**
10990
- * @ignore
10991
- * @author watson
10992
- * @date 2022-04-26
10993
- * @param {string} fetchUrl api url
10994
- * @returns {promise}
10995
- */
10996
- function getUuid(fetchUrl) {
10997
- return new Promise(function (resolve, reject) {
10998
- service({
10999
- baseURL: fetchUrl,
11000
- url: undefined,
11001
- method: 'GET',
11002
- urlParams: undefined,
11003
- data: null
11004
- }).then(function (res) {
11005
- resolve(res);
11006
- }).catch(function (err) {
11007
- reject(err);
11008
- });
11145
+ function postProductDataCalculate(urlParams, postParams) {
11146
+ var path = '/api/product/data/calculate';
11147
+ if (urlParams && urlParams.uuid) {
11148
+ path += "?userUuid=".concat(encodeURIComponent(urlParams.uuid));
11149
+ } else if (urlParams && urlParams.openId) {
11150
+ path += "?userUuid=".concat(encodeURIComponent(urlParams.openId));
11151
+ }
11152
+ if (urlParams && urlParams.appid) {
11153
+ path += path.includes('?') ? "&appId=".concat(encodeURIComponent(urlParams.appid)) : "?appId=".concat(encodeURIComponent(urlParams.appid));
11154
+ }
11155
+ return request({
11156
+ baseURL: INSURANCE2A_API_HOSTNAME,
11157
+ url: path,
11158
+ method: 'post',
11159
+ data: postParams,
11160
+ headers: {
11161
+ Accept: 'application/json, text/plain, */*',
11162
+ 'Content-Type': 'application/json'
11163
+ },
11164
+ isIgnoreLoading: false,
11165
+ returnFullResponse: true
11009
11166
  });
11010
11167
  }
11011
11168
 
@@ -11226,55 +11383,31 @@ function insureCalculate(urlParams, postParams, planParams) {
11226
11383
  if (postParams && !postParams.scenario) {
11227
11384
  postParams.scenario = 'h5Widget';
11228
11385
  }
11229
- var url = '/api/product/data/calculate';
11230
- if (urlParams && urlParams.uuid) {
11231
- url += "?userUuid=".concat(urlParams.uuid);
11232
- } else if (urlParams && urlParams.openId) {
11233
- url += "?userUuid=".concat(urlParams.openId);
11234
- }
11235
- if (urlParams && urlParams.appid) {
11236
- if (url.indexOf('?') > -1) {
11237
- url += "&appId=".concat(urlParams.appid);
11238
- } else {
11239
- url += "?appId=".concat(urlParams.appid);
11240
- }
11241
- }
11242
11386
  if (hasPlanParams(planParams) && postParams.current_data) {
11243
11387
  postParams.current_data = tranlateCurrentData(postParams.current_data, planParams);
11244
11388
  }
11245
- return new Promise(function (resolve, reject) {
11246
- service({
11247
- baseURL: baseURL,
11248
- url: url,
11249
- method: 'POST',
11250
- urlParams: urlParams,
11251
- data: postParams
11252
- }).then(function (res) {
11253
- if (res.code === 200) {
11254
- var data = JSON.parse(JSON.stringify(res.data));
11255
- if (hasPlanParams(planParams)) {
11256
- var widgets = data.widgets;
11257
- var currentData = data.current_data;
11258
- translatePlanData(widgets, currentData, planParams);
11259
- }
11260
- var cData = {
11261
- widgets: data.widgets,
11262
- total_premium: data.total_premium,
11263
- terms: data.terms,
11264
- product_id: data.product_id,
11265
- current_data: data.current_data,
11266
- risk_premiums: data.risk_premiums
11267
- };
11268
- resolve({
11269
- code: 200,
11270
- data: cData
11271
- });
11272
- } else {
11273
- reject(res);
11389
+ return postProductDataCalculate(urlParams, postParams).then(function (res) {
11390
+ if (res.code === 200) {
11391
+ var data = JSON.parse(JSON.stringify(res.data));
11392
+ if (hasPlanParams(planParams)) {
11393
+ var widgets = data.widgets;
11394
+ var currentData = data.current_data;
11395
+ translatePlanData(widgets, currentData, planParams);
11274
11396
  }
11275
- }).catch(function (err) {
11276
- reject(err);
11277
- });
11397
+ var cData = {
11398
+ widgets: data.widgets,
11399
+ total_premium: data.total_premium,
11400
+ terms: data.terms,
11401
+ product_id: data.product_id,
11402
+ current_data: data.current_data,
11403
+ risk_premiums: data.risk_premiums
11404
+ };
11405
+ return {
11406
+ code: 200,
11407
+ data: cData
11408
+ };
11409
+ }
11410
+ return Promise.reject(res);
11278
11411
  });
11279
11412
  }
11280
11413
 
@@ -11355,47 +11488,17 @@ function checkInsureCalculateIn(urlParams, postParams, planParams) {
11355
11488
  if (postParams && !postParams.scenario) {
11356
11489
  postParams.scenario = 'h5Widget';
11357
11490
  }
11358
- var url = '/api/product/data/calculate';
11359
- if (urlParams && urlParams.uuid) {
11360
- url += "?userUuid=".concat(urlParams.uuid);
11361
- } else if (urlParams && urlParams.openId) {
11362
- url += "?userUuid=".concat(urlParams.openId);
11363
- }
11364
- if (urlParams && urlParams.appid) {
11365
- if (url.indexOf('?') > -1) {
11366
- url += "&appId=".concat(urlParams.appid);
11367
- } else {
11368
- url += "?appId=".concat(urlParams.appid);
11369
- }
11370
- }
11371
11491
  if (hasPlanParams(planParams) && postParams.current_data) {
11372
11492
  postParams.current_data = tranlateCurrentData(postParams.current_data, planParams);
11373
11493
  }
11374
- return new Promise(function (resolve, reject) {
11375
- service({
11376
- baseURL: baseURL,
11377
- url: url,
11378
- method: 'POST',
11379
- urlParams: urlParams,
11380
- data: postParams
11381
- }).then(function (res) {
11382
- if (res.code === 200) {
11383
- // if (postParams && !postParams.current_data) {
11384
- // let data = JSON.parse(JSON.stringify(res.data));
11385
- // postParams.current_data = data.current_data
11386
- // // 重新试算
11387
- // checkInsureCalculate(urlParams, postParams, planParams)
11388
- // }
11389
- resolve({
11390
- code: 200,
11391
- data: res.data
11392
- });
11393
- } else {
11394
- reject(res);
11395
- }
11396
- }).catch(function (err) {
11397
- reject(err);
11398
- });
11494
+ return postProductDataCalculate(urlParams, postParams).then(function (res) {
11495
+ if (res.code === 200) {
11496
+ return {
11497
+ code: 200,
11498
+ data: res.data
11499
+ };
11500
+ }
11501
+ return Promise.reject(res);
11399
11502
  });
11400
11503
  }
11401
11504
 
@@ -11403,8 +11506,6 @@ const trade = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
11403
11506
  __proto__: null,
11404
11507
  checkInsureCalculate,
11405
11508
  checkInsureCalculateIn,
11406
- getAddress,
11407
- getUuid,
11408
11509
  hasPlanParams,
11409
11510
  insureCalculate
11410
11511
  }, Symbol.toStringTag, { value: 'Module' }));
@@ -11414,4 +11515,4 @@ const index = {
11414
11515
  trade: trade
11415
11516
  };
11416
11517
 
11417
- export { calcTotalBaof, checkInsureCalculate, checkInsureCalculateIn, clearAddAndTakeAndAdjustBaoeData, consoleLogWhenEnable, converUnit10000, convertEleOrderListToObj, convertPersonData, convertProductData, deepCopy, index as default, enableLizhaoDebug, executeElementRule, formatNumberToThousand, getAddress, getAgeFromBirth, getElementVerifyFromProductVerify, getExpressionParamMap, getHuomianPeriodValue, getInsuredAgeRange, getNumberFromYear, getUuid, hasPlanParams, initElementValidateRules, initInsuranceData, initPersonData, initProductData, insuranceDataHandler, insureCalculate, isHideProduct, personDataHandler, productDataHandler, restrictElementsInInsurance, restrictInsurancesInProduct, setCommonInfo, setGroupInsurance, setPersonAgeOptions, textOverflowEllipsis, verifyProductRules };
11518
+ export { calcTotalBaof, checkInsureCalculate, checkInsureCalculateIn, clearAddAndTakeAndAdjustBaoeData, consoleLogWhenEnable, converUnit10000, convertEleOrderListToObj, convertPersonData, convertProductData, index as default, enableLizhaoDebug, executeElementRule, formatNumberToThousand, getAgeFromBirth, getElementVerifyFromProductVerify, getExpressionParamMap, getHuomianPeriodValue, getInsuredAgeRange, getNumberFromYear, hasPlanParams, initElementValidateRules, initInsuranceData, initPersonData, initProductData, insuranceDataHandler, insureCalculate, isHideProduct, multipleInsuredHandler, personDataHandler, productDataHandler, restrictElementsInInsurance, restrictInsurancesInProduct, setCommonInfo, setGroupInsurance, setPersonAgeOptions, textOverflowEllipsis, verifyProductRules };