<template>
	<view class="shop-list-box">
		<view class="shop-item" v-for="(item,index) in list" :key="index" @tap="clickItem(item,index)">
			<view class="item-l">
				<view class="shop-info">
					<image :src="item.titleImg"></image>
					<view class="info-box">
						<view class="name">{{item.goodsTitle}}</view>
						<view class="surplus">剩余<text class="colR">{{item.endNum}}</text></view>
						<view class="tag">
							<image class="jifen" src="../../static/img/home/jifen.png"></image>
							<text>返还{{item.memberMoneys}}积分</text>
						</view>
					</view>
				</view>
				<view class="location">
					<view class="address">{{item.district}}</view>
					<view class="">距离：{{item.distance}}</view>
				</view>
			</view>
			<view class="item-r">
				<image src="@/static/img/home/mt.png" v-if="item.classify == 2"></image>
				<image src="@/static/img/home/elm.png" v-if="item.classify == 1"></image>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'shopList',
		props: {
			list: {
				type: Array,
				default () {
					return [];
				}
			},
		},
		data(){
			return {}
		},
		methods:{
			clickItem(item, index) {
				this.$emit('click', {
					item: item,
					index: index,
				});
			}
		}
	}
</script>

<style lang="scss">
	.shop-list-box{
		width: 686rpx;
		margin: 32rpx auto;
		.shop-item{
			width: 100%;
			height: 200rpx;
			margin-bottom: 20rpx;
			position: relative;
			box-shadow: 0px 6rpx 12rpx rgba(0, 0, 0, 0.16);
			.item-l{
				width: 638rpx;
				height: 100%;
				border-radius: 12rpx;
				overflow: hidden;
				background: #fff;
				padding: 24rpx;
				display: flex;
				justify-content: space-between;
				position: absolute;
				left: 0;
				z-index: 3;
				.shop-info{
					width: 450rpx;
					display: flex;
					image{
						width: 152rpx;
						height: 152rpx;
						margin-right: 18rpx;
						border-radius: 8rpx;
					}
					.info-box{
						width: calc(100% - 162rpx);
						color: #000;
						display: flex;
						flex-direction: column;
						justify-content: space-around;
						.name{
							width: 100%;
							overflow:hidden;
							text-overflow:ellipsis;
							white-space:nowrap;
							font-size: 36rpx;
							font-weight: 600;
						}
						.surplus{
							font-size: 28rpx;
							.colR{
								color: #FF0000;
							}
						}
						.tag{
							width: 200rpx;
							height: 36rpx;
							font-size: 20rpx;
							background: #F8E3DF;
							border: 2rpx solid #FF6A6A;
							border-radius: 4rpx;
							color: #FF4848;
							display: flex;
							align-items: center;
							justify-content: center;
							.jifen{
								width: 22rpx;
								height: 20rpx;
								margin: 0 8rpx;
							}
						}
					}
				}
				.location{
					font-size: 20rpx;
					color: #686868;
					display: flex;
					flex-direction: column;
					align-items: flex-end;
					padding-top: 8rpx;
					.address{
						min-width: 60rpx;
						height: 32rpx;
						padding: 0 4rpx;
						background: #FF4848;
						line-height: 32rpx;
						text-align: center;
						border-radius: 4rpx;
						color: #fff;
						margin-bottom: 16rpx;
					}
				}
			}
			.item-r{
				width: 76rpx;
				height: 200rpx;
				position: absolute;
				right: 0;
				z-index: 1;
				image{
					width: 100%;
					height: 100%;
				}
			}
		}
	}
</style>
