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
@@ -111,12 +111,12 @@
111
111
  </template>
112
112
 
113
113
  <script>
114
- import { get as _get, cloneDeep } from 'lodash';
115
- import { Toast, Icon } from 'vant';
116
- import { formatNumberToThousand } from 'packages/bxs-utils/planbook/index';
117
- import { PURPOSE_OPTIONS } from '../constant';
118
- import CommonRadio from '@src/components/common/common-radio.vue';
119
- import './interest-form.css';
114
+ import { get as _get, cloneDeep } from 'lodash'
115
+ import { Toast, Icon } from 'vant'
116
+ import { formatNumberToThousand } from 'packages/bxs-utils/planbook/index'
117
+ import { PURPOSE_OPTIONS } from '../constant'
118
+ import CommonRadio from '../../../src/components/common/common-radio.vue'
119
+ import './interest-form.less'
120
120
 
121
121
  function initPickerConfig() {
122
122
  return {
@@ -125,13 +125,13 @@ function initPickerConfig() {
125
125
  title: '',
126
126
  columns: [],
127
127
  element: null
128
- };
128
+ }
129
129
  }
130
130
  export default {
131
131
  filters: {
132
132
  filterOption(value, list) {
133
- const option = list.find(o => o.val === value);
134
- return option ? option.desc : '';
133
+ const option = list.find(o => o.val === value)
134
+ return option ? option.desc : ''
135
135
  }
136
136
  },
137
137
  components: {
@@ -163,54 +163,54 @@ export default {
163
163
  formValues: cloneDeep(this.formData),
164
164
  pickerConfig: initPickerConfig(),
165
165
  PURPOSE_OPTIONS
166
- };
166
+ }
167
167
  },
168
168
  computed: {
169
169
  beginYearOptions() {
170
- return this.getBeginYearOptions();
170
+ return this.getBeginYearOptions()
171
171
  },
172
172
  minReservedAmount() {
173
- const { knowledgeData } = this;
174
- const drawLeft = (knowledgeData || []).find(e => e.key === 'draw_left');
175
- const drawLeftValue = Number(_get(drawLeft, 'value'));
176
- return drawLeftValue || 0;
173
+ const { knowledgeData } = this
174
+ const drawLeft = (knowledgeData || []).find(e => e.key === 'draw_left')
175
+ const drawLeftValue = Number(_get(drawLeft, 'value'))
176
+ return drawLeftValue || 0
177
177
  },
178
178
  maxAvailableAmount() {
179
- const { formData, type, formValues, knowledgeData } = this;
180
- let maxAmount = null;
179
+ const { formData, type, formValues, knowledgeData } = this
180
+ let maxAmount = null
181
181
  if (formValues.type === 'take' && formData.columnKey !== 'draw_value2') {
182
182
  if (type === 'reduceBaof') {
183
- maxAmount = this.getMaxReduceAmount();
183
+ maxAmount = this.getMaxReduceAmount()
184
184
  }
185
185
  if (['addAndTake', 'take'].includes(type)) {
186
- maxAmount = this.getMaxTakeAmount();
186
+ maxAmount = this.getMaxTakeAmount()
187
187
  }
188
188
  }
189
189
 
190
190
  if (maxAmount) {
191
191
  // 最大可领取金额:小于最低领取金额时,展示为 0;有倍数限制时,清理求余数值
192
- const drawMin = (knowledgeData || []).find(e => e.key === 'draw_min');
193
- const rateLimit = (knowledgeData || []).find(e => e.key === 'rate_limit');
192
+ const drawMin = (knowledgeData || []).find(e => e.key === 'draw_min')
193
+ const rateLimit = (knowledgeData || []).find(e => e.key === 'rate_limit')
194
194
  if (drawMin && drawMin.value) {
195
195
  if (maxAmount < Number(drawMin.value)) {
196
- maxAmount = 0;
196
+ maxAmount = 0
197
197
  }
198
198
  }
199
199
  if (rateLimit && rateLimit.value) {
200
- maxAmount = Number((Math.floor(maxAmount / rateLimit.value) * rateLimit.value).toFixed(0));
200
+ maxAmount = Number((Math.floor(maxAmount / rateLimit.value) * rateLimit.value).toFixed(0))
201
201
  }
202
202
  }
203
- return maxAmount;
203
+ return maxAmount
204
204
  },
205
205
  maxAvailableAmountTips() {
206
- const { maxAvailableAmount } = this;
207
- return maxAvailableAmount === null ? '' : `最大领取金额:${formatNumberToThousand(maxAvailableAmount)}元`;
206
+ const { maxAvailableAmount } = this
207
+ return maxAvailableAmount === null ? '' : `最大领取金额:${formatNumberToThousand(maxAvailableAmount)}元`
208
208
  },
209
209
  baofRules() {
210
- return this.getElementRules('baof');
210
+ return this.getElementRules('baof')
211
211
  },
212
212
  adjustData() {
213
- const { insuredAge } = this;
213
+ const { insuredAge } = this
214
214
  const header = {
215
215
  index: '序号',
216
216
  typeName: '类型',
@@ -218,14 +218,14 @@ export default {
218
218
  baof: '金额(元)',
219
219
  purpose: '用途',
220
220
  operate: '操作'
221
- };
222
- const addAndTakeData = _get(this, 'addAndTakeRecordData.addAndTakeData') || [];
223
- const body = [];
221
+ }
222
+ const addAndTakeData = _get(this, 'addAndTakeRecordData.addAndTakeData') || []
223
+ const body = []
224
224
  addAndTakeData
225
225
  .filter(item => (item.adjustData || []).length)
226
226
  .forEach(item => {
227
227
  item.adjustData.forEach(ele => {
228
- const ageStr = ele[0] === ele[1] ? ele[0] + insuredAge : `${ele[0] + insuredAge}-${ele[1] + insuredAge}`;
228
+ const ageStr = ele[0] === ele[1] ? ele[0] + insuredAge : `${ele[0] + insuredAge}-${ele[1] + insuredAge}`
229
229
  const record = {
230
230
  type: item.key,
231
231
  typeName:
@@ -240,38 +240,38 @@ export default {
240
240
  operate: 'delete',
241
241
  beginYear: ele[0],
242
242
  endYear: ele[1]
243
- };
244
- body.push(record);
245
- });
246
- });
247
- return body.length ? [header].concat(body) : [];
243
+ }
244
+ body.push(record)
245
+ })
246
+ })
247
+ return body.length ? [header].concat(body) : []
248
248
  },
249
249
  hasAdjustData() {
250
- return !!this.adjustData.length;
250
+ return !!this.adjustData.length
251
251
  },
252
252
  limitRules() {
253
- const { knowledgeData } = this;
254
- const rules = [];
253
+ const { knowledgeData } = this
254
+ const rules = []
255
255
  knowledgeData
256
256
  .filter(e => ['start_time', 'draw_max', 'draw_left'].includes(e.key) && e.remark)
257
257
  .forEach((e, i) => {
258
- rules.push(`${i + 1}.${e.name}:${e.remark || ''}`);
259
- });
260
- return rules;
258
+ rules.push(`${i + 1}.${e.name}:${e.remark || ''}`)
259
+ })
260
+ return rules
261
261
  }
262
262
  },
263
263
  created() {
264
- this.formValues = this.initFormValues(this.formData);
264
+ this.formValues = this.initFormValues(this.formData)
265
265
  },
266
266
  methods: {
267
267
  initFormValues(formData) {
268
- const { beginYearOptions } = this;
269
- const { type, beginYear } = formData;
270
- let option0 = beginYearOptions.find(o => o.val === beginYear) || beginYearOptions[0];
268
+ const { beginYearOptions } = this
269
+ const { type, beginYear } = formData
270
+ let option0 = beginYearOptions.find(o => o.val === beginYear) || beginYearOptions[0]
271
271
  if (!beginYearOptions.some(o => o.val === beginYear) && beginYearOptions.some(o => o.val > beginYear)) {
272
- option0 = beginYearOptions.find(o => o.val > beginYear);
272
+ option0 = beginYearOptions.find(o => o.val > beginYear)
273
273
  }
274
- const _beginYear = _get(option0, 'val');
274
+ const _beginYear = _get(option0, 'val')
275
275
  return {
276
276
  type,
277
277
  beginYear: _beginYear,
@@ -279,25 +279,25 @@ export default {
279
279
  baof: null,
280
280
  purpose: '',
281
281
  customPurpose: ''
282
- };
282
+ }
283
283
  },
284
284
  // 获取减保领取的最大可领金额
285
285
  getMaxReduceAmount() {
286
- const { addAndTakeRecordData, addAndTakeDetailData, formValues, minReservedAmount } = this;
287
- const { beginYear, endYear } = formValues;
288
- const takeAdjustData = (_get(addAndTakeRecordData, 'addAndTakeData') || []).find(e => e.key === 'take');
289
- const adjustData = _get(takeAdjustData, 'adjustData') || [];
290
- const cashValueDetail = (addAndTakeDetailData || [])[0];
291
- const cashValueValues = _get(cashValueDetail, 'values') || [];
292
- const drawMaxDetail = (addAndTakeDetailData || []).find(d => d.key === 'draw_max');
293
- const drawMaxValues = _get(drawMaxDetail, 'values') || [];
294
- let maxAvailableAmount = null;
286
+ const { addAndTakeRecordData, addAndTakeDetailData, formValues, minReservedAmount } = this
287
+ const { beginYear, endYear } = formValues
288
+ const takeAdjustData = (_get(addAndTakeRecordData, 'addAndTakeData') || []).find(e => e.key === 'take')
289
+ const adjustData = _get(takeAdjustData, 'adjustData') || []
290
+ const cashValueDetail = (addAndTakeDetailData || [])[0]
291
+ const cashValueValues = _get(cashValueDetail, 'values') || []
292
+ const drawMaxDetail = (addAndTakeDetailData || []).find(d => d.key === 'draw_max')
293
+ const drawMaxValues = _get(drawMaxDetail, 'values') || []
294
+ let maxAvailableAmount = null
295
295
  if (cashValueValues.length) {
296
- const values = [];
296
+ const values = []
297
297
  for (let y = beginYear; y <= endYear; y++) {
298
- const index = y - 1;
298
+ const index = y - 1
299
299
  if (index >= 0 && index <= cashValueValues.length - 1) {
300
- values.push(cashValueValues[index]);
300
+ values.push(cashValueValues[index])
301
301
  }
302
302
  }
303
303
 
@@ -305,75 +305,75 @@ export default {
305
305
  Math.max.apply(
306
306
  null,
307
307
  adjustData.map(ad => ad[1])
308
- ) || 0;
309
- const maxReduceYear = Math.max(maxHadReduceYear, endYear);
310
- const maxReduceCaseValue = cashValueValues[maxReduceYear - 1];
308
+ ) || 0
309
+ const maxReduceYear = Math.max(maxHadReduceYear, endYear)
310
+ const maxReduceCaseValue = cashValueValues[maxReduceYear - 1]
311
311
  // 最低保留份数 = minReservedAmount / maxReduceCaseValue
312
- const minRetainedNum = maxReduceCaseValue ? minReservedAmount / maxReduceCaseValue : 0;
312
+ const minRetainedNum = maxReduceCaseValue ? minReservedAmount / maxReduceCaseValue : 0
313
313
 
314
314
  // 剩余可领取份数:1-最低保留份数,再遍历已领取数据,剩余份数-当年已领取金额/当年现价
315
- let remainderNum = 1 - (minRetainedNum || 0);
316
- const remainderNumArr = [];
315
+ let remainderNum = 1 - (minRetainedNum || 0)
316
+ const remainderNumArr = []
317
317
  adjustData.forEach(adjust => {
318
318
  for (let y1 = adjust[0]; y1 <= adjust[1]; y1++) {
319
- const index1 = y1 - 1;
319
+ const index1 = y1 - 1
320
320
  if (index1 >= 0 && index1 <= cashValueValues.length - 1) {
321
- const currentCashValue = cashValueValues[index1];
321
+ const currentCashValue = cashValueValues[index1]
322
322
  if (currentCashValue) {
323
- remainderNum = remainderNum - adjust[2] / currentCashValue;
324
- remainderNumArr.push(remainderNum);
323
+ remainderNum = remainderNum - adjust[2] / currentCashValue
324
+ remainderNumArr.push(remainderNum)
325
325
  }
326
326
  }
327
327
  }
328
- });
328
+ })
329
329
 
330
330
  // 即将领取系数:遍历已领取数据,1-当年已领取金额/当年现价
331
- let willTakeCoefficient = 0;
332
- const willTakeCoefficientArr = [];
331
+ let willTakeCoefficient = 0
332
+ const willTakeCoefficientArr = []
333
333
  for (let y = beginYear; y <= maxReduceYear; y++) {
334
- const currentCashValue = cashValueValues[y - 1];
335
- const drawMaxValue = drawMaxValues[y - 1];
334
+ const currentCashValue = cashValueValues[y - 1]
335
+ const drawMaxValue = drawMaxValues[y - 1]
336
336
  // 当前年度已领取的金额
337
- let currentYearHadReduceAmount = 0;
337
+ let currentYearHadReduceAmount = 0
338
338
  if (y >= beginYear && y <= endYear) {
339
339
  if (currentCashValue) {
340
- willTakeCoefficient = willTakeCoefficient + 1 / currentCashValue;
341
- willTakeCoefficientArr.push(willTakeCoefficient);
340
+ willTakeCoefficient = willTakeCoefficient + 1 / currentCashValue
341
+ willTakeCoefficientArr.push(willTakeCoefficient)
342
342
  }
343
343
  adjustData.forEach(adjust => {
344
344
  if (adjust[0] <= y && y <= adjust[1]) {
345
- currentYearHadReduceAmount = adjust[2];
345
+ currentYearHadReduceAmount = adjust[2]
346
346
  }
347
- });
347
+ })
348
348
  }
349
349
 
350
350
  // 最大可领取金额1:剩余可领取份数 / 即将领取系数
351
- const maxAvailableAmount1 = remainderNum / willTakeCoefficient;
351
+ const maxAvailableAmount1 = remainderNum / willTakeCoefficient
352
352
  // 最大可领取金额2:当前领取期间内的最大可领取值 - 当前年度已领取的金额
353
- const maxAvailableAmount2 = drawMaxValue ? drawMaxValue - currentYearHadReduceAmount : Infinity;
354
- maxAvailableAmount = Math.min.apply(null, [maxAvailableAmount === null ? Infinity : maxAvailableAmount, maxAvailableAmount1, maxAvailableAmount2]);
353
+ const maxAvailableAmount2 = drawMaxValue ? drawMaxValue - currentYearHadReduceAmount : Infinity
354
+ maxAvailableAmount = Math.min.apply(null, [maxAvailableAmount === null ? Infinity : maxAvailableAmount, maxAvailableAmount1, maxAvailableAmount2])
355
355
  }
356
356
  }
357
- return maxAvailableAmount === null ? null : Math.max(0, Math.floor(Number(maxAvailableAmount.toFixed(6))));
357
+ return maxAvailableAmount === null ? null : Math.max(0, Math.floor(Number(maxAvailableAmount.toFixed(6))))
358
358
  },
359
359
  // 获取账户领取的最大可领金额
360
360
  getMaxTakeAmount() {
361
- const { addAndTakeRecordData, addAndTakeDetailData, formValues, minReservedAmount, rate } = this;
362
- const { beginYear, endYear } = formValues;
363
- const takeAdjustData = (_get(addAndTakeRecordData, 'addAndTakeData') || []).find(e => e.key === 'take');
364
- const adjustData = _get(takeAdjustData, 'adjustData') || [];
365
- const accountValueDetail = (addAndTakeDetailData || []).filter(e => e.key === 'account_value')[1];
366
- const accountValueValues = _get(accountValueDetail, 'values') || [];
367
- const takeMaxDetail = (addAndTakeDetailData || []).find(d => d.key === 'take_max');
368
- const takeMaxValues = _get(takeMaxDetail, 'values') || [];
361
+ const { addAndTakeRecordData, addAndTakeDetailData, formValues, minReservedAmount, rate } = this
362
+ const { beginYear, endYear } = formValues
363
+ const takeAdjustData = (_get(addAndTakeRecordData, 'addAndTakeData') || []).find(e => e.key === 'take')
364
+ const adjustData = _get(takeAdjustData, 'adjustData') || []
365
+ const accountValueDetail = (addAndTakeDetailData || []).filter(e => e.key === 'account_value')[1]
366
+ const accountValueValues = _get(accountValueDetail, 'values') || []
367
+ const takeMaxDetail = (addAndTakeDetailData || []).find(d => d.key === 'take_max')
368
+ const takeMaxValues = _get(takeMaxDetail, 'values') || []
369
369
 
370
- let maxAvailableAmount = null;
370
+ let maxAvailableAmount = null
371
371
  if (accountValueValues.length) {
372
- const values = [];
372
+ const values = []
373
373
  for (let year = beginYear; year <= endYear; year++) {
374
- const index = year - 1;
374
+ const index = year - 1
375
375
  if (index >= 0 && index <= accountValueValues.length - 1) {
376
- values.push(accountValueValues[index]);
376
+ values.push(accountValueValues[index])
377
377
  }
378
378
  }
379
379
 
@@ -381,77 +381,77 @@ export default {
381
381
  Math.max.apply(
382
382
  null,
383
383
  adjustData.map(ad => ad[1])
384
- ) || 0;
385
- const maxTakeYear = Math.max(maxHadTakeYear, endYear);
384
+ ) || 0
385
+ const maxTakeYear = Math.max(maxHadTakeYear, endYear)
386
386
  if (values.length) {
387
- let maxAvailableAmount1 = Infinity;
388
- let n = 0;
389
- let m = 0;
390
- const paramBArr = [];
387
+ let maxAvailableAmount1 = Infinity
388
+ let n = 0
389
+ let m = 0
390
+ const paramBArr = []
391
391
  accountValueValues.forEach((v, vi) => {
392
392
  if (vi >= beginYear - 1 && vi <= maxTakeYear - 1) {
393
- const paramA = (v - minReservedAmount) * rate;
393
+ const paramA = (v - minReservedAmount) * rate
394
394
  if (vi <= endYear - 1) {
395
- n++;
396
- const paramB = Math.pow(1 + rate, n) - 1;
397
- maxAvailableAmount1 = Math.min(maxAvailableAmount1, paramA / paramB);
398
- paramBArr.push([vi, paramB, maxAvailableAmount1]);
395
+ n++
396
+ const paramB = Math.pow(1 + rate, n) - 1
397
+ maxAvailableAmount1 = Math.min(maxAvailableAmount1, paramA / paramB)
398
+ paramBArr.push([vi, paramB, maxAvailableAmount1])
399
399
  } else {
400
- m++;
401
- const paramB = Math.pow(1 + rate, n) - 1;
402
- const paramC = Math.pow(1 + rate, m);
403
- maxAvailableAmount1 = Math.min(maxAvailableAmount1, paramA / (paramB * paramC));
404
- paramBArr.push([vi, paramB, maxAvailableAmount1, paramA / (paramB * paramC)]);
400
+ m++
401
+ const paramB = Math.pow(1 + rate, n) - 1
402
+ const paramC = Math.pow(1 + rate, m)
403
+ maxAvailableAmount1 = Math.min(maxAvailableAmount1, paramA / (paramB * paramC))
404
+ paramBArr.push([vi, paramB, maxAvailableAmount1, paramA / (paramB * paramC)])
405
405
  }
406
406
  }
407
- });
408
- let maxAvailableAmount2 = Infinity;
407
+ })
408
+ let maxAvailableAmount2 = Infinity
409
409
  if (takeMaxValues.length && takeMaxValues[beginYear - 1]) {
410
- let beginYearAdjustbaof = 0;
410
+ let beginYearAdjustbaof = 0
411
411
  adjustData.forEach(adjust => {
412
412
  if (adjust[0] <= beginYear && beginYear <= adjust[1]) {
413
- beginYearAdjustbaof = adjust[2];
413
+ beginYearAdjustbaof = adjust[2]
414
414
  }
415
- });
416
- maxAvailableAmount2 = takeMaxValues[beginYear - 1] - beginYearAdjustbaof;
415
+ })
416
+ maxAvailableAmount2 = takeMaxValues[beginYear - 1] - beginYearAdjustbaof
417
417
  }
418
- maxAvailableAmount = Math.min.apply(null, [maxAvailableAmount === null ? Infinity : maxAvailableAmount, maxAvailableAmount1, maxAvailableAmount2]);
418
+ maxAvailableAmount = Math.min.apply(null, [maxAvailableAmount === null ? Infinity : maxAvailableAmount, maxAvailableAmount1, maxAvailableAmount2])
419
419
  }
420
420
  }
421
- return maxAvailableAmount === null ? null : Math.max(0, Math.floor(Number(maxAvailableAmount.toFixed(6))));
421
+ return maxAvailableAmount === null ? null : Math.max(0, Math.floor(Number(maxAvailableAmount.toFixed(6))))
422
422
  },
423
423
  getElementRules(key) {
424
- const { knowledgeData, maxAvailableAmount } = this;
425
- const rules = [];
424
+ const { knowledgeData, maxAvailableAmount } = this
425
+ const rules = []
426
426
  if (key === 'baof') {
427
427
  rules.push({
428
428
  type: 'number',
429
429
  required: true,
430
430
  message: '请输入金额'
431
- });
431
+ })
432
432
 
433
- const drawMin = knowledgeData.find(e => e.key === 'draw_min');
434
- const drawMinValue = Number(_get(drawMin, 'value')) || 1;
433
+ const drawMin = knowledgeData.find(e => e.key === 'draw_min')
434
+ const drawMinValue = Number(_get(drawMin, 'value')) || 1
435
435
  if (maxAvailableAmount) {
436
436
  rules.push({
437
437
  type: 'number',
438
438
  message: `请输入不小于${drawMinValue}的金额`,
439
439
  validator(value) {
440
- return Number(value) >= drawMinValue;
440
+ return Number(value) >= drawMinValue
441
441
  }
442
- });
442
+ })
443
443
  }
444
444
 
445
- const rateLimit = knowledgeData.find(e => e.key === 'rate_limit');
446
- const rateLimitValue = Number(_get(rateLimit, 'value'));
445
+ const rateLimit = knowledgeData.find(e => e.key === 'rate_limit')
446
+ const rateLimitValue = Number(_get(rateLimit, 'value'))
447
447
  if (maxAvailableAmount && rateLimitValue) {
448
448
  rules.push({
449
449
  type: 'number',
450
450
  message: `请输入${rateLimitValue}的倍数`,
451
451
  validator(value) {
452
- return !(Number(value) % rateLimitValue);
452
+ return !(Number(value) % rateLimitValue)
453
453
  }
454
- });
454
+ })
455
455
  }
456
456
 
457
457
  if (maxAvailableAmount !== null) {
@@ -460,84 +460,84 @@ export default {
460
460
  message: `最大领取金额:${formatNumberToThousand(maxAvailableAmount)}元`,
461
461
  validator(value) {
462
462
  if (!value) {
463
- return true;
463
+ return true
464
464
  }
465
- return value <= maxAvailableAmount;
465
+ return value <= maxAvailableAmount
466
466
  }
467
- });
467
+ })
468
468
  }
469
- return rules;
469
+ return rules
470
470
  }
471
471
  },
472
472
  getBeginYearOptions() {
473
- const { type, addAndTakeRecordData, minTakeYear, insuredAge, interestInitData, addAndTakeDetailData, formValues } = this;
474
- const options = [];
473
+ const { type, addAndTakeRecordData, minTakeYear, insuredAge, interestInitData, addAndTakeDetailData, formValues } = this
474
+ const options = []
475
475
  if (interestInitData && addAndTakeDetailData) {
476
- const { startPolicyNo, startIndex } = interestInitData;
477
- const maxLength = addAndTakeDetailData.reduce((a, b) => Math.max(a, b.values.length), 0);
476
+ const { startPolicyNo, startIndex } = interestInitData
477
+ const maxLength = addAndTakeDetailData.reduce((a, b) => Math.max(a, b.values.length), 0)
478
478
  for (let i = 0; i < maxLength; i++) {
479
- const year = i + (startPolicyNo || 1);
479
+ const year = i + (startPolicyNo || 1)
480
480
  options.push({
481
481
  val: year,
482
482
  desc: `第${year}年,${insuredAge + (startIndex || 0) + i + 1}岁`
483
- });
483
+ })
484
484
  }
485
485
  }
486
486
 
487
- const takeAdjustData = (_get(addAndTakeRecordData, 'addAndTakeData') || []).find(e => e.key === formValues.type);
488
- const adjustData = _get(takeAdjustData, 'adjustData') || [];
489
- const hadAddYearSet = new Set();
487
+ const takeAdjustData = (_get(addAndTakeRecordData, 'addAndTakeData') || []).find(e => e.key === formValues.type)
488
+ const adjustData = _get(takeAdjustData, 'adjustData') || []
489
+ const hadAddYearSet = new Set()
490
490
  adjustData.forEach(item => {
491
491
  for (let i = item[0]; i <= item[1]; i++) {
492
- hadAddYearSet.add(i);
492
+ hadAddYearSet.add(i)
493
493
  }
494
- });
495
- return options.filter(o => !minTakeYear || o.val >= minTakeYear).filter(o => !hadAddYearSet.has(o.val));
494
+ })
495
+ return options.filter(o => !minTakeYear || o.val >= minTakeYear).filter(o => !hadAddYearSet.has(o.val))
496
496
  },
497
497
  onClickOpenYearPicker(key) {
498
- const { formValues, beginYearOptions } = this;
498
+ const { formValues, beginYearOptions } = this
499
499
  if (beginYearOptions.length) {
500
- const endYearOptions = [];
500
+ const endYearOptions = []
501
501
  beginYearOptions.forEach(o => {
502
502
  if (o.val === formValues.beginYear) {
503
- endYearOptions.push(o);
503
+ endYearOptions.push(o)
504
504
  }
505
- const lastOption = endYearOptions.length && endYearOptions[endYearOptions.length - 1];
505
+ const lastOption = endYearOptions.length && endYearOptions[endYearOptions.length - 1]
506
506
  if (lastOption) {
507
507
  if (o.val === lastOption.val + 1) {
508
- endYearOptions.push(o);
508
+ endYearOptions.push(o)
509
509
  }
510
510
  }
511
- });
511
+ })
512
512
  const columns = (key === 'beginYear' ? beginYearOptions : endYearOptions).map(e => ({
513
513
  value: e.val,
514
514
  name: e.desc
515
- }));
516
- const defaultIndex = columns.findIndex(o => o.value == formValues[key]);
515
+ }))
516
+ const defaultIndex = columns.findIndex(o => o.value == formValues[key])
517
517
  this.pickerConfig = {
518
518
  visible: true,
519
519
  key,
520
520
  title: `请选择${key === 'beginYear' ? '开始' : '结束'}时间`,
521
521
  defaultIndex,
522
522
  columns
523
- };
524
- return;
523
+ }
524
+ return
525
525
  }
526
- Toast('全部年度已设置领取,暂无可以设置的领取年度');
526
+ Toast('全部年度已设置领取,暂无可以设置的领取年度')
527
527
  },
528
528
  onConfirmPicker(item) {
529
- const { formValues, pickerConfig } = this;
530
- formValues[pickerConfig.key] = item.value;
529
+ const { formValues, pickerConfig } = this
530
+ formValues[pickerConfig.key] = item.value
531
531
  if (formValues.beginYear > formValues.endYear) {
532
- formValues.endYear = formValues.beginYear;
532
+ formValues.endYear = formValues.beginYear
533
533
  }
534
- this.onCancelPicker();
534
+ this.onCancelPicker()
535
535
  },
536
536
  onCancelPicker() {
537
- this.pickerConfig = initPickerConfig();
537
+ this.pickerConfig = initPickerConfig()
538
538
  },
539
539
  deleteAdjustData(item) {
540
- const self = this;
540
+ const self = this
541
541
  if (item.operate === 'delete') {
542
542
  const values = {
543
543
  type: item.type,
@@ -546,32 +546,32 @@ export default {
546
546
  baof: null,
547
547
  purpose: '',
548
548
  customPurpose: ''
549
- };
550
- self.$emit('update', values);
549
+ }
550
+ self.$emit('update', values)
551
551
  setTimeout(() => {
552
- self.$refs.Form.validate();
553
- }, 500);
552
+ self.$refs.Form.validate()
553
+ }, 500)
554
554
  }
555
555
  },
556
556
  confirm() {
557
- const self = this;
558
- const { $refs, formData, formValues } = self;
557
+ const self = this
558
+ const { $refs, formData, formValues } = self
559
559
  if (!formValues.baof) {
560
- return;
560
+ return
561
561
  }
562
562
  return $refs.Form.validate()
563
563
  .then(() => {
564
564
  self.$emit('update', cloneDeep(formValues), () => {
565
- self.formValues = self.initFormValues(formData);
566
- });
567
- self.$emit('openTable');
565
+ self.formValues = self.initFormValues(formData)
566
+ })
567
+ self.$emit('openTable')
568
568
  })
569
569
  .catch(() => {
570
- Toast('请完善表单信息');
571
- });
570
+ Toast('请完善表单信息')
571
+ })
572
572
  }
573
573
  }
574
- };
574
+ }
575
575
  </script>
576
576
 
577
577
  <style>