<template>
	<view class="content" :style="ing&&result.length==0?'':'background-color: #ffffff'">
		<car-common   ref="common"  ></car-common>
		
		<u-navbar :is-back="back"  title="">	
			<view class="slot-wrap">	
				<view class="search-wrap">
					<u-search placeholder="搜索线路"  :focus="true" v-model="key" @change="change()" @search="submit"  :show-action="false"></u-search>
				</view>
				<view class="navbar-right">
				
					<u-button type="warning" shape="circle" size="mini" @click="submit()">搜索</u-button>
				</view>
			</view>
		</u-navbar>	
		<view class="search" >
			<view class="search-head" v-show="!ing">
				<span>搜索历史</span>
				<u-icon name="shanchu" @click="clearBtn"  custom-prefix="custom-icon" size="36" color="#888888"></u-icon>
			</view>
			
			<view class="search-main" v-show="!ing">
				<view class="search-record" v-for="item,index in record" :key="index" @click="key=item,submit()">{{item}}</view>
			 
			</view>
			<view class="search-result" v-show="ing&&result.length" v-for="item,index in result" :key="index" @click="gotoLine(item)">
				<u-icon name="bus" custom-prefix="custom-icon" size="30" color="#888888" v-if="!item.stationId"></u-icon>
				<u-icon name="zhanpai1" v-if="item.stationId" custom-prefix="custom-icon" size="30" color="#888888"></u-icon>
				
				<view class="search-result-text"  >
					<p>{{item.name1}}</p><span>{{key}}</span><p>{{item.name2}}</p>
				</view>
			</view>
			<view v-show="ing&&result.length&&result.length==recordsTotal" style="text-align:center;margin-top: 10px;">没有更多记录了</view>
			<view v-show="ing&&result.length&&result.length<recordsTotal" style="text-align:center;margin-top: 10px;">只展示20条数据</view>
			
			<view  v-show="ing&&result.length==0" style="text-align:center;margin-top: 80px;" >
				<img src="static/img/blankpage.png" style="width: 50%;" alt="" >
				<view>附近暂无站点信息</view>
			</view>
			
			
		</view>
	</view>
</template>

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

<style scoped lang="scss">
	
	
	.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;
	}
	.search{
		margin: 20rpx;
		.search-head{
			display: flex;
			justify-content: space-between;
			align-items: center;
			span{
				color:#999;
			}
		}
		.search-result{
			border-bottom: 1px solid #f7f7f7;
			padding:20rpx ;
			display: flex;
			align-items: center;
			.search-result-text{
				display: flex;
				align-items: center;
				margin-left: 20rpx;
				span{
					color:#ff7826
				}
			}
		}
		.search-main{
			margin-top: 30rpx;
			.search-record{
				background-color: #eee;
				float: left;
				margin:10rpx;
				padding:10rpx 30rpx;
				border-radius: 10rpx;
			}
			
		}
	}
</style>
