mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-10 06:56:44 +08:00
Merge branch 'feature/【保全】' into dev
This commit is contained in:
@@ -32,7 +32,7 @@
|
|||||||
</p>
|
</p>
|
||||||
<p class="mt10">
|
<p class="mt10">
|
||||||
<span class="c-gray-dark">受益份额</span>
|
<span class="c-gray-dark">受益份额</span>
|
||||||
<span class="ml35">{{ item.bnfLot }}%</span>
|
<span class="ml35">{{ parseInt(item.bnfLot) }}%</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
@@ -102,17 +102,13 @@ export default {
|
|||||||
created() {
|
created() {
|
||||||
// 获取保单列表存储的数据
|
// 获取保单列表存储的数据
|
||||||
this.insuredName = this.policy.insuredName
|
this.insuredName = this.policy.insuredName
|
||||||
for (let i of this.policy.bnfDTOs) {
|
|
||||||
if (i.isNewInfo == '0') {
|
|
||||||
return (this.type = i.isLegal == '0' ? '2' : '1')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
await this.init()
|
await this.init()
|
||||||
this.beneficiaries = this.policy.bnfDTOs.filter(v => {
|
this.beneficiaries = this.beneficiaries.filter(v => {
|
||||||
return v.isNewInfo == '0' && v.isLegal == '0'
|
return v.isNewInfo == '0' && v.isLegal == '0'
|
||||||
})
|
})
|
||||||
|
this.type = this.beneficiaries.length > '0' ? '2' : '1'
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
//详情
|
//详情
|
||||||
@@ -205,6 +201,9 @@ export default {
|
|||||||
}
|
}
|
||||||
changeEdor(data).then(res => {
|
changeEdor(data).then(res => {
|
||||||
if (res.result == 0) {
|
if (res.result == 0) {
|
||||||
|
if (localStorage['fromAddBC']) {
|
||||||
|
localStorage.removeItem('fromAddBC')
|
||||||
|
}
|
||||||
this.$jump({
|
this.$jump({
|
||||||
flag: 'h5',
|
flag: 'h5',
|
||||||
extra: {
|
extra: {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<!-- 受益人列表 -->
|
<!-- 受益人列表 -->
|
||||||
<div class="fs14 beneficiary-list" v-if="type == 2">
|
<div class="fs14 beneficiary-list" v-if="type == 2">
|
||||||
<ul>
|
<ul>
|
||||||
<li class="ph15 item" v-for="(item, index) in beneficiaries" :key="index">
|
<li class="ph15 item" v-for="(item, index) in beneficiariesNew" :key="index">
|
||||||
<div class="bg-white p15" v-if="item.name">
|
<div class="bg-white p15" v-if="item.name">
|
||||||
<div class="flex justify-content-s c-gray-darker">
|
<div class="flex justify-content-s c-gray-darker">
|
||||||
<div>
|
<div>
|
||||||
@@ -58,6 +58,7 @@
|
|||||||
import { RadioGroup, Radio, Icon, Dialog } from 'vant'
|
import { RadioGroup, Radio, Icon, Dialog } from 'vant'
|
||||||
import { changeEdor, policyInfo } from '@/api/ebiz/preserve/preserve'
|
import { changeEdor, policyInfo } from '@/api/ebiz/preserve/preserve'
|
||||||
import filters from '@/views/ebiz/preserve/filters'
|
import filters from '@/views/ebiz/preserve/filters'
|
||||||
|
import businessCommon from '../js/business-common'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'BeneficiaryInfo',
|
name: 'BeneficiaryInfo',
|
||||||
@@ -75,10 +76,9 @@ export default {
|
|||||||
isDisType: false,
|
isDisType: false,
|
||||||
policy: null,
|
policy: null,
|
||||||
customerInfo: {}, //客户详情
|
customerInfo: {}, //客户详情
|
||||||
insuredInfo: {}, //被保险人信息
|
|
||||||
appntInfo: {}, //投保人信息
|
|
||||||
insuredName: '', //被保险人
|
insuredName: '', //被保险人
|
||||||
beneficiaries: [] // 指定受益人列表
|
beneficiariesOld: [], // 变更前指定受益人列表
|
||||||
|
beneficiariesNew: [] // 变更后指定受益人列表
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
@@ -86,8 +86,9 @@ export default {
|
|||||||
this.customerInfo = JSON.parse(localStorage['preserve-customerInfo']) //客户详情
|
this.customerInfo = JSON.parse(localStorage['preserve-customerInfo']) //客户详情
|
||||||
this.policy = JSON.parse(localStorage['preserve-policy'])
|
this.policy = JSON.parse(localStorage['preserve-policy'])
|
||||||
if (localStorage.fromAddBC) {
|
if (localStorage.fromAddBC) {
|
||||||
this.beneficiaries = this.policy.bnfDTOs
|
this.beneficiariesNew = this.policy.bnfDTOs.beneficiariesNew
|
||||||
this.type = this.beneficiaries.some(i => {
|
this.beneficiariesOld = this.policy.bnfDTOs.beneficiariesOld
|
||||||
|
this.type = this.beneficiariesNew.some(i => {
|
||||||
//isLegal:法定标记 1-是法定受益人 0-是指定受益人
|
//isLegal:法定标记 1-是法定受益人 0-是指定受益人
|
||||||
return i.isNewInfo == '0' && i.isLegal == '0' //新增受益人存在指定受益人
|
return i.isNewInfo == '0' && i.isLegal == '0' //新增受益人存在指定受益人
|
||||||
})
|
})
|
||||||
@@ -95,11 +96,14 @@ export default {
|
|||||||
: '1'
|
: '1'
|
||||||
} else {
|
} else {
|
||||||
await this.getPolicyInfo()
|
await this.getPolicyInfo()
|
||||||
this.type = this.beneficiaries.some(i => {
|
this.type = this.beneficiariesOld.some(i => {
|
||||||
return i.isNewInfo == '1' && i.isLegal == '0' //初始化受益人存在指定受益人
|
return i.isNewInfo == '1' && i.isLegal == '0' //初始化受益人存在指定受益人
|
||||||
})
|
})
|
||||||
? '2'
|
? '2'
|
||||||
: '1'
|
: '1'
|
||||||
|
if (this.type == '1') {
|
||||||
|
this.beneficiariesNew = []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.insuredName = this.policy.insuredName
|
this.insuredName = this.policy.insuredName
|
||||||
if (this.type == 2) {
|
if (this.type == 2) {
|
||||||
@@ -121,17 +125,16 @@ export default {
|
|||||||
policyInfo(data).then(
|
policyInfo(data).then(
|
||||||
res => {
|
res => {
|
||||||
if (res.result == '0') {
|
if (res.result == '0') {
|
||||||
this.beneficiaries = res.content.cont.bcBnfList
|
res.content.cont.bcBnfList.forEach(item => {
|
||||||
this.riskList = res.content.cont.riskList
|
//isNewInfo 是否新信息 0-是 1-否
|
||||||
this.insuredInfo = res.content.cont.insuredList[0]
|
|
||||||
this.appntInfo = res.content.cont.appnt
|
|
||||||
this.policy.appntInfo = this.appntInfo
|
|
||||||
this.policy.insuredInfo = this.insuredInfo
|
|
||||||
localStorage['preserve-policy'] = JSON.stringify(this.policy)
|
|
||||||
//isNewInfo 是否新信息 0-是 1-否
|
|
||||||
this.beneficiaries.forEach(item => {
|
|
||||||
item.isNewInfo = '1'
|
item.isNewInfo = '1'
|
||||||
})
|
})
|
||||||
|
this.beneficiariesOld = [...res.content.cont.bcBnfList]
|
||||||
|
this.beneficiariesNew = [...res.content.cont.bcBnfList]
|
||||||
|
this.riskList = res.content.cont.riskList
|
||||||
|
this.policy.appntInfo = res.content.cont.appnt //投保人信息
|
||||||
|
this.policy.insuredInfo = res.content.cont.insuredList[0] //被保险人信息
|
||||||
|
localStorage['preserve-policy'] = JSON.stringify(this.policy)
|
||||||
resolve()
|
resolve()
|
||||||
} else {
|
} else {
|
||||||
reject(this.$toast(res.content))
|
reject(this.$toast(res.content))
|
||||||
@@ -145,29 +148,33 @@ export default {
|
|||||||
},
|
},
|
||||||
//下一步
|
//下一步
|
||||||
nextStep() {
|
nextStep() {
|
||||||
if (this.type == 2 && this.beneficiaries.length < 1) {
|
if (this.type == 2 && this.beneficiariesNew.length < 1) {
|
||||||
this.$toast('受益人列表不能为空')
|
this.$toast('受益人列表不能为空')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let beneRatio = 0
|
let beneRatio = 0
|
||||||
this.beneficiaries.forEach(item => {
|
this.beneficiariesNew.forEach(item => {
|
||||||
beneRatio += Number(item.bnfLot)
|
beneRatio += Number(item.bnfLot)
|
||||||
})
|
})
|
||||||
if (beneRatio != 100 && this.type == 2) {
|
if (beneRatio != 100 && this.type == 2) {
|
||||||
return (this.dialogShow = true)
|
return (this.dialogShow = true)
|
||||||
}
|
}
|
||||||
|
let beneficiaries = [...this.beneficiariesOld, ...this.beneficiariesNew]
|
||||||
|
beneficiaries = businessCommon.unrepeatObj(beneficiaries, 'idNo')
|
||||||
let feachData = {
|
let feachData = {
|
||||||
platformType: 'app',
|
platformType: 'app',
|
||||||
edorType: 'BC',
|
edorType: 'BC',
|
||||||
operateType: '01',
|
operateType: '01',
|
||||||
bcBnfDTOList: this.beneficiaries
|
bcBnfDTOList: beneficiaries
|
||||||
}
|
}
|
||||||
changeEdor(feachData).then(
|
changeEdor(feachData).then(
|
||||||
res => {
|
res => {
|
||||||
if (res.result == 0) {
|
if (res.result == 0) {
|
||||||
this.policy.bnfDTOs = this.beneficiaries
|
this.policy.bnfDTOs = {
|
||||||
|
beneficiariesOld: this.beneficiariesOld,
|
||||||
|
beneficiariesNew: this.beneficiariesNew
|
||||||
|
}
|
||||||
localStorage['preserve-policy'] = JSON.stringify(this.policy)
|
localStorage['preserve-policy'] = JSON.stringify(this.policy)
|
||||||
localStorage.removeItem('fromAddBC')
|
|
||||||
this.customerInfo.surrenderId = res.content.surrenderId
|
this.customerInfo.surrenderId = res.content.surrenderId
|
||||||
this.customerInfo.edorApplyNo = res.content.edorApplyNo
|
this.customerInfo.edorApplyNo = res.content.edorApplyNo
|
||||||
localStorage.setItem('preserve-customerInfo', JSON.stringify(this.customerInfo))
|
localStorage.setItem('preserve-customerInfo', JSON.stringify(this.customerInfo))
|
||||||
@@ -197,13 +204,16 @@ export default {
|
|||||||
//添加受益人
|
//添加受益人
|
||||||
add() {
|
add() {
|
||||||
let beneRatio = 0
|
let beneRatio = 0
|
||||||
this.beneficiaries.forEach(item => {
|
this.beneficiariesNew.forEach(item => {
|
||||||
beneRatio += parseFloat(item.bnfLot | 0)
|
beneRatio += parseFloat(item.bnfLot | 0)
|
||||||
})
|
})
|
||||||
if (beneRatio >= 100) {
|
if (beneRatio >= 100) {
|
||||||
return this.$toast('受益份额已满~')
|
return this.$toast('受益份额已满~')
|
||||||
}
|
}
|
||||||
this.policy.bnfDTOs = this.beneficiaries
|
this.policy.bnfDTOs = {
|
||||||
|
beneficiariesOld: this.beneficiariesOld,
|
||||||
|
beneficiariesNew: this.beneficiariesNew
|
||||||
|
}
|
||||||
this.checkIsDetail(this.riskList)
|
this.checkIsDetail(this.riskList)
|
||||||
localStorage['preserve-policy'] = JSON.stringify(this.policy)
|
localStorage['preserve-policy'] = JSON.stringify(this.policy)
|
||||||
this.$jump({
|
this.$jump({
|
||||||
@@ -227,8 +237,11 @@ export default {
|
|||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// 删除页面中的对应数据
|
// 删除页面中的对应数据
|
||||||
this.beneficiaries.splice(index, 1)
|
this.beneficiariesNew.splice(index, 1)
|
||||||
this.policy.bnfDTOs = this.beneficiaries
|
this.policy.bnfDTOs = {
|
||||||
|
beneficiariesOld: this.beneficiariesOld,
|
||||||
|
beneficiariesNew: this.beneficiariesNew
|
||||||
|
}
|
||||||
localStorage['preserve-policy'] = JSON.stringify(this.policy)
|
localStorage['preserve-policy'] = JSON.stringify(this.policy)
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
@@ -237,7 +250,10 @@ export default {
|
|||||||
},
|
},
|
||||||
// 编辑受益人
|
// 编辑受益人
|
||||||
editBeneficiary(index) {
|
editBeneficiary(index) {
|
||||||
this.policy.bnfDTOs = this.beneficiaries
|
this.policy.bnfDTOs = {
|
||||||
|
beneficiariesOld: this.beneficiariesOld,
|
||||||
|
beneficiariesNew: this.beneficiariesNew
|
||||||
|
}
|
||||||
this.checkIsDetail(this.riskList)
|
this.checkIsDetail(this.riskList)
|
||||||
localStorage['preserve-policy'] = JSON.stringify(this.policy)
|
localStorage['preserve-policy'] = JSON.stringify(this.policy)
|
||||||
let path = '/preserve/bc/BeneficiaryInfoAdd?edit=' + index
|
let path = '/preserve/bc/BeneficiaryInfoAdd?edit=' + index
|
||||||
|
|||||||
@@ -101,16 +101,7 @@
|
|||||||
<van-checkbox v-model="userInfo.effectiveDateType" class="fr" :disabled="effectiveDateTypeAble" @change="effectiveDataTypeChange">长期</van-checkbox>
|
<van-checkbox v-model="userInfo.effectiveDateType" class="fr" :disabled="effectiveDateTypeAble" @change="effectiveDataTypeChange">长期</van-checkbox>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<van-field
|
<van-field v-model="userInfo.bnfOrder" required readonly label="受益顺序" name="受益顺序" placeholder="请输入" maxlength="1" />
|
||||||
v-model="userInfo.bnfOrder"
|
|
||||||
required
|
|
||||||
readonly
|
|
||||||
label="受益顺序"
|
|
||||||
name="受益顺序"
|
|
||||||
placeholder="请输入"
|
|
||||||
v-validate="'required|onlyNumber'"
|
|
||||||
maxlength="1"
|
|
||||||
/>
|
|
||||||
<van-field
|
<van-field
|
||||||
v-model="userInfo.bnfLot"
|
v-model="userInfo.bnfLot"
|
||||||
label="受益比例(%)"
|
label="受益比例(%)"
|
||||||
@@ -287,16 +278,19 @@ export default {
|
|||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.policy = JSON.parse(localStorage['preserve-policy'])
|
this.policy = JSON.parse(localStorage['preserve-policy'])
|
||||||
this.bnfDTOs = this.policy.bnfDTOs
|
this.bnfDTOs = this.policy.bnfDTOs.beneficiariesNew
|
||||||
this.isDetailFlag = this.policy.isDetailFlag
|
this.isDetailFlag = this.policy.isDetailFlag
|
||||||
this.bnfDTOs.map(i => {
|
if (this.bnfDTOs.length > 0) {
|
||||||
if (i.idExpDate == '9999-01-01') {
|
this.bnfDTOs.map(i => {
|
||||||
i.effectiveDateType = true
|
if (i.idExpDate == '9999-01-01') {
|
||||||
}
|
i.effectiveDateType = true
|
||||||
})
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
if (this.$route.query.edit) {
|
if (this.$route.query.edit) {
|
||||||
this.editIndex = this.$route.query.edit
|
this.editIndex = this.$route.query.edit
|
||||||
this.userInfo = this.bnfDTOs[this.$route.query.edit]
|
this.userInfo = this.bnfDTOs[this.$route.query.edit]
|
||||||
|
this.userInfo.isNewInfo = '0'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {},
|
mounted() {},
|
||||||
@@ -546,8 +540,8 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.bnfDTOs[this.editIndex] = this.userInfo
|
this.bnfDTOs[this.editIndex] = this.userInfo
|
||||||
}
|
}
|
||||||
this.policy.bnfDTOs = this.bnfDTOs
|
this.policy.bnfDTOs.beneficiariesNew = this.bnfDTOs
|
||||||
this.policy.bnfDTOs.map(i => {
|
this.policy.bnfDTOs.beneficiariesNew.map(i => {
|
||||||
if (i.effectiveDateType) {
|
if (i.effectiveDateType) {
|
||||||
i.idExpDate = '9999-01-01'
|
i.idExpDate = '9999-01-01'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,85 +3,40 @@
|
|||||||
<!-- 基本信息 -->
|
<!-- 基本信息 -->
|
||||||
<van-cell-group>
|
<van-cell-group>
|
||||||
<van-field
|
<van-field
|
||||||
:value="userInfo.relationToInsured | idToText('relationToAppnt')"
|
:value="userInfo.relationToInsured | idToText('edorRelationToAppnt')"
|
||||||
required
|
required
|
||||||
readonly
|
readonly
|
||||||
label="是被保险人的"
|
label="是被保险人的"
|
||||||
name="是被保险人的"
|
name="是被保险人的"
|
||||||
right-icon="arrow"
|
right-icon="arrow"
|
||||||
placeholder="请选择"
|
|
||||||
v-validate="'required'"
|
|
||||||
/>
|
/>
|
||||||
<customer-picker
|
<van-field name="姓名" label="姓名" required :value.sync="userInfo.name" readonly></van-field>
|
||||||
v-validate="'required|name'"
|
|
||||||
name="姓名"
|
|
||||||
label="姓名"
|
|
||||||
required
|
|
||||||
:value.sync="userInfo.name"
|
|
||||||
:parentShowPicker.sync="customerShowPicker"
|
|
||||||
readonly
|
|
||||||
></customer-picker>
|
|
||||||
<van-field
|
|
||||||
:value="userInfo.idType | idToText('idType')"
|
|
||||||
v-validate="'required'"
|
|
||||||
readonly
|
|
||||||
required
|
|
||||||
label="证件类型"
|
|
||||||
name="证件类型"
|
|
||||||
right-icon="arrow"
|
|
||||||
placeholder="请选择"
|
|
||||||
/>
|
|
||||||
<van-field
|
|
||||||
v-model="userInfo.idNo"
|
|
||||||
label="证件号码"
|
|
||||||
name="证件号码"
|
|
||||||
required
|
|
||||||
readonly
|
|
||||||
placeholder="请输入"
|
|
||||||
maxlength="18"
|
|
||||||
clearable
|
|
||||||
v-validate="'required'"
|
|
||||||
></van-field>
|
|
||||||
<!-- <FieldDatePicter
|
|
||||||
:v-validate="{ required: effectiveDateRequired }"
|
|
||||||
label="证件起始日期"
|
|
||||||
name="证件起始日期"
|
|
||||||
:required="isRequired"
|
|
||||||
:defaultDate="new Date()"
|
|
||||||
:value.sync="userInfo.certificateValidate"
|
|
||||||
type="date"
|
|
||||||
@confirm="onDateConfirm($event, '1')"
|
|
||||||
ref="certificateValidate"
|
|
||||||
:flag="certificateValidateShow"
|
|
||||||
:readonly="idLimit"
|
|
||||||
></FieldDatePicter> -->
|
|
||||||
<FieldDatePicter
|
|
||||||
:v-validate="{ required: effectiveDateRequired }"
|
|
||||||
label="证件截止日期"
|
|
||||||
name="证件截止日期"
|
|
||||||
:required="isRequired"
|
|
||||||
:defaultDate="new Date()"
|
|
||||||
:value.sync="userInfo.effectiveDate"
|
|
||||||
type="date"
|
|
||||||
@confirm="onDateConfirm($event, '1')"
|
|
||||||
ref="effectiveDate"
|
|
||||||
:flag="effectiveDateShow"
|
|
||||||
readonly
|
|
||||||
></FieldDatePicter>
|
|
||||||
<div class="border-bt relative fs14 p10 flex align-center">
|
|
||||||
<van-checkbox v-model="userInfo.effectiveDateType" class="fr" :disabled="true">长期</van-checkbox>
|
|
||||||
</div>
|
|
||||||
<select-radio :radios="sexRadio" disabled required label="性别" :value.sync="userInfo.sex"></select-radio>
|
<select-radio :radios="sexRadio" disabled required label="性别" :value.sync="userInfo.sex"></select-radio>
|
||||||
<van-field
|
<van-field
|
||||||
:value="userInfo.nationality | idToText('nativeplace')"
|
:value="userInfo.nativeplace | idToText('edorNativeplace')"
|
||||||
readonly
|
readonly
|
||||||
label="国家/地区"
|
label="国家/地区"
|
||||||
name="国家/地区"
|
name="国家/地区"
|
||||||
required
|
required
|
||||||
v-validate="'required'"
|
v-validate="'required'"
|
||||||
right-icon="arrow"
|
right-icon="arrow"
|
||||||
placeholder="请选择"
|
|
||||||
/>
|
/>
|
||||||
|
<van-field label="出生日期" name="出生日期" required readonly right-icon="arrow" :value.sync="userInfo.birthday"></van-field>
|
||||||
|
<van-field v-model="userInfo.idNo" label="证件号码" name="证件号码" required readonly maxlength="18" clearable v-validate="'required'"></van-field>
|
||||||
|
<van-field right-icon="arrow" :value="userInfo.idType | idToText('edorIdType')" readonly required label="证件类型" name="证件类型" />
|
||||||
|
<van-field
|
||||||
|
label="证件截止日期"
|
||||||
|
name="证件截止日期"
|
||||||
|
required
|
||||||
|
:value.sync="userInfo.idExpDate == '9999-01-01' ? '' : userInfo.idExpDate"
|
||||||
|
readonly
|
||||||
|
right-icon="arrow"
|
||||||
|
></van-field>
|
||||||
|
|
||||||
|
<div class="border-bt relative fs14 p10 flex align-center">
|
||||||
|
<van-checkbox v-model="userInfo.effectiveDateType" class="fr" :disabled="true">长期</van-checkbox>
|
||||||
|
</div>
|
||||||
<van-field
|
<van-field
|
||||||
v-model="userInfo.bnfOrder"
|
v-model="userInfo.bnfOrder"
|
||||||
required
|
required
|
||||||
@@ -104,31 +59,20 @@
|
|||||||
clearable
|
clearable
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<template v-if="false">
|
<template v-if="isDetailFlag == '0'">
|
||||||
<van-field
|
<van-field
|
||||||
v-model="userInfo.mobile"
|
v-model="userInfo.phone"
|
||||||
clearable
|
clearable
|
||||||
label="联系电话"
|
label="联系电话"
|
||||||
name="联系电话"
|
name="联系电话"
|
||||||
required
|
required
|
||||||
readonly
|
|
||||||
placeholder="请输入"
|
placeholder="请输入"
|
||||||
v-validate="'required|mobile'"
|
v-validate="'required|mobile'"
|
||||||
maxlength="11"
|
maxlength="11"
|
||||||
/>
|
/>
|
||||||
<van-field
|
<van-field v-model="areaName" readonly label="联系地址" right-icon="arrow" name="联系地址" required v-validate="'required'" @click="chooseArea" />
|
||||||
v-model="areaName"
|
<van-field v-model="userInfo.postalAddress" readonly label="" name="详细地址" placeholder="请输入详细地址" v-validate="'required'" clearable readonly />
|
||||||
readonly
|
<van-field v-model="userInfo.email" required label="电子邮箱" name="电子邮箱" placeholder="请输入" v-validate="'required|email'" clearable />
|
||||||
label="联系地址"
|
|
||||||
name="联系地址"
|
|
||||||
required
|
|
||||||
right-icon="arrow"
|
|
||||||
placeholder="请选择"
|
|
||||||
v-validate="'required'"
|
|
||||||
@click="chooseArea"
|
|
||||||
/>
|
|
||||||
<van-field v-model="userInfo.village" label="" readonly name="详细地址" placeholder="请输入详细地址" v-validate="'required'" clearable maxlength="30" />
|
|
||||||
<van-field v-model="userInfo.email" required readonly label="电子邮箱" name="电子邮箱" placeholder="请输入" v-validate="'required|email'" clearable />
|
|
||||||
<occupation-picker
|
<occupation-picker
|
||||||
:value.sync="userInfo.occupationCode"
|
:value.sync="userInfo.occupationCode"
|
||||||
:chooseName.sync="userInfo.occupationName"
|
:chooseName.sync="userInfo.occupationName"
|
||||||
@@ -139,12 +83,16 @@
|
|||||||
name="职业类别"
|
name="职业类别"
|
||||||
required
|
required
|
||||||
v-validate="'required'"
|
v-validate="'required'"
|
||||||
placeholder="请选择"
|
|
||||||
readonly
|
readonly
|
||||||
:parentShowPicker.sync="occupationShowPicker"
|
:parentShowPicker.sync="occupationShowPicker"
|
||||||
@on-choose="chooseOccupation"
|
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
<!-- <div>
|
||||||
|
<van-cell-group>
|
||||||
|
<van-field required class="365" label="受益人证件" disabled />
|
||||||
|
</van-cell-group>
|
||||||
|
<van-uploader name="fileList" v-model="fileList" class="mt10 ml20" />
|
||||||
|
</div> -->
|
||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -154,16 +102,11 @@ import { Field, CellGroup, Checkbox, Popup, Picker, Area } from 'vant'
|
|||||||
import SelectRadio from '@/components/ebiz/SelectRadio'
|
import SelectRadio from '@/components/ebiz/SelectRadio'
|
||||||
import FieldDatePicter from '@/components/ebiz/FieldDatePicter'
|
import FieldDatePicter from '@/components/ebiz/FieldDatePicter'
|
||||||
import OccupationPicker from '@/components/ebiz/occipation/OccupationPicker'
|
import OccupationPicker from '@/components/ebiz/occipation/OccupationPicker'
|
||||||
import DataDictionary from '@/assets/js/utils/data-dictionary'
|
|
||||||
import areaList from '@/assets/js/utils/area'
|
import areaList from '@/assets/js/utils/area'
|
||||||
import getAreaName from '@/assets/js/utils/get-area-name'
|
|
||||||
import utilsAge from '@/assets/js/utils/age'
|
|
||||||
import IdentityCardScan from '@/components/ebiz/sale/IdentityCardScan'
|
import IdentityCardScan from '@/components/ebiz/sale/IdentityCardScan'
|
||||||
import CustomerPicker from '@/components/ebiz/customer/CustomerPicker'
|
import CustomerPicker from '@/components/ebiz/customer/CustomerPicker'
|
||||||
import idNoCheck from '@/assets/js/utils/idNoCheck'
|
import filters from '@/views/ebiz/preserve/filters'
|
||||||
import { idToData } from '../js/verification'
|
import getAreaName from '@/views/ebiz/preserve/js/utils/get-area-name'
|
||||||
import { selectComp } from '../js/methods'
|
|
||||||
let relationToInsured = DataDictionary.relationToAppnt
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'beneficiaryInfoAdd',
|
name: 'beneficiaryInfoAdd',
|
||||||
@@ -182,8 +125,6 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
effectiveDateTypeAble: true, //长期按钮是否禁用
|
|
||||||
isScan: false, //是否显示证件扫描组件
|
|
||||||
sexRadio: [
|
sexRadio: [
|
||||||
{
|
{
|
||||||
label: '男',
|
label: '男',
|
||||||
@@ -194,79 +135,57 @@ export default {
|
|||||||
value: '1'
|
value: '1'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
currentPopupIndex: '',
|
isDetailFlag: '',
|
||||||
relationToAppnt: '',
|
|
||||||
popupShow: false,
|
|
||||||
areaShow: false,
|
|
||||||
pickerType: undefined,
|
|
||||||
columns: [],
|
|
||||||
valueKey: 'text',
|
|
||||||
nationality: '',
|
|
||||||
idType: '居民身份证',
|
|
||||||
degree: '',
|
|
||||||
socialSecurity: '',
|
|
||||||
taxIdentity: '',
|
|
||||||
areaName: '',
|
areaName: '',
|
||||||
areaValue: '110101',
|
|
||||||
effectiveDateRequired: true, //证件截止日期是否需要校验
|
effectiveDateRequired: true, //证件截止日期是否需要校验
|
||||||
effectiveDateShow: true, //证件截止日期是否可以选择
|
effectiveDateShow: true, //证件截止日期是否可以选择
|
||||||
marriage: '',
|
|
||||||
isRequired: '', //长期前是否有*
|
isRequired: '', //长期前是否有*
|
||||||
userInfo: {
|
userInfo: {
|
||||||
bnfId: '',
|
bnfType: '1', //受益人类别 0-生存受益人 1-身故受益人
|
||||||
bnfType: '2',
|
isLegal: '0', //1-法定受益人 0-指定受益人
|
||||||
|
// bnfNo: '1',
|
||||||
|
relationToInsured: '', //受益人和被保人关系
|
||||||
|
bnfOrder: '1',
|
||||||
bnfGrade: '',
|
bnfGrade: '',
|
||||||
name: '',
|
name: '',
|
||||||
sex: '0',
|
sex: '0',
|
||||||
nationality: '1',
|
isNewInfo: '0', //是否是新信息 0-是 1-否
|
||||||
birthday: '',
|
|
||||||
idType: '1',
|
idType: '1',
|
||||||
idNo: '',
|
idNo: '',
|
||||||
certificateValidate: '',
|
idExpDate: '', //证件截止日期
|
||||||
effectiveDate: '',
|
|
||||||
effectiveDateType: false, //是否长期
|
|
||||||
bnfNo: '1',
|
|
||||||
bnfOrder: 1,
|
|
||||||
bnfLot: '',
|
|
||||||
phone: '',
|
phone: '',
|
||||||
|
birthday: '',
|
||||||
|
nativeplace: '1',
|
||||||
|
email: '',
|
||||||
province: '',
|
province: '',
|
||||||
city: '',
|
city: '',
|
||||||
area: '',
|
postalAddress: '', //详细地址
|
||||||
postalAddress: '',
|
|
||||||
email: '',
|
|
||||||
occupationCode: '',
|
occupationCode: '',
|
||||||
occupationName: '' // 职业中文
|
occupationType: '',
|
||||||
|
occupationName: '',
|
||||||
|
area: '',
|
||||||
|
bnfLot: '', //受益比例
|
||||||
|
effectiveDateType: false //是否长期
|
||||||
},
|
},
|
||||||
areaList: areaList,
|
areaList: areaList,
|
||||||
occupationShowPicker: false,
|
occupationShowPicker: false,
|
||||||
customerShowPicker: false, //客户列表展示
|
customerShowPicker: false, //客户列表展示
|
||||||
idLimit: false, //证件起止日期是否只读
|
idLimit: false, //证件起止日期是否只读
|
||||||
policy: null,
|
policy: JSON.parse(localStorage['preserve-policy']),
|
||||||
bnfDTOs: []
|
fileList: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.policy = JSON.parse(localStorage['preserve-policy'])
|
this.isDetailFlag = this.policy.isDetailFlag
|
||||||
this.bnfDTOs = this.policy.bnfDTOs.filter(i => {
|
|
||||||
return i.isNewInfo == '0'
|
|
||||||
})
|
|
||||||
if (this.$route.query.edit) {
|
if (this.$route.query.edit) {
|
||||||
this.editIndex = this.$route.query.edit
|
this.editIndex = this.$route.query.edit
|
||||||
this.userInfo = this.bnfDTOs[this.$route.query.edit]
|
this.userInfo = this.policy.bnfDTOs.beneficiariesNew[this.$route.query.edit]
|
||||||
|
this.userInfo.effectiveDateType = this.userInfo.idExpDate == '9999-01-01' ? true : false
|
||||||
}
|
}
|
||||||
|
this.areaName = getAreaName([{ code: this.userInfo.province }, { code: this.userInfo.city }, { code: this.userInfo.area }])
|
||||||
},
|
},
|
||||||
mounted() {},
|
mounted() {},
|
||||||
methods: {
|
methods: {
|
||||||
chooseOccupation() {
|
|
||||||
this.$jump({
|
|
||||||
flag: 'navigation',
|
|
||||||
extra: {
|
|
||||||
title: '指定受益人信息',
|
|
||||||
hiddenRight: '1'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
this.occupationShowPicker = false
|
|
||||||
},
|
|
||||||
//时间戳格式处理
|
//时间戳格式处理
|
||||||
timeStampFormat(timeStamp) {
|
timeStampFormat(timeStamp) {
|
||||||
let date = new Date(timeStamp)
|
let date = new Date(timeStamp)
|
||||||
@@ -277,6 +196,9 @@ export default {
|
|||||||
day = day.toString().padStart(2, '0')
|
day = day.toString().padStart(2, '0')
|
||||||
return `${year}-${month}-${day}`
|
return `${year}-${month}-${day}`
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
filters: {
|
||||||
|
idToText: filters.idToText
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -102,8 +102,8 @@
|
|||||||
maxlength="200"
|
maxlength="200"
|
||||||
name="其他退保原因"
|
name="其他退保原因"
|
||||||
placeholder="请输入其他退保原因"
|
placeholder="请输入其他退保原因"
|
||||||
v-validate="surrenderReasonType == '6' ? 'required' : ''"
|
v-validate="surrenderReasonType == '06' ? 'required' : ''"
|
||||||
v-if="surrenderReasonType == '6'"
|
v-if="surrenderReasonType == '06'"
|
||||||
/>
|
/>
|
||||||
</van-col>
|
</van-col>
|
||||||
</van-row>
|
</van-row>
|
||||||
|
|||||||
534
src/views/ebiz/preserve/js/business-common.js
Normal file
534
src/views/ebiz/preserve/js/business-common.js
Normal file
@@ -0,0 +1,534 @@
|
|||||||
|
// import utilsAge from '@/assets/js/utils/age'
|
||||||
|
/**
|
||||||
|
* @desc 扩展对象继承
|
||||||
|
* @param {Object} out 一个或多个对象
|
||||||
|
* @return {Object} 对象
|
||||||
|
*/
|
||||||
|
Object.extend = function(out) {
|
||||||
|
out = out || {}
|
||||||
|
for (var i = 1; i < arguments.length; i++) {
|
||||||
|
if (!arguments[i]) continue
|
||||||
|
|
||||||
|
for (var key in arguments[i]) {
|
||||||
|
if (arguments[i].hasOwnProperty(key)) out[key] = arguments[i][key]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @desc 时间格式转化
|
||||||
|
* @param {String} format 转化格式
|
||||||
|
* @return {String} 已转化的时间
|
||||||
|
*/
|
||||||
|
Date.prototype.format = function(format) {
|
||||||
|
let args = {
|
||||||
|
'M+': this.getMonth() + 1,
|
||||||
|
'd+': this.getDate(),
|
||||||
|
'h+': this.getHours(),
|
||||||
|
'm+': this.getMinutes(),
|
||||||
|
's+': this.getSeconds(),
|
||||||
|
'q+': Math.floor((this.getMonth() + 3) / 3), // quarter
|
||||||
|
S: this.getMilliseconds()
|
||||||
|
}
|
||||||
|
if (/(y+)/.test(format)) format = format.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length))
|
||||||
|
for (var i in args) {
|
||||||
|
var n = args[i]
|
||||||
|
if (new RegExp('(' + i + ')').test(format)) format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? n : ('00' + n).substr(('' + n).length))
|
||||||
|
}
|
||||||
|
return format
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
/**
|
||||||
|
* @desc 判断对象是否为空
|
||||||
|
* @param {Object} o 对象
|
||||||
|
* @return {Boolean}
|
||||||
|
*/
|
||||||
|
isEmptyObject(o = {}) {
|
||||||
|
let flag = true
|
||||||
|
for (let k in o) {
|
||||||
|
if (k) {
|
||||||
|
flag = false
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return flag
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 去除前后空格
|
||||||
|
* @param {String} 值
|
||||||
|
* @return {String}
|
||||||
|
*/
|
||||||
|
trim(val) {
|
||||||
|
return val.replace(/(^\s*)|(\s*$)/g, '')
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取query特定参数
|
||||||
|
getQueryParameter() {
|
||||||
|
let activityFromApp = this.getQuery().activityFromApp
|
||||||
|
let appUserToken = this.getQuery().appUserToken
|
||||||
|
let env = this.getQuery().env
|
||||||
|
let query = {}
|
||||||
|
if (activityFromApp) {
|
||||||
|
query.activityFromApp = activityFromApp
|
||||||
|
}
|
||||||
|
if (appUserToken) {
|
||||||
|
query.appUserToken = decodeURIComponent(appUserToken.replace(/%20/g, '+'))
|
||||||
|
}
|
||||||
|
if (env) {
|
||||||
|
query.env = env
|
||||||
|
}
|
||||||
|
return query
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 替换字符串具体位置字符
|
||||||
|
* @param {String} str 目标字符串
|
||||||
|
* @param {String} char 字符
|
||||||
|
* @param {Number} start 数组开始索引
|
||||||
|
* @param {Number} end 数组结束索引
|
||||||
|
* @return {[type]} [description]
|
||||||
|
*/
|
||||||
|
replaceChar(str = '', char = '*', start = 0, end) {
|
||||||
|
let list = []
|
||||||
|
if (str) {
|
||||||
|
list = str.split('')
|
||||||
|
let len = list.length
|
||||||
|
start = start > 0 ? (start <= len ? start : len) : 0
|
||||||
|
end = end ? (end > start ? end : start) : len
|
||||||
|
for (let i = 0; i < len; i++) {
|
||||||
|
if (i >= start && i < end) {
|
||||||
|
list[i] = char
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list.join('')
|
||||||
|
},
|
||||||
|
|
||||||
|
addSpace(value) {
|
||||||
|
if (value) {
|
||||||
|
return value.replace(/\s/g, '').replace(/(.{4})/g, '$1 ')
|
||||||
|
}
|
||||||
|
return value
|
||||||
|
},
|
||||||
|
|
||||||
|
// 字符省略
|
||||||
|
ellipsis(value = '', num = -1) {
|
||||||
|
if (value) {
|
||||||
|
let str = ''
|
||||||
|
if (num > 0 && value.length > num) {
|
||||||
|
str = '...'
|
||||||
|
}
|
||||||
|
return value.slice(0, num) + str
|
||||||
|
}
|
||||||
|
return value
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @desc 获取 cookie
|
||||||
|
* @param {String}
|
||||||
|
* @return {*}
|
||||||
|
*/
|
||||||
|
getCookie(name1) {
|
||||||
|
let rs = ''
|
||||||
|
var name = name1 + '='
|
||||||
|
var ca = document.cookie.split(';')
|
||||||
|
for (var i = 0; i < ca.length; i++) {
|
||||||
|
var c = ca[i]
|
||||||
|
while (c.charAt(0) == ' ') {
|
||||||
|
c = c.substring(1)
|
||||||
|
}
|
||||||
|
if (c.indexOf(name) != -1) {
|
||||||
|
rs = this._string2json(c.substring(name.length, c.length))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rs
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @desc 设置 cookie
|
||||||
|
* @param {String} name 名称
|
||||||
|
* @param {*} value 值
|
||||||
|
* @param {Number} hours 时长
|
||||||
|
*/
|
||||||
|
setCookie(name, value, hours) {
|
||||||
|
let str = name + '=' + this._json2string(value)
|
||||||
|
if (hours && hours > 0) {
|
||||||
|
var date = new Date()
|
||||||
|
date.setTime(date.getTime() + hours * 3600 * 1000)
|
||||||
|
str += '; expires=' + date.toUTCString()
|
||||||
|
}
|
||||||
|
document.cookie = str
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @desc 清除 cookie
|
||||||
|
* @param {String} 名称
|
||||||
|
*/
|
||||||
|
delCookie(name) {
|
||||||
|
var date = new Date()
|
||||||
|
date.setTime(date.getTime() - 10000)
|
||||||
|
document.cookie = name + '=a; expires=' + date.toGMTString()
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @desc 获取 localStorage 中指定的变量
|
||||||
|
* @param {String} name 名称
|
||||||
|
* @return {*} rs
|
||||||
|
*/
|
||||||
|
getStorage(name) {
|
||||||
|
return this._string2json(window.localStorage[name])
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @desc 设置或添加 localStorage 中指定的变量
|
||||||
|
* @param {String} name 名称
|
||||||
|
*/
|
||||||
|
setStorage(name, value) {
|
||||||
|
window.localStorage[name] = this._json2string(value)
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @desc 删除 localStorage 中指定的变量
|
||||||
|
* @param {String} name 名称
|
||||||
|
*/
|
||||||
|
delStorage(name) {
|
||||||
|
window.localStorage.removeItem(name)
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @desc json转string
|
||||||
|
* @param {*} value 值
|
||||||
|
* @return {*} value 值
|
||||||
|
*/
|
||||||
|
_json2string(value) {
|
||||||
|
return JSON.stringify(value)
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 获取设备类型
|
||||||
|
*/
|
||||||
|
device() {
|
||||||
|
let ua = navigator.userAgent
|
||||||
|
return {
|
||||||
|
isChrome: ua.match(/Chrome\/([\d.]+)/) || ua.match(/CriOS\/([\d.]+)/),
|
||||||
|
// eslint-disable-next-line no-useless-escape
|
||||||
|
isAndroid: ua.match(/(Android);?[\s\/]+([\d.]+)?/),
|
||||||
|
isIphone: ua.indexOf('iPhone') != -1,
|
||||||
|
isWeixin: ua.match(/MicroMessenger/i)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 设置title
|
||||||
|
*/
|
||||||
|
setTitle(title) {
|
||||||
|
let device = this.device()
|
||||||
|
if (device.isIphone && device.isWeixin) {
|
||||||
|
document.title = title
|
||||||
|
var i = document.createElement('iframe')
|
||||||
|
i.src = '/favicon.ico'
|
||||||
|
i.style.display = 'none'
|
||||||
|
i.onload = function() {
|
||||||
|
setTimeout(function() {
|
||||||
|
i.remove()
|
||||||
|
}, 9)
|
||||||
|
}
|
||||||
|
document.body.appendChild(i)
|
||||||
|
} else {
|
||||||
|
document.title = title
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* @desc string转json
|
||||||
|
* @param {*} value 值
|
||||||
|
* @return {*} value 值
|
||||||
|
*/
|
||||||
|
_string2json(value) {
|
||||||
|
try {
|
||||||
|
value = JSON.parse(value)
|
||||||
|
} catch (e) {
|
||||||
|
//console.log(e)
|
||||||
|
}
|
||||||
|
return value
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
*@desc 只能输入单词字符
|
||||||
|
*@param { String } value
|
||||||
|
*/
|
||||||
|
character(value) {
|
||||||
|
if (value) {
|
||||||
|
value = value.replace(/[^A-Za-z0-9]/g, '')
|
||||||
|
}
|
||||||
|
return value
|
||||||
|
},
|
||||||
|
|
||||||
|
m2km(value) {
|
||||||
|
if (value < 1000) return value + 'm'
|
||||||
|
else if (value >= 1000 && value <= 20000) return (value / 1000).toFixed(1) + 'km'
|
||||||
|
else if (value >= 2000) return '>20km'
|
||||||
|
return value
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 除法
|
||||||
|
* @param {Number} dividend 被除数
|
||||||
|
* @param {Number} divisor 除数
|
||||||
|
* @return {Number} 值
|
||||||
|
*/
|
||||||
|
divide(dividend, divisor = 100) {
|
||||||
|
if (dividend && divisor) {
|
||||||
|
dividend = Number(dividend)
|
||||||
|
return this.toFloatFixed(dividend / divisor)
|
||||||
|
}
|
||||||
|
return dividend
|
||||||
|
},
|
||||||
|
|
||||||
|
// 保留小数位,替代Number.toFixed()方法,针对于某些数据(16.455)不能做到四舍五入
|
||||||
|
toFixed(value, num = 0) {
|
||||||
|
let pos = value.toString().indexOf('.')
|
||||||
|
let decimalPlaces = value.toString().length - pos - 1
|
||||||
|
let intValue = value * Math.pow(10, decimalPlaces)
|
||||||
|
let divisor1 = Math.pow(10, decimalPlaces - num)
|
||||||
|
let divisor2 = Math.pow(10, num)
|
||||||
|
return Math.round(intValue / divisor1) / divisor2
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取App信息
|
||||||
|
*/
|
||||||
|
detectApp() {
|
||||||
|
var ua = navigator.userAgent
|
||||||
|
//RegExp.$1; RegExp.$2; RegExp.$3;
|
||||||
|
//var info = ua.match(/(CarmeApp)\s*[v]*(\d+\.\d+\.\d+)\s*\/\s*(IOS|Android)/i)
|
||||||
|
ua.match(/(CarmeApp)\s*[v]*(\d+\.\d+\.\d+)\s*\/\s*(IOS|Android)/i)
|
||||||
|
return {
|
||||||
|
appName: RegExp.$1,
|
||||||
|
appVersion: RegExp.$2,
|
||||||
|
appOS: RegExp.$3
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 如果是小数则保留小数位,默认两位
|
||||||
|
* @param {[type]} value [description]
|
||||||
|
* @param {Number} num [description]
|
||||||
|
* @return {[type]} [description]
|
||||||
|
*/
|
||||||
|
toFloatFixed(value, num = 2) {
|
||||||
|
let values = Number(value)
|
||||||
|
if (values) {
|
||||||
|
if (/^\d+\.\d+/.test(values)) {
|
||||||
|
return this.toFixed(values, num)
|
||||||
|
} else {
|
||||||
|
return this.toFixed(values)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return value
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取周
|
||||||
|
getWeek(str) {
|
||||||
|
let rs = ''
|
||||||
|
switch (str + '') {
|
||||||
|
case '1':
|
||||||
|
rs = '一'
|
||||||
|
break
|
||||||
|
case '2':
|
||||||
|
rs = '二'
|
||||||
|
break
|
||||||
|
case '3':
|
||||||
|
rs = '三'
|
||||||
|
break
|
||||||
|
case '4':
|
||||||
|
rs = '四'
|
||||||
|
break
|
||||||
|
case '5':
|
||||||
|
rs = '五'
|
||||||
|
break
|
||||||
|
case '6':
|
||||||
|
rs = '六'
|
||||||
|
break
|
||||||
|
case '7':
|
||||||
|
case '0':
|
||||||
|
rs = '日'
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
return rs
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取补全的时间
|
||||||
|
getTime(str) {
|
||||||
|
if (str < 10) {
|
||||||
|
return '0' + str
|
||||||
|
}
|
||||||
|
return str
|
||||||
|
},
|
||||||
|
|
||||||
|
// 数组去重
|
||||||
|
unrepeat(arr) {
|
||||||
|
if (arr instanceof Array) {
|
||||||
|
let hash = {}
|
||||||
|
let rsArr = []
|
||||||
|
let len = arr.length
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
let type = ''
|
||||||
|
for (let i = 0; i < len; i++) {
|
||||||
|
if (typeof arr[i] == 'string') {
|
||||||
|
type = 'string'
|
||||||
|
}
|
||||||
|
if (!hash[arr[i]]) {
|
||||||
|
hash[arr[i]] = arr[i]
|
||||||
|
rsArr.push(arr[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rsArr
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 一层对象数组去重
|
||||||
|
unrepeatObj(arr, key) {
|
||||||
|
if (arr instanceof Array) {
|
||||||
|
let hash = {}
|
||||||
|
let rsArr = []
|
||||||
|
let len = arr.length
|
||||||
|
let type = ''
|
||||||
|
for (let i = 0; i < len; i++) {
|
||||||
|
if (typeof arr[i] == 'string') {
|
||||||
|
type = 'string'
|
||||||
|
}
|
||||||
|
if (!hash[arr[i][key]]) {
|
||||||
|
hash[arr[i][key]] = arr[i]
|
||||||
|
rsArr.push(arr[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rsArr
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
@desc:只能输入整数
|
||||||
|
@param
|
||||||
|
value 操作数值
|
||||||
|
max 最大值
|
||||||
|
**/
|
||||||
|
intOnly(value, max = Infinity, min = 0) {
|
||||||
|
if (value) {
|
||||||
|
let regular0 = /^0{1,}$/
|
||||||
|
if (regular0.test(value)) {
|
||||||
|
// 如果输入1个0以上,去除掉
|
||||||
|
value = value.replace(/^0{1,}$/, '')
|
||||||
|
}
|
||||||
|
if (/[^0-9]*$/.test(value)) {
|
||||||
|
value = value.replace(/\D/g, '')
|
||||||
|
} else {
|
||||||
|
if (value > max) value = value.substr(0, value.length - 1)
|
||||||
|
if (value < min) value = min
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return value
|
||||||
|
},
|
||||||
|
|
||||||
|
//解析url参数
|
||||||
|
getQuery() {
|
||||||
|
var query = []
|
||||||
|
// 当url是通过传参过来的话,我们把第一个参数作为url并进行解析
|
||||||
|
if (arguments[0]) {
|
||||||
|
let lnk = document.createElement('a')
|
||||||
|
lnk.href = arguments[0]
|
||||||
|
query = this.extractQuery(lnk)
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
var query = window.location.search.split('?');
|
||||||
|
if(query.length <= 1) query = window.location.hash.split('#');
|
||||||
|
query = query.length > 1 ? query[1].split('&') : []
|
||||||
|
*/
|
||||||
|
query = this.extractQuery(window.location)
|
||||||
|
}
|
||||||
|
|
||||||
|
var json = {}
|
||||||
|
for (var i = 0, len = query.length; i < len; i++) {
|
||||||
|
var key = query[i].split('=')[0],
|
||||||
|
index = query[i].indexOf('='),
|
||||||
|
value = query[i].substr(index + 1)
|
||||||
|
json[key] = value
|
||||||
|
}
|
||||||
|
|
||||||
|
return json
|
||||||
|
},
|
||||||
|
extractQuery(lnk) {
|
||||||
|
var query = lnk.search.split('?')
|
||||||
|
//url/#/repairBooking?activityFromApp=1
|
||||||
|
if (query.length <= 1) query = lnk.hash.split('?')
|
||||||
|
query = query.length > 1 ? query[1].split('&') : []
|
||||||
|
|
||||||
|
return query
|
||||||
|
},
|
||||||
|
formatDate(date, fmt) {
|
||||||
|
date = date == undefined ? new Date() : date
|
||||||
|
date = typeof date == 'number' ? new Date(date) : date
|
||||||
|
fmt = fmt || 'yyyy-MM-dd HH:mm:ss'
|
||||||
|
var obj = {
|
||||||
|
y: date.getFullYear(), // 年份,注意必须用getFullYear
|
||||||
|
M: date.getMonth() + 1, // 月份,注意是从0-11
|
||||||
|
d: date.getDate(), // 日期
|
||||||
|
q: Math.floor((date.getMonth() + 3) / 3), // 季度
|
||||||
|
w: date.getDay(), // 星期,注意是0-6
|
||||||
|
H: date.getHours(), // 24小时制
|
||||||
|
h: date.getHours() % 12 == 0 ? 12 : date.getHours() % 12, // 12小时制
|
||||||
|
m: date.getMinutes(), // 分钟
|
||||||
|
s: date.getSeconds(), // 秒
|
||||||
|
S: date.getMilliseconds() // 毫秒
|
||||||
|
}
|
||||||
|
var week = ['天', '一', '二', '三', '四', '五', '六']
|
||||||
|
for (var i in obj) {
|
||||||
|
fmt = fmt.replace(new RegExp(i + '+', 'g'), function(m) {
|
||||||
|
var val = obj[i] + ''
|
||||||
|
if (i == 'w') return (m.length > 2 ? '星期' : '周') + week[val]
|
||||||
|
for (var j = 0, len = val.length; j < m.length - len; j++) val = '0' + val
|
||||||
|
return m.length == 1 ? val : val.substring(val.length - m.length)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return fmt
|
||||||
|
},
|
||||||
|
/*根据出生日期算出年龄*/
|
||||||
|
jsGetAge(strBirthday) {
|
||||||
|
var returnAge
|
||||||
|
var strBirthdayArr = strBirthday.split('-')
|
||||||
|
var birthYear = strBirthdayArr[0]
|
||||||
|
var birthMonth = strBirthdayArr[1]
|
||||||
|
var birthDay = strBirthdayArr[2]
|
||||||
|
|
||||||
|
let d = new Date()
|
||||||
|
var nowYear = d.getFullYear()
|
||||||
|
var nowMonth = d.getMonth() + 1
|
||||||
|
var nowDay = d.getDate()
|
||||||
|
|
||||||
|
if (nowYear == birthYear) {
|
||||||
|
returnAge = 0 //同年 则为0岁
|
||||||
|
} else {
|
||||||
|
var ageDiff = nowYear - birthYear //年之差
|
||||||
|
if (ageDiff > 0) {
|
||||||
|
if (nowMonth == birthMonth) {
|
||||||
|
var dayDiff = nowDay - birthDay //日之差
|
||||||
|
if (dayDiff < 0) {
|
||||||
|
returnAge = ageDiff - 1
|
||||||
|
} else {
|
||||||
|
returnAge = ageDiff
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var monthDiff = nowMonth - birthMonth //月之差
|
||||||
|
if (monthDiff < 0) {
|
||||||
|
returnAge = ageDiff - 1
|
||||||
|
} else {
|
||||||
|
returnAge = ageDiff
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
returnAge = -1 //返回-1 表示出生日期输入错误 晚于今天
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnAge //返回周岁年龄
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user