<template>
	<view>
		<u-navbar  title="选择地锁" title-color="#101010"></u-navbar>
		
		<view class="top">
			<view class="search">
				<view class="searchBox">
					<u-search shape="square" placeholder="使用停车场名称/地锁编号搜索" maxlength="12" v-model="testName" :show-action="false"
						:animation="true"></u-search>
					<u-button type="primary" size="mini" @click="testBtn">搜素</u-button>
				</view>
			</view>
		</view>
		<view class="body2">
			<view class="item" v-if="isAll"  @click="returnName( {id:''})">
				<view class="v">
					
			
					<view class="v1" style="font-weight: bold;" >
						查询全部
					</view>
					
				</view>
				<u-icon name="arrow-right" size="24" color="#BBBBBB"></u-icon>
			</view>
			<view class="item" v-for="(item,i) in list" :key="i"
				@click="returnName( item)">
				<view class="v">
					

					<view class="v1" >
						{{item.parkingName}}<span class="y">|</span>{{item.lockNo}}
					</view>
					<view class="v2" >
						地锁名称：{{item.name}}
					</view>
					<view class="v2" v-if="item.locationAddress" >
						地锁地址：{{item.locationAddress}}
					</view>
				</view>
				<u-icon name="arrow-right" size="24" color="#BBBBBB"></u-icon>
			</view>

			 
		</view>

		<u-divider color="#B6BDC3" :isnone="list.length==0">已经到底了</u-divider>
	</view>
</template>

<script>
	import * as API from '@/apis/pagejs/pagesTask.js'

	export default {
		data() {
			return {
				list: [],
				testName: "",
				queryName: "",
				type: 1,
				isAll: 0,
			};
		},
		onLoad(op) {
			if (op.isAll) {
				this.isAll = op.isAll
			}
			if (op.type) {
				this.type = op.type
			}
			this.getList()
		},
		methods: {
			getList() {
				uni.showLoading({
					title: "加载中",
					mask: true,
				})
				var obj = {
					name: this.testName
				}
				if (this.type == 3) {
					obj.buildMode = 2
				}
				API.findFloorLock(obj).then((res) => {
					this.queryName = this.testName
					var list = res.data.floorlockInfoList
					if (list == null) {
						list = []
					}
					this.list = list


					


					uni.hideLoading();

				}).catch(error => {

					uni.hideLoading();
					uni.showToast({
						title: error,
						icon: "none"
					})
				})
			},
			returnName(  obj) {
				const eventChannel = this.getOpenerEventChannel();

				eventChannel.emit('acceptDataFromOpenerPage', {
				 
					item: obj
				})
				uni.navigateBack()
			},
			testBtn() {

				this.list = []
				//this.listForm.pageIndex=1
				this.getList()
			},
			getInfo() {

			}

		}
	}
</script>
<style>
	page {
		background-color: rgba(242, 244, 246, 1);
	}
</style>
<style lang="scss" scoped>
	::v-deep .u-content {
		width: 380% !important;
	}

	.search {

		padding: 16rpx 32rpx;
		background: #fff;

		.searchBox {
			display: flex;
			align-items: center;
			background: #F2F2F2;
			padding: 1px 16rpx;
			border-radius: 8px;
			justify-content: space-between;
		}
	}

	.body2 {
		padding-top: 20rpx;
		.item:not(:last-child) {
			border-bottom: 1px solid rgba(232, 232, 232, 1);
		}

		.item {
			padding: 24rpx 32rpx;
			background: #fff;
			display: flex;
			justify-content: space-between;

			.vquery {
				display: flex;
				align-items: center;
			}

			.buildMode {
				font-size: 24rpx;
				border: 1px solid #bbbbbb;
				border-radius: 4px;
				color: #1677ff;
				padding: 2rpx 8rpx;
				margin: 0 8rpx;

			}

			.buildMode1 {
				color: #1677ff;
				border: 1px solid #1677ff;
			}

			.buildMode2 {
				color: #4CAF50;
				border: 1px solid #4CAF50;
			}

			.qName {
				color: #FF5100
			}

			.v1 {
				color: rgba(16, 16, 16, 1);
				font-size: 32rpx;
			}
			.y{
				margin: 0 8rpx;
				color:rgba(119, 119, 119, 1);
				
			}
			.v2 {
				color: rgba(119, 119, 119, 1);
				font-size: 24rpx;
			}

		}
	}
</style>