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
|
@@ -1,169 +1,226 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { PLANBOOK_API_HOSTNAME } from '@src/js/variables.js';
|
|
1
|
+
import qs from 'qs'
|
|
2
|
+
import { get as _get, cloneDeep } from 'lodash'
|
|
3
|
+
import { Toast, Dialog } from 'vant'
|
|
5
4
|
import {
|
|
6
5
|
initPersonData,
|
|
7
6
|
personDataHandler,
|
|
8
7
|
convertPersonData,
|
|
8
|
+
calcTotalBaof,
|
|
9
9
|
initProductData,
|
|
10
10
|
productDataHandler,
|
|
11
|
+
multipleInsuredHandler,
|
|
12
|
+
clearAddAndTakeAndAdjustBaoeData,
|
|
11
13
|
convertProductData,
|
|
12
14
|
verifyProductRules,
|
|
13
15
|
convertEleOrderListToObj,
|
|
14
16
|
getExpressionParamMap
|
|
15
|
-
} from '
|
|
16
|
-
import {
|
|
17
|
+
} from '../bxs-utils/index'
|
|
18
|
+
import { calcPlanbookProduct, uploadPlanBookResult, getUnderwriteEffectiveRules } from '../../src/api/index.js'
|
|
19
|
+
import { parseTime, getSecurityToken, goBack } from '../../src/js/utils.js'
|
|
20
|
+
import { isIos, appVersion, URL_PARAM } from '../../src/js/variables'
|
|
17
21
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
productDataHandler(p, data.verifyData[p.key], inputData.personData, {
|
|
32
|
-
planbookId: data.pbId
|
|
33
|
-
})
|
|
34
|
-
);
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
await Promise.all(promises);
|
|
22
|
+
let productCalcVuexStore = null
|
|
23
|
+
export function setProductCalcVuexStore(storeInstance) {
|
|
24
|
+
productCalcVuexStore = storeInstance
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function getProductCalcVuexStore() {
|
|
28
|
+
return productCalcVuexStore
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function commitProductCalcError(productUniqueKey, message) {
|
|
32
|
+
const calcStore = getProductCalcVuexStore()
|
|
33
|
+
if (productUniqueKey && calcStore && calcStore._mutations && calcStore._mutations.SET_PRODUCT_CALC_ERROR) {
|
|
34
|
+
calcStore.commit('SET_PRODUCT_CALC_ERROR', { id: productUniqueKey, message })
|
|
38
35
|
}
|
|
39
|
-
return data;
|
|
40
36
|
}
|
|
41
37
|
|
|
42
|
-
export function
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
export async function initPageData(data, options = {}) {
|
|
39
|
+
const planbookId = data.pbId
|
|
40
|
+
const pbType = _get(options, 'pbType')
|
|
41
|
+
const { user } = options || {}
|
|
42
|
+
|
|
43
|
+
// 承保规则赋值
|
|
44
|
+
if (!['annual_survey'].includes(pbType)) {
|
|
45
|
+
const _inputData = await setupUnderwriteRuleToInputData(_get(data, 'initData.inputData')).catch(() => null)
|
|
46
|
+
if (_inputData) {
|
|
47
|
+
data.initData.inputData = _inputData
|
|
48
|
+
}
|
|
45
49
|
}
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
|
|
51
|
+
data.interestProductList = data.interestProductList || []
|
|
52
|
+
const inputData = _get(data, 'initData.inputData')
|
|
53
|
+
if (inputData) {
|
|
54
|
+
const verifyData = data.verifyData
|
|
55
|
+
const exportData = data.exportData ? JSON.parse(data.exportData) : null
|
|
56
|
+
const policyInfo = data.policyInfo
|
|
57
|
+
const personData = inputData.personData
|
|
58
|
+
initPersonData(inputData, verifyData)
|
|
59
|
+
const productFlatList = (inputData.productGroupList || []).map(g => g.prodOrderList || []).flat()
|
|
60
|
+
productFlatList.forEach(p => {
|
|
61
|
+
initProductData(p)
|
|
62
|
+
multipleInsuredHandler(p, personData)
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
// 导入已有数据,重新赋值到初始化中的产品对象中
|
|
66
|
+
setPageDataBaseOnResult(inputData, exportData, policyInfo, options)
|
|
67
|
+
|
|
68
|
+
personDataHandler(personData)
|
|
69
|
+
const promises = productFlatList.map(p => {
|
|
70
|
+
return productDataHandler(p, _get(verifyData, p.key), personData, {
|
|
71
|
+
user,
|
|
72
|
+
planbookId,
|
|
73
|
+
executeSource: exportData ? 'import' : 'init'
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
|
+
await Promise.all(promises)
|
|
77
|
+
}
|
|
78
|
+
return data
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function setPageDataBaseOnResult(inputData, exportData, policyInfo, options = {}) {
|
|
48
82
|
if (inputData && exportData) {
|
|
49
83
|
// 人员信息赋值
|
|
50
|
-
|
|
51
|
-
|
|
84
|
+
const iPersonData = inputData.personData
|
|
85
|
+
const ePersonData = exportData.personData
|
|
52
86
|
if (iPersonData && ePersonData) {
|
|
53
87
|
for (let k in iPersonData) {
|
|
54
88
|
if (k == 'personOrderList' && ePersonData[k]) {
|
|
55
|
-
iPersonData[k].forEach(
|
|
56
|
-
person.eleOrderList
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
89
|
+
iPersonData[k].forEach(person => {
|
|
90
|
+
if (!person.eleOrderList) {
|
|
91
|
+
return
|
|
92
|
+
}
|
|
93
|
+
const ePerson = ePersonData[k].find(e => e.key === person.key)
|
|
94
|
+
person.eleOrderList.forEach(ele => {
|
|
95
|
+
let value = ePerson && ePerson[ele.key]
|
|
96
|
+
if (ele.key === 'insuranceDay' && policyInfo) {
|
|
97
|
+
value = parseTime(policyInfo.insuranceDay, '{y}/{m}/{d}')
|
|
98
|
+
}
|
|
99
|
+
if (value !== undefined && value !== null) {
|
|
100
|
+
ele.value = value
|
|
101
|
+
}
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
const cid = policyInfo ? policyInfo[person.key.replace(/Info/, 'Uuid')] : ePerson.cid
|
|
105
|
+
if (ePerson && cid) {
|
|
106
|
+
person.cid = cid
|
|
107
|
+
}
|
|
108
|
+
})
|
|
63
109
|
}
|
|
64
110
|
if (k == 'recipientInfo' && ePersonData[k]) {
|
|
65
111
|
iPersonData[k].eleOrderList &&
|
|
66
112
|
iPersonData[k].eleOrderList.forEach(ele => {
|
|
67
113
|
if (iPersonData[k][ele.key]) {
|
|
68
|
-
ele.value = ePersonData[k][ele.key]
|
|
114
|
+
ele.value = ePersonData[k][ele.key]
|
|
69
115
|
}
|
|
70
|
-
})
|
|
116
|
+
})
|
|
71
117
|
}
|
|
72
118
|
}
|
|
73
119
|
}
|
|
74
120
|
|
|
75
121
|
// 产品赋值
|
|
76
|
-
|
|
77
|
-
|
|
122
|
+
const iGroupList = inputData.productGroupList
|
|
123
|
+
const eGroupList = exportData.productGroupList
|
|
78
124
|
if (iGroupList && eGroupList) {
|
|
79
125
|
iGroupList.forEach((group, gi) => {
|
|
80
|
-
let eGroupData = eGroupList[gi]
|
|
81
|
-
if (eGroupData
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
126
|
+
let eGroupData = eGroupList[gi]
|
|
127
|
+
if (!eGroupData || !group.prodOrderList) {
|
|
128
|
+
return
|
|
129
|
+
}
|
|
130
|
+
group.prodOrderList.forEach(prod => {
|
|
131
|
+
let eProductData = eGroupData.prodOrderList.find(p => p.key === prod.key)
|
|
132
|
+
if (!eProductData) {
|
|
133
|
+
return
|
|
134
|
+
}
|
|
135
|
+
// 取调整保额数据
|
|
136
|
+
if (eProductData.adjustBaoeData) {
|
|
137
|
+
prod.adjustBaoeData = eProductData.adjustBaoeData
|
|
138
|
+
}
|
|
139
|
+
prod.inputResultSwitch = !!eProductData.inputResultSwitch
|
|
140
|
+
prod.resultImport = true
|
|
141
|
+
// 已生成的计划书取回的产品数据,赋值到初始化中的产品对象中
|
|
142
|
+
for (let k in prod) {
|
|
143
|
+
if (k == 'mulInsOrderList') {
|
|
144
|
+
// 清除组合险
|
|
145
|
+
prod.mulInsOrderList = prod.mulInsOrderList.filter(ins => !ins.isGroup)
|
|
146
|
+
// 已生成的计划书取回的险种数据,赋值到初始化中的险种对象中
|
|
147
|
+
prod.mulInsOrderList.forEach(ins => {
|
|
148
|
+
const eInsuranceData = eProductData.mulInsOrderList.find(m => m.key === ins.key)
|
|
149
|
+
if (eInsuranceData) {
|
|
150
|
+
if (ins.eleOrderList) {
|
|
151
|
+
// 下为处理从结果页中导入数值时,保额保费互算问题 2018.12.11
|
|
152
|
+
let calMethod = ins.eleOrderList.find(e => e.key === 'calMethod')
|
|
153
|
+
let baoe = ins.eleOrderList.find(e => e.key === 'baoe')
|
|
154
|
+
let baof = ins.eleOrderList.find(e => e.key === 'baof') || ins.eleOrderList.find(e => e.key === 'payModePremium')
|
|
155
|
+
if (calMethod && baoe && baof && eInsuranceData.calMethod) {
|
|
156
|
+
baoe.isHide = eInsuranceData.calMethod !== 'baoe2baof'
|
|
157
|
+
baof.isHide = eInsuranceData.calMethod === 'baoe2baof'
|
|
158
|
+
}
|
|
159
|
+
ins.eleOrderList.forEach(ele => {
|
|
160
|
+
if (!options.uuid && options.ocrUuid) {
|
|
161
|
+
ele.value = eInsuranceData[ele.key]
|
|
162
|
+
return
|
|
114
163
|
}
|
|
115
|
-
if (eInsuranceData.
|
|
116
|
-
|
|
164
|
+
if (eInsuranceData[ele.key]) {
|
|
165
|
+
ele.value = eInsuranceData[ele.key]
|
|
117
166
|
}
|
|
167
|
+
})
|
|
168
|
+
}
|
|
169
|
+
if (eInsuranceData.inputResult !== undefined) {
|
|
170
|
+
ins.inputResult = eInsuranceData.inputResult
|
|
171
|
+
}
|
|
118
172
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
}
|
|
173
|
+
// 万能账户存在,可以不加追加领取数据
|
|
174
|
+
for (let ik in ins) {
|
|
175
|
+
if (['reduceBaof'].includes(ik)) {
|
|
176
|
+
if (eInsuranceData[ik + 'Data']) {
|
|
177
|
+
ins[ik + 'Data'] = eInsuranceData[ik + 'Data']
|
|
126
178
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
if (ins.eleOrderList) {
|
|
130
|
-
ins.eleOrderList.forEach(ele => {
|
|
131
|
-
if (ele.key == 'title') {
|
|
132
|
-
ele.value = false;
|
|
133
|
-
}
|
|
134
|
-
});
|
|
179
|
+
if (eInsuranceData.duplicateReduceBaofData) {
|
|
180
|
+
ins.duplicateReduceBaofData = eInsuranceData.duplicateReduceBaofData
|
|
135
181
|
}
|
|
136
182
|
}
|
|
137
|
-
}
|
|
183
|
+
}
|
|
184
|
+
if ('policyInsuranceCategory' in eInsuranceData) {
|
|
185
|
+
ins.policyInsuranceCategory = eInsuranceData.policyInsuranceCategory
|
|
186
|
+
}
|
|
187
|
+
} else {
|
|
188
|
+
// 结果页数据中没有对应险种,对应的初始化数据置为未选中
|
|
189
|
+
if (ins.eleOrderList) {
|
|
190
|
+
ins.eleOrderList.forEach(ele => {
|
|
191
|
+
if (ele.key == 'title') {
|
|
192
|
+
ele.value = false
|
|
193
|
+
}
|
|
194
|
+
})
|
|
195
|
+
}
|
|
138
196
|
}
|
|
139
|
-
}
|
|
197
|
+
})
|
|
140
198
|
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
})
|
|
199
|
+
}
|
|
200
|
+
})
|
|
201
|
+
})
|
|
144
202
|
}
|
|
145
203
|
}
|
|
146
|
-
return
|
|
204
|
+
return inputData
|
|
147
205
|
}
|
|
148
206
|
|
|
149
|
-
export function createdProductDataToCalc(inputData, options = {}) {
|
|
207
|
+
export async function createdProductDataToCalc(inputData, options = {}) {
|
|
150
208
|
if (inputData && inputData.personData && inputData.productGroupList && inputData.productGroupList.length) {
|
|
151
209
|
const productData = getProductFromInputData(inputData, {
|
|
152
210
|
groupKey: options.groupKey,
|
|
153
211
|
productKey: options.productKey
|
|
154
|
-
})
|
|
155
|
-
|
|
156
|
-
const tempProductForm = convertProductData(productData);
|
|
212
|
+
})
|
|
213
|
+
const tempProductForm = convertProductData(productData)
|
|
157
214
|
// 过滤一些不必要的数据
|
|
158
|
-
const productForm = {}
|
|
215
|
+
const productForm = {}
|
|
159
216
|
for (let k in tempProductForm) {
|
|
160
|
-
if (!['hadChoice', 'hide', 'totalBaof', 'insShowArr', 'autoImport'].includes(k)) {
|
|
161
|
-
productForm[k] = tempProductForm[k]
|
|
217
|
+
if (!['hadChoice', 'hide', 'totalBaof', 'insShowArr', 'autoImport', 'restrictList', 'resultImport', 'adjustBaoeData'].includes(k)) {
|
|
218
|
+
productForm[k] = tempProductForm[k]
|
|
162
219
|
}
|
|
163
220
|
}
|
|
164
221
|
if (productForm.mulInsOrderList) {
|
|
165
222
|
productForm.mulInsOrderList = productForm.mulInsOrderList.map(ins => {
|
|
166
|
-
|
|
223
|
+
const tempIns = {}
|
|
167
224
|
for (let k in ins) {
|
|
168
225
|
if (
|
|
169
226
|
![
|
|
@@ -172,38 +229,37 @@ export function createdProductDataToCalc(inputData, options = {}) {
|
|
|
172
229
|
'baoeDesc',
|
|
173
230
|
'baofDesc',
|
|
174
231
|
'iDurationDesc',
|
|
232
|
+
'payModeDesc',
|
|
233
|
+
'payModePremiumDesc',
|
|
175
234
|
'accountData',
|
|
176
235
|
'reduceBaofData',
|
|
177
236
|
'duplicateReduceBaofData',
|
|
178
237
|
'isCheckbox',
|
|
179
238
|
'groupKey',
|
|
180
239
|
'groupName',
|
|
240
|
+
'shmInsData',
|
|
241
|
+
'totalBaof',
|
|
181
242
|
'customVariableExp',
|
|
182
|
-
'calcResultExp',
|
|
243
|
+
// 'calcResultExp', // 不能删除,后面有依赖
|
|
183
244
|
'revalidateFlag'
|
|
184
245
|
].includes(k)
|
|
185
246
|
) {
|
|
186
|
-
tempIns[k] = ins[k]
|
|
247
|
+
tempIns[k] = ins[k]
|
|
187
248
|
}
|
|
188
249
|
}
|
|
189
|
-
return tempIns
|
|
190
|
-
})
|
|
250
|
+
return tempIns
|
|
251
|
+
})
|
|
191
252
|
}
|
|
192
253
|
|
|
193
254
|
// 产品是否有选中的险种
|
|
255
|
+
if (productForm && productForm.policyType === 'online_trade') {
|
|
256
|
+
return Promise.resolve({})
|
|
257
|
+
}
|
|
194
258
|
if (productForm && productForm.mulInsOrderList && productForm.mulInsOrderList.length) {
|
|
195
259
|
const errorMsg = verifyProductRules({
|
|
196
260
|
personData: inputData.personData,
|
|
197
261
|
productData
|
|
198
|
-
})
|
|
199
|
-
|
|
200
|
-
// 清除产品中的一些不必要的险种数据
|
|
201
|
-
productForm.mulInsOrderList.forEach(ins => {
|
|
202
|
-
if (ins.shmInsData) {
|
|
203
|
-
delete ins.shmInsData;
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
|
|
262
|
+
})
|
|
207
263
|
const reqData = {
|
|
208
264
|
publicPbUuid: options.publicPbUuid || null,
|
|
209
265
|
insuranceTypeId: options.planbookId ? options.planbookId * 1 : null,
|
|
@@ -219,414 +275,745 @@ export function createdProductDataToCalc(inputData, options = {}) {
|
|
|
219
275
|
prodOrderList: [productForm] //转换后的产品数据
|
|
220
276
|
}
|
|
221
277
|
]
|
|
222
|
-
}
|
|
278
|
+
}
|
|
279
|
+
const reqDataStr = JSON.stringify(reqData)
|
|
280
|
+
const signature = await getSecurityToken(reqDataStr, {
|
|
281
|
+
groupDataKey: options.groupKey
|
|
282
|
+
})
|
|
223
283
|
return Promise.resolve({
|
|
224
284
|
errorMsg,
|
|
225
|
-
jd:
|
|
226
|
-
signature
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
})
|
|
285
|
+
jd: reqDataStr,
|
|
286
|
+
signature,
|
|
287
|
+
clientVersion: appVersion,
|
|
288
|
+
isIos
|
|
289
|
+
})
|
|
230
290
|
} else {
|
|
231
|
-
return Promise.reject('请选择险种')
|
|
291
|
+
return Promise.reject('请选择险种')
|
|
232
292
|
}
|
|
233
293
|
} else {
|
|
234
|
-
return Promise.reject('请填写投保数据')
|
|
294
|
+
return Promise.reject('请填写投保数据')
|
|
235
295
|
}
|
|
236
296
|
}
|
|
237
297
|
|
|
238
298
|
export function receiveProductData(inputData, rProductData, options = {}) {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
if (
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
insuranceData.eleOrderList.
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
299
|
+
const productData = getProductFromInputData(inputData, options)
|
|
300
|
+
if (productData) {
|
|
301
|
+
rProductData.mulInsOrderList.forEach(ins => {
|
|
302
|
+
let insuranceData = productData.mulInsOrderList.find(i => i.key === ins.key)
|
|
303
|
+
if (insuranceData) {
|
|
304
|
+
if (ins.huomian === 'shm_spouse') {
|
|
305
|
+
insuranceData.shmInsData = ins
|
|
306
|
+
} else {
|
|
307
|
+
//将返回来的险种数据,赋值到现在数据中
|
|
308
|
+
for (let k in ins) {
|
|
309
|
+
if (insuranceData.eleOrderList.some(e => e.key === k)) {
|
|
310
|
+
insuranceData.eleOrderList.forEach(e => {
|
|
311
|
+
if (ins[e.key] !== undefined) {
|
|
312
|
+
e.value = ins[e.key]
|
|
313
|
+
}
|
|
314
|
+
})
|
|
315
|
+
}
|
|
316
|
+
insuranceData[k] = ins[k]
|
|
256
317
|
}
|
|
257
318
|
}
|
|
258
319
|
}
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
let insuranceId = groupInsData.isCheckbox ? groupInsData.insuranceId[0] : groupInsData.insuranceId;
|
|
265
|
-
let checkedIns = productData.mulInsOrderList.find(i => i.key === insuranceId);
|
|
266
|
-
for (let key in checkedIns) {
|
|
267
|
-
if (!['allowSamePerson', 'code', 'eleOrderList', 'groupKey', 'groupName', 'huomian', 'key', 'name'].includes(key)) {
|
|
268
|
-
ins[key] = checkedIns[key];
|
|
269
|
-
}
|
|
320
|
+
})
|
|
321
|
+
|
|
322
|
+
productData.mulInsOrderList.forEach(ins => {
|
|
323
|
+
if (ins.isGroup) {
|
|
324
|
+
return
|
|
270
325
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
productData.companyName = rProductData.companyName;
|
|
278
|
-
|
|
279
|
-
let insShowArr = null;
|
|
280
|
-
if (rProductData.insShowArr) {
|
|
281
|
-
insShowArr = rProductData.insShowArr;
|
|
282
|
-
} else if (hasSomeCheckedIns) {
|
|
283
|
-
const hasPayModePremium = rProductData.mulInsOrderList.some(ins => 'payModePremium' in ins && (ins.payModePremium || ins.payModePremium === 0));
|
|
284
|
-
insShowArr = [['险种', '保额', '保费', '交费期', hasPayModePremium ? '期交保费' : ''].filter(Boolean)];
|
|
285
|
-
rProductData.mulInsOrderList.forEach(function(ins) {
|
|
286
|
-
if (ins.title && !ins.resultFormulaRef) {
|
|
287
|
-
const insResultItem = [
|
|
288
|
-
ins.name,
|
|
289
|
-
ins.showPlanDesc ? ins.planDesc : ins.baoeDesc || '-',
|
|
290
|
-
ins.baofDesc === 0 || ins.baofDesc === '0' || ins.baofDesc ? ins.baof : '-',
|
|
291
|
-
ins.pPeriodDesc
|
|
292
|
-
];
|
|
293
|
-
if (hasPayModePremium) {
|
|
294
|
-
insResultItem.push(ins.payModePremiumDesc || '-');
|
|
326
|
+
const groupInsData = convertEleOrderListToObj(ins)
|
|
327
|
+
const insuranceId = groupInsData.isCheckbox ? groupInsData.insuranceId[0] : groupInsData.insuranceId
|
|
328
|
+
const checkedIns = productData.mulInsOrderList.find(i => i.key === insuranceId)
|
|
329
|
+
for (const key in checkedIns) {
|
|
330
|
+
if (['allowSamePerson', 'code', 'eleOrderList', 'groupKey', 'groupName', 'huomian', 'key', 'name'].indexOf(key) === -1) {
|
|
331
|
+
ins[key] = checkedIns[key]
|
|
295
332
|
}
|
|
296
|
-
insShowArr.push(insResultItem);
|
|
297
333
|
}
|
|
298
|
-
})
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
productData.
|
|
302
|
-
|
|
303
|
-
productData.
|
|
334
|
+
})
|
|
335
|
+
|
|
336
|
+
const hasSomeCheckedIns = rProductData.mulInsOrderList.some(ins => ins.title)
|
|
337
|
+
productData.hadChoice = hasSomeCheckedIns
|
|
338
|
+
productData.totalBaof = hasSomeCheckedIns ? rProductData.totalBaof : null
|
|
339
|
+
productData.companyName = rProductData.companyName
|
|
340
|
+
|
|
341
|
+
let insShowArr = null
|
|
342
|
+
if (rProductData.insShowArr) {
|
|
343
|
+
insShowArr = rProductData.insShowArr
|
|
344
|
+
} else if (hasSomeCheckedIns) {
|
|
345
|
+
const hasPayModePremium = rProductData.mulInsOrderList.some(ins => ins.payModeDesc && ins.payModePremiumDesc)
|
|
346
|
+
insShowArr = [['投保险种', '保额', '保险期', '交费期', '首年保费', hasPayModePremium ? '期交保费' : ''].filter(Boolean)]
|
|
347
|
+
rProductData.mulInsOrderList.forEach(function(ins) {
|
|
348
|
+
if (ins.title && !ins.resultFormulaRef) {
|
|
349
|
+
const insResultItem = [
|
|
350
|
+
ins.name,
|
|
351
|
+
ins.showPlanDesc ? ins.planDesc : ins.baoeDesc || '-',
|
|
352
|
+
ins.iDurationDesc,
|
|
353
|
+
ins.pPeriodDesc,
|
|
354
|
+
ins.baofDesc === 0 || ins.baofDesc === '0' || ins.baofDesc ? ins.baofDesc : '-'
|
|
355
|
+
]
|
|
356
|
+
if (hasPayModePremium) {
|
|
357
|
+
insResultItem.push(ins.payModePremiumDesc ? `${ins.payModeDesc}${ins.payModePremiumDesc}` : '-')
|
|
358
|
+
}
|
|
359
|
+
insShowArr.push(insResultItem)
|
|
360
|
+
}
|
|
361
|
+
})
|
|
362
|
+
}
|
|
363
|
+
if (insShowArr && insShowArr.length > 1) {
|
|
364
|
+
productData.insShowArr = insShowArr
|
|
365
|
+
} else {
|
|
366
|
+
productData.insShowArr = null
|
|
367
|
+
}
|
|
304
368
|
}
|
|
305
|
-
return productData
|
|
369
|
+
return productData
|
|
306
370
|
}
|
|
307
371
|
|
|
308
|
-
export function
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
372
|
+
export function createPlanbookDataToMake(inputData = {}, options = {}) {
|
|
373
|
+
const { title, theme, categorySort, displayFormatSort, commonData, personData, productGroupList } = cloneDeep(inputData)
|
|
374
|
+
const _prodOrderList0 = _get(productGroupList, '[0].prodOrderList') || []
|
|
375
|
+
if (!_prodOrderList0.some(ele => !!ele.hadChoice && !ele.hide)) {
|
|
376
|
+
return
|
|
377
|
+
}
|
|
378
|
+
let hasMultipleInsured = false
|
|
379
|
+
const _productGroupList = productGroupList.filter(g => g.prodOrderList.some(p => p.hadChoice && !p.hide))
|
|
380
|
+
_productGroupList.forEach(g => {
|
|
381
|
+
const _prodOrderList = g.prodOrderList.filter(p => !!p.hadChoice && !p.hide)
|
|
382
|
+
_prodOrderList.forEach(p => {
|
|
383
|
+
if (p.multipleInsured) {
|
|
384
|
+
hasMultipleInsured = true
|
|
319
385
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
let hadChoiceProducts = productGroup && productGroup.prodOrderList && productGroup.prodOrderList.some(ele => !!ele.hadChoice && !ele.hide);
|
|
336
|
-
if (hadChoiceProducts) {
|
|
337
|
-
let resultData = {
|
|
338
|
-
...options,
|
|
339
|
-
companyId: inputData.companyId,
|
|
340
|
-
recordSetting: inputData.recordSetting,
|
|
341
|
-
personData: convertPersonData(inputData.personData),
|
|
342
|
-
productGroupList: [],
|
|
343
|
-
theme: inputData.theme,
|
|
344
|
-
commonData: inputData.commonData,
|
|
345
|
-
displayFormatSort: inputData.displayFormatSort,
|
|
346
|
-
categorySort: inputData.categorySort,
|
|
347
|
-
title: inputData.title || document.title,
|
|
348
|
-
videoTypeKey: planbookData.videoTypeKey
|
|
349
|
-
};
|
|
350
|
-
|
|
351
|
-
inputData.productGroupList.forEach(group => {
|
|
352
|
-
let reqProductGroup = {
|
|
353
|
-
key: group.key,
|
|
354
|
-
prodOrderList: []
|
|
355
|
-
};
|
|
356
|
-
group.prodOrderList.forEach(prod => {
|
|
357
|
-
if (!!prod.hadChoice && !prod.hide) {
|
|
358
|
-
prod.mulInsOrderList.forEach((ins, iIdx, arr) => {
|
|
359
|
-
// 结果页需要显示的数据
|
|
360
|
-
ins.eleOrderInResult = [];
|
|
361
|
-
let refInsuranceData;
|
|
362
|
-
//refInsuranceId: -1,关联主险;-2,关联险种自身
|
|
363
|
-
if (ins.refInsuranceId && ins.refInsuranceId != -2) {
|
|
364
|
-
if (ins.refInsuranceId == -1) {
|
|
365
|
-
refInsuranceData = arr[arr[0].key == 'common' ? 1 : 0];
|
|
366
|
-
} else {
|
|
367
|
-
refInsuranceData = arr.find(e => e.key === ins.refInsuranceId);
|
|
386
|
+
})
|
|
387
|
+
})
|
|
388
|
+
// 高客-险种类型逻辑:当用户选择的险种类型与后台定义的默认值一致时,服务端不要保存该值
|
|
389
|
+
// 解决方案:如果元素有 unnecessaryValue,且与元素的 value 值相同时,该元素的 value 设置为 null。该逻辑适用于所有字段
|
|
390
|
+
_productGroupList.forEach(g => {
|
|
391
|
+
const _prodOrderList = g.prodOrderList.filter(p => !!p.hadChoice && !p.hide)
|
|
392
|
+
_prodOrderList
|
|
393
|
+
.filter(p => Array.isArray(p.mulInsOrderList))
|
|
394
|
+
.forEach(p => {
|
|
395
|
+
p.mulInsOrderList
|
|
396
|
+
.filter(ins => Array.isArray(ins.eleOrderList))
|
|
397
|
+
.forEach(ins => {
|
|
398
|
+
ins.eleOrderList.forEach(e => {
|
|
399
|
+
if (e.unnecessaryValue && e.unnecessaryValue === e.value) {
|
|
400
|
+
e.value = null
|
|
368
401
|
}
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
402
|
+
})
|
|
403
|
+
})
|
|
404
|
+
})
|
|
405
|
+
})
|
|
406
|
+
personData.personOrderList = personData.personOrderList.filter(p => hasMultipleInsured || p.key !== 'insured2Info')
|
|
407
|
+
const resultData = {
|
|
408
|
+
...options,
|
|
409
|
+
title: title || document.title,
|
|
410
|
+
theme,
|
|
411
|
+
displayFormatSort,
|
|
412
|
+
categorySort,
|
|
413
|
+
commonData,
|
|
414
|
+
totalBaof: options.totalBaof || calcTotalBaof(_productGroupList),
|
|
415
|
+
personData: convertPersonData(personData),
|
|
416
|
+
productGroupList: []
|
|
417
|
+
}
|
|
418
|
+
const productKeyList = []
|
|
419
|
+
_productGroupList.forEach(group => {
|
|
420
|
+
const reqProductGroup = {
|
|
421
|
+
key: group.key,
|
|
422
|
+
prodOrderList: []
|
|
423
|
+
}
|
|
424
|
+
const _prodOrderList = group.prodOrderList.filter(p => !!p.hadChoice && !p.hide)
|
|
425
|
+
_prodOrderList.forEach(prod => {
|
|
426
|
+
prod.mulInsOrderList.forEach((ins, i, arr) => {
|
|
427
|
+
let refInsuranceData = null
|
|
428
|
+
const _refId = ins.refInsuranceId
|
|
429
|
+
//refInsuranceId: -1,关联主险;-2,关联险种自身
|
|
430
|
+
if (_refId && _refId != -2) {
|
|
431
|
+
if (_refId == -1) {
|
|
432
|
+
refInsuranceData = arr[arr[0].key == 'common' ? 1 : 0]
|
|
433
|
+
} else {
|
|
434
|
+
refInsuranceData = arr.find(e => e.key === _refId)
|
|
435
|
+
}
|
|
436
|
+
}
|
|
385
437
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
438
|
+
const eleOrderInResult = []
|
|
439
|
+
const _eleOrderList = ins.eleOrderList || []
|
|
440
|
+
const _refEleOrderList = _get(refInsuranceData, 'eleOrderList') || []
|
|
441
|
+
_eleOrderList
|
|
442
|
+
.filter(e => !['title', 'calMethod', 'customRate', 'company'].includes(e.key))
|
|
443
|
+
.forEach(e => {
|
|
444
|
+
const _refElementData = _refEleOrderList.find(e => e.key === e.key)
|
|
445
|
+
if (!e.isHide || (e.isHide && !e.isDisabled && _refElementData && !_refElementData.isHide)) {
|
|
446
|
+
eleOrderInResult.push({
|
|
447
|
+
value: e.key,
|
|
448
|
+
label: e.labelName
|
|
449
|
+
})
|
|
390
450
|
}
|
|
391
|
-
})
|
|
392
|
-
|
|
451
|
+
})
|
|
452
|
+
if ('payMode' in ins && ins.payMode) {
|
|
453
|
+
if (!eleOrderInResult.some(e => e.value === 'payModePremium')) {
|
|
454
|
+
eleOrderInResult.push({
|
|
455
|
+
value: 'payModePremium',
|
|
456
|
+
label: '期交保费'
|
|
457
|
+
})
|
|
458
|
+
}
|
|
393
459
|
}
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
460
|
+
ins.eleOrderInResult = eleOrderInResult
|
|
461
|
+
})
|
|
462
|
+
|
|
463
|
+
const productData = convertProductData(prod)
|
|
464
|
+
productData.mulInsOrderList.forEach(ins => {
|
|
465
|
+
if (ins.huomian == 'shuangHuomian' && ins.shmInsData && ins.shmInsData.title) {
|
|
466
|
+
productData.mulInsOrderList.push(ins.shmInsData)
|
|
467
|
+
}
|
|
468
|
+
})
|
|
469
|
+
reqProductGroup.prodOrderList.push(productData)
|
|
470
|
+
productKeyList.push(productData.key)
|
|
471
|
+
})
|
|
472
|
+
resultData.productGroupList.push(reqProductGroup)
|
|
473
|
+
})
|
|
474
|
+
|
|
475
|
+
const insuredInfo = resultData.personData.personOrderList.find(e => e.key === 'insuredInfo')
|
|
476
|
+
window.WeiyiStatSDK &&
|
|
477
|
+
window.WeiyiStatSDK.submit('scjhs', {
|
|
478
|
+
productList: productKeyList.join(),
|
|
479
|
+
insuredName: insuredInfo.name
|
|
480
|
+
})
|
|
481
|
+
|
|
482
|
+
return cleanNeedlessResultData(resultData)
|
|
401
483
|
}
|
|
402
484
|
|
|
403
485
|
export function getProductFromInputData(inputData, options = {}) {
|
|
404
|
-
let product = null
|
|
486
|
+
let product = null
|
|
405
487
|
if (inputData.productGroupList && inputData.productGroupList.length) {
|
|
406
|
-
let groupData = inputData.productGroupList.find(g => g.key === options.groupKey)
|
|
407
|
-
product = groupData && groupData.prodOrderList && groupData.prodOrderList.find(p => p.key === options.productKey)
|
|
488
|
+
let groupData = inputData.productGroupList.find(g => g.key === options.groupKey)
|
|
489
|
+
product = groupData && groupData.prodOrderList && groupData.prodOrderList.find(p => p.key === options.productKey)
|
|
408
490
|
}
|
|
409
|
-
return product
|
|
491
|
+
return product
|
|
410
492
|
}
|
|
411
493
|
|
|
412
|
-
export function
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
eleOrderList.forEach(ele => {
|
|
416
|
-
if (ele.key === 'title') {
|
|
417
|
-
ele.componentName = 'cmCommonTitle';
|
|
418
|
-
ele.isDisabled = false;
|
|
419
|
-
(ele.label = '封面信息'), (ele.rules = []);
|
|
420
|
-
}
|
|
421
|
-
});
|
|
422
|
-
if (!eleOrderList.find(ele => ele.key === 'shareTitle')) {
|
|
423
|
-
eleOrderList.push({
|
|
424
|
-
componentName: 'cmCommonInput',
|
|
425
|
-
key: 'shareTitle',
|
|
426
|
-
label: '计划书标题',
|
|
427
|
-
labelIcon: 'icon-common_problem',
|
|
428
|
-
maxlength: 16,
|
|
429
|
-
placeholder: '请输入计划书标题',
|
|
430
|
-
rules: [
|
|
431
|
-
{
|
|
432
|
-
type: 'string',
|
|
433
|
-
validator(rule, value, callback, source, options) {
|
|
434
|
-
if (value && value.match(/本金|利息|额度有限|回本|返本|复利|存钱|理财|返佣|赠送|免费|暴利/)) {
|
|
435
|
-
return new Error('标题不能包含禁用词');
|
|
436
|
-
}
|
|
437
|
-
return true;
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
],
|
|
441
|
-
value: ''
|
|
442
|
-
});
|
|
494
|
+
export function genProductUniqueKeyWithNS(namespace, groupKey, productKey) {
|
|
495
|
+
if (groupKey == null || productKey == null) {
|
|
496
|
+
return ''
|
|
443
497
|
}
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
componentName: 'cmCommonSelect',
|
|
447
|
-
key: 'coverId',
|
|
448
|
-
label: '封面样式',
|
|
449
|
-
placeholder: '请选择封面样式',
|
|
450
|
-
isDisabled: true,
|
|
451
|
-
options: [],
|
|
452
|
-
value: 1,
|
|
453
|
-
rules: []
|
|
454
|
-
});
|
|
455
|
-
}
|
|
456
|
-
personData.eleOrderList = eleOrderList;
|
|
498
|
+
const ns = namespace ? String(namespace) : ''
|
|
499
|
+
return ns ? `ns:${ns}:${groupKey}:${productKey}` : `${groupKey}:${productKey}`
|
|
457
500
|
}
|
|
458
501
|
|
|
459
|
-
export async function
|
|
460
|
-
const { planbookId, publicPbUuid, groupKey, productKey, isIgnoreError } = options
|
|
461
|
-
|
|
462
|
-
|
|
502
|
+
export async function calcProductData(inputData, options, cb) {
|
|
503
|
+
const { planbookId, publicPbUuid, groupKey, productKey, isIgnoreError, isIgnoreLoading, productCalcNamespace } = options || {}
|
|
504
|
+
const productUniqueKey = genProductUniqueKeyWithNS(productCalcNamespace, groupKey, productKey)
|
|
505
|
+
try {
|
|
506
|
+
const params = await createdProductDataToCalc(inputData, {
|
|
463
507
|
planbookId,
|
|
464
508
|
publicPbUuid,
|
|
465
509
|
groupKey,
|
|
466
510
|
productKey
|
|
467
|
-
})
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
511
|
+
})
|
|
512
|
+
|
|
513
|
+
if (params.errorMsg && !isIgnoreError) {
|
|
514
|
+
commitProductCalcError(productUniqueKey, params.errorMsg)
|
|
515
|
+
Toast(params.errorMsg)
|
|
516
|
+
return Promise.reject(params.errorMsg)
|
|
517
|
+
}
|
|
518
|
+
if (['annual_survey', 'compare2'].includes(URL_PARAM.pbType)) {
|
|
519
|
+
if (inputData.productGroupList) {
|
|
520
|
+
inputData.productGroupList.forEach(g => {
|
|
521
|
+
g.defNum = 0
|
|
522
|
+
g.prodOrderList.forEach(p => {
|
|
523
|
+
p.required = false
|
|
524
|
+
})
|
|
525
|
+
})
|
|
472
526
|
}
|
|
473
527
|
}
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
}
|
|
522
|
-
if (errorMessage) {
|
|
523
|
-
return Promise.reject(new Error(errorMessage));
|
|
524
|
-
}
|
|
525
|
-
}
|
|
528
|
+
let resData = null
|
|
529
|
+
if (publicPbUuid) {
|
|
530
|
+
resData = await calcPlanbookProduct({
|
|
531
|
+
jd: params.jd
|
|
532
|
+
})
|
|
533
|
+
} else {
|
|
534
|
+
resData = await calcPlanbookProduct(
|
|
535
|
+
qs.stringify({
|
|
536
|
+
jd: params.jd,
|
|
537
|
+
signature: params.signature,
|
|
538
|
+
clientVersion: params.clientVersion,
|
|
539
|
+
isIos: params.isIos
|
|
540
|
+
}),
|
|
541
|
+
{
|
|
542
|
+
isIgnoreLoading
|
|
543
|
+
}
|
|
544
|
+
).catch(err => {
|
|
545
|
+
return Promise.reject(err)
|
|
546
|
+
})
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
if (!resData.success || !resData.data) {
|
|
550
|
+
if (resData.code === '002017') {
|
|
551
|
+
window.WeiyiStatSDK && window.WeiyiStatSDK.submit('crawler_warning')
|
|
552
|
+
}
|
|
553
|
+
const calcFailMsg = resData.info || '计算请求出错'
|
|
554
|
+
commitProductCalcError(productUniqueKey, calcFailMsg)
|
|
555
|
+
Toast(calcFailMsg)
|
|
556
|
+
return
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
if (resData.data.productGroupList) {
|
|
560
|
+
const productGroupList = resData.data.productGroupList || []
|
|
561
|
+
productGroupList
|
|
562
|
+
.filter(g => g.key === groupKey)
|
|
563
|
+
.map(g =>
|
|
564
|
+
g.prodOrderList
|
|
565
|
+
.filter(p => p.key === productKey)
|
|
566
|
+
.map(p => {
|
|
567
|
+
return receiveProductData(inputData, p, {
|
|
568
|
+
planbookId,
|
|
569
|
+
groupKey: g.key,
|
|
570
|
+
productKey: p.key
|
|
571
|
+
})
|
|
572
|
+
})
|
|
573
|
+
)
|
|
574
|
+
}
|
|
526
575
|
|
|
527
|
-
|
|
576
|
+
if (Array.isArray(inputData.productGroupList)) {
|
|
577
|
+
const productList = inputData.productGroupList
|
|
578
|
+
.map(g => g.prodOrderList)
|
|
579
|
+
.flat()
|
|
580
|
+
.filter(Boolean)
|
|
581
|
+
const currentProduct = productList.find(p => p.key === productKey)
|
|
582
|
+
|
|
583
|
+
if (currentProduct) {
|
|
584
|
+
clearAddAndTakeAndAdjustBaoeData(currentProduct)
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
// 计算结果校验
|
|
588
|
+
const mulInsOrderList = _get(currentProduct, 'mulInsOrderList') || []
|
|
589
|
+
const hasCalcResultExp = mulInsOrderList.some(ins => ins.calcResultExp)
|
|
590
|
+
if (hasCalcResultExp) {
|
|
591
|
+
let errorMessage = ''
|
|
592
|
+
mulInsOrderList
|
|
593
|
+
.filter(ins => ins.calcResultExp)
|
|
594
|
+
.forEach(ins => {
|
|
595
|
+
if (!errorMessage) {
|
|
596
|
+
const paramMap = getExpressionParamMap(inputData.personData, currentProduct, ins, options)
|
|
597
|
+
if (paramMap) {
|
|
598
|
+
try {
|
|
599
|
+
const exp = ins.calcResultExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2')
|
|
600
|
+
errorMessage = eval(exp)
|
|
601
|
+
console.log('计算结果约束结果: ', errorMessage)
|
|
602
|
+
} catch (error) {
|
|
603
|
+
errorMessage = '校验公式语法错误!'
|
|
604
|
+
}
|
|
605
|
+
if (ins.calcResultExp) {
|
|
606
|
+
console.log('计算结果约束公式: ', ins.calcResultExp)
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
})
|
|
611
|
+
if (errorMessage) {
|
|
612
|
+
commitProductCalcError(productUniqueKey, errorMessage)
|
|
613
|
+
return Promise.reject({
|
|
614
|
+
type: 'calcResultError',
|
|
615
|
+
message: errorMessage
|
|
616
|
+
})
|
|
528
617
|
}
|
|
529
|
-
|
|
530
|
-
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
cb && cb()
|
|
622
|
+
commitProductCalcError(productUniqueKey, null)
|
|
623
|
+
return Promise.resolve(resData)
|
|
624
|
+
} catch (err) {
|
|
625
|
+
const errMsg = typeof err === 'string' ? err : _get(err, 'message') || _get(err, 'info') || '计算请求出错'
|
|
626
|
+
if (!(_get(err, 'type') === 'calcResultError')) {
|
|
627
|
+
commitProductCalcError(productUniqueKey, errMsg)
|
|
628
|
+
}
|
|
629
|
+
if (typeof err === 'string') {
|
|
630
|
+
Toast(err)
|
|
631
|
+
}
|
|
632
|
+
return Promise.reject(err)
|
|
531
633
|
}
|
|
532
|
-
return Promise.reject();
|
|
533
634
|
}
|
|
534
635
|
|
|
535
636
|
export async function doubleCalcProductData(inputData, verifyData, options = {}) {
|
|
536
|
-
const { planbookId, publicPbUuid, groupKey, productKey, isIgnoreError,
|
|
537
|
-
const personData = inputData && inputData.personData
|
|
538
|
-
const productGroupList = inputData && inputData.productGroupList ? inputData.productGroupList : []
|
|
539
|
-
const productGroup = productGroupList.find(g => g.key === groupKey)
|
|
540
|
-
const prodOrderList = productGroup && productGroup.prodOrderList ? productGroup.prodOrderList : []
|
|
541
|
-
const productData = prodOrderList.find(p => p.key === productKey)
|
|
542
|
-
const mulInsOrderList = productData && productData.mulInsOrderList ? productData.mulInsOrderList : []
|
|
543
|
-
const productVerifyData = verifyData && verifyData[productKey]
|
|
544
|
-
const hasRevalidateFlag = mulInsOrderList.some(ins => ins.revalidateFlag)
|
|
637
|
+
const { user, planbookId, publicPbUuid, groupKey, productKey, isIgnoreError, productCalcNamespace, executeSource } = options
|
|
638
|
+
const personData = inputData && inputData.personData
|
|
639
|
+
const productGroupList = inputData && inputData.productGroupList ? inputData.productGroupList : []
|
|
640
|
+
const productGroup = productGroupList.find(g => g.key === groupKey)
|
|
641
|
+
const prodOrderList = productGroup && productGroup.prodOrderList ? productGroup.prodOrderList : []
|
|
642
|
+
const productData = prodOrderList.find(p => p.key === productKey)
|
|
643
|
+
const mulInsOrderList = productData && productData.mulInsOrderList ? productData.mulInsOrderList : []
|
|
644
|
+
const productVerifyData = verifyData && verifyData[productKey]
|
|
645
|
+
const hasRevalidateFlag = mulInsOrderList.some(ins => ins.revalidateFlag)
|
|
545
646
|
if (productData) {
|
|
647
|
+
if (productData.multipleInsured) {
|
|
648
|
+
multipleInsuredHandler(productData, personData)
|
|
649
|
+
}
|
|
546
650
|
await productDataHandler(productData, productVerifyData, personData, {
|
|
651
|
+
user,
|
|
547
652
|
planbookId,
|
|
548
|
-
|
|
549
|
-
})
|
|
550
|
-
await
|
|
653
|
+
executeSource
|
|
654
|
+
})
|
|
655
|
+
await calcProductData(inputData, {
|
|
656
|
+
user,
|
|
551
657
|
planbookId,
|
|
552
658
|
publicPbUuid,
|
|
553
659
|
groupKey,
|
|
554
660
|
productKey,
|
|
555
|
-
|
|
556
|
-
|
|
661
|
+
executeSource,
|
|
662
|
+
isIgnoreError,
|
|
663
|
+
productCalcNamespace
|
|
664
|
+
})
|
|
557
665
|
if (hasRevalidateFlag) {
|
|
558
666
|
await productDataHandler(productData, productVerifyData, personData, {
|
|
667
|
+
user,
|
|
559
668
|
planbookId,
|
|
560
|
-
|
|
561
|
-
})
|
|
562
|
-
await
|
|
669
|
+
executeSource
|
|
670
|
+
})
|
|
671
|
+
await calcProductData(inputData, {
|
|
672
|
+
user,
|
|
563
673
|
planbookId,
|
|
564
674
|
publicPbUuid,
|
|
565
675
|
groupKey,
|
|
566
676
|
productKey,
|
|
567
|
-
|
|
568
|
-
|
|
677
|
+
executeSource,
|
|
678
|
+
isIgnoreError,
|
|
679
|
+
productCalcNamespace
|
|
680
|
+
})
|
|
569
681
|
}
|
|
570
682
|
}
|
|
571
683
|
}
|
|
572
684
|
|
|
573
|
-
export function
|
|
574
|
-
const
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
.
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
.
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
685
|
+
export function calcAllProductData(inputData, verifyData, options) {
|
|
686
|
+
const { planbookId, publicPbUuid, userUuid, appid, productCalcNamespace, executeSource } = options
|
|
687
|
+
const productGroupList = (_get(inputData, 'productGroupList') || []).filter(g => g.prodOrderList)
|
|
688
|
+
const prodOrderList = productGroupList
|
|
689
|
+
.map(g => g.prodOrderList)
|
|
690
|
+
.flat()
|
|
691
|
+
.filter(p => p.hadChoice)
|
|
692
|
+
if (prodOrderList.length) {
|
|
693
|
+
let allProductCalcCount = options.allProductCalcCount != null ? options.allProductCalcCount : 0
|
|
694
|
+
const calcStore = getProductCalcVuexStore()
|
|
695
|
+
if (calcStore && calcStore._mutations && calcStore._mutations.CLEAR_PRODUCT_CALC_ERROR_MAP) {
|
|
696
|
+
calcStore.commit('CLEAR_PRODUCT_CALC_ERROR_MAP', productCalcNamespace)
|
|
697
|
+
}
|
|
698
|
+
const promises = productGroupList
|
|
699
|
+
.map(g => {
|
|
700
|
+
return g.prodOrderList
|
|
701
|
+
.filter(p => p.hadChoice)
|
|
702
|
+
.filter(p => !['single_insurance', 'noconfig_insurance', 'manual_insurance'].includes(p.policyType))
|
|
703
|
+
.map(p => {
|
|
704
|
+
if (p.policyType === 'online_trade') {
|
|
705
|
+
return
|
|
706
|
+
}
|
|
707
|
+
return doubleCalcProductData(inputData, verifyData, {
|
|
708
|
+
planbookId,
|
|
709
|
+
executeSource,
|
|
710
|
+
publicPbUuid,
|
|
711
|
+
groupKey: g.key,
|
|
712
|
+
productKey: p.key,
|
|
713
|
+
isIgnoreError: true,
|
|
714
|
+
isIgnoreLoading: true,
|
|
715
|
+
productCalcNamespace
|
|
716
|
+
})
|
|
717
|
+
})
|
|
718
|
+
})
|
|
719
|
+
.flat()
|
|
720
|
+
|
|
721
|
+
window.appBridge.showLoading()
|
|
722
|
+
return Promise.all(promises)
|
|
723
|
+
.then(res => {
|
|
724
|
+
Dialog.close()
|
|
725
|
+
return res
|
|
726
|
+
})
|
|
727
|
+
.catch(err => {
|
|
728
|
+
const errorType = err && err.type
|
|
729
|
+
const errorMessage = typeof err === 'string' ? err : _get(err, 'message') || '未知错误'
|
|
730
|
+
const isVerifyError = errorMessage === '请选择险种'
|
|
731
|
+
const isRestrictError = ['002012', '002013', '002015'].includes(_get(err, 'code'))
|
|
732
|
+
const isNeedConfirm = !(isVerifyError || isRestrictError || ['calcResultError'].includes(errorType))
|
|
733
|
+
if (isNeedConfirm) {
|
|
734
|
+
allProductCalcCount += 1
|
|
735
|
+
Dialog.confirm({
|
|
736
|
+
title: '保费计算超时',
|
|
737
|
+
message: allProductCalcCount > 1 ? '建议检查网络或点击反馈问题。' : '当前网络不稳定,导致保费计算失败。为避免保费不准确,请检查网络后重试。',
|
|
738
|
+
cancelButtonText: '退出',
|
|
739
|
+
confirmButtonText: allProductCalcCount > 1 ? '反馈问题' : '重试'
|
|
740
|
+
})
|
|
741
|
+
.then(() => {
|
|
742
|
+
window.WeiyiStatSDK && window.WeiyiStatSDK.submit(allProductCalcCount > 1 ? 'JHS_JSCW_FK' : 'JHS_JSCW_CS')
|
|
743
|
+
if (allProductCalcCount > 1) {
|
|
744
|
+
location.href = `https://pbf.winbaoxian.cn/planBook/projectGroup/feedback/index.html?type=0&planbookId=${planbookId}&tagId=3`
|
|
745
|
+
} else {
|
|
746
|
+
calcAllProductData(inputData, verifyData, {
|
|
747
|
+
...options,
|
|
748
|
+
allProductCalcCount
|
|
749
|
+
})
|
|
750
|
+
}
|
|
751
|
+
})
|
|
752
|
+
.catch(() => {
|
|
753
|
+
goBack()
|
|
754
|
+
})
|
|
755
|
+
} else if (['calcResultError'].includes(errorType) && errorMessage) {
|
|
756
|
+
Toast(errorMessage)
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
window.WeiyiStatSDK &&
|
|
760
|
+
window.WeiyiStatSDK.submit('JHS_JSCW', {
|
|
761
|
+
localUuid: localStorage.getItem('intellectScheme') ? JSON.parse(localStorage.getItem('intellectScheme'))[`s${planbookId}`] : null,
|
|
762
|
+
productIds: prodOrderList.map(p => p.key).join(','),
|
|
763
|
+
errorMessage
|
|
764
|
+
})
|
|
765
|
+
return Promise.reject(err)
|
|
766
|
+
})
|
|
767
|
+
.finally(() => {
|
|
768
|
+
window.appBridge.hideLoading()
|
|
769
|
+
})
|
|
770
|
+
}
|
|
771
|
+
return Promise.reject('请选择投保产品')
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
export async function makePlanbook(inputData, options = {}) {
|
|
775
|
+
if (!inputData) {
|
|
776
|
+
return Promise.reject()
|
|
777
|
+
}
|
|
778
|
+
const { pbType, userUuid, insuranceTypeId, videoTypeKey } = options
|
|
779
|
+
const reqData = createPlanbookDataToMake(inputData, {
|
|
780
|
+
pbType: pbType || '',
|
|
781
|
+
userUuid,
|
|
782
|
+
insuranceTypeId,
|
|
783
|
+
videoTypeKey
|
|
784
|
+
})
|
|
785
|
+
if (!reqData) {
|
|
786
|
+
Toast('请选择险种')
|
|
787
|
+
return Promise.reject()
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
const reqDataStr = JSON.stringify(reqData)
|
|
791
|
+
const groupDataKey = _get(inputData, 'productGroupList[0].key')
|
|
792
|
+
const signature = await getSecurityToken(reqDataStr, {
|
|
793
|
+
groupDataKey
|
|
794
|
+
})
|
|
795
|
+
return uploadPlanBookResult(
|
|
796
|
+
qs.stringify({
|
|
797
|
+
jd: JSON.stringify(reqData),
|
|
798
|
+
userUuid,
|
|
799
|
+
signature,
|
|
800
|
+
clientVersion: appVersion,
|
|
801
|
+
isIos
|
|
598
802
|
})
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
803
|
+
).then(({ success, data, info }) => {
|
|
804
|
+
if (!success || !data) {
|
|
805
|
+
Toast(info || '生成计划书失败')
|
|
806
|
+
return Promise.reject()
|
|
807
|
+
}
|
|
808
|
+
return Promise.resolve(data)
|
|
809
|
+
})
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
export function convertInputDataToResultData(inputData, options = {}) {
|
|
813
|
+
let resultData = null
|
|
814
|
+
if (inputData) {
|
|
815
|
+
const { title, theme, categorySort, displayFormatSort, commonData, personData, productGroupList, addedServiceList = [] } = cloneDeep(inputData)
|
|
816
|
+
const { insuranceTypeId, pbType, planName, userUuid } = options
|
|
817
|
+
resultData = {
|
|
818
|
+
insuranceTypeId,
|
|
819
|
+
pbType,
|
|
820
|
+
planName,
|
|
821
|
+
userUuid,
|
|
822
|
+
title: title || document.title,
|
|
823
|
+
theme,
|
|
824
|
+
displayFormatSort,
|
|
825
|
+
categorySort,
|
|
826
|
+
addedServiceList,
|
|
827
|
+
commonData,
|
|
828
|
+
personData: convertPersonData(personData),
|
|
829
|
+
productGroupList: [],
|
|
830
|
+
totalBaof: null
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
const _productGroupList = productGroupList.filter(g => (g.prodOrderList || []).some(p => p.hadChoice && !p.hide))
|
|
834
|
+
if (_productGroupList.length) {
|
|
835
|
+
_productGroupList.forEach(g => {
|
|
836
|
+
g.prodOrderList = g.prodOrderList.filter(p => p.hadChoice && !p.hide)
|
|
837
|
+
})
|
|
838
|
+
|
|
839
|
+
_productGroupList.forEach(group => {
|
|
840
|
+
const _productGroup = {
|
|
841
|
+
key: group.key,
|
|
842
|
+
prodOrderList: []
|
|
843
|
+
}
|
|
844
|
+
group.prodOrderList.forEach(prod => {
|
|
845
|
+
const mainInsurance = prod.mulInsOrderList.find(ins => ins.key !== 'common')
|
|
846
|
+
prod.mulInsOrderList.forEach((ins, i, arr) => {
|
|
847
|
+
if (Array.isArray(ins.eleOrderList)) {
|
|
848
|
+
// 用于结果页控制字段显示顺序
|
|
849
|
+
const eleOrderInResult = []
|
|
850
|
+
// refInsuranceId: -1-主险 -2-险种自身
|
|
851
|
+
const _refId = Number(ins.refInsuranceId)
|
|
852
|
+
let refInsuranceData = null
|
|
853
|
+
if (_refId && _refId !== -2) {
|
|
854
|
+
refInsuranceData = _refId === -1 ? mainInsurance : arr.find(e => e.key === _refId)
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
const _refEleOrderList = _get(refInsuranceData, 'eleOrderList') || []
|
|
858
|
+
ins.eleOrderList
|
|
859
|
+
.filter(e => !['title', 'calMethod', 'customRate', 'company'].includes(e.key))
|
|
860
|
+
.forEach(e => {
|
|
861
|
+
const _refElementData = _refEleOrderList.find(e => e.key === e.key)
|
|
862
|
+
if (!e.isHide || (e.isHide && !e.isDisabled && _refElementData && !_refElementData.isHide)) {
|
|
863
|
+
eleOrderInResult.push({
|
|
864
|
+
value: e.key,
|
|
865
|
+
label: e.labelName
|
|
866
|
+
})
|
|
621
867
|
}
|
|
622
|
-
})
|
|
868
|
+
})
|
|
869
|
+
if ('payMode' in ins && ins.payMode) {
|
|
870
|
+
if (!eleOrderInResult.some(e => e.value === 'payModePremium')) {
|
|
871
|
+
eleOrderInResult.push({
|
|
872
|
+
value: 'payModePremium',
|
|
873
|
+
label: '期交保费'
|
|
874
|
+
})
|
|
875
|
+
}
|
|
623
876
|
}
|
|
877
|
+
ins.eleOrderInResult = eleOrderInResult
|
|
624
878
|
}
|
|
625
|
-
})
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
879
|
+
})
|
|
880
|
+
|
|
881
|
+
const productData = convertProductData(prod)
|
|
882
|
+
// 双豁免险种处理
|
|
883
|
+
productData.mulInsOrderList.forEach(ins => {
|
|
884
|
+
const { huomian, shmInsData } = ins
|
|
885
|
+
if (huomian === 'shuangHuomian' && shmInsData && shmInsData.title) {
|
|
886
|
+
productData.mulInsOrderList.push(shmInsData)
|
|
887
|
+
}
|
|
888
|
+
})
|
|
889
|
+
_productGroup.prodOrderList.push(productData)
|
|
890
|
+
})
|
|
891
|
+
resultData.productGroupList.push(_productGroup)
|
|
892
|
+
})
|
|
893
|
+
resultData.totalBaof = calcTotalBaof(_productGroupList)
|
|
894
|
+
}
|
|
629
895
|
}
|
|
896
|
+
return resultData
|
|
897
|
+
}
|
|
630
898
|
|
|
631
|
-
|
|
899
|
+
export function cleanNeedlessResultData(resultData) {
|
|
900
|
+
const pureResultData = cloneDeep(resultData)
|
|
901
|
+
if (pureResultData) {
|
|
902
|
+
const productGroupList = _get(pureResultData, 'productGroupList') || []
|
|
903
|
+
productGroupList
|
|
904
|
+
.filter(g => g.prodOrderList)
|
|
905
|
+
.forEach(g => {
|
|
906
|
+
g.prodOrderList.forEach(p => {
|
|
907
|
+
const noNeedProductKeys = ['constraintRules', 'inputResultSwitch', 'insShowArr', 'isShowDeleteButton', 'restrictList']
|
|
908
|
+
noNeedProductKeys.forEach(k => {
|
|
909
|
+
if (k in p) {
|
|
910
|
+
delete p[k]
|
|
911
|
+
}
|
|
912
|
+
})
|
|
913
|
+
if (Array.isArray(p.mulInsOrderList)) {
|
|
914
|
+
p.mulInsOrderList.forEach(ins => {
|
|
915
|
+
const noNeedInsuranceKeys = ['isFollowing', 'isCheckbox', 'condotionList', 'customVariableExp', 'calcResultExp', 'revalidateFlag']
|
|
916
|
+
noNeedInsuranceKeys.forEach(k => {
|
|
917
|
+
if (k in ins) {
|
|
918
|
+
delete ins[k]
|
|
919
|
+
}
|
|
920
|
+
})
|
|
921
|
+
})
|
|
922
|
+
}
|
|
923
|
+
})
|
|
924
|
+
})
|
|
925
|
+
}
|
|
926
|
+
return pureResultData
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
// 获取产品险种标签;入参过滤与 findInsuranceTag().catch 与 compare3 fetchInsuranceSaleStatusMap 一致
|
|
930
|
+
export async function getProductInsuranceTags(inputData, options = {}, key = 'salesStatus') {
|
|
931
|
+
const product = getProductFromInputData(inputData, options)
|
|
932
|
+
const mulInsOrderList = (_get(product, 'mulInsOrderList') || []).filter(ins => !ins.isGroup)
|
|
933
|
+
|
|
934
|
+
if (!mulInsOrderList.length) {
|
|
935
|
+
return {}
|
|
936
|
+
}
|
|
937
|
+
const insuranceKeys = mulInsOrderList.map(ins => ins.key)
|
|
938
|
+
const keys = insuranceKeys.filter(k => {
|
|
939
|
+
if (k == null) return false
|
|
940
|
+
if (typeof k === 'number') return Number.isFinite(k)
|
|
941
|
+
if (typeof k === 'string') {
|
|
942
|
+
const t = k.trim()
|
|
943
|
+
if (t === '') return false
|
|
944
|
+
return Number.isFinite(Number(t))
|
|
945
|
+
}
|
|
946
|
+
return false
|
|
947
|
+
})
|
|
948
|
+
if (!keys.length) {
|
|
949
|
+
return {}
|
|
950
|
+
}
|
|
951
|
+
const res = await findInsuranceTag(keys).catch(() => {})
|
|
952
|
+
const list = _get(res, 'data') || []
|
|
953
|
+
const byInsuranceId = new Map()
|
|
954
|
+
list.forEach(item => {
|
|
955
|
+
if (item && item.insuranceId != null) {
|
|
956
|
+
byInsuranceId.set(String(item.insuranceId), item)
|
|
957
|
+
}
|
|
958
|
+
})
|
|
959
|
+
const tagMap = {}
|
|
960
|
+
mulInsOrderList.forEach(ins => {
|
|
961
|
+
const row = byInsuranceId.get(String(ins.key))
|
|
962
|
+
if (row && Object.prototype.hasOwnProperty.call(row, key)) {
|
|
963
|
+
tagMap[ins.key] = row[key]
|
|
964
|
+
}
|
|
965
|
+
})
|
|
966
|
+
return tagMap
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
export async function setupUnderwriteRuleToInputData(data) {
|
|
970
|
+
const inputData = cloneDeep(data)
|
|
971
|
+
if (inputData) {
|
|
972
|
+
const insuranceList = (_get(inputData, 'productGroupList') || [])
|
|
973
|
+
.map(g => g.prodOrderList)
|
|
974
|
+
.flat()
|
|
975
|
+
.map(p => p && p.mulInsOrderList)
|
|
976
|
+
.flat()
|
|
977
|
+
.filter(ins => ins && !['common'].includes(ins.key))
|
|
978
|
+
await setupUnderwriteRuleToInsuranceList(insuranceList).catch(() => {})
|
|
979
|
+
}
|
|
980
|
+
return inputData
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
export function setupUnderwriteRuleToInsuranceList(list) {
|
|
984
|
+
if (Array.isArray(list)) {
|
|
985
|
+
const insuranceIds = list.map(ins => ins.key)
|
|
986
|
+
return getUnderwriteEffectiveRules(insuranceIds).then(data => {
|
|
987
|
+
if (Array.isArray(data)) {
|
|
988
|
+
data.forEach(rule => {
|
|
989
|
+
const { insruanceId, eleRules } = rule
|
|
990
|
+
const insurance = list.find(ins => ins.key === insruanceId)
|
|
991
|
+
if (insurance) {
|
|
992
|
+
const insExpKeys = ['customVariableExp', 'calcResultExp', 'revalidateFlag']
|
|
993
|
+
insExpKeys
|
|
994
|
+
.filter(k => k in rule)
|
|
995
|
+
.forEach(key => {
|
|
996
|
+
insurance[key] = rule[key]
|
|
997
|
+
})
|
|
998
|
+
const eleOrderList = insurance.eleOrderList || []
|
|
999
|
+
if (eleOrderList && Array.isArray(eleRules)) {
|
|
1000
|
+
eleOrderList.forEach(ele => {
|
|
1001
|
+
const eleRule = eleRules.find(e => e.elementKey === ele.key)
|
|
1002
|
+
if (eleRule) {
|
|
1003
|
+
const eleExpkeys = ['defaultValueExp', 'maxExp', 'minExp', 'multiExp', 'underwriteExp']
|
|
1004
|
+
eleExpkeys
|
|
1005
|
+
.filter(k => k in eleRule)
|
|
1006
|
+
.forEach(key => {
|
|
1007
|
+
ele[key] = eleRule[key]
|
|
1008
|
+
})
|
|
1009
|
+
}
|
|
1010
|
+
})
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
})
|
|
1014
|
+
return list
|
|
1015
|
+
}
|
|
1016
|
+
})
|
|
1017
|
+
}
|
|
1018
|
+
return list
|
|
632
1019
|
}
|