<template>
	<view class="near-good" @click="goDetail">
		<image :src="goodItem.CoverImg" mode="aspectFill"></image>
		<view class="good-name" v-if="goodType===1">{{goodItem.HotelName.substring(0,6)+'...'}}</view>
		<view class="good-name" v-if="goodType===2">{{goodItem.Name.substring(0,6)+'...'}}</view>
	</view>
</template>

<script>
	export default {
		props: {
			goodItem: {
				type: Object,
				default: {}
			},
			goodType: {
				type: Number,
				default: 0
			}
		},
		data() {
			return{
				
			}
		},
		created() {
		},
		methods: {
			//页面跳转
			goDetail() {
				//1 酒店
				if(this.goodType==1){
					uni.navigateTo({
						url: "/pages/hotel/detail?id="+this.goodItem.HotelId,
					});
				}
				//2 美食
				if(this.goodType==2){
					uni.navigateTo({
						url:"/pages/restaurant/detail?id="+this.goodItem.ID
					});
				}
			}
		}
	}
</script>

<style>
	.near-good {
		margin-right: 20rpx;
		flex-shrink: 0;
	}

	.near-good image {
		width: 200rpx;
		height: 200rpx;
		border-radius: 20rpx;
		margin-bottom: 29rpx;
	}

	.near-good .good-name {
		font-weight: bold;
		color: #1F1F1F;
		font-size: 28rpx;
		text-overflow: ellipsis;
		overflow: hidden;
		white-space: nowrap;
	}
</style>
