<template>
	<view class="step2">
		<view class="card" v-for="(item,index) in list" :key="index" :class="{active: siteId==item.id}" @click="chooseSite(item)">
			<view class="leftTxt">
				<view class="name oneRowText">{{ item.name}}</view>
				<view class="adr">{{ item.address }}</view>
			</view>
			<view class="icon">
				<image src="@/static/images/car/btn_daohang_cli.png" mode="" v-if="siteId==item.id"></image>
				<image src="@/static/images/car/btn_daohang.png" mode="" v-else></image>
			</view>
		</view>
		<view class="poz_btn">
			<view class="btn_row" >
				<view class="btn"  @click="changeStep(2)">下一步</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: ['list', 'siteId'],
		methods: {
			changeStep(val) {
				if(!this.siteId) return this.$u.toast('请选择考场')
				this.$emit('changeStep', val)
			},
			chooseSite(item) {
				this.$emit('chooseSite', item)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.poz_btn {
		position: fixed;
		bottom: 0;
		left: 0;
		padding: 32rpx;
		width: 100%;
		background: #F6F6F6;
	}
	.step2 {
		width: 100%;
		padding-bottom: 120rpx;
		.card {
			padding: 28rpx 36rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-bottom: 20rpx;
			&.active {
				background: rgba(25,137,250,0.1);
				border: 2rpx solid #1989FA;
				color: $themC;
			}
			.leftTxt {
				width: 0;
				flex: 1;
				.name {
					font-size: 32rpx;
					font-weight: 600;
				}

				.adr {
					font-size: 24rpx;
					margin-top: 8rpx;
				}
			}

			.icon {
				width: 72rpx;
				height: 72rpx;
				border-radius: 50%;
				overflow: hidden;
			}
		}
	}
	.btn {
		width: 47%;
		height: 72rpx;
		background: #1989FA;
		border-radius: 8rpx;
		font-size: 28rpx;
		color: #fff;
		text-align: center;
		line-height: 72rpx;
		margin: 0 auto;
	}
</style>