<template>
	<view class="list">
		<view class="item" v-for="(item, index) in list"
			@click="$utils.navigateTo('/pages_order/product/productDetail?id=' + item.id)" :key="index">
			<image class="image" :src="item.image &&
			item.image.split(',')[0]" mode="aspectFill"></image>
			<view class="product-info">
				<view class="product-title">
					{{ item.title }}
				</view>

				<view class="product-main">
					<view class="sale-information">
						<view style="display: flex;align-items: flex-end;">
							<view class="price">
								<text>￥{{ item.price }}</text>/件
							</view>
							<view class="oldPrice">
								<text>￥{{ item.oldPrice }}</text>/件
							</view>
						</view>
						<view class="num">
							已售卖5000+件
						</view>
					</view>

					<view class="btn">
						购买
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "productList",
		props: {
			list: {
				default: []
			},
		},
		data() {
			return {

			};
		},
		methods: {

		},
	}
</script>

<style scoped lang="scss">
	.list {
		display: flex;
		flex-wrap: wrap;

		.item {
			position: relative;
			width: 345rpx;
			padding: 20rpx;
			box-sizing: border-box;
			background-color: #fff;
			border-radius: 20rpx;
			margin-left: 20rpx;

			.image {
				width: 300rpx;
				height: 250rpx;
				border-radius: 20rpx;
			}

			.product-info {
				font-size: 24rpx;

				.product-title {}

				.product-main {
					display: flex;

					.sale-information {
						width: 75%;

						.title {
							font-size: 28rpx;
							overflow: hidden; //超出的文本隐藏
							text-overflow: ellipsis; //溢出用省略号显示
							white-space: nowrap; //溢出不换行
						}

						.price {
							color: $uni-color;
							margin-top: 6rpx;

							text {
								font-size: 30rpx;
								font-weight: 900;
							}
						}

						.oldPrice {
							color: #888;
							text-decoration: line-through;
						}

						.num {
							margin-top: 6rpx;
							font-size: 22rpx;
							color: #888;
						}
					}

					.btn {
						display: flex;
						align-items: center;
						justify-content: center;
						border-radius: 10rpx;
						font-size: 24rpx;
						height: 60rpx;
						width: 25%;
						color: #fff;
						background-color: $uni-color;
					}
				}
			}
		}
	}
</style>