<template>
	<view class="goods-hotel">
		<view class="search">
			<u-input placeholder="搜索" border='none' v-model="search" @input="searchText">
				<template slot="suffix" style='margin-right:40rpx;'>
					<u-image :showLoading="true" :showError='true' src="/static/icon/search.png" width="40rpx"
						height="32rpx"></u-image>
				</template>
			</u-input>
		</view>

		<view class="content">
			<view class="content-item" v-for="item in 2">
				<image style="flex: none;width: 112rpx;height: 112rpx;border-radius: 50%;" src="/static/icon/youyue.png"
					mode=""></image>
				<view class="content-item-main">
					<text class="content-item-main-text">成都环球中心天堂洲际大饭店</text>
					<view class="content-item-main-call" style="margin: 20rpx 0 12rpx;">
						<image style="width: 26rpx;height: 26rpx; margin-right: 8rpx;" src="/static/icon/phone02.png"
							mode=""></image>
						<text>028-129320</text>
					</view>
					<view class="content-item-main-call">
						<image style="width: 24rpx;height: 28rpx; margin-right: 8rpx; " src="/static/icon/address01.png"
							mode=""></image>
						<text>1.2km</text>
					</view>
				</view>
				<view class="content-item-right">
					<image style="width: 50rpx;height: 48rpx;" src="/static/icon/navigation.png" mode=""></image>
					<text class="content-item-right-text">去这里</text>
				</view>
			</view>
		</view>
		<!-- 触底 -->
		<view class="home-bottom">
			<uni-load-more :status="status" color="#CCCCCC" :content-text="contentText" />
		</view>

	</view>
</template>

<script>
	import util from '../../../utils/util.js'
	export default {
		data() {
			return {
				// 搜索
				search:'',
				// 组价uni-load-more
				status: 'noMore',
				contentText: {
					contentdown: '查看更多',
					contentrefresh: '加载中',
					contentnomore: '——  已经到底啦  ——'
				},
				// 酒店列表
				hotelList:[],
				// 产品id
				product_id:'',
			}
		},
		onLoad(op) {
			this.product_id=op.product_id
			if(op.product_id!=''){
				this.getHotelList(op.product_id)
			}
		},
		methods: {
			// 获取酒店列表
			getHotelList(id){
				this.$api.hotel.getHotelList({
					page:1,
					product_id:id
				}).then(res=>{
					console.log(res,"酒店列表")
					if(res.code==0){
						this.hotelList=res.data.data
					}
				})
			},
			// 搜索防抖
			searchText:util.debounce(function(){
				this.goSearch()
			},1000),
			// 搜索
			goSearch(){
				this.$api.hotel.getHotelList({
					page:1,
					name:this.search,
					product_id:this.product_id
				}).then(res=>{
					console.log(res,'搜索酒店列表')
					if(res.code==0){
						this.hotelList=res.data.data
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	$pageColor:#F9F9F9;
	$bgColor:#FFFFFF;

	@mixin flexlayout {
		display: flex;
		align-items: center;
		justify-content: center;
	}

	page {
		height: 100% !important;
		background: #F9F9F9 !important;
	}

	.goods-hotel {
		height: 100%;
		background: #F9F9F9;
	}

	.home-bottom {
		background-color: #f9f9f9;
	}

	.content {
		width: 100%;
		padding: 24rpx 30rpx;
		padding-bottom: 30rpx;
		background-color: #F9F9F9;

		.content-item {
			margin-bottom: 24rpx;
			padding: 0 24rpx;
			padding-top: 20rpx;
			padding-bottom: 20rpx;
			height: 204rpx;
			background: #FFFFFF;
			box-shadow: 0px 4rpx 24rpx -10rpx rgba(101, 95, 90, 0.3);
			border-radius: 12rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;

			.content-item-main {
				flex: 1;
				display: flex;
				flex-direction: column;
				align-items: flex-start;
				justify-content: center;
				margin-left: 20rpx;
				margin-top: 12rpx;

				.content-item-main-text {
					font-weight: 500;
					color: #333333;
					font-size: 30rpx;
				}

				.content-item-main-call {
					font-weight: 500;
					color: #666666;
					font-size: 26rpx;
					display: flex;
					align-items: center;
					justify-content: flex-start;
				}
			}

			.content-item-right {
				flex: none;
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;

				.content-item-right-text {
					font-weight: bold;
					color: #FF6201;
					font-size: 24rpx;
					margin-top: 16rpx;
				}
			}
		}
	}

	.search {
		padding: 0 30rpx;
		height: 124rpx;
		background: #FFFFFF;
		box-shadow: 0px 4rpx 8rpx 0px rgba(0, 0, 0, 0.04);
		display: flex;
		align-items: center;
		justify-content: center;

		::v-deep .u-input {
			width: 690rpx !important;
			height: 68rpx !important;
			background: #F1F1F1;
			border-radius: 74rpx;
		}

		::v-deep .u-input__content__field-wrapper {
			padding-left: 36rpx;
		}

		::v-deep .u-input__content__field-wrapper__field {
			color: #999999 !important;
			font-size: 28rpx !important;
		}
	}
</style>
