<template>
	<!-- 选择驾校弹出框 -->
	
	<view class="box">
		<view class="schoolTit">
			选择驾校
		</view>
		<view class="searchBox">
			<u-search placeholder="请输入驾校名称" v-model.trim="keyword" @search="searchSchool" @custom="searchSchool">
			</u-search>
		</view>
		<scroll-view scroll-y="true" style="height: calc(100% - 180rpx);" @scrolltolower="loadMore">
			<view class="ul">
				<view class="li" v-for="(item,index) in list" :key="index" @click="chooseSchool(item)">
					<view class="name">
						{{item.schoolName}}
					</view>
					<view class="starText">
						{{item.starLevel}}分
					</view>
					<!-- <view class="distance">
						{{ $u.utils.distanceFn(item.distance)}}
					</view> -->
				</view>
			</view>
			<u-loadmore :status="status" icon-type="circle" />
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				keyword: '',
				status: 'loadmore',
				list: [
					{schoolName: '翔力驾校',starLevel: 5, }
				]
			}
		},
		methods: {
			// 选择驾校
			chooseSchool(item) {
				this.$emit('chooseSchool', item)
			},
		}
	}
</script>

<style lang="scss" scoped>
	.schoolTit {
		line-height: 90rpx;
		text-align: center;
		font-size: 28rpx;
	}
	
	.searchBox {
		width: 100%;
		padding: 0 20rpx 20rpx 20rpx;
		border-bottom: 1rpx solid #ededed;
	}
	
	.ul {
		width: 100%;
		padding: 0 20rpx;
	
		.li {
			width: 100%;
			display: flex;
			align-items: center;
			height: 90rpx;
			font-size: 24rpx;
			border-bottom: 1rpx solid #ededed;
	
			&:last-child {
				border: none;
			}
	
			.name {
				width: 0;
				flex: 1;
				font-size: 28rpx;
			}
	
			.starText {
				color: red;
				width: 100rpx;
				text-align: right;
				flex-shrink: 0;
				white-space: nowrap;
			}
	
			.distance {
				width: 120rpx;
				text-align: right;
				flex-shrink: 0;
				white-space: nowrap;
			}
		}
	}
</style>