<template>
	<view class="filter">
		<view class="flex justify-around">
			<view :class="{active:activeIndex==index}" class="con" :key="index"
				v-for="(item,index) in tagsList" @click="activeIndex=index">
				<text class="title">{{item.title}}</text>
				<view class="tag">
					<text>{{item.desc}}</text>
				</view>
			</view>
		</view>
		<view class="item">
			<view class="card" @click="goDetail(item.id)" v-for="(item,index) in list" :key="index">
				<view class="left">
					<image :src="item.cover" mode=""></image>
				</view>
				<view class="right">
					<view class="title text-cut-1">
						<text class="">{{item.name}}</text>
					</view>
					<view class="data">
						<view class="">
							<block>
								<u-icon name="star-fill" color="#ff7001" size="30"></u-icon>
								<text
									style="margin-left: 4rpx;margin-right: 20rpx;color: #ff7001;font-size: 26rpx;">4.9</text>
							</block>
							<block>
								<text>月售</text>
								<text>{{item.sales}}</text>
							</block>
						</view>
						<view>
							<text>珠江新城</text>
							<text class="margin-left-10">3.5km</text>
						</view>
					</view>
					<view class="text-cut-2" style="width: 100%;height: 32rpx;margin-top: 14rpx;">
						<view v-for="(item1,index1) in item.labelNames.split(',')" :key="index1" class="cu-tag sm "
							style="background-color: #fff0d9;color: #ffa353;">
							{{item1}}
						</view>
					</view>
					<view v-if="false" class="flex justify-start text-cut-2"
						style="margin-top: 12rpx;width: 100%;height: 34rpx;">
						<view class="line-red sm cu-tag" v-for="(item,index) in 5" :key="index">
							首次光临减2元
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		props:{
			list:Array
		},
		data(){
			return {
				activeIndex: 0,
				tagsList: [{
					title: '智能筛选',
					desc: '大数据优选'
				}, {
					title: '距离最近',
					desc: '由近到远'
				}, {
					title: '评论最高',
					desc: '好评如潮'
				}, {
					title: '全部筛选',
					desc: '全部分类'
				}]
			}
		},
		methods:{
			goDetail(id){
				uni.navigateTo({
					url:"/pages/consume/detail/shop-detail?id="+id,
					fail(err) {
						console.log(err);
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.filter {
		padding: 10rpx;
		display: flex;
		flex-direction: column;
	
		.con {
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
	
			.title {
				font-size: 28rpx;
				font-weight: 800;
			}
	
			.tag {
				color: #888888;
				padding: 4rpx;
				margin-top: 10rpx;
				font-size: 22rpx;
			}
		}
	
		.active {
			color: #fd5d4a;
	
			.title {
				color: fd5d4a;
			}
	
			.tag {
				border-radius: 20rpx 0 20rpx 0;
				background-color: #ffddd5;
				color: #fd5d4a;
			}
		}
	}
	
	.item {
		display: flex;
		flex-direction: column;
		margin-top: 50rpx;
	
		.card {
			margin-bottom: 20rpx;
			display: flex;
			border-bottom: 1rpx solid #ececec;
			padding-bottom: 20rpx;
	
			.left {
				width: 30%;
	
				image {
					width: 100%;
					border-radius: 12rpx;
					height: 180rpx;
				}
			}
	
			.right {
				margin-left: 20rpx;
				display: flex;
				width: 70%;
				flex-direction: column;
	
				.title {
					font-size: 30rpx;
					font-weight: 800;
				}
	
				.data {
					margin-top: 20rpx;
					display: flex;
					justify-content: space-between;
					font-size: 24rpx;
					color: #666666;
				}
	
				.label {
					margin-top: 10rpx;
				}
			}
		}
	
		.card:last-child {
			border: none;
			margin-bottom: 0;
			padding-bottom: 0;
		}
	}
</style>
