<template>
	<view class="content">
		<scroll-view scroll-y="true" class="scroll-wrapper">
			<view class="spgood"  v-for="(items, ind) in list" :key="ind">
				<view class="left-wrapper"><image :src="items.product_info.image" mode="scaleToFill"></image></view>
				<view class="right-wrapper">
					<view class="right-title clamp">{{ items.product_info.store_name }}</view>
					<!-- <view class="ex-addr">
					
					</view> -->
					<view class="right-bottom">
						<view class="sp-price">
							<view class="now-price">￥{{ items.product_info.price * 1 }}</view>
							<view class="old-price">￥{{ items.product_info.ot_price * 1 }}</view>
						</view>
						<view class="sp-btn">马上购</view>
					</view>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
import { getOrderStock } from '@/api/product.js';
export default {
	data() {
		return {
			list: [],
			page: 1,
			limit: 10,
			loadType: 'more',
			loaded: false
		};
	},
	onReady() {
		//初始化获取页面宽度
		uni.createSelectorQuery().select('.scroll-wrapper')
			.fields(
			{
				size:true
			},
			data => {
				console.log(data);
				console.log(Math.floor((data.width /750) * 300));
				//保存头部高度
				this.maxheight =data.height - Math.floor((data.width / 750) * 570);
				console.log(this.maxheight);
				}
			)
			.exec();
	},
	onLoad() {
		this.loadData();
	},
	methods: {
		loadData() {
			let obj = this;
			if (obj.loadType == 'loading') {
				return;
			}
			if (obj.loadType == 'noMore') {
				return;
			}
			obj.loadType = 'loading';
			getOrderStock({
				page: obj.page,
				limit: obj.limit
			}).then(({ data }) => {
				// this.list = this.list.concat()
				obj.page++;
				console.log(data.data.data, 'ddddddddddddddddddddddddddddddd');
				this.list = this.list.concat(data.data.data)
			});
		}
	}
};
</script>

<style lang="scss" scoped>
.spgood {
	margin: 0 auto;
	width: 710rpx;
	height: 280rpx;
	background: #ffffff;
	box-shadow: 0px 0px 20px 0px rgba(50, 50, 52, 0.06);
	border-radius: 8rpx;
	padding: 40rpx 20rpx;
	display: flex;
	margin-bottom: 21rpx;
	position: relative;
	.left-wrapper {
		width: 190rpx;
		height: 200rpx;
		border-radius: 10rpx;
		image {
			width: 190rpx;
			height: 200rpx;
			border-radius: 10rpx;
		}
	}
	.right-wrapper {
		padding-left: 22rpx;
		width: 100%;
		height: 200rpx;
		// background-color: red;
		.right-title {
			padding-top: 8rpx;
			width: 400rpx;
			// height: 29rpx;
			font-size: 30rpx;
			font-weight: bold;
			color: #333333;
		}
		.right-addr {
			margin-top: 18rpx;
			display: flex;
			.shop-img {
				width: 26rpx;
				height: 23rpx;
				margin: 0 4rpx 0 0;
				image {
					width: 100%;
					height: 100%;
				}
			}
			.shop-name {
				// height: 22rpx;
				font-size: 22rpx;
				font-weight: 500;
				color: #dcb876;
			}
			.point-img {
				width: 16rpx;
				height: 23rpx;
				margin: 0 4rpx 0 14rpx;
				image {
					width: 100%;
					height: 21rpx;
				}
			}
			.point-disc {
				font-size: 24rpx;
				font-weight: 500;
				padding-top: 3rpx;
				color: #dcb876;
			}
		}
		.ex-addr {
			margin-top: 16rpx;
			// padding-left: 22rpx;
			height: 24rpx;
			font-size: 24rpx;
			font-weight: 500;
			color: #dcb876;
			image {
				height: 22rpx;
			}
			.name-img {
				// vertical-align: ;
				width: 26rpx;
				margin: 0 4rpx -3rpx 0;
			}
			.point-img {
				width: 16rpx;
				margin: 0 4rpx -3rpx 14rpx;
			}
		}
		.pepple-num {
			// width: 99rpx;
			display: inline-block;
			padding-right: 15rpx;
			height: 36rpx;
			// color: #ff3366;
			// background: #FC7A0C;
			background-color: #fee4ce;
			// opacity: 0.2;
			border-radius: 18rpx;
			font-size: 20rpx;
			font-weight: 500;
			color: #ff3366;
			line-height: 36rpx;
			padding-left: 12rpx;
			margin-top: 33rpx;
			image {
				width: 17rpx;
				height: 20rpx;
				margin-right: 10rpx;
				// padding-right: rpx;
			}
		}
		.right-bottom {
			margin-top: 2rpx;
			// justify-items: flex-end;
			display: flex;
			justify-content: space-between;
			.sp-price {
				height: 60rpx;
				display: flex;
				vertical-align: bottom;
				line-height: 60rpx;
				.now-price {
					font-size: 30rpx;
					font-weight: bold;
					color: #901b21;
					margin-right: 16rpx;
				}
				.old-price {
					font-size: 22rpx;
					font-weight: 500;
					text-decoration: line-through;
					color: #aaaaaa;
				}
			}
			.sp-btn {
				width: 160rpx;
				height: 60rpx;
				border-radius: 30rpx;
				font-size: 26rpx;
				text-align: center;
				line-height: 60rpx;
				font-weight: 400;
				color: #ffffff;
				background-color: #901b21;
				position: absolute;
				bottom: 40rpx;
				right: 20rpx;
			}
		}
	}
}
</style>
