<template>
	<view class="cmain">
		<view v-if="item.id">
			<view v-if="item.judgeStatus == 0">
				<view class="icon">&#xe64d;</view>
				<view class="title">您的资料已经提交审核</view>
				<view class="desc">请耐心等待。</view>
				<button class="btn" @click="go()">重新编辑</button>
			</view>
			<view v-if="item.judgeStatus == 1">
				<view class="icon">&#xe631;</view>
				<view class="title">审核通过</view>
				<button class="btn" @click="go()">我的认证信息</button>
			</view>
			<view v-if="item.judgeStatus == 2">
				<view class="icon" style="color: #f44336">&#xe61a;</view>
				<view class="title">审核不通过</view>
				<view class="message _error">{{ item.judgeContent }}</view>
				<button class="btn" @click="go()">重新认证</button>
			</view>
		</view>
		<view v-else>
			<view class="icon">&#xe64e;</view>
			<view class="title">您还未进行认证</view>
			<button class="btn" @click="go()">去认证</button>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			item: {}
		};
	},
	onLoad() {
		this.getData();
		uni.$on('authentication', res => {
			this.getData();
		});
	},
	methods: {
		getData() {
			this.http.request({
				url: '/level-two-server/app/TbPurchaser/info',
				success: res => {
					if (res.data.data) {
						this.item = res.data.data;
					}
				}
			});
		},
		go() {
			uni.navigateTo({
				url: '/pages/authentication/info'
			});
		}
	}
};
</script>

<style lang="scss">
.cmain {
	text-align: center;
	padding: 40px;
	color: $font-c;
	.icon {
		font-size: 150px;
		color: $main-color;
	}
	.title {
		margin-top: 10px;
		margin-bottom: 7px;
	}
	.message {
		margin-top: 15px;
		text-align: left;
	}
	.desc {
		margin-top: -5px;
	}
	.btn {
		margin-top: 30px;
	}
}
</style>
