|
|
|
<template>
|
|
|
|
<view class="verification">
|
|
|
|
<view class="c">身份信息<text v-if="userInfo.status==-1">认证失败</text>
|
|
|
|
<text class="on" v-if="userInfo.status==1">已认证</text>
|
|
|
|
<text class="on" v-if="userInfo.status==0">
|
|
|
|
{{userInfo.status_text}}</text>
|
|
|
|
</view>
|
|
|
|
<view class="a">
|
|
|
|
<view class="item">
|
|
|
|
<view class="fl">姓名</view>
|
|
|
|
<view class="fr">
|
|
|
|
<input type="text" v-model="userInfo.realname" placeholder="请输入本人姓名" />
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="item">
|
|
|
|
<view class="fl">证件号</view>
|
|
|
|
<view class="fr">
|
|
|
|
<input type="text" v-model="userInfo.cardno" placeholder="请输入18位居民身份证号码" />
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="b">
|
|
|
|
<view class="title">本人身份证照片</view>
|
|
|
|
<image :src="userInfo.cardno_z?baseUrl+userInfo.cardno_z:'https://www.lijkj.cn/static/sfz-01.png'" @click="uploadImg(1)"></image>
|
|
|
|
<image :src="userInfo.cardno_f?baseUrl+userInfo.cardno_f:'https://www.lijkj.cn/static/sfz-02.png'" @click="uploadImg(2)"></image>
|
|
|
|
<view class="err" v-if="userInfo.status==-1">失败原因:{{userInfo.reason}}</view>
|
|
|
|
<view class="btn" v-if="userInfo.status==-2" @click="toSubmit()">确定</view>
|
|
|
|
<view class="btns" v-if="userInfo.status !=-2" @click="toSubmit()">重新认证</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
userInfo: {},
|
|
|
|
baseUrl: ""
|
|
|
|
};
|
|
|
|
},
|
|
|
|
onLoad() {
|
|
|
|
this.getUsershenhe();
|
|
|
|
this.baseUrl=this.$baseUrl
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
async toSubmit() {
|
|
|
|
if(!this.userInfo.realname){
|
|
|
|
uni.showToast({
|
|
|
|
icon: "none",
|
|
|
|
title: "姓名不能为空!"
|
|
|
|
})
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
if(!this.userInfo.cardno){
|
|
|
|
uni.showToast({
|
|
|
|
icon: "none",
|
|
|
|
title: "身份证号不能为空!"
|
|
|
|
})
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
if(!this.userInfo.cardno_z){
|
|
|
|
uni.showToast({
|
|
|
|
icon: "none",
|
|
|
|
title: "请上传身份证正面!"
|
|
|
|
})
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
if(!this.userInfo.cardno_f){
|
|
|
|
uni.showToast({
|
|
|
|
icon: "none",
|
|
|
|
title: "请上传身份证反面!"
|
|
|
|
})
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
const { code, data, msg } = await this.$api.setshenhe({
|
|
|
|
realname: this.userInfo.realname,
|
|
|
|
cardno: this.userInfo.cardno,
|
|
|
|
cardno_z: this.userInfo.cardno_z,
|
|
|
|
cardno_f: this.userInfo.cardno_f,
|
|
|
|
token: uni.getStorageSync('token')
|
|
|
|
})
|
|
|
|
if(code == 1){
|
|
|
|
uni.showToast({
|
|
|
|
title: "提交成功"
|
|
|
|
})
|
|
|
|
this.getUsershenhe();
|
|
|
|
}else{
|
|
|
|
uni.showToast({
|
|
|
|
icon: "none",
|
|
|
|
title: msg
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
//上传图片
|
|
|
|
uploadImg(type) {
|
|
|
|
const that = this
|
|
|
|
uni.chooseImage({
|
|
|
|
count: 1,
|
|
|
|
sizeType: ["original"], //可以指定是原图还是压缩图,默认二者都有
|
|
|
|
sourceType: ["album", "camera"],
|
|
|
|
success: (res) => {
|
|
|
|
console.log(res.tempFilePaths[0])
|
|
|
|
uni.uploadFile({
|
|
|
|
name: 'file',
|
|
|
|
formData: {
|
|
|
|
token: uni.getStorageSync('token')
|
|
|
|
},
|
|
|
|
url: this.$baseUrl+'/api/Common/upload',
|
|
|
|
filePath: res.tempFilePaths[0],
|
|
|
|
success: (upRes) => {
|
|
|
|
let end = JSON.parse(upRes.data)
|
|
|
|
if(type == 1){
|
|
|
|
that.userInfo.cardno_z = end.data.url
|
|
|
|
console.log(111,that.userInfo.cardno_z)
|
|
|
|
}else{
|
|
|
|
that.userInfo.cardno_f = end.data.url
|
|
|
|
console.log(222,that.userInfo.cardno_f)
|
|
|
|
}
|
|
|
|
that.$forceUpdate();
|
|
|
|
},
|
|
|
|
fail: (err) => {
|
|
|
|
console.log("toUpload err",err)
|
|
|
|
console.log(err)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
fail(err){
|
|
|
|
console.log("fail",err)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
//查询当前实名认证情况
|
|
|
|
async getUsershenhe() {
|
|
|
|
const { code, data, msg } = await this.$api.getUsershenhe({token: uni.getStorageSync("token")});
|
|
|
|
if(code == 1){
|
|
|
|
this.userInfo = data
|
|
|
|
// this.userInfo.cardno_z=""
|
|
|
|
// this.userInfo.cardno_f=""
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
.verification{
|
|
|
|
padding: 0 25rpx 25rpx;
|
|
|
|
background: #FFFFFF;
|
|
|
|
box-sizing: border-box;
|
|
|
|
min-height: 100vh;
|
|
|
|
.c{
|
|
|
|
font-weight: 500;
|
|
|
|
font-size: 36rpx;
|
|
|
|
color: #222222;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
padding: 25rpx 0;
|
|
|
|
text{
|
|
|
|
width: 120rpx;
|
|
|
|
height: 50rpx;
|
|
|
|
line-height: 50rpx;
|
|
|
|
background: #D80C0C;
|
|
|
|
border-radius: 4rpx;
|
|
|
|
display: block;
|
|
|
|
margin-left: 20rpx;
|
|
|
|
text-align: center;
|
|
|
|
font-weight: 500;
|
|
|
|
font-size: 22rpx;
|
|
|
|
color: #FFFFFF;
|
|
|
|
&.on{
|
|
|
|
background-color: #00C6A9;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.a{
|
|
|
|
overflow: hidden;
|
|
|
|
.item{
|
|
|
|
padding: 40rpx 0;
|
|
|
|
border-bottom: 1px solid #EAEAEA;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: space-between;
|
|
|
|
.fr{
|
|
|
|
flex: 1;
|
|
|
|
input{
|
|
|
|
font-weight: 400;
|
|
|
|
font-size: 30rpx;
|
|
|
|
color: #999999;
|
|
|
|
line-height: 40rpx;
|
|
|
|
text-align: right;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.b{
|
|
|
|
.title{
|
|
|
|
font-weight: 500;
|
|
|
|
font-size: 36rpx;
|
|
|
|
color: #222222;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
padding: 25rpx 0;
|
|
|
|
text{
|
|
|
|
width: 120rpx;
|
|
|
|
height: 50rpx;
|
|
|
|
line-height: 50rpx;
|
|
|
|
background: #D80C0C;
|
|
|
|
border-radius: 4rpx;
|
|
|
|
display: block;
|
|
|
|
margin-left: 20rpx;
|
|
|
|
text-align: center;
|
|
|
|
font-weight: 500;
|
|
|
|
font-size: 22rpx;
|
|
|
|
color: #FFFFFF;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
image{
|
|
|
|
width: 555rpx;
|
|
|
|
height: 345rpx;
|
|
|
|
display: block;
|
|
|
|
border-radius: 20rpx;
|
|
|
|
margin: 35rpx auto 0;
|
|
|
|
}
|
|
|
|
.err{
|
|
|
|
font-weight: 400;
|
|
|
|
font-size: 28rpx;
|
|
|
|
color: #D80C0C;
|
|
|
|
line-height: 40rpx;
|
|
|
|
margin-top: 40rpx;
|
|
|
|
}
|
|
|
|
.btn{
|
|
|
|
width: 702rpx;
|
|
|
|
line-height: 90rpx;
|
|
|
|
background: #00C6A9;
|
|
|
|
box-shadow: 0px 3rpx 10rpx 0px rgba(9,44,39,0.05);
|
|
|
|
border-radius: 90rpx;
|
|
|
|
text-align: center;
|
|
|
|
font-weight: 500;
|
|
|
|
font-size: 30rpx;
|
|
|
|
color: #FFFFFF;
|
|
|
|
margin: 0 auto;
|
|
|
|
margin-top: 170rpx;
|
|
|
|
}
|
|
|
|
.btns{
|
|
|
|
width: 702rpx;
|
|
|
|
line-height: 90rpx;
|
|
|
|
background: #00C6A9;
|
|
|
|
box-shadow: 0px 3rpx 10rpx 0px rgba(9,44,39,0.05);
|
|
|
|
border-radius: 90rpx;
|
|
|
|
text-align: center;
|
|
|
|
font-weight: 500;
|
|
|
|
font-size: 30rpx;
|
|
|
|
color: #FFFFFF;
|
|
|
|
margin: 0 auto;
|
|
|
|
margin-top: 70rpx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|