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.
- package/README.md +20 -20
- package/es/add-and-take/index.css +1 -1
- package/es/add-and-take/index.js +283 -64
- package/es/adjust-baoe/index.css +1 -1
- package/es/adjust-baoe/index.js +444 -195
- package/es/business-card/index.css +1 -1
- package/es/business-card/index.js +1 -0
- package/es/canvas-poster/index.css +1 -1
- package/es/canvas-poster/index.js +1 -0
- package/es/index.css +1 -1
- package/es/index.js +936 -824
- package/es/insure-calculate/index.css +1 -1
- package/es/insure-calculate/index.js +438 -265
- package/es/person-info/index.css +1 -1
- package/es/person-info/index.js +296 -1370
- package/es/product-info/index.css +1 -1
- package/es/product-info/index.js +644 -548
- package/es/share-sheet/index.css +1 -1
- package/es/share-sheet/index.js +313 -21
- package/es/utils/index.js +530 -429
- package/lib/add-and-take/index.css +1 -1
- package/lib/add-and-take/index.js +283 -64
- package/lib/adjust-baoe/index.css +1 -1
- package/lib/adjust-baoe/index.js +441 -194
- package/lib/business-card/index.css +1 -1
- package/lib/business-card/index.js +1 -0
- package/lib/canvas-poster/index.css +1 -1
- package/lib/canvas-poster/index.js +1 -0
- package/lib/index.css +1 -1
- package/lib/index.js +939 -826
- package/lib/insure-calculate/index.css +1 -1
- package/lib/insure-calculate/index.js +438 -268
- package/lib/person-info/index.css +1 -1
- package/lib/person-info/index.js +295 -1372
- package/lib/product-info/index.css +1 -1
- package/lib/product-info/index.js +645 -550
- package/lib/share-sheet/index.css +1 -1
- package/lib/share-sheet/index.js +313 -25
- package/lib/utils/index.js +531 -433
- package/package.json +9 -7
- package/packages/add-and-take/components/interest-form.less +144 -0
- package/packages/add-and-take/components/interest-form.vue +179 -179
- package/packages/add-and-take/components/interest-items.less +87 -0
- package/packages/add-and-take/components/interest-items.vue +67 -80
- package/packages/add-and-take/components/interest-table.less +111 -0
- package/packages/add-and-take/components/interest-table.vue +31 -31
- package/packages/add-and-take/constant.ts +2 -2
- package/packages/add-and-take/demo/index.vue +89 -86
- package/packages/add-and-take/handler.ts +52 -57
- package/packages/add-and-take/index.less +69 -0
- package/packages/add-and-take/index.vue +156 -156
- package/packages/add-and-take/readme.md +87 -98
- package/packages/adjust-baoe/demo/index.vue +37 -47
- package/packages/adjust-baoe/index.less +125 -0
- package/packages/adjust-baoe/index.vue +134 -147
- package/packages/adjust-baoe/readme.md +35 -45
- package/packages/business-card/demo/index.vue +7 -7
- package/packages/business-card/index.less +100 -0
- package/packages/business-card/index.vue +18 -21
- package/packages/business-card/readme.md +46 -53
- package/packages/bxs-utils/demo/index.vue +2 -2
- package/packages/bxs-utils/index.ts +5 -5
- package/packages/bxs-utils/planbook/common.ts +56 -92
- package/packages/bxs-utils/planbook/index.ts +4 -4
- package/packages/bxs-utils/planbook/insurance.ts +137 -127
- package/packages/bxs-utils/planbook/person.ts +143 -147
- package/packages/bxs-utils/planbook/product.ts +473 -509
- package/packages/bxs-utils/readme.md +94 -84
- package/packages/bxs-utils/trade/index.js +1 -1
- package/packages/bxs-utils/trade/insureCalculate.js +91 -204
- package/packages/canvas-poster/demo/index.vue +9 -13
- package/packages/canvas-poster/index.less +5 -0
- package/packages/canvas-poster/index.vue +68 -79
- package/packages/canvas-poster/readme.md +106 -109
- package/packages/index.ts +1 -1
- package/packages/insure-calculate/demo/index.vue +20 -20
- package/packages/insure-calculate/index.less +366 -0
- package/packages/insure-calculate/index.vue +305 -329
- package/packages/insure-calculate/readme.md +99 -106
- package/packages/person-info/crm-popup.vue +81 -80
- package/packages/person-info/demo/index.vue +25 -37
- package/packages/person-info/index-inline.less +11 -0
- package/packages/person-info/index.vue +53 -83
- package/packages/person-info/readme.md +109 -115
- package/packages/planbook-input/components/footer.less +54 -0
- package/packages/planbook-input/components/footer.vue +8 -64
- package/packages/planbook-input/components/handler.js +33 -44
- package/packages/planbook-input/components/product-table.less +235 -0
- package/packages/planbook-input/components/product-table.vue +114 -108
- package/packages/planbook-input/demo/index.vue +3 -3
- package/packages/planbook-input/helper.js +852 -465
- package/packages/planbook-input/index.less +30 -0
- package/packages/planbook-input/index.vue +86 -103
- package/packages/planbook-input/readme.md +72 -90
- package/packages/product-info/demo/constant.js +1 -1
- package/packages/product-info/demo/index.vue +31 -43
- package/packages/product-info/index.less +271 -0
- package/packages/product-info/index.vue +198 -210
- package/packages/product-info/readme.md +72 -75
- package/packages/share-sheet/constant.js +4 -4
- package/packages/share-sheet/demo/index.vue +10 -10
- package/packages/share-sheet/handler.js +14 -14
- package/packages/share-sheet/index.less +201 -0
- package/packages/share-sheet/index.vue +39 -39
- package/packages/share-sheet/readme.md +121 -127
- package/src/api/add-and-take.js +45 -0
- package/src/api/adjust-baoe.js +16 -0
- package/src/api/index.js +6 -0
- package/src/api/planbook.js +93 -0
- package/src/api/request.js +211 -0
- package/src/api/trade.js +56 -0
- package/src/api/user.js +18 -0
- package/src/components/common/common-age-birthday.less +66 -0
- package/src/components/common/common-age-birthday.vue +27 -95
- package/src/components/common/common-popup.less +81 -0
- package/src/components/common/common-popup.vue +12 -96
- package/src/components/common/common-radio.less +75 -0
- package/src/components/common/common-radio.vue +13 -91
- package/src/components/common/common-select.less +13 -0
- package/src/components/common/common-select.vue +21 -38
- package/src/components/common/common-title.less +115 -0
- package/src/components/common/common-title.vue +24 -24
- package/src/js/loading.js +6 -6
- package/src/js/md5Token.js +38 -44
- package/src/js/utils.js +45 -53
- package/src/js/variables.js +47 -25
- package/src/style/base.less +18 -0
- package/src/style/color.less +40 -0
- package/src/style/variables.less +21 -42
- package/packages/add-and-take/api.ts +0 -70
- package/packages/add-and-take/components/interest-form.css +0 -146
- package/packages/add-and-take/components/interest-items.css +0 -87
- package/packages/add-and-take/components/interest-table.css +0 -113
- package/packages/add-and-take/index.css +0 -70
- package/packages/adjust-baoe/index.css +0 -123
- package/packages/business-card/index.css +0 -101
- package/packages/canvas-poster/index.css +0 -5
- package/packages/insure-calculate/index.css +0 -368
- package/packages/planbook-input/api.js +0 -29
- package/packages/planbook-input/components/product-table.css +0 -236
- package/packages/planbook-input/index.css +0 -31
- package/packages/product-info/index.css +0 -264
- package/packages/share-sheet/index.css +0 -203
- package/src/components/common/common-title.css +0 -116
- package/src/js/request.js +0 -64
- package/src/style/apply.css +0 -25
- package/src/style/base.css +0 -36
- package/src/style/color.css +0 -74
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
@import (reference) 'variables.less';
|
|
2
|
+
|
|
3
|
+
.bxt-business-card {
|
|
4
|
+
position: fixed;
|
|
5
|
+
left: 0;
|
|
6
|
+
bottom: 0;
|
|
7
|
+
width: 100%;
|
|
8
|
+
padding-bottom: constant(safe-area-inset-bottom);
|
|
9
|
+
padding-bottom: env(safe-area-inset-bottom);
|
|
10
|
+
box-sizing: content-box;
|
|
11
|
+
background: #f8f8f8;
|
|
12
|
+
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
|
|
13
|
+
z-index: 100;
|
|
14
|
+
|
|
15
|
+
& .bxt-business-card-ul {
|
|
16
|
+
position: relative;
|
|
17
|
+
padding: 10px 15px;
|
|
18
|
+
white-space: nowrap;
|
|
19
|
+
|
|
20
|
+
& .bxt-business-card-li {
|
|
21
|
+
display: inline-block;
|
|
22
|
+
line-height: 100%;
|
|
23
|
+
vertical-align: middle;
|
|
24
|
+
|
|
25
|
+
& .bxt-business-card-avatar {
|
|
26
|
+
display: block;
|
|
27
|
+
width: 100%;
|
|
28
|
+
height: 100%;
|
|
29
|
+
border-radius: 100px;
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
& .bxt-business-card-container {
|
|
34
|
+
margin-left: 9px;
|
|
35
|
+
line-height: 40px;
|
|
36
|
+
|
|
37
|
+
& .bxt-business-card-name,
|
|
38
|
+
& .bxt-business-card-rank {
|
|
39
|
+
.bxt-nowrap();
|
|
40
|
+
|
|
41
|
+
display: block;
|
|
42
|
+
line-height: 100%;
|
|
43
|
+
font-size: 16px;
|
|
44
|
+
font-weight: bold;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
& .bxt-business-card-rank {
|
|
48
|
+
margin-top: 2px;
|
|
49
|
+
font-size: 12px;
|
|
50
|
+
transform: scale(0.8333);
|
|
51
|
+
transform-origin: 0 50%;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
& .bxt-business-card-diamond {
|
|
55
|
+
width: 15px;
|
|
56
|
+
vertical-align: top;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
& .bxt-business-card-mobile {
|
|
61
|
+
.bxt-nowrap();
|
|
62
|
+
|
|
63
|
+
display: block;
|
|
64
|
+
line-height: 40px;
|
|
65
|
+
font-size: 14px;
|
|
66
|
+
color: inherit;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
& .bxt-business-card-button {
|
|
70
|
+
display: inline-block;
|
|
71
|
+
margin-top: 3px;
|
|
72
|
+
padding: 0 12px;
|
|
73
|
+
line-height: 35px;
|
|
74
|
+
border-radius: 2px;
|
|
75
|
+
font-size: 13px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&:nth-child(1) {
|
|
79
|
+
width: 40px;
|
|
80
|
+
height: 40px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&:nth-child(2) {
|
|
84
|
+
min-width: 25%;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&:nth-child(3) {
|
|
88
|
+
width: 32%;
|
|
89
|
+
margin-left: 9px;
|
|
90
|
+
text-align: center;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&:nth-child(4) {
|
|
94
|
+
position: absolute;
|
|
95
|
+
top: 10px;
|
|
96
|
+
right: 15px;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -27,8 +27,9 @@
|
|
|
27
27
|
</div>
|
|
28
28
|
</template>
|
|
29
29
|
<script lang="ts">
|
|
30
|
-
import Vue from 'vue'
|
|
31
|
-
import { Component, Prop } from 'vue-property-decorator'
|
|
30
|
+
import Vue from 'vue'
|
|
31
|
+
import { Component, Prop } from 'vue-property-decorator'
|
|
32
|
+
import './index.less'
|
|
32
33
|
|
|
33
34
|
const defaultCardData: any = {
|
|
34
35
|
avatar: '',
|
|
@@ -36,63 +37,59 @@ const defaultCardData: any = {
|
|
|
36
37
|
rank: '',
|
|
37
38
|
rankIcon: '',
|
|
38
39
|
mobile: ''
|
|
39
|
-
}
|
|
40
|
+
}
|
|
40
41
|
const defaultButtonData: any = {
|
|
41
42
|
tx: '编辑名片',
|
|
42
43
|
bg: '#ED9E14',
|
|
43
44
|
color: '#fff'
|
|
44
|
-
}
|
|
45
|
+
}
|
|
45
46
|
|
|
46
47
|
@Component({})
|
|
47
48
|
export default class BusinessCard extends Vue {
|
|
48
49
|
rankStyle: any = {
|
|
49
50
|
color: '#999'
|
|
50
|
-
}
|
|
51
|
-
buttonStyle: any = {}
|
|
51
|
+
}
|
|
52
|
+
buttonStyle: any = {}
|
|
52
53
|
|
|
53
54
|
@Prop({
|
|
54
55
|
default: () => {
|
|
55
|
-
return defaultCardData
|
|
56
|
+
return defaultCardData
|
|
56
57
|
}
|
|
57
58
|
})
|
|
58
|
-
cardData: any
|
|
59
|
+
cardData: any
|
|
59
60
|
|
|
60
61
|
@Prop({
|
|
61
62
|
default: () => {
|
|
62
|
-
return defaultButtonData
|
|
63
|
+
return defaultButtonData
|
|
63
64
|
}
|
|
64
65
|
})
|
|
65
|
-
buttonData: any
|
|
66
|
+
buttonData: any
|
|
66
67
|
|
|
67
68
|
created() {
|
|
68
69
|
//默认头像
|
|
69
70
|
if (!this.cardData.avatar) {
|
|
70
|
-
this.cardData.avatar = defaultCardData.avatar
|
|
71
|
+
this.cardData.avatar = defaultCardData.avatar
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
//按钮样式
|
|
74
75
|
if (this.buttonData) {
|
|
75
|
-
this.buttonStyle.background = this.buttonData.bg || defaultButtonData.bg
|
|
76
|
-
this.buttonStyle.color = this.buttonData.color || defaultButtonData.color
|
|
76
|
+
this.buttonStyle.background = this.buttonData.bg || defaultButtonData.bg
|
|
77
|
+
this.buttonStyle.color = this.buttonData.color || defaultButtonData.color
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
80
|
mounted() {
|
|
80
81
|
//职级样式
|
|
81
|
-
const thisEl: any = this.$el
|
|
82
|
+
const thisEl: any = this.$el
|
|
82
83
|
if (thisEl.style.color) {
|
|
83
|
-
this.rankStyle.color = thisEl.style.color
|
|
84
|
+
this.rankStyle.color = thisEl.style.color
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
avatarHandler() {
|
|
88
|
-
this.$emit('click')
|
|
89
|
+
this.$emit('click')
|
|
89
90
|
}
|
|
90
91
|
buttonHandler() {
|
|
91
|
-
this.$emit('clickBtn')
|
|
92
|
+
this.$emit('clickBtn')
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
95
|
</script>
|
|
95
|
-
<style>
|
|
96
|
-
@import 'base.css';
|
|
97
|
-
@import './index.css';
|
|
98
|
-
</style>
|
|
@@ -29,44 +29,39 @@ export default {
|
|
|
29
29
|
|
|
30
30
|
```html
|
|
31
31
|
<template>
|
|
32
|
-
<BusinessCard
|
|
33
|
-
:card-data="cardData"
|
|
34
|
-
:button-data="buttonData"
|
|
35
|
-
@click="avatarHandler"
|
|
36
|
-
@clickBtn="buttonHandler"
|
|
37
|
-
/>
|
|
32
|
+
<BusinessCard :card-data="cardData" :button-data="buttonData" @click="avatarHandler" @clickBtn="buttonHandler" />
|
|
38
33
|
</template>
|
|
39
34
|
|
|
40
35
|
<script>
|
|
41
|
-
import { BusinessCard } from 'bxs-tools-ui';
|
|
42
|
-
|
|
43
|
-
export default {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
36
|
+
import { BusinessCard } from 'bxs-tools-ui';
|
|
37
|
+
|
|
38
|
+
export default {
|
|
39
|
+
components: { BusinessCard },
|
|
40
|
+
data() {
|
|
41
|
+
return {
|
|
42
|
+
cardData: {
|
|
43
|
+
avatar: '//media.winbaoxian.com/autoUpload/activity/xxx.jpeg',
|
|
44
|
+
name: '张三',
|
|
45
|
+
rank: '三联钻代理人',
|
|
46
|
+
rankIcon: '//media.winbaoxian.com/autoUpload/activity/diamond_xxx.png',
|
|
47
|
+
mobile: '13800138000'
|
|
48
|
+
},
|
|
49
|
+
buttonData: {
|
|
50
|
+
tx: '编辑名片',
|
|
51
|
+
bg: '#ED9E14',
|
|
52
|
+
color: '#fff'
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
methods: {
|
|
57
|
+
avatarHandler() {
|
|
58
|
+
console.log('点击头像或姓名');
|
|
53
59
|
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
bg: '#ED9E14',
|
|
57
|
-
color: '#fff'
|
|
60
|
+
buttonHandler() {
|
|
61
|
+
console.log('点击操作按钮');
|
|
58
62
|
}
|
|
59
|
-
};
|
|
60
|
-
},
|
|
61
|
-
methods: {
|
|
62
|
-
avatarHandler() {
|
|
63
|
-
console.log('点击头像或姓名');
|
|
64
|
-
},
|
|
65
|
-
buttonHandler() {
|
|
66
|
-
console.log('点击操作按钮');
|
|
67
63
|
}
|
|
68
|
-
}
|
|
69
|
-
};
|
|
64
|
+
};
|
|
70
65
|
</script>
|
|
71
66
|
```
|
|
72
67
|
|
|
@@ -76,30 +71,28 @@ export default {
|
|
|
76
71
|
|
|
77
72
|
#### 根级 props
|
|
78
73
|
|
|
79
|
-
| 参数
|
|
80
|
-
|
|
|
81
|
-
| `cardData`
|
|
74
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
75
|
+
| ------------ | -------------- | ------ | ------------------ |
|
|
76
|
+
| `cardData` | 必传,名片信息 | Object | 见 CardData 对象 |
|
|
82
77
|
| `buttonData` | 可选,按钮配置 | Object | 见 ButtonData 对象 |
|
|
83
78
|
|
|
84
|
-
|
|
85
79
|
#### CardData 对象
|
|
86
80
|
|
|
87
|
-
| 参数
|
|
88
|
-
|
|
|
89
|
-
| `avatar`
|
|
90
|
-
| `name`
|
|
91
|
-
| `rank`
|
|
92
|
-
| `rankIcon` | 职级图标地址
|
|
93
|
-
| `mobile`
|
|
94
|
-
|
|
81
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
82
|
+
| ---------- | -------------------------- | ------ | ------ |
|
|
83
|
+
| `avatar` | 头像图片地址 | String | `''` |
|
|
84
|
+
| `name` | 姓名 | String | `''` |
|
|
85
|
+
| `rank` | 职级文案 | String | `''` |
|
|
86
|
+
| `rankIcon` | 职级图标地址 | String | `''` |
|
|
87
|
+
| `mobile` | 手机号(点击触发系统拨号) | String | `''` |
|
|
95
88
|
|
|
96
89
|
#### ButtonData 对象
|
|
97
90
|
|
|
98
|
-
| 参数
|
|
99
|
-
|
|
|
100
|
-
| `tx`
|
|
101
|
-
| `bg`
|
|
102
|
-
| `color` | 按钮文字颜色
|
|
91
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
92
|
+
| ------- | -------------------------- | ------ | ------------ |
|
|
93
|
+
| `tx` | 按钮文案;为空时不渲染按钮 | String | `'编辑名片'` |
|
|
94
|
+
| `bg` | 按钮背景色 | String | `'#ED9E14'` |
|
|
95
|
+
| `color` | 按钮文字颜色 | String | `'#fff'` |
|
|
103
96
|
|
|
104
97
|
---
|
|
105
98
|
|
|
@@ -111,7 +104,7 @@ export default {
|
|
|
111
104
|
|
|
112
105
|
### Events
|
|
113
106
|
|
|
114
|
-
| 事件名
|
|
115
|
-
|
|
|
116
|
-
| `click`
|
|
117
|
-
| `clickBtn` | 点击操作按钮时触发
|
|
107
|
+
| 事件名 | 说明 | 参数 |
|
|
108
|
+
| ---------- | ------------------------ | ---- |
|
|
109
|
+
| `click` | 点击头像或姓名区域时触发 | — |
|
|
110
|
+
| `clickBtn` | 点击操作按钮时触发 | — |
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * from './planbook'
|
|
2
|
-
export * from './trade'
|
|
3
|
-
import * as planbook from './planbook'
|
|
4
|
-
import * as trade from './trade'
|
|
1
|
+
export * from './planbook'
|
|
2
|
+
export * from './trade'
|
|
3
|
+
import * as planbook from './planbook'
|
|
4
|
+
import * as trade from './trade'
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
7
|
planbook,
|
|
8
8
|
trade
|
|
9
|
-
}
|
|
9
|
+
}
|
|
@@ -31,21 +31,21 @@ export function consoleLogWhenEnable(...args: any[]) {
|
|
|
31
31
|
// }
|
|
32
32
|
* @returns {any}
|
|
33
33
|
*/
|
|
34
|
-
export function convertEleOrderListToObj(obj
|
|
35
|
-
let resData
|
|
34
|
+
export function convertEleOrderListToObj(obj: any): any {
|
|
35
|
+
let resData: any = {}
|
|
36
36
|
for (let k in obj) {
|
|
37
37
|
if (k == 'eleOrderList') {
|
|
38
|
-
obj[k].map((ele
|
|
39
|
-
resData[ele.key] = ele.value
|
|
40
|
-
})
|
|
38
|
+
obj[k].map((ele: any) => {
|
|
39
|
+
resData[ele.key] = ele.value
|
|
40
|
+
})
|
|
41
41
|
} else {
|
|
42
42
|
// eleOrderList中有的key,则不取当前对象下的属性
|
|
43
|
-
if (!obj.eleOrderList || obj.eleOrderList.every((e
|
|
44
|
-
resData[k] = obj[k]
|
|
43
|
+
if (!obj.eleOrderList || obj.eleOrderList.every((e: any) => e.key !== k)) {
|
|
44
|
+
resData[k] = obj[k]
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
return resData
|
|
48
|
+
return resData
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
/**
|
|
@@ -55,22 +55,22 @@ export function convertEleOrderListToObj(obj : any) : any {
|
|
|
55
55
|
* @param {IPbProductGroup} productGroupList 所有产品组数据
|
|
56
56
|
* @returns {number} 总保费
|
|
57
57
|
*/
|
|
58
|
-
export function calcTotalBaof(productGroupList
|
|
59
|
-
let totalBaof
|
|
58
|
+
export function calcTotalBaof(productGroupList: IPbProductGroup[]): number {
|
|
59
|
+
let totalBaof: number = 0
|
|
60
60
|
if (!productGroupList) {
|
|
61
61
|
return totalBaof
|
|
62
62
|
}
|
|
63
|
-
productGroupList.map((group
|
|
63
|
+
productGroupList.map((group: IPbProductGroup) => {
|
|
64
64
|
if (group.isHide) {
|
|
65
|
-
return
|
|
65
|
+
return
|
|
66
66
|
}
|
|
67
|
-
group.prodOrderList.map((prod
|
|
67
|
+
group.prodOrderList.map((prod: IPbProduct) => {
|
|
68
68
|
if (prod.hadChoice && !prod.hide) {
|
|
69
|
-
totalBaof += Number(prod.totalBaof) || 0
|
|
69
|
+
totalBaof += Number(prod.totalBaof) || 0
|
|
70
70
|
}
|
|
71
|
-
})
|
|
72
|
-
})
|
|
73
|
-
return totalBaof && Number(totalBaof.toFixed(2))
|
|
71
|
+
})
|
|
72
|
+
})
|
|
73
|
+
return totalBaof && Number(totalBaof.toFixed(2))
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
/**
|
|
@@ -91,18 +91,18 @@ export function calcTotalBaof(productGroupList : IPbProductGroup []) : number {
|
|
|
91
91
|
* getHuomianPeriodValue('a60', 1, 30)
|
|
92
92
|
* // returns b29
|
|
93
93
|
*/
|
|
94
|
-
export function getHuomianPeriodValue(val = '', pMinus = 0, age = 0)
|
|
94
|
+
export function getHuomianPeriodValue(val = '', pMinus = 0, age = 0): string {
|
|
95
95
|
// a999: 终身; a1000: 趸交
|
|
96
96
|
if (val == 'a999' || val == 'a1000') {
|
|
97
|
-
return val
|
|
97
|
+
return val
|
|
98
98
|
}
|
|
99
99
|
// b开头:XXX 年。关联险种的交费期间 - 指定的值
|
|
100
100
|
if (val.search(/^b/) !== -1) {
|
|
101
|
-
return 'b' + (Number(val.replace(/[^0-9]/, '')) - pMinus)
|
|
101
|
+
return 'b' + (Number(val.replace(/[^0-9]/, '')) - pMinus)
|
|
102
102
|
}
|
|
103
103
|
// a开头:至XXX岁。关联险种的交费期间 - 人员的年龄 - 指定的值
|
|
104
104
|
if (val.search(/^a/) !== -1) {
|
|
105
|
-
return 'b' + (Number(val.replace(/[^0-9]/, '')) - age - pMinus)
|
|
105
|
+
return 'b' + (Number(val.replace(/[^0-9]/, '')) - age - pMinus)
|
|
106
106
|
}
|
|
107
107
|
return ''
|
|
108
108
|
}
|
|
@@ -124,17 +124,17 @@ export function getHuomianPeriodValue(val = '', pMinus = 0, age = 0) : string {
|
|
|
124
124
|
* getNumberFromYear('b10')
|
|
125
125
|
* // returns 10
|
|
126
126
|
*/
|
|
127
|
-
export function getNumberFromYear(value
|
|
127
|
+
export function getNumberFromYear(value: string | number, age = 0): number {
|
|
128
128
|
if (typeof value === 'number') {
|
|
129
|
-
return value
|
|
129
|
+
return value
|
|
130
130
|
}
|
|
131
131
|
if (value === 'a1000') {
|
|
132
|
-
return 1
|
|
132
|
+
return 1
|
|
133
133
|
}
|
|
134
134
|
if (value.match(/^a/)) {
|
|
135
|
-
return Number(value.replace(/\D/g, '')) - age
|
|
135
|
+
return Number(value.replace(/\D/g, '')) - age
|
|
136
136
|
}
|
|
137
|
-
return Number(value.replace(/\D/g, ''))
|
|
137
|
+
return Number(value.replace(/\D/g, ''))
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
/**
|
|
@@ -153,48 +153,8 @@ export function getNumberFromYear(value : string | number, age = 0) : number {
|
|
|
153
153
|
* converUnit10000(2000001)
|
|
154
154
|
* // returns 2000001
|
|
155
155
|
*/
|
|
156
|
-
export function converUnit10000(value
|
|
157
|
-
return value >= 10000 && !(value % 10000) ? `${value / 10000}万` : value
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* **对象的深拷贝**
|
|
162
|
-
* @ignore
|
|
163
|
-
* @author Lizhao <lz@winbaoxian.com>
|
|
164
|
-
* @date 2022-04-25
|
|
165
|
-
* @param {object} obj - 必传
|
|
166
|
-
* @param {WeakMap} hash - 可不传
|
|
167
|
-
* @returns {object} 拷贝对象
|
|
168
|
-
*/
|
|
169
|
-
export function deepCopy(obj : any, hash = new WeakMap()) : any {
|
|
170
|
-
if (!obj || typeof obj !== 'object') {
|
|
171
|
-
return obj;
|
|
172
|
-
}
|
|
173
|
-
if (hash.has(obj)) {
|
|
174
|
-
return hash.get(obj);
|
|
175
|
-
}
|
|
176
|
-
let newObj : any;
|
|
177
|
-
let Constructor = obj.constructor;
|
|
178
|
-
switch (Constructor) {
|
|
179
|
-
case RegExp:
|
|
180
|
-
newObj = new Constructor(obj);
|
|
181
|
-
break;
|
|
182
|
-
case Date:
|
|
183
|
-
newObj = new Constructor(obj.getTime());
|
|
184
|
-
break;
|
|
185
|
-
default:
|
|
186
|
-
newObj = new Constructor();
|
|
187
|
-
break;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
hash.set(obj, newObj);
|
|
191
|
-
for (let key in obj) {
|
|
192
|
-
if (obj.hasOwnProperty(key)) {
|
|
193
|
-
newObj[key] = typeof obj[key] === 'object' ? deepCopy(obj[key], hash) : obj[key];
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
return newObj;
|
|
156
|
+
export function converUnit10000(value: number): number | string {
|
|
157
|
+
return value >= 10000 && !(value % 10000) ? `${value / 10000}万` : value
|
|
198
158
|
}
|
|
199
159
|
|
|
200
160
|
/**
|
|
@@ -214,17 +174,14 @@ export function deepCopy(obj : any, hash = new WeakMap()) : any {
|
|
|
214
174
|
* getAgeFromBirth('2000-01-10', '2022-01-09')
|
|
215
175
|
* // returns 21
|
|
216
176
|
*/
|
|
217
|
-
export function getAgeFromBirth(birth
|
|
218
|
-
const nowDate
|
|
219
|
-
const bDate
|
|
220
|
-
let age = nowDate.getFullYear() - bDate.getFullYear()
|
|
221
|
-
if (
|
|
222
|
-
|
|
223
|
-
(nowDate.getMonth() - bDate.getMonth() === 0 && nowDate.getDate() - bDate.getDate() < 0)
|
|
224
|
-
) {
|
|
225
|
-
age--;
|
|
177
|
+
export function getAgeFromBirth(birth: Date | number | string, cDate?: Date | number | string): number {
|
|
178
|
+
const nowDate: Date = cDate ? new Date(cDate) : new Date()
|
|
179
|
+
const bDate: Date = new Date(birth)
|
|
180
|
+
let age = nowDate.getFullYear() - bDate.getFullYear()
|
|
181
|
+
if (nowDate.getMonth() - bDate.getMonth() < 0 || (nowDate.getMonth() - bDate.getMonth() === 0 && nowDate.getDate() - bDate.getDate() < 0)) {
|
|
182
|
+
age--
|
|
226
183
|
}
|
|
227
|
-
return age
|
|
184
|
+
return age
|
|
228
185
|
}
|
|
229
186
|
|
|
230
187
|
/**
|
|
@@ -271,7 +228,7 @@ export function formatNumberToThousand(n) {
|
|
|
271
228
|
* textOverflowEllipsis('hello world', 4)
|
|
272
229
|
* // returns hello world
|
|
273
230
|
*/
|
|
274
|
-
export function textOverflowEllipsis
|
|
231
|
+
export function textOverflowEllipsis(str, n) {
|
|
275
232
|
let text = String(str)
|
|
276
233
|
if (text && n && n > 2) {
|
|
277
234
|
const ChineseChars = text.match(/[^0-9a-z.()]/g) || ''
|
|
@@ -284,8 +241,10 @@ export function textOverflowEllipsis (str, n) {
|
|
|
284
241
|
return text
|
|
285
242
|
}
|
|
286
243
|
|
|
287
|
-
export function getExpressionParamMap
|
|
288
|
-
const map
|
|
244
|
+
export function getExpressionParamMap(personData: IPbPersons, product: IPbProduct, ins: IProdInsurance, options: any): any {
|
|
245
|
+
const map: any = {
|
|
246
|
+
user: {},
|
|
247
|
+
executeSource: null, // 执行:init-初始化 import-导入数据 userAction-用户操作 confirm-确认
|
|
289
248
|
planbookId: null, // 计划书id
|
|
290
249
|
productId: null, // 产品id
|
|
291
250
|
insured: {}, // 被保人
|
|
@@ -298,7 +257,7 @@ export function getExpressionParamMap (personData : IPbPersons, product : IPbPro
|
|
|
298
257
|
common: {}, // 通用信息
|
|
299
258
|
customVariable: null, // 自定义变量
|
|
300
259
|
cv: null, // 简写,自定义变量
|
|
301
|
-
t: {}
|
|
260
|
+
t: {} // 事件目标
|
|
302
261
|
}
|
|
303
262
|
|
|
304
263
|
if (personData) {
|
|
@@ -326,7 +285,7 @@ export function getExpressionParamMap (personData : IPbPersons, product : IPbPro
|
|
|
326
285
|
})
|
|
327
286
|
if (Array.isArray(product.mulInsOrderList)) {
|
|
328
287
|
const common = product.mulInsOrderList.find(item => item.key === 'common')
|
|
329
|
-
const insuranceList = product.mulInsOrderList.filter((item
|
|
288
|
+
const insuranceList = product.mulInsOrderList.filter((item: any) => !['common'].includes(item.key)).map(item => convertEleOrderListToObj(item))
|
|
330
289
|
map.m = insuranceList[0] ? insuranceList[0] : {}
|
|
331
290
|
map.me = ins && ins.key ? insuranceList.find(e => e.key === ins.key) || {} : {}
|
|
332
291
|
map.common = common ? convertEleOrderListToObj(common) : {}
|
|
@@ -337,12 +296,18 @@ export function getExpressionParamMap (personData : IPbPersons, product : IPbPro
|
|
|
337
296
|
}
|
|
338
297
|
|
|
339
298
|
if (options) {
|
|
299
|
+
if (options.user) {
|
|
300
|
+
map.user = options.user
|
|
301
|
+
}
|
|
340
302
|
if (options.planbookId) {
|
|
341
303
|
map.planbookId = options.planbookId
|
|
342
304
|
}
|
|
343
305
|
if (options.eventTarget) {
|
|
344
306
|
map.t = options.eventTarget
|
|
345
307
|
}
|
|
308
|
+
if (options.executeSource) {
|
|
309
|
+
map.executeSource = options.executeSource
|
|
310
|
+
}
|
|
346
311
|
}
|
|
347
312
|
|
|
348
313
|
if (ins && ins.customVariableExp) {
|
|
@@ -350,18 +315,17 @@ export function getExpressionParamMap (personData : IPbPersons, product : IPbPro
|
|
|
350
315
|
map.customVariable = eval(exp)
|
|
351
316
|
map.cv = map.customVariable
|
|
352
317
|
}
|
|
353
|
-
|
|
354
318
|
return map
|
|
355
319
|
}
|
|
356
320
|
|
|
357
|
-
export function executeElementRule
|
|
321
|
+
export function executeElementRule(personData: IPbPersons, product: IPbProduct, ins: IProdInsurance, ele: IInsElement, options: any = {}): any {
|
|
358
322
|
const paramMap = getExpressionParamMap(personData, product, ins, options)
|
|
359
|
-
const newEleMap
|
|
323
|
+
const newEleMap: any = {}
|
|
360
324
|
if (paramMap) {
|
|
361
325
|
if (['cmCommonTitle'].includes(ele.componentName!)) {
|
|
362
326
|
if (ele.underwriteExp) {
|
|
363
327
|
const exp = ele.underwriteExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2')
|
|
364
|
-
const evalValue
|
|
328
|
+
const evalValue: Array<number> = eval(exp)
|
|
365
329
|
if (Array.isArray(evalValue)) {
|
|
366
330
|
if ([0, 1].includes(evalValue[0])) {
|
|
367
331
|
newEleMap.value = evalValue[0] === 1
|
|
@@ -384,16 +348,16 @@ export function executeElementRule (personData : IPbPersons, product : IPbProduc
|
|
|
384
348
|
}
|
|
385
349
|
if (ele.underwriteExp) {
|
|
386
350
|
const exp = ele.underwriteExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2')
|
|
387
|
-
const evalValue
|
|
351
|
+
const evalValue: Array<number> = eval(exp)
|
|
388
352
|
if (Array.isArray(evalValue) && Array.isArray(ele.opts)) {
|
|
389
353
|
if (evalValue.length === 2) {
|
|
390
|
-
newEleMap.opts = (ele.opts || []).filter((o
|
|
354
|
+
newEleMap.opts = (ele.opts || []).filter((o: any) => o.val >= evalValue[0] && o.val <= evalValue[1])
|
|
391
355
|
} else {
|
|
392
|
-
newEleMap.opts = (ele.opts || []).filter((o
|
|
356
|
+
newEleMap.opts = (ele.opts || []).filter((o: any) => evalValue.includes(o.val))
|
|
393
357
|
}
|
|
394
358
|
}
|
|
395
359
|
if (Array.isArray(newEleMap.opts)) {
|
|
396
|
-
if (newEleMap.opts.length && !newEleMap.opts.some((o
|
|
360
|
+
if (newEleMap.opts.length && !newEleMap.opts.some((o: any) => o.val === ele.value)) {
|
|
397
361
|
newEleMap.value = newEleMap.opts[0].val
|
|
398
362
|
}
|
|
399
363
|
}
|
|
@@ -427,4 +391,4 @@ export function executeElementRule (personData : IPbPersons, product : IPbProduc
|
|
|
427
391
|
}
|
|
428
392
|
}
|
|
429
393
|
return newEleMap
|
|
430
|
-
}
|
|
394
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './common'
|
|
2
|
-
export * from './person'
|
|
3
|
-
export * from './product'
|
|
4
|
-
export * from './insurance'
|
|
1
|
+
export * from './common'
|
|
2
|
+
export * from './person'
|
|
3
|
+
export * from './product'
|
|
4
|
+
export * from './insurance'
|