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
@@ -1,18 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('qs'), require('lodash'), require('axios'), require('vant/lib/toast/index.css'), require('vant/lib/toast')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'qs', 'lodash', 'axios', 'vant/lib/toast/index.css', 'vant/lib/toast'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BXT = {}, global.QS, global._, global.axios, null, global._Toast));
5
- })(this, (function (exports, QS, lodash, axios, index_css, _Toast) { 'use strict';
6
-
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
- }
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('qs'), require('lodash'), require('vant/lib/dialog/index.css'), require('vant/lib/dialog'), require('vant/lib/toast/index.css'), require('vant/lib/toast')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'qs', 'lodash', 'vant/lib/dialog/index.css', 'vant/lib/dialog', 'vant/lib/toast/index.css', 'vant/lib/toast'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BXT = {}, global.QS, global._, null, global._Dialog, null, global._Toast));
5
+ })(this, (function (exports, QS, lodash, index_css, _Dialog, index_css$1, _Toast) { 'use strict';
16
6
 
17
7
  var enableLizhaoDebug = document && document.cookie && document.cookie.match('ENABLE_LIZHAO_DEBUG=1');
18
8
  function consoleLogWhenEnable() {
@@ -182,45 +172,6 @@
182
172
  return value >= 10000 && !(value % 10000) ? "".concat(value / 10000, "\u4E07") : value;
183
173
  }
184
174
 
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
175
  /**
225
176
  * **根据生日算年龄**
226
177
  * @author Lizhao <lz@winbaoxian.com>
@@ -306,6 +257,9 @@
306
257
  }
307
258
  function getExpressionParamMap(personData, product, ins, options) {
308
259
  var map = {
260
+ user: {},
261
+ executeSource: null,
262
+ // 执行:init-初始化 import-导入数据 userAction-用户操作 confirm-确认
309
263
  planbookId: null,
310
264
  // 计划书id
311
265
  productId: null,
@@ -379,12 +333,18 @@
379
333
  }
380
334
  }
381
335
  if (options) {
336
+ if (options.user) {
337
+ map.user = options.user;
338
+ }
382
339
  if (options.planbookId) {
383
340
  map.planbookId = options.planbookId;
384
341
  }
385
342
  if (options.eventTarget) {
386
343
  map.t = options.eventTarget;
387
344
  }
345
+ if (options.executeSource) {
346
+ map.executeSource = options.executeSource;
347
+ }
388
348
  }
389
349
  if (ins && ins.customVariableExp) {
390
350
  var exp = ins.customVariableExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'map.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'map.$2');
@@ -510,6 +470,15 @@
510
470
  if (!person || !person.eleOrderList) {
511
471
  return;
512
472
  }
473
+
474
+ // 投保人年龄默认范围调整到「16-99岁」。From hyw
475
+ if (person.key === 'applicantInfo') {
476
+ person.eleOrderList.forEach(function (ele) {
477
+ if (ele.key === 'age') {
478
+ ele.opts = [16, 99];
479
+ }
480
+ });
481
+ }
513
482
  person.createArchive = person.createArchive || false;
514
483
  person.cid = person.cid || null;
515
484
  if (!person.eleOrderList.find(function (e) {
@@ -522,7 +491,7 @@
522
491
  placeholder: '请输入姓名',
523
492
  componentName: 'cmCommonInput',
524
493
  maxlength: 16,
525
- isHide: false
494
+ isHide: true
526
495
  });
527
496
  }
528
497
  // 投保人添加元素:投被保人是同一人
@@ -635,7 +604,7 @@
635
604
  }
636
605
  case 'age':
637
606
  {
638
- e.label = '年龄';
607
+ e.label = '投保时年龄';
639
608
  e.componentName = 'cmAgeBirthday';
640
609
  e.placeholder = '请选择年龄';
641
610
  e.options = [];
@@ -895,6 +864,16 @@
895
864
  }
896
865
  }
897
866
 
867
+ function _typeof$1(o) {
868
+ "@babel/helpers - typeof";
869
+
870
+ return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
871
+ return typeof o;
872
+ } : function (o) {
873
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
874
+ }, _typeof$1(o);
875
+ }
876
+
898
877
  function toPrimitive(t, r) {
899
878
  if ("object" != _typeof$1(t) || !t) return t;
900
879
  var e = t[Symbol.toPrimitive];
@@ -9344,12 +9323,27 @@
9344
9323
  var Jax = /*@__PURE__*/getDefaultExportFromCjs(jaxExports);
9345
9324
 
9346
9325
  var getStandardOrigin = Jax.urlUtil.getStandardOrigin;
9326
+ var _Jax$parseUaString = Jax.parseUaString();
9327
+ _Jax$parseUaString.isApp;
9328
+ _Jax$parseUaString.appType;
9329
+ _Jax$parseUaString.appVersion;
9330
+ _Jax$parseUaString.isAndroid;
9331
+ _Jax$parseUaString.isIos;
9332
+ _Jax$parseUaString.isBxsApp;
9333
+ _Jax$parseUaString.isBaoXiaoZhuApp;
9334
+ _Jax$parseUaString.isBrokerApp;
9335
+ _Jax$parseUaString.isYjjApp;
9336
+ _Jax$parseUaString.isToBApp;
9337
+ _Jax$parseUaString.isRongYiBaoApp;
9338
+ _Jax$parseUaString.isWeChat;
9339
+ _Jax$parseUaString.appScheme;
9347
9340
  var hostname = window && window.location && window.location.hostname || '';
9348
9341
  /** 当前页 host 为 cppoc- 前缀时,请求 loading 使用 Vant Toast,否则走 appBridge */
9349
9342
  var IS_CPPOC_HOST = hostname.startsWith('cppoc-');
9350
9343
  var IS_PRODUCT_ENV = hostname.search(/(winbaoxian|ai-baoxiaozhu)\.com/) !== -1;
9351
9344
  hostname.search(/(winbaoxian|ai-baoxiaozhu)\.cn/) !== -1;
9352
9345
  hostname.search(/localhost|192\.168|127\.0\.0\.1|dev\.winbaoxian\.cn/) !== -1;
9346
+ var IS_LOCALHOST_IP_ENV = hostname.search(/192\.168/) !== -1;
9353
9347
  var IS_UAT_ENV = hostname.includes("pbf-uat.");
9354
9348
  var IS_ENABLE_DEBUG = !IS_PRODUCT_ENV;
9355
9349
  if (IS_ENABLE_DEBUG) {
@@ -9357,6 +9351,9 @@
9357
9351
  }
9358
9352
  hostname.includes('ai-baoxiaozhu') ? 'ai-baoxiaozhu' : 'winbaoxian';
9359
9353
  function getFullOrigin(data) {
9354
+ if (IS_LOCALHOST_IP_ENV) {
9355
+ return "https://".concat(data, ".winbaoxian.cn");
9356
+ }
9360
9357
  var _prefixDomain = IS_CPPOC_HOST ? 'cppoc-' : '';
9361
9358
  if (typeof data === 'string') {
9362
9359
  return getStandardOrigin("".concat(_prefixDomain).concat(data));
@@ -9371,7 +9368,9 @@
9371
9368
  }
9372
9369
  var APP_HOSTNAME = getFullOrigin('app');
9373
9370
  getFullOrigin('pbf');
9374
- getFullOrigin("bxs-planbook-api".concat(IS_UAT_ENV ? '-uat' : ''));
9371
+ var PLANBOOK_API_HOSTNAME = getFullOrigin("bxs-planbook-api".concat(IS_UAT_ENV ? '-uat' : ''));
9372
+ /** 险种试算等 trade 接口(insurance2a-api) */
9373
+ var INSURANCE2A_API_HOSTNAME = "https://insurance2a-api.wyins.net".concat(IS_PRODUCT_ENV ? '' : '.cn');
9375
9374
  getUrlParams();
9376
9375
  function getUrlParams(url) {
9377
9376
  var _url = location.search || '';
@@ -9379,6 +9378,267 @@
9379
9378
  return _searchStr ? QS.parse(_searchStr) : {};
9380
9379
  }
9381
9380
 
9381
+ function showLoading() {
9382
+ if (IS_CPPOC_HOST) {
9383
+ _Toast.loading({
9384
+ message: '加载中...',
9385
+ forbidClick: true
9386
+ });
9387
+ } else if (window.appBridge && window.appBridge.showLoading) {
9388
+ window.appBridge.showLoading();
9389
+ }
9390
+ }
9391
+ function hideLoading() {
9392
+ if (IS_CPPOC_HOST) {
9393
+ _Toast.clear();
9394
+ } else if (window.appBridge && window.appBridge.hideLoading) {
9395
+ window.appBridge.hideLoading();
9396
+ }
9397
+ }
9398
+
9399
+ 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; }
9400
+ 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; }
9401
+ var options = {
9402
+ baseURL: PLANBOOK_API_HOSTNAME,
9403
+ withCredentials: true,
9404
+ timeout: 10000,
9405
+ headers: {
9406
+ 'X-Requested-With': 'XMLHttpRequest'
9407
+ }
9408
+ };
9409
+ var loadingTimer = null;
9410
+ var showRequestLoading = function showRequestLoading() {
9411
+ if (loadingTimer) {
9412
+ clearTimeout(loadingTimer);
9413
+ }
9414
+ loadingTimer = setTimeout(function () {
9415
+ showLoading();
9416
+ }, 300);
9417
+ };
9418
+ var hideRequestLoading = function hideRequestLoading() {
9419
+ if (loadingTimer) {
9420
+ hideLoading();
9421
+ }
9422
+ if (loadingTimer) {
9423
+ clearTimeout(loadingTimer);
9424
+ }
9425
+ };
9426
+ var normalizeMethod = function normalizeMethod(method) {
9427
+ return (method || 'get').toUpperCase();
9428
+ };
9429
+ var serializeParams = function serializeParams(params) {
9430
+ if (!params) {
9431
+ return '';
9432
+ }
9433
+ var queryParts = [];
9434
+ Object.keys(params).forEach(function (key) {
9435
+ var value = params[key];
9436
+ if (value === undefined || value === null) {
9437
+ return;
9438
+ }
9439
+ if (Array.isArray(value)) {
9440
+ value.forEach(function (item) {
9441
+ queryParts.push("".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(item)));
9442
+ });
9443
+ return;
9444
+ }
9445
+ queryParts.push("".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(value)));
9446
+ });
9447
+ return queryParts.join('&');
9448
+ };
9449
+ var isAbsoluteUrl = function isAbsoluteUrl(url) {
9450
+ return /^https?:\/\//.test(url);
9451
+ };
9452
+ var buildUrl = function buildUrl(baseURL, url, params) {
9453
+ var queryString = serializeParams(params);
9454
+ var requestUrl = isAbsoluteUrl(url) ? url : "".concat(baseURL).concat(url);
9455
+ if (!queryString) {
9456
+ return requestUrl;
9457
+ }
9458
+ return "".concat(requestUrl).concat(requestUrl.includes('?') ? '&' : '?').concat(queryString);
9459
+ };
9460
+ var isPlainObject = function isPlainObject(value) {
9461
+ return Object.prototype.toString.call(value) === '[object Object]';
9462
+ };
9463
+ var buildBody = function buildBody(data, headers) {
9464
+ if (data === undefined || data === null) {
9465
+ return undefined;
9466
+ }
9467
+ if (data instanceof FormData || data instanceof Blob || typeof data === 'string') {
9468
+ return data;
9469
+ }
9470
+ if (isPlainObject(data) || Array.isArray(data)) {
9471
+ if (!headers['Content-Type']) {
9472
+ headers['Content-Type'] = 'application/json';
9473
+ }
9474
+ return JSON.stringify(data);
9475
+ }
9476
+ return data;
9477
+ };
9478
+ var parseResponse = /*#__PURE__*/function () {
9479
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(response) {
9480
+ var contentType, text;
9481
+ return _regeneratorRuntime.wrap(function (_context) {
9482
+ while (1) switch (_context.prev = _context.next) {
9483
+ case 0:
9484
+ contentType = response.headers.get('content-type') || '';
9485
+ if (!contentType.includes('application/json')) {
9486
+ _context.next = 1;
9487
+ break;
9488
+ }
9489
+ return _context.abrupt("return", response.json());
9490
+ case 1:
9491
+ _context.next = 2;
9492
+ return response.text();
9493
+ case 2:
9494
+ text = _context.sent;
9495
+ if (text) {
9496
+ _context.next = 3;
9497
+ break;
9498
+ }
9499
+ return _context.abrupt("return", {});
9500
+ case 3:
9501
+ _context.prev = 3;
9502
+ return _context.abrupt("return", JSON.parse(text));
9503
+ case 4:
9504
+ _context.prev = 4;
9505
+ _context["catch"](3);
9506
+ return _context.abrupt("return", {
9507
+ data: text
9508
+ });
9509
+ case 5:
9510
+ case "end":
9511
+ return _context.stop();
9512
+ }
9513
+ }, _callee, null, [[3, 4]]);
9514
+ }));
9515
+ return function parseResponse(_x) {
9516
+ return _ref.apply(this, arguments);
9517
+ };
9518
+ }();
9519
+ var createTimeoutError = function createTimeoutError(timeout) {
9520
+ var error = new Error("timeout of ".concat(timeout, "ms exceeded"));
9521
+ error.name = 'TimeoutError';
9522
+ return error;
9523
+ };
9524
+ var request = /*#__PURE__*/function () {
9525
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(config) {
9526
+ 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;
9527
+ return _regeneratorRuntime.wrap(function (_context2) {
9528
+ while (1) switch (_context2.prev = _context2.next) {
9529
+ case 0:
9530
+ 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;
9531
+ if (!isIgnoreLoading) {
9532
+ showRequestLoading();
9533
+ }
9534
+ requestHeaders = _objectSpread$2(_objectSpread$2({}, options.headers), headers);
9535
+ timeoutId = null;
9536
+ _context2.prev = 1;
9537
+ fetchPromise = fetch(buildUrl(baseURL, url, params), {
9538
+ method: normalizeMethod(method),
9539
+ headers: requestHeaders,
9540
+ body: normalizeMethod(method) === 'GET' ? undefined : buildBody(data, requestHeaders),
9541
+ credentials: withCredentials ? 'include' : 'same-origin'
9542
+ });
9543
+ _context2.next = 2;
9544
+ return Promise.race([fetchPromise, new Promise(function (resolve, reject) {
9545
+ timeoutId = setTimeout(function () {
9546
+ reject(createTimeoutError(timeout));
9547
+ }, timeout);
9548
+ })]);
9549
+ case 2:
9550
+ response = _context2.sent;
9551
+ _context2.next = 3;
9552
+ return parseResponse(response);
9553
+ case 3:
9554
+ res = _context2.sent;
9555
+ if (response.ok) {
9556
+ _context2.next = 4;
9557
+ break;
9558
+ }
9559
+ error = new Error("Request failed with status code ".concat(response.status));
9560
+ error.response = {
9561
+ status: response.status,
9562
+ data: res
9563
+ };
9564
+ throw error;
9565
+ case 4:
9566
+ code = res.code;
9567
+ if (!['002012', '002013', '002015'].includes(code)) {
9568
+ _context2.next = 5;
9569
+ break;
9570
+ }
9571
+ messageMap = {
9572
+ m002012: '当前账号因操作频繁被限制,请明天再试。感谢理解',
9573
+ m002013: '您的操作频率较高,已达到今日生成上限。请稍后再试或明天继续使用,感谢您的理解!',
9574
+ m002015: '您今天做了太多计划书了,休息一下,明天再来吧'
9575
+ };
9576
+ message = messageMap["m".concat(code)];
9577
+ if (message) {
9578
+ _Dialog.alert({
9579
+ message: message,
9580
+ confirmButtonText: '知道了',
9581
+ confirmButtonColor: '#0A64FE'
9582
+ });
9583
+ }
9584
+ return _context2.abrupt("return", Promise.reject({
9585
+ code: code,
9586
+ message: message
9587
+ }));
9588
+ case 5:
9589
+ if (!(code === 401 || res.status === 401)) {
9590
+ _context2.next = 6;
9591
+ break;
9592
+ }
9593
+ gotoLogin();
9594
+ return _context2.abrupt("return", Promise.reject('status: 401'));
9595
+ case 6:
9596
+ if (!(res.success && res.data === -1)) {
9597
+ _context2.next = 7;
9598
+ break;
9599
+ }
9600
+ gotoLogin();
9601
+ return _context2.abrupt("return", Promise.reject('login: -1'));
9602
+ case 7:
9603
+ return _context2.abrupt("return", returnFullResponse ? res : res.data);
9604
+ case 8:
9605
+ _context2.prev = 8;
9606
+ _t2 = _context2["catch"](1);
9607
+ if (_t2.response && _t2.response.status == 401) {
9608
+ gotoLogin();
9609
+ }
9610
+ return _context2.abrupt("return", Promise.reject(_t2));
9611
+ case 9:
9612
+ _context2.prev = 9;
9613
+ if (timeoutId) {
9614
+ clearTimeout(timeoutId);
9615
+ }
9616
+ hideRequestLoading();
9617
+ return _context2.finish(9);
9618
+ case 10:
9619
+ case "end":
9620
+ return _context2.stop();
9621
+ }
9622
+ }, _callee2, null, [[1, 8, 9, 10]]);
9623
+ }));
9624
+ return function request(_x2) {
9625
+ return _ref2.apply(this, arguments);
9626
+ };
9627
+ }();
9628
+
9629
+ function getPlanbookInsuranceVerifyData(params) {
9630
+ return request({
9631
+ baseURL: APP_HOSTNAME,
9632
+ url: '/planBook/input/insurance/verifyData',
9633
+ method: 'post',
9634
+ data: params,
9635
+ headers: {
9636
+ Accept: 'application/json, text/plain, */*',
9637
+ 'Content-Type': 'application/json;'
9638
+ }
9639
+ });
9640
+ }
9641
+
9382
9642
  function _arrayLikeToArray(r, a) {
9383
9643
  (null == a || a > r.length) && (a = r.length);
9384
9644
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
@@ -9533,6 +9793,26 @@
9533
9793
  });
9534
9794
  });
9535
9795
  }
9796
+ if (e.componentName === 'cmCommonInput') {
9797
+ // 输入框,默认打开普通键盘。From hyw
9798
+ if (!e.inputType) {
9799
+ e.inputType = 'text';
9800
+ }
9801
+ if (['baoe', 'baof', 'payModePremium', 'num'].includes(e.key)) {
9802
+ // 输入框,默认2位小数。From hyw
9803
+ if (!e.regExp) {
9804
+ e.regExp = '/^\\d{1,9}(\\.\\d{1,2})?$/';
9805
+ e.regExpMessage = '请输入最多9位整数和最多2位小数';
9806
+ e.maxlength = 12;
9807
+ e.inputType = 'decimal';
9808
+ }
9809
+ // 输入框,整数值,使用数字键盘。From hyw
9810
+ if (e.regExp === '/^\\d{1,}$/') {
9811
+ e.maxlength = 9;
9812
+ e.inputType = 'tel';
9813
+ }
9814
+ }
9815
+ }
9536
9816
  });
9537
9817
  }
9538
9818
 
@@ -9841,6 +10121,7 @@
9841
10121
  prodData.mulInsOrderList.forEach(function (ins) {
9842
10122
  initInsuranceData(ins);
9843
10123
  });
10124
+ setCommonInfo(prodData);
9844
10125
  return prodData;
9845
10126
  }
9846
10127
 
@@ -9874,36 +10155,22 @@
9874
10155
  */
9875
10156
  function _productDataHandler() {
9876
10157
  _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;
10158
+ var _ref4, eventTarget, productVerifyData, insuranceKey, elementKey, groupInsurance, groupInsuranceIdEle, subInsurances, hasProduct, hasVerifyData, hasPersonData, personOrderList, _prodData$mulInsOrder3;
9878
10159
  return _regeneratorRuntime.wrap(function (_context) {
9879
10160
  while (1) switch (_context.prev = _context.next) {
9880
10161
  case 0:
9881
- if (prodData) {
9882
- _context.next = 1;
10162
+ if (!prodData) {
10163
+ _context.next = 2;
9883
10164
  break;
9884
10165
  }
9885
- return _context.abrupt("return", prodData);
10166
+ _ref4 = parmas || {}, eventTarget = _ref4.eventTarget;
10167
+ _context.next = 1;
10168
+ return getSingleInsurancesVerifyData(prodVerifyData, prodData, personData, parmas).catch(function () {});
9886
10169
  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
10170
  productVerifyData = _context.sent;
9899
- _context.next = 4;
9900
- break;
9901
- case 3:
9902
- productVerifyData = prodVerifyData;
9903
- case 4:
9904
10171
  // 组合险种特殊处理:当用户点击组合险种的子险种选项时,将其他子险种的标题设置为未选中状态
9905
- if (parmas && parmas.eventTarget) {
9906
- _parmas$eventTarget = parmas.eventTarget, insuranceKey = _parmas$eventTarget.insuranceKey, elementKey = _parmas$eventTarget.elementKey;
10172
+ if (eventTarget) {
10173
+ insuranceKey = eventTarget.insuranceKey, elementKey = eventTarget.elementKey;
9907
10174
  if (insuranceKey && elementKey === 'insuranceId') {
9908
10175
  groupInsurance = (prodData.mulInsOrderList || []).find(function (ins) {
9909
10176
  return ins.key === insuranceKey;
@@ -9932,7 +10199,6 @@
9932
10199
  personOrderList = convertPersonData(personData, personData.personOrderList.map(function (p) {
9933
10200
  return p.key;
9934
10201
  }));
9935
- setCommonInfo(prodData);
9936
10202
  (_prodData$mulInsOrder3 = prodData.mulInsOrderList) === null || _prodData$mulInsOrder3 === void 0 || _prodData$mulInsOrder3.forEach(function (ins, ii, insList) {
9937
10203
  var _ins$eleOrderList;
9938
10204
  insuranceDataHandler(ins, prodData);
@@ -10166,8 +10432,9 @@
10166
10432
  }
10167
10433
  setGroupInsurance(prodData);
10168
10434
  isHideProduct(prodData, productVerifyData, personOrderList);
10435
+ case 2:
10169
10436
  return _context.abrupt("return", prodData);
10170
- case 5:
10437
+ case 3:
10171
10438
  case "end":
10172
10439
  return _context.stop();
10173
10440
  }
@@ -10175,32 +10442,34 @@
10175
10442
  }));
10176
10443
  return _productDataHandler.apply(this, arguments);
10177
10444
  }
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';
10445
+ function multipleInsuredHandler(prodData, personData) {
10446
+ if (prodData && prodData.multipleInsured) {
10447
+ var personOrderList = personData.personOrderList;
10448
+ if (!(personOrderList && personOrderList.length)) {
10449
+ return null;
10450
+ }
10451
+ var insured2Info = personOrderList.find(function (p) {
10452
+ return p.key === 'insured2Info';
10192
10453
  });
10193
- if (insuredIndex >= 0) {
10194
- var person = lodash.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
- }
10454
+ if (!insured2Info) {
10455
+ var insuredInfo = personOrderList.find(function (p) {
10456
+ return p.key === 'insuredInfo';
10202
10457
  });
10203
- personOrderList.splice(insuredIndex + 1, 0, person);
10458
+ var insuredIndex = personOrderList.findIndex(function (p) {
10459
+ return p.key === 'insuredInfo';
10460
+ });
10461
+ if (insuredIndex >= 0) {
10462
+ var person = lodash.cloneDeep(insuredInfo);
10463
+ person.key = 'insured2Info';
10464
+ person.eleOrderList.forEach(function (e) {
10465
+ if (e.key === 'title') {
10466
+ e.isDisabled = false;
10467
+ e.value = true;
10468
+ e.label = '第二被保人信息';
10469
+ }
10470
+ });
10471
+ personOrderList.splice(insuredIndex + 1, 0, person);
10472
+ }
10204
10473
  }
10205
10474
  }
10206
10475
  return personData;
@@ -10215,63 +10484,67 @@
10215
10484
  * @param {IPbPersons} personData 必传。人员信息,包括被保人、投保人、投保人配偶
10216
10485
  * @returns 请求函数的 Promise
10217
10486
  */
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';
10487
+ function getSingleInsurancesVerifyData(verifyData, prodData, personData) {
10488
+ var parmas = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
10489
+ var isSingleFeeValidateMode = prodData && prodData.feeValidateMode === 'single' || verifyData && verifyData.feeValidateMode === 'single';
10490
+ if (isSingleFeeValidateMode) {
10491
+ var _prodData$mulInsOrder, _prodData$mulInsOrder2;
10492
+ var personOrderList = personData.personOrderList;
10493
+ if (!(personOrderList && personOrderList.length)) {
10494
+ return null;
10495
+ }
10496
+ var pbId = prodData.isTemp || prodData.policyType === 'single_insurance' ? null : parmas.planbookId;
10497
+ var productId = prodData.policyType === 'single_insurance' ? null : prodData.key;
10498
+ // 险种对比,prodData 没有 feeValidateMode 字段。因此需要特殊处理。
10499
+ // 险种对比,以险种为维度,其 prodData.key 就是险种id,不能当成正常产品id。因此需要特殊处理。
10500
+ if (prodData.feeValidateMode !== 'single') {
10501
+ productId = null;
10502
+ }
10503
+ var insuredList = personOrderList.filter(function (p) {
10504
+ return ['insuredInfo', 'insured2Info'].includes(p.key);
10505
+ }).filter(function (p) {
10506
+ var _p$eleOrderList;
10507
+ var title = (_p$eleOrderList = p.eleOrderList) === null || _p$eleOrderList === void 0 ? void 0 : _p$eleOrderList.find(function (e) {
10508
+ return e.key === 'title';
10509
+ });
10510
+ return title && title.value || p.title;
10511
+ }).map(function (p) {
10512
+ var person = convertEleOrderListToObj(p);
10513
+ return {
10514
+ key: person.key,
10515
+ sex: person.sex,
10516
+ age: person.age
10517
+ };
10518
+ });
10519
+ var applicant = null;
10520
+ var applicantItem = personData.personOrderList.find(function (p) {
10521
+ return p.key === 'applicantInfo';
10522
+ });
10523
+ if (applicantItem) {
10524
+ var person = convertEleOrderListToObj(applicantItem);
10525
+ applicant = {
10526
+ key: person.key,
10527
+ sex: person.sex,
10528
+ age: person.age
10529
+ };
10530
+ }
10531
+ var insuranceIdList = prodData === null || prodData === void 0 || (_prodData$mulInsOrder = prodData.mulInsOrderList) === null || _prodData$mulInsOrder === void 0 ? void 0 : _prodData$mulInsOrder.map(function (ins) {
10532
+ return ins.key;
10533
+ }).filter(function (k) {
10534
+ return !['common'].includes(k);
10535
+ });
10536
+ prodData === null || prodData === void 0 || (_prodData$mulInsOrder2 = prodData.mulInsOrderList) === null || _prodData$mulInsOrder2 === void 0 || _prodData$mulInsOrder2.reduce(function (list, ins) {
10537
+ return ins.key === 'common' || ins.isGroup ? list : list.concat(ins.key);
10538
+ }, []);
10539
+ return getAndCacheInsurancesVerifyData({
10540
+ pbId: pbId,
10541
+ productId: productId,
10542
+ insuredList: insuredList,
10543
+ applicant: applicant,
10544
+ insuranceIdList: insuranceIdList
10238
10545
  });
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
10546
  }
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
- });
10547
+ return Promise.resolve(verifyData);
10275
10548
  }
10276
10549
 
10277
10550
  /**
@@ -10283,25 +10556,7 @@
10283
10556
  * @returns {Promise<any>} 产品下所有险种的费率
10284
10557
  */
10285
10558
  var getAndCacheInsurancesVerifyData = lodash.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 () {});
10559
+ return getPlanbookInsuranceVerifyData(params).catch(function () {});
10305
10560
  }, function (params) {
10306
10561
  return QS.stringify(params);
10307
10562
  });
@@ -10506,7 +10761,7 @@
10506
10761
  }
10507
10762
  }
10508
10763
  }
10509
- var index = mulInsOrderList.findLastIndex(function (ins) {
10764
+ var index = lodash.findLastIndex(mulInsOrderList, function (ins) {
10510
10765
  return ins.groupKey === k;
10511
10766
  });
10512
10767
  if (index >= 0) {
@@ -10528,21 +10783,21 @@
10528
10783
  * @author Lizhao <lz@winbaoxian.com>
10529
10784
  * @date 2022-04-26
10530
10785
  * @param {IPbProduct} prodData 必传。产品数据(单个)
10531
- * @param {object} productVerifyData 必传。产品限制条件(单个)
10786
+ * @param {object} prodVerifyData 必传。产品限制条件(单个)
10532
10787
  * @param {IPbPerson} personOrderList 必传。转换后的人员信息,包括被保人、投保人、投保人配偶
10533
10788
  * @returns {object} 产品数据(单个)
10534
10789
  */
10535
- function isHideProduct(prodData, productVerifyData, personOrderList) {
10790
+ function isHideProduct(prodData, prodVerifyData, personOrderList) {
10536
10791
  var ageRangeProd = {};
10537
- if (prodData && productVerifyData && Object.keys(productVerifyData).length && personOrderList) {
10792
+ if (prodData && prodVerifyData && Object.keys(prodVerifyData).length && personOrderList) {
10538
10793
  if (prodData.mulInsOrderList) {
10539
10794
  // 产品中是否有必选险种且有费率
10540
10795
  var hasRequiredIns = prodData.mulInsOrderList.some(function (ins) {
10541
- return !!ins.required && productVerifyData[ins.key];
10796
+ return !!ins.required && prodVerifyData[ins.key];
10542
10797
  });
10543
10798
  prodData.mulInsOrderList.forEach(function (ins) {
10544
10799
  // 当前险种的限制条件
10545
- var insuranceVerifyData = productVerifyData[ins.key];
10800
+ var insuranceVerifyData = prodVerifyData[ins.key];
10546
10801
  if (insuranceVerifyData) {
10547
10802
  // 产品年龄范围取各险种最大范围
10548
10803
  if ((!ins.huomian || ins.huomian == 'beiHuomian') && (!hasRequiredIns || hasRequiredIns && ins.required)) {
@@ -10554,11 +10809,11 @@
10554
10809
  }
10555
10810
  });
10556
10811
  }
10557
- var _ref2 = personOrderList.find(function (p) {
10812
+ var _ref = personOrderList.find(function (p) {
10558
10813
  return p.key === 'insuredInfo';
10559
10814
  }),
10560
- sex = _ref2.sex,
10561
- age = _ref2.age;
10815
+ sex = _ref.sex,
10816
+ age = _ref.age;
10562
10817
  if (ageRangeProd[sex] && age >= ageRangeProd[sex][0] && age <= ageRangeProd[sex][1]) {
10563
10818
  prodData.hide = false;
10564
10819
  } else {
@@ -10584,11 +10839,11 @@
10584
10839
  * @param {IInsElement} params.eleData 可不传。元素数据,当前交互的元素(如:用户修改了该险种的交费期间)
10585
10840
  * @returns {string} 校验结果。空表示校验通过
10586
10841
  */
10587
- function verifyProductRules(_ref3) {
10588
- var personData = _ref3.personData,
10589
- productData = _ref3.productData,
10590
- insData = _ref3.insData,
10591
- eleData = _ref3.eleData;
10842
+ function verifyProductRules(_ref2) {
10843
+ var personData = _ref2.personData,
10844
+ productData = _ref2.productData,
10845
+ insData = _ref2.insData,
10846
+ eleData = _ref2.eleData;
10592
10847
  var errorMsg = '';
10593
10848
  var personOrderList = convertPersonData(personData, personData.personOrderList.map(function (p) {
10594
10849
  return p.key;
@@ -10634,11 +10889,11 @@
10634
10889
  * @param {eleData} params.eleData 可不传。元素数据,当前交互的元素(如:用户修改了该险种的交费期间)
10635
10890
  * @returns {string} 校验结果。空表示校验通过
10636
10891
  */
10637
- function restrictInsurancesInProduct(_ref4) {
10638
- var personOrderList = _ref4.personOrderList,
10639
- productData = _ref4.productData,
10640
- insData = _ref4.insData,
10641
- eleData = _ref4.eleData;
10892
+ function restrictInsurancesInProduct(_ref3) {
10893
+ var personOrderList = _ref3.personOrderList,
10894
+ productData = _ref3.productData,
10895
+ insData = _ref3.insData,
10896
+ eleData = _ref3.eleData;
10642
10897
  var errorMsg = '';
10643
10898
  var restrictList = productData.restrictList;
10644
10899
  if (restrictList && restrictList.length) {
@@ -10647,16 +10902,16 @@
10647
10902
  return p.key === 'insuredInfo';
10648
10903
  });
10649
10904
  var productInfo = convertProductData(productData);
10650
- var prodVerifyData = {
10905
+ var evalVerifyMap = {
10651
10906
  age: insuredInfo.age,
10652
10907
  sex: insuredInfo.sex,
10653
10908
  common: productInfo.common
10654
10909
  };
10655
10910
  productInfo.mulInsOrderList.forEach(function (ins) {
10656
- prodVerifyData['i' + ins.key] = ins;
10911
+ evalVerifyMap['i' + ins.key] = ins;
10657
10912
  });
10658
- restrict.rCondition = restrict.rCondition.replace(/(%)(\d+)(\.*\w*)(%)/g, 'prodVerifyData.i$2$3');
10659
- restrict.rCondition = restrict.rCondition.replace(/(%)(\w*\.*\w*)(%)/g, 'prodVerifyData.$2');
10913
+ restrict.rCondition = restrict.rCondition.replace(/(%)(\d+)(\.*\w*)(%)/g, 'evalVerifyMap.i$2$3');
10914
+ restrict.rCondition = restrict.rCondition.replace(/(%)(\w*\.*\w*)(%)/g, 'evalVerifyMap.$2');
10660
10915
  var curIns = productData.mulInsOrderList.find(function (ins) {
10661
10916
  return ins.key === restrict.rInsKey;
10662
10917
  });
@@ -10706,8 +10961,8 @@
10706
10961
  var rangeSelect = eval(restrict.rCondition);
10707
10962
  if (rangeSelect !== undefined && rangeSelect !== null) {
10708
10963
  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);
10964
+ var optNum = getNumberFromYear(opt.val, evalVerifyMap.age);
10965
+ var rangeSelectNum = rangeSelect.constructor === Array ? [rangeSelect[0] && getNumberFromYear(rangeSelect[0], evalVerifyMap.age), rangeSelect[1] && getNumberFromYear(rangeSelect[1], evalVerifyMap.age)] : getNumberFromYear(rangeSelect, evalVerifyMap.age);
10711
10966
  if (rangeSelect) {
10712
10967
  if (rangeSelect.constructor === Array) {
10713
10968
  opt.isHide = rangeSelect[0] && optNum < rangeSelectNum[0] || rangeSelect[1] && optNum > rangeSelectNum[1];
@@ -10734,7 +10989,7 @@
10734
10989
  case 3:
10735
10990
  {
10736
10991
  // 全局校验、或者点击的是约束元素、或者点击的是目标元素时,触发校验
10737
- if (!insData && !eleData || restrict.rInsKey === insData.key && restrict.rEleKey === eleData.key || restrict.rCondition.search("prodVerifyData.i".concat(insData.key, ".").concat(eleData.key)) !== -1) {
10992
+ if (!insData && !eleData || restrict.rInsKey === insData.key && restrict.rEleKey === eleData.key || restrict.rCondition.search("evalVerifyMap.i".concat(insData.key, ".").concat(eleData.key)) !== -1) {
10738
10993
  var rangeVal = eval(restrict.rCondition);
10739
10994
  if (rangeVal !== undefined && rangeVal !== null) {
10740
10995
  if (rangeVal.constructor === Array) {
@@ -10803,7 +11058,7 @@
10803
11058
  checkedInsData[ele.key] = insuranceData[ele.key];
10804
11059
  }
10805
11060
  });
10806
- productData.mulInsOrderList.push(deepCopy(checkedInsData));
11061
+ productData.mulInsOrderList.push(lodash.cloneDeep(checkedInsData));
10807
11062
  }
10808
11063
  });
10809
11064
  return;
@@ -10822,32 +11077,28 @@
10822
11077
  * @returns {IPbProduct} 产品数据
10823
11078
  */
10824
11079
  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) {
11080
+ if (productData && Array.isArray(productData.mulInsOrderList)) {
11081
+ productData.adjustBaoeData = null;
11082
+ productData.mulInsOrderList.forEach(function (ins) {
11083
+ if (ins.accountData && ins.accountData.addAndTakeData) {
11084
+ ins.accountData.addAndTakeData.forEach(function (aat) {
10841
11085
  aat.adjustData = [];
10842
11086
  });
10843
11087
  }
10844
- if (ins.duplicateReduceBaofData) {
10845
- ins.duplicateReduceBaofData.addAndTakeData.forEach(function (aat) {
10846
- aat.adjustData = [];
10847
- });
11088
+ if (ins.reduceBaof) {
11089
+ if (ins.reduceBaofData) {
11090
+ ins.reduceBaofData.addAndTakeData.forEach(function (aat) {
11091
+ aat.adjustData = [];
11092
+ });
11093
+ }
11094
+ if (ins.duplicateReduceBaofData) {
11095
+ ins.duplicateReduceBaofData.addAndTakeData.forEach(function (aat) {
11096
+ aat.adjustData = [];
11097
+ });
11098
+ }
10848
11099
  }
10849
- }
10850
- });
11100
+ });
11101
+ }
10851
11102
  return productData;
10852
11103
  }
10853
11104
 
@@ -10860,7 +11111,6 @@
10860
11111
  convertEleOrderListToObj: convertEleOrderListToObj,
10861
11112
  convertPersonData: convertPersonData,
10862
11113
  convertProductData: convertProductData,
10863
- deepCopy: deepCopy,
10864
11114
  enableLizhaoDebug: enableLizhaoDebug,
10865
11115
  executeElementRule: executeElementRule,
10866
11116
  formatNumberToThousand: formatNumberToThousand,
@@ -10876,6 +11126,7 @@
10876
11126
  initProductData: initProductData,
10877
11127
  insuranceDataHandler: insuranceDataHandler,
10878
11128
  isHideProduct: isHideProduct,
11129
+ multipleInsuredHandler: multipleInsuredHandler,
10879
11130
  personDataHandler: personDataHandler,
10880
11131
  productDataHandler: productDataHandler,
10881
11132
  restrictElementsInInsurance: restrictElementsInInsurance,
@@ -10887,125 +11138,30 @@
10887
11138
  verifyProductRules: verifyProductRules
10888
11139
  });
10889
11140
 
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
11141
  /**
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
11142
+ * 险种保费试算 `/api/product/data/calculate`
10971
11143
  */
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
- });
11144
+ function postProductDataCalculate(urlParams, postParams) {
11145
+ var path = '/api/product/data/calculate';
11146
+ if (urlParams && urlParams.uuid) {
11147
+ path += "?userUuid=".concat(encodeURIComponent(urlParams.uuid));
11148
+ } else if (urlParams && urlParams.openId) {
11149
+ path += "?userUuid=".concat(encodeURIComponent(urlParams.openId));
11150
+ }
11151
+ if (urlParams && urlParams.appid) {
11152
+ path += path.includes('?') ? "&appId=".concat(encodeURIComponent(urlParams.appid)) : "?appId=".concat(encodeURIComponent(urlParams.appid));
11153
+ }
11154
+ return request({
11155
+ baseURL: INSURANCE2A_API_HOSTNAME,
11156
+ url: path,
11157
+ method: 'post',
11158
+ data: postParams,
11159
+ headers: {
11160
+ Accept: 'application/json, text/plain, */*',
11161
+ 'Content-Type': 'application/json'
11162
+ },
11163
+ isIgnoreLoading: false,
11164
+ returnFullResponse: true
11009
11165
  });
11010
11166
  }
11011
11167
 
@@ -11226,55 +11382,31 @@
11226
11382
  if (postParams && !postParams.scenario) {
11227
11383
  postParams.scenario = 'h5Widget';
11228
11384
  }
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
11385
  if (hasPlanParams(planParams) && postParams.current_data) {
11243
11386
  postParams.current_data = tranlateCurrentData(postParams.current_data, planParams);
11244
11387
  }
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);
11388
+ return postProductDataCalculate(urlParams, postParams).then(function (res) {
11389
+ if (res.code === 200) {
11390
+ var data = JSON.parse(JSON.stringify(res.data));
11391
+ if (hasPlanParams(planParams)) {
11392
+ var widgets = data.widgets;
11393
+ var currentData = data.current_data;
11394
+ translatePlanData(widgets, currentData, planParams);
11274
11395
  }
11275
- }).catch(function (err) {
11276
- reject(err);
11277
- });
11396
+ var cData = {
11397
+ widgets: data.widgets,
11398
+ total_premium: data.total_premium,
11399
+ terms: data.terms,
11400
+ product_id: data.product_id,
11401
+ current_data: data.current_data,
11402
+ risk_premiums: data.risk_premiums
11403
+ };
11404
+ return {
11405
+ code: 200,
11406
+ data: cData
11407
+ };
11408
+ }
11409
+ return Promise.reject(res);
11278
11410
  });
11279
11411
  }
11280
11412
 
@@ -11355,47 +11487,17 @@
11355
11487
  if (postParams && !postParams.scenario) {
11356
11488
  postParams.scenario = 'h5Widget';
11357
11489
  }
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
11490
  if (hasPlanParams(planParams) && postParams.current_data) {
11372
11491
  postParams.current_data = tranlateCurrentData(postParams.current_data, planParams);
11373
11492
  }
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
- });
11493
+ return postProductDataCalculate(urlParams, postParams).then(function (res) {
11494
+ if (res.code === 200) {
11495
+ return {
11496
+ code: 200,
11497
+ data: res.data
11498
+ };
11499
+ }
11500
+ return Promise.reject(res);
11399
11501
  });
11400
11502
  }
11401
11503
 
@@ -11403,8 +11505,6 @@
11403
11505
  __proto__: null,
11404
11506
  checkInsureCalculate: checkInsureCalculate,
11405
11507
  checkInsureCalculateIn: checkInsureCalculateIn,
11406
- getAddress: getAddress,
11407
- getUuid: getUuid,
11408
11508
  hasPlanParams: hasPlanParams,
11409
11509
  insureCalculate: insureCalculate
11410
11510
  });
@@ -11423,19 +11523,16 @@
11423
11523
  exports.convertEleOrderListToObj = convertEleOrderListToObj;
11424
11524
  exports.convertPersonData = convertPersonData;
11425
11525
  exports.convertProductData = convertProductData;
11426
- exports.deepCopy = deepCopy;
11427
11526
  exports.default = index;
11428
11527
  exports.enableLizhaoDebug = enableLizhaoDebug;
11429
11528
  exports.executeElementRule = executeElementRule;
11430
11529
  exports.formatNumberToThousand = formatNumberToThousand;
11431
- exports.getAddress = getAddress;
11432
11530
  exports.getAgeFromBirth = getAgeFromBirth;
11433
11531
  exports.getElementVerifyFromProductVerify = getElementVerifyFromProductVerify;
11434
11532
  exports.getExpressionParamMap = getExpressionParamMap;
11435
11533
  exports.getHuomianPeriodValue = getHuomianPeriodValue;
11436
11534
  exports.getInsuredAgeRange = getInsuredAgeRange;
11437
11535
  exports.getNumberFromYear = getNumberFromYear;
11438
- exports.getUuid = getUuid;
11439
11536
  exports.hasPlanParams = hasPlanParams;
11440
11537
  exports.initElementValidateRules = initElementValidateRules;
11441
11538
  exports.initInsuranceData = initInsuranceData;
@@ -11444,6 +11541,7 @@
11444
11541
  exports.insuranceDataHandler = insuranceDataHandler;
11445
11542
  exports.insureCalculate = insureCalculate;
11446
11543
  exports.isHideProduct = isHideProduct;
11544
+ exports.multipleInsuredHandler = multipleInsuredHandler;
11447
11545
  exports.personDataHandler = personDataHandler;
11448
11546
  exports.productDataHandler = productDataHandler;
11449
11547
  exports.restrictElementsInInsurance = restrictElementsInInsurance;