<template>
	<view class="hotel-list-item" :class="[isMap?'hotel-mapList':'']" @click="goHotelDetail(item.hotelid)">
		<view class="img-box">
			<image v-if="item.coverimg&&item.coverimg!=''" :src="item.coverimg" mode="aspectFill"></image>
			<image v-else src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/defaultHotelImg.png"
				mode="aspectFill"></image>
		</view>
		<view class="hotel-info column">
			<view class="hotel-name row items-center">
				<img v-if="item.starRating>=3" class="hotel-SubR"
					:class="[item.starRating==3?'hotel-SubStar3':item.starRating==4?'hotel-SubStar4':item.starRating==5?'hotel-SubStar5':'']"
					:src="item.starRating==3?StarImgs[0]:item.starRating==4?StarImgs[1]:item.starRating==5?StarImgs[2]:''" />
				<text v-else class="hotel-Economy">经济型</text>
				{{item.name}}
			</view>
			<view class="hotel-Subtitle row">
				<view class="hotel-SubText" v-if="item.areaList.length>0">
					<text v-for="(t,i) in item.areaList" :key="i">{{ t }}
						<template v-if="i!=item.areaList.length-1">、</template>
					</text>
				</view>
			</view>
			<view class="hotel-start">
				<view class="other-rate" v-for="(tItem,i) in item.tagList" :key="i">
					<text>{{tItem}}</text>
				</view>
			</view>
			<view class="localtion row items-start">
				<view class="localtionL">
					<img style="width: 18rpx;height: 21rpx;"
						src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/638759918789658713.png" />
				</view>
				<view class="localtionR" style="width:1px;flex:1">
					{{item.address}}
				</view>
			</view>
			<view class="hotel-price">
				<view class="hotel-priceL">
					<view>
						{{ item.brandname }}
					</view>
				</view>
				<view class="price">
					<text>CNY</text>
					<text class="money">{{item.unitprice}}</text>
					<text>起</text>
				</view>
			</view>

		</view>
	</view>
</template>

<script>
	export default {
		props: ['item', 'isMap', 'dayObj', 'searchObj'],
		data() {
			return {
				StarImgs: [
					'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/hotel3stars.png',
					'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/hotel4stars.png',
					'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/hotel5stars.png',
				],
				myDayObj: null,
			}
		},
		created() {},
		watch: {
			dayObj: {
				handler(val, oldval) {
					if (val) {
						this.myDayObj = val
					}
				},
				deep: true,
				immediate: true
			}
		},
		methods: {
			goHotelDetail(id) {
				let myDayObj = JSON.stringify(this.myDayObj);
				uni.navigateTo({
					url: "/pages/hotel/detail?id=" + id + '&dayObj=' + myDayObj + '&searchObj=' + JSON.stringify(
						this.searchObj)
				});
			}
		}
	}
</script>

<style>
	@import url("@/asset/css/flex.css");

	.hotel-list-item {
		margin: 0 0 25rpx 0;
		padding-bottom: 25rpx;
		border-bottom: 1rpx solid #f2f2f2;
		display: flex;
		align-items: flex-start;
	}

	.hotel-list-item .img-box {
		width: 161rpx;
		height: 236rpx;
		border-radius: 14rpx;
		overflow: hidden;
		margin-right: 17rpx;
	}

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

	.hotel-list-item .hotel-info {
		width: 1px;
		height: 236rpx;
		flex: 1;
	}

	.hotel-list-item .hotel-info .hotel-name {
		font-weight: bold;
		color: #111111;
		line-height: 34rpx;
		font-size: 28rpx;
		word-break: break-all;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		overflow: hidden;
	}

	.hotel-Economy {
		font-weight: 500;
		font-size: 22rpx;
		color: #757776;
		margin-left: 10rpx;
	}

	.hotel-list-item .hotel-info .hotel-start {}

	.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 {
		height: 28rpx;
		overflow: hidden;
		display: inline-block;
		border: 1rpx solid #B99846;
		border-radius: 4rpx;
		padding: 0 4rpx 0 4rpx;
		margin-right: 10rpx;
	}

	.hotel-list-item .hotel-info .hotel-start .other-rate text {
		font-size: 20rpx;
		font-weight: 500;
		color: #B99846;
		position: relative;
		top: -10rpx;
	}

	.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 {}

	.hotel-list-item .hotel-info .localtionL {
		margin-right: 9rpx;
	}

	.hotel-list-item .hotel-info .localtionL img {
		position: relative;
		top: -7rpx;
	}

	.hotel-list-item .hotel-info .localtionR {
		font-size: 22rpx;
		font-weight: 500;
		color: #080A09;
		line-height: 28rpx;
		text-overflow: -o-ellipsis-lastline;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
	}

	.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: 34rpx;
		margin-left: 5rpx;
	}

	.hotel-Subtitle {
		font-size: 22rpx;
		color: #FF3166;
		padding: 5rpx 0;
	}

	.hotel-SubText {
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
	}

	.hotel-SubR {
		max-width: 102rpx;
		height: 35rpx;
		margin-right: 10rpx;
		position: relative;
		top: 6rpx;
	}

	.hotel-Subtitle img {
		height: 35rpx;
		display: block;
	}

	.hotel-SubStar3 img {
		width: 74rpx;
	}

	.hotel-SubStar4 img {
		width: 81rpx;
	}

	.hotel-SubStar5 img {
		width: 102rpx;
	}

	.hotel-price {
		height: 1px;
		flex: 1;
		display: flex;
		justify-content: space-between;
		align-items: flex-end;
	}

	.hotel-priceL {
		width: 198rpx;
		background: url('https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/638759918587388853.png')no-repeat;
		background-size: 198rpx 26rpx;
	}

	.hotel-priceL view {
		width: 198rpx;
		font-size: 20rpx;
		color: #fff;
		padding: 0rpx 12rpx 0rpx 12rpx;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
		position: relative;
		top: -3rpx;
		text-align: center;
	}

	.hotel-list-item.hotel-mapList {
		margin: 0;
		padding-bottom: 0;
		border-bottom: 0;
	}
</style>