<template>
	<view class="bg">
		<view v-for="(item,index) in list" :key="index" class="item" @click="gotoDetail(item)">
			<image :src="showImg(item.arr.image)" mode="aspectFill"></image>
			<view class="content flex-column">
				<view class="title text-overflowRows">{{item.arr.title}}</view>
				<view class="price" v-if="item.arr.low_money">{{item.arr.low_money / 100}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: []
			}
		},
		onShow() {
			this.getList()
		},
		methods: {
			getList() {
				this.Post({
					offset: 0,
					limit: 100
				},'/api/scenic/getCollectList').then(res => {
					this.list = res.data
				})
			},
			// 通过type跳转详情
			gotoDetail(item) {
				// 1文章 2景点 3商品美食 4酒店 5商品文创 6商品线路 7活动
				let url = ''
				switch (item.type){
					case 1:
						url= '/subPackages/travelGuide/detail?id=' + item.arr.id
						break;
					case 2:
						url= '/subPackages/ticketBooking/detail?id=' + item.arr.id
						break;
					case 3:
						url= '/subPackages/food/foodDetail?id=' + item.arr.id
						break;
					case 4:
						url= '/subPackages/hotelHomestay/detail?id=' + item.arr.id
						break;
					case 5:
						url= '/subPackages/techan/detail?id=' + item.arr.id
						break;
					case 6:
						url= ''
						break;
					case 7:
						url= '/subPackages/eventCalendar/detail?id=' + item.arr.id
						break;
					default:
						break;
				}
				this.gotoPath(url)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.bg {
		min-height: 100vh;
		padding: 20rpx auto 100rpx;
		background: #F7F7F7;
	}
	
	.item {
		width: 697rpx;
		height: 213rpx;
		padding: 6rpx 20rpx 6rpx 6rpx;
		border-radius: 20rpx;
		display: flex;
		margin: 0 auto 20rpx;
		background: #FFFFFF;
		
		image {
			width: 200rpx;
			height: 200rpx;
			background: #DFEDE0;
			border-radius: 13rpx;
		}
		
		.content {
			flex: 1;
			margin-left: 15rpx;
			padding: 10rpx 0;
			height: 200rpx;
			justify-content: space-between;
			
			.title {
				font-weight: bold;
				font-size: 31rpx;
				color: #333333;
			}
			
			.price {
				font-weight: bold;
				font-size: 40rpx;
				color: #FF3D3D;
				text-align: right;
			}
			.price::before {
				content: '￥';
				font-size: 31rpx;
				color: #FF3D3D;
			}
			.price::after {
				content: '起';
				font-weight: 500;
				font-size: 27rpx;
				color: #999999;
			}
		}
	}
</style>