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
|
@@ -181,19 +181,19 @@
|
|
|
181
181
|
</div>
|
|
182
182
|
</template>
|
|
183
183
|
<script lang="ts">
|
|
184
|
-
import { Component, Prop, Vue } from 'vue-property-decorator'
|
|
185
|
-
import { Toast } from 'vant'
|
|
186
|
-
import { get as _get } from 'lodash'
|
|
187
|
-
import { parseTime } from '
|
|
188
|
-
import {
|
|
189
|
-
import 'bxs-ui-vue/lib/index.css'
|
|
190
|
-
import { ProfessionList } from 'bxs-ui-vue'
|
|
191
|
-
import 'bxs-ui-vue/esm/profession-list/index.css'
|
|
184
|
+
import { Component, Prop, Vue } from 'vue-property-decorator'
|
|
185
|
+
import { Toast } from 'vant'
|
|
186
|
+
import { get as _get } from 'lodash'
|
|
187
|
+
import { parseTime } from '../../src/js/utils.js'
|
|
188
|
+
import { getCommonCurrentUser, getAddress } from '../../src/api'
|
|
189
|
+
import 'bxs-ui-vue/lib/index.css'
|
|
190
|
+
import { ProfessionList } from 'bxs-ui-vue'
|
|
191
|
+
import 'bxs-ui-vue/esm/profession-list/index.css'
|
|
192
192
|
|
|
193
|
-
import { insureCalculate, hasPlanParams
|
|
194
|
-
import './index.
|
|
193
|
+
import { insureCalculate, hasPlanParams } from 'packages/bxs-utils/index'
|
|
194
|
+
import './index.less'
|
|
195
195
|
|
|
196
|
-
Vue.use(Toast)
|
|
196
|
+
Vue.use(Toast)
|
|
197
197
|
const defaultCalculateData: any = {
|
|
198
198
|
widgets: [],
|
|
199
199
|
current_data: [],
|
|
@@ -201,7 +201,7 @@ const defaultCalculateData: any = {
|
|
|
201
201
|
calculateData: {},
|
|
202
202
|
product_id: '',
|
|
203
203
|
risk_premiums: []
|
|
204
|
-
}
|
|
204
|
+
}
|
|
205
205
|
|
|
206
206
|
const defaultPlanParams: any = {
|
|
207
207
|
// 被保人生日 被保人年龄
|
|
@@ -214,7 +214,7 @@ const defaultPlanParams: any = {
|
|
|
214
214
|
detail_applicant_age: '',
|
|
215
215
|
// 投保人性别
|
|
216
216
|
detail_applicant_sex: ''
|
|
217
|
-
}
|
|
217
|
+
}
|
|
218
218
|
|
|
219
219
|
function initPickerConfig() {
|
|
220
220
|
return {
|
|
@@ -223,7 +223,7 @@ function initPickerConfig() {
|
|
|
223
223
|
columns: [],
|
|
224
224
|
defaultIndex: null,
|
|
225
225
|
item: null
|
|
226
|
-
}
|
|
226
|
+
}
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
function initDatePickerConfig() {
|
|
@@ -234,7 +234,7 @@ function initDatePickerConfig() {
|
|
|
234
234
|
minDate: null,
|
|
235
235
|
maxDate: null,
|
|
236
236
|
item: null
|
|
237
|
-
}
|
|
237
|
+
}
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
@Component({
|
|
@@ -244,180 +244,177 @@ function initDatePickerConfig() {
|
|
|
244
244
|
})
|
|
245
245
|
export default class InsureCalculate extends Vue {
|
|
246
246
|
get terms() {
|
|
247
|
-
return this.originData.terms
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
isShowProfession = false;
|
|
256
|
-
isDevelop: boolean = true;
|
|
257
|
-
asyncColumnsParams: any = null;
|
|
247
|
+
return this.originData.terms
|
|
248
|
+
}
|
|
249
|
+
widgets: any = []
|
|
250
|
+
originData: any = {}
|
|
251
|
+
hasCalculateData: boolean = false // 是否从父组件获取的参数
|
|
252
|
+
isShowProfession = false
|
|
253
|
+
isDevelop: boolean = true
|
|
254
|
+
asyncColumnsParams: any = null
|
|
258
255
|
areaData: any = {
|
|
259
256
|
province_list: [],
|
|
260
257
|
city_list: [],
|
|
261
258
|
county_list: []
|
|
262
|
-
}
|
|
263
|
-
isShowArea: boolean = false
|
|
264
|
-
returnClassify: any = []
|
|
265
|
-
currentAddress: any = undefined
|
|
266
|
-
hasInit: boolean = false
|
|
267
|
-
uuidFromApi: string = ''
|
|
268
|
-
defaultArea: string = ''
|
|
269
|
-
list: any = []
|
|
270
|
-
pickerConfig: any = initPickerConfig()
|
|
271
|
-
datePickerConfig: any = initDatePickerConfig()
|
|
259
|
+
}
|
|
260
|
+
isShowArea: boolean = false
|
|
261
|
+
returnClassify: any = []
|
|
262
|
+
currentAddress: any = undefined
|
|
263
|
+
hasInit: boolean = false
|
|
264
|
+
uuidFromApi: string = ''
|
|
265
|
+
defaultArea: string = ''
|
|
266
|
+
list: any = []
|
|
267
|
+
pickerConfig: any = initPickerConfig()
|
|
268
|
+
datePickerConfig: any = initDatePickerConfig()
|
|
272
269
|
|
|
273
270
|
// 是否展示浮层顶部栏
|
|
274
271
|
@Prop({
|
|
275
272
|
default: false
|
|
276
273
|
})
|
|
277
|
-
showHeader: boolean
|
|
274
|
+
showHeader: boolean
|
|
278
275
|
|
|
279
276
|
// 是否展示浮层底部按钮
|
|
280
277
|
@Prop({
|
|
281
278
|
default: false
|
|
282
279
|
})
|
|
283
|
-
showFooter: boolean
|
|
280
|
+
showFooter: boolean
|
|
284
281
|
|
|
285
282
|
// 顶部栏标题
|
|
286
283
|
@Prop({
|
|
287
284
|
default: ''
|
|
288
285
|
})
|
|
289
|
-
title: string
|
|
286
|
+
title: string
|
|
290
287
|
|
|
291
288
|
// 父组件获取数据
|
|
292
289
|
@Prop({
|
|
293
290
|
default: () => defaultCalculateData
|
|
294
291
|
})
|
|
295
|
-
calculateData: any
|
|
292
|
+
calculateData: any
|
|
296
293
|
|
|
297
294
|
// 是否本地缓存
|
|
298
295
|
@Prop({
|
|
299
296
|
default: 10
|
|
300
297
|
})
|
|
301
|
-
lsTime: number
|
|
298
|
+
lsTime: number
|
|
302
299
|
|
|
303
300
|
// 产品ID
|
|
304
301
|
@Prop({
|
|
305
302
|
default: undefined
|
|
306
303
|
})
|
|
307
|
-
productId: number | string
|
|
304
|
+
productId: number | string
|
|
308
305
|
|
|
309
306
|
// 当前用户userUuid
|
|
310
307
|
@Prop({
|
|
311
308
|
default: undefined
|
|
312
309
|
})
|
|
313
|
-
uuid: string
|
|
310
|
+
uuid: string
|
|
314
311
|
|
|
315
312
|
// 当前环境
|
|
316
313
|
@Prop({
|
|
317
314
|
default: undefined
|
|
318
315
|
})
|
|
319
|
-
isDev: boolean | undefined
|
|
316
|
+
isDev: boolean | undefined
|
|
320
317
|
|
|
321
318
|
// 计划书给的默认参数
|
|
322
319
|
@Prop({
|
|
323
320
|
default: () => defaultPlanParams
|
|
324
321
|
})
|
|
325
|
-
planParams: any
|
|
322
|
+
planParams: any
|
|
326
323
|
|
|
327
324
|
// 是否展示试算责任 默认 false
|
|
328
325
|
@Prop({
|
|
329
326
|
default: false
|
|
330
327
|
})
|
|
331
|
-
isShowDuty: boolean
|
|
328
|
+
isShowDuty: boolean
|
|
332
329
|
|
|
333
330
|
// tob环境参数:appid 用户判断是否tob
|
|
334
331
|
@Prop({
|
|
335
332
|
default: ''
|
|
336
333
|
})
|
|
337
|
-
appid: string
|
|
334
|
+
appid: string
|
|
338
335
|
|
|
339
336
|
// tob环境参数:openId
|
|
340
337
|
@Prop({
|
|
341
338
|
default: ''
|
|
342
339
|
})
|
|
343
|
-
openId: string
|
|
340
|
+
openId: string
|
|
344
341
|
|
|
345
342
|
async created() {
|
|
346
|
-
const vm = this
|
|
347
|
-
vm.setIsDevelop()
|
|
343
|
+
const vm = this
|
|
344
|
+
vm.setIsDevelop()
|
|
348
345
|
if (!vm.uuid) {
|
|
349
346
|
try {
|
|
350
|
-
const userInfo = await
|
|
347
|
+
const userInfo = await getCommonCurrentUser()
|
|
351
348
|
if (userInfo && userInfo.data && userInfo.data.uuid) {
|
|
352
|
-
vm.uuidFromApi = userInfo.data.uuid
|
|
349
|
+
vm.uuidFromApi = userInfo.data.uuid
|
|
353
350
|
} else {
|
|
354
|
-
Toast(userInfo && userInfo.info ? userInfo.info : '')
|
|
351
|
+
Toast(userInfo && userInfo.info ? userInfo.info : '')
|
|
355
352
|
}
|
|
356
353
|
} catch (error) {
|
|
357
|
-
Toast(error && error.info ? error.info : '用户信息获取失败')
|
|
354
|
+
Toast(error && error.info ? error.info : '用户信息获取失败')
|
|
358
355
|
}
|
|
359
356
|
}
|
|
360
|
-
vm.init()
|
|
357
|
+
vm.init()
|
|
361
358
|
}
|
|
362
359
|
init() {
|
|
363
360
|
const urlParamsProfess = {
|
|
364
361
|
userUuid: this.getU()
|
|
365
|
-
}
|
|
362
|
+
}
|
|
366
363
|
const postParamsProfess = {
|
|
367
364
|
productId: this.productId
|
|
368
|
-
}
|
|
365
|
+
}
|
|
369
366
|
// 职业数据配置
|
|
370
|
-
this.asyncColumnsParams = {}
|
|
371
|
-
this.$set(this.asyncColumnsParams, 'urlParams', urlParamsProfess)
|
|
372
|
-
this.$set(this.asyncColumnsParams, 'postParams', postParamsProfess)
|
|
373
|
-
this.$set(this.asyncColumnsParams, 'isDev', this.isDevelop)
|
|
374
|
-
let originData
|
|
375
|
-
this.hasCalculateData = !!(this.calculateData && this.calculateData.current_data && this.calculateData.current_data.length)
|
|
367
|
+
this.asyncColumnsParams = {}
|
|
368
|
+
this.$set(this.asyncColumnsParams, 'urlParams', urlParamsProfess)
|
|
369
|
+
this.$set(this.asyncColumnsParams, 'postParams', postParamsProfess)
|
|
370
|
+
this.$set(this.asyncColumnsParams, 'isDev', this.isDevelop)
|
|
371
|
+
let originData
|
|
372
|
+
this.hasCalculateData = !!(this.calculateData && this.calculateData.current_data && this.calculateData.current_data.length)
|
|
376
373
|
if (this.hasCalculateData) {
|
|
377
|
-
originData = JSON.parse(JSON.stringify(this.calculateData))
|
|
374
|
+
originData = JSON.parse(JSON.stringify(this.calculateData))
|
|
378
375
|
}
|
|
379
376
|
// 初始化试算
|
|
380
|
-
this.hasInit = true
|
|
377
|
+
this.hasInit = true
|
|
381
378
|
const postParams = {
|
|
382
379
|
current_data: this.hasCalculateData ? this.calculateData.current_data : null,
|
|
383
380
|
product_id: this.productId,
|
|
384
381
|
scenario: 'h5Widget'
|
|
385
|
-
}
|
|
382
|
+
}
|
|
386
383
|
let urlParams = {
|
|
387
384
|
uuid: this.getU(),
|
|
388
385
|
appid: undefined
|
|
389
|
-
}
|
|
386
|
+
}
|
|
390
387
|
// 默认处理 tob流程
|
|
391
388
|
if (this.appid) {
|
|
392
389
|
// 重新赋值
|
|
393
390
|
if (!this.uuid && this.openId) {
|
|
394
|
-
this.uuid = this.openId
|
|
391
|
+
this.uuid = this.openId
|
|
395
392
|
}
|
|
396
393
|
// 判断uuid存不存在
|
|
397
394
|
if (!this.getU()) {
|
|
398
|
-
return this.$toast('缺少必要参数userUuid')
|
|
395
|
+
return this.$toast('缺少必要参数userUuid')
|
|
399
396
|
}
|
|
400
|
-
urlParams.appid = this.appid
|
|
397
|
+
urlParams.appid = this.appid
|
|
401
398
|
}
|
|
402
|
-
const planParams = this.planParams
|
|
399
|
+
const planParams = this.planParams
|
|
403
400
|
insureCalculate(urlParams, postParams, planParams)
|
|
404
401
|
.then(res => {
|
|
405
|
-
const data = this.translateData(res.data)
|
|
406
|
-
this.widgets = data.widgets
|
|
407
|
-
this.originData = data
|
|
402
|
+
const data = this.translateData(res.data)
|
|
403
|
+
this.widgets = data.widgets
|
|
404
|
+
this.originData = data
|
|
408
405
|
// 是否需要重新试算
|
|
409
406
|
if (this.hasInit && hasPlanParams(planParams)) {
|
|
410
|
-
this.hasInit = false
|
|
411
|
-
this.reCalculate()
|
|
407
|
+
this.hasInit = false
|
|
408
|
+
this.reCalculate()
|
|
412
409
|
}
|
|
413
410
|
})
|
|
414
411
|
.catch(err => {
|
|
415
|
-
console.log(err)
|
|
416
|
-
})
|
|
412
|
+
console.log(err)
|
|
413
|
+
})
|
|
417
414
|
}
|
|
418
415
|
// Promise 返回试算结果
|
|
419
416
|
confirm() {
|
|
420
|
-
const originData = JSON.parse(JSON.stringify(this.originData))
|
|
417
|
+
const originData = JSON.parse(JSON.stringify(this.originData))
|
|
421
418
|
const params = {
|
|
422
419
|
t_version: Date.now(),
|
|
423
420
|
code: 200,
|
|
@@ -429,14 +426,14 @@ export default class InsureCalculate extends Vue {
|
|
|
429
426
|
current_data: originData.current_data,
|
|
430
427
|
risk_premiums: originData.risk_premiums
|
|
431
428
|
}
|
|
432
|
-
}
|
|
429
|
+
}
|
|
433
430
|
// 返回业务
|
|
434
|
-
return Promise.resolve(params)
|
|
431
|
+
return Promise.resolve(params)
|
|
435
432
|
}
|
|
436
433
|
// 试算过滤器
|
|
437
434
|
handleSaveCalculate(item) {
|
|
438
435
|
if (item.cal_key === 1) {
|
|
439
|
-
this.reCalculate()
|
|
436
|
+
this.reCalculate()
|
|
440
437
|
}
|
|
441
438
|
}
|
|
442
439
|
// 重新试算
|
|
@@ -445,68 +442,67 @@ export default class InsureCalculate extends Vue {
|
|
|
445
442
|
current_data: this.getCurrentData(),
|
|
446
443
|
product_id: String(this.productId),
|
|
447
444
|
scenario: 'h5Widget'
|
|
448
|
-
}
|
|
445
|
+
}
|
|
449
446
|
const params = {
|
|
450
447
|
uuid: this.getU(),
|
|
451
448
|
appid: undefined
|
|
452
|
-
}
|
|
449
|
+
}
|
|
453
450
|
// 默认处理 tob流程
|
|
454
451
|
if (this.appid) {
|
|
455
452
|
// 重新赋值
|
|
456
453
|
if (!this.uuid && this.openId) {
|
|
457
|
-
this.uuid = this.openId
|
|
454
|
+
this.uuid = this.openId
|
|
458
455
|
}
|
|
459
456
|
// 判断uuid存不存在
|
|
460
457
|
if (!this.getU()) {
|
|
461
|
-
return this.$toast('缺少必要参数userUuid')
|
|
458
|
+
return this.$toast('缺少必要参数userUuid')
|
|
462
459
|
}
|
|
463
|
-
params.appid = this.appid
|
|
460
|
+
params.appid = this.appid
|
|
464
461
|
}
|
|
465
462
|
insureCalculate(params, data, this.planParams)
|
|
466
463
|
.then(res => {
|
|
467
|
-
const data = this.translateData(res.data)
|
|
468
|
-
this.widgets = data.widgets
|
|
469
|
-
this.originData = data
|
|
464
|
+
const data = this.translateData(res.data)
|
|
465
|
+
this.widgets = data.widgets
|
|
466
|
+
this.originData = data
|
|
470
467
|
})
|
|
471
468
|
.catch(err => {
|
|
472
|
-
console.log(err)
|
|
473
|
-
})
|
|
469
|
+
console.log(err)
|
|
470
|
+
})
|
|
474
471
|
}
|
|
475
472
|
// 组件事件
|
|
476
473
|
// 关闭
|
|
477
474
|
closeInsureCalculate() {
|
|
478
|
-
this.$emit('closeInsureCalculate')
|
|
475
|
+
this.$emit('closeInsureCalculate')
|
|
479
476
|
}
|
|
480
477
|
// 底部按钮 - 确定
|
|
481
478
|
sureInsureCalculate() {
|
|
482
|
-
this.$emit('sureInsureCalculate')
|
|
479
|
+
this.$emit('sureInsureCalculate')
|
|
483
480
|
}
|
|
484
481
|
showProfession(item) {
|
|
485
|
-
console.log('showProfession', item)
|
|
486
|
-
this.isShowProfession = true
|
|
482
|
+
console.log('showProfession', item)
|
|
483
|
+
this.isShowProfession = true
|
|
487
484
|
}
|
|
488
485
|
async showAddress(item) {
|
|
489
486
|
// console.log('showAddress', item);
|
|
490
|
-
const vm = this
|
|
491
|
-
vm.currentAddress = item
|
|
492
|
-
vm.returnClassify = item.values ? JSON.parse(item.values) : []
|
|
487
|
+
const vm = this
|
|
488
|
+
vm.currentAddress = item
|
|
489
|
+
vm.returnClassify = item.values ? JSON.parse(item.values) : []
|
|
493
490
|
try {
|
|
494
491
|
// 获取地址信息
|
|
495
|
-
const url = vm.getApiUrl(vm.getAreaCodeApi);
|
|
496
492
|
const data = {
|
|
497
493
|
pageType: 'detail',
|
|
498
494
|
productId: String(vm.productId)
|
|
499
|
-
}
|
|
500
|
-
const addressData = await getAddress(
|
|
495
|
+
}
|
|
496
|
+
const addressData = await getAddress(data, vm.getU())
|
|
501
497
|
if (addressData && addressData.code === 200) {
|
|
502
|
-
vm.list = addressData.data.codes
|
|
503
|
-
vm.formateAreaData(vm.list)
|
|
504
|
-
vm.isShowArea = true
|
|
498
|
+
vm.list = addressData.data.codes
|
|
499
|
+
vm.formateAreaData(vm.list)
|
|
500
|
+
vm.isShowArea = true
|
|
505
501
|
} else {
|
|
506
|
-
Toast(addressData && addressData.message ? addressData.message : '')
|
|
502
|
+
Toast(addressData && addressData.message ? addressData.message : '')
|
|
507
503
|
}
|
|
508
504
|
} catch (error) {
|
|
509
|
-
Toast(error && error.info ? error.info : '地址信息获取失败')
|
|
505
|
+
Toast(error && error.info ? error.info : '地址信息获取失败')
|
|
510
506
|
}
|
|
511
507
|
}
|
|
512
508
|
confirmArea(address) {
|
|
@@ -518,27 +514,27 @@ export default class InsureCalculate extends Vue {
|
|
|
518
514
|
provinceName: _get(address, '[0].name') || '',
|
|
519
515
|
cityName: _get(address, '[1].name') || '',
|
|
520
516
|
countyName: _get(address, '[2].name') || ''
|
|
521
|
-
}
|
|
517
|
+
}
|
|
522
518
|
if (_address.countyCode) {
|
|
523
|
-
this.currentAddress.current.v = _address.countyCode
|
|
524
|
-
this.currentAddress.tv = `${_address.provinceName}${_address.cityName}${_address.countyName}
|
|
519
|
+
this.currentAddress.current.v = _address.countyCode
|
|
520
|
+
this.currentAddress.tv = `${_address.provinceName}${_address.cityName}${_address.countyName}`
|
|
525
521
|
} else if (_address.cityCode) {
|
|
526
|
-
this.currentAddress.current.v = _address.cityCode
|
|
527
|
-
this.currentAddress.tv = `${_address.provinceName}${_address.cityName}
|
|
522
|
+
this.currentAddress.current.v = _address.cityCode
|
|
523
|
+
this.currentAddress.tv = `${_address.provinceName}${_address.cityName}`
|
|
528
524
|
} else if (_address.provinceCode) {
|
|
529
|
-
this.currentAddress.current.v = _address.provinceCode
|
|
530
|
-
this.currentAddress.tv = `${_address.provinceName}
|
|
525
|
+
this.currentAddress.current.v = _address.provinceCode
|
|
526
|
+
this.currentAddress.tv = `${_address.provinceName}`
|
|
531
527
|
}
|
|
532
|
-
this.isShowArea = false
|
|
528
|
+
this.isShowArea = false
|
|
533
529
|
}
|
|
534
530
|
}
|
|
535
531
|
toggle(item) {
|
|
536
|
-
console.log(item)
|
|
532
|
+
console.log(item)
|
|
537
533
|
if (item) {
|
|
538
534
|
if (item && item.toggle) {
|
|
539
|
-
this.$set(item, 'toggle', false)
|
|
535
|
+
this.$set(item, 'toggle', false)
|
|
540
536
|
} else {
|
|
541
|
-
this.$set(item, 'toggle', true)
|
|
537
|
+
this.$set(item, 'toggle', true)
|
|
542
538
|
}
|
|
543
539
|
}
|
|
544
540
|
}
|
|
@@ -549,63 +545,63 @@ export default class InsureCalculate extends Vue {
|
|
|
549
545
|
columns: item.opts[item.key],
|
|
550
546
|
defaultIndex: item.index,
|
|
551
547
|
item
|
|
552
|
-
}
|
|
548
|
+
}
|
|
553
549
|
}
|
|
554
550
|
onConfirmPicker(data) {
|
|
555
|
-
const { widgets, pickerConfig } = this
|
|
556
|
-
const { item } = pickerConfig
|
|
551
|
+
const { widgets, pickerConfig } = this
|
|
552
|
+
const { item } = pickerConfig
|
|
557
553
|
if (item.type === 'select_number_range') {
|
|
558
|
-
const orginTarget = widgets.find(e => e.riskCode === item.riskCode && e.key === item.key)
|
|
559
|
-
let idx = 0
|
|
554
|
+
const orginTarget = widgets.find(e => e.riskCode === item.riskCode && e.key === item.key)
|
|
555
|
+
let idx = 0
|
|
560
556
|
item.opts[item.key].forEach((e, index) => {
|
|
561
557
|
if (e.name === data.name) {
|
|
562
|
-
idx = index
|
|
558
|
+
idx = index
|
|
563
559
|
}
|
|
564
|
-
})
|
|
565
|
-
orginTarget.index = Number(idx)
|
|
566
|
-
const curr = item.opts[item.key][idx]
|
|
560
|
+
})
|
|
561
|
+
orginTarget.index = Number(idx)
|
|
562
|
+
const curr = item.opts[item.key][idx]
|
|
567
563
|
if (curr && curr.opt_type === 'number_range') {
|
|
568
|
-
this.$set(item, 'showInput', true)
|
|
569
|
-
this.$set(item, 'minValue', Number(curr.value.split('-')[0]))
|
|
570
|
-
this.$set(item, 'maxValue', Number(curr.value.split('-')[1]))
|
|
571
|
-
this.$set(item, 'step', Number(curr.step_length))
|
|
572
|
-
this.$set(item, 'errorMessage', '')
|
|
573
|
-
this.$set(item.current, 'v', '')
|
|
564
|
+
this.$set(item, 'showInput', true)
|
|
565
|
+
this.$set(item, 'minValue', Number(curr.value.split('-')[0]))
|
|
566
|
+
this.$set(item, 'maxValue', Number(curr.value.split('-')[1]))
|
|
567
|
+
this.$set(item, 'step', Number(curr.step_length))
|
|
568
|
+
this.$set(item, 'errorMessage', '')
|
|
569
|
+
this.$set(item.current, 'v', '')
|
|
574
570
|
} else {
|
|
575
|
-
this.$set(item, 'showInput', false)
|
|
576
|
-
this.$set(item, 'minValue', undefined)
|
|
577
|
-
this.$set(item, 'maxValue', undefined)
|
|
578
|
-
this.$set(item, 'step', undefined)
|
|
579
|
-
this.$set(item, 'errorMessage', '')
|
|
580
|
-
this.handleSaveCalculate(item)
|
|
571
|
+
this.$set(item, 'showInput', false)
|
|
572
|
+
this.$set(item, 'minValue', undefined)
|
|
573
|
+
this.$set(item, 'maxValue', undefined)
|
|
574
|
+
this.$set(item, 'step', undefined)
|
|
575
|
+
this.$set(item, 'errorMessage', '')
|
|
576
|
+
this.handleSaveCalculate(item)
|
|
581
577
|
}
|
|
582
|
-
this.onCancelPicker()
|
|
583
|
-
return
|
|
578
|
+
this.onCancelPicker()
|
|
579
|
+
return
|
|
584
580
|
}
|
|
585
|
-
let idx = 0
|
|
581
|
+
let idx = 0
|
|
586
582
|
item.opts[item.key].forEach((e, index) => {
|
|
587
583
|
if (e.name === data.name) {
|
|
588
|
-
idx = index
|
|
584
|
+
idx = index
|
|
589
585
|
}
|
|
590
|
-
})
|
|
586
|
+
})
|
|
591
587
|
|
|
592
|
-
let orginTarget
|
|
588
|
+
let orginTarget
|
|
593
589
|
if (item.duty) {
|
|
594
|
-
orginTarget = widgets.find(e => e.riskCode === item.riskCode && e.key === item.key && e.duty === item.duty)
|
|
590
|
+
orginTarget = widgets.find(e => e.riskCode === item.riskCode && e.key === item.key && e.duty === item.duty)
|
|
595
591
|
} else {
|
|
596
|
-
orginTarget = widgets.find(e => e.riskCode === item.riskCode && e.key === item.key)
|
|
592
|
+
orginTarget = widgets.find(e => e.riskCode === item.riskCode && e.key === item.key)
|
|
597
593
|
}
|
|
598
|
-
orginTarget.index = Number(idx)
|
|
599
|
-
this.handleSaveCalculate(item)
|
|
600
|
-
this.onCancelPicker()
|
|
594
|
+
orginTarget.index = Number(idx)
|
|
595
|
+
this.handleSaveCalculate(item)
|
|
596
|
+
this.onCancelPicker()
|
|
601
597
|
}
|
|
602
598
|
onCancelPicker() {
|
|
603
|
-
this.pickerConfig = initPickerConfig()
|
|
599
|
+
this.pickerConfig = initPickerConfig()
|
|
604
600
|
}
|
|
605
601
|
openDatePicker(item) {
|
|
606
|
-
const defaultValue = item.current && item.current.v ? new Date(item.current.v) : new Date()
|
|
607
|
-
const minDate = new Date(item.opts[item.key][0].st)
|
|
608
|
-
const maxDate = new Date(item.opts[item.key][0].et)
|
|
602
|
+
const defaultValue = item.current && item.current.v ? new Date(item.current.v) : new Date()
|
|
603
|
+
const minDate = new Date(item.opts[item.key][0].st)
|
|
604
|
+
const maxDate = new Date(item.opts[item.key][0].et)
|
|
609
605
|
this.datePickerConfig = {
|
|
610
606
|
visible: true,
|
|
611
607
|
title: item.label,
|
|
@@ -613,387 +609,367 @@ export default class InsureCalculate extends Vue {
|
|
|
613
609
|
minDate,
|
|
614
610
|
maxDate,
|
|
615
611
|
item
|
|
616
|
-
}
|
|
612
|
+
}
|
|
617
613
|
}
|
|
618
614
|
onConfirmDatetimePicker(data) {
|
|
619
|
-
const { widgets, datePickerConfig } = this
|
|
620
|
-
const { item } = datePickerConfig
|
|
621
|
-
const orginTarget = widgets.find(e => e.riskCode === item.riskCode && e.key === item.key)
|
|
622
|
-
orginTarget.current.v = parseTime(data, '{y}-{m}-{d}' as any)
|
|
623
|
-
this.handleSaveCalculate(item)
|
|
624
|
-
this.onCancelDatetimePicker()
|
|
615
|
+
const { widgets, datePickerConfig } = this
|
|
616
|
+
const { item } = datePickerConfig
|
|
617
|
+
const orginTarget = widgets.find(e => e.riskCode === item.riskCode && e.key === item.key)
|
|
618
|
+
orginTarget.current.v = parseTime(data, '{y}-{m}-{d}' as any)
|
|
619
|
+
this.handleSaveCalculate(item)
|
|
620
|
+
this.onCancelDatetimePicker()
|
|
625
621
|
}
|
|
626
622
|
onCancelDatetimePicker() {
|
|
627
|
-
this.datePickerConfig.visible = false
|
|
623
|
+
this.datePickerConfig.visible = false
|
|
628
624
|
}
|
|
629
625
|
bindSelectChange(item, it) {
|
|
630
626
|
// console.log('bindSelectChange', item, it);
|
|
631
|
-
const currTarget = item
|
|
632
|
-
const currClickItem = it
|
|
633
|
-
let orginTarget
|
|
627
|
+
const currTarget = item
|
|
628
|
+
const currClickItem = it
|
|
629
|
+
let orginTarget
|
|
634
630
|
if (currTarget.duty) {
|
|
635
|
-
orginTarget = this.widgets.find(item => item.riskCode === currTarget.riskCode && item.key === currTarget.key && item.duty === currTarget.duty)
|
|
631
|
+
orginTarget = this.widgets.find(item => item.riskCode === currTarget.riskCode && item.key === currTarget.key && item.duty === currTarget.duty)
|
|
636
632
|
} else {
|
|
637
|
-
orginTarget = this.widgets.find(item => item.riskCode === currTarget.riskCode && item.key === currTarget.key)
|
|
633
|
+
orginTarget = this.widgets.find(item => item.riskCode === currTarget.riskCode && item.key === currTarget.key)
|
|
638
634
|
}
|
|
639
|
-
orginTarget.current.v = currClickItem.value
|
|
640
|
-
this.handleSaveCalculate(item)
|
|
635
|
+
orginTarget.current.v = currClickItem.value
|
|
636
|
+
this.handleSaveCalculate(item)
|
|
641
637
|
}
|
|
642
638
|
inputNumberChange(item) {
|
|
643
|
-
const currValue = Number(item.current.v)
|
|
644
|
-
const self = this
|
|
639
|
+
const currValue = Number(item.current.v)
|
|
640
|
+
const self = this
|
|
645
641
|
if (currValue < item.minValue || currValue > item.maxValue) {
|
|
646
|
-
item.errorMessage = '请输入' + item.minValue + '到' + item.maxValue + '之间的整数'
|
|
642
|
+
item.errorMessage = '请输入' + item.minValue + '到' + item.maxValue + '之间的整数'
|
|
647
643
|
} else if (currValue % item.step !== 0) {
|
|
648
|
-
item.errorMessage = '请输入' + item.step + '的倍数'
|
|
644
|
+
item.errorMessage = '请输入' + item.step + '的倍数'
|
|
649
645
|
} else {
|
|
650
|
-
item.errorMessage = ''
|
|
651
|
-
console.log('去试算了', item)
|
|
652
|
-
self.handleSaveCalculate(item)
|
|
646
|
+
item.errorMessage = ''
|
|
647
|
+
console.log('去试算了', item)
|
|
648
|
+
self.handleSaveCalculate(item)
|
|
653
649
|
}
|
|
654
650
|
}
|
|
655
651
|
inputNumberRangeBlur(item) {
|
|
656
|
-
if (item.lastValue === item.current.v) return
|
|
652
|
+
if (item.lastValue === item.current.v) return
|
|
657
653
|
|
|
658
|
-
const currValue = Number(item.current.v)
|
|
659
|
-
let toastText = ''
|
|
654
|
+
const currValue = Number(item.current.v)
|
|
655
|
+
let toastText = ''
|
|
660
656
|
|
|
661
657
|
if (isNaN(currValue) || String(item.current.v).indexOf('.') > -1) {
|
|
662
658
|
if (item.minValue) {
|
|
663
|
-
toastText = `请输入不小于${item.minValue}
|
|
664
|
-
item.current.v = item.minValue
|
|
659
|
+
toastText = `请输入不小于${item.minValue}的正整数`
|
|
660
|
+
item.current.v = item.minValue
|
|
665
661
|
} else if (item.maxValue) {
|
|
666
|
-
toastText = `请输入不大于${item.maxValue}
|
|
667
|
-
item.current.v = item.maxValue
|
|
662
|
+
toastText = `请输入不大于${item.maxValue}的正整数`
|
|
663
|
+
item.current.v = item.maxValue
|
|
668
664
|
}
|
|
669
665
|
} else if (item.minValue && currValue < item.minValue) {
|
|
670
|
-
toastText = `购买份数不能小于${item.minValue}
|
|
671
|
-
item.current.v = item.minValue
|
|
666
|
+
toastText = `购买份数不能小于${item.minValue}份`
|
|
667
|
+
item.current.v = item.minValue
|
|
672
668
|
} else if (item.maxValue && currValue > item.maxValue) {
|
|
673
|
-
toastText = `最多购买${item.maxValue}
|
|
674
|
-
item.current.v = item.maxValue
|
|
669
|
+
toastText = `最多购买${item.maxValue}份`
|
|
670
|
+
item.current.v = item.maxValue
|
|
675
671
|
}
|
|
676
672
|
|
|
677
|
-
item.lastValue = item.current.v
|
|
678
|
-
toastText && this.$toast(toastText)
|
|
679
|
-
this.handleSaveCalculate(item)
|
|
673
|
+
item.lastValue = item.current.v
|
|
674
|
+
toastText && this.$toast(toastText)
|
|
675
|
+
this.handleSaveCalculate(item)
|
|
680
676
|
}
|
|
681
677
|
// model -> view 给予数据拼装视图
|
|
682
678
|
translateData(res) {
|
|
683
|
-
const widgets = res.widgets
|
|
684
|
-
const currentData = res.current_data
|
|
685
|
-
this.translateWidgets(widgets, currentData)
|
|
686
|
-
return res
|
|
679
|
+
const widgets = res.widgets
|
|
680
|
+
const currentData = res.current_data
|
|
681
|
+
this.translateWidgets(widgets, currentData)
|
|
682
|
+
return res
|
|
687
683
|
}
|
|
688
684
|
translateWidgets(widgets, currentData) {
|
|
689
685
|
widgets.forEach(item => {
|
|
690
|
-
let current
|
|
686
|
+
let current
|
|
691
687
|
// 增加current字段,保存current_data的数据
|
|
692
688
|
if (item.duty) {
|
|
693
|
-
item.current = current = currentData.find(it => it.k === item.key && it.risk === item.riskCode && item.duty === it.d)
|
|
689
|
+
item.current = current = currentData.find(it => it.k === item.key && it.risk === item.riskCode && item.duty === it.d)
|
|
694
690
|
} else {
|
|
695
|
-
item.current = current = currentData.find(it => it.k === item.key && it.risk === item.riskCode)
|
|
691
|
+
item.current = current = currentData.find(it => it.k === item.key && it.risk === item.riskCode)
|
|
696
692
|
}
|
|
697
693
|
if ((item.type === 'select' || item.type === 'input') && item.opts && item.opts[item.key]) {
|
|
698
|
-
const isNumberRange = item.opts[item.key].some(it => it.opt_type === 'number_range')
|
|
694
|
+
const isNumberRange = item.opts[item.key].some(it => it.opt_type === 'number_range')
|
|
699
695
|
if (isNumberRange) {
|
|
700
|
-
item.type = `${item.type}_number_range
|
|
696
|
+
item.type = `${item.type}_number_range`
|
|
701
697
|
}
|
|
702
698
|
}
|
|
703
699
|
// 投保年龄是区间的修正
|
|
704
700
|
if (item.type === 'select' && item.key === 'detail_age' && current && current.sv) {
|
|
705
|
-
item.current.v = current.sv
|
|
701
|
+
item.current.v = current.sv
|
|
706
702
|
}
|
|
707
703
|
if (~item.key.indexOf('#')) {
|
|
708
704
|
if (!item.opts) {
|
|
709
|
-
item.opts = {}
|
|
705
|
+
item.opts = {}
|
|
710
706
|
} else if (!item.opts[item.key]) {
|
|
711
|
-
let key = item.key.split('#')[0]
|
|
707
|
+
let key = item.key.split('#')[0]
|
|
712
708
|
if (item.opts[key]) {
|
|
713
|
-
item.opts[item.key] = item.opts[key]
|
|
709
|
+
item.opts[item.key] = item.opts[key]
|
|
714
710
|
}
|
|
715
711
|
}
|
|
716
712
|
}
|
|
717
713
|
switch (item.type) {
|
|
718
714
|
case 'v-text':
|
|
719
715
|
// 自定义text展示
|
|
720
|
-
this.translateVText(item)
|
|
721
|
-
break
|
|
716
|
+
this.translateVText(item)
|
|
717
|
+
break
|
|
722
718
|
case 'text':
|
|
723
719
|
// text展示
|
|
724
|
-
this.translateText(item)
|
|
725
|
-
break
|
|
720
|
+
this.translateText(item)
|
|
721
|
+
break
|
|
726
722
|
case 'select':
|
|
727
723
|
// select展示
|
|
728
|
-
this.translateSelect(item, current)
|
|
729
|
-
break
|
|
724
|
+
this.translateSelect(item, current)
|
|
725
|
+
break
|
|
730
726
|
case 'select_number_range':
|
|
731
727
|
// select 包含自定义输入框的展示
|
|
732
|
-
this.translateSelectNumberRange(item, current)
|
|
733
|
-
break
|
|
728
|
+
this.translateSelectNumberRange(item, current)
|
|
729
|
+
break
|
|
734
730
|
case 'calendar':
|
|
735
731
|
// 日历展示
|
|
736
|
-
this.translateCalendar(item, current)
|
|
737
|
-
break
|
|
732
|
+
this.translateCalendar(item, current)
|
|
733
|
+
break
|
|
738
734
|
case 'address':
|
|
739
735
|
// 地址展示
|
|
740
|
-
this.translateAddress(item, current)
|
|
741
|
-
break
|
|
736
|
+
this.translateAddress(item, current)
|
|
737
|
+
break
|
|
742
738
|
case 'input_number_range':
|
|
743
739
|
// input展示
|
|
744
|
-
this.translateInputNumberRange(item, current)
|
|
745
|
-
break
|
|
740
|
+
this.translateInputNumberRange(item, current)
|
|
741
|
+
break
|
|
746
742
|
}
|
|
747
|
-
})
|
|
743
|
+
})
|
|
748
744
|
}
|
|
749
745
|
translateVText(item) {}
|
|
750
746
|
translateText(item) {
|
|
751
|
-
item.name = item.opts[item.key][0].name
|
|
747
|
+
item.name = item.opts[item.key][0].name
|
|
752
748
|
}
|
|
753
749
|
translateSelect(item, current) {
|
|
754
|
-
let len = 0
|
|
750
|
+
let len = 0
|
|
755
751
|
if (item.opts && item.opts[item.key] && item.opts[item.key].length) {
|
|
756
|
-
len = item.opts[item.key].length
|
|
752
|
+
len = item.opts[item.key].length
|
|
757
753
|
}
|
|
758
754
|
if (len <= 2) {
|
|
759
|
-
item.type = 'select_checkbox'
|
|
755
|
+
item.type = 'select_checkbox'
|
|
760
756
|
} else {
|
|
761
|
-
item.type = 'select_picker'
|
|
762
|
-
let idx = 0
|
|
757
|
+
item.type = 'select_picker'
|
|
758
|
+
let idx = 0
|
|
763
759
|
if (item.opts && item.opts[item.key] && item.opts[item.key].length) {
|
|
764
760
|
item.opts[item.key].forEach((it, index) => {
|
|
765
761
|
if (it.value === current.v) {
|
|
766
|
-
idx = index
|
|
762
|
+
idx = index
|
|
767
763
|
}
|
|
768
|
-
})
|
|
764
|
+
})
|
|
769
765
|
}
|
|
770
766
|
// 增加index字段,保存用户选项,同时设置默认值
|
|
771
|
-
item.index = idx
|
|
767
|
+
item.index = idx
|
|
772
768
|
}
|
|
773
769
|
}
|
|
774
770
|
translateSelectNumberRange(item, current) {
|
|
775
|
-
let idx = -1
|
|
771
|
+
let idx = -1
|
|
776
772
|
if (item.opts && item.opts[item.key] && item.opts[item.key].length) {
|
|
777
773
|
item.opts[item.key].forEach((it, index) => {
|
|
778
774
|
if (it.value === current.v) {
|
|
779
|
-
idx = index
|
|
775
|
+
idx = index
|
|
780
776
|
}
|
|
781
|
-
})
|
|
777
|
+
})
|
|
782
778
|
}
|
|
783
779
|
// 增加index字段,保存用户选项,同时设置默认值
|
|
784
780
|
if (idx === -1) {
|
|
785
|
-
let numberRangeIndex = 0
|
|
781
|
+
let numberRangeIndex = 0
|
|
786
782
|
if (item.opts && item.opts[item.key] && item.opts[item.key].length) {
|
|
787
783
|
item.opts[item.key].forEach((it, n) => {
|
|
788
784
|
if (it.opt_type === 'number_range') {
|
|
789
|
-
numberRangeIndex = n
|
|
785
|
+
numberRangeIndex = n
|
|
790
786
|
}
|
|
791
|
-
})
|
|
787
|
+
})
|
|
792
788
|
}
|
|
793
|
-
const curr = item.opts[item.key].find(it => it.opt_type === 'number_range')
|
|
789
|
+
const curr = item.opts[item.key].find(it => it.opt_type === 'number_range')
|
|
794
790
|
if (curr) {
|
|
795
|
-
this.$set(item, 'showInput', true)
|
|
796
|
-
this.$set(item, 'minValue', Number(curr.value.split('-')[0]))
|
|
797
|
-
this.$set(item, 'maxValue', Number(curr.value.split('-')[1]))
|
|
798
|
-
this.$set(item, 'step', Number(curr.step_length))
|
|
799
|
-
this.$set(item, 'errorMessage', '')
|
|
800
|
-
this.$set(item.current, 'v', current.v)
|
|
791
|
+
this.$set(item, 'showInput', true)
|
|
792
|
+
this.$set(item, 'minValue', Number(curr.value.split('-')[0]))
|
|
793
|
+
this.$set(item, 'maxValue', Number(curr.value.split('-')[1]))
|
|
794
|
+
this.$set(item, 'step', Number(curr.step_length))
|
|
795
|
+
this.$set(item, 'errorMessage', '')
|
|
796
|
+
this.$set(item.current, 'v', current.v)
|
|
801
797
|
}
|
|
802
|
-
item.index = numberRangeIndex
|
|
798
|
+
item.index = numberRangeIndex
|
|
803
799
|
} else {
|
|
804
|
-
item.index = idx
|
|
800
|
+
item.index = idx
|
|
805
801
|
}
|
|
806
802
|
}
|
|
807
803
|
translateInputNumberRange(item, current) {
|
|
808
|
-
item.lastValue = current.v
|
|
804
|
+
item.lastValue = current.v
|
|
809
805
|
if (item.opts && item.opts[item.key] && item.opts[item.key].length) {
|
|
810
|
-
const range = item.opts[item.key][0].value
|
|
806
|
+
const range = item.opts[item.key][0].value
|
|
811
807
|
if (range && range.indexOf('-') > -1) {
|
|
812
|
-
const limitArr = []
|
|
813
|
-
const valueRange = range.split('-')
|
|
814
|
-
item.minValue = valueRange[0] === 'null' ? '' : valueRange[0]
|
|
815
|
-
item.maxValue = valueRange[1] === 'null' ? '' : valueRange[1]
|
|
816
|
-
item.minValue && limitArr.push(`${item.minValue}份起购`)
|
|
817
|
-
item.maxValue && limitArr.push(`最多购买${item.maxValue}份`)
|
|
818
|
-
limitArr.length && (item.limitInfo = limitArr.join(','))
|
|
808
|
+
const limitArr = []
|
|
809
|
+
const valueRange = range.split('-')
|
|
810
|
+
item.minValue = valueRange[0] === 'null' ? '' : valueRange[0]
|
|
811
|
+
item.maxValue = valueRange[1] === 'null' ? '' : valueRange[1]
|
|
812
|
+
item.minValue && limitArr.push(`${item.minValue}份起购`)
|
|
813
|
+
item.maxValue && limitArr.push(`最多购买${item.maxValue}份`)
|
|
814
|
+
limitArr.length && (item.limitInfo = limitArr.join(','))
|
|
819
815
|
}
|
|
820
816
|
}
|
|
821
817
|
}
|
|
822
818
|
translateCalendar(item, current) {
|
|
823
819
|
// 增加current字段,保存currentData的数据
|
|
824
|
-
item.current = current
|
|
820
|
+
item.current = current
|
|
825
821
|
}
|
|
826
822
|
translateAddress(item, current) {
|
|
827
823
|
if (current && current.v) {
|
|
828
|
-
this.defaultArea = current.v
|
|
829
|
-
const arrAddress = this.getArea(this.list, '', [])
|
|
824
|
+
this.defaultArea = current.v
|
|
825
|
+
const arrAddress = this.getArea(this.list, '', [])
|
|
830
826
|
if (arrAddress && arrAddress.length) {
|
|
831
|
-
const currAddress = arrAddress.find(item => String(item.areaCode) === String(current.v))
|
|
827
|
+
const currAddress = arrAddress.find(item => String(item.areaCode) === String(current.v))
|
|
832
828
|
if (currAddress && currAddress.areaCode) {
|
|
833
|
-
item.tv = currAddress.des
|
|
829
|
+
item.tv = currAddress.des
|
|
834
830
|
}
|
|
835
831
|
}
|
|
836
832
|
}
|
|
837
833
|
}
|
|
838
834
|
getArea(list, des, params) {
|
|
839
|
-
const vm = this
|
|
840
|
-
const res = params
|
|
835
|
+
const vm = this
|
|
836
|
+
const res = params
|
|
841
837
|
for (let index = 0; index < list.length; index += 1) {
|
|
842
|
-
const item = list[index]
|
|
838
|
+
const item = list[index]
|
|
843
839
|
if (item.children) {
|
|
844
|
-
const tempDes = `${des}${item.areaName}
|
|
845
|
-
vm.getArea(item.children, tempDes, res)
|
|
840
|
+
const tempDes = `${des}${item.areaName}`
|
|
841
|
+
vm.getArea(item.children, tempDes, res)
|
|
846
842
|
} else {
|
|
847
|
-
const tempDes = `${des}${item.areaName}
|
|
848
|
-
res.push({ ...item, des: tempDes })
|
|
843
|
+
const tempDes = `${des}${item.areaName}`
|
|
844
|
+
res.push({ ...item, des: tempDes })
|
|
849
845
|
}
|
|
850
846
|
}
|
|
851
|
-
return res
|
|
847
|
+
return res
|
|
852
848
|
}
|
|
853
849
|
formateAreaData(list) {
|
|
854
|
-
let province: any[] = []
|
|
855
|
-
let city: any[] = []
|
|
856
|
-
let county: any[] = []
|
|
857
|
-
let hasCity = false
|
|
858
|
-
let hasCounty = false
|
|
859
|
-
let areaList = list
|
|
850
|
+
let province: any[] = []
|
|
851
|
+
let city: any[] = []
|
|
852
|
+
let county: any[] = []
|
|
853
|
+
let hasCity = false
|
|
854
|
+
let hasCounty = false
|
|
855
|
+
let areaList = list
|
|
860
856
|
areaList.forEach(item => {
|
|
861
857
|
if (item.areaLevel === 1) {
|
|
862
858
|
province.push({
|
|
863
859
|
code: item.areaCode,
|
|
864
860
|
name: item.areaName,
|
|
865
861
|
classify: item.classify
|
|
866
|
-
})
|
|
862
|
+
})
|
|
867
863
|
}
|
|
868
864
|
if (item.children) {
|
|
869
|
-
hasCity = true
|
|
865
|
+
hasCity = true
|
|
870
866
|
item.children.forEach((item2: any) => {
|
|
871
867
|
city.push({
|
|
872
868
|
code: item2.areaCode,
|
|
873
869
|
name: item2.areaName,
|
|
874
870
|
parentId: item.areaCode,
|
|
875
871
|
classify: item2.classify
|
|
876
|
-
})
|
|
872
|
+
})
|
|
877
873
|
|
|
878
874
|
if (item2.children) {
|
|
879
|
-
hasCounty = true
|
|
875
|
+
hasCounty = true
|
|
880
876
|
item2.children.forEach(item3 => {
|
|
881
877
|
county.push({
|
|
882
878
|
code: item3.areaCode,
|
|
883
879
|
name: item3.areaName,
|
|
884
880
|
parentId: item2.areaCode,
|
|
885
881
|
classify: item3.classify
|
|
886
|
-
})
|
|
887
|
-
})
|
|
882
|
+
})
|
|
883
|
+
})
|
|
888
884
|
} else {
|
|
889
|
-
hasCounty = false
|
|
885
|
+
hasCounty = false
|
|
890
886
|
}
|
|
891
|
-
})
|
|
887
|
+
})
|
|
892
888
|
} else {
|
|
893
|
-
hasCity = false
|
|
889
|
+
hasCity = false
|
|
894
890
|
}
|
|
895
|
-
})
|
|
896
|
-
let countyCopy = []
|
|
897
|
-
let cityCopy = []
|
|
891
|
+
})
|
|
892
|
+
let countyCopy = []
|
|
893
|
+
let cityCopy = []
|
|
898
894
|
if (hasCounty) {
|
|
899
895
|
county.forEach(item => {
|
|
900
896
|
if (this.returnClassify.findIndex(v => v == item.classify || !item.classify) > -1) {
|
|
901
|
-
countyCopy.push(item)
|
|
897
|
+
countyCopy.push(item)
|
|
902
898
|
}
|
|
903
|
-
})
|
|
899
|
+
})
|
|
904
900
|
if (hasCity) {
|
|
905
|
-
cityCopy = city
|
|
901
|
+
cityCopy = city
|
|
906
902
|
}
|
|
907
903
|
} else {
|
|
908
904
|
if (hasCity) {
|
|
909
905
|
city.forEach(item => {
|
|
910
906
|
if (this.returnClassify.findIndex(v => v == item.classify || !item.classify) > -1) {
|
|
911
|
-
cityCopy.push(item)
|
|
907
|
+
cityCopy.push(item)
|
|
912
908
|
}
|
|
913
|
-
})
|
|
909
|
+
})
|
|
914
910
|
}
|
|
915
911
|
}
|
|
916
|
-
let currProvince = []
|
|
917
|
-
let currCity = []
|
|
912
|
+
let currProvince = []
|
|
913
|
+
let currCity = []
|
|
918
914
|
// 过滤省下面没有市的情况
|
|
919
915
|
if (hasCounty) {
|
|
920
916
|
cityCopy.forEach(item => {
|
|
921
917
|
if (
|
|
922
918
|
countyCopy.some(item2 => {
|
|
923
|
-
return item2.parentId === item.code
|
|
919
|
+
return item2.parentId === item.code
|
|
924
920
|
}) ||
|
|
925
921
|
[441900, 442000].includes(item.code)
|
|
926
922
|
) {
|
|
927
|
-
currCity.push(item)
|
|
923
|
+
currCity.push(item)
|
|
928
924
|
}
|
|
929
|
-
})
|
|
925
|
+
})
|
|
930
926
|
} else {
|
|
931
|
-
currCity = cityCopy
|
|
927
|
+
currCity = cityCopy
|
|
932
928
|
}
|
|
933
929
|
|
|
934
930
|
province.forEach(item => {
|
|
935
931
|
if (
|
|
936
932
|
currCity.some(item2 => {
|
|
937
|
-
return item2.parentId === item.code
|
|
933
|
+
return item2.parentId === item.code
|
|
938
934
|
})
|
|
939
935
|
) {
|
|
940
|
-
currProvince.push(item)
|
|
936
|
+
currProvince.push(item)
|
|
941
937
|
}
|
|
942
|
-
})
|
|
938
|
+
})
|
|
943
939
|
this.areaData = {
|
|
944
940
|
province_list: currProvince.reduce((accr, e: any) => Object.assign(accr, { [e.code]: e.name }), {}),
|
|
945
941
|
city_list: currCity.reduce((accr, e: any) => Object.assign(accr, { [e.code]: e.name }), {}),
|
|
946
942
|
county_list: countyCopy.reduce((accr, e: any) => Object.assign(accr, { [e.code]: e.name }), {})
|
|
947
|
-
}
|
|
943
|
+
}
|
|
948
944
|
}
|
|
949
945
|
// 工具方法
|
|
950
946
|
getCurrentData() {
|
|
951
|
-
const currentData = []
|
|
947
|
+
const currentData = []
|
|
952
948
|
this.widgets &&
|
|
953
949
|
this.widgets.forEach(item => {
|
|
954
950
|
if (item.index === undefined) {
|
|
955
|
-
currentData.push(item.current)
|
|
951
|
+
currentData.push(item.current)
|
|
956
952
|
} else if ((item.index || Number(item.index) === 0) && !item.showInput) {
|
|
957
|
-
const temp = JSON.parse(JSON.stringify(item.current))
|
|
958
|
-
temp.v = item.opts[item.key][item.index].value
|
|
959
|
-
currentData.push(temp)
|
|
953
|
+
const temp = JSON.parse(JSON.stringify(item.current))
|
|
954
|
+
temp.v = item.opts[item.key][item.index].value
|
|
955
|
+
currentData.push(temp)
|
|
960
956
|
} else {
|
|
961
|
-
currentData.push(item.current)
|
|
957
|
+
currentData.push(item.current)
|
|
962
958
|
}
|
|
963
|
-
})
|
|
964
|
-
return currentData
|
|
959
|
+
})
|
|
960
|
+
return currentData
|
|
965
961
|
}
|
|
966
962
|
getU() {
|
|
967
|
-
return this.uuid || this.uuidFromApi
|
|
968
|
-
}
|
|
969
|
-
getApiUrl(url) {
|
|
970
|
-
let u = url;
|
|
971
|
-
if (this.getU() && u.indexOf('userUuid') === -1) {
|
|
972
|
-
if (u.indexOf('?') === -1) {
|
|
973
|
-
u += `?userUuid=${this.getU()}`;
|
|
974
|
-
} else {
|
|
975
|
-
u += `&userUuid=${this.getU()}`;
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
return u;
|
|
963
|
+
return this.uuid || this.uuidFromApi
|
|
979
964
|
}
|
|
980
965
|
setIsDevelop() {
|
|
981
966
|
if (window.location.port) {
|
|
982
|
-
this.isDevelop = true
|
|
967
|
+
this.isDevelop = true
|
|
983
968
|
} else {
|
|
984
|
-
this.isDevelop = false
|
|
969
|
+
this.isDevelop = false
|
|
985
970
|
}
|
|
986
971
|
if (this.isDev === true || this.isDev === false) {
|
|
987
|
-
this.isDevelop = this.isDev
|
|
988
|
-
}
|
|
989
|
-
if (this.isDevelop) {
|
|
990
|
-
this.getCalculateApi = 'https://insurance2a-api.wyins.net.cn/api/product/data/calculate';
|
|
991
|
-
this.getAreaCodeApi = 'https://insurance2a-api.wyins.net.cn/api/product/data/getAreaCode';
|
|
992
|
-
this.getUuidApi = `${PLANBOOK_API_HOSTNAME}/planBook/common/currentUser`;
|
|
993
|
-
} else {
|
|
994
|
-
this.getCalculateApi = 'https://insurance2a-api.wyins.net/api/product/data/calculate';
|
|
995
|
-
this.getAreaCodeApi = 'https://insurance2a-api.wyins.net/api/product/data/getAreaCode';
|
|
996
|
-
this.getUuidApi = `${PLANBOOK_API_HOSTNAME}/planBook/common/currentUser`;
|
|
972
|
+
this.isDevelop = this.isDev
|
|
997
973
|
}
|
|
998
974
|
}
|
|
999
975
|
}
|