<!-- 解锁记录 -->
<!-- 一键开门 -->
<template>
	<view class="">
		<image src="../../static/history_top_bgimage@2x.png" style="width: 100%;height: 278rpx;"></image>
		<view class="main">
			<view style="width:520rpx;margin: 0 auto;margin-top: 300rpx;" v-show="visible">
				<image src="../../static/notData.png" style="width:520rpx ;height: 520rpx;"></image>
				<view style="width:144rpx;height:50rpx;font-size:36rpx;margin: 0 auto;margin-top: 46rpx;">暂无数据</view>
			</view>
			<!-- <view class="infoBox" style="margin-top: 40rpx;"> -->
				<!-- <view class="title">
					番茄小区
				</view> -->
				<view class="item" v-for="(item,index) in data" :key="index" v-show="!visible">
					<view class="leftIcon">
						<image src="../../static/open_icon@2x.png" style="width: 100%;height: 100%;"></image>
					</view>
					<view class="" style="position: absolute;left: 100rpx;">
						<view class="name">{{item.deviceName}}</view>
						<view class="dec">
							解锁时间：{{item.createTime}}
						</view>
					</view>
				</view>
			<!-- </view> -->
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				data:[],
				visible:true
			}
		},
		mounted() {
			this.getList()
		},
		onPullDownRefresh() {
			uni.showLoading({
				title: '加载中',
				mask: true
			})
			this.getList()
		},
		methods: {
			// 获取列表数据
			getList() {
				uni.showLoading({
					mask:true,
					title:'加载中'
				})
				this.http.httpRequest('/wxapplet/owner/openDoor/list', 'get', {
					phoneNum:uni.getStorageSync('phoneNumber')
				}, true).then((res) => {
					console.log(res)
					if (res.code == 0) {
						// 判断返回数据是否为空
						if(res.data.rows.length==0){
							this.visible=true
						}else{
							this.visible=false
						}
						this.data=res.data.rows
						setTimeout(() => {
							uni.hideLoading()
							uni.stopPullDownRefresh()
						}, 1000)
					} else {
						uni.hideLoading()
						uni.showToast({
							title: res.msg,
							'icon': 'none'
						})
					}
				}).catch(()=>{
					uni.hideLoading()
				})
			},
			// 查看解锁记录
			seeList() {
				uni.navigateTo({
					url: ""
				})
			}
		}

	}
</script>

<style scoped>
	.notInfo {
		width: 100%;
		height: 50rpx;
		font-size: 36rpx;
		font-family: PingFang SC;
		font-weight: 400;
		line-height: 50rpx;
		color: rgba(36, 36, 36, 1);
		margin: 0 auto;
		margin-top: 40rpx;
		text-align: center;
	}
	.title {
		width: 100%;
		height: 44rpx;
		font-size: 32rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: rgba(41, 138, 253, 1);
	}

	.btn {
		width: 702rpx;
		height: 90rpx;
		background: rgba(41, 138, 253, 1);
		opacity: 1;
		border-radius: 18rpx;
		position: fixed;
		bottom: 56rpx;
		left: 24rpx;
		font-size: 32rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: rgba(255, 255, 255, 1);
	}

	.dec {
		width: 400rpx;
		height: 40rpx;
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: rgba(153, 153, 153, 1);
		margin-top: 12rpx;
	}

	.name {
		width: 262rpx;
		height: 44rpx;
		font-size: 30rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: rgba(51, 51, 51, 1);
		margin-top: 38rpx;
	}

	.item {
		width: 702rpx;
		height: 170rpx;
		border-bottom: 2px solid rgba(247, 247, 247, 1);
		;
		display: flex;
		position: relative;
	}

	.infoBox {
		width: 702rpx;
		margin: 0 auto;
	}

	.leftIcon {
		width: 60rpx;
		height: 60rpx;
		position: absolute;
		left: 24rpx;
		bottom: 60rpx;
	}

	.rightIcon {
		width: 80rpx;
		height: 80rpx;
		position: absolute;
		right: 24rpx;
		bottom: 44rpx;
	}

	.main {
		width: 100%;
		position: absolute;
		top: 0rpx;
	}
</style>
