<template>
	<view class="">
		<view class="card bg-white">
			<view class="top">
				<text class="title">{{dataDetail.residentialName}}</text>
				<view class="avatar">
					<u-avatar :sex-icon="userInfo.gender==1?'man':'woman'" show-sex="true" size="110" :src="userInfo.avatarUrl"></u-avatar>
				</view>
				<view class="text-center text-bold">
					<text v-text="userInfo.nickName"></text>
				</view>
				<view class="text-center text-blue padding-top-50 " style="font-size: 26rpx;">
					请出示该通行证截图，由保安核检
				</view>
			</view>
			<view class="bottom">
				<view class="item">
					<text class="">姓名:</text>
					<text>{{memberName}}</text>
				</view>
				<view class="item">
					<text class="">出入原因:</text>
					<text>{{dataDetail.reason}}</text>
				</view>
				<view class="item">
					<text class="">体温是否异常:</text>
					<text v-if="dataDetail.temparetureException==0">否</text>
					<text v-if="dataDetail.temparetureException==1" class="text-red text-bold">异常</text>
				</view>
				<view class="item">
					<text class="">是否有异常症状:</text>
					<text v-if="dataDetail.symptomException==0">否</text>
					<text v-if="dataDetail.symptomException==1" class="text-red text-bold">异常</text>
				</view>
				<view class="item">
					<text class="">访问日期:</text>
					<text>{{dataDetail.createDate}}</text>
				</view>
			</view>
		</view>
		<view class="text-center text-sm text-gray">
			通行证仅当天有效，隔日需要再次登记出入信息
		</view>
		<view v-if="show==true" @click="goList" class=" text-center margin-top-50">
			<u-icon name="order" color="#0081ff"></u-icon>
			<text class="text-blue text-df padding-left-10" >登记记录</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				//如果是从列表跳过来的，隐藏登记记录
				show:true,
				
				memberName:'',
				userInfo:{},
				dataDetail:{}
			}
		},
		onLoad(options) {
			this.show=options.show || true
			this.fetchUserInfo()
		},
		onShow() {
			this.memberName=getApp().globalData.member.name
			this.dataDetail=getApp().globalData.pratiqueData
		},
		methods: {
			fetchUserInfo(){
				let that=this
				that.userInfo=uni.getStorageSync("userInfo")
				if (this.$isEmpty(that.userInfo)) {
					uni.login({
					  success: function () {
					    uni.getUserInfo({
					      success: function (res) {
					        that.userInfo=res.userInfo
					      }
					    });
					  }
					});
				}
			},
			goList(){
				uni.navigateTo({
					url:"/pages/tool-list/epidemic-pass/list"
				})
			}
		},
		
	}
</script>

<style lang="scss">
	.card{
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		width: 80%;
		height: 850rpx;
		border-radius: 18rpx;
		background-color: #FFFFFF;
		margin: 50rpx auto;
		
		.top{
			padding-top: 20rpx;
			margin: 30rpx;
			.title{
				font-size: 32rpx;
				font-weight: 800;
				display: flex;
				justify-content: center;
			}
		}
		
		.bottom{
			padding-bottom: 50rpx;
			.item{
				padding: 10rpx 0 10rpx 50rpx;
				text:first-child{
					padding-right: 20rpx;
				}
			}
		}
		.avatar{
			padding: 50rpx 0 20rpx 0;
			display: flex;
			justify-content: center;
		}
	}
</style>
