<template>
	<view>
		<view class="hotel-list-item" v-for="(item,index) in HotelList" :key="index" @click="goHotelDetail(item.HotelId)">
			<view class="img-box">
				<image :src="item.CoverImg" mode="aspectFill"></image>
			</view>
			<view class="hotel-info">
				<view class="hotel-name">{{item.HotelName}}</view>
				<view class="hotel-start">
					<!-- TODO：判定是否为星级酒店，如果是显示星级，不是，显示另外一种方式 -->
					<view class="rate" v-if="item.Star>=1&&item.Star<=5">
						<u-rate active-color="#FEB969" inactive-color="#b2b2b2" :current="item.Star" active-icon="star" inactive-icon="star" disabled></u-rate>
						<text style="margin-left: 20rpx;vertical-align: top;">{{item.Star+'.0'}}</text>
					</view>
					<view class="other-rate" v-if="item.Star==9">
						<text>温泉酒店</text>
						<span class="line"></span>
					</view>
					<view class="other-rate" v-if="item.Star==8">
						<text>精选民宿</text>
						<span class="line"></span>
					</view>
				</view>
				<view class="localtion">{{item.Address}}</view>
				<view>
					<u-tag v-for="(subItem,subIndex) in item.TagList" :key="subIndex" style="margin-right:10rpx;" :text="subItem" bg-color="#FFF" border-color="#DFBE6E" color="#DFBE6E"
					 size="mini"></u-tag>
				</view>
				<view class="price">
					<text>￥</text>
					<text class="money">{{$utils.getretailer()==true? item.B2BPrice:item.SalesPrice}}</text>
					<text>起</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			HotelList: {
				type: Array,
				default: null
			},
			dayObj:{
				type: Object,
				default: null
			},
			searchObj:{
				type:Object,
				default:null
			}
		},
		data() {
			return {
				key: value
			}
		},
		created() {
			console.log(this.HotelList, 'hotel');
		},
		methods:{
			goHotelDetail(id){
				let myDayObj = JSON.stringify(this.dayObj);
				uni.navigateTo({
					url: "/pages/hotel/detail?id=" + id + '&dayObj=' + myDayObj+'&searchObj='+JSON.stringify(this.searchObj)
				});
			}
		}
	}
</script>

<style>
	.hotel-list-item {
		margin: 30rpx 30rpx 0 30rpx;
		padding-bottom: 30rpx;
		border-bottom: 1rpx solid #E2E2E2;
		display: flex;
		align-items: flex-start;
	}

	.hotel-list-item .img-box {
		width: 220rpx;
		height: 280rpx;
		border-radius: 20rpx;
		overflow: hidden;
		margin-right: 30rpx;
	}

	.hotel-list-item .img-box image {
		width: 100%;
	}

	.hotel-list-item .hotel-info {
		width: 1px;
		flex: 1;
		margin-top:20rpx;
	}

	.hotel-list-item .hotel-info .hotel-name {
		font-weight: 500;
		color: #111111;
		line-height: 30rpx;
		font-size: 30rpx;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.hotel-list-item .hotel-info .hotel-start {
		margin: 20rpx 0;
	}

	.hotel-list-item .hotel-info .hotel-start .rate {
		font-size: 30rpx;
		font-weight: 500;
		color: #999999;
		line-height: 30rpx;
		display: flex;
		align-items: center;
	}

	.hotel-list-item .hotel-info .hotel-start .other-rate {
		display: inline-block;
		position: relative;
	}

	.hotel-list-item .hotel-info .hotel-start .other-rate text {
		position: relative;
		z-index: 2;
		font-size: 30rpx;
		line-height: 30rpx;
		font-weight: 500;
		color: #111;
	}

	.hotel-list-item .hotel-info .hotel-start .other-rate .line {
		background-color: #DFBE6E;
		height: 6px;
		bottom: 2px;
		left: 0;
		right: 0;
		position: absolute;
		z-index: 1;
	}

	.hotel-list-item .hotel-info .localtion {
		font-size: 24rpx;
		font-weight: 400;
		color: #999999;
		line-height: 30rpx;

		text-overflow: -o-ellipsis-lastline;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		margin-bottom: 10rpx;
	}

	.hotel-list-item .hotel-info .price {
		margin-top: 10rpx;
		font-weight: 500;
		color: #FF3166;
		font-size: 20rpx;
		text-align: right;
	}

	.hotel-list-item .hotel-info .price .money {
		font-size: 36rpx;
	}
</style>
