<template>
	<view>
		<up-navbar leftIcon="" placeholder></up-navbar>
		<view class="audit-content">
			<view class="icon-wrap" aria-hidden="true">
				<svg viewBox="0 0 64 64" class="clock-svg" xmlns="http://www.w3.org/2000/svg">
					<circle cx="32" cy="32" r="30" fill="#09aaff" />
					<path d="M32 18v14l10 6" stroke="#fff" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"
						fill="none" />
				</svg>
			</view>
			<template v-if="userInfo.auditStatus == 1">
				<view class="title">审核中</view>
				<view class="desc">审核结果将以短信进行通知，通过后分配订单哦~</view>
				<view class="btn-row">
					<up-button type="primary" plain @click="onDone">完成</up-button>
				</view>
			</template>
			<template v-if="userInfo.auditStatus == 3">
				<view class="title">审核不通过</view>
				<view class="desc">请重新申请~</view>
				<view class="btn-row">
					<up-button type="primary" plain @click="sheep.$router.go('/pages/registered/registerRiders')">
						重新提交入驻申请
					</up-button>
				</view>
			</template>
		</view>
	</view>
</template>

<script setup>
	import {
		computed,
	} from 'vue'
	import sheep from '@/sheep';
	import AuthUtil from '@/sheep/api/member/auth';

	const userInfo = computed(() => sheep.$store('user').userInfo);

	const onDone = async () => {
		// // 返回首页（重启栈）
		// uni.reLaunch({ url: '/pages/index/index' })
		const {
			code
		} = await AuthUtil.logout();
		if (code !== 0) {
			return;
		}
		try {
			uni.clearStorageSync();
			console.log('缓存清空成功');
		} catch (e) {
			console.log('缓存清空失败', e);
		}
		sheep.$store('user').logout();
		sheep.$router.go('/pages/index/user');
	}
</script>

<style lang="scss" scoped>
	.audit-wrap {
		background: #fff;
		min-height: 100vh;
	}

	.audit-content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: flex-start;
		padding-top: 140rpx;
	}

	.icon-wrap {
		width: 140rpx;
		height: 140rpx;
		border-radius: 50%;
		display: flex;
		align-items: center;
		justify-content: center;
		margin-bottom: 20rpx;
	}

	.clock-svg {
		width: 100%;
		height: 100%;
	}

	.title {
		font-size: 36rpx;
		font-weight: 700;
		color: #222;
		margin-bottom: 20rpx;
	}

	.desc {
		font-size: 24rpx;
		color: #999;
		text-align: center;
		padding: 0 40rpx;
		margin-bottom: 60rpx;
	}

	.btn-row {
		width: 520rpx;
	}
</style>