Files
18500206848 91172a730c 11
2024-02-02 14:44:30 +08:00

248 lines
5.2 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="body">
<view class="list">
<view class="name">
姓名
</view>
<text v-if="auth.realNameState" style="color: #1b66ff;">{{auth.authInfo.realName}}</text>
<input v-else type="text" value="" placeholder="请输入真实姓名" @input="setName" placeholder-style="color:#cccccc;" />
</view>
<view>
<view class="list">
<view class="name">
身份证号
</view>
<text v-if="auth.realNameState" style="color: #1b66ff;">{{idNumberFilter(auth.authInfo.idNumber)}}</text>
<input v-else type="idcard" value="" placeholder="请输入身份证号" @input="setCard" style="text-transform:uppercase"
placeholder-style="color:#cccccc;" />
</view>
<view v-if="error" class="error">身份证填写有误</view>
</view>
<picker :range="identityList" @change="identityChange" :value="index">
<view class="list">
<view class="listLeft">
<view class="name">
身份信息
</view>
<view class="listContent">完成实名认证提高信息可信度</view>
</view>
<view class="listRight">
<view class="listRightContent">
<view class="" v-if="auth.laborState">已认证</view>
<view class="" v-else>未认证</view>
</view>
<image src="@/static/img/right.svg" mode=""></image>
</view>
</view>
</picker>
<picker :range="insureList" @change="insureChange" :value="indexBao">
<view class="list">
<view class="listLeft">
<view class="name">
社保信息
</view>
<view class="listContent">选择个人身份获得精准推荐</view>
</view>
<view class="listRight">
<view class="listRightContent">
<view class="" v-if="auth.insureState">{{insureList[indexBao]}}</view>
<view class="" v-else>未选择</view>
</view>
<image src="@/static/img/right.svg" mode=""></image>
</view>
</view>
</picker>
<view v-if="auth.realNameState"></view>
<view class="btn nocheck" v-else-if="loading">
<view class="bottombtn">
认证中
</view>
</view>
<view class="btn" @click="goSet" v-else-if="check">
<view class="bottombtn">
认证
</view>
</view>
<view class="btn nocheck" v-else>
<view class="bottombtn">
认证
</view>
</view>
</view>
</template>
<script>
import {
check18IdCardNo,
validatenull
} from '@/untils/validate.js'
import {
mapGetters
} from 'vuex'
import {
idNumberFilter
} from '@/untils/format.js'
import textdata from '@/common/textdata.js'
export default {
data() {
return {
name: '',
card: '',
loading: false,
error: false,
identityList: textdata.laborType,
insureList: textdata.insureType,
index: 0,
}
},
methods: {
setName: function(e) {
this.name = e.detail.value;
},
setCard: function(e) {
this.card = e.detail.value.toUpperCase();
this.error = !check18IdCardNo(this.card)
return e.detail.value.toUpperCase()
},
goSet: function() {
this.loading = true
this.$store.dispatch('authRealName', {
name: this.name,
idNumber: this.card
})
.then(() => {
this.loading = false
uni.navigateBack()
}).catch(() => {
this.loading = false
})
},
idNumberFilter,
identityChange(val) {
uni.showLoading();
this.$store.dispatch('authLabor').then(() => {
this.index = val.detail.value;
uni.hideLoading();
}).catch(() => {
uni.hideLoading();
})
},
insureChange(val) {
uni.showLoading();
this.$store.dispatch('authInsure', val.detail.value * 1 + 1).then(() => {
uni.hideLoading();
}).catch(()=>{
uni.hideLoading();
})
}
},
computed: {
...mapGetters(['auth', 'authInfo']),
check() {
return check18IdCardNo(this.card) && !validatenull(this.name)
},
indexBao() {
if (this.auth.insureState) {
return this.authInfo.bakValue - 1
} else {
return 0
}
}
}
}
</script>
<style>
.bottombtn {
background-color: #1B66FF;
color: #fff;
text-align: center;
border-radius: 10rpx;
font-family: PingFangSC-Medium;
font-size: 32rpx;
height: 90rpx;
line-height: 90rpx;
}
.btn {
background-color: #fefefe;
width: 690rpx;
padding: 30rpx;
padding-bottom: 80rpx;
position: fixed;
bottom: 0;
left: 0;
}
.name {
font-family: PingFangSC-Regular;
font-size: 32rpx;
color: #333333;
width: 200rpx;
}
.error {
font-family: PingFangSC-Regular;
font-size: 26rpx;
color: red;
margin: 5px 0 0 200rpx;
padding-bottom: 5px;
}
.list {
padding: 20rpx;
padding-left: 0;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1rpx solid #f2f2f2;
font-size: 28rpx;
}
.pickerList {
padding: 20rpx;
padding-left: 0;
border-bottom: 1rpx solid #f2f2f2;
}
.listRight {
display: flex;
align-items: center;
justify-content: space-between;
font-family: PingFangSC-Regular;
font-size: 28rpx;
color: #999999;
}
.listRightContent {
color: #1b66ff;
}
.listRight image {
width: 40rpx;
height: 40rpx;
margin-left: 15rpx;
}
.listContent {
color: #999;
font-size: 28rpx;
}
.body {
background-color: #fefefe;
padding-left: 20rpx;
margin-top: 20rpx;
}
.nocheck {
opacity: 0.3;
}
page {
background-color: #f6f6f6;
}
</style>