<template>
	<view>
		<ujp-navbar title="摄像头管理"></ujp-navbar>
	 
		<view class="deviceList" 	>
		<view style="text-align: center;margin-top: 100px" v-if="!list.length">
			<img src="@/assets/img/blankpage.png">
			<view>查询为空</view>
		</view>
		
		
		
			<view v-for="(item ,index) in list" :key="item.id"
			@click="gotoUrl('pagesFinance/user/deviceListLine?id='+item.id)"
		 
			class="deviceList-item deviceList-bg1" >
				<view class="deviceList-main">
				 
			<!-- 	<span class="btn12 " v-if="item.type=='1,2'" >快/慢</span>
				<span class="btn12 btn1"  v-if="item.type=='1'"  >慢冲</span>
				<span class="btn12 btn2" v-if="item.type=='2'" >快冲</span> -->
				{{item.name}}</view>
 				<view class="deviceList-head">{{item.address}}<span style="float: right;" class="iconfont more">&#xe600;</span></view>
				<view class="deviceList-foot">
					
					<view class="deviceList-label" style="color: #333333;"  >摄像头总数<b>{{item.cameraNum}}</b></view>
				
					
				<!-- 	<view class="deviceList-label">{{item.roleName}}</view> -->
				</view>
			</view>
			<u-divider v-if="list.length&&list.length==recordsTotal" color="#B6BDC3" style="margin-top:20px;" bg-color="#f7f7f7">已经到底了</u-divider>
			
		 
		</view>
	</view>
</template>

<script>
	import * as API from '@/apis/finance.js'
	
	export default {
		data() {
			return {
				form: {
				
				},
				startDate:'',
				endDate:'',
				pageIndex: 1,
				recordsTotal: 0,
				list: [],
				value1: -1,
				value2: -1,
				value3: -1,
				stationList:[],
				options0: [
					{
							label: '全部',
							value: -1,
						},
					{
						label: '自行车充电',
						value: 0,
					},
					{
						label: '交流慢充',
						value: 2,
					},
					{
						label: '直流快充',
						value: 1,
					}
				],
				options1: [{
						label: '全部',
						value: '-1',
					},
					{
						label: '自行车充电',
						value: 0,
					},
					{
						label: '交流慢充',
						value: 2,
					},
					{
						label: '直流快充',
						value: 1,
					}
				],
				options2: [
				],
				options3: [
					{
						label: '全部',
						value: -1,
					},
					{
						label: '在线',
						value: 1,
					},
					{
						label: '离线',
						value: 0,
					},
				],
			}
		},
		onReachBottom() {
			if (this.list.length < this.recordsTotal) {
				this.myLoadmore();
			}
		},
		methods: {
			change1(e){
				this.form.type=e
				if(e==-1){
					this.form.type=""
				}
				this.getList(true)
			},
			change2(e){
				this.form.stationId=e
				if(e==-1){
					this.form.stationId=""
				}
				this.getList(true)
			},
			change3(e){
				this.form.onlineStatus=e
				if(e==-1){
					this.form.onlineStatus=""
				}
				this.getList(true)
			},
			 
		myLoadmore() {

				this.pageIndex += 1;
				this.getList()
			},
			getList(bl) {
				
				uni.showLoading({
					title: "加载中",
					mask: true,
				})
				if (bl) {
					this.list = [];
					this.pageIndex = 1;
				}
				this.form.pageIndex= this.pageIndex
				
				API.stationsListLine(this.form).then((res) => {
					
					this.list = [
						...this.list,
						...res.data.data
					];
				 
					uni.hideLoading()

				}).catch(error => {
					uni.showToast({

						title: error
					})
				})
			},
			onReady() {
				//this.getStation()
				this.getList()
				
			}
		}
	}
</script>
<style>
	page{
		background-color: #F7F7F7;
	}
</style>
<style lang="scss" scoped>
	.btn12{
		color: #fff;
		background-color: #449ca8;
		font-size: 16px;
		    border-radius: 50px;
		    padding: 1px 5px;
	}
	.btn1{
	
		background-color: #5cbe7d;
		
	}
	.btn2{
	
		background-color: #7a68f6;
		
	}
	.deviceDropdown{
		background-color: #fff;
	}
	.deviceList-item{
		margin: 16px;
		border-radius: 8px;
		.deviceList-head{
			color: #9e9e9e;
			font-size: 16px;
			padding: 8px 16px;
		}
		.deviceList-main{
			font-size: 20px/*  */;
			padding:5px 16px 0px 16px;
			font-weight: bold;
		}
		.deviceList-foot{
			display: flex;
			align-items: center;
			flex-wrap: wrap;
			padding: 0 16px 16px;
			.deviceList-label{
				// background-color: #F0F2F4 ;
				// padding: 4px 10px;
				margin: 1px;
				border-radius: 4px;
			}
		}
	}
	.deviceList-bg1{
		//background:url(../../assets/img/charging_type_fast.png) no-repeat #fff;
		background-size:100%;
		background-color: #ffffff ;
	}
	.deviceList-bg2{
		background:url(../../assets/img/charging_type_slow.png) no-repeat #fff;
		background-size:100%;
	}
	.deviceList-bg3{
		background:url(../../assets/img/charging_type_bike.png) no-repeat #fff;
		background-size:100%;
	}
</style>
