<template>
	<view class="">
		<view class="cabinet-list-main" v-if="item.dev_id" @tap="navDeatil(item)"  v-for="(item, index) in near_cabinet_list" :key="index">
			<view class="flex-row flex-between">
				<view class="cabinet-name">{{item.cabinet_name}}</view>
				<view class="cabinet-distance">{{item.distance}}m</view>
			</view>
			<view class="battery-list-view">
				<view style="margin-bottom: 10rpx;" class="battery-view" v-for="(items, index) in item.tag_code" :key="index">
					<text class="battery-voltage">{{items.main_tag_name ? items.main_tag_name : ''}}{{items.child_tag_name ? '/' + items.child_tag_name : ''}}</text>
					<text class="battery-num">{{'*'+items.num}}</text>
				</view>
			</view>
			<view  class="flex-row flex-end">
				<view @tap.stop="navBtn" :data-item="item" style="height: 56rpx;"><img style="width: 112rpx;height: 64rpx;" src="https://qiniu.bms16.com/Fts38M35doVjK09GfOza5qD-wwkK" alt=""></view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			near_cabinet_list:{
				type:Array,
				defult:[]
			}
		},
		data() {
			return {
			};
		}
		/**
		 * 生命周期函数--监听页面加载
		 */
		,
		onLoad: function(options) {
		},
		methods: {
			navBtn(e){
				const shop = e.currentTarget.dataset.item;
				uni.openLocation({
					latitude: shop.latitude - 0,
					longitude: shop.longitude - 0,
					scale: 15,
					name: shop.cabinet_name,
					address: shop.address,
					success: function(res) {}
				})
			},
			navDeatil(item){
				let dev_id = item.dev_id
				uni.navigateTo({
					url: `/pages/cabinetDetail/cabinetDetail?dev_id=${dev_id}`
				});
				
			}
		}
	};
</script>
<style>
	@import './cabinetList.css';
</style>