<template>
	<view class="content">
		<car-common   ref="common"  ></car-common>
		
		<u-navbar :is-back="false" title="">	
			<view class="slot-wrap">
				<view class="navbar-left">
					<u-dropdown ref="uDropdown">
						<u-dropdown-item title="荆州">
							<view class="slot-content">
								<view class="u-text-center">沙市</view>
								<view class="u-text-center">湖南</view>
								<view class="u-text-center">湖北</view>
								<u-button type="primary" @click="closeDropdown">确定</u-button>
							</view>
						</u-dropdown-item>
					</u-dropdown>
				</view>				
				<view class="search-wrap" >
					<u-search placeholder="查线路、站点" @click="gotoQuery" :disabled="true" :show-action="false"></u-search>
				</view>
				<view class="navbar-right"  @click="getScan">
					<u-icon name="saoma" custom-prefix="custom-icon" size="40" color="#333"></u-icon>
				</view>
			</view>
			
		</u-navbar>	
		<view class="banner">
			<u-swiper :list="list" @click="clickSwiper"></u-swiper>
		</view>
		
		<view  v-if="!getPointBl"  style="text-align:center;margin-top: 40px;" >		
			 <img src="static/img/getPointError.png" style="width: 50%;" alt="" >
			 <view>无法获取定位信息,请打开手机定位功能</view>
			 <u-button :custom-style="btn" size="medium" shape="circle" plain @click="getPoint(true)"  >刷新</u-button>
			 
		</view>
		
		<view  v-if="getPointBl&&siteList.length==0" style="text-align:center;margin-top: 40px;" >
			<img src="static/img/null.png" style="width: 50%;" alt="" >
			<view>附近暂无站点信息</view>
			<u-button   :custom-style="btn" size="medium" shape="circle" plain   @click="getPoint(true)" >刷新</u-button>
		</view>
		<view class="index-floor"  v-for="item,index in siteList" :key="index">
			
			<view class="title">
				<u-icon name="zhanpai" custom-prefix="custom-icon" size="40" color="#1677ff"></u-icon>
				<span>{{item.stationName}}</span>
			</view>
			<view class="content">
				<view class="route">
					<view class="route-item" v-for="li,i in item.nearbyShiftDTOList" :key="i" @click="gotoLine(li)">
						<view class="route-text">
							<h4>{{li.routeName}}</h4>
							<p>开往 {{li.endStationName}}</p>
						</view>
						<view class="route-gap" >
							<view class="route-gap stop">
								<span>{{li.distance}}米</span>
								<u-icon name="arrow-right" color="#999" size="28"></u-icon>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	
	import api from './index.js'
	export default   api
</script>

<style>
	page{background-color: #f7f7f7;}
</style>
<style scoped lang="scss">
	.btn{
		border-color: #1677FF ;
	}
	.slot-wrap {
		display: flex;
		align-items: center;
		flex: 1;
	}
	.navbar-right {
		display: flex;
		margin-right: 20rpx;
	}
	.navbar-left{
		display: flex;
		align-items: center;
		margin-left: 20rpx;
		span{
			margin-right: 6rpx;
			font-size: 14px;
		}
	}
	.search-wrap {
		margin: 0 20rpx;
		flex: 1;
	}
	.banner{
		padding: 20rpx;
		background-color: #fff;
	}
	.slot-content{
		background-color: #fff;
	}
	.index-floor{
		margin: 20rpx;
		background-color: #fff;
		border-radius: 20rpx;
		.title{
			padding: 20rpx;
			border-bottom: 1px solid #f7f7f7;
			display: flex;
			align-items: center;
			span{
				margin-left: 10rpx;
				font-size: 16px;
				font-weight: bold;
			}
		}
		.text{
			padding: 20rpx;
			border-bottom: 1px solid #f7f7f7;
			display: flex;
			align-items: center;
			span{
				margin-left: 10rpx;
				font-size: 12px;
			}
		}
	}
	.route{
		margin:0 20rpx;
	}
	.route-item{
		padding:  20rpx 0;
		border-bottom: 1px solid #f7f7f7;
		display: flex;
		justify-content: space-between;
		align-items: center;
		&:last-child{
			border: none;
		}
		h4{
			font-size: 32rpx;
		}
		p{
			margin-top: 6rpx;
			color:#999;
		}
	}
	.route-gap{
		span{
			font-size: 32rpx;
			font-weight: bold;
			margin-right: 10rpx;
			color:#1677ff;
		}
		&.stop{
			span{color:#ff731d}
		}
	}
</style>
