<template>
	<view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
		<cus-header title='电表'></cus-header>
		<div class="nums">
			<div class="pre">电表：<span class="mr">{{2}}</span></div>
			<div class="pre">正常：<span class="zc">{{20}}</span></div>
			<div class="pre">离线：<span class="lx">{{1}}</span></div>
		</div>
		<div class="boxs" v-if="list.length">
			<div class="box" v-for="(item,index) in list" :key="index" @tap="toDetail(item)">
				<div class="name">{{item.name}}</div>
				<div class="tip">安装位置<span>{{item.place}}</span></div>
				<div class="tip">设备编号<span>{{item.deviceno}}</span></div>
				<div class="tip">实时读数<span>{{item.readnum}}</span></div>
				<div class="status" :class="item.status==1?'on':(item.status==2?'off':'mr')">
					{{item.status==1?'在线':(item.status==2?'离线':'异常')}}
				</div>
				<div class="btn">
					{{item.status==1?'断闸':(item.status==2?'合闸':'异常')}}
				</div>
			</div>
		</div>
		<template v-else>
			<page-empty :height="'calc(100vh - 200px)'"></page-empty>
		</template>
	</view>
</template>

<script>
	import pageEmpty from '@/components/pageEmpty/index.vue'
	export default {
		components:{
			pageEmpty
		},
		data(){
			return {
				list:[
					{
						name:'B座13楼生产车间电表A',
						place:'电商园四期B座-13层',
						deviceno:'A32445',
						readnum:'281kwh',
						status:1
					},
					{
						name:'B座13楼生产车间电表B',
						place:'电商园四期B座-13层',
						deviceno:'A32446',
						readnum:'285kwh',
						status:2
					}
				]
			}
		},
		methods:{
			
		}
	}
</script>

<style scoped lang="less">
	.page{
		padding: 0 24rpx 20rpx;
		box-sizing: border-box;
		background: #F4F8FB;
		
		.nums{
			width: 100%;
			background: #FFFFFF;
			border-radius: 16rpx;
			padding: 37rpx 24rpx;
			box-sizing: border-box;
			display: flex;
			margin-top: 20rpx;
			.pre{
				width: calc(100% / 3);
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				font-size: 30rpx;
				color: #4E5969;
				line-height: 36rpx;
				text-align: left;
				span{
					font-family: PingFang-SC, PingFang-SC;
					font-weight: bold;
					font-size: 32rpx;
					line-height: 36rpx;
					text-align: left;
					&.mr{
						color: #1D2129;
					}
					&.zc{
						color: #14CC8C;
					}
					&.lx{
						color: #F95050;
					}
				}
			}
		}
	
		.boxs{
			.box{
				background: #FFFFFF;
				border-radius: 16rpx;
				margin-top: 20rpx;
				padding: 36rpx 24rpx;
				position: relative;
				.name{
					font-family: PingFang-SC, PingFang-SC;
					font-weight: bold;
					font-size: 32rpx;
					color: #1D2129;
					line-height: 36rpx;
					text-align: left;
					overflow: hidden;
					white-space: nowrap;
					text-overflow: ellipsis;
				}
				.tip{
					margin-top: 20rpx;
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					font-size: 24rpx;
					color: #4E5969;
					line-height: 36rpx;
					text-align: left;
					span{
						color: #1D2129;
						padding-left: 48rpx;
					}
				}
				.status{
					width: 90rpx;
					height: 48rpx;
					border-radius: 0rpx 16rpx 0rpx 16rpx;
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					font-size: 26rpx;
					color: #FFFFFF;
					line-height: 48rpx;
					text-align: center;
					position: absolute;
					top: 0;
					right: 0;
					&.on{
						background: #14CC8C;
					}
					&.off{
						background: #B9C0C8;
					}
					&.mr{
						background: #666666;
					}
				}
				.btn{
					width: 114rpx;
					height: 64rpx;
					background: #198CFF;
					border-radius: 32rpx;
					font-family: PingFang-SC, PingFang-SC;
					font-weight: bold;
					font-size: 28rpx;
					color: #FFFFFF;
					line-height: 64rpx;
					text-align: center;
					letter-spacing: 2rpx;
					position: absolute;
					right: 24rpx;
					bottom: 36rpx;
				}
			}
		}
	}
</style>