<template>
	<view class="container">
		<view class="status-list">
			<view class="status-row">
				<view class="status-line"></view>
				<u-icon name="checkmark-circle-fill" class="icon" color="#52A63A" size="32"></u-icon>
				<view class="status-title">已注册</view>
				<text class="status-date">{{registerInfo.applyTime ? registerInfo.applyTime : ' '}}</text>
			</view>
			<view class="status-row">
				<view class="status-line"></view>
				<u-icon name="checkmark-circle-fill" class="icon" color="#52A63A" size="32"></u-icon>
				<view class="status-title">待审核</view>
				<text class="status-date">{{registerInfo.applyTime}}</text>
			</view>
			<view class="status-row" v-if="registerInfo.auditState != 1">
				<view class="status-line"></view>
				<u-icon name="checkmark-circle-fill" class="icon" color="#52A63A" size="32" v-if="registerInfo.auditState == 2"></u-icon>
				<u-icon name="close-circle-fill" class="icon" color="#FF4545" size="32" v-else></u-icon>
				<view class="status-title">{{registerInfo.auditState == 2 ? '审核已通过' : '审核未通过:'+registerInfo.rejectReason}}</view>
				<text class="status-date">{{registerInfo.auditTime}}</text>
			</view>
		</view>
		<view class="form-handle">
			<!-- <u-button type="success" shape="circle" :ripple="true" @click="againLogin" class="handle-custom" style="margin-bottom: 10px;" v-if="registerInfo.auditState == 2">重新登录</u-button> -->
			<u-button type="success" shape="circle" :ripple="true" @click="editRegister" class="handle-custom">重新提交注册信息</u-button>
		</view>
		<u-top-tips ref="uTips"></u-top-tips>
	</view>
</template>

<script>
	const NET = require('@/utils/request')
	const API = require('@/config/api')
	export default {
		data() {
			return {
				registerInfo: {
					auditState: 1,
					applyTime: '',
					auditTime: '',
					effectTime: '',
					rejectReason: ''
				},
			}
		},
		onLoad(options) {
			NET.request(API.getShopRegisterStatu, {}, 'POST').then(res => {
				this.registerInfo = res.data
			}).catch(error => {
				this.$refs.uTips.show({
					title: error.data.msg,
					type: 'warning',
				})
			})
		},
		methods: {
			//  重新登录
			againLogin() {
				uni.reLaunch({
					url: '/pages/index/index'
				});
			},
			//  重新提交注册信息
			editRegister() {
				uni.navigateTo({
					url: '/pages/index/register?type=edit'
				});
			}
		}
	}
</script>

<style lang="less" scoped>
	page {
		width: 100%;
		height: 100%;
	}

	.container {
		width: 100%;
		height: 100%;
		float: left;

		.status-list {
			width: 100%;
			height: calc(100% - 318px);
			float: left;
			background: #FFFFFF;
			box-sizing: border-box;
			padding: 2px 15px 15px 15px;
			overflow-y: auto;

			.status-row {
				width: 100%;
				float: left;
				box-sizing: border-box;
				padding: 14px 0 14px 32px;
				position: relative;

				.status-line {
					width: 1px;
					position: absolute;
					background: #F1F3F5;
					left: 7px;
					top: 0;
					bottom: 0;
				}

				.icon {
					width: 16px;
					height: 16px;
					position: absolute;
					left: 0px;
					top: 50%;
					transform: translateY(-50%);
					color: #52A63A;
					font-size: 28px;
				}

				.status-title {
					font-family: PingFang SC;
					line-height: 20px;
				}

				.status-date {
					width: 100%;
					height: 20px;
					float: left;
					font-size: 12px;
					font-family: PingFang SC;
					color: #656565;
					line-height: 20px;
				}
			}

			.status-row:first-child {
				.status-line {
					top: 50%;
				}
			}

			.status-row:last-child {
				.status-line {
					bottom: 50%;
				}
			}
		}

		.form-handle {
			width: calc(100% - 30px);
			height: 40px;
			position: fixed;
			bottom: 20px;
			left: 15px;

			.handle-custom {
				background-color: #51A539;
			}
		}
	}
</style>
