<template>
	<view class="center">
		<view class="list-box-h">
			<view v-for="(item, index) in dataList" :key="index" class="guess-item" @click="navToDetailPage(item)">
				<image :src="item.image"></image>
				<view class="guess-box">
					<view class="title clamp2">
						{{ item.store_name }}
					</view>
					<view class="price-box flex">
						<view class="yuanprice">{{ item.ot_price }}</view>
						<!-- <image src="../../static/img/jiantou.png" mode=""></image>
						<view class="jiang">直降{{ (item.vip_price - item.price).toFixed(2) }}元</view> -->
					</view>
					<view class="price">￥{{ item.price }}</view>
					<view class="btn">立即购买</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import { getProducts } from '@/api/product.js'
export default {
	data(){
		return {
			dataList:[],
		}
	},
	onLoad() {
		this.loadData();
	},
	methods:{
		loadData(){
			getProducts({sid:47,page:1,limit: 1000}).then(({data}) =>{
				this.dataList = data;
			})
		},
		//详情页
		navToDetailPage(item) {
			let id = item.id;
			uni.navigateTo({
				url: '/pages/product/product?id=' + id
			});
		}
	}
}
</script>

<style lang="scss">
page,
.center {
	height: auto;
	min-height: 100%;
	background-color: #ffffff;
}
.guess-item {
	display: flex;
	width: 710rpx;
	height: 290rpx;
	background: #ffffff;
	box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
	border-radius: 10rpx;
	padding: 15rpx;
	padding-bottom: 150rpx;
	margin: 20rpx auto 0;
	position: relative;
	image {
		width: 260rpx;
		height: 260rpx;
		border-radius: 10rpx;
	}
	.guess-box {
		padding: 12rpx 0 0 24rpx;
		width: 436rpx;
		.title {
			font-size: 30rpx;
			padding-left: 4rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #333333;
			width: 368rpx;
			line-height: 36rpx;
			.tuanF {
				display: inline-block;
				margin-right: 4rpx;
				position: relative;
				top: -6rpx;
				.tuan {
					display: flex;
					align-items: center;
					padding: 10rpx;
					height: 36rpx;
					background: #ffebe9;
					border-radius: 18rpx;
					.tuan-image {
						width: 18rpx;
						height: 18rpx;
					}
					.tuan-font {
						display: inline;
						font-size: 20rpx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #ff1135;
						margin-left: 2rpx;
					}
				}
			}
		}
		.ping-box {
			margin-top: 15rpx;
			justify-content: flex-start;
			.ping {
				margin-left: 10rpx;
				height: 39rpx;
				background: #fdf7eb;
				border-radius: 5rpx;
				font-size: 22rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #ff911f;
				display: flex;
				align-items: center;
				padding: 0 10rpx;
			}
		}
		.price-box {
			margin-top: 80rpx;
			justify-content: flex-start;
			.yuanprice {
				font-size: 26rpx;
				font-family: PingFang SC;
				font-weight: 500;
				text-decoration: line-through;
				color: #999999;
				padding-right: 6rpx;
			}
			image {
				width: 14rpx;
				height: 16rpx;
			}
			.jiang {
				padding-left: 2rpx;
				font-size: 24rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #b59467;
			}
		}
		.price {
			font-size: 36rpx;
			font-family: PingFang SC;
			font-weight: bold;
			color: #ff1135;
		}
		.btn {
			width: 137rpx;
			height: 56rpx;
			background: #16CC9F;
			border-radius: 28rpx;
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #FFFFFF;
			line-height: 56rpx;
			text-align: center;
			position: absolute;
			bottom: 25rpx;
			right: 25rpx;
		}
	}
}
</style>
