mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-24 21:52:53 +08:00
责任验证
This commit is contained in:
@@ -68,7 +68,7 @@
|
||||
<div class="duty">
|
||||
<div class="flex justify-content-s border-bd pv10 align-items-c" v-for="(dutyItem, dutyItemIndex) in riskFactor.rules" :key="dutyItemIndex">
|
||||
<span class="fs14 w100">{{ dutyItem.dutyName }}({{ dutyItem.suffix }})</span>
|
||||
<div class="flex">
|
||||
<div class="flex relative">
|
||||
<van-stepper
|
||||
v-model="dutyItem.defaultDutyAmt"
|
||||
:min="dutyItem.minDutyAmt"
|
||||
@@ -77,7 +77,7 @@
|
||||
:show-minus="false"
|
||||
class="ml10 mr10"
|
||||
@focus="focusStep"
|
||||
@blur="blurStep"
|
||||
@blur="blurStep(arguments, dutyItem.duty)"
|
||||
@change="
|
||||
dutyStepperChange(
|
||||
item.calFactorLst[riskFactorIndex].rules[dutyItemIndex].defaultDutyAmt,
|
||||
@@ -98,6 +98,7 @@
|
||||
shape="square"
|
||||
@change="changeChecked(index, riskFactorIndex, dutyItemIndex)"
|
||||
></van-checkbox>
|
||||
<div class="checkbox-click" @touchstart="valiCheckbox(dutyItem)"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -154,7 +155,7 @@
|
||||
<div class="duty">
|
||||
<div class="flex justify-content-s border-bd pv10 align-items-c" v-for="(dutyItem, dutyItemIndex) in riskFactor.rules" :key="dutyItemIndex">
|
||||
<span class="fs14 w100">{{ dutyItem.dutyName }}({{ dutyItem.suffix }})</span>
|
||||
<div class="flex">
|
||||
<div class="flex relative">
|
||||
<van-stepper
|
||||
v-model="dutyItem.defaultDutyAmt"
|
||||
:min="dutyItem.minDutyAmt"
|
||||
@@ -163,7 +164,7 @@
|
||||
:show-minus="false"
|
||||
class="ml10 mr10"
|
||||
@focus="focusStep"
|
||||
@blur="blurStep"
|
||||
@blur="blurStep(arguments, dutyItem.duty)"
|
||||
@change="
|
||||
dutyStepperChange(
|
||||
item.calFactorLst[riskFactorIndex].rules[dutyItemIndex].defaultDutyAmt,
|
||||
@@ -184,6 +185,7 @@
|
||||
shape="square"
|
||||
@change="changeChecked(index, riskFactorIndex, dutyItemIndex)"
|
||||
></van-checkbox>
|
||||
<div class="checkbox-click" @touchstart="valiCheckbox(dutyItem)"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -233,6 +235,42 @@ import { Tag, Icon, Dialog, ActionSheet, Popup, Picker, Stepper, Field, Checkbox
|
||||
import { trial } from '@/api/ebiz/common/common'
|
||||
import { saveOrUpdateOrderInfo, getOrderDetail } from '@/api/ebiz/sale/sale'
|
||||
import { saveProposal } from '@/api/ebiz/proposal/proposal.js'
|
||||
|
||||
//险种GFRS_M0016的责任的验证规则
|
||||
//默认 最低基本保险金额min 10000 整数倍要求mutiple 1000
|
||||
const dutyRules = {
|
||||
410800: {
|
||||
min: 50000,
|
||||
msg: '意外基本保险金额最低为50000元,超过最低基本保险金额为1000元整数倍'
|
||||
},
|
||||
410805: {
|
||||
msg: '轨道列车意外基本保险金额最低为10000元,超过最低基本保险金额为1000元整数倍,并且小于等于意外基本保险金额的5倍'
|
||||
},
|
||||
410801: {
|
||||
msg: '客运汽车意外基本保险金额最低为10000元,超过最低基本保险金额为1000元整数倍,并且小于等于意外基本保险金额的5倍'
|
||||
},
|
||||
410802: {
|
||||
msg: '客运轮船意外基本保险金额最低为10000元,超过最低基本保险金额为1000元整数倍,并且小于等于意外基本保险金额的5倍'
|
||||
},
|
||||
410803: {
|
||||
msg: '客运民航班机意外基本保险金额最低为10000元,超过最低基本保险金额为1000元整数倍,并且小于等于意外基本保险金额的10倍'
|
||||
},
|
||||
410804: {
|
||||
msg: '自驾车意外基本保险金额最低为10000元,超过最低基本保险金额为1000元整数倍,并且小于等于意外基本保险金额的5倍'
|
||||
},
|
||||
410806: {
|
||||
min: 2000,
|
||||
msg: '意外伤害医疗基本保险金额最低为2000元,超过最低基本保险金额为1000元整数倍,并且小于等于意外基本保险金额的1/5倍'
|
||||
},
|
||||
410807: {
|
||||
min: 10,
|
||||
mutiple: 10,
|
||||
msg: '意外住院津贴日额最低基本保险金额为10元/天,超过最低基本保险金额为10元/天整数倍,最高不得超过200元/天'
|
||||
}
|
||||
}
|
||||
const DUTY_DEFAULT_MUTIPLE = 1000
|
||||
const DUTY_DEFAULT_MIN = 10000
|
||||
|
||||
export default {
|
||||
name: 'calculatePremium',
|
||||
components: {
|
||||
@@ -316,6 +354,9 @@ export default {
|
||||
this.mult = Math.ceil(Number(i.displayAmount) / Number(i.defaultValue))
|
||||
})
|
||||
}
|
||||
|
||||
//保存险种编号
|
||||
this.mainRiskCode = item.mainRiskCode
|
||||
})
|
||||
//GFRS_M0005和GFRS_M0016两个产品需要展示免赔额和赔付比例,并需要根据是否有社保调整数值
|
||||
let mainRiskCode = chooseProducts[0].mainRiskCode
|
||||
@@ -381,6 +422,9 @@ export default {
|
||||
},
|
||||
// 责任保额份数变化
|
||||
dutyStepperChange(value, productIndex, calFactorIndex, dutyItemIndex, isChecked, min, max) {
|
||||
//这个险种使用其他验证方式
|
||||
if (this.mainRiskCode === 'GFRS_M0016') return
|
||||
|
||||
let currentEle = this.chooseProducts[productIndex].calFactorLst[calFactorIndex].rules[dutyItemIndex]
|
||||
if (value < min || value > max) {
|
||||
this.$toast(localStorage.hint)
|
||||
@@ -478,6 +522,8 @@ export default {
|
||||
},
|
||||
// 交通责任险复选框变化
|
||||
changeChecked(productIndex, calFactorIndex, dutyItemIndex) {
|
||||
|
||||
|
||||
let isChecked = this.chooseProducts[productIndex].calFactorLst[calFactorIndex].rules.some(item => {
|
||||
return item.necess == true
|
||||
})
|
||||
@@ -490,12 +536,44 @@ export default {
|
||||
this.mainRiskInfluenceAddRisk()
|
||||
this.getTrial()
|
||||
},
|
||||
valiCheckbox(dutyItem) {
|
||||
//验证责任
|
||||
let inputValue = dutyItem.defaultDutyAmt,
|
||||
duty = dutyItem.duty
|
||||
if (this.mainRiskCode === 'GFRS_M0016' && !this.valiDuty(inputValue, duty)) {
|
||||
//验证不通过
|
||||
return
|
||||
} else {
|
||||
dutyItem.necess = !dutyItem.necess
|
||||
}
|
||||
},
|
||||
// 计步器聚焦
|
||||
focusStep() {
|
||||
this.nextStepFlag = true
|
||||
},
|
||||
blurStep() {
|
||||
blurStep(args, duty) {
|
||||
this.nextStepFlag = false
|
||||
|
||||
//失去焦点时做验证
|
||||
const value = Number(args[0].target.value)
|
||||
this.valiDuty(value, duty)
|
||||
},
|
||||
//险种GFRS_M0016的责任的验证规则
|
||||
valiDuty(value, duty) {
|
||||
if (this.mainRiskCode === 'GFRS_M0016') {
|
||||
value *= 10000
|
||||
const rule = dutyRules[duty]
|
||||
const mutiple = rule.mutiple || DUTY_DEFAULT_MUTIPLE
|
||||
const min = rule.min || DUTY_DEFAULT_MIN
|
||||
if (!value || value < min || value % mutiple !== 0) {
|
||||
this.$toast(rule.msg)
|
||||
this.nextStepFlag = true
|
||||
return false
|
||||
} else {
|
||||
this.nextStepFlag = false
|
||||
return true
|
||||
}
|
||||
}
|
||||
},
|
||||
/********start 通用规则、特殊规则处理 start******/
|
||||
//通用规则1:交费方式为一次交情,无交费期限
|
||||
@@ -1003,6 +1081,22 @@ export default {
|
||||
},
|
||||
//下一步
|
||||
async nextStep() {
|
||||
//GFRS_M0016需要验证责任
|
||||
if (this.mainRiskCode === 'GFRS_M0016') {
|
||||
let calFactorLst = this.chooseProducts[0].calFactorLst
|
||||
for (let i = 0; i < calFactorLst.length; i++) {
|
||||
if (calFactorLst[i].code === 'dutyGroup') {
|
||||
let duties = calFactorLst[i].rules
|
||||
for(let j = 0; j < duties.length; j++) {
|
||||
let item = duties[j]
|
||||
if (!this.valiDuty(item.defaultDutyAmt, item.duty)) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//组装险种提交数据
|
||||
let [mainRiskCode, riskDTOLst] = ['', []]
|
||||
let rollInResult = '' //校验预计转入保费结果
|
||||
@@ -1127,13 +1221,13 @@ export default {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
chooseProducts: {
|
||||
deep: true,
|
||||
handler: function(newVal) {
|
||||
// console.log('xin', newVal)
|
||||
this.chooseProducts = newVal
|
||||
}
|
||||
}
|
||||
// chooseProducts: {
|
||||
// deep: true,
|
||||
// handler: function(newVal) {
|
||||
// // console.log('xin', newVal)
|
||||
// this.chooseProducts = newVal
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1151,5 +1245,12 @@ export default {
|
||||
/deep/.van-action-sheet__name {
|
||||
font-size: 12px;
|
||||
}
|
||||
.checkbox-click {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
width: 7.46667vw;
|
||||
height: 7.46667vw;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user