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
@@ -45,31 +45,31 @@ export default {
45
45
  </template>
46
46
 
47
47
  <script>
48
- import { InsureCalculate } from 'bxs-tools-ui';
49
-
50
- export default {
51
- components: { InsureCalculate },
52
- data() {
53
- return {
54
- productId: '102163',
55
- calculateData: {},
56
- planParams: {
57
- detail_age: '30周岁',
58
- detail_sex: '1'
59
- }
60
- };
61
- },
62
- methods: {
63
- // 主动获取当前试算数据(调用组件 confirm 方法)
64
- getCalculateData() {
65
- this.$refs.insureCalculate.confirm().then(({ t_version, code, data }) => {
66
- console.log(t_version, data);
67
- });
48
+ import { InsureCalculate } from 'bxs-tools-ui';
49
+
50
+ export default {
51
+ components: { InsureCalculate },
52
+ data() {
53
+ return {
54
+ productId: '102163',
55
+ calculateData: {},
56
+ planParams: {
57
+ detail_age: '30周岁',
58
+ detail_sex: '1'
59
+ }
60
+ };
68
61
  },
69
- onClose() {},
70
- onSure() {}
71
- }
72
- };
62
+ methods: {
63
+ // 主动获取当前试算数据(调用组件 confirm 方法)
64
+ getCalculateData() {
65
+ this.$refs.insureCalculate.confirm().then(({ t_version, code, data }) => {
66
+ console.log(t_version, data);
67
+ });
68
+ },
69
+ onClose() {},
70
+ onSure() {}
71
+ }
72
+ };
73
73
  </script>
74
74
  ```
75
75
 
@@ -77,67 +77,63 @@ export default {
77
77
 
78
78
  ### Attributes
79
79
 
80
- | 参数 | 说明 | 类型 | 默认值 |
81
- | --- | --- | --- | --- |
82
- | `calculateData` | 必传,试算组件原始数据 | Object | `{}` |
83
- | `productId` | 必传,试算产品 ID | String / Number | — |
84
- | `uuid` | 可选,C 端用户 uuid;传入后跳过内部自动获取用户信息接口 | String | — |
85
- | `planParams` | 必传,初始化参数,见 PlanParams 对象 | Object | — |
86
- | `lsTime` | 可选,本地缓存时长(分钟) | Number | `10` |
87
- | `isDev` | 可选,是否为开发环境;默认根据 `window.location.port` 自动判断,可手动覆盖 | Boolean | — |
88
- | `isShowDuty` | 可选,是否展示试算责任 | Boolean | `false` |
89
- | `showHeader` | 可选,是否展示顶部标题栏 | Boolean | `false` |
90
- | `title` | 可选,顶部标题,`showHeader` 为 `true` 时有效 | String | `''` |
91
- | `showFooter` | 可选,是否展示底部确定按钮 | Boolean | `false` |
92
- | `appid` | 可选,ToB 环境变量,用于判断是否为 ToB 环境 | String | `''` |
93
- | `openId` | 可选,ToB 环境变量;未获取到 `uuid` 时用于替代 `userUuid` | String | `''` |
94
-
80
+ | 参数 | 说明 | 类型 | 默认值 |
81
+ | --------------- | -------------------------------------------------------------------------- | --------------- | ------- |
82
+ | `calculateData` | 必传,试算组件原始数据 | Object | `{}` |
83
+ | `productId` | 必传,试算产品 ID | String / Number | — |
84
+ | `uuid` | 可选,C 端用户 uuid;传入后跳过内部自动获取用户信息接口 | String | — |
85
+ | `planParams` | 必传,初始化参数,见 PlanParams 对象 | Object | — |
86
+ | `lsTime` | 可选,本地缓存时长(分钟) | Number | `10` |
87
+ | `isDev` | 可选,是否为开发环境;默认根据 `window.location.port` 自动判断,可手动覆盖 | Boolean | — |
88
+ | `isShowDuty` | 可选,是否展示试算责任 | Boolean | `false` |
89
+ | `showHeader` | 可选,是否展示顶部标题栏 | Boolean | `false` |
90
+ | `title` | 可选,顶部标题,`showHeader` 为 `true` 时有效 | String | `''` |
91
+ | `showFooter` | 可选,是否展示底部确定按钮 | Boolean | `false` |
92
+ | `appid` | 可选,ToB 环境变量,用于判断是否为 ToB 环境 | String | `''` |
93
+ | `openId` | 可选,ToB 环境变量;未获取到 `uuid` 时用于替代 `userUuid` | String | `''` |
95
94
 
96
95
  #### calculateData 对象
97
96
 
98
- | 参数 | 说明 | 类型 |
99
- | --- | --- | --- |
100
- | `widgets` | 页面渲染数据,见 widgets 对象 | Array |
101
- | `current_data` | 当前选项映射值,元素见 current_data 对象 | Array |
102
- | `total_premium` | 试算保费(保留字段) | Number |
103
- | `product_id` | 当前试算产品 ID(保留字段) | String |
104
- | `risk_premiums` | 试算附加险相关信息(保留字段) | Array |
105
- | `terms` | 险种说明(保留字段) | Array |
106
-
97
+ | 参数 | 说明 | 类型 |
98
+ | --------------- | ---------------------------------------- | ------ |
99
+ | `widgets` | 页面渲染数据,见 widgets 对象 | Array |
100
+ | `current_data` | 当前选项映射值,元素见 current_data 对象 | Array |
101
+ | `total_premium` | 试算保费(保留字段) | Number |
102
+ | `product_id` | 当前试算产品 ID(保留字段) | String |
103
+ | `risk_premiums` | 试算附加险相关信息(保留字段) | Array |
104
+ | `terms` | 险种说明(保留字段) | Array |
107
105
 
108
106
  #### widgets 对象(单项)
109
107
 
110
- | 参数 | 说明 | 类型 |
111
- | --- | --- | --- |
112
- | `cal_key` | 是否与保费相关;`1` 相关,`0` 不相关 | Number |
113
- | `hidden` | 是否隐藏;`0` 展示,`1` 隐藏 | Number |
114
- | `key` | 取值 key,与 `opts` 联合使用:`opts[key]` | Number |
115
- | `label` | 试算因子名称 | String |
116
- | `opts` | 试算因子取值范围,以 `key` 为索引的对象,取当前值用 `opts[key]` | Object |
117
- | `riskCode` | 险种 code | String |
118
- | `type` | 映射的前端组件类型 | String |
119
-
108
+ | 参数 | 说明 | 类型 |
109
+ | ---------- | --------------------------------------------------------------- | ------ |
110
+ | `cal_key` | 是否与保费相关;`1` 相关,`0` 不相关 | Number |
111
+ | `hidden` | 是否隐藏;`0` 展示,`1` 隐藏 | Number |
112
+ | `key` | 取值 key,与 `opts` 联合使用:`opts[key]` | Number |
113
+ | `label` | 试算因子名称 | String |
114
+ | `opts` | 试算因子取值范围,以 `key` 为索引的对象,取当前值用 `opts[key]` | Object |
115
+ | `riskCode` | 险种 code | String |
116
+ | `type` | 映射的前端组件类型 | String |
120
117
 
121
118
  #### current_data 对象(单项)
122
119
 
123
- | 参数 | 说明 | 类型 |
124
- | --- | --- | --- |
125
- | `k` | 试算因子 Java 名称,对应 `widgets.key` | String |
126
- | `risk` | 险种 code,对应 `widgets.riskCode` | String |
127
- | `v` | 当前选项值,对应 `widgets.opts` 中的某个值 | String |
128
- | `age` | calendar 组件特有,当前年龄数值(保留字段) | Number |
129
- | `sv` | calendar 组件特有,可选年龄范围(保留字段) | String |
130
-
120
+ | 参数 | 说明 | 类型 |
121
+ | ------ | ------------------------------------------- | ------ |
122
+ | `k` | 试算因子 Java 名称,对应 `widgets.key` | String |
123
+ | `risk` | 险种 code,对应 `widgets.riskCode` | String |
124
+ | `v` | 当前选项值,对应 `widgets.opts` 中的某个值 | String |
125
+ | `age` | calendar 组件特有,当前年龄数值(保留字段) | Number |
126
+ | `sv` | calendar 组件特有,可选年龄范围(保留字段) | String |
131
127
 
132
128
  #### PlanParams 对象
133
129
 
134
- | 参数 | 说明 | 类型 |
135
- | --- | --- | --- |
136
- | `detail_age` | 被保人年龄,如 `'50周岁'` 或 `'1990-06-17'`;无限制不传 | String |
137
- | `detail_sex` | 被保人性别,`'1'` 男 / `'2'` 女;无限制不传 | String |
138
- | `detail_relation` | 投被保人关系;非本人:`'-1'`;本人:`'1'`;其他关系见备注;不限制:`''` / `undefined` / `null` | String |
139
- | `detail_applicant_age` | 投保人年龄,格式同 `detail_age`;无限制不传 | String |
140
- | `detail_applicant_sex` | 投保人性别,格式同 `detail_sex`;无限制不传 | String |
130
+ | 参数 | 说明 | 类型 |
131
+ | ---------------------- | ---------------------------------------------------------------------------------------------- | ------ |
132
+ | `detail_age` | 被保人年龄,如 `'50周岁'` 或 `'1990-06-17'`;无限制不传 | String |
133
+ | `detail_sex` | 被保人性别,`'1'` 男 / `'2'` 女;无限制不传 | String |
134
+ | `detail_relation` | 投被保人关系;非本人:`'-1'`;本人:`'1'`;其他关系见备注;不限制:`''` / `undefined` / `null` | String |
135
+ | `detail_applicant_age` | 投保人年龄,格式同 `detail_age`;无限制不传 | String |
136
+ | `detail_applicant_sex` | 投保人性别,格式同 `detail_sex`;无限制不传 | String |
141
137
 
142
138
  > `detail_relation` 其他关系值:`'14'` 丈夫 / `'15'` 妻子 / `'16'` 儿子 / `'17'` 女儿 / `'18'` 父亲 / `'19'` 母亲
143
139
 
@@ -147,61 +143,58 @@ export default {
147
143
 
148
144
  #### 组件实例方法(通过 `$refs` 调用)
149
145
 
150
- | 方法名 | 说明 | 出参 |
151
- | --- | --- | --- |
146
+ | 方法名 | 说明 | 出参 |
147
+ | --------- | ------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------- |
152
148
  | `confirm` | 主动获取当前试算数据,不触发试算请求 | Promise `{ t_version, code: 200, data }`;`data` 含 `widgets / total_premium / terms / product_id / current_data / risk_premiums` |
153
149
 
154
150
  #### 工具函数(从 `bxs-utils` 导入,非组件实例方法)
155
151
 
156
- | 方法名 | 说明 | 入参 | 出参 |
157
- | --- | --- | --- | --- |
158
- | `insureCalculate` | 执行试算,返回完整的试算数据 | `urlParams`, `postParams`, `planParams` | Promise `{ code, data }`;`code === 200` 表示成功;`data` 含 `widgets / total_premium / terms / product_id / current_data` |
159
- | `checkInsureCalculate` | 校验试算是否成功 | `urlParams`, `postParams`, `planParams` | Promise `{ code, data }`;`code === 200` 表示试算成功 |
160
-
152
+ | 方法名 | 说明 | 入参 | 出参 |
153
+ | ---------------------- | ---------------------------- | --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
154
+ | `insureCalculate` | 执行试算,返回完整的试算数据 | `urlParams`, `postParams`, `planParams` | Promise `{ code, data }`;`code === 200` 表示成功;`data` 含 `widgets / total_premium / terms / product_id / current_data` |
155
+ | `checkInsureCalculate` | 校验试算是否成功 | `urlParams`, `postParams`, `planParams` | Promise `{ code, data }`;`code === 200` 表示试算成功 |
161
156
 
162
157
  #### urlParams 对象
163
158
 
164
- | 参数 | 说明 | 类型 |
165
- | --- | --- | --- |
166
- | `uuid` | C 端必传,用户 uuid | String |
167
- | `appid` | ToB 必传,作为 url 中 `appId` 字段传递 | String |
159
+ | 参数 | 说明 | 类型 |
160
+ | -------- | ------------------------------------------------ | ------ |
161
+ | `uuid` | C 端必传,用户 uuid | String |
162
+ | `appid` | ToB 必传,作为 url 中 `appId` 字段传递 | String |
168
163
  | `openId` | ToB 选传,未获取到 `uuid` 时作为 `userUuid` 传递 | String |
169
164
 
170
-
171
165
  #### postParams 对象
172
166
 
173
- | 参数 | 说明 | 类型 |
174
- | --- | --- | --- |
175
- | `product_id` | 产品 ID | String |
176
- | `current_data` | 当前试算因子对象,默认 `null` | Object |
177
- | `scenario` | 固定值 `'h5Widget'`,可不传(已兼容) | String |
178
-
167
+ | 参数 | 说明 | 类型 |
168
+ | -------------- | ------------------------------------- | ------ |
169
+ | `product_id` | 产品 ID | String |
170
+ | `current_data` | 当前试算因子对象,默认 `null` | Object |
171
+ | `scenario` | 固定值 `'h5Widget'`,可不传(已兼容) | String |
179
172
 
180
173
  #### 时间单位说明
181
174
 
182
- | 值 | 含义 |
183
- | --- | --- |
184
- | `30D` | 30 天 |
185
- | `12M` | 12 个月 |
186
- | `1Y` | 趸交或 1 年交 |
187
- | `20Y` | 20 年 |
188
- | `70A` | 至 70 周岁 |
189
- | `100O` | 终生 |
175
+ | 值 | 含义 |
176
+ | ------ | ------------- |
177
+ | `30D` | 30 天 |
178
+ | `12M` | 12 个月 |
179
+ | `1Y` | 趸交或 1 年交 |
180
+ | `20Y` | 20 年 |
181
+ | `70A` | 至 70 周岁 |
182
+ | `100O` | 终生 |
190
183
 
191
184
  ---
192
185
 
193
186
  ### Events
194
187
 
195
- | 事件名 | 说明 | 回调参数 |
196
- | --- | --- | --- |
197
- | `closeInsureCalculate` | `showHeader` 为 `true` 时,点击关闭按钮触发 | — |
198
- | `sureInsureCalculate` | `showFooter` 为 `true` 时,点击确定按钮触发 | — |
188
+ | 事件名 | 说明 | 回调参数 |
189
+ | ---------------------- | ------------------------------------------- | -------- |
190
+ | `closeInsureCalculate` | `showHeader` 为 `true` 时,点击关闭按钮触发 | — |
191
+ | `sureInsureCalculate` | `showFooter` 为 `true` 时,点击确定按钮触发 | — |
199
192
 
200
193
  ---
201
194
 
202
195
  ### Slot
203
196
 
204
- | 插槽名 | 说明 |
205
- | --- | --- |
197
+ | 插槽名 | 说明 |
198
+ | -------- | ------------------------------------------------------------------------------------------- |
206
199
  | `header` | 自定义顶部内容,`showHeader` 为 `true` 时生效;不传则展示默认标题栏(含标题文字和关闭按钮) |
207
- | `footer` | 自定义底部内容,`showFooter` 为 `true` 时生效;不传则展示默认确定按钮 |
200
+ | `footer` | 自定义底部内容,`showFooter` 为 `true` 时生效;不传则展示默认确定按钮 |
@@ -79,15 +79,16 @@
79
79
  </CommonPopup>
80
80
  </template>
81
81
  <script lang="ts">
82
- import Vue from 'vue';
83
- import { Component, Prop, Watch } from 'vue-property-decorator';
84
- import { get as _get } from 'lodash';
85
- import { parseTime, IS_LOCALHOST_ENV } from '@src/js/utils.js';
86
- import { convertEleOrderListToObj, deepCopy, getAgeFromBirth } from 'packages/bxs-utils/index';
82
+ import Vue from 'vue'
83
+ import { Component, Prop, Watch } from 'vue-property-decorator'
84
+ import { get as _get, cloneDeep } from 'lodash'
85
+ import { parseTime } from '../../src/js/utils.js'
86
+ import { IS_LOCALHOST_ENV } from '../../src/js/variables.js'
87
+ import { convertEleOrderListToObj, getAgeFromBirth } from 'packages/bxs-utils/index'
87
88
 
88
- import CommonPopup from '@src/components/common/common-popup.vue';
89
- import CommonRadio from '@src/components/common/common-radio.vue';
90
- import CommonAgeBirthday from '@src/components/common/common-age-birthday.vue';
89
+ import CommonPopup from '../../src/components/common/common-popup.vue'
90
+ import CommonRadio from '../../src/components/common/common-radio.vue'
91
+ import CommonAgeBirthday from '../../src/components/common/common-age-birthday.vue'
91
92
 
92
93
  @Component({
93
94
  name: 'BxtCrmPersonPop',
@@ -98,33 +99,33 @@ import CommonAgeBirthday from '@src/components/common/common-age-birthday.vue';
98
99
  }
99
100
  })
100
101
  export default class BxtCrmPersonPop extends Vue {
101
- title = '';
102
- currentValue = false;
103
- currentPersonData = deepCopy(this.personData);
104
- canImportCrm = !!(window.appBridge && window.appBridge.checkAppFeature('CRM_IMPORT'));
102
+ title = ''
103
+ currentValue = false
104
+ currentPersonData = cloneDeep(this.personData)
105
+ canImportCrm = !!(window.appBridge && window.appBridge.checkAppFeature('CRM_IMPORT'))
105
106
 
106
107
  @Prop({
107
108
  default: false
108
109
  })
109
- value: boolean;
110
+ value: boolean
110
111
 
111
112
  @Prop({
112
113
  default: () => ({})
113
114
  })
114
- personData: any;
115
+ personData: any
115
116
 
116
117
  @Prop({
117
118
  default: () => ({})
118
119
  })
119
- params: any;
120
+ params: any
120
121
 
121
122
  get personForm() {
122
- return convertEleOrderListToObj(this.currentPersonData);
123
+ return convertEleOrderListToObj(this.currentPersonData)
123
124
  }
124
125
 
125
126
  get birthdayElement() {
126
- const elementList = _get(this, 'currentPersonData.eleOrderList') || [];
127
- return elementList.find(e => e.key === 'birthday');
127
+ const elementList = _get(this, 'currentPersonData.eleOrderList') || []
128
+ return elementList.find(e => e.key === 'birthday')
128
129
  }
129
130
 
130
131
  @Watch('value', {
@@ -133,7 +134,7 @@ export default class BxtCrmPersonPop extends Vue {
133
134
  })
134
135
  watchValue(value: boolean, oValue: boolean) {
135
136
  if (this.currentValue !== value) {
136
- this.currentValue = value;
137
+ this.currentValue = value
137
138
  }
138
139
  }
139
140
  @Watch('currentValue', {
@@ -142,37 +143,37 @@ export default class BxtCrmPersonPop extends Vue {
142
143
  })
143
144
  watchCurrentValue(value: boolean, oValue: boolean) {
144
145
  if (!value) {
145
- this.$emit('input', false);
146
+ this.$emit('input', false)
146
147
  }
147
148
  }
148
149
 
149
150
  created() {
150
- const { currentPersonData } = this;
151
+ const { currentPersonData } = this
151
152
  const TITLE_NANES = {
152
153
  insuredInfo: '被保人',
153
154
  applicantInfo: '投保人',
154
155
  spouseInfo: '投保人配偶'
155
- };
156
- this.title = TITLE_NANES[currentPersonData.key] || currentPersonData.label || '';
157
- currentPersonData.createArchive = currentPersonData.createArchive || false;
156
+ }
157
+ this.title = TITLE_NANES[currentPersonData.key] || currentPersonData.label || ''
158
+ currentPersonData.createArchive = currentPersonData.createArchive || false
158
159
  }
159
160
 
160
161
  getElementRules(ele) {
161
- const { currentPersonData, personForm } = this;
162
- let rules: any = [];
162
+ const { currentPersonData, personForm } = this
163
+ let rules: any = []
163
164
  if (currentPersonData.createArchive) {
164
165
  if (ele.key === 'name') {
165
- rules = [{ required: true, message: '请输入姓名' }];
166
+ rules = [{ required: true, message: '请输入姓名' }]
166
167
  }
167
168
  if (ele.key === 'age') {
168
- rules = [{ validator: () => !!personForm.birthday, message: '请输入生日' }];
169
+ rules = [{ validator: () => !!personForm.birthday, message: '请输入生日' }]
169
170
  }
170
171
  }
171
- return rules;
172
+ return rules
172
173
  }
173
174
 
174
175
  onClickImportCrm(ele) {
175
- const self = this;
176
+ const self = this
176
177
  if (ele.key === 'name') {
177
178
  if (self.canImportCrm) {
178
179
  if (IS_LOCALHOST_ENV) {
@@ -181,98 +182,98 @@ export default class BxtCrmPersonPop extends Vue {
181
182
  cid: 'efb4324d73f947d09e8a1833ec12abc923',
182
183
  name: '艾力卡木',
183
184
  sex: 1
184
- });
185
- return;
185
+ })
186
+ return
186
187
  }
187
- window.appBridge.importContact('recipient');
188
+ window.appBridge.importContact('recipient')
188
189
  window.appBridge.onContactImport(info => {
189
- self.setCrmPersonData(info);
190
- });
191
- window.WeiyiStatSDK && window.WeiyiStatSDK.submit('khlbdr');
192
- return;
190
+ self.setCrmPersonData(info)
191
+ })
192
+ window.WeiyiStatSDK && window.WeiyiStatSDK.submit('khlbdr')
193
+ return
193
194
  }
194
195
  }
195
196
  }
196
197
  setCrmPersonData(info) {
197
- const self = this;
198
- const copyPersonData = deepCopy(self.currentPersonData);
199
- let isImportSuccess = true;
200
- copyPersonData.cid = info.cid;
198
+ const self = this
199
+ const copyPersonData = cloneDeep(self.currentPersonData)
200
+ let isImportSuccess = true
201
+ copyPersonData.cid = info.cid
201
202
  copyPersonData.eleOrderList.map(ele => {
202
203
  if (ele.key === 'birthday') {
203
- return;
204
+ return
204
205
  }
205
206
  if (ele.key === 'age' && info.birthday) {
206
- const age = getAgeFromBirth(info.birthday);
207
- const sexUi = copyPersonData.eleOrderList.find(ele => ele.key === 'sex');
208
- const birthdayUi = copyPersonData.eleOrderList.find(ele => ele.key === 'birthday');
207
+ const age = getAgeFromBirth(info.birthday)
208
+ const sexUi = copyPersonData.eleOrderList.find(ele => ele.key === 'sex')
209
+ const birthdayUi = copyPersonData.eleOrderList.find(ele => ele.key === 'birthday')
209
210
  if (ele.options.find(e => e.val === age)) {
210
- birthdayUi.value = parseTime(info.birthday, '{y}/{m}/{d}');
211
- ele.value = age;
212
- return;
211
+ birthdayUi.value = parseTime(info.birthday, '{y}/{m}/{d}')
212
+ ele.value = age
213
+ return
213
214
  }
214
- isImportSuccess = false;
215
+ isImportSuccess = false
215
216
  if (TITLE_NANES[copyPersonData.key]) {
216
- self.$toast(`${TITLE_NANES[copyPersonData.key]}年龄超出投保范围:${ele.options[0].val}-${ele.options[ele.options.length - 1].val}岁`);
217
+ self.$toast(`${TITLE_NANES[copyPersonData.key]}年龄超出投保范围:${ele.options[0].val}-${ele.options[ele.options.length - 1].val}岁`)
217
218
  }
218
- return;
219
+ return
219
220
  }
220
221
  if (ele.key === 'sex' && info.sex) {
221
- const option = ele.options.find(o => o.val === info.sex);
222
+ const option = ele.options.find(o => o.val === info.sex)
222
223
  if (copyPersonData.key === 'insuredInfo' && !option) {
223
- isImportSuccess = false;
224
- self.$toast(`被保人只能为"${ele.options[0].val == 1 ? '男' : '女'}性"`);
225
- return;
224
+ isImportSuccess = false
225
+ self.$toast(`被保人只能为"${ele.options[0].val == 1 ? '男' : '女'}性"`)
226
+ return
226
227
  }
227
- ele.value = info.sex;
228
- return;
228
+ ele.value = info.sex
229
+ return
229
230
  }
230
231
  if (ele.key === 'title') {
231
- ele.value = true;
232
- return;
232
+ ele.value = true
233
+ return
233
234
  }
234
235
  if (info[ele.key]) {
235
- ele.value = info[ele.key];
236
+ ele.value = info[ele.key]
236
237
  }
237
- });
238
+ })
238
239
  if (isImportSuccess) {
239
- self.currentPersonData = copyPersonData;
240
+ self.currentPersonData = copyPersonData
240
241
  }
241
242
  }
242
243
  closeSheet() {
243
- this.currentValue = false;
244
+ this.currentValue = false
244
245
  }
245
246
  confirm() {
246
- const { personData, personForm } = this;
247
- const refPersonForm: any = this.$refs.personForm;
247
+ const { personData, personForm } = this
248
+ const refPersonForm: any = this.$refs.personForm
248
249
  refPersonForm
249
250
  .validate()
250
251
  .then(() => {
251
- const keys = ['createArchive', 'cid'];
252
+ const keys = ['createArchive', 'cid']
252
253
  keys.forEach(k => {
253
- personData[k] = personForm[k];
254
- });
254
+ personData[k] = personForm[k]
255
+ })
255
256
  personData.eleOrderList.forEach(ele => {
256
257
  if (ele.key === 'title') {
257
- ele.value = true;
258
- return;
258
+ ele.value = true
259
+ return
259
260
  }
260
- ele.value = personForm[ele.key];
261
- });
262
- this.$emit('change');
263
- this.closeSheet();
261
+ ele.value = personForm[ele.key]
262
+ })
263
+ this.$emit('change')
264
+ this.closeSheet()
264
265
  })
265
266
  .catch(err => {
266
- console.log(err);
267
- });
267
+ console.log(err)
268
+ })
268
269
  }
269
270
  closeKeyBoard() {
270
- const activeElement: any = document.activeElement;
271
+ const activeElement: any = document.activeElement
271
272
  if (!activeElement) {
272
- return false;
273
+ return false
273
274
  }
274
- activeElement.blur();
275
- return false;
275
+ activeElement.blur()
276
+ return false
276
277
  }
277
278
  }
278
279
  </script>
@@ -4,12 +4,12 @@
4
4
  </div>
5
5
  </template>
6
6
  <script lang="ts">
7
- import Vue from 'vue';
8
- import { Component } from 'vue-property-decorator';
9
- import QS from 'qs';
10
- import { PLANBOOK_API_HOSTNAME } from '@src/js/variables.js';
11
- import { initPageData } from '../../planbook-input/helper';
12
- import PersonInfo from '../index.vue';
7
+ import Vue from 'vue'
8
+ import { Component } from 'vue-property-decorator'
9
+ import QS from 'qs'
10
+ import { getPlanbookData } from '../../../src/api/planbook.js'
11
+ import { initPageData } from '../../planbook-input/helper'
12
+ import PersonInfo from '../index.vue'
13
13
 
14
14
  @Component({
15
15
  components: {
@@ -17,49 +17,37 @@ import PersonInfo from '../index.vue';
17
17
  }
18
18
  })
19
19
  export default class PersonInfoDemo extends Vue {
20
- URL_PARAM: any = this.getUrlParam();
21
- inputData = null;
22
- verifyData = null;
23
- personData = null;
20
+ URL_PARAM: any = this.getUrlParam()
21
+ inputData = null
22
+ verifyData = null
23
+ personData = null
24
24
  created() {
25
25
  if (!this.URL_PARAM.publicPbUuid) {
26
- this.URL_PARAM.publicPbUuid = '5d6499946bbb47bb8f6a286e9d4eee77';
26
+ this.URL_PARAM.publicPbUuid = '5d6499946bbb47bb8f6a286e9d4eee77'
27
27
  }
28
- document.body.style.backgroundColor = '#f2f2f2';
29
- this.getPlanbookData();
28
+ document.body.style.backgroundColor = '#f2f2f2'
29
+ this.getPlanbookData()
30
30
  }
31
31
  getUrlParam() {
32
- return QS.parse(`${location.href.split('?')[1]}`) || {};
32
+ return QS.parse(`${location.href.split('?')[1]}`) || {}
33
33
  }
34
34
  getPlanbookData() {
35
- fetch(`${PLANBOOK_API_HOSTNAME}/planBook/public/init`, {
36
- method: 'POST',
37
- credentials: 'include',
38
- headers: {
39
- Accept: 'application/json, text/plain, */*',
40
- 'Content-Type': 'application/x-www-form-urlencoded'
41
- },
42
- body: QS.stringify({
43
- publicPbUuid: this.URL_PARAM.publicPbUuid
44
- })
35
+ getPlanbookData({
36
+ publicPbUuid: this.URL_PARAM.publicPbUuid
45
37
  })
46
- .then(response => response.json())
47
- .then(async ({ success, data }: any) => {
48
- if (!success || !data) {
49
- return;
50
- }
51
- await initPageData(data);
52
- this.inputData = data.initData.inputData;
53
- this.verifyData = data.verifyData;
54
- this.personData = data.initData.inputData.personData.personOrderList[0];
55
- document.title = `DEMO(人员):${data.title}`;
38
+ .then(async (data: any) => {
39
+ await initPageData(data)
40
+ this.inputData = data.initData.inputData
41
+ this.verifyData = data.verifyData
42
+ this.personData = data.initData.inputData.personData.personOrderList[0]
43
+ document.title = `DEMO(人员):${data.title}`
56
44
  })
57
45
  .catch(error => {
58
- console.log(error);
59
- });
46
+ console.log(error)
47
+ })
60
48
  }
61
49
  changePersonInfo(personData, eleData) {
62
- this.$toast(`${eleData.label} -> ${eleData.value}`);
50
+ this.$toast(`${eleData.label} -> ${eleData.value}`)
63
51
  }
64
52
  }
65
53
  </script>
@@ -0,0 +1,11 @@
1
+ @import 'color.less';
2
+
3
+ .bxt-person-info {
4
+ & .van-form {
5
+ background: #fff;
6
+
7
+ & .van-cell::after {
8
+ border-bottom: 0;
9
+ }
10
+ }
11
+ }