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('vue'), require('lodash'), require('qs'), require('axios'), require('vant/lib/toast/index.css'), require('vant/lib/toast'), require('md5'), require('crypto-js')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'vue', 'lodash', 'qs', 'axios', 'vant/lib/toast/index.css', 'vant/lib/toast', 'md5', 'crypto-js'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BXT = {}, global.Vue, global._, global.QS, global.axios, null, global._Toast, global.md5, global.CryptoJS));
5
- })(this, (function (exports, Vue, lodash, QS, axios, index_css, _Toast, MD5, CryptoJS) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('lodash'), require('qs'), require('vant/lib/dialog/index.css'), require('vant/lib/dialog'), require('vant/lib/toast/index.css'), require('vant/lib/toast'), require('md5'), require('crypto-js')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'vue', 'lodash', 'qs', 'vant/lib/dialog/index.css', 'vant/lib/dialog', 'vant/lib/toast/index.css', 'vant/lib/toast', 'md5', 'crypto-js'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BXT = {}, global.Vue, global._, global.QS, null, global._Dialog, null, global._Toast, global.md5, global.CryptoJS));
5
+ })(this, (function (exports, Vue, lodash, QS, index_css, _Dialog, index_css$1, _Toast, MD5, CryptoJS) { 'use strict';
6
6
 
7
7
  function _typeof$2(o) {
8
8
  "@babel/helpers - typeof";
@@ -8911,12 +8911,27 @@
8911
8911
  var Jax = /*@__PURE__*/getDefaultExportFromCjs(jaxExports);
8912
8912
 
8913
8913
  var getStandardOrigin = Jax.urlUtil.getStandardOrigin;
8914
+ var _Jax$parseUaString = Jax.parseUaString();
8915
+ _Jax$parseUaString.isApp;
8916
+ _Jax$parseUaString.appType;
8917
+ var appVersion = _Jax$parseUaString.appVersion;
8918
+ _Jax$parseUaString.isAndroid;
8919
+ var isIos = _Jax$parseUaString.isIos;
8920
+ _Jax$parseUaString.isBxsApp;
8921
+ _Jax$parseUaString.isBaoXiaoZhuApp;
8922
+ _Jax$parseUaString.isBrokerApp;
8923
+ _Jax$parseUaString.isYjjApp;
8924
+ _Jax$parseUaString.isToBApp;
8925
+ _Jax$parseUaString.isRongYiBaoApp;
8926
+ _Jax$parseUaString.isWeChat;
8927
+ _Jax$parseUaString.appScheme;
8914
8928
  var hostname = window && window.location && window.location.hostname || '';
8915
8929
  /** 当前页 host 为 cppoc- 前缀时,请求 loading 使用 Vant Toast,否则走 appBridge */
8916
8930
  var IS_CPPOC_HOST = hostname.startsWith('cppoc-');
8917
8931
  var IS_PRODUCT_ENV = hostname.search(/(winbaoxian|ai-baoxiaozhu)\.com/) !== -1;
8918
8932
  hostname.search(/(winbaoxian|ai-baoxiaozhu)\.cn/) !== -1;
8919
8933
  hostname.search(/localhost|192\.168|127\.0\.0\.1|dev\.winbaoxian\.cn/) !== -1;
8934
+ var IS_LOCALHOST_IP_ENV = hostname.search(/192\.168/) !== -1;
8920
8935
  var IS_UAT_ENV = hostname.includes("pbf-uat.");
8921
8936
  var IS_ENABLE_DEBUG = !IS_PRODUCT_ENV;
8922
8937
  if (IS_ENABLE_DEBUG) {
@@ -8924,6 +8939,9 @@
8924
8939
  }
8925
8940
  hostname.includes('ai-baoxiaozhu') ? 'ai-baoxiaozhu' : 'winbaoxian';
8926
8941
  function getFullOrigin(data) {
8942
+ if (IS_LOCALHOST_IP_ENV) {
8943
+ return "https://".concat(data, ".winbaoxian.cn");
8944
+ }
8927
8945
  var _prefixDomain = IS_CPPOC_HOST ? 'cppoc-' : '';
8928
8946
  if (typeof data === 'string') {
8929
8947
  return getStandardOrigin("".concat(_prefixDomain).concat(data));
@@ -8946,6 +8964,278 @@
8946
8964
  return _searchStr ? QS.parse(_searchStr) : {};
8947
8965
  }
8948
8966
 
8967
+ function showLoading() {
8968
+ if (IS_CPPOC_HOST) {
8969
+ _Toast.loading({
8970
+ message: '加载中...',
8971
+ forbidClick: true
8972
+ });
8973
+ } else if (window.appBridge && window.appBridge.showLoading) {
8974
+ window.appBridge.showLoading();
8975
+ }
8976
+ }
8977
+ function hideLoading() {
8978
+ if (IS_CPPOC_HOST) {
8979
+ _Toast.clear();
8980
+ } else if (window.appBridge && window.appBridge.hideLoading) {
8981
+ window.appBridge.hideLoading();
8982
+ }
8983
+ }
8984
+
8985
+ 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; }
8986
+ 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; }
8987
+ var options = {
8988
+ baseURL: PLANBOOK_API_HOSTNAME,
8989
+ withCredentials: true,
8990
+ timeout: 10000,
8991
+ headers: {
8992
+ 'X-Requested-With': 'XMLHttpRequest'
8993
+ }
8994
+ };
8995
+ var loadingTimer = null;
8996
+ var showRequestLoading = function showRequestLoading() {
8997
+ if (loadingTimer) {
8998
+ clearTimeout(loadingTimer);
8999
+ }
9000
+ loadingTimer = setTimeout(function () {
9001
+ showLoading();
9002
+ }, 300);
9003
+ };
9004
+ var hideRequestLoading = function hideRequestLoading() {
9005
+ if (loadingTimer) {
9006
+ hideLoading();
9007
+ }
9008
+ if (loadingTimer) {
9009
+ clearTimeout(loadingTimer);
9010
+ }
9011
+ };
9012
+ var normalizeMethod = function normalizeMethod(method) {
9013
+ return (method || 'get').toUpperCase();
9014
+ };
9015
+ var serializeParams = function serializeParams(params) {
9016
+ if (!params) {
9017
+ return '';
9018
+ }
9019
+ var queryParts = [];
9020
+ Object.keys(params).forEach(function (key) {
9021
+ var value = params[key];
9022
+ if (value === undefined || value === null) {
9023
+ return;
9024
+ }
9025
+ if (Array.isArray(value)) {
9026
+ value.forEach(function (item) {
9027
+ queryParts.push("".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(item)));
9028
+ });
9029
+ return;
9030
+ }
9031
+ queryParts.push("".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(value)));
9032
+ });
9033
+ return queryParts.join('&');
9034
+ };
9035
+ var isAbsoluteUrl = function isAbsoluteUrl(url) {
9036
+ return /^https?:\/\//.test(url);
9037
+ };
9038
+ var buildUrl = function buildUrl(baseURL, url, params) {
9039
+ var queryString = serializeParams(params);
9040
+ var requestUrl = isAbsoluteUrl(url) ? url : "".concat(baseURL).concat(url);
9041
+ if (!queryString) {
9042
+ return requestUrl;
9043
+ }
9044
+ return "".concat(requestUrl).concat(requestUrl.includes('?') ? '&' : '?').concat(queryString);
9045
+ };
9046
+ var isPlainObject = function isPlainObject(value) {
9047
+ return Object.prototype.toString.call(value) === '[object Object]';
9048
+ };
9049
+ var buildBody = function buildBody(data, headers) {
9050
+ if (data === undefined || data === null) {
9051
+ return undefined;
9052
+ }
9053
+ if (data instanceof FormData || data instanceof Blob || typeof data === 'string') {
9054
+ return data;
9055
+ }
9056
+ if (isPlainObject(data) || Array.isArray(data)) {
9057
+ if (!headers['Content-Type']) {
9058
+ headers['Content-Type'] = 'application/json';
9059
+ }
9060
+ return JSON.stringify(data);
9061
+ }
9062
+ return data;
9063
+ };
9064
+ var parseResponse = /*#__PURE__*/function () {
9065
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(response) {
9066
+ var contentType, text;
9067
+ return _regeneratorRuntime.wrap(function (_context) {
9068
+ while (1) switch (_context.prev = _context.next) {
9069
+ case 0:
9070
+ contentType = response.headers.get('content-type') || '';
9071
+ if (!contentType.includes('application/json')) {
9072
+ _context.next = 1;
9073
+ break;
9074
+ }
9075
+ return _context.abrupt("return", response.json());
9076
+ case 1:
9077
+ _context.next = 2;
9078
+ return response.text();
9079
+ case 2:
9080
+ text = _context.sent;
9081
+ if (text) {
9082
+ _context.next = 3;
9083
+ break;
9084
+ }
9085
+ return _context.abrupt("return", {});
9086
+ case 3:
9087
+ _context.prev = 3;
9088
+ return _context.abrupt("return", JSON.parse(text));
9089
+ case 4:
9090
+ _context.prev = 4;
9091
+ _context["catch"](3);
9092
+ return _context.abrupt("return", {
9093
+ data: text
9094
+ });
9095
+ case 5:
9096
+ case "end":
9097
+ return _context.stop();
9098
+ }
9099
+ }, _callee, null, [[3, 4]]);
9100
+ }));
9101
+ return function parseResponse(_x) {
9102
+ return _ref.apply(this, arguments);
9103
+ };
9104
+ }();
9105
+ var createTimeoutError = function createTimeoutError(timeout) {
9106
+ var error = new Error("timeout of ".concat(timeout, "ms exceeded"));
9107
+ error.name = 'TimeoutError';
9108
+ return error;
9109
+ };
9110
+ var request = /*#__PURE__*/function () {
9111
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(config) {
9112
+ 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;
9113
+ return _regeneratorRuntime.wrap(function (_context2) {
9114
+ while (1) switch (_context2.prev = _context2.next) {
9115
+ case 0:
9116
+ 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;
9117
+ if (!isIgnoreLoading) {
9118
+ showRequestLoading();
9119
+ }
9120
+ requestHeaders = _objectSpread$2(_objectSpread$2({}, options.headers), headers);
9121
+ timeoutId = null;
9122
+ _context2.prev = 1;
9123
+ fetchPromise = fetch(buildUrl(baseURL, url, params), {
9124
+ method: normalizeMethod(method),
9125
+ headers: requestHeaders,
9126
+ body: normalizeMethod(method) === 'GET' ? undefined : buildBody(data, requestHeaders),
9127
+ credentials: withCredentials ? 'include' : 'same-origin'
9128
+ });
9129
+ _context2.next = 2;
9130
+ return Promise.race([fetchPromise, new Promise(function (resolve, reject) {
9131
+ timeoutId = setTimeout(function () {
9132
+ reject(createTimeoutError(timeout));
9133
+ }, timeout);
9134
+ })]);
9135
+ case 2:
9136
+ response = _context2.sent;
9137
+ _context2.next = 3;
9138
+ return parseResponse(response);
9139
+ case 3:
9140
+ res = _context2.sent;
9141
+ if (response.ok) {
9142
+ _context2.next = 4;
9143
+ break;
9144
+ }
9145
+ error = new Error("Request failed with status code ".concat(response.status));
9146
+ error.response = {
9147
+ status: response.status,
9148
+ data: res
9149
+ };
9150
+ throw error;
9151
+ case 4:
9152
+ code = res.code;
9153
+ if (!['002012', '002013', '002015'].includes(code)) {
9154
+ _context2.next = 5;
9155
+ break;
9156
+ }
9157
+ messageMap = {
9158
+ m002012: '当前账号因操作频繁被限制,请明天再试。感谢理解',
9159
+ m002013: '您的操作频率较高,已达到今日生成上限。请稍后再试或明天继续使用,感谢您的理解!',
9160
+ m002015: '您今天做了太多计划书了,休息一下,明天再来吧'
9161
+ };
9162
+ message = messageMap["m".concat(code)];
9163
+ if (message) {
9164
+ _Dialog.alert({
9165
+ message: message,
9166
+ confirmButtonText: '知道了',
9167
+ confirmButtonColor: '#0A64FE'
9168
+ });
9169
+ }
9170
+ return _context2.abrupt("return", Promise.reject({
9171
+ code: code,
9172
+ message: message
9173
+ }));
9174
+ case 5:
9175
+ if (!(code === 401 || res.status === 401)) {
9176
+ _context2.next = 6;
9177
+ break;
9178
+ }
9179
+ gotoLogin();
9180
+ return _context2.abrupt("return", Promise.reject('status: 401'));
9181
+ case 6:
9182
+ if (!(res.success && res.data === -1)) {
9183
+ _context2.next = 7;
9184
+ break;
9185
+ }
9186
+ gotoLogin();
9187
+ return _context2.abrupt("return", Promise.reject('login: -1'));
9188
+ case 7:
9189
+ return _context2.abrupt("return", returnFullResponse ? res : res.data);
9190
+ case 8:
9191
+ _context2.prev = 8;
9192
+ _t2 = _context2["catch"](1);
9193
+ if (_t2.response && _t2.response.status == 401) {
9194
+ gotoLogin();
9195
+ }
9196
+ return _context2.abrupt("return", Promise.reject(_t2));
9197
+ case 9:
9198
+ _context2.prev = 9;
9199
+ if (timeoutId) {
9200
+ clearTimeout(timeoutId);
9201
+ }
9202
+ hideRequestLoading();
9203
+ return _context2.finish(9);
9204
+ case 10:
9205
+ case "end":
9206
+ return _context2.stop();
9207
+ }
9208
+ }, _callee2, null, [[1, 8, 9, 10]]);
9209
+ }));
9210
+ return function request(_x2) {
9211
+ return _ref2.apply(this, arguments);
9212
+ };
9213
+ }();
9214
+
9215
+ function getPlanbookRecommendData(params) {
9216
+ return request({
9217
+ url: '/planBook/input/calculate/recommend',
9218
+ method: 'post',
9219
+ data: params,
9220
+ headers: {
9221
+ Accept: 'application/json, text/plain, */*',
9222
+ 'Content-Type': 'application/json;'
9223
+ }
9224
+ });
9225
+ }
9226
+ function getPlanbookInsuranceVerifyData(params) {
9227
+ return request({
9228
+ baseURL: APP_HOSTNAME,
9229
+ url: '/planBook/input/insurance/verifyData',
9230
+ method: 'post',
9231
+ data: params,
9232
+ headers: {
9233
+ Accept: 'application/json, text/plain, */*',
9234
+ 'Content-Type': 'application/json;'
9235
+ }
9236
+ });
9237
+ }
9238
+
8949
9239
  var enableLizhaoDebug = document && document.cookie && document.cookie.match('ENABLE_LIZHAO_DEBUG=1');
8950
9240
  function consoleLogWhenEnable() {
8951
9241
  if (enableLizhaoDebug) {
@@ -9089,45 +9379,6 @@
9089
9379
  return value >= 10000 && !(value % 10000) ? "".concat(value / 10000, "\u4E07") : value;
9090
9380
  }
9091
9381
 
9092
- /**
9093
- * **对象的深拷贝**
9094
- * @ignore
9095
- * @author Lizhao <lz@winbaoxian.com>
9096
- * @date 2022-04-25
9097
- * @param {object} obj - 必传
9098
- * @param {WeakMap} hash - 可不传
9099
- * @returns {object} 拷贝对象
9100
- */
9101
- function deepCopy(obj) {
9102
- var hash = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new WeakMap();
9103
- if (!obj || _typeof$2(obj) !== 'object') {
9104
- return obj;
9105
- }
9106
- if (hash.has(obj)) {
9107
- return hash.get(obj);
9108
- }
9109
- var newObj;
9110
- var Constructor = obj.constructor;
9111
- switch (Constructor) {
9112
- case RegExp:
9113
- newObj = new Constructor(obj);
9114
- break;
9115
- case Date:
9116
- newObj = new Constructor(obj.getTime());
9117
- break;
9118
- default:
9119
- newObj = new Constructor();
9120
- break;
9121
- }
9122
- hash.set(obj, newObj);
9123
- for (var key in obj) {
9124
- if (obj.hasOwnProperty(key)) {
9125
- newObj[key] = _typeof$2(obj[key]) === 'object' ? deepCopy(obj[key], hash) : obj[key];
9126
- }
9127
- }
9128
- return newObj;
9129
- }
9130
-
9131
9382
  /**
9132
9383
  * **根据生日算年龄**
9133
9384
  * @author Lizhao <lz@winbaoxian.com>
@@ -9156,6 +9407,9 @@
9156
9407
  }
9157
9408
  function getExpressionParamMap(personData, product, ins, options) {
9158
9409
  var map = {
9410
+ user: {},
9411
+ executeSource: null,
9412
+ // 执行:init-初始化 import-导入数据 userAction-用户操作 confirm-确认
9159
9413
  planbookId: null,
9160
9414
  // 计划书id
9161
9415
  productId: null,
@@ -9229,12 +9483,18 @@
9229
9483
  }
9230
9484
  }
9231
9485
  if (options) {
9486
+ if (options.user) {
9487
+ map.user = options.user;
9488
+ }
9232
9489
  if (options.planbookId) {
9233
9490
  map.planbookId = options.planbookId;
9234
9491
  }
9235
9492
  if (options.eventTarget) {
9236
9493
  map.t = options.eventTarget;
9237
9494
  }
9495
+ if (options.executeSource) {
9496
+ map.executeSource = options.executeSource;
9497
+ }
9238
9498
  }
9239
9499
  if (ins && ins.customVariableExp) {
9240
9500
  var exp = ins.customVariableExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'map.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'map.$2');
@@ -9405,8 +9665,8 @@
9405
9665
  return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray$1(r) || _nonIterableSpread();
9406
9666
  }
9407
9667
 
9408
- 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; }
9409
- 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; }
9668
+ 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; }
9669
+ 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; }
9410
9670
 
9411
9671
  /**
9412
9672
  * **处理险种数据**
@@ -9627,7 +9887,7 @@
9627
9887
  var insuranceInfo = convertEleOrderListToObj(insData);
9628
9888
  var insVerifyData;
9629
9889
  if (insuredInfo) {
9630
- insVerifyData = _objectSpread$2({
9890
+ insVerifyData = _objectSpread$1({
9631
9891
  sex: insuredInfo.sex,
9632
9892
  age: insuredInfo.age
9633
9893
  }, insuranceInfo);
@@ -9685,8 +9945,8 @@
9685
9945
  return errorMsg;
9686
9946
  }
9687
9947
 
9688
- 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; }
9689
- 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; }
9948
+ function ownKeys(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; }
9949
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty$1(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
9690
9950
 
9691
9951
  /**
9692
9952
  * **处理产品数据(单个)**
@@ -9718,36 +9978,22 @@
9718
9978
  */
9719
9979
  function _productDataHandler() {
9720
9980
  _productDataHandler = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(prodData, prodVerifyData, personData, parmas) {
9721
- var productVerifyData, _parmas$eventTarget, insuranceKey, elementKey, groupInsurance, groupInsuranceIdEle, subInsurances, hasProduct, hasVerifyData, hasPersonData, personOrderList, _prodData$mulInsOrder3;
9981
+ var _ref4, eventTarget, productVerifyData, insuranceKey, elementKey, groupInsurance, groupInsuranceIdEle, subInsurances, hasProduct, hasVerifyData, hasPersonData, personOrderList, _prodData$mulInsOrder3;
9722
9982
  return _regeneratorRuntime.wrap(function (_context) {
9723
9983
  while (1) switch (_context.prev = _context.next) {
9724
9984
  case 0:
9725
- if (prodData) {
9726
- _context.next = 1;
9985
+ if (!prodData) {
9986
+ _context.next = 2;
9727
9987
  break;
9728
9988
  }
9729
- return _context.abrupt("return", prodData);
9989
+ _ref4 = parmas || {}, eventTarget = _ref4.eventTarget;
9990
+ _context.next = 1;
9991
+ return getSingleInsurancesVerifyData(prodVerifyData, prodData, personData, parmas).catch(function () {});
9730
9992
  case 1:
9731
- productVerifyData = null;
9732
- if (prodData.multipleInsured) {
9733
- multipleInsuredHandler(personData);
9734
- }
9735
- if (!(prodData.feeValidateMode === 'single' || prodVerifyData && prodVerifyData.feeValidateMode === 'single')) {
9736
- _context.next = 3;
9737
- break;
9738
- }
9739
- _context.next = 2;
9740
- return getSingleInsurancesVerifyData(prodData, personData, parmas).catch(function () {});
9741
- case 2:
9742
9993
  productVerifyData = _context.sent;
9743
- _context.next = 4;
9744
- break;
9745
- case 3:
9746
- productVerifyData = prodVerifyData;
9747
- case 4:
9748
9994
  // 组合险种特殊处理:当用户点击组合险种的子险种选项时,将其他子险种的标题设置为未选中状态
9749
- if (parmas && parmas.eventTarget) {
9750
- _parmas$eventTarget = parmas.eventTarget, insuranceKey = _parmas$eventTarget.insuranceKey, elementKey = _parmas$eventTarget.elementKey;
9995
+ if (eventTarget) {
9996
+ insuranceKey = eventTarget.insuranceKey, elementKey = eventTarget.elementKey;
9751
9997
  if (insuranceKey && elementKey === 'insuranceId') {
9752
9998
  groupInsurance = (prodData.mulInsOrderList || []).find(function (ins) {
9753
9999
  return ins.key === insuranceKey;
@@ -9776,7 +10022,6 @@
9776
10022
  personOrderList = convertPersonData(personData, personData.personOrderList.map(function (p) {
9777
10023
  return p.key;
9778
10024
  }));
9779
- setCommonInfo(prodData);
9780
10025
  (_prodData$mulInsOrder3 = prodData.mulInsOrderList) === null || _prodData$mulInsOrder3 === void 0 || _prodData$mulInsOrder3.forEach(function (ins, ii, insList) {
9781
10026
  var _ins$eleOrderList;
9782
10027
  insuranceDataHandler(ins, prodData);
@@ -10010,8 +10255,9 @@
10010
10255
  }
10011
10256
  setGroupInsurance(prodData);
10012
10257
  isHideProduct(prodData, productVerifyData, personOrderList);
10258
+ case 2:
10013
10259
  return _context.abrupt("return", prodData);
10014
- case 5:
10260
+ case 3:
10015
10261
  case "end":
10016
10262
  return _context.stop();
10017
10263
  }
@@ -10019,32 +10265,34 @@
10019
10265
  }));
10020
10266
  return _productDataHandler.apply(this, arguments);
10021
10267
  }
10022
- function multipleInsuredHandler(personData) {
10023
- var personOrderList = personData.personOrderList;
10024
- if (!(personOrderList && personOrderList.length)) {
10025
- return null;
10026
- }
10027
- var insured2Info = personOrderList.find(function (p) {
10028
- return p.key === 'insured2Info';
10029
- });
10030
- if (!insured2Info) {
10031
- var insuredInfo = personOrderList.find(function (p) {
10032
- return p.key === 'insuredInfo';
10033
- });
10034
- var insuredIndex = personOrderList.findIndex(function (p) {
10035
- return p.key === 'insuredInfo';
10268
+ function multipleInsuredHandler(prodData, personData) {
10269
+ if (prodData && prodData.multipleInsured) {
10270
+ var personOrderList = personData.personOrderList;
10271
+ if (!(personOrderList && personOrderList.length)) {
10272
+ return null;
10273
+ }
10274
+ var insured2Info = personOrderList.find(function (p) {
10275
+ return p.key === 'insured2Info';
10036
10276
  });
10037
- if (insuredIndex >= 0) {
10038
- var person = lodash.cloneDeep(insuredInfo);
10039
- person.key = 'insured2Info';
10040
- person.eleOrderList.forEach(function (e) {
10041
- if (e.key === 'title') {
10042
- e.isDisabled = false;
10043
- e.value = true;
10044
- e.label = '第二被保人信息';
10045
- }
10277
+ if (!insured2Info) {
10278
+ var insuredInfo = personOrderList.find(function (p) {
10279
+ return p.key === 'insuredInfo';
10046
10280
  });
10047
- personOrderList.splice(insuredIndex + 1, 0, person);
10281
+ var insuredIndex = personOrderList.findIndex(function (p) {
10282
+ return p.key === 'insuredInfo';
10283
+ });
10284
+ if (insuredIndex >= 0) {
10285
+ var person = lodash.cloneDeep(insuredInfo);
10286
+ person.key = 'insured2Info';
10287
+ person.eleOrderList.forEach(function (e) {
10288
+ if (e.key === 'title') {
10289
+ e.isDisabled = false;
10290
+ e.value = true;
10291
+ e.label = '第二被保人信息';
10292
+ }
10293
+ });
10294
+ personOrderList.splice(insuredIndex + 1, 0, person);
10295
+ }
10048
10296
  }
10049
10297
  }
10050
10298
  return personData;
@@ -10059,63 +10307,67 @@
10059
10307
  * @param {IPbPersons} personData 必传。人员信息,包括被保人、投保人、投保人配偶
10060
10308
  * @returns 请求函数的 Promise
10061
10309
  */
10062
- function getSingleInsurancesVerifyData(prodData, personData) {
10063
- var _prodData$mulInsOrder, _prodData$mulInsOrder2;
10064
- var parmas = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
10065
- var personOrderList = personData.personOrderList;
10066
- if (!(personOrderList && personOrderList.length)) {
10067
- return null;
10068
- }
10069
- var pbId = prodData.isTemp || prodData.policyType === 'single_insurance' ? null : parmas.planbookId;
10070
- var productId = prodData.policyType === 'single_insurance' ? null : prodData.key;
10071
- // 险种对比,prodData 没有 feeValidateMode 字段。因此需要特殊处理。
10072
- // 险种对比,以险种为维度,其 prodData.key 就是险种id,不能当成正常产品id。因此需要特殊处理。
10073
- if (prodData.feeValidateMode !== 'single') {
10074
- productId = null;
10075
- }
10076
- var insuredList = personOrderList.filter(function (p) {
10077
- return ['insuredInfo', 'insured2Info'].includes(p.key);
10078
- }).filter(function (p) {
10079
- var _p$eleOrderList;
10080
- var title = (_p$eleOrderList = p.eleOrderList) === null || _p$eleOrderList === void 0 ? void 0 : _p$eleOrderList.find(function (e) {
10081
- return e.key === 'title';
10310
+ function getSingleInsurancesVerifyData(verifyData, prodData, personData) {
10311
+ var parmas = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
10312
+ var isSingleFeeValidateMode = prodData && prodData.feeValidateMode === 'single' || verifyData && verifyData.feeValidateMode === 'single';
10313
+ if (isSingleFeeValidateMode) {
10314
+ var _prodData$mulInsOrder, _prodData$mulInsOrder2;
10315
+ var personOrderList = personData.personOrderList;
10316
+ if (!(personOrderList && personOrderList.length)) {
10317
+ return null;
10318
+ }
10319
+ var pbId = prodData.isTemp || prodData.policyType === 'single_insurance' ? null : parmas.planbookId;
10320
+ var productId = prodData.policyType === 'single_insurance' ? null : prodData.key;
10321
+ // 险种对比,prodData 没有 feeValidateMode 字段。因此需要特殊处理。
10322
+ // 险种对比,以险种为维度,其 prodData.key 就是险种id,不能当成正常产品id。因此需要特殊处理。
10323
+ if (prodData.feeValidateMode !== 'single') {
10324
+ productId = null;
10325
+ }
10326
+ var insuredList = personOrderList.filter(function (p) {
10327
+ return ['insuredInfo', 'insured2Info'].includes(p.key);
10328
+ }).filter(function (p) {
10329
+ var _p$eleOrderList;
10330
+ var title = (_p$eleOrderList = p.eleOrderList) === null || _p$eleOrderList === void 0 ? void 0 : _p$eleOrderList.find(function (e) {
10331
+ return e.key === 'title';
10332
+ });
10333
+ return title && title.value || p.title;
10334
+ }).map(function (p) {
10335
+ var person = convertEleOrderListToObj(p);
10336
+ return {
10337
+ key: person.key,
10338
+ sex: person.sex,
10339
+ age: person.age
10340
+ };
10341
+ });
10342
+ var applicant = null;
10343
+ var applicantItem = personData.personOrderList.find(function (p) {
10344
+ return p.key === 'applicantInfo';
10345
+ });
10346
+ if (applicantItem) {
10347
+ var person = convertEleOrderListToObj(applicantItem);
10348
+ applicant = {
10349
+ key: person.key,
10350
+ sex: person.sex,
10351
+ age: person.age
10352
+ };
10353
+ }
10354
+ var insuranceIdList = prodData === null || prodData === void 0 || (_prodData$mulInsOrder = prodData.mulInsOrderList) === null || _prodData$mulInsOrder === void 0 ? void 0 : _prodData$mulInsOrder.map(function (ins) {
10355
+ return ins.key;
10356
+ }).filter(function (k) {
10357
+ return !['common'].includes(k);
10358
+ });
10359
+ prodData === null || prodData === void 0 || (_prodData$mulInsOrder2 = prodData.mulInsOrderList) === null || _prodData$mulInsOrder2 === void 0 || _prodData$mulInsOrder2.reduce(function (list, ins) {
10360
+ return ins.key === 'common' || ins.isGroup ? list : list.concat(ins.key);
10361
+ }, []);
10362
+ return getAndCacheInsurancesVerifyData({
10363
+ pbId: pbId,
10364
+ productId: productId,
10365
+ insuredList: insuredList,
10366
+ applicant: applicant,
10367
+ insuranceIdList: insuranceIdList
10082
10368
  });
10083
- return title && title.value || p.title;
10084
- }).map(function (p) {
10085
- var person = convertEleOrderListToObj(p);
10086
- return {
10087
- key: person.key,
10088
- sex: person.sex,
10089
- age: person.age
10090
- };
10091
- });
10092
- var applicant = null;
10093
- var applicantItem = personData.personOrderList.find(function (p) {
10094
- return p.key === 'applicantInfo';
10095
- });
10096
- if (applicantItem) {
10097
- var person = convertEleOrderListToObj(applicantItem);
10098
- applicant = {
10099
- key: person.key,
10100
- sex: person.sex,
10101
- age: person.age
10102
- };
10103
10369
  }
10104
- var insuranceIdList = prodData === null || prodData === void 0 || (_prodData$mulInsOrder = prodData.mulInsOrderList) === null || _prodData$mulInsOrder === void 0 ? void 0 : _prodData$mulInsOrder.map(function (ins) {
10105
- return ins.key;
10106
- }).filter(function (k) {
10107
- return !['common'].includes(k);
10108
- });
10109
- prodData === null || prodData === void 0 || (_prodData$mulInsOrder2 = prodData.mulInsOrderList) === null || _prodData$mulInsOrder2 === void 0 || _prodData$mulInsOrder2.reduce(function (list, ins) {
10110
- return ins.key === 'common' || ins.isGroup ? list : list.concat(ins.key);
10111
- }, []);
10112
- return getAndCacheInsurancesVerifyData({
10113
- pbId: pbId,
10114
- productId: productId,
10115
- insuredList: insuredList,
10116
- applicant: applicant,
10117
- insuranceIdList: insuranceIdList
10118
- });
10370
+ return Promise.resolve(verifyData);
10119
10371
  }
10120
10372
 
10121
10373
  /**
@@ -10127,25 +10379,7 @@
10127
10379
  * @returns {Promise<any>} 产品下所有险种的费率
10128
10380
  */
10129
10381
  var getAndCacheInsurancesVerifyData = lodash.memoize(function (params) {
10130
- var url = "".concat(APP_HOSTNAME, "/planBook/input/insurance/verifyData");
10131
- return fetch(url, {
10132
- method: 'POST',
10133
- credentials: 'include',
10134
- headers: {
10135
- Accept: 'application/json, text/plain, */*',
10136
- 'Content-Type': 'application/json;'
10137
- },
10138
- body: JSON.stringify(params)
10139
- }).then(function (response) {
10140
- return response.json();
10141
- }).then(function (_ref) {
10142
- var success = _ref.success,
10143
- data = _ref.data;
10144
- if (!success || !data) {
10145
- return Promise.reject();
10146
- }
10147
- return Promise.resolve(data);
10148
- }).catch(function () {});
10382
+ return getPlanbookInsuranceVerifyData(params).catch(function () {});
10149
10383
  }, function (params) {
10150
10384
  return QS.stringify(params);
10151
10385
  });
@@ -10156,10 +10390,10 @@
10156
10390
  var insuranceInfo = {};
10157
10391
  insurances.forEach(function (ins) {
10158
10392
  if (['common', option.insuranceKey].includes(ins.key)) {
10159
- insuranceInfo = _objectSpread$1(_objectSpread$1({}, insuranceInfo), convertEleOrderListToObj(ins));
10393
+ insuranceInfo = _objectSpread(_objectSpread({}, insuranceInfo), convertEleOrderListToObj(ins));
10160
10394
  }
10161
10395
  });
10162
- insuranceInfo = _objectSpread$1(_objectSpread$1({}, insuranceInfo), option);
10396
+ insuranceInfo = _objectSpread(_objectSpread({}, insuranceInfo), option);
10163
10397
  var temp = verify;
10164
10398
  var hasElementKey = verify.key === option.elementKey;
10165
10399
  while (temp && temp.key && temp.key !== option.elementKey) {
@@ -10179,53 +10413,6 @@
10179
10413
  return temp ? [temp] : null;
10180
10414
  }
10181
10415
 
10182
- /**
10183
- * **提取产品中的通用信息**
10184
- * - 将产品下所有险种中 [common: true] 的元素,提取到一个新险种下(险种[key: common]),并作为产品的第一个险种。
10185
- * @ignore
10186
- * @author Lizhao <lz@winbaoxian.com>
10187
- * @date 2022-04-26
10188
- * @param {IPbProduct} prodData 必传。产品数据(单个)
10189
- * @returns {IPbProduct} 产品数据(单个)
10190
- */
10191
- function setCommonInfo(prodData) {
10192
- if (!prodData || !prodData.mulInsOrderList) {
10193
- return prodData;
10194
- }
10195
- var common = {
10196
- key: 'common',
10197
- eleOrderList: []
10198
- };
10199
- prodData.mulInsOrderList.forEach(function (ins) {
10200
- if (!ins.eleOrderList) {
10201
- return;
10202
- }
10203
- ins.eleOrderList.forEach(function (ele) {
10204
- if (ele.common && common.eleOrderList.every(function (e) {
10205
- return e.key !== ele.key;
10206
- })) {
10207
- common.eleOrderList.push(ele);
10208
- }
10209
- });
10210
- ins.eleOrderList = ins.eleOrderList.filter(function (ele) {
10211
- return !ele.common;
10212
- });
10213
- });
10214
- // 把通用信息当作一个险种,做为产品险种列表的第一个险种
10215
- if (!common.eleOrderList.length) {
10216
- return prodData;
10217
- }
10218
- prodData.mulInsOrderList = prodData.mulInsOrderList.filter(function (ins) {
10219
- return ins.key !== 'common';
10220
- });
10221
- prodData.mulInsOrderList.unshift(common);
10222
- // 通用信息,与跟随其后的险种不留间距
10223
- if (prodData.mulInsOrderList[1]) {
10224
- prodData.mulInsOrderList[1].isFollowing = true;
10225
- }
10226
- return prodData;
10227
- }
10228
-
10229
10416
  /**
10230
10417
  * **创建或更新组合险**
10231
10418
  * - 组合险是虚拟的险种,是为了解决特殊场景:多个险种,只能同时选中一个。
@@ -10350,7 +10537,7 @@
10350
10537
  }
10351
10538
  }
10352
10539
  }
10353
- var index = mulInsOrderList.findLastIndex(function (ins) {
10540
+ var index = lodash.findLastIndex(mulInsOrderList, function (ins) {
10354
10541
  return ins.groupKey === k;
10355
10542
  });
10356
10543
  if (index >= 0) {
@@ -10372,21 +10559,21 @@
10372
10559
  * @author Lizhao <lz@winbaoxian.com>
10373
10560
  * @date 2022-04-26
10374
10561
  * @param {IPbProduct} prodData 必传。产品数据(单个)
10375
- * @param {object} productVerifyData 必传。产品限制条件(单个)
10562
+ * @param {object} prodVerifyData 必传。产品限制条件(单个)
10376
10563
  * @param {IPbPerson} personOrderList 必传。转换后的人员信息,包括被保人、投保人、投保人配偶
10377
10564
  * @returns {object} 产品数据(单个)
10378
10565
  */
10379
- function isHideProduct(prodData, productVerifyData, personOrderList) {
10566
+ function isHideProduct(prodData, prodVerifyData, personOrderList) {
10380
10567
  var ageRangeProd = {};
10381
- if (prodData && productVerifyData && Object.keys(productVerifyData).length && personOrderList) {
10568
+ if (prodData && prodVerifyData && Object.keys(prodVerifyData).length && personOrderList) {
10382
10569
  if (prodData.mulInsOrderList) {
10383
10570
  // 产品中是否有必选险种且有费率
10384
10571
  var hasRequiredIns = prodData.mulInsOrderList.some(function (ins) {
10385
- return !!ins.required && productVerifyData[ins.key];
10572
+ return !!ins.required && prodVerifyData[ins.key];
10386
10573
  });
10387
10574
  prodData.mulInsOrderList.forEach(function (ins) {
10388
10575
  // 当前险种的限制条件
10389
- var insuranceVerifyData = productVerifyData[ins.key];
10576
+ var insuranceVerifyData = prodVerifyData[ins.key];
10390
10577
  if (insuranceVerifyData) {
10391
10578
  // 产品年龄范围取各险种最大范围
10392
10579
  if ((!ins.huomian || ins.huomian == 'beiHuomian') && (!hasRequiredIns || hasRequiredIns && ins.required)) {
@@ -10398,11 +10585,11 @@
10398
10585
  }
10399
10586
  });
10400
10587
  }
10401
- var _ref2 = personOrderList.find(function (p) {
10588
+ var _ref = personOrderList.find(function (p) {
10402
10589
  return p.key === 'insuredInfo';
10403
10590
  }),
10404
- sex = _ref2.sex,
10405
- age = _ref2.age;
10591
+ sex = _ref.sex,
10592
+ age = _ref.age;
10406
10593
  if (ageRangeProd[sex] && age >= ageRangeProd[sex][0] && age <= ageRangeProd[sex][1]) {
10407
10594
  prodData.hide = false;
10408
10595
  } else {
@@ -10428,11 +10615,11 @@
10428
10615
  * @param {IInsElement} params.eleData 可不传。元素数据,当前交互的元素(如:用户修改了该险种的交费期间)
10429
10616
  * @returns {string} 校验结果。空表示校验通过
10430
10617
  */
10431
- function verifyProductRules(_ref3) {
10432
- var personData = _ref3.personData,
10433
- productData = _ref3.productData,
10434
- insData = _ref3.insData,
10435
- eleData = _ref3.eleData;
10618
+ function verifyProductRules(_ref2) {
10619
+ var personData = _ref2.personData,
10620
+ productData = _ref2.productData,
10621
+ insData = _ref2.insData,
10622
+ eleData = _ref2.eleData;
10436
10623
  var errorMsg = '';
10437
10624
  var personOrderList = convertPersonData(personData, personData.personOrderList.map(function (p) {
10438
10625
  return p.key;
@@ -10478,11 +10665,11 @@
10478
10665
  * @param {eleData} params.eleData 可不传。元素数据,当前交互的元素(如:用户修改了该险种的交费期间)
10479
10666
  * @returns {string} 校验结果。空表示校验通过
10480
10667
  */
10481
- function restrictInsurancesInProduct(_ref4) {
10482
- var personOrderList = _ref4.personOrderList,
10483
- productData = _ref4.productData,
10484
- insData = _ref4.insData,
10485
- eleData = _ref4.eleData;
10668
+ function restrictInsurancesInProduct(_ref3) {
10669
+ var personOrderList = _ref3.personOrderList,
10670
+ productData = _ref3.productData,
10671
+ insData = _ref3.insData,
10672
+ eleData = _ref3.eleData;
10486
10673
  var errorMsg = '';
10487
10674
  var restrictList = productData.restrictList;
10488
10675
  if (restrictList && restrictList.length) {
@@ -10491,16 +10678,16 @@
10491
10678
  return p.key === 'insuredInfo';
10492
10679
  });
10493
10680
  var productInfo = convertProductData(productData);
10494
- var prodVerifyData = {
10681
+ var evalVerifyMap = {
10495
10682
  age: insuredInfo.age,
10496
10683
  sex: insuredInfo.sex,
10497
10684
  common: productInfo.common
10498
10685
  };
10499
10686
  productInfo.mulInsOrderList.forEach(function (ins) {
10500
- prodVerifyData['i' + ins.key] = ins;
10687
+ evalVerifyMap['i' + ins.key] = ins;
10501
10688
  });
10502
- restrict.rCondition = restrict.rCondition.replace(/(%)(\d+)(\.*\w*)(%)/g, 'prodVerifyData.i$2$3');
10503
- restrict.rCondition = restrict.rCondition.replace(/(%)(\w*\.*\w*)(%)/g, 'prodVerifyData.$2');
10689
+ restrict.rCondition = restrict.rCondition.replace(/(%)(\d+)(\.*\w*)(%)/g, 'evalVerifyMap.i$2$3');
10690
+ restrict.rCondition = restrict.rCondition.replace(/(%)(\w*\.*\w*)(%)/g, 'evalVerifyMap.$2');
10504
10691
  var curIns = productData.mulInsOrderList.find(function (ins) {
10505
10692
  return ins.key === restrict.rInsKey;
10506
10693
  });
@@ -10550,8 +10737,8 @@
10550
10737
  var rangeSelect = eval(restrict.rCondition);
10551
10738
  if (rangeSelect !== undefined && rangeSelect !== null) {
10552
10739
  curEle.opts.forEach(function (opt) {
10553
- var optNum = getNumberFromYear(opt.val, prodVerifyData.age);
10554
- var rangeSelectNum = rangeSelect.constructor === Array ? [rangeSelect[0] && getNumberFromYear(rangeSelect[0], prodVerifyData.age), rangeSelect[1] && getNumberFromYear(rangeSelect[1], prodVerifyData.age)] : getNumberFromYear(rangeSelect, prodVerifyData.age);
10740
+ var optNum = getNumberFromYear(opt.val, evalVerifyMap.age);
10741
+ var rangeSelectNum = rangeSelect.constructor === Array ? [rangeSelect[0] && getNumberFromYear(rangeSelect[0], evalVerifyMap.age), rangeSelect[1] && getNumberFromYear(rangeSelect[1], evalVerifyMap.age)] : getNumberFromYear(rangeSelect, evalVerifyMap.age);
10555
10742
  if (rangeSelect) {
10556
10743
  if (rangeSelect.constructor === Array) {
10557
10744
  opt.isHide = rangeSelect[0] && optNum < rangeSelectNum[0] || rangeSelect[1] && optNum > rangeSelectNum[1];
@@ -10578,7 +10765,7 @@
10578
10765
  case 3:
10579
10766
  {
10580
10767
  // 全局校验、或者点击的是约束元素、或者点击的是目标元素时,触发校验
10581
- if (!insData && !eleData || restrict.rInsKey === insData.key && restrict.rEleKey === eleData.key || restrict.rCondition.search("prodVerifyData.i".concat(insData.key, ".").concat(eleData.key)) !== -1) {
10768
+ if (!insData && !eleData || restrict.rInsKey === insData.key && restrict.rEleKey === eleData.key || restrict.rCondition.search("evalVerifyMap.i".concat(insData.key, ".").concat(eleData.key)) !== -1) {
10582
10769
  var rangeVal = eval(restrict.rCondition);
10583
10770
  if (rangeVal !== undefined && rangeVal !== null) {
10584
10771
  if (rangeVal.constructor === Array) {
@@ -10621,7 +10808,7 @@
10621
10808
  if (!prodData.mulInsOrderList) {
10622
10809
  return prodData;
10623
10810
  }
10624
- var productData = _objectSpread$1(_objectSpread$1({}, prodData), {}, {
10811
+ var productData = _objectSpread(_objectSpread({}, prodData), {}, {
10625
10812
  common: {},
10626
10813
  mulInsOrderList: []
10627
10814
  });
@@ -10647,7 +10834,7 @@
10647
10834
  checkedInsData[ele.key] = insuranceData[ele.key];
10648
10835
  }
10649
10836
  });
10650
- productData.mulInsOrderList.push(deepCopy(checkedInsData));
10837
+ productData.mulInsOrderList.push(lodash.cloneDeep(checkedInsData));
10651
10838
  }
10652
10839
  });
10653
10840
  return;
@@ -10658,128 +10845,18 @@
10658
10845
  return productData;
10659
10846
  }
10660
10847
 
10661
- /**
10662
- * **清空追加领取、减保领取、调整保额数据**
10663
- * @author Lizhao <lz@winbaoxian.com>
10664
- * @date 2022-04-26
10665
- * @param {IPbProduct} productData 产品数据
10666
- * @returns {IPbProduct} 产品数据
10667
- */
10668
- function clearAddAndTakeAndAdjustBaoeData(productData) {
10669
- if (!productData) {
10670
- return productData;
10671
- }
10672
- if (!productData.mulInsOrderList) {
10673
- return productData;
10674
- }
10675
- productData.adjustBaoeData = null;
10676
- productData.mulInsOrderList.forEach(function (ins) {
10677
- if (ins.accountData && ins.accountData.addAndTakeData) {
10678
- ins.accountData.addAndTakeData.forEach(function (aat) {
10679
- aat.adjustData = [];
10680
- });
10681
- }
10682
- if (ins.reduceBaof) {
10683
- if (ins.reduceBaofData) {
10684
- ins.reduceBaofData.addAndTakeData.forEach(function (aat) {
10685
- aat.adjustData = [];
10686
- });
10687
- }
10688
- if (ins.duplicateReduceBaofData) {
10689
- ins.duplicateReduceBaofData.addAndTakeData.forEach(function (aat) {
10690
- aat.adjustData = [];
10691
- });
10692
- }
10693
- }
10694
- });
10695
- return productData;
10696
- }
10697
-
10698
- function showLoading() {
10699
- if (IS_CPPOC_HOST) {
10700
- _Toast.loading({
10701
- message: '加载中...',
10702
- forbidClick: true
10703
- });
10704
- } else if (window.appBridge && window.appBridge.showLoading) {
10705
- window.appBridge.showLoading();
10706
- }
10707
- }
10708
- function hideLoading() {
10709
- if (IS_CPPOC_HOST) {
10710
- _Toast.clear();
10711
- } else if (window.appBridge && window.appBridge.hideLoading) {
10712
- window.appBridge.hideLoading();
10713
- }
10714
- }
10715
-
10716
- // 创建axios实例
10717
- var service = axios.create({
10718
- baseURL: APP_HOSTNAME,
10719
- withCredentials: true,
10720
- timeout: 10000,
10721
- // 请求超时时间
10722
- headers: {
10723
- 'X-Requested-With': 'XMLHttpRequest'
10724
- }
10725
- });
10726
- var loadingTimer = null;
10727
- var loading = function loading(show) {
10728
- if (show) {
10729
- showLoading();
10730
- } else {
10731
- hideLoading();
10732
- }
10733
- };
10734
-
10735
- // request拦截器
10736
- service.interceptors.request.use(function (config) {
10737
- if (loadingTimer) clearTimeout(loadingTimer);
10738
- loadingTimer = setTimeout(function () {
10739
- loading(true);
10740
- }, 300);
10741
- return config;
10742
- }, function (error) {
10743
- // Do something with request error
10744
- console.log(error); // for debug
10745
- Promise.reject(error);
10746
- });
10747
-
10748
- // respone拦截器
10749
- service.interceptors.response.use(function (response) {
10750
- if (loadingTimer) clearTimeout(loadingTimer);
10751
- loading(false);
10752
- var res = response.data;
10753
- if (res.code === 401 || res.status === 401) {
10754
- // gotoLogin()
10755
- return Promise.reject('login');
10756
- }
10757
- return res;
10758
- }, function (error) {
10759
- if (loadingTimer) clearTimeout(loadingTimer);
10760
- loading(false);
10761
- if (error.response && error.response.status == 401) {
10762
- // gotoLogin()
10763
- return Promise.reject('login');
10764
- }
10765
- console.log('err' + error); // for debug
10766
- return Promise.reject(error);
10767
- });
10768
-
10769
- function ownKeys(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; }
10770
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty$1(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
10771
10848
  function createMd5Token(reqData, obj) {
10772
10849
  var personList = reqData.personData.personOrderList;
10773
10850
  var signInfo = {};
10774
10851
  if (reqData.insuranceTypeId !== null) {
10775
10852
  signInfo.insuranceTypeId = reqData.insuranceTypeId;
10776
10853
  }
10777
- var insuredInfo = personList.find(function (p) {
10854
+ var insuredInfo = personList.filter(function (p) {
10778
10855
  return p.key === 'insuredInfo';
10779
- });
10780
- var applicantInfo = personList.find(function (p) {
10856
+ })[0];
10857
+ var applicantInfo = personList.filter(function (p) {
10781
10858
  return p.key === 'applicantInfo';
10782
- });
10859
+ })[0];
10783
10860
  signInfo.insuredAge = insuredInfo.age * 1;
10784
10861
  signInfo.insuredSex = insuredInfo.sex * 1;
10785
10862
  if (applicantInfo) {
@@ -10826,80 +10903,164 @@
10826
10903
  // signMd5: MD5(signInfoTx)
10827
10904
  // }))
10828
10905
 
10829
- return CryptoJS.AES.encrypt(JSON.stringify(_objectSpread(_objectSpread({}, signInfo), {}, {
10830
- signMd5: MD5(signInfoTx)
10831
- })), CryptoJS.enc.Utf8.parse('67u3Dg5fcc06UntP'), {
10906
+ signInfo.signMd5 = MD5(signInfoTx);
10907
+ return CryptoJS.AES.encrypt(JSON.stringify(signInfo), CryptoJS.enc.Utf8.parse('67u3Dg5fcc06UntP'), {
10832
10908
  mode: CryptoJS.mode.ECB,
10833
10909
  padding: CryptoJS.pad.Pkcs7
10834
10910
  }).toString() || MD5(signInfoTx) || '20190929';
10835
10911
  }
10836
10912
 
10837
- function createdProductDataToCalc(inputData) {
10838
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
10839
- if (inputData && inputData.personData && inputData.productGroupList && inputData.productGroupList.length) {
10840
- var productData = getProductFromInputData(inputData, {
10841
- groupKey: options.groupKey,
10842
- productKey: options.productKey
10843
- });
10844
- var tempProductForm = convertProductData(productData);
10845
- // 过滤一些不必要的数据
10846
- var productForm = {};
10847
- for (var k in tempProductForm) {
10848
- if (!['hadChoice', 'hide', 'totalBaof', 'insShowArr', 'autoImport'].includes(k)) {
10849
- productForm[k] = tempProductForm[k];
10850
- }
10913
+ /**转换时间字符串
10914
+ * @Author Lizh
10915
+ * @DateTime 2020-04-16
10916
+ * @param {[type]} time [description]
10917
+ * @param {[type]} cFormat [description]
10918
+ * @return {[type]} [description]
10919
+ */
10920
+ function parseTime(time, cFormat) {
10921
+ if (arguments.length === 0) {
10922
+ return null;
10923
+ }
10924
+ var format = cFormat;
10925
+ var date;
10926
+ if (time === null) {
10927
+ return;
10928
+ } else if (_typeof$2(time) === 'object') {
10929
+ date = time;
10930
+ } else {
10931
+ if (('' + time).length === 10) time = parseInt(time) * 1000;
10932
+ date = new Date(time);
10933
+ }
10934
+ var formatObj = {
10935
+ y: date.getFullYear(),
10936
+ m: date.getMonth() + 1,
10937
+ d: date.getDate(),
10938
+ h: date.getHours(),
10939
+ i: date.getMinutes(),
10940
+ s: date.getSeconds(),
10941
+ a: date.getDay()
10942
+ };
10943
+ var timeStr = format.replace(/{(y|m|d|h|i|s|a)+}/g, function (result, key) {
10944
+ var value = formatObj[key];
10945
+ if (key === 'a') {
10946
+ return ['日', '一', '二', '三', '四', '五', '六'][value];
10851
10947
  }
10852
- if (productForm.mulInsOrderList) {
10853
- productForm.mulInsOrderList = productForm.mulInsOrderList.map(function (ins) {
10854
- var tempIns = {};
10855
- for (var _k2 in ins) {
10856
- if (!['isFollowing', 'pPeriodDesc', 'baoeDesc', 'baofDesc', 'iDurationDesc', 'accountData', 'reduceBaofData', 'duplicateReduceBaofData', 'isCheckbox', 'groupKey', 'groupName', 'customVariableExp', 'calcResultExp', 'revalidateFlag'].includes(_k2)) {
10857
- tempIns[_k2] = ins[_k2];
10858
- }
10859
- }
10860
- return tempIns;
10861
- });
10948
+ if (result.length > 0 && value < 10) {
10949
+ value = '0' + value;
10862
10950
  }
10951
+ return value || 0;
10952
+ });
10953
+ return timeStr;
10954
+ }
10955
+ function getSecurityToken(data) {
10956
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
10957
+ return createMd5Token(JSON.parse(data), options);
10958
+ }
10863
10959
 
10864
- // 产品是否有选中的险种
10865
- if (productForm && productForm.mulInsOrderList && productForm.mulInsOrderList.length) {
10866
- var errorMsg = verifyProductRules({
10867
- personData: inputData.personData,
10868
- productData: productData
10869
- });
10960
+ function createdProductDataToCalc(_x2) {
10961
+ return _createdProductDataToCalc.apply(this, arguments);
10962
+ }
10963
+ function _createdProductDataToCalc() {
10964
+ _createdProductDataToCalc = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(inputData) {
10965
+ var options,
10966
+ productData,
10967
+ tempProductForm,
10968
+ productForm,
10969
+ k,
10970
+ errorMsg,
10971
+ reqData,
10972
+ reqDataStr,
10973
+ signature,
10974
+ _args2 = arguments;
10975
+ return _regeneratorRuntime.wrap(function (_context2) {
10976
+ while (1) switch (_context2.prev = _context2.next) {
10977
+ case 0:
10978
+ options = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
10979
+ if (!(inputData && inputData.personData && inputData.productGroupList && inputData.productGroupList.length)) {
10980
+ _context2.next = 5;
10981
+ break;
10982
+ }
10983
+ productData = getProductFromInputData(inputData, {
10984
+ groupKey: options.groupKey,
10985
+ productKey: options.productKey
10986
+ });
10987
+ tempProductForm = convertProductData(productData); // 过滤一些不必要的数据
10988
+ productForm = {};
10989
+ for (k in tempProductForm) {
10990
+ if (!['hadChoice', 'hide', 'totalBaof', 'insShowArr', 'autoImport', 'restrictList', 'resultImport', 'adjustBaoeData'].includes(k)) {
10991
+ productForm[k] = tempProductForm[k];
10992
+ }
10993
+ }
10994
+ if (productForm.mulInsOrderList) {
10995
+ productForm.mulInsOrderList = productForm.mulInsOrderList.map(function (ins) {
10996
+ var tempIns = {};
10997
+ for (var _k2 in ins) {
10998
+ if (!['isFollowing', 'pPeriodDesc', 'baoeDesc', 'baofDesc', 'iDurationDesc', 'payModeDesc', 'payModePremiumDesc', 'accountData', 'reduceBaofData', 'duplicateReduceBaofData', 'isCheckbox', 'groupKey', 'groupName', 'shmInsData', 'totalBaof', 'customVariableExp',
10999
+ // 'calcResultExp', // 不能删除,后面有依赖
11000
+ 'revalidateFlag'].includes(_k2)) {
11001
+ tempIns[_k2] = ins[_k2];
11002
+ }
11003
+ }
11004
+ return tempIns;
11005
+ });
11006
+ }
10870
11007
 
10871
- // 清除产品中的一些不必要的险种数据
10872
- productForm.mulInsOrderList.forEach(function (ins) {
10873
- if (ins.shmInsData) {
10874
- delete ins.shmInsData;
10875
- }
10876
- });
10877
- var reqData = {
10878
- publicPbUuid: options.publicPbUuid || null,
10879
- insuranceTypeId: options.planbookId ? options.planbookId * 1 : null,
10880
- personData: {
10881
- personOrderList: convertPersonData(inputData.personData, inputData.personData.personOrderList.map(function (p) {
10882
- return p.key;
10883
- }))
10884
- },
10885
- productGroupList: [{
10886
- key: options.groupKey,
10887
- prodOrderList: [productForm] //转换后的产品数据
10888
- }]
10889
- };
10890
- return Promise.resolve({
10891
- errorMsg: errorMsg,
10892
- jd: JSON.stringify(reqData),
10893
- signature: createMd5Token(reqData, {
10894
- groupDataKey: options.groupKey
10895
- })
10896
- });
10897
- } else {
10898
- return Promise.reject('请选择险种');
10899
- }
10900
- } else {
10901
- return Promise.reject('请填写投保数据');
10902
- }
11008
+ // 产品是否有选中的险种
11009
+ if (!(productForm && productForm.policyType === 'online_trade')) {
11010
+ _context2.next = 1;
11011
+ break;
11012
+ }
11013
+ return _context2.abrupt("return", Promise.resolve({}));
11014
+ case 1:
11015
+ if (!(productForm && productForm.mulInsOrderList && productForm.mulInsOrderList.length)) {
11016
+ _context2.next = 3;
11017
+ break;
11018
+ }
11019
+ errorMsg = verifyProductRules({
11020
+ personData: inputData.personData,
11021
+ productData: productData
11022
+ });
11023
+ reqData = {
11024
+ publicPbUuid: options.publicPbUuid || null,
11025
+ insuranceTypeId: options.planbookId ? options.planbookId * 1 : null,
11026
+ personData: {
11027
+ personOrderList: convertPersonData(inputData.personData, inputData.personData.personOrderList.map(function (p) {
11028
+ return p.key;
11029
+ }))
11030
+ },
11031
+ productGroupList: [{
11032
+ key: options.groupKey,
11033
+ prodOrderList: [productForm] //转换后的产品数据
11034
+ }]
11035
+ };
11036
+ reqDataStr = JSON.stringify(reqData);
11037
+ _context2.next = 2;
11038
+ return getSecurityToken(reqDataStr, {
11039
+ groupDataKey: options.groupKey
11040
+ });
11041
+ case 2:
11042
+ signature = _context2.sent;
11043
+ return _context2.abrupt("return", Promise.resolve({
11044
+ errorMsg: errorMsg,
11045
+ jd: reqDataStr,
11046
+ signature: signature,
11047
+ clientVersion: appVersion,
11048
+ isIos: isIos
11049
+ }));
11050
+ case 3:
11051
+ return _context2.abrupt("return", Promise.reject('请选择险种'));
11052
+ case 4:
11053
+ _context2.next = 6;
11054
+ break;
11055
+ case 5:
11056
+ return _context2.abrupt("return", Promise.reject('请填写投保数据'));
11057
+ case 6:
11058
+ case "end":
11059
+ return _context2.stop();
11060
+ }
11061
+ }, _callee2);
11062
+ }));
11063
+ return _createdProductDataToCalc.apply(this, arguments);
10903
11064
  }
10904
11065
  function getProductFromInputData(inputData) {
10905
11066
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -10915,7 +11076,7 @@
10915
11076
  return product;
10916
11077
  }
10917
11078
 
10918
- var _dec$1, _dec2$1, _dec3$1, _dec4$1, _dec5$1, _dec6$1, _dec7$1, _dec8, _dec9, _dec0, _dec1, _dec10, _class$1, _class2$1, _descriptor$1, _descriptor2$1, _descriptor3$1, _descriptor4$1, _descriptor5$1, _descriptor6$1, _descriptor7, _descriptor8, _descriptor9, _descriptor0;
11079
+ var _dec$1, _dec2$1, _dec3$1, _dec4$1, _dec5$1, _dec6$1, _dec7$1, _dec8$1, _dec9, _dec0, _dec1, _dec10, _class$1, _class2$1, _descriptor$1, _descriptor2$1, _descriptor3$1, _descriptor4$1, _descriptor5$1, _descriptor6$1, _descriptor7$1, _descriptor8, _descriptor9, _descriptor0;
10919
11080
  function _callSuper$1(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$1() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
10920
11081
  function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function _isNativeReflectConstruct() { return !!t; })(); }
10921
11082
  var BxtTitleItem = (_dec$1 = Component({
@@ -10932,7 +11093,7 @@
10932
11093
  default: ''
10933
11094
  }), _dec7$1 = Prop({
10934
11095
  default: ''
10935
- }), _dec8 = Prop({
11096
+ }), _dec8$1 = Prop({
10936
11097
  default: ''
10937
11098
  }), _dec9 = Prop({
10938
11099
  default: ''
@@ -10958,7 +11119,7 @@
10958
11119
  _initializerDefineProperty(_this, "label", _descriptor4$1, _this);
10959
11120
  _initializerDefineProperty(_this, "code", _descriptor5$1, _this);
10960
11121
  _initializerDefineProperty(_this, "huomianTag", _descriptor6$1, _this);
10961
- _initializerDefineProperty(_this, "statusTag", _descriptor7, _this);
11122
+ _initializerDefineProperty(_this, "statusTag", _descriptor7$1, _this);
10962
11123
  _initializerDefineProperty(_this, "huomianTips", _descriptor8, _this);
10963
11124
  _initializerDefineProperty(_this, "disabled", _descriptor9, _this);
10964
11125
  _initializerDefineProperty(_this, "dataStatId", _descriptor0, _this);
@@ -11025,7 +11186,7 @@
11025
11186
  enumerable: true,
11026
11187
  writable: true,
11027
11188
  initializer: null
11028
- }), _descriptor7 = _applyDecoratedDescriptor(_class2$1.prototype, "statusTag", [_dec8], {
11189
+ }), _descriptor7$1 = _applyDecoratedDescriptor(_class2$1.prototype, "statusTag", [_dec8$1], {
11029
11190
  configurable: true,
11030
11191
  enumerable: true,
11031
11192
  writable: true,
@@ -11248,6 +11409,7 @@
11248
11409
 
11249
11410
  /* script */
11250
11411
  var __vue_script__$3 = script$2;
11412
+
11251
11413
  /* template */
11252
11414
  var __vue_render__$3 = function __vue_render__() {
11253
11415
  var _vm = this;
@@ -11326,29 +11488,6 @@
11326
11488
  staticRenderFns: __vue_staticRenderFns__$3
11327
11489
  }, __vue_inject_styles__$3, __vue_script__$3);
11328
11490
 
11329
- //
11330
- //
11331
- //
11332
- //
11333
- //
11334
- //
11335
- //
11336
- //
11337
- //
11338
- //
11339
- //
11340
- //
11341
- //
11342
- //
11343
- //
11344
- //
11345
- //
11346
- //
11347
- //
11348
- //
11349
- //
11350
- //
11351
-
11352
11491
  function initPickerConfig() {
11353
11492
  return {
11354
11493
  visible: false,
@@ -11457,6 +11596,7 @@
11457
11596
 
11458
11597
  /* script */
11459
11598
  var __vue_script__$2 = script$1;
11599
+
11460
11600
  /* template */
11461
11601
  var __vue_render__$2 = function __vue_render__() {
11462
11602
  var _vm = this;
@@ -11525,49 +11665,6 @@
11525
11665
  staticRenderFns: __vue_staticRenderFns__$2
11526
11666
  }, __vue_inject_styles__$2, __vue_script__$2);
11527
11667
 
11528
- /**转换时间字符串
11529
- * @Author Lizh
11530
- * @DateTime 2020-04-16
11531
- * @param {[type]} time [description]
11532
- * @param {[type]} cFormat [description]
11533
- * @return {[type]} [description]
11534
- */
11535
- function parseTime(time, cFormat) {
11536
- if (arguments.length === 0) {
11537
- return null;
11538
- }
11539
- var format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}';
11540
- var date;
11541
- if (time === null) {
11542
- return;
11543
- } else if (_typeof$2(time) === 'object') {
11544
- date = time;
11545
- } else {
11546
- if (('' + time).length === 10) time = parseInt(time) * 1000;
11547
- date = new Date(time);
11548
- }
11549
- var formatObj = {
11550
- y: date.getFullYear(),
11551
- m: date.getMonth() + 1,
11552
- d: date.getDate(),
11553
- h: date.getHours(),
11554
- i: date.getMinutes(),
11555
- s: date.getSeconds(),
11556
- a: date.getDay()
11557
- };
11558
- var timeStr = format.replace(/{(y|m|d|h|i|s|a)+}/g, function (result, key) {
11559
- var value = formatObj[key];
11560
- if (key === 'a') {
11561
- return ['日', '一', '二', '三', '四', '五', '六'][value];
11562
- }
11563
- if (result.length > 0 && value < 10) {
11564
- value = '0' + value;
11565
- }
11566
- return value || 0;
11567
- });
11568
- return timeStr;
11569
- }
11570
-
11571
11668
  var script = {
11572
11669
  components: {
11573
11670
  CommonSelect: __vue_component__$2
@@ -11671,6 +11768,7 @@
11671
11768
 
11672
11769
  /* script */
11673
11770
  var __vue_script__$1 = script;
11771
+
11674
11772
  /* template */
11675
11773
  var __vue_render__$1 = function __vue_render__() {
11676
11774
  var _vm = this;
@@ -11767,7 +11865,7 @@
11767
11865
  staticRenderFns: __vue_staticRenderFns__$1
11768
11866
  }, __vue_inject_styles__$1, __vue_script__$1);
11769
11867
 
11770
- var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6;
11868
+ var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7;
11771
11869
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: true } : { done: false, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = true, u = false; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = true, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
11772
11870
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
11773
11871
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
@@ -11790,12 +11888,16 @@
11790
11888
  return {};
11791
11889
  }
11792
11890
  }), _dec4 = Prop({
11793
- default: null
11891
+ default: function _default() {
11892
+ return {};
11893
+ }
11794
11894
  }), _dec5 = Prop({
11795
11895
  default: null
11796
11896
  }), _dec6 = Prop({
11797
- default: true
11897
+ default: null
11798
11898
  }), _dec7 = Prop({
11899
+ default: true
11900
+ }), _dec8 = Prop({
11799
11901
  default: function _default() {
11800
11902
  return {};
11801
11903
  }
@@ -11812,12 +11914,13 @@
11812
11914
  _defineProperty$1(_this, "recommendValues", {});
11813
11915
  _defineProperty$1(_this, "recommendValuesCache", {});
11814
11916
  _defineProperty$1(_this, "isShowCustomValueTips", true);
11815
- _initializerDefineProperty(_this, "inputData", _descriptor, _this);
11816
- _initializerDefineProperty(_this, "verifyData", _descriptor2, _this);
11817
- _initializerDefineProperty(_this, "groupKey", _descriptor3, _this);
11818
- _initializerDefineProperty(_this, "productKey", _descriptor4, _this);
11819
- _initializerDefineProperty(_this, "showRecommendValue", _descriptor5, _this);
11820
- _initializerDefineProperty(_this, "params", _descriptor6, _this);
11917
+ _initializerDefineProperty(_this, "user", _descriptor, _this);
11918
+ _initializerDefineProperty(_this, "inputData", _descriptor2, _this);
11919
+ _initializerDefineProperty(_this, "verifyData", _descriptor3, _this);
11920
+ _initializerDefineProperty(_this, "groupKey", _descriptor4, _this);
11921
+ _initializerDefineProperty(_this, "productKey", _descriptor5, _this);
11922
+ _initializerDefineProperty(_this, "showRecommendValue", _descriptor6, _this);
11923
+ _initializerDefineProperty(_this, "params", _descriptor7, _this);
11821
11924
  return _this;
11822
11925
  }
11823
11926
  _inherits(BxtProductInfo, _Vue);
@@ -11961,11 +12064,11 @@
11961
12064
  value: function () {
11962
12065
  var _changeProduct = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(productData, options) {
11963
12066
  var _this5 = this;
11964
- var $listeners, inputData, verifyData, personData, groupKey, productKey, params, type, insData, eleData, planbookId, publicPbUuid, productVerifyData, eventTarget, errorMsg;
12067
+ var $listeners, user, inputData, verifyData, personData, groupKey, productKey, params, type, insData, eleData, planbookId, publicPbUuid, productVerifyData, eventTarget, errorMsg;
11965
12068
  return _regeneratorRuntime.wrap(function (_context4) {
11966
12069
  while (1) switch (_context4.prev = _context4.next) {
11967
12070
  case 0:
11968
- $listeners = this.$listeners, inputData = this.inputData, verifyData = this.verifyData, personData = this.personData, groupKey = this.groupKey, productKey = this.productKey, params = this.params;
12071
+ $listeners = this.$listeners, user = this.user, inputData = this.inputData, verifyData = this.verifyData, personData = this.personData, groupKey = this.groupKey, productKey = this.productKey, params = this.params;
11969
12072
  type = options.type, insData = options.insData, eleData = options.eleData;
11970
12073
  planbookId = lodash.get(params, 'planbookId');
11971
12074
  publicPbUuid = lodash.get(params, 'publicPbUuid');
@@ -11975,12 +12078,14 @@
11975
12078
  insuranceCode: lodash.get(insData, 'code') || null,
11976
12079
  elementKey: lodash.get(eleData, 'key') || null
11977
12080
  };
11978
- if (type === 'change') {
11979
- clearAddAndTakeAndAdjustBaoeData(productData);
12081
+ if (productData.multipleInsured) {
12082
+ multipleInsuredHandler(productData, personData);
11980
12083
  }
11981
12084
  _context4.next = 1;
11982
12085
  return productDataHandler(productData, productVerifyData, personData, {
12086
+ user: user,
11983
12087
  planbookId: planbookId,
12088
+ executeSource: 'userAction',
11984
12089
  eventTarget: eventTarget
11985
12090
  });
11986
12091
  case 1:
@@ -12015,10 +12120,12 @@
12015
12120
  _context3.next = 1;
12016
12121
  return new Promise(function (resolve, reject) {
12017
12122
  _this5.$emit('reCalculate', inputData, {
12123
+ user: user,
12018
12124
  planbookId: planbookId,
12019
12125
  publicPbUuid: publicPbUuid,
12020
12126
  groupKey: groupKey,
12021
12127
  productKey: productKey,
12128
+ executeSource: 'userAction',
12022
12129
  isIgnoreError: true,
12023
12130
  eventTarget: eventTarget
12024
12131
  }, resolve, reject);
@@ -12028,7 +12135,9 @@
12028
12135
  case 1:
12029
12136
  _context3.next = 2;
12030
12137
  return productDataHandler(productData, productVerifyData, personData, {
12138
+ user: user,
12031
12139
  planbookId: planbookId,
12140
+ executeSource: 'userAction',
12032
12141
  eventTarget: eventTarget
12033
12142
  });
12034
12143
  case 2:
@@ -12236,7 +12345,7 @@
12236
12345
  }, {
12237
12346
  key: "getRecommendValues",
12238
12347
  value: function getRecommendValues(ins, ele) {
12239
- if (!['baoe', 'baof'].includes(ele.key)) {
12348
+ if (!['baoe', 'baof'].includes(ele.key) || ele.isDisabled) {
12240
12349
  return null;
12241
12350
  }
12242
12351
  var insurance = convertEleOrderListToObj(ins);
@@ -12246,7 +12355,7 @@
12246
12355
  key: "requiestRecommendValues",
12247
12356
  value: function () {
12248
12357
  var _requiestRecommendValues = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
12249
- var self, showRecommendValue, recommendValuesCache, inputData, groupData, productData, url, calcData, reqParams, calcInputData, calcProductData;
12358
+ var self, showRecommendValue, recommendValuesCache, inputData, groupData, productData, requestDataToCalc, reqParams, inputDataToCalc, mulInsOrderList;
12250
12359
  return _regeneratorRuntime.wrap(function (_context6) {
12251
12360
  while (1) switch (_context6.prev = _context6.next) {
12252
12361
  case 0:
@@ -12258,26 +12367,23 @@
12258
12367
  }
12259
12368
  return _context6.abrupt("return");
12260
12369
  case 1:
12261
- url = "".concat(PLANBOOK_API_HOSTNAME, "/planBook/input/calculate/recommend");
12262
12370
  _context6.next = 2;
12263
12371
  return createdProductDataToCalc(inputData, {
12264
12372
  groupKey: groupData.key,
12265
12373
  productKey: productData.key
12266
12374
  }).catch(function () {});
12267
12375
  case 2:
12268
- calcData = _context6.sent;
12376
+ requestDataToCalc = _context6.sent;
12269
12377
  reqParams = [];
12270
- calcInputData = calcData && JSON.parse(calcData.jd);
12271
- calcProductData = calcInputData && calcInputData.productGroupList[0].prodOrderList[0];
12272
- if (calcProductData && calcProductData.mulInsOrderList) {
12273
- calcProductData.mulInsOrderList.forEach(function (ins) {
12274
- reqParams.push({
12275
- insuranceId: ins.key,
12276
- period: ins.pPeriod,
12277
- calMethod: ins.calMethod || ins.feeType || ins.feeBaseType
12278
- });
12378
+ inputDataToCalc = requestDataToCalc && JSON.parse(requestDataToCalc.jd);
12379
+ mulInsOrderList = lodash.get(inputDataToCalc, 'productGroupList[0].prodOrderList[0].mulInsOrderList') || [];
12380
+ mulInsOrderList.forEach(function (ins) {
12381
+ reqParams.push({
12382
+ insuranceId: ins.key,
12383
+ period: ins.pPeriod,
12384
+ calMethod: ins.calMethod || ins.feeType || ins.feeBaseType
12279
12385
  });
12280
- }
12386
+ });
12281
12387
  if (!recommendValuesCache[JSON.stringify(reqParams)]) {
12282
12388
  _context6.next = 3;
12283
12389
  break;
@@ -12285,30 +12391,13 @@
12285
12391
  self.recommendValues = recommendValuesCache[JSON.stringify(reqParams)];
12286
12392
  return _context6.abrupt("return");
12287
12393
  case 3:
12288
- return _context6.abrupt("return", fetch(url, {
12289
- method: 'POST',
12290
- credentials: 'include',
12291
- headers: {
12292
- Accept: 'application/json, text/plain, */*',
12293
- 'Content-Type': 'application/json;'
12294
- },
12295
- body: JSON.stringify(reqParams)
12296
- }).then(function (response) {
12297
- return response.json();
12298
- }).then(function (_ref4) {
12299
- var success = _ref4.success,
12300
- data = _ref4.data,
12301
- info = _ref4.info;
12302
- if (!success || !data) {
12303
- self.$toast(info);
12304
- return Promise.reject();
12305
- }
12394
+ return _context6.abrupt("return", getPlanbookRecommendData(reqParams).then(function (data) {
12306
12395
  var recommendValues = data.reduce(function (obj, ele) {
12307
12396
  return Object.assign(obj, _defineProperty$1({}, ele.insuranceId, ele.valueList));
12308
12397
  }, {});
12309
12398
 
12310
12399
  // 推荐金额,根据最小值和最大值进行过滤。From hyw
12311
- var mulInsOrderList = productData && productData.mulInsOrderList ? productData.mulInsOrderList : [];
12400
+ var mulInsOrderList = lodash.get(productData, 'mulInsOrderList') || [];
12312
12401
  mulInsOrderList.filter(function (ins) {
12313
12402
  return ins.eleOrderList && ins.eleOrderList.length;
12314
12403
  }).filter(function (ins) {
@@ -12334,8 +12423,9 @@
12334
12423
  });
12335
12424
  self.recommendValues = recommendValues;
12336
12425
  recommendValuesCache[JSON.stringify(reqParams)] = recommendValues;
12337
- }).catch(function (error) {
12338
- console.log(error);
12426
+ }).catch(function (info) {
12427
+ self.$toast(info);
12428
+ console.log(info);
12339
12429
  }));
12340
12430
  case 4:
12341
12431
  case "end":
@@ -12428,32 +12518,37 @@
12428
12518
  });
12429
12519
  }
12430
12520
  }]);
12431
- }(Vue), _descriptor = _applyDecoratedDescriptor(_class2.prototype, "inputData", [_dec2], {
12521
+ }(Vue), _descriptor = _applyDecoratedDescriptor(_class2.prototype, "user", [_dec2], {
12522
+ configurable: true,
12523
+ enumerable: true,
12524
+ writable: true,
12525
+ initializer: null
12526
+ }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "inputData", [_dec3], {
12432
12527
  configurable: true,
12433
12528
  enumerable: true,
12434
12529
  writable: true,
12435
12530
  initializer: null
12436
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "verifyData", [_dec3], {
12531
+ }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "verifyData", [_dec4], {
12437
12532
  configurable: true,
12438
12533
  enumerable: true,
12439
12534
  writable: true,
12440
12535
  initializer: null
12441
- }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "groupKey", [_dec4], {
12536
+ }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "groupKey", [_dec5], {
12442
12537
  configurable: true,
12443
12538
  enumerable: true,
12444
12539
  writable: true,
12445
12540
  initializer: null
12446
- }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "productKey", [_dec5], {
12541
+ }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "productKey", [_dec6], {
12447
12542
  configurable: true,
12448
12543
  enumerable: true,
12449
12544
  writable: true,
12450
12545
  initializer: null
12451
- }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "showRecommendValue", [_dec6], {
12546
+ }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "showRecommendValue", [_dec7], {
12452
12547
  configurable: true,
12453
12548
  enumerable: true,
12454
12549
  writable: true,
12455
12550
  initializer: null
12456
- }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "params", [_dec7], {
12551
+ }), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, "params", [_dec8], {
12457
12552
  configurable: true,
12458
12553
  enumerable: true,
12459
12554
  writable: true,