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
@@ -0,0 +1,30 @@
1
+ @import 'color.less';
2
+
3
+ .bxt-planbook {
4
+ min-height: 100vh;
5
+ font-size: 14px;
6
+ box-sizing: border-box;
7
+ background: var(--bxt-bg-primary);
8
+
9
+ &::after {
10
+ display: block;
11
+ height: 52px;
12
+ content: '';
13
+ padding-bottom: constant(safe-area-inset-bottom);
14
+ padding-bottom: env(safe-area-inset-bottom);
15
+ box-sizing: content-box;
16
+ }
17
+
18
+ & .bxt-planbook-person {
19
+ padding: 9px;
20
+
21
+ & .bxt-person-container {
22
+ border-radius: 6px;
23
+ overflow: hidden;
24
+ }
25
+ }
26
+
27
+ & .bxt-planbook-product {
28
+ padding: 0 9px 9px;
29
+ }
30
+ }
@@ -23,6 +23,7 @@
23
23
  <template v-for="(p, pi) in g.prodOrderList">
24
24
  <ProductTable
25
25
  v-if="!p.hide || pi < g.defNum"
26
+ :user="userInfo"
26
27
  :key="p.key"
27
28
  :result-uuid="URL_PARAM.uuid"
28
29
  :input-data="inputData"
@@ -45,29 +46,22 @@
45
46
  </div>
46
47
  </template>
47
48
  <script lang="ts">
48
- import Vue from 'vue';
49
- import { Component } from 'vue-property-decorator';
50
- import Vant, { Toast } from 'vant';
51
- import QS from 'qs';
52
- import { get as _get } from 'lodash';
53
- import { PLANBOOK_API_HOSTNAME, PBF_HOSTNAME } from '@src/js/variables.js';
54
- import { calcTotalBaof } from 'packages/bxs-utils/index';
55
- import { getPlanbookData } from './api';
56
- import {
57
- initPageData,
58
- setPageDataBaseOnResult,
59
- calculateProductData,
60
- doubleCalcProductData,
61
- createPlanbookDataToMake,
62
- setupUnderwriteRuleToInputData
63
- } from './helper.js';
64
- import { createMd5Token } from '@src/js/md5Token.js';
65
- import PersonInfo from '../person-info/index.vue';
66
- import ProductTable from './components/product-table.vue';
67
- import InputFooter from './components/footer.vue';
68
- import './index.css';
49
+ import Vue from 'vue'
50
+ import { Component } from 'vue-property-decorator'
51
+ import Vant, { Toast } from 'vant'
52
+ import QS from 'qs'
53
+ import { get as _get } from 'lodash'
54
+ import { PBF_HOSTNAME } from '../../src/js/variables.js'
55
+ import { getCommonCurrentUser } from '../../src/api/user.js'
56
+ import { getPlanbookData } from '../../src/api/planbook.js'
57
+ import { calcTotalBaof } from 'packages/bxs-utils/index'
58
+ import { initPageData, calcProductData, doubleCalcProductData, makePlanbook } from './helper.js'
59
+ import PersonInfo from '../person-info/index.vue'
60
+ import ProductTable from './components/product-table.vue'
61
+ import InputFooter from './components/footer.vue'
62
+ import './index.less'
69
63
 
70
- Vue.use(Vant);
64
+ Vue.use(Vant)
71
65
  @Component({
72
66
  name: 'BxtPlanbookInput',
73
67
  components: {
@@ -77,24 +71,31 @@ Vue.use(Vant);
77
71
  }
78
72
  })
79
73
  export default class BxtPlanbookInput extends Vue {
80
- URL_PARAM: any = this.getUrlParam();
81
- planbookData: IPlanbookData | null = null;
74
+ URL_PARAM: any = this.getUrlParam()
75
+ userInfo: any = null
76
+ planbookData: IPlanbookData | null = null
82
77
  get inputData(): IPbInput | null {
83
- return _get(this, 'planbookData.initData.inputData');
78
+ return _get(this, 'planbookData.initData.inputData')
79
+ }
80
+ get exportData(): IPbInput | null {
81
+ return _get(this, 'planbookData.exportData')
84
82
  }
85
83
  get verifyData(): IPbInput | null {
86
- return _get(this, 'planbookData.verifyData');
84
+ return _get(this, 'planbookData.verifyData')
87
85
  }
88
86
  async created() {
89
- this.getPlanbookData();
87
+ await getCommonCurrentUser().then(data => {
88
+ this.userInfo = data
89
+ })
90
+ this.getPlanbookData()
90
91
  }
91
92
  getUrlParam() {
92
- return QS.parse(`${location.href.split('?')[1]}`) || {};
93
+ return QS.parse(`${location.href.split('?')[1]}`) || {}
93
94
  }
94
95
  getPlanbookData() {
95
- const self = this;
96
- const { URL_PARAM } = self;
97
- const { planbookId, publicPbUuid, uuid } = URL_PARAM;
96
+ const self = this
97
+ const { URL_PARAM, userInfo } = self
98
+ const { planbookId, publicPbUuid, uuid } = URL_PARAM
98
99
  return getPlanbookData({
99
100
  insuranceTypeId: planbookId || 13767,
100
101
  resultUuid: uuid,
@@ -102,48 +103,47 @@ export default class BxtPlanbookInput extends Vue {
102
103
  // publicPbUuid: '5d6499946bbb47bb8f6a286e9d4eee77'
103
104
  })
104
105
  .then(async (data: any) => {
105
- if (data.initData && data.initData.inputData) {
106
- const _inputData = await setupUnderwriteRuleToInputData(data.initData.inputData).catch(() => null);
107
- data.initData.inputData = _inputData || data.initData.inputData;
108
- }
109
- await initPageData(data);
110
- setPageDataBaseOnResult(data);
111
- document.title = `DEMO:${data.title}`;
112
- self.planbookData = data;
113
- self.autoImportData();
106
+ await initPageData(data, {
107
+ user: userInfo
108
+ })
109
+ document.title = `DEMO:${data.title}`
110
+ self.planbookData = data
111
+ self.autoImportData()
114
112
  })
115
113
  .catch(error => {
116
- Toast('请求错误');
117
- console.log(error);
118
- });
114
+ Toast('请求错误')
115
+ console.log(error)
116
+ })
119
117
  }
120
118
  autoImportData() {
121
- const { URL_PARAM, verifyData, inputData } = this;
122
- const { planbookId, publicPbUuid } = URL_PARAM;
119
+ const { URL_PARAM, userInfo, exportData, verifyData, inputData } = this
120
+ const { planbookId, publicPbUuid } = URL_PARAM
123
121
  if (inputData) {
124
122
  inputData.productGroupList
125
123
  .filter((g: IPbProductGroup) => g.prodOrderList)
126
124
  .forEach((g: IPbProductGroup) => {
127
125
  g.prodOrderList.forEach((p: IPbProduct) => {
128
126
  doubleCalcProductData(inputData, verifyData, {
127
+ user: userInfo,
129
128
  planbookId: Number(planbookId),
130
129
  publicPbUuid,
131
130
  groupKey: g.key,
132
131
  productKey: p.key,
132
+ executeSource: exportData ? 'import' : 'init',
133
133
  isIgnoreError: true
134
134
  }).catch(err => {
135
135
  if (err && err.message) {
136
- Toast(err.message);
136
+ Toast(err.message)
137
137
  }
138
- console.error(err);
139
- });
140
- });
141
- });
138
+ console.error(err)
139
+ })
140
+ })
141
+ })
142
142
  }
143
143
  }
144
144
  changePersonInfo(person: IPbPerson, ele: any = {}) {
145
- const { URL_PARAM, verifyData, inputData } = this;
146
- const { planbookId, publicPbUuid } = URL_PARAM;
145
+ const { URL_PARAM, userInfo, exportData, verifyData, inputData } = this
146
+ const { planbookId, publicPbUuid } = URL_PARAM
147
147
  if (inputData) {
148
148
  inputData.productGroupList
149
149
  .filter((g: IPbProductGroup) => g.prodOrderList)
@@ -152,7 +152,9 @@ export default class BxtPlanbookInput extends Vue {
152
152
  .filter((p: IPbProduct) => p.hadChoice)
153
153
  .forEach((p: IPbProduct) => {
154
154
  doubleCalcProductData(inputData, verifyData, {
155
+ user: userInfo,
155
156
  planbookId: Number(planbookId),
157
+ executeSource: exportData ? 'import' : 'init',
156
158
  publicPbUuid,
157
159
  groupKey: g.key,
158
160
  productKey: p.key,
@@ -162,87 +164,68 @@ export default class BxtPlanbookInput extends Vue {
162
164
  elementKey: ele.key
163
165
  }
164
166
  }).catch(err => {
165
- Toast(err.message);
166
- });
167
- });
168
- });
167
+ Toast(err.message)
168
+ })
169
+ })
170
+ })
169
171
  }
170
172
  }
171
173
  changeProduct(product, options, inst) {
172
174
  if (options.type === 'change' && options.errorMsg) {
173
- Toast(options.errorMsg);
175
+ Toast(options.errorMsg)
174
176
  }
175
177
  }
176
178
  confirmProduct(options: any, inst: any) {
177
- const self = this;
178
- const { URL_PARAM, inputData } = self;
179
- const { planbookId, publicPbUuid } = URL_PARAM;
180
- const { groupKey, productKey } = options;
179
+ const self = this
180
+ const { URL_PARAM, userInfo, inputData } = self
181
+ const { planbookId, publicPbUuid } = URL_PARAM
182
+ const { groupKey, productKey } = options
181
183
  inst.$refs.productInfo
182
184
  .validate()
183
185
  .then(() => {
184
- return calculateProductData(inputData, {
186
+ return calcProductData(inputData, {
187
+ user: userInfo,
185
188
  planbookId: Number(planbookId),
186
189
  publicPbUuid,
187
190
  groupKey,
188
- productKey
191
+ productKey,
192
+ executeSource: 'confirm'
189
193
  }).then(() => {
190
- inst.close();
191
- });
194
+ inst.close()
195
+ })
192
196
  })
193
197
  .catch(err => {
194
- const errorMessage = _get(err, '[0].message') || _get(err, 'message') || err;
198
+ const errorMessage = _get(err, '[0].message') || _get(err, 'message') || err
195
199
  if (typeof errorMessage === 'string' && errorMessage.trim()) {
196
- Toast(errorMessage);
200
+ Toast(errorMessage)
197
201
  }
198
- console.log(err);
199
- });
202
+ console.log(err)
203
+ })
200
204
  }
201
205
  createPlanbook(planbookData: IPlanbookData | null): any {
202
- const { URL_PARAM, inputData } = this;
206
+ const { URL_PARAM, inputData } = this
203
207
  if (!planbookData || !inputData) {
204
- Toast('数据不完整');
205
- return Promise.reject();
208
+ Toast('数据不完整')
209
+ return Promise.reject()
206
210
  }
207
211
 
208
- const { pbType, planbookId, publicPbUuid, userUuid } = URL_PARAM;
212
+ const { pbType, planbookId, publicPbUuid, userUuid } = URL_PARAM
209
213
  const options: any = {
210
214
  pbType,
211
215
  insuranceTypeId: Number(planbookId) || null,
212
216
  publicPbUuid,
213
217
  totalBaof: calcTotalBaof(inputData?.productGroupList),
214
218
  userUuid
215
- };
216
- const resultData: any = createPlanbookDataToMake(planbookData, options);
217
- if (resultData) {
218
- return fetch(`${PLANBOOK_API_HOSTNAME}/planBook/${URL_PARAM.publicPbUuid ? 'public/createPb' : 'V2/uploadResult'}`, {
219
- method: 'POST',
220
- credentials: 'include',
221
- headers: {
222
- Accept: 'application/json, text/plain, */*',
223
- 'Content-Type': 'application/x-www-form-urlencoded'
224
- },
225
- body: QS.stringify({
226
- jd: JSON.stringify(resultData),
227
- userUuid,
228
- signature: createMd5Token(resultData, {
229
- groupDataKey: resultData.productGroupList[0]?.key
230
- })
231
- })
232
- })
233
- .then(response => response.json())
234
- .then(({ success, data }: any) => {
235
- if (success && data) {
236
- const urlParam = QS.stringify({
237
- theme: inputData?.theme,
238
- uuid: data
239
- });
240
- location.href = `${PBF_HOSTNAME}/planBook/planBookResult/pages/${publicPbUuid ? 'planbkPurely' : 'planbkTemplatev2'}.html?${urlParam}`;
241
- }
242
- });
243
219
  }
244
- Toast('请选择险种');
245
- return Promise.reject();
220
+ return makePlanbook(inputData, options).then((data: any) => {
221
+ if (data) {
222
+ const urlParam = QS.stringify({
223
+ theme: inputData?.theme,
224
+ uuid: data
225
+ })
226
+ location.href = `${PBF_HOSTNAME}/planBook/planBookResult/pages/${publicPbUuid ? 'planbkPurely' : 'planbkTemplatev2'}.html?${urlParam}`
227
+ }
228
+ })
246
229
  }
247
230
  }
248
231
  </script>
@@ -38,13 +38,7 @@ export default {
38
38
  <div class="bxt-planbook-person">
39
39
  <div class="bxt-person-container" v-if="inputData.personData">
40
40
  <template v-for="person in inputData.personData.personOrderList">
41
- <PersonInfo
42
- :key="person.key"
43
- :input-data="inputData"
44
- :verify-data="planbookData.verifyData"
45
- :person-data="person"
46
- @change="changePersonInfo"
47
- />
41
+ <PersonInfo :key="person.key" :input-data="inputData" :verify-data="planbookData.verifyData" :person-data="person" @change="changePersonInfo" />
48
42
  </template>
49
43
  </div>
50
44
  </div>
@@ -68,56 +62,56 @@ export default {
68
62
  </template>
69
63
 
70
64
  <script>
71
- import { PersonInfo } from 'bxs-tools-ui';
72
- import { initPersonData, personDataHandler, initProductData, productDataHandler } from 'bxs-utils';
73
-
74
- export default {
75
- components: { PersonInfo },
76
- methods: {
77
- async initPageData(data) {
78
- const inputData = data && data.initData && data.initData.inputData;
79
- if (inputData) {
80
- initPersonData(inputData, data.verifyData);
81
- personDataHandler(inputData.personData);
82
- const productGroupList = inputData.productGroupList || [];
83
- productGroupList
84
- .filter(g => g.prodOrderList)
85
- .forEach(g => {
65
+ import { PersonInfo } from 'bxs-tools-ui';
66
+ import { initPersonData, personDataHandler, initProductData, productDataHandler } from 'bxs-utils';
67
+
68
+ export default {
69
+ components: { PersonInfo },
70
+ methods: {
71
+ async initPageData(data) {
72
+ const inputData = data && data.initData && data.initData.inputData;
73
+ if (inputData) {
74
+ initPersonData(inputData, data.verifyData);
75
+ personDataHandler(inputData.personData);
76
+ const productGroupList = inputData.productGroupList || [];
77
+ productGroupList
78
+ .filter(g => g.prodOrderList)
79
+ .forEach(g => {
80
+ g.prodOrderList.forEach(p => {
81
+ initProductData(p);
82
+ productDataHandler(p, data.verifyData[p.key], inputData.personData);
83
+ });
84
+ });
85
+ }
86
+ return data;
87
+ },
88
+ changePersonInfo(person, ele) {
89
+ this.inputData.productGroupList.forEach(g => {
90
+ g.prodOrderList &&
86
91
  g.prodOrderList.forEach(p => {
87
- initProductData(p);
88
- productDataHandler(p, data.verifyData[p.key], inputData.personData);
92
+ if (p.hadChoice) {
93
+ this.doubleCalcProductData(this.inputData, {
94
+ planbookId: this.URL_PARAM.planbookId * 1,
95
+ groupKey: g.key,
96
+ productKey: p.key,
97
+ isIgnoreError: true
98
+ });
99
+ }
89
100
  });
101
+ });
102
+ },
103
+ confirmProduct(options, inst) {
104
+ inst.$refs.productInfo
105
+ .validate()
106
+ .then(valid => {
107
+ // 校验通过,执行投保逻辑
108
+ })
109
+ .catch(err => {
110
+ console.log(err);
90
111
  });
91
112
  }
92
- return data;
93
- },
94
- changePersonInfo(person, ele) {
95
- this.inputData.productGroupList.forEach(g => {
96
- g.prodOrderList &&
97
- g.prodOrderList.forEach(p => {
98
- if (p.hadChoice) {
99
- this.doubleCalcProductData(this.inputData, {
100
- planbookId: this.URL_PARAM.planbookId * 1,
101
- groupKey: g.key,
102
- productKey: p.key,
103
- isIgnoreError: true
104
- });
105
- }
106
- });
107
- });
108
- },
109
- confirmProduct(options, inst) {
110
- inst.$refs.productInfo
111
- .validate()
112
- .then(valid => {
113
- // 校验通过,执行投保逻辑
114
- })
115
- .catch(err => {
116
- console.log(err);
117
- });
118
113
  }
119
- }
120
- };
114
+ };
121
115
  </script>
122
116
  ```
123
117
 
@@ -126,39 +120,27 @@ export default {
126
120
  ```html
127
121
  <template>
128
122
  <div :class="['bxt-product-show', `bxt-product-id-${productData.key}`]" v-if="productData">
129
- <bxs-bottom-sheets
130
- v-model="isShowProductSheet"
131
- :title="productData.titleName"
132
- height="middle"
133
- @overlayClose="overlayClose"
134
- >
135
- <ProductInfo
136
- ref="productInfo"
137
- :input-data="inputData"
138
- :verify-data="verifyData"
139
- :group-key="groupKey"
140
- :product-key="productKey"
141
- @change="cgProduct"
142
- />
123
+ <bxs-bottom-sheets v-model="isShowProductSheet" :title="productData.titleName" height="middle" @overlayClose="overlayClose">
124
+ <ProductInfo ref="productInfo" :input-data="inputData" :verify-data="verifyData" :group-key="groupKey" :product-key="productKey" @change="cgProduct" />
143
125
  </bxs-bottom-sheets>
144
126
  </div>
145
127
  </template>
146
128
 
147
129
  <script>
148
- import { ProductInfo } from 'bxs-tools-ui';
149
-
150
- export default {
151
- components: { ProductInfo },
152
- methods: {
153
- cgProduct(product, options) {
154
- if (options.type === 'change' && options.errorMsg) {
155
- this.$nextTick(() => {
156
- this.$toast(options.errorMsg);
157
- });
130
+ import { ProductInfo } from 'bxs-tools-ui';
131
+
132
+ export default {
133
+ components: { ProductInfo },
134
+ methods: {
135
+ cgProduct(product, options) {
136
+ if (options.type === 'change' && options.errorMsg) {
137
+ this.$nextTick(() => {
138
+ this.$toast(options.errorMsg);
139
+ });
140
+ }
158
141
  }
159
142
  }
160
- }
161
- };
143
+ };
162
144
  </script>
163
145
  ```
164
146
 
@@ -182,20 +164,20 @@ export default {
182
164
  import {
183
165
  initPageData,
184
166
  setPageDataBaseOnResult,
185
- calculateProductData,
167
+ calcProductData,
186
168
  doubleCalcProductData,
187
- createPlanbookDataToMake,
169
+ makePlanbook,
188
170
  setupUnderwriteRuleToInputData
189
171
  } from 'packages/planbook-input/helper.js';
190
172
  ```
191
173
 
192
- | 函数名 | 说明 | 入参 | 出参 |
193
- | --- | --- | --- | --- |
194
- | `initPageData(data)` | 初始化计划书数据,依次处理人员数据和所有产品数据 | `data`:接口返回的原始数据 | Promise\<data\> |
195
- | `setPageDataBaseOnResult(data)` | 将已生成结果中的导出数据(`exportData`)回填到初始化数据中,用于「编辑已有计划书」场景 | `data`:同上 | data |
196
- | `calculateProductData(inputData, options)` | 对指定产品发起一次试算请求,并将结果写回 `inputData` | `inputData`;`options`:`{ planbookId, publicPbUuid, groupKey, productKey, isIgnoreError }` | Promise |
197
- | `doubleCalcProductData(inputData, verifyData, options)` | 先执行 `productDataHandler` 再执行 `calculateProductData`,对存在 `revalidateFlag` 的产品自动执行二次试算 | 同上,额外需要 `verifyData` | Promise |
198
- | `createPlanbookDataToMake(planbookData, options)` | 将投保页数据转换为提交计划书所需的 JSON 结构 | `planbookData`;`options`:`{ pbType, insuranceTypeId, publicPbUuid, totalBaof, userUuid }` | Object / null |
199
- | `setupUnderwriteRuleToInputData(inputData)` | 将核保规则(underwrite rule)应用到 inputData,返回处理后的 inputData | `inputData` | Promise\<inputData\> |
200
- | `createdProductDataToCalc(inputData, options)` | 生成试算接口的请求参数(jd + signature) | `inputData`;`options`:`{ planbookId, publicPbUuid, groupKey, productKey }` | Promise\<{ errorMsg, jd, signature }\> |
201
- | `receiveProductData(inputData, rProductData, options)` | 将试算接口返回的产品数据写回 `inputData` | `inputData`;`rProductData`:接口返回的产品数据;`options` | productData |
174
+ | 函数名 | 说明 | 入参 | 出参 |
175
+ | ------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | -------------------------------------- |
176
+ | `initPageData(data)` | 初始化计划书数据,依次处理人员数据和所有产品数据 | `data`:接口返回的原始数据 | Promise\<data\> |
177
+ | `setPageDataBaseOnResult(data)` | 将已生成结果中的导出数据(`exportData`)回填到初始化数据中,用于「编辑已有计划书」场景 | `data`:同上 | data |
178
+ | `calcProductData(inputData, options)` | 对指定产品发起一次试算请求,并将结果写回 `inputData` | `inputData`;`options`:`{ planbookId, publicPbUuid, groupKey, productKey, isIgnoreError }` | Promise |
179
+ | `doubleCalcProductData(inputData, verifyData, options)` | 先执行 `productDataHandler` 再执行 `calcProductData`,对存在 `revalidateFlag` 的产品自动执行二次试算 | 同上,额外需要 `verifyData` | Promise |
180
+ | `makePlanbook(inputData, options)` | 生成计划书 | `inputData`;`options`:`{ pbType, insuranceTypeId, publicPbUuid, totalBaof, userUuid }` | Object / null |
181
+ | `setupUnderwriteRuleToInputData(inputData)` | 将核保规则(underwrite rule)应用到 inputData,返回处理后的 inputData | `inputData` | Promise\<inputData\> |
182
+ | `createdProductDataToCalc(inputData, options)` | 生成试算接口的请求参数(jd + signature) | `inputData`;`options`:`{ planbookId, publicPbUuid, groupKey, productKey }` | Promise\<{ errorMsg, jd, signature }\> |
183
+ | `receiveProductData(inputData, rProductData, options)` | 将试算接口返回的产品数据写回 `inputData` | `inputData`;`rProductData`:接口返回的产品数据;`options` | productData |
@@ -990,4 +990,4 @@ export const PLANBOOK_DATA = {
990
990
  interactionSwitchOn: null,
991
991
  interestProductList: [3263],
992
992
  compareType: null
993
- };
993
+ }
@@ -4,13 +4,13 @@
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 { get as _get } from 'lodash';
12
- import { initPageData } from '../../planbook-input/helper';
13
- import ProductInfo 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 { get as _get } from 'lodash'
12
+ import { initPageData } from '../../planbook-input/helper'
13
+ import ProductInfo from '../index.vue'
14
14
 
15
15
  @Component({
16
16
  components: {
@@ -18,59 +18,47 @@ import ProductInfo from '../index.vue';
18
18
  }
19
19
  })
20
20
  export default class ProductInfoDemo extends Vue {
21
- URL_PARAM: any = this.getUrlParam();
22
- inputData = null;
23
- verifyData = null;
24
- groupKey = null;
25
- productKey = null;
21
+ URL_PARAM: any = this.getUrlParam()
22
+ inputData = null
23
+ verifyData = null
24
+ groupKey = null
25
+ productKey = null
26
26
  created() {
27
27
  if (!this.URL_PARAM.publicPbUuid) {
28
- this.URL_PARAM.publicPbUuid = '5d6499946bbb47bb8f6a286e9d4eee77';
28
+ this.URL_PARAM.publicPbUuid = '5d6499946bbb47bb8f6a286e9d4eee77'
29
29
  }
30
- document.body.style.backgroundColor = '#f2f2f2';
31
- this.getPlanbookData();
30
+ document.body.style.backgroundColor = '#f2f2f2'
31
+ this.getPlanbookData()
32
32
  }
33
33
  getUrlParam() {
34
- return QS.parse(`${location.href.split('?')[1]}`) || {};
34
+ return QS.parse(`${location.href.split('?')[1]}`) || {}
35
35
  }
36
36
  getPlanbookData() {
37
- fetch(`${PLANBOOK_API_HOSTNAME}/planBook/public/init`, {
38
- method: 'POST',
39
- credentials: 'include',
40
- headers: {
41
- Accept: 'application/json, text/plain, */*',
42
- 'Content-Type': 'application/x-www-form-urlencoded'
43
- },
44
- body: QS.stringify({
45
- publicPbUuid: this.URL_PARAM.publicPbUuid
46
- })
37
+ getPlanbookData({
38
+ publicPbUuid: this.URL_PARAM.publicPbUuid
47
39
  })
48
- .then(response => response.json())
49
- .then(async ({ success, data }: any) => {
50
- if (!success || !data) {
51
- return;
52
- }
53
- await initPageData(data);
54
- this.inputData = data.initData.inputData;
55
- this.verifyData = data.verifyData;
40
+ .then(async (data: any) => {
41
+ await initPageData(data)
42
+ this.inputData = data.initData.inputData
43
+ this.verifyData = data.verifyData
56
44
  data.initData.inputData.productGroupList.map(g => {
57
45
  if (!g.prodOrderList) {
58
- return;
46
+ return
59
47
  }
60
- this.groupKey = g.key;
48
+ this.groupKey = g.key
61
49
  g.prodOrderList.map(p => {
62
- this.productKey = p.key;
63
- });
64
- });
65
- document.title = `DEMO(产品):${data.title}`;
50
+ this.productKey = p.key
51
+ })
52
+ })
53
+ document.title = `DEMO(产品):${data.title}`
66
54
  })
67
55
  .catch(error => {
68
- console.log(error);
69
- });
56
+ console.log(error)
57
+ })
70
58
  }
71
59
  cgProduct(product, obj, inst) {
72
60
  if (obj.type === 'change') {
73
- this.$toast(`${_get(obj, 'insData.eleOrderList[0].labelName')} -> ${_get(obj, 'eleData.labelName')}: ${_get(obj, 'eleData.value')}`);
61
+ this.$toast(`${_get(obj, 'insData.eleOrderList[0].labelName')} -> ${_get(obj, 'eleData.labelName')}: ${_get(obj, 'eleData.value')}`)
74
62
  }
75
63
  }
76
64
  }