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,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vant/lib/toast/index.css'), require('vant/lib/toast'), require('qs'), require('vue'), require('lodash/cloneDeep'), require('lodash')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'vant/lib/toast/index.css', 'vant/lib/toast', 'qs', 'vue', 'lodash/cloneDeep', 'lodash'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BXT = {}, null, global._Toast, global.QS, global.Vue, global.cloneDeep, global._));
5
- })(this, (function (exports, index_css, _Toast, QS, Vue, cloneDeep, lodash) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vant/lib/toast/index.css'), require('vant/lib/toast'), require('vue'), require('lodash/cloneDeep'), require('qs'), require('vant/lib/dialog/index.css'), require('vant/lib/dialog'), require('lodash')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'vant/lib/toast/index.css', 'vant/lib/toast', 'vue', 'lodash/cloneDeep', 'qs', 'vant/lib/dialog/index.css', 'vant/lib/dialog', 'lodash'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BXT = {}, null, global._Toast, global.Vue, global.cloneDeep, global.QS, null, global._Dialog, global._));
5
+ })(this, (function (exports, index_css, _Toast, Vue, cloneDeep, QS, index_css$1, _Dialog, lodash) { 'use strict';
6
6
 
7
7
  function _initializerDefineProperty(e, i, r, l) {
8
8
  r && Object.defineProperty(e, i, {
@@ -471,142 +471,30 @@
471
471
  });
472
472
  }
473
473
 
474
- document && document.cookie && document.cookie.match('ENABLE_LIZHAO_DEBUG=1');
475
-
476
- /**
477
- * **将对象下的 eleOrderList 数组中的子元素下的 value,转换为 key-value 键值对**
478
- * @author Lizhao <lz@winbaoxian.com>
479
- * @date 2022-04-25
480
- * @param {any} obj 必传。带eleOrderList数组的对象。如人员数据、产品数据
481
- * @example
482
- * convertEleOrderListToObj({
483
- "key": "insuredInfo"
484
- "eleOrderList": [
485
- { "value": true, "key": "title" },
486
- { "value": 1, "key": "sex" },
487
- { "value": 30, "key": "age" },
488
- { "value": "2020/10/23", "key": "insuranceDay" }
489
- ]
490
- })
491
- // returns
492
- // {
493
- // "key": "insuredInfo",
494
- // "title": true,
495
- // "sex": 1,
496
- // "age": 30,
497
- // "insuranceDay": "2020/10/23",
498
- // }
499
- * @returns {any}
500
- */
501
- function convertEleOrderListToObj(obj) {
502
- var resData = {};
503
- var _loop = function _loop(k) {
504
- if (k == 'eleOrderList') {
505
- obj[k].map(function (ele) {
506
- resData[ele.key] = ele.value;
507
- });
508
- } else {
509
- // eleOrderList中有的key,则不取当前对象下的属性
510
- if (!obj.eleOrderList || obj.eleOrderList.every(function (e) {
511
- return e.key !== k;
512
- })) {
513
- resData[k] = obj[k];
514
- }
515
- }
516
- };
517
- for (var k in obj) {
518
- _loop(k);
474
+ function asyncGeneratorStep(n, t, e, r, o, a, c) {
475
+ try {
476
+ var i = n[a](c),
477
+ u = i.value;
478
+ } catch (n) {
479
+ return void e(n);
519
480
  }
520
- return resData;
481
+ i.done ? t(u) : Promise.resolve(u).then(r, o);
521
482
  }
522
-
523
- /**
524
- * **对象的深拷贝**
525
- * @ignore
526
- * @author Lizhao <lz@winbaoxian.com>
527
- * @date 2022-04-25
528
- * @param {object} obj - 必传
529
- * @param {WeakMap} hash - 可不传
530
- * @returns {object} 拷贝对象
531
- */
532
- function deepCopy(obj) {
533
- var hash = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new WeakMap();
534
- if (!obj || _typeof$2(obj) !== 'object') {
535
- return obj;
536
- }
537
- if (hash.has(obj)) {
538
- return hash.get(obj);
539
- }
540
- var newObj;
541
- var Constructor = obj.constructor;
542
- switch (Constructor) {
543
- case RegExp:
544
- newObj = new Constructor(obj);
545
- break;
546
- case Date:
547
- newObj = new Constructor(obj.getTime());
548
- break;
549
- default:
550
- newObj = new Constructor();
551
- break;
552
- }
553
- hash.set(obj, newObj);
554
- for (var key in obj) {
555
- if (obj.hasOwnProperty(key)) {
556
- newObj[key] = _typeof$2(obj[key]) === 'object' ? deepCopy(obj[key], hash) : obj[key];
557
- }
558
- }
559
- return newObj;
560
- }
561
-
562
- /**
563
- * **转换人员数据**
564
- * @author Lizhao <lz@winbaoxian.com>
565
- * @date 2022-04-26
566
- * @param {IPbPersons} allPersonsData 必传。所有人员数据
567
- * @param {null|string|string[]} type 可不传。
568
- * 不传,人员数据按原结构返回;
569
- * 字符串,返回指定的人员数据;
570
- * 数组,以数组形式,返回多个人员数据。
571
- * @returns {any} 人员数据(单个或多个)
572
- */
573
- function convertPersonData(allPersonsData) {
574
- var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
575
- var cPersonData = {};
576
- if (allPersonsData) {
577
- //转换收件人信息
578
- if (allPersonsData.recipientInfo) {
579
- cPersonData.recipientInfo = convertEleOrderListToObj(allPersonsData.recipientInfo);
580
- }
581
- //转换被、投、投保人配偶的信息
582
- if (allPersonsData.personOrderList) {
583
- allPersonsData.personOrderList.forEach(function (person) {
584
- cPersonData[person.key] = convertEleOrderListToObj(person);
585
- });
586
- }
587
- }
588
- if (!type) {
589
- return {
590
- recipientInfo: cPersonData.recipientInfo,
591
- personOrderList: allPersonsData.personOrderList && allPersonsData.personOrderList.map(function (p) {
592
- return p.key;
593
- }).map(function (p) {
594
- return cPersonData[p];
595
- })
596
- };
597
- }
598
- if (typeof type === 'string') {
599
- return cPersonData[type];
600
- }
601
- if (type.constructor === Array) {
602
- var temp = [];
603
- for (var k in cPersonData) {
604
- if (type.indexOf(k) !== -1) {
605
- temp.push(cPersonData[k]);
483
+ function _asyncToGenerator(n) {
484
+ return function () {
485
+ var t = this,
486
+ e = arguments;
487
+ return new Promise(function (r, o) {
488
+ var a = n.apply(t, e);
489
+ function _next(n) {
490
+ asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
606
491
  }
607
- }
608
- return temp;
609
- }
492
+ function _throw(n) {
493
+ asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
494
+ }
495
+ _next(void 0);
496
+ });
497
+ };
610
498
  }
611
499
 
612
500
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -1036,7 +924,8 @@
1036
924
  return regenerator;
1037
925
  }
1038
926
 
1039
- requireRegenerator();
927
+ var regeneratorExports = requireRegenerator();
928
+ var _regeneratorRuntime = /*@__PURE__*/getDefaultExportFromCjs(regeneratorExports);
1040
929
 
1041
930
  var jax$1 = {exports: {}};
1042
931
 
@@ -9006,12 +8895,27 @@
9006
8895
  var Jax = /*@__PURE__*/getDefaultExportFromCjs(jaxExports);
9007
8896
 
9008
8897
  var getStandardOrigin = Jax.urlUtil.getStandardOrigin;
8898
+ var _Jax$parseUaString = Jax.parseUaString();
8899
+ _Jax$parseUaString.isApp;
8900
+ _Jax$parseUaString.appType;
8901
+ _Jax$parseUaString.appVersion;
8902
+ _Jax$parseUaString.isAndroid;
8903
+ _Jax$parseUaString.isIos;
8904
+ _Jax$parseUaString.isBxsApp;
8905
+ _Jax$parseUaString.isBaoXiaoZhuApp;
8906
+ _Jax$parseUaString.isBrokerApp;
8907
+ _Jax$parseUaString.isYjjApp;
8908
+ _Jax$parseUaString.isToBApp;
8909
+ _Jax$parseUaString.isRongYiBaoApp;
8910
+ _Jax$parseUaString.isWeChat;
8911
+ _Jax$parseUaString.appScheme;
9009
8912
  var hostname = window && window.location && window.location.hostname || '';
9010
8913
  /** 当前页 host 为 cppoc- 前缀时,请求 loading 使用 Vant Toast,否则走 appBridge */
9011
8914
  var IS_CPPOC_HOST = hostname.startsWith('cppoc-');
9012
8915
  var IS_PRODUCT_ENV = hostname.search(/(winbaoxian|ai-baoxiaozhu)\.com/) !== -1;
9013
8916
  hostname.search(/(winbaoxian|ai-baoxiaozhu)\.cn/) !== -1;
9014
8917
  hostname.search(/localhost|192\.168|127\.0\.0\.1|dev\.winbaoxian\.cn/) !== -1;
8918
+ var IS_LOCALHOST_IP_ENV = hostname.search(/192\.168/) !== -1;
9015
8919
  var IS_UAT_ENV = hostname.includes("pbf-uat.");
9016
8920
  var IS_ENABLE_DEBUG = !IS_PRODUCT_ENV;
9017
8921
  if (IS_ENABLE_DEBUG) {
@@ -9019,6 +8923,9 @@
9019
8923
  }
9020
8924
  hostname.includes('ai-baoxiaozhu') ? 'ai-baoxiaozhu' : 'winbaoxian';
9021
8925
  function getFullOrigin(data) {
8926
+ if (IS_LOCALHOST_IP_ENV) {
8927
+ return "https://".concat(data, ".winbaoxian.cn");
8928
+ }
9022
8929
  var _prefixDomain = IS_CPPOC_HOST ? 'cppoc-' : '';
9023
8930
  if (typeof data === 'string') {
9024
8931
  return getStandardOrigin("".concat(_prefixDomain).concat(data));
@@ -9041,6 +8948,381 @@
9041
8948
  return _searchStr ? QS.parse(_searchStr) : {};
9042
8949
  }
9043
8950
 
8951
+ function showLoading() {
8952
+ if (IS_CPPOC_HOST) {
8953
+ _Toast.loading({
8954
+ message: '加载中...',
8955
+ forbidClick: true
8956
+ });
8957
+ } else if (window.appBridge && window.appBridge.showLoading) {
8958
+ window.appBridge.showLoading();
8959
+ }
8960
+ }
8961
+ function hideLoading() {
8962
+ if (IS_CPPOC_HOST) {
8963
+ _Toast.clear();
8964
+ } else if (window.appBridge && window.appBridge.hideLoading) {
8965
+ window.appBridge.hideLoading();
8966
+ }
8967
+ }
8968
+
8969
+ 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; }
8970
+ 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$1(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; }
8971
+ var options = {
8972
+ baseURL: PLANBOOK_API_HOSTNAME,
8973
+ withCredentials: true,
8974
+ timeout: 10000,
8975
+ headers: {
8976
+ 'X-Requested-With': 'XMLHttpRequest'
8977
+ }
8978
+ };
8979
+ var loadingTimer = null;
8980
+ var showRequestLoading = function showRequestLoading() {
8981
+ if (loadingTimer) {
8982
+ clearTimeout(loadingTimer);
8983
+ }
8984
+ loadingTimer = setTimeout(function () {
8985
+ showLoading();
8986
+ }, 300);
8987
+ };
8988
+ var hideRequestLoading = function hideRequestLoading() {
8989
+ if (loadingTimer) {
8990
+ hideLoading();
8991
+ }
8992
+ if (loadingTimer) {
8993
+ clearTimeout(loadingTimer);
8994
+ }
8995
+ };
8996
+ var normalizeMethod = function normalizeMethod(method) {
8997
+ return (method || 'get').toUpperCase();
8998
+ };
8999
+ var serializeParams = function serializeParams(params) {
9000
+ if (!params) {
9001
+ return '';
9002
+ }
9003
+ var queryParts = [];
9004
+ Object.keys(params).forEach(function (key) {
9005
+ var value = params[key];
9006
+ if (value === undefined || value === null) {
9007
+ return;
9008
+ }
9009
+ if (Array.isArray(value)) {
9010
+ value.forEach(function (item) {
9011
+ queryParts.push("".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(item)));
9012
+ });
9013
+ return;
9014
+ }
9015
+ queryParts.push("".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(value)));
9016
+ });
9017
+ return queryParts.join('&');
9018
+ };
9019
+ var isAbsoluteUrl = function isAbsoluteUrl(url) {
9020
+ return /^https?:\/\//.test(url);
9021
+ };
9022
+ var buildUrl = function buildUrl(baseURL, url, params) {
9023
+ var queryString = serializeParams(params);
9024
+ var requestUrl = isAbsoluteUrl(url) ? url : "".concat(baseURL).concat(url);
9025
+ if (!queryString) {
9026
+ return requestUrl;
9027
+ }
9028
+ return "".concat(requestUrl).concat(requestUrl.includes('?') ? '&' : '?').concat(queryString);
9029
+ };
9030
+ var isPlainObject = function isPlainObject(value) {
9031
+ return Object.prototype.toString.call(value) === '[object Object]';
9032
+ };
9033
+ var buildBody = function buildBody(data, headers) {
9034
+ if (data === undefined || data === null) {
9035
+ return undefined;
9036
+ }
9037
+ if (data instanceof FormData || data instanceof Blob || typeof data === 'string') {
9038
+ return data;
9039
+ }
9040
+ if (isPlainObject(data) || Array.isArray(data)) {
9041
+ if (!headers['Content-Type']) {
9042
+ headers['Content-Type'] = 'application/json';
9043
+ }
9044
+ return JSON.stringify(data);
9045
+ }
9046
+ return data;
9047
+ };
9048
+ var parseResponse = /*#__PURE__*/function () {
9049
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(response) {
9050
+ var contentType, text;
9051
+ return _regeneratorRuntime.wrap(function (_context) {
9052
+ while (1) switch (_context.prev = _context.next) {
9053
+ case 0:
9054
+ contentType = response.headers.get('content-type') || '';
9055
+ if (!contentType.includes('application/json')) {
9056
+ _context.next = 1;
9057
+ break;
9058
+ }
9059
+ return _context.abrupt("return", response.json());
9060
+ case 1:
9061
+ _context.next = 2;
9062
+ return response.text();
9063
+ case 2:
9064
+ text = _context.sent;
9065
+ if (text) {
9066
+ _context.next = 3;
9067
+ break;
9068
+ }
9069
+ return _context.abrupt("return", {});
9070
+ case 3:
9071
+ _context.prev = 3;
9072
+ return _context.abrupt("return", JSON.parse(text));
9073
+ case 4:
9074
+ _context.prev = 4;
9075
+ _context["catch"](3);
9076
+ return _context.abrupt("return", {
9077
+ data: text
9078
+ });
9079
+ case 5:
9080
+ case "end":
9081
+ return _context.stop();
9082
+ }
9083
+ }, _callee, null, [[3, 4]]);
9084
+ }));
9085
+ return function parseResponse(_x) {
9086
+ return _ref.apply(this, arguments);
9087
+ };
9088
+ }();
9089
+ var createTimeoutError = function createTimeoutError(timeout) {
9090
+ var error = new Error("timeout of ".concat(timeout, "ms exceeded"));
9091
+ error.name = 'TimeoutError';
9092
+ return error;
9093
+ };
9094
+ var request = /*#__PURE__*/function () {
9095
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(config) {
9096
+ 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;
9097
+ return _regeneratorRuntime.wrap(function (_context2) {
9098
+ while (1) switch (_context2.prev = _context2.next) {
9099
+ case 0:
9100
+ 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;
9101
+ if (!isIgnoreLoading) {
9102
+ showRequestLoading();
9103
+ }
9104
+ requestHeaders = _objectSpread$2(_objectSpread$2({}, options.headers), headers);
9105
+ timeoutId = null;
9106
+ _context2.prev = 1;
9107
+ fetchPromise = fetch(buildUrl(baseURL, url, params), {
9108
+ method: normalizeMethod(method),
9109
+ headers: requestHeaders,
9110
+ body: normalizeMethod(method) === 'GET' ? undefined : buildBody(data, requestHeaders),
9111
+ credentials: withCredentials ? 'include' : 'same-origin'
9112
+ });
9113
+ _context2.next = 2;
9114
+ return Promise.race([fetchPromise, new Promise(function (resolve, reject) {
9115
+ timeoutId = setTimeout(function () {
9116
+ reject(createTimeoutError(timeout));
9117
+ }, timeout);
9118
+ })]);
9119
+ case 2:
9120
+ response = _context2.sent;
9121
+ _context2.next = 3;
9122
+ return parseResponse(response);
9123
+ case 3:
9124
+ res = _context2.sent;
9125
+ if (response.ok) {
9126
+ _context2.next = 4;
9127
+ break;
9128
+ }
9129
+ error = new Error("Request failed with status code ".concat(response.status));
9130
+ error.response = {
9131
+ status: response.status,
9132
+ data: res
9133
+ };
9134
+ throw error;
9135
+ case 4:
9136
+ code = res.code;
9137
+ if (!['002012', '002013', '002015'].includes(code)) {
9138
+ _context2.next = 5;
9139
+ break;
9140
+ }
9141
+ messageMap = {
9142
+ m002012: '当前账号因操作频繁被限制,请明天再试。感谢理解',
9143
+ m002013: '您的操作频率较高,已达到今日生成上限。请稍后再试或明天继续使用,感谢您的理解!',
9144
+ m002015: '您今天做了太多计划书了,休息一下,明天再来吧'
9145
+ };
9146
+ message = messageMap["m".concat(code)];
9147
+ if (message) {
9148
+ _Dialog.alert({
9149
+ message: message,
9150
+ confirmButtonText: '知道了',
9151
+ confirmButtonColor: '#0A64FE'
9152
+ });
9153
+ }
9154
+ return _context2.abrupt("return", Promise.reject({
9155
+ code: code,
9156
+ message: message
9157
+ }));
9158
+ case 5:
9159
+ if (!(code === 401 || res.status === 401)) {
9160
+ _context2.next = 6;
9161
+ break;
9162
+ }
9163
+ gotoLogin();
9164
+ return _context2.abrupt("return", Promise.reject('status: 401'));
9165
+ case 6:
9166
+ if (!(res.success && res.data === -1)) {
9167
+ _context2.next = 7;
9168
+ break;
9169
+ }
9170
+ gotoLogin();
9171
+ return _context2.abrupt("return", Promise.reject('login: -1'));
9172
+ case 7:
9173
+ return _context2.abrupt("return", returnFullResponse ? res : res.data);
9174
+ case 8:
9175
+ _context2.prev = 8;
9176
+ _t2 = _context2["catch"](1);
9177
+ if (_t2.response && _t2.response.status == 401) {
9178
+ gotoLogin();
9179
+ }
9180
+ return _context2.abrupt("return", Promise.reject(_t2));
9181
+ case 9:
9182
+ _context2.prev = 9;
9183
+ if (timeoutId) {
9184
+ clearTimeout(timeoutId);
9185
+ }
9186
+ hideRequestLoading();
9187
+ return _context2.finish(9);
9188
+ case 10:
9189
+ case "end":
9190
+ return _context2.stop();
9191
+ }
9192
+ }, _callee2, null, [[1, 8, 9, 10]]);
9193
+ }));
9194
+ return function request(_x2) {
9195
+ return _ref2.apply(this, arguments);
9196
+ };
9197
+ }();
9198
+
9199
+ function validateAdjustBaoe(params) {
9200
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
9201
+ return request({
9202
+ url: "/planBook/".concat(options.publicPbUuid ? 'public' : 'V2', "/validateAccount/-1/low"),
9203
+ method: 'post',
9204
+ data: QS.stringify({
9205
+ jd: JSON.stringify(params)
9206
+ }),
9207
+ headers: {
9208
+ Accept: 'application/json, text/plain, */*',
9209
+ 'Content-Type': 'application/x-www-form-urlencoded'
9210
+ }
9211
+ });
9212
+ }
9213
+
9214
+ document && document.cookie && document.cookie.match('ENABLE_LIZHAO_DEBUG=1');
9215
+
9216
+ /**
9217
+ * **将对象下的 eleOrderList 数组中的子元素下的 value,转换为 key-value 键值对**
9218
+ * @author Lizhao <lz@winbaoxian.com>
9219
+ * @date 2022-04-25
9220
+ * @param {any} obj 必传。带eleOrderList数组的对象。如人员数据、产品数据
9221
+ * @example
9222
+ * convertEleOrderListToObj({
9223
+ "key": "insuredInfo"
9224
+ "eleOrderList": [
9225
+ { "value": true, "key": "title" },
9226
+ { "value": 1, "key": "sex" },
9227
+ { "value": 30, "key": "age" },
9228
+ { "value": "2020/10/23", "key": "insuranceDay" }
9229
+ ]
9230
+ })
9231
+ // returns
9232
+ // {
9233
+ // "key": "insuredInfo",
9234
+ // "title": true,
9235
+ // "sex": 1,
9236
+ // "age": 30,
9237
+ // "insuranceDay": "2020/10/23",
9238
+ // }
9239
+ * @returns {any}
9240
+ */
9241
+ function convertEleOrderListToObj(obj) {
9242
+ var resData = {};
9243
+ var _loop = function _loop(k) {
9244
+ if (k == 'eleOrderList') {
9245
+ obj[k].map(function (ele) {
9246
+ resData[ele.key] = ele.value;
9247
+ });
9248
+ } else {
9249
+ // eleOrderList中有的key,则不取当前对象下的属性
9250
+ if (!obj.eleOrderList || obj.eleOrderList.every(function (e) {
9251
+ return e.key !== k;
9252
+ })) {
9253
+ resData[k] = obj[k];
9254
+ }
9255
+ }
9256
+ };
9257
+ for (var k in obj) {
9258
+ _loop(k);
9259
+ }
9260
+ return resData;
9261
+ }
9262
+
9263
+ /**
9264
+ * **转换人员数据**
9265
+ * @author Lizhao <lz@winbaoxian.com>
9266
+ * @date 2022-04-26
9267
+ * @param {IPbPersons} allPersonsData 必传。所有人员数据
9268
+ * @param {null|string|string[]} type 可不传。
9269
+ * 不传,人员数据按原结构返回;
9270
+ * 字符串,返回指定的人员数据;
9271
+ * 数组,以数组形式,返回多个人员数据。
9272
+ * @returns {any} 人员数据(单个或多个)
9273
+ */
9274
+ function convertPersonData(allPersonsData) {
9275
+ var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
9276
+ var cPersonData = {};
9277
+ if (allPersonsData) {
9278
+ //转换收件人信息
9279
+ if (allPersonsData.recipientInfo) {
9280
+ cPersonData.recipientInfo = convertEleOrderListToObj(allPersonsData.recipientInfo);
9281
+ }
9282
+ //转换被、投、投保人配偶的信息
9283
+ if (allPersonsData.personOrderList) {
9284
+ allPersonsData.personOrderList.forEach(function (person) {
9285
+ cPersonData[person.key] = convertEleOrderListToObj(person);
9286
+ });
9287
+ }
9288
+ }
9289
+ if (!type) {
9290
+ return {
9291
+ recipientInfo: cPersonData.recipientInfo,
9292
+ personOrderList: allPersonsData.personOrderList && allPersonsData.personOrderList.map(function (p) {
9293
+ return p.key;
9294
+ }).map(function (p) {
9295
+ return cPersonData[p];
9296
+ })
9297
+ };
9298
+ }
9299
+ if (typeof type === 'string') {
9300
+ return cPersonData[type];
9301
+ }
9302
+ if (type.constructor === Array) {
9303
+ var temp = [];
9304
+ for (var k in cPersonData) {
9305
+ if (type.indexOf(k) !== -1) {
9306
+ temp.push(cPersonData[k]);
9307
+ }
9308
+ }
9309
+ return temp;
9310
+ }
9311
+ }
9312
+
9313
+ function getPlanbookInsuranceVerifyData(params) {
9314
+ return request({
9315
+ baseURL: APP_HOSTNAME,
9316
+ url: '/planBook/input/insurance/verifyData',
9317
+ method: 'post',
9318
+ data: params,
9319
+ headers: {
9320
+ Accept: 'application/json, text/plain, */*',
9321
+ 'Content-Type': 'application/json;'
9322
+ }
9323
+ });
9324
+ }
9325
+
9044
9326
  function ownKeys$1(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; }
9045
9327
  function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), true).forEach(function (r) { _defineProperty$1(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
9046
9328
 
@@ -9053,25 +9335,7 @@
9053
9335
  * @returns {Promise<any>} 产品下所有险种的费率
9054
9336
  */
9055
9337
  lodash.memoize(function (params) {
9056
- var url = "".concat(APP_HOSTNAME, "/planBook/input/insurance/verifyData");
9057
- return fetch(url, {
9058
- method: 'POST',
9059
- credentials: 'include',
9060
- headers: {
9061
- Accept: 'application/json, text/plain, */*',
9062
- 'Content-Type': 'application/json;'
9063
- },
9064
- body: JSON.stringify(params)
9065
- }).then(function (response) {
9066
- return response.json();
9067
- }).then(function (_ref) {
9068
- var success = _ref.success,
9069
- data = _ref.data;
9070
- if (!success || !data) {
9071
- return Promise.reject();
9072
- }
9073
- return Promise.resolve(data);
9074
- }).catch(function () {});
9338
+ return getPlanbookInsuranceVerifyData(params).catch(function () {});
9075
9339
  }, function (params) {
9076
9340
  return QS.stringify(params);
9077
9341
  });
@@ -9119,7 +9383,7 @@
9119
9383
  checkedInsData[ele.key] = insuranceData[ele.key];
9120
9384
  }
9121
9385
  });
9122
- productData.mulInsOrderList.push(deepCopy(checkedInsData));
9386
+ productData.mulInsOrderList.push(lodash.cloneDeep(checkedInsData));
9123
9387
  }
9124
9388
  });
9125
9389
  return;
@@ -9345,44 +9609,27 @@
9345
9609
  delete ins[ele];
9346
9610
  });
9347
9611
  });
9348
- var url = "".concat(PLANBOOK_API_HOSTNAME, "/planBook/").concat(params.publicPbUuid ? 'public' : 'V2', "/validateAccount/-1/low");
9349
- return fetch(url, {
9350
- method: 'POST',
9351
- credentials: 'include',
9352
- headers: {
9353
- Accept: 'application/json, text/plain, */*',
9354
- 'Content-Type': 'application/x-www-form-urlencoded'
9612
+ return validateAdjustBaoe({
9613
+ insuranceTypeId: params.planbookId * 1,
9614
+ publicPbUuid: params.publicPbUuid,
9615
+ personData: {
9616
+ personOrderList: convertPersonData(personData, personData.personOrderList.map(function (p) {
9617
+ return p.key;
9618
+ }))
9355
9619
  },
9356
- body: QS.stringify({
9357
- jd: JSON.stringify({
9358
- insuranceTypeId: params.planbookId * 1,
9359
- publicPbUuid: params.publicPbUuid,
9360
- personData: {
9361
- personOrderList: convertPersonData(personData, personData.personOrderList.map(function (p) {
9362
- return p.key;
9363
- }))
9364
- },
9365
- productGroupList: [{
9366
- key: params.groupKey,
9367
- prodOrderList: [_objectSpread(_objectSpread({}, cloneProductData), {}, {
9368
- adjustBaoeData: this.adjustBaoeData
9369
- })]
9370
- }]
9371
- })
9372
- })
9373
- }).then(function (response) {
9374
- return response.json();
9375
- }).then(function (_ref) {
9376
- var success = _ref.success,
9377
- data = _ref.data,
9378
- info = _ref.info;
9379
- if (!success || !data || data === -1) {
9380
- _this5.adjustBaoeData = cloneAdjustBaoeData;
9381
- _this5.$toast(info);
9382
- return Promise.reject();
9383
- }
9384
- return Promise.resolve(data);
9620
+ productGroupList: [{
9621
+ key: params.groupKey,
9622
+ prodOrderList: [_objectSpread(_objectSpread({}, cloneProductData), {}, {
9623
+ adjustBaoeData: this.adjustBaoeData
9624
+ })]
9625
+ }]
9626
+ }, {
9627
+ publicPbUuid: params.publicPbUuid
9385
9628
  }).catch(function (err) {
9629
+ _this5.adjustBaoeData = cloneAdjustBaoeData;
9630
+ if (err) {
9631
+ _this5.$toast(err);
9632
+ }
9386
9633
  console.log(err);
9387
9634
  });
9388
9635
  }