bxs-tools-ui 3.2.0-1 → 3.2.0-2

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.
@@ -1,31 +1,32 @@
1
- <!--仅用于绕过 eslint-loader 校验的错误信息:Parsing error: Invalid character-->
2
- <!--??以目前现象看,文档首字符不为 "<" 会报错??-->
3
- ## 追加领取(减保领取)(AddAndTake)
4
- 计划书的追加领取模块。减保领取可以认为是追加领取的一种,两者数据结构是相同的,只是险种中对应的字段(accountData、reduceBaofData)不同、校验数据的接口不同。
5
- v1.x.x,追加领取、减保领取两者是独立的;v2.x.x,追加领取的账户价值是受减保领取的数据影响的,并且当分红、账户利率变化(余额不足)时,可能两者的数据都要清空。
6
- v2.x.x,对模块进行了重构,重新定义了传参、回参,并且尽量保证不同场景的传参是一样的(投保页、结果页、对比)。
7
- **内容:** 该模块包含三部分:
8
- * 利益表单:包括分利、年末分红利率、账户利率、自定义利率、领取方式等
9
- * 利益表格:展示利益账户价值、追加金额、领取的金额数据等
10
- * 追加领取表单:编辑追加领取数据,包括起止年度、追加金额、领取金额、领取用途等
11
-
12
- **属性:** type、submoduleName、scene、groupKey、productKey、insuranceKey、resultUuid、inputData、accountData、accountInsuranceId、reduceBaofData、reduceBaofData2、reduceBaofInsuranceId、interestData
13
- **方法:** goToTable、confirm、updateData
14
- **事件:** confirm
15
-
16
- ###
1
+ ## 追加领取(AddAndTake)
2
+
3
+ 计划书的追加领取 / 减保领取模块。减保领取可视为追加领取的一种,两者数据结构相同,仅险种对应字段(`accountData` / `reduceBaofData`)及校验接口不同。
4
+
5
+ v2.x.x 起,追加领取的账户价值受减保领取数据影响;当分红、账户利率变化(余额不足)时,两者数据可能同时被清空。同版本对模块进行了重构,重新定义了传参与回参,并尽量保证不同场景(投保页、结果页、对比)的传参一致。
6
+
7
+ **模块包含三部分**:
8
+
9
+ 1. **利益表单**:分利、年末分红利率、账户利率、自定义利率、领取方式等
10
+ 2. **利益表格**:展示利益账户价值、追加金额、领取金额等数据
11
+ 3. **追加领取表单**:编辑追加领取数据,包括起止年度、追加金额、领取金额、领取用途等
12
+
13
+ ---
14
+
17
15
  ### 模块引用(import)
16
+
18
17
  ```javascript
19
- import AddAndTake from 'bxs-tools-ui';
18
+ import { AddAndTake } from 'bxs-tools-ui';
20
19
  export default {
21
20
  components: {
22
21
  AddAndTake
23
22
  }
24
- }
23
+ };
25
24
  ```
26
25
 
27
- ###
26
+ ---
27
+
28
28
  ### 示例(example)
29
+
29
30
  ```html
30
31
  <template>
31
32
  <CommonPopup
@@ -63,112 +64,41 @@ export default {
63
64
  </template>
64
65
 
65
66
  <script>
67
+ import { AddAndTake } from 'bxs-tools-ui';
68
+
66
69
  export default {
67
- data () {
70
+ components: { AddAndTake },
71
+ data() {
68
72
  return {
69
- takePopupConfig: null
70
- }
71
- },
72
- computed: {
73
- inputData() {
74
- return _get(this, 'planbookData.initData.inputData');
75
- },
76
- groupData() {
77
- return _get(this, 'inputData.productGroupList[0]');
78
- },
79
- productData() {
80
- return _get(this, 'groupData.prodOrderList[0]');
81
- },
82
- reduceBaofInsuranceData() {
83
- const productData = convertProductData(this.productData);
84
- const mulInsOrderList = _get(productData, 'mulInsOrderList') || [];
85
- return mulInsOrderList.find(ins => ins.reduceBaof && ins.reduceBaofData);
86
- },
87
- accountInsuranceData() {
88
- const productData = convertProductData(this.productData);
89
- const mulInsOrderList = _get(productData, 'mulInsOrderList') || [];
90
- return mulInsOrderList.find(ins => ins.account && ins.accountData);
91
- }
92
- },
93
- created () {
94
- this.openAddAndTakePopup(this.reduceBaofInsuranceData, 'reduceBaofData')
95
- // this.openAddAndTakePopup(this.accountInsuranceData, 'accountData')
96
- },
97
- methods: {
98
- openAddAndTakePopup(ins, name) {
99
- const { resultUuid, inputData, params } = this;
100
- if (ins[name]) {
101
- const { groupKey, productKey } = params;
102
- const isReduceBaof = name === 'reduceBaofData';
103
- const type = isReduceBaof ? 'reduceBaof' : ins[name].accountPart;
104
- const takePopupConfig = {
105
- visible: true,
106
- title: '弹层标题',
107
- type,
108
- submoduleName: 'Table',
109
- scene: 0,
110
- groupKey,
111
- productKey,
112
- insuranceKey: ins.key,
113
- resultUuid,
114
- inputData: null,
115
- insuredAge: null,
116
- periodNum: ins.periodNum,
117
- [name]: ins[name],
118
- reduceBaofData2: ins.duplicateReduceBaofData,
119
- [isReduceBaof ? 'reduceBaofInsuranceId' : 'accountInsuranceId']: ins.key,
120
- interestData: {
121
- bonus: 'low',
122
- rate: null,
123
- takeType: 'account',
124
- customRate: 0.047,
125
- // yearBonusRate: 1.2,
126
- // endBonusRate: 1.2,
127
- }
128
- };
129
- // 将投保页数据转换为结果页数据形式
130
- const resultData = convertInputDataToResultData(inputData);
131
- if (resultData) {
132
- takePopupConfig.inputData = {
133
- personData: resultData.personData,
134
- productGroupList: resultData.productGroupList
135
- };
136
- takePopupConfig.insuredAge = resultData.personData.personOrderList[0].age;
137
- const productGroupList = (resultData.productGroupList || []).filter(g => g.prodOrderList);
138
- productGroupList.forEach(g => {
139
- const product = g.prodOrderList.find(p => p.key === productKey && p.hadChoice && p.mulInsOrderList);
140
- product.mulInsOrderList.forEach(ins => {
141
- if (name === 'reduceBaofData') {
142
- if (ins.account && ins.accountData) {
143
- takePopupConfig.accountData = ins.accountData;
144
- takePopupConfig.accountInsuranceId = ins.key;
145
- }
146
- } else {
147
- if (ins.reduceBaof && ins.reduceBaofData) {
148
- takePopupConfig.reduceBaofData = ins.reduceBaofData;
149
- takePopupConfig.reduceBaofData2 = ins.duplicateReduceBaofData;
150
- takePopupConfig.reduceBaofInsuranceId = ins.key;
151
- }
152
- }
153
- });
154
- });
73
+ takePopupConfig: {
74
+ visible: true,
75
+ title: '弹层标题',
76
+ type: 'reduceBaof',
77
+ submoduleName: 'Table',
78
+ scene: 0,
79
+ groupKey: 'allMainInsData',
80
+ productKey: 1800,
81
+ insuranceKey: 17588,
82
+ resultUuid: null,
83
+ inputData: null,
84
+ insuredAge: 30,
85
+ accountData: null,
86
+ accountInsuranceId: null,
87
+ reduceBaofData: null,
88
+ reduceBaofData2: null,
89
+ reduceBaofInsuranceId: 17588,
90
+ interestData: {
91
+ bonus: 'low',
92
+ rate: null,
93
+ takeType: 'account',
94
+ customRate: 0.047
155
95
  }
156
- this.takePopupConfig = takePopupConfig;
157
96
  }
158
- },
97
+ };
98
+ },
99
+ methods: {
159
100
  addAndTakeConfirm(data) {
160
- const { productData } = this;
161
101
  const { type, accountData, accountInsuranceId, reduceBaofData, reduceBaofData2, reduceBaofInsuranceId, interestData } = data;
162
- productData.mulInsOrderList.forEach(ins => {
163
- if (ins.key === accountInsuranceId) {
164
- ins.accountData = accountData;
165
- }
166
- if (ins.key === reduceBaofInsuranceId) {
167
- ins.reduceBaofData = reduceBaofData;
168
- ins.duplicateReduceBaofData = reduceBaofData2;
169
- }
170
- });
171
- this.takePopupConfig = initAddAndTakePopupConfig();
172
102
  console.log(data);
173
103
  },
174
104
  closeAddAndTake() {
@@ -182,36 +112,40 @@ export default {
182
112
  }
183
113
  }
184
114
  }
185
- }
115
+ };
186
116
  </script>
187
117
  ```
188
118
 
189
- ###
190
- ### 属性(Attributes)
191
- | 参数| 说明 | 类型 | 默认值 | 备注 | 版本 |
192
- | --- | --- | --- | --- | --- | --- |
193
- | type | 可选,追加领取的类型。 | String | addAndTake | addAndTake-追加领取 <br/>add-追加 <br/>take-领取 <br/>reduceBaof-减保领取 | 2.0.0 |
194
- | scene | 可选,所在场景。 | Number | 0 | 0-投保页 <br/>1-结果页 <br/>2-计划书对比 <br/>3-利益对比 <br/>4-保司投保页 | 2.0.0 |
195
- | submoduleName | 可选,当前展示的模块。 | String | Table | Table-利益表格 <br/>Form-追加领取表单 | 2.0.0 |
196
- | groupKey | 必传,产品组的 key。 | String | - | - | 2.0.0 |
197
- | productKey | 必传,产品的 key。 | Number | - | - | 2.0.0 |
198
- | insuranceKey | 必传,险种的 key。 | Number | - | - | 2.0.0 |
199
- | resultUuid | 可选,计划书结果页的 uuid。 | String | - | - | 2.0.0 |
200
- | inputData | 可选,需要符合计划书投保页的数据结构。主要有两种场景:不传 resultUuid,inputData 是必传,用于利益初始化接口、利益详情接口的请求传参;传 resultUuid,不需要传 inputData | Object | - | 见 InputData 对象 | 2.0.0 |
201
- | insuredAge | 必传,被保人年龄。 | Number | - | | 2.0.0 |
202
- | periodNum | 可选,险种交费期间。 | Number | 0 | | 2.0.0 |
203
- | accountData | 可选,追加领取的数据。 | Object | - | 见 AccountData 对象 | 2.0.0 |
204
- | accountInsuranceId | 可选,追加领取险种的 key。 | Number | - | - | 2.0.0 |
205
- | reduceBaofData | 可选,减保领取的数据。 | Object | - | 见 ReduceBaofData 对象 | 2.0.0 |
206
- | reduceBaofData2 | 可选,减保领取的数据。 | Object | - | 见 ReduceBaofData 对象 | 2.0.0 |
207
- | reduceBaofInsuranceId | 可选,减保领取险种的 key。 | Number | - | - | 2.0.0 |
208
- | interestData | 可选,利益数据。 | Object | - | 见 InterestData 对象 | 2.0.0 |
209
- | footer | 可选,表示是否显示底部按钮。 | Boolean | true | - | 2.0.0 |
210
-
211
- accountData、accountInsuranceId,是追加领取的数据和对应的险种id;reduceBaofData、reduceBaofInsuranceId 是减保领取的数据和对应的险种id。当一个产品下,即有追加领取,又有减保领取,两者都要传;正常传其中一个即可。
212
-
213
- ####
214
- #### - InputData 对象
119
+ ---
120
+
121
+ ### Attributes
122
+
123
+ #### 根级 props
124
+
125
+ | 参数 | 说明 | 类型 | 默认值 | 备注 |
126
+ | --- | --- | --- | --- | --- |
127
+ | `type` | 可选,追加领取的类型 | String | `addAndTake` | `addAndTake` 追加领取 / `add` 追加 / `take` 领取 / `reduceBaof` 减保领取 |
128
+ | `groupKey` | 必传,产品组的 key | Number / String | — | — |
129
+ | `productKey` | 必传,产品的 key | Number / String | — | — |
130
+ | `insuredAge` | 必传,被保人年龄 | Number | — | — |
131
+ | `scene` | 可选,所在场景 | Number | `0` | `0` 投保页 / `1` 结果页 / `2` 计划书对比 / `3` 利益对比 / `4` 保司投保页 / `5` 险种对比(利益对比2024) |
132
+ | `submoduleName` | 可选,当前展示的子模块(`.sync`) | String | `Table` | `Table` 利益表格 / `Form` 追加领取表单 |
133
+ | `resultUuid` | 可选,计划书结果页的 uuid | String | — | 传入后可不传 `inputData` |
134
+ | `inputData` | 可选,计划书投保页数据结构 | Object | — | 不传 `resultUuid` 时需传入;见 InputData 对象 |
135
+ | `periodNum` | 可选,险种交费期间 | Number | `0` | — |
136
+ | `accountData` | 可选,追加领取的数据 | Object | — | 见 AccountData 对象 |
137
+ | `accountInsuranceId` | 可选,追加领取险种的 key | Number | — | — |
138
+ | `reduceBaofData` | 可选,减保领取的数据 | Object | — | 见 ReduceBaofData 对象 |
139
+ | `reduceBaofData2` | 可选,双减保领取的数据 | Object | — | 见 ReduceBaofData 对象 |
140
+ | `reduceBaofInsuranceId` | 可选,减保领取险种的 key | Number | — | — |
141
+ | `interestData` | 可选,利益数据 | Object | — | 见 InterestData 对象 |
142
+ | `footer` | 可选,是否显示底部按钮 | Boolean | `true` | — |
143
+
144
+ > `accountData` / `accountInsuranceId` 对应追加领取,`reduceBaofData` / `reduceBaofInsuranceId` 对应减保领取。产品下同时存在两者时,需全部传入。
145
+
146
+
147
+ #### InputData 对象
148
+
215
149
  ```json
216
150
  {
217
151
  "personData": {
@@ -221,7 +155,7 @@ accountData、accountInsuranceId,是追加领取的数据和对应的险种id
221
155
  "title": true,
222
156
  "sex": 1,
223
157
  "age": 30,
224
- "birthday": "",
158
+ "birthday": ""
225
159
  }
226
160
  ]
227
161
  },
@@ -230,136 +164,108 @@ accountData、accountInsuranceId,是追加领取的数据和对应的险种id
230
164
  "key": "allMainInsData",
231
165
  "prodOrderList": [
232
166
  {
167
+ "key": 1800,
233
168
  "mulInsOrderList": [
234
169
  {
235
- "code": "862",
236
- "calculatorType": "",
237
- "allowSamePerson": false,
238
- "scale": 2,
239
- "durationType": 0,
170
+ "key": 17588,
171
+ "name": "智悦人生年金保险(万能型,Ⅱ)",
172
+ "account": true,
240
173
  "accountData": {
241
174
  "accountName": "",
242
175
  "addAndTakeData": [],
243
176
  "accountPart": "addAndTake"
244
- },
245
- "required": true,
246
- "roundingMode": "HALF_UP",
247
- "trade": false,
248
- "huomian": "",
249
- "name": "智悦人生年金保险(万能型,Ⅱ)",
250
- "key": 17588,
251
- "account": true
177
+ }
252
178
  }
253
- ],
254
- "companyId": 2,
255
- "hide": false,
256
- "titleName": "平安智悦人生年金保险(万能型,Ⅱ)",
257
- "trade": false,
258
- "companyName": "中国平安",
259
- "autoImport": true,
260
- "liabilityShowType": 0,
261
- "key": 1800,
262
- "required": true,
263
- "tradeId": -1
264
- },
265
- ],
179
+ ]
180
+ }
181
+ ]
266
182
  }
267
183
  ]
268
184
  }
269
185
  ```
270
186
 
271
- #### - AccountData 对象
272
- ```json
273
- {
274
- "accountData": {
275
- "accountPart": "addAndTake", // addAndTake-追加领取 add-追加 take-领取 reduceBaof-减额领取
276
- "accountName": "",
277
- "addAndTakeData": [
278
- {
279
- "key": "add", // accountPart 为 addAndTake、add 时必要
280
- "adjustData": [
281
- [1, 6, 1] // [年度、年度、追加]
282
- ]
283
- },
284
- {
285
- "key": "take", // accountPart 为 addAndTake、take 时必要
286
- "adjustData": [
287
- [3, 3, 2, ""] // [年度、年度、领取、用途]
288
- ]
289
- }
290
- ]
291
- }
292
- }
293
- ```
294
187
 
295
- #### - ReduceBaofData 对象
188
+ #### AccountData 对象
189
+
296
190
  ```json
297
191
  {
298
- "reduceBaofData": {
299
- "accountPart": "take", // 固定值: take-领取
300
- "addAndTakeData": [
301
- {
302
- "key": "take",
303
- "adjustData": [
304
- [3, 3, 2, ""] // [年度、年度、领取、用途]
305
- ]
306
- }
307
- ]
308
- }
192
+ "accountPart": "addAndTake",
193
+ "accountName": "",
194
+ "addAndTakeData": [
195
+ {
196
+ "key": "add",
197
+ "adjustData": [
198
+ [1, 6, 1]
199
+ ]
200
+ },
201
+ {
202
+ "key": "take",
203
+ "adjustData": [
204
+ [3, 3, 2, ""]
205
+ ]
206
+ }
207
+ ]
309
208
  }
310
209
  ```
311
210
 
312
- #### - InterestData 对象
313
- | 参数| 说明 | 类型 | 备注 | 版本 |
314
- | --- | --- | --- | --- | --- |
315
- | takeType | 可选,领取方式式 | String | - | 2.0.0 |
316
- | bonus | 可选,分红值 | String | - | 2.0.0 |
317
- | rate | 可选,账户利率值 | Number | - | 2.0.0 |
318
- | customRate | 可选,自定义利率 | Number | - | 2.0.0 |
319
- | yearBonusRate | 可选,现金分红实现率 | Number | 仅在 scene 为 3, 即利益对比时有效 | 2.0.0 |
320
- | endBonusRate | 可选,终了分红实现率 | Number | 仅在 scene 为 3, 即利益对比时有效 | 2.0.0 |
211
+ > `accountPart`:`addAndTake` 追加领取 / `add` 追加 / `take` 领取 / `reduceBaof` 减额领取
212
+ > `adjustData` 行格式:`[开始年度, 结束年度, 金额]`(追加);`[开始年度, 结束年度, 金额, 用途]`(领取)
213
+
214
+
215
+ #### ReduceBaofData 对象
216
+
321
217
  ```json
322
218
  {
323
- "bonus": 'low',
324
- "rate": 0.06,
325
- "takeType": 'account',
326
- "customRate": 0.047,
327
- // year"BonusRate: 1.2,
328
- // "endBonusRate": 1.2,
219
+ "accountPart": "take",
220
+ "addAndTakeData": [
221
+ {
222
+ "key": "take",
223
+ "adjustData": [
224
+ [3, 3, 2, ""]
225
+ ]
226
+ }
227
+ ]
329
228
  }
330
229
  ```
331
230
 
332
- ###
333
- ###
334
- ### 方法(Methods)
335
- | 方法名 | 说明 | 参数 | 备注 |
336
- | --- | --- | --- | --- |
337
- | goToTable | 从 Form 子模块,返回 Table 子模块 | - | - |
338
- | confirm | 自动调用 Table、Form 的确定事件。如果当前是 Table 模块,返回追加领取的数据 | - | - |
339
- | updateData | 修改指定年度的追加领取数据 | Function(values),见 Values 对象 | - |
340
- ###
341
- #### - Values 对象
342
- | 参数| 说明 | 类型 | 备注 |
343
- | --- | --- | --- | --- |
344
- | type | 必传。追加领取的数据类型 | String | 可选值:add、take |
345
- | beginYear | 必传。开始年度 | Number | - |
346
- | endYear | 必传。结束年度 | Number | - |
347
- | baof | 可不传。修改的金额,为 `falsity` 表示删除 | Number | - |
348
- | purpose | 可不传。用途 | String | - |
349
- | customPurpose | 可不传。自定义用途,优先级高于 purpose | String | - |
350
- ###
351
- ### 事件(Events)
352
- | 方法名 | 说明 | 回调参数 | 备注 |
231
+
232
+ #### InterestData 对象
233
+
234
+ | 参数 | 说明 | 类型 | 备注 |
235
+ | --- | --- | --- | --- |
236
+ | `takeType` | 领取方式 | String | — |
237
+ | `bonus` | 分红值 | String | — |
238
+ | `rate` | 账户利率值 | Number | — |
239
+ | `customRate` | 自定义利率 | Number | — |
240
+ | `yearBonusRate` | 现金分红实现率 | Number | 仅 `scene` 为 `3`(利益对比)时有效 |
241
+ | `endBonusRate` | 终了分红实现率 | Number | 仅 `scene` 为 `3`(利益对比)时有效 |
242
+
243
+ ---
244
+
245
+ ### Methods
246
+
247
+ | 方法名 | 说明 | 参数 |
248
+ | --- | --- | --- |
249
+ | `goToTable` | 从 Form 子模块返回 Table 子模块 | — |
250
+ | `confirm` | 自动触发 Table / Form 的确定事件;当前为 Table 时返回追加领取数据(Promise) | — |
251
+
252
+ ---
253
+
254
+ ### Events
255
+
256
+ | 事件名 | 说明 | 回调参数 |
257
+ | --- | --- | --- |
258
+ | `confirm` | 确定事件;`footer` 为 `true` 时,Table 子模块底部确定按钮的回调 | `Function(data, 模块实例)`,data 见 Response 对象 |
259
+
260
+
261
+ #### Response 对象
262
+
263
+ | 参数 | 说明 | 类型 | 备注 |
353
264
  | --- | --- | --- | --- |
354
- | confirm | 确定事件。footer 属性为 true 时,Table 子模块底部确定按钮的回调 | Function(data, 模块实例),data 见 Response 对象 | - |
355
- ###
356
- #### - Response 对象
357
- | 参数| 说明 | 类型 | 备注 |
358
- | --- | --- | --- | --- |
359
- | type | 追加领取的数据类型 | String | addAndTake-追加领取 <br/>add-追加 <br/>take-领取 <br/>reduceBaof-减保领取 |
360
- | accountData | 追加领取的数据 | Object | 见上方 AccountData 对象 |
361
- | accountInsuranceId | 追加领取险种的 key | Number | - |
362
- | reduceBaofData | 减保领取的数据 | Object | 见上方 ReduceBaofData 对象 |
363
- | reduceBaofData2 | 双减保领取的数据 | Object | 见上方 ReduceBaofData 对象 |
364
- | reduceBaofInsuranceId | 减保领取险种的 key | Number | - |
365
- | interestData | 利益数据 | Object | 见上方 InterestData 对象 |
265
+ | `type` | 追加领取的数据类型 | String | `addAndTake` / `add` / `take` / `reduceBaof` |
266
+ | `accountData` | 追加领取的数据 | Object | 见 AccountData 对象 |
267
+ | `accountInsuranceId` | 追加领取险种的 key | Number | — |
268
+ | `reduceBaofData` | 减保领取的数据 | Object | 见 ReduceBaofData 对象 |
269
+ | `reduceBaofData2` | 双减保领取的数据 | Object | 见 ReduceBaofData 对象 |
270
+ | `reduceBaofInsuranceId` | 减保领取险种的 key | Number | — |
271
+ | `interestData` | 利益数据 | Object | 见 InterestData 对象 |