<!-- 消息 -->
<template>
	<view class="message">
		<TabBar></TabBar>
		<view class="main" v-for="(item, index) in list" :key="index">
			<view class="date-time">{{item.date}}</view>
			<view class="card">
				<view class="title">
					<text v-show="isManager">收到新的访客申请</text>
					<text v-show="!isManager" class="text">您的访客信息{{item.status}}</text>
					<view v-show="!isManager" :class="item.status === '未通过' ? 'button-area' : item.status === '已通过' ? 'button-area pass' : 'button-area submit'">申请{{item.status}}</view>
				</view>
				<view class="content">
					<text class="content-title">申请者工号：</text>
					<text class="value">{{item.number}}</text>
				</view>
				<view class="content">
					<text>ㅤ访客姓名：</text>
					<text>{{item.name}}</text>
				</view>
				<view class="content">
					<text>ㅤ访问时间：</text>
					<text>{{item.time}}</text>
				</view>
				<view class="detail-area">
					<view class="detail" @click="clickDetail">详ㅤ情</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import TabBar from '@/components/tabBar/tabBar.vue';
	export default {
		components: {
			TabBar,
		},
		data() {
			return {
				isManager: false,
				list: [
					{
						//0未通过，1已通过，2已提交
						status: '未通过',
						number: '1111',
						name: '张三',
						time: '2022-12-03 ~ 2022-01-69',
						date: '星期一 上午9:00'
					},
					{
						//0未通过，1已通过，2已提交
						status: '已通过',
						number: '1111',
						name: '张三',
						time: '2022-12-03 ~ 2022-01-69',
						date: '星期一 上午9:00'
					},
					{
						//0未通过，1已通过，2已提交
						status: '已提交',
						number: '1111',
						name: '张三',
						time: '2022-12-03 ~ 2022-01-69',
						date: '星期一 上午9:00'
					},
				]
			}
		},
		onShow() {
			let pages = getCurrentPages();
			const curPage = pages[pages.length - 1];
			this.currentPagePath = curPage.route;
			uni.setStorageSync('currentPagePath', this.currentPagePath);
		},
		methods: {
			clickDetail() {
				wx.navigateTo({
					url: '/pages/checkMessageDetail/checkMessageDetail'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.message {
		padding: 40rpx;
		padding-bottom: 200rpx;
		.date-time {
			display: flex;
			justify-content: center;
			align-items: center;
			margin: 20rpx 0;
			font-weight: 600;
		}
		.card {
			padding: 20rpx 32rpx;
			background-color: #ccc;
			border-radius: 16rpx;
			margin-bottom: 20rpx;
			.title {
				display: flex;
				flex-direction: row;
				justify-content: space-between;
				align-items: center;
				font-size: 32rpx;
				.text {
					font-weight: 600;
				}
				.button-area {
					padding: 10rpx 16rpx;
					background-color: red;
					border-radius: 16rpx;
				}
				.pass {
					background-color: green;
				}
				.submit {
					background-color: blue;
				}
			}
			.content {
				margin: 32rpx 0;
				.content-title {
					// margin-right: 32rpx;
				}
			}
			.detail-area {
				width: 100%;
				display: flex;
				justify-content: flex-end;
				.detail {
					width: fit-content;
					padding: 10rpx 16rpx;
					background-color: blue;
					border-radius: 16rpx;
					// letter-spacing: 10rpx;
				}
			}
		}
	}
</style>
