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
|
@@ -7,62 +7,7 @@
|
|
|
7
7
|
* @return {*} 试算结果
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import
|
|
11
|
-
import { IS_PRODUCT_ENV } from '@src/js/variables.js';
|
|
12
|
-
const baseURL = `https://insurance2a-api.wyins.net${IS_PRODUCT_ENV ? '' : '.cn'}`;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* **获取地址信息**
|
|
16
|
-
* @ignore
|
|
17
|
-
* @author watson
|
|
18
|
-
* @date 2022-04-26
|
|
19
|
-
* @param {string} fetchUrl api url
|
|
20
|
-
* @param {object} data 接口传参
|
|
21
|
-
* @returns {object} addressData
|
|
22
|
-
*/
|
|
23
|
-
export function getAddress(fetchUrl, data) {
|
|
24
|
-
return new Promise((resolve, reject) => {
|
|
25
|
-
fetch({
|
|
26
|
-
baseURL: fetchUrl,
|
|
27
|
-
url: undefined,
|
|
28
|
-
method: 'POST',
|
|
29
|
-
urlParams: undefined,
|
|
30
|
-
data
|
|
31
|
-
})
|
|
32
|
-
.then(res => {
|
|
33
|
-
resolve(res);
|
|
34
|
-
})
|
|
35
|
-
.catch(err => {
|
|
36
|
-
reject(err);
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* **获取用户信息**
|
|
43
|
-
* @ignore
|
|
44
|
-
* @author watson
|
|
45
|
-
* @date 2022-04-26
|
|
46
|
-
* @param {string} fetchUrl api url
|
|
47
|
-
* @returns {promise}
|
|
48
|
-
*/
|
|
49
|
-
export function getUuid(fetchUrl) {
|
|
50
|
-
return new Promise((resolve, reject) => {
|
|
51
|
-
fetch({
|
|
52
|
-
baseURL: fetchUrl,
|
|
53
|
-
url: undefined,
|
|
54
|
-
method: 'GET',
|
|
55
|
-
urlParams: undefined,
|
|
56
|
-
data: null
|
|
57
|
-
})
|
|
58
|
-
.then(res => {
|
|
59
|
-
resolve(res);
|
|
60
|
-
})
|
|
61
|
-
.catch(err => {
|
|
62
|
-
reject(err);
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
}
|
|
10
|
+
import { postProductDataCalculate } from '../../../src/api/trade.js'
|
|
66
11
|
|
|
67
12
|
/**
|
|
68
13
|
* **计划书初始化参数**
|
|
@@ -78,14 +23,14 @@ export function getUuid(fetchUrl) {
|
|
|
78
23
|
* @returns {boolean} 是否有计划书参数
|
|
79
24
|
*/
|
|
80
25
|
export function hasPlanParams(planParams) {
|
|
81
|
-
let type = false
|
|
26
|
+
let type = false
|
|
82
27
|
if (
|
|
83
28
|
planParams &&
|
|
84
29
|
(planParams.detail_age || planParams.detail_sex || planParams.detail_relation || planParams.detail_applicant_age || planParams.detail_applicant_sex)
|
|
85
30
|
) {
|
|
86
|
-
type = true
|
|
31
|
+
type = true
|
|
87
32
|
}
|
|
88
|
-
return type
|
|
33
|
+
return type
|
|
89
34
|
}
|
|
90
35
|
|
|
91
36
|
/**
|
|
@@ -100,38 +45,38 @@ export function hasPlanParams(planParams) {
|
|
|
100
45
|
*/
|
|
101
46
|
function translatePlanData(widgets, currentData, planParams) {
|
|
102
47
|
widgets.forEach(item => {
|
|
103
|
-
let current
|
|
48
|
+
let current
|
|
104
49
|
// 增加current字段,保存current_data的数据
|
|
105
50
|
if (item.duty) {
|
|
106
|
-
current = currentData.find(it => it.k === item.key && it.risk === item.riskCode && item.duty === it.d)
|
|
51
|
+
current = currentData.find(it => it.k === item.key && it.risk === item.riskCode && item.duty === it.d)
|
|
107
52
|
} else {
|
|
108
|
-
current = currentData.find(it => it.k === item.key && it.risk === item.riskCode)
|
|
53
|
+
current = currentData.find(it => it.k === item.key && it.risk === item.riskCode)
|
|
109
54
|
}
|
|
110
55
|
if (planParams) {
|
|
111
56
|
// 被保人生日 / 年龄
|
|
112
57
|
if (planParams.detail_age && item.key === 'detail_age') {
|
|
113
58
|
if (/-/.test(planParams.detail_age)) {
|
|
114
59
|
// 被保人生日
|
|
115
|
-
item.type = 'v-text'
|
|
116
|
-
item.name = planParams.detail_age
|
|
117
|
-
current.v = planParams.detail_age
|
|
60
|
+
item.type = 'v-text'
|
|
61
|
+
item.name = planParams.detail_age
|
|
62
|
+
current.v = planParams.detail_age
|
|
118
63
|
} else if (/岁/.test(planParams.detail_age)) {
|
|
119
64
|
// 被保人年龄
|
|
120
|
-
item.type = 'v-text'
|
|
121
|
-
item.name = planParams.detail_age
|
|
122
|
-
item.label = item.label + '(年龄)'
|
|
65
|
+
item.type = 'v-text'
|
|
66
|
+
item.name = planParams.detail_age
|
|
67
|
+
item.label = item.label + '(年龄)'
|
|
123
68
|
current.v =
|
|
124
69
|
planParams.detail_age
|
|
125
70
|
.replace('周', '')
|
|
126
71
|
.replace('岁', '')
|
|
127
|
-
.replace('Y', '') + 'Y'
|
|
72
|
+
.replace('Y', '') + 'Y'
|
|
128
73
|
}
|
|
129
74
|
}
|
|
130
75
|
// 被保人性别
|
|
131
76
|
if (planParams.detail_sex && item.key === 'detail_sex') {
|
|
132
|
-
item.type = 'v-text'
|
|
133
|
-
item.name = planParams.detail_sex === '1' ? '男' : '女'
|
|
134
|
-
current.v = planParams.detail_sex
|
|
77
|
+
item.type = 'v-text'
|
|
78
|
+
item.name = planParams.detail_sex === '1' ? '男' : '女'
|
|
79
|
+
current.v = planParams.detail_sex
|
|
135
80
|
}
|
|
136
81
|
// 投被保人关系
|
|
137
82
|
// 初始化
|
|
@@ -169,55 +114,55 @@ function translatePlanData(widgets, currentData, planParams) {
|
|
|
169
114
|
// 条件检索
|
|
170
115
|
if (planParams.detail_relation === '-1' || planParams.detail_relation === -1) {
|
|
171
116
|
// 非本人
|
|
172
|
-
const temp = []
|
|
117
|
+
const temp = []
|
|
173
118
|
item.opts[item.key].forEach(i => {
|
|
174
119
|
if (String(i.value) != '1') {
|
|
175
|
-
temp.push(i)
|
|
120
|
+
temp.push(i)
|
|
176
121
|
}
|
|
177
|
-
})
|
|
178
|
-
item.name = temp[0] && temp[0].name ? temp[0].name : ''
|
|
179
|
-
item.opts[item.key] = temp
|
|
122
|
+
})
|
|
123
|
+
item.name = temp[0] && temp[0].name ? temp[0].name : ''
|
|
124
|
+
item.opts[item.key] = temp
|
|
180
125
|
} else if (planParams.detail_relation) {
|
|
181
126
|
// 指定人 - 本人 其他人
|
|
182
|
-
item.type = 'v-text'
|
|
183
|
-
current.v = planParams.detail_relation
|
|
184
|
-
const temp = []
|
|
127
|
+
item.type = 'v-text'
|
|
128
|
+
current.v = planParams.detail_relation
|
|
129
|
+
const temp = []
|
|
185
130
|
item.opts[item.key].forEach(i => {
|
|
186
131
|
if (String(i.value) === String(planParams.detail_relation)) {
|
|
187
|
-
temp.push(i)
|
|
188
|
-
item.name = i.name
|
|
132
|
+
temp.push(i)
|
|
133
|
+
item.name = i.name
|
|
189
134
|
}
|
|
190
|
-
})
|
|
191
|
-
item.opts[item.key] = temp
|
|
135
|
+
})
|
|
136
|
+
item.opts[item.key] = temp
|
|
192
137
|
}
|
|
193
138
|
}
|
|
194
139
|
// 投保人出生日期
|
|
195
140
|
if (planParams.detail_applicant_age && item.key === 'detail_applicant_age') {
|
|
196
141
|
if (/-/.test(planParams.detail_applicant_age)) {
|
|
197
142
|
// 被保人生日
|
|
198
|
-
item.type = 'v-text'
|
|
199
|
-
item.name = planParams.detail_applicant_age
|
|
200
|
-
current.v = planParams.detail_applicant_age
|
|
143
|
+
item.type = 'v-text'
|
|
144
|
+
item.name = planParams.detail_applicant_age
|
|
145
|
+
current.v = planParams.detail_applicant_age
|
|
201
146
|
} else if (/岁/.test(planParams.detail_applicant_age)) {
|
|
202
147
|
// 被保人年龄
|
|
203
|
-
item.type = 'v-text'
|
|
204
|
-
item.name = planParams.detail_applicant_age
|
|
205
|
-
item.label = item.label + '(年龄)'
|
|
148
|
+
item.type = 'v-text'
|
|
149
|
+
item.name = planParams.detail_applicant_age
|
|
150
|
+
item.label = item.label + '(年龄)'
|
|
206
151
|
current.v =
|
|
207
152
|
planParams.detail_applicant_age
|
|
208
153
|
.replace('周', '')
|
|
209
154
|
.replace('岁', '')
|
|
210
|
-
.replace('Y', '') + 'Y'
|
|
155
|
+
.replace('Y', '') + 'Y'
|
|
211
156
|
}
|
|
212
157
|
}
|
|
213
158
|
// 投保人性别
|
|
214
159
|
if (planParams.detail_applicant_sex && item.key === 'detail_applicant_sex') {
|
|
215
|
-
item.type = 'v-text'
|
|
216
|
-
item.name = planParams.detail_applicant_sex === '1' ? '男' : '女'
|
|
217
|
-
current.v = planParams.detail_applicant_sex
|
|
160
|
+
item.type = 'v-text'
|
|
161
|
+
item.name = planParams.detail_applicant_sex === '1' ? '男' : '女'
|
|
162
|
+
current.v = planParams.detail_applicant_sex
|
|
218
163
|
}
|
|
219
164
|
}
|
|
220
|
-
})
|
|
165
|
+
})
|
|
221
166
|
}
|
|
222
167
|
|
|
223
168
|
/**
|
|
@@ -230,54 +175,54 @@ function translatePlanData(widgets, currentData, planParams) {
|
|
|
230
175
|
* @returns {object}
|
|
231
176
|
*/
|
|
232
177
|
function tranlateCurrentData(currentData, planParams) {
|
|
233
|
-
const currentDataCopy = JSON.parse(JSON.stringify(currentData))
|
|
178
|
+
const currentDataCopy = JSON.parse(JSON.stringify(currentData))
|
|
234
179
|
currentDataCopy.forEach(item => {
|
|
235
|
-
const current = item
|
|
180
|
+
const current = item
|
|
236
181
|
if (planParams) {
|
|
237
182
|
if (planParams.detail_age && item.k === 'detail_age') {
|
|
238
183
|
if (/-/.test(planParams.detail_age)) {
|
|
239
184
|
// 被保人生日
|
|
240
|
-
current.v = planParams.detail_age
|
|
185
|
+
current.v = planParams.detail_age
|
|
241
186
|
} else if (/岁/.test(planParams.detail_age)) {
|
|
242
187
|
// 被保人年龄
|
|
243
188
|
current.v =
|
|
244
189
|
planParams.detail_age
|
|
245
190
|
.replace('周', '')
|
|
246
191
|
.replace('岁', '')
|
|
247
|
-
.replace('Y', '') + 'Y'
|
|
192
|
+
.replace('Y', '') + 'Y'
|
|
248
193
|
}
|
|
249
194
|
}
|
|
250
195
|
// 被保人性别
|
|
251
196
|
if (planParams.detail_sex && item.k === 'detail_sex') {
|
|
252
|
-
current.v = planParams.detail_sex
|
|
197
|
+
current.v = planParams.detail_sex
|
|
253
198
|
}
|
|
254
199
|
// 投被保人关系
|
|
255
200
|
if (planParams.detail_relation && item.k === 'detail_relation') {
|
|
256
201
|
if (planParams.detail_relation != -1 || planParams.detail_relation != '-1') {
|
|
257
|
-
current.v = planParams.detail_relation
|
|
202
|
+
current.v = planParams.detail_relation
|
|
258
203
|
}
|
|
259
204
|
}
|
|
260
205
|
// 投保人出生日期
|
|
261
206
|
if (planParams.detail_applicant_age && item.k === 'detail_applicant_age') {
|
|
262
207
|
if (/-/.test(planParams.detail_applicant_age)) {
|
|
263
208
|
// 被保人生日
|
|
264
|
-
current.v = planParams.detail_applicant_age
|
|
209
|
+
current.v = planParams.detail_applicant_age
|
|
265
210
|
} else if (/岁/.test(planParams.detail_applicant_age)) {
|
|
266
211
|
// 被保人年龄
|
|
267
212
|
current.v =
|
|
268
213
|
planParams.detail_applicant_age
|
|
269
214
|
.replace('周', '')
|
|
270
215
|
.replace('岁', '')
|
|
271
|
-
.replace('Y', '') + 'Y'
|
|
216
|
+
.replace('Y', '') + 'Y'
|
|
272
217
|
}
|
|
273
218
|
}
|
|
274
219
|
// 投保人性别
|
|
275
220
|
if (planParams.detail_applicant_sex && item.k === 'detail_applicant_sex') {
|
|
276
|
-
current.v = planParams.detail_applicant_sex
|
|
221
|
+
current.v = planParams.detail_applicant_sex
|
|
277
222
|
}
|
|
278
223
|
}
|
|
279
|
-
})
|
|
280
|
-
return currentDataCopy
|
|
224
|
+
})
|
|
225
|
+
return currentDataCopy
|
|
281
226
|
}
|
|
282
227
|
|
|
283
228
|
/**
|
|
@@ -291,60 +236,34 @@ function tranlateCurrentData(currentData, planParams) {
|
|
|
291
236
|
*/
|
|
292
237
|
export function insureCalculate(urlParams, postParams, planParams) {
|
|
293
238
|
if (!postParams || typeof postParams !== 'object' || !postParams.product_id) {
|
|
294
|
-
return postParams
|
|
239
|
+
return postParams
|
|
295
240
|
}
|
|
296
241
|
if (postParams && !postParams.scenario) {
|
|
297
|
-
postParams.scenario = 'h5Widget'
|
|
298
|
-
}
|
|
299
|
-
let url = '/api/product/data/calculate';
|
|
300
|
-
if (urlParams && urlParams.uuid) {
|
|
301
|
-
url += `?userUuid=${urlParams.uuid}`;
|
|
302
|
-
} else if (urlParams && urlParams.openId) {
|
|
303
|
-
url += `?userUuid=${urlParams.openId}`;
|
|
304
|
-
}
|
|
305
|
-
if (urlParams && urlParams.appid) {
|
|
306
|
-
if (url.indexOf('?') > -1) {
|
|
307
|
-
url += `&appId=${urlParams.appid}`;
|
|
308
|
-
} else {
|
|
309
|
-
url += `?appId=${urlParams.appid}`;
|
|
310
|
-
}
|
|
242
|
+
postParams.scenario = 'h5Widget'
|
|
311
243
|
}
|
|
312
244
|
if (hasPlanParams(planParams) && postParams.current_data) {
|
|
313
|
-
postParams.current_data = tranlateCurrentData(postParams.current_data, planParams)
|
|
245
|
+
postParams.current_data = tranlateCurrentData(postParams.current_data, planParams)
|
|
314
246
|
}
|
|
315
|
-
return
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
product_id: data.product_id,
|
|
336
|
-
current_data: data.current_data,
|
|
337
|
-
risk_premiums: data.risk_premiums
|
|
338
|
-
};
|
|
339
|
-
resolve({ code: 200, data: cData });
|
|
340
|
-
} else {
|
|
341
|
-
reject(res);
|
|
342
|
-
}
|
|
343
|
-
})
|
|
344
|
-
.catch(err => {
|
|
345
|
-
reject(err);
|
|
346
|
-
});
|
|
347
|
-
});
|
|
247
|
+
return postProductDataCalculate(urlParams, postParams).then(res => {
|
|
248
|
+
if (res.code === 200) {
|
|
249
|
+
let data = JSON.parse(JSON.stringify(res.data))
|
|
250
|
+
if (hasPlanParams(planParams)) {
|
|
251
|
+
const widgets = data.widgets
|
|
252
|
+
const currentData = data.current_data
|
|
253
|
+
translatePlanData(widgets, currentData, planParams)
|
|
254
|
+
}
|
|
255
|
+
const cData = {
|
|
256
|
+
widgets: data.widgets,
|
|
257
|
+
total_premium: data.total_premium,
|
|
258
|
+
terms: data.terms,
|
|
259
|
+
product_id: data.product_id,
|
|
260
|
+
current_data: data.current_data,
|
|
261
|
+
risk_premiums: data.risk_premiums
|
|
262
|
+
}
|
|
263
|
+
return { code: 200, data: cData }
|
|
264
|
+
}
|
|
265
|
+
return Promise.reject(res)
|
|
266
|
+
})
|
|
348
267
|
}
|
|
349
268
|
|
|
350
269
|
/**
|
|
@@ -357,22 +276,22 @@ export function insureCalculate(urlParams, postParams, planParams) {
|
|
|
357
276
|
* @returns {promise} 试算结果
|
|
358
277
|
*/
|
|
359
278
|
export async function checkInsureCalculate(urlParams, postParams, planParams) {
|
|
360
|
-
let res
|
|
361
|
-
res = await checkInsureCalculateIn(urlParams, postParams, planParams)
|
|
279
|
+
let res
|
|
280
|
+
res = await checkInsureCalculateIn(urlParams, postParams, planParams)
|
|
362
281
|
if (postParams && !postParams.current_data) {
|
|
363
|
-
let data = JSON.parse(JSON.stringify(res.data))
|
|
364
|
-
postParams.current_data = data.current_data
|
|
282
|
+
let data = JSON.parse(JSON.stringify(res.data))
|
|
283
|
+
postParams.current_data = data.current_data
|
|
365
284
|
// 重新试算
|
|
366
285
|
try {
|
|
367
|
-
res = await checkInsureCalculateIn(urlParams, postParams, planParams)
|
|
286
|
+
res = await checkInsureCalculateIn(urlParams, postParams, planParams)
|
|
368
287
|
} catch (error) {
|
|
369
|
-
res = error
|
|
288
|
+
res = error
|
|
370
289
|
}
|
|
371
290
|
}
|
|
372
291
|
if (res && res.code === 200) {
|
|
373
|
-
return res
|
|
292
|
+
return res
|
|
374
293
|
} else {
|
|
375
|
-
return Promise.reject(res)
|
|
294
|
+
return Promise.reject(res)
|
|
376
295
|
}
|
|
377
296
|
}
|
|
378
297
|
|
|
@@ -388,50 +307,18 @@ export async function checkInsureCalculate(urlParams, postParams, planParams) {
|
|
|
388
307
|
*/
|
|
389
308
|
export function checkInsureCalculateIn(urlParams, postParams, planParams) {
|
|
390
309
|
if (!postParams || typeof postParams !== 'object' || !postParams.product_id) {
|
|
391
|
-
return Promise.reject({ code: 400, msg: 'postParams参数非法' })
|
|
310
|
+
return Promise.reject({ code: 400, msg: 'postParams参数非法' })
|
|
392
311
|
}
|
|
393
312
|
if (postParams && !postParams.scenario) {
|
|
394
|
-
postParams.scenario = 'h5Widget'
|
|
395
|
-
}
|
|
396
|
-
let url = '/api/product/data/calculate';
|
|
397
|
-
if (urlParams && urlParams.uuid) {
|
|
398
|
-
url += `?userUuid=${urlParams.uuid}`;
|
|
399
|
-
} else if (urlParams && urlParams.openId) {
|
|
400
|
-
url += `?userUuid=${urlParams.openId}`;
|
|
401
|
-
}
|
|
402
|
-
if (urlParams && urlParams.appid) {
|
|
403
|
-
if (url.indexOf('?') > -1) {
|
|
404
|
-
url += `&appId=${urlParams.appid}`;
|
|
405
|
-
} else {
|
|
406
|
-
url += `?appId=${urlParams.appid}`;
|
|
407
|
-
}
|
|
313
|
+
postParams.scenario = 'h5Widget'
|
|
408
314
|
}
|
|
409
315
|
if (hasPlanParams(planParams) && postParams.current_data) {
|
|
410
|
-
postParams.current_data = tranlateCurrentData(postParams.current_data, planParams)
|
|
316
|
+
postParams.current_data = tranlateCurrentData(postParams.current_data, planParams)
|
|
411
317
|
}
|
|
412
|
-
return
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
data: postParams
|
|
419
|
-
})
|
|
420
|
-
.then(res => {
|
|
421
|
-
if (res.code === 200) {
|
|
422
|
-
// if (postParams && !postParams.current_data) {
|
|
423
|
-
// let data = JSON.parse(JSON.stringify(res.data));
|
|
424
|
-
// postParams.current_data = data.current_data
|
|
425
|
-
// // 重新试算
|
|
426
|
-
// checkInsureCalculate(urlParams, postParams, planParams)
|
|
427
|
-
// }
|
|
428
|
-
resolve({ code: 200, data: res.data });
|
|
429
|
-
} else {
|
|
430
|
-
reject(res);
|
|
431
|
-
}
|
|
432
|
-
})
|
|
433
|
-
.catch(err => {
|
|
434
|
-
reject(err);
|
|
435
|
-
});
|
|
436
|
-
});
|
|
318
|
+
return postProductDataCalculate(urlParams, postParams).then(res => {
|
|
319
|
+
if (res.code === 200) {
|
|
320
|
+
return { code: 200, data: res.data }
|
|
321
|
+
}
|
|
322
|
+
return Promise.reject(res)
|
|
323
|
+
})
|
|
437
324
|
}
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
</div>
|
|
13
13
|
</template>
|
|
14
14
|
<script lang="ts">
|
|
15
|
-
import Vue from 'vue'
|
|
16
|
-
import { Component } from 'vue-property-decorator'
|
|
17
|
-
import CanvasPoster from '../index.vue'
|
|
15
|
+
import Vue from 'vue'
|
|
16
|
+
import { Component } from 'vue-property-decorator'
|
|
17
|
+
import CanvasPoster from '../index.vue'
|
|
18
18
|
|
|
19
19
|
@Component({
|
|
20
20
|
components: {
|
|
@@ -22,20 +22,18 @@ import CanvasPoster from '../index.vue';
|
|
|
22
22
|
}
|
|
23
23
|
})
|
|
24
24
|
export default class CanvasPosterDemo extends Vue {
|
|
25
|
-
window: any = window
|
|
25
|
+
window: any = window
|
|
26
26
|
posterData: any[] = [
|
|
27
27
|
{
|
|
28
28
|
type: 'image',
|
|
29
|
-
url:
|
|
30
|
-
'https://media.winbaoxian.com/autoUpload/planbook/712d0f9ecd593a33029b5ea1b6ab419f2e014e5029e1a-MTGQfr_fw658_7f99c5bc34a5ef5.jpeg',
|
|
29
|
+
url: 'https://media.winbaoxian.com/autoUpload/planbook/712d0f9ecd593a33029b5ea1b6ab419f2e014e5029e1a-MTGQfr_fw658_7f99c5bc34a5ef5.jpeg',
|
|
31
30
|
crossOrigin: 'anonymous',
|
|
32
31
|
width: window.innerWidth,
|
|
33
32
|
height: window.innerHeight
|
|
34
33
|
},
|
|
35
34
|
{
|
|
36
35
|
type: 'image',
|
|
37
|
-
url:
|
|
38
|
-
'https://media.winbaoxian.com/autoUpload/planbook/712d0f9ecd593a33029b5ea1b6ab419f2e014e5029e1a-MTGQfr_fw658_7f99c5bc34a5ef5.jpeg',
|
|
36
|
+
url: 'https://media.winbaoxian.com/autoUpload/planbook/712d0f9ecd593a33029b5ea1b6ab419f2e014e5029e1a-MTGQfr_fw658_7f99c5bc34a5ef5.jpeg',
|
|
39
37
|
crossOrigin: 'anonymous',
|
|
40
38
|
point: [200, 250],
|
|
41
39
|
width: 100,
|
|
@@ -44,8 +42,7 @@ export default class CanvasPosterDemo extends Vue {
|
|
|
44
42
|
},
|
|
45
43
|
{
|
|
46
44
|
type: 'image',
|
|
47
|
-
url:
|
|
48
|
-
'https://media.winbaoxian.com/autoUpload/planbook/712d0f9ecd593a33029b5ea1b6ab419f2e014e5029e1a-MTGQfr_fw658_7f99c5bc34a5ef5.jpeg',
|
|
45
|
+
url: 'https://media.winbaoxian.com/autoUpload/planbook/712d0f9ecd593a33029b5ea1b6ab419f2e014e5029e1a-MTGQfr_fw658_7f99c5bc34a5ef5.jpeg',
|
|
49
46
|
crossOrigin: 'anonymous',
|
|
50
47
|
point: [250, 300],
|
|
51
48
|
width: 100,
|
|
@@ -59,8 +56,7 @@ export default class CanvasPosterDemo extends Vue {
|
|
|
59
56
|
},
|
|
60
57
|
{
|
|
61
58
|
type: 'text',
|
|
62
|
-
tx:
|
|
63
|
-
'文本自动换行文本自动换行文本自动换行文本自动换行文本自动换行文本自动换行文本自动换行文本自动换行文本自动换行文本自动换行文本自动换行文本自动换行',
|
|
59
|
+
tx: '文本自动换行文本自动换行文本自动换行文本自动换行文本自动换行文本自动换行文本自动换行文本自动换行文本自动换行文本自动换行文本自动换行文本自动换行',
|
|
64
60
|
color: '#fff',
|
|
65
61
|
fontWeight: 'bold',
|
|
66
62
|
fontSize: 18,
|
|
@@ -95,7 +91,7 @@ export default class CanvasPosterDemo extends Vue {
|
|
|
95
91
|
height: 100,
|
|
96
92
|
radius: 5
|
|
97
93
|
}
|
|
98
|
-
]
|
|
94
|
+
]
|
|
99
95
|
created() {}
|
|
100
96
|
}
|
|
101
97
|
</script>
|