bxs-tools-ui 1.2.18 → 1.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.
@@ -3,8 +3,44 @@
3
3
  .bxt-product-info {
4
4
  padding: 10px;
5
5
 
6
+ & .bxt-custom-result {
7
+ margin-bottom: 9px;
8
+ background: white;
9
+ font-size: 15px;
10
+ color: var(--color-text-primary);
11
+
12
+ & .bxt-custom-result-title {
13
+ padding: 15px;
14
+ position: relative;
15
+
16
+ & .bxt-custom-result-title_desc {
17
+ & .icon-arrows_up,
18
+ & .icon-arrows_down {
19
+ color: var(--color-text-assist);
20
+ }
21
+ }
22
+
23
+ & .bx-switch-box {
24
+ @apply --vertical-center;
25
+
26
+ right: 15px;
27
+
28
+ & .bx-switch-circle {
29
+ pointer-events: none;
30
+ }
31
+ }
32
+ }
33
+
34
+ & .bxt-custom-result-tips {
35
+ padding: 0 15px 15px;
36
+ font-size: 14px;
37
+ line-height: normal;
38
+ color: var(--color-text-patch);
39
+ }
40
+ }
41
+
6
42
  & .bxt-product-info-form {
7
- background: #fff;
43
+ background: white;
8
44
  margin-bottom: 9px;
9
45
  border-radius: 6px;
10
46
 
@@ -144,7 +180,7 @@
144
180
  padding: 1px 12px;
145
181
  line-height: normal;
146
182
  background: #666;
147
- color: #fff;
183
+ color: white;
148
184
  font-size: 12px;
149
185
  border-radius: 4px;
150
186
  }
@@ -1,5 +1,18 @@
1
1
  <template>
2
2
  <div class="bxt-product-info" v-if="productData && productData.mulInsOrderList">
3
+ <section v-if="params.allowCustomResult" class="bxt-custom-result">
4
+ <div class="bxt-custom-result-title">
5
+ <span class="bxt-custom-result-title_desc" @click="isShowCustomValueTips = !isShowCustomValueTips">
6
+ 自定义保费
7
+ <i class="iconfont" :class="isShowCustomValueTips ? 'icon-arrows_up' : 'icon-arrows_down'" />
8
+ </span>
9
+ <bxs-switch v-model="productData.inputResultSwitch" @change="createInsuranceInputResultEle()" />
10
+ </div>
11
+ <div v-if="isShowCustomValueTips" class="bxt-custom-result-tips">
12
+ 保险公司会因非标准体等原因修改费率。<br />
13
+ 打开"自定义保费"功能,按保单填写实际保费/保额
14
+ </div>
15
+ </section>
3
16
  <template v-for="ins in filterInsuranceList">
4
17
  <bxs-form
5
18
  :ref="`insuranceForm${ins.key}`"
@@ -191,6 +204,7 @@ import {
191
204
  productDataHandler,
192
205
  verifyProductRules,
193
206
  clearAddAndTakeAndAdjustBaoeData,
207
+ initElementValidateRules,
194
208
  convertEleOrderListToObj
195
209
  } from 'packages/bxs-utils/index';
196
210
  import { createdProductDataToCalc } from 'packages/planbook-input/helper.js';
@@ -198,7 +212,7 @@ import { createdProductDataToCalc } from 'packages/planbook-input/helper.js';
198
212
  import SelectItem from 'packages/components/form-item/select-item.vue';
199
213
  import TitleItem from 'packages/components/form-item/title-item.vue';
200
214
 
201
- import { Form, FormItem, Input, RadioGroup, Radio } from 'bxs-ui-vue';
215
+ import { Form, FormItem, Input, RadioGroup, Radio, Switch } from 'bxs-ui-vue';
202
216
  import 'bxs-ui-vue/esm/index.css';
203
217
 
204
218
  @Component({
@@ -210,7 +224,8 @@ import 'bxs-ui-vue/esm/index.css';
210
224
  [FormItem.name]: FormItem,
211
225
  [Input.name]: Input,
212
226
  [RadioGroup.name]: RadioGroup,
213
- [Radio.name]: Radio
227
+ [Radio.name]: Radio,
228
+ [Switch.name]: Switch
214
229
  }
215
230
  })
216
231
  export default class BxtProductInfo extends Vue {
@@ -218,6 +233,7 @@ export default class BxtProductInfo extends Vue {
218
233
  numberUnitStr = '';
219
234
  recommendValues = {};
220
235
  recommendValuesCache = {};
236
+ isShowCustomValueTips = true;
221
237
 
222
238
  @Prop({
223
239
  default: () => ({})
@@ -239,6 +255,11 @@ export default class BxtProductInfo extends Vue {
239
255
  })
240
256
  productKey!: number | string;
241
257
 
258
+ @Prop({
259
+ default: () => ({})
260
+ })
261
+ params: any;
262
+
242
263
  get personData() {
243
264
  return this.inputData && this.inputData.personData;
244
265
  }
@@ -336,6 +357,11 @@ export default class BxtProductInfo extends Vue {
336
357
  clearAddAndTakeAndAdjustBaoeData(productData);
337
358
  }
338
359
  productDataHandler(productData, this.verifyData && this.verifyData[productData.key], this.personData);
360
+ if (options.type === 'change') {
361
+ this.createInsuranceInputResultEle(options.insData, options.eleData);
362
+ } else {
363
+ this.createInsuranceInputResultEle();
364
+ }
339
365
  return verifyProductRules({
340
366
  personData: this.personData,
341
367
  productData,
@@ -514,6 +540,55 @@ export default class BxtProductInfo extends Vue {
514
540
  }
515
541
  });
516
542
  }
543
+ createInsuranceInputResultEle(insData?: any, eleData?: any) {
544
+ const { params, productData } = this;
545
+ if (!params.allowCustomResult) {
546
+ return;
547
+ }
548
+
549
+ productData.mulInsOrderList
550
+ .filter(e => e.key !== 'common' || e.eleOrderList)
551
+ .forEach(ins => {
552
+ // 需要特别注意组合险的情况
553
+ if (ins.groupKey) {
554
+ return;
555
+ }
556
+ if (insData && eleData && !insData.isGroup && insData.key === ins.key && eleData.key !== 'calMethod') {
557
+ return;
558
+ }
559
+
560
+ const calMethod = ins.eleOrderList.find(e => e.key === 'calMethod');
561
+ const baof = ins.eleOrderList.find(e => e.key === 'baof');
562
+ let inputResult = ins.eleOrderList.find(e => e.key === 'inputResult');
563
+ const labelName = calMethod ? (calMethod.value === 'baof2baoe' ? '保额' : '保费') : baof ? '保额' : '保费';
564
+ let value = ins.inputResult === undefined ? null : ins.inputResult;
565
+ if (inputResult) {
566
+ value = inputResult.value;
567
+ }
568
+ if (insData && eleData && insData.key === ins.key && eleData.key === 'inputResult') {
569
+ value = eleData.value;
570
+ }
571
+ inputResult = {
572
+ componentName: 'cmCommonInput',
573
+ placeholder: `按照保单填写${labelName}`,
574
+ isHide: !productData.inputResultSwitch,
575
+ key: 'inputResult',
576
+ labelName: `自定义${labelName}`,
577
+ inputType: 'text',
578
+ required: false,
579
+ regExp: '/^\\d{1,}(\\.\\d{1,2})?$/',
580
+ regExpMessage: '请输入1-2位小数的值',
581
+ value
582
+ };
583
+ inputResult.rules = initElementValidateRules(inputResult);
584
+ delete ins.inputResult;
585
+ ins.eleOrderList = ins.eleOrderList.filter(e => e.key !== 'inputResult');
586
+
587
+ if (productData.inputResultSwitch) {
588
+ ins.eleOrderList.push(inputResult);
589
+ }
590
+ });
591
+ }
517
592
  }
518
593
  </script>
519
594
  <style>
@@ -3,17 +3,17 @@
3
3
  ## 计划书产品(ProductInfo)
4
4
  说明:计划书产品组件
5
5
  内容:包括产品中各险种的各项元素值的修改、校验
6
- 属性:inputData、verifyData、groupKey、productKey
6
+ 属性:inputData、verifyData、groupKey、productKey、params
7
7
  方法:change、validate
8
8
 
9
9
  ### 示例
10
10
  ```html
11
11
  import { ProductInfo } from 'bxs-tools-ui'
12
- ...
13
- components: {
14
- ProductInfo
12
+ export default {
13
+ components: {
14
+ ProductInfo
15
+ }
15
16
  }
16
- ...
17
17
  ```
18
18
 
19
19
  ```html
@@ -25,33 +25,6 @@
25
25
  :product-key="2695"
26
26
  @change="cgProduct"
27
27
  ></ProductInfo>
28
- ...
29
- inputData = {
30
- personData: {
31
- personOrderList: [
32
- ...
33
- ],
34
- },
35
- productGroupList: [
36
- {
37
- "defNum": "5",
38
- "prodOrderList": [
39
- ...
40
- ],
41
- "maxNum": 5,
42
- "key": "allMainInsData"
43
- }
44
- ]
45
- }
46
- verifyData = null
47
- cgProduct(product, obj, inst) {
48
- if (obj.type === 'change') {
49
- alert(
50
- `${obj.ins.eleOrderList[0].labelName} -> ${obj.ele.labelName}: ${obj.ele.value}`
51
- );
52
- }
53
- }
54
- ...
55
28
  ```
56
29
 
57
30
  ### Attributes
@@ -61,33 +34,21 @@
61
34
  | verify-data | 可不传,计划书限制条件。如不传,不会调用模块内部封装的产品逻辑处理函数 | Object | {} |
62
35
  | group-key | 必传,产品组的key。 | Number, String | null |
63
36
  | product-key | 必传,产品的key。 | Number, String | null |
64
- > 注: 访问[计划书初始化API](http://app.winbaoxian.cn/planBook/V2/getInitData?insuranceTypeId=6128)查看示例数据。
37
+ | params | 可传,一些可选参数,目前有:allowCustomResult(自定义保额、保费)。 | Object | {} |
38
+
39
+ ### 数据说明
40
+ 注: 访问[计划书初始化API](http://app.winbaoxian.cn/planBook/V2/getInitData?insuranceTypeId=6128)查看示例数据,或者查看[静态示例数据](./demo/constant.js)。
65
41
  > inputData: data -> initData -> inputData
66
42
  > verifyData: data -> verifyData
67
43
  > groupKey: inputData -> productGroupList -> key
68
44
  > productKey: inputData -> productGroupList -> prodOrderList -> key
69
- ```js
70
- let inputData = {
71
- personData: {
72
- personOrderList: [personData对象, personData对象]
73
- },
74
- productGroupList: [
75
- {
76
- "prodOrderList": [
77
- productData对象,
78
- productData对象
79
- ],
80
- "key": "allMainInsData"
81
- }
82
- ]
83
- }
84
- ```
85
45
 
86
46
  #### productData对象
87
47
  | 参数| 说明 | 类型 | 默认值 |
88
48
  | --- | --- | --- | --- |
89
49
  | mulInsOrderList | 必传。险种列表,具体查看mulInsOrderList数组 | Array | - |
90
50
  | key | 必传。产品id | Number | - |
51
+
91
52
  #### mulInsOrderList数组
92
53
  | 参数| 说明 | 类型 | 默认值 |
93
54
  | --- | --- | --- | --- |
@@ -95,6 +56,7 @@ let inputData = {
95
56
  | key | 必传。险种id | Number | - |
96
57
  | code | 可不传。险种code | String | - |
97
58
  | isFollowing | 可不传。是否去除与上一险种之间的间距 | Boolean | - |
59
+
98
60
  #### eleOrderList数组
99
61
  | 参数| 说明 | 类型 | 默认值 |
100
62
  | --- | --- | --- | --- |
@@ -111,31 +73,6 @@ let inputData = {
111
73
  | restrictions | 可不传。当前元素的限制条件 | Array | - |
112
74
  | placeholder | 可不传。适用于 cmCommonInput 组件 | String | - |
113
75
  ```js
114
- productData = {
115
- "mulInsOrderList": [
116
- {
117
- "code": "",
118
- "isFollowing": false,
119
- "eleOrderList": [
120
- {
121
- "componentName": "cmCommonTitle",
122
- "common": false,
123
- "labelName": "康乐一生(2019)",
124
- "value": true,
125
- "key": "title",
126
- "isDisabled": true,
127
- "isHide": null,
128
- "isIgnoreValidate": null,
129
- "rules": []
130
- },
131
- ...
132
- ],
133
- "key": 18753
134
- },
135
- ],
136
- "key": 2695
137
- }
138
- ```
139
76
 
140
77
 
141
78
  ### Methods