<template>
	<view class="mall_recommend_product_cn">
		<view class="padding-lr-30 flex" v-if="type==1">
			<text class="line-height-50 text-40 text-bold">好物推荐</text>
			<text class="margin-top-20 line-height-30 margin-left-15 text-24 text-b3">精挑细选的好物带回家</text>
		</view>
		<view class="flex align-center justify-center" v-else-if="type==2">
			<view class="border_line"></view>
			<text class="margin-left-45 tyIcon-aixin text-28 text-main"></text>
			<text class="margin-left-10 margin-right-45 text-26 text-main text-bold">好物推荐</text>
			<view class="border_line"></view>
		</view>

		<view class="margin-top-30">
			<ty-list-list :status="load_status">
				<view class="padding-lr-20 flex align-center flex-wrap">
					<view class="item" v-for="(item,index) in list" :key="index"
						@click="go('/pages/mall/detail?id='+item.id)">
						<view class="img_box">
							<image :src="item.cover_img" mode="aspectFill" class="jc-image" style="width: 345rpx;height: 345rpx;"></image>
							<view class="label_box flex">
								<view class="label_item" v-for="(item1,index1) in item.mallLabel" :key="index1">
									<ty-text-label :text="item1.name" :bg-color="item1.color"></ty-text-label>
								</view>
							</view>
						</view>
						<view class="padding-tb-20 padding-lr-15">
							<view class="line-35 height-70 text-cut-two text-28">{{item.name}}</view>
							<view class="margin-top-20 flex align-center">
								<view class="text-price text-32 text-main">{{item.price_min}}</view>
								<view class="margin-left-20 text-24 text-98">已售{{item.sales_number}}</view>
							</view>
						</view>
					</view>
				</view>
			</ty-list-list>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			list: {
				type: Array,
				default: []
			},
			load_status: {
				type: String,
				default: ''
			},
			type: {
				type: [String, Number],
				default: 1
			}
		},
		data() {
			return {

			}
		},
		methods: {

		}
	}
</script>

<style scoped>
	.border_line{
		width: 60rpx;
		height: 1rpx;
		background: var(--main);
	}
	
	.item {
		margin-left: 20rpx;
		margin-bottom: 20rpx;
		width: 345rpx;
		border-radius: 10rpx;
		overflow: hidden;
		background: #fff;
	}
	
	.item:nth-child(2n+1){
		margin-left: 0;
	}
	
	.img_box {
		position: relative;
		width: 345rpx;
		height: 345rpx;
	}
	
	.label_box{
		position: absolute;
		left: 0;
		bottom: 0;
	}
	
	.label_item{
		margin-left: 10rpx;
	}
	
	.label_item:first-child{
		margin-left: 0;
	}

</style>
