<template>
	<view class="">
		<view class="goods-top">
		<image src="@/static/icon/jxgoods.png" mode=""></image>
		<text>精选好物</text><text>买多赚多</text>
	</view>
	<view class="goods-list">
		<view class="goods-list-top">
				<view class="goods-list-title">
					<text>精选好货 平台推荐</text><br>
					<text>买到就是赚到</text>
				</view>
				<navigator url="/pages/product/classify?type=1">
					<view class="goods-list-more">
						<image src="@/static/icon/more.png"></image>
					</view>
				</navigator>
		</view>
		<view class="list">
			<view class="list-g">
				<view class="scroll-boxs">
					<scroll-view scroll-x class="right-head"  style="white-space: nowrap">
					    <view  class="goods-item" v-for="g in goodsList" @click="navToDetailPage(g)">
							<view class="item-img">
								<image :src="g.image" onerror="@/static/error/errorImage.jpg"></image>
							</view>
							<view class="name">{{g.store_name}}</view>
							<view class="ot_price">￥{{g.price}}</view>
							<view class="price">￥{{g.vip_price}}</view>
						</view>
					</scroll-view>
				</view>
				    
			</view>
		</view>
	</view>
	</view>
	
</template>

<script>
	export default {
		data() {
			return {
				errImg: require('@/static/error/errorImage.jpg'),
			}
		},
		props: ["goodsList"],
		mounted() {
			console.log(this.goodsList)
		},
		methods: {
			//详情页
			navToDetailPage(item) {
				this.$parent.$parent.$parent.navToDetailPage(item)
			},
		}
	}
</script>

<style lang="scss" scoped>
	.goods-top {
		image {
			position: absolute;
			width: 45rpx;
			height: 45rpx;
		}
		text:nth-child(2) {
			margin:0 10rpx 0 60rpx;
			color: #333333;
			font-size: 32rpx;
			font-weight: bold;
			font-family: PingFang-SC-Bold;
		}
		text:nth-child(3) {
			color: #95A0B1;
			font-size: 18rpx;
		}
	}
	.goods-list-top {
		margin-top: 20rpx;
		padding: 20rpx;
		padding-bottom: 65rpx;
		border-radius: 15rpx 15rpx 0 0;
		background:-moz-linear-gradient(top,#438BED,#45BDEB);/*火狐*/ 
		background:-webkit-gradient(linear, 0% 0%, 100% 100%,from(#438BED), to(#45BDEB));/*谷歌*/
		background: linear-gradient(to right, #438BED, #45BDEB);
		color: #fff;
		display: flex;
		justify-content: space-between;
		.goods-list-title {
			text:nth-child(1) {
				font-size: 32rpx;
			}
			text:nth-child(3) {
				font-size: 20rpx;
			}
		}
		.goods-list-more {
			margin: auto 0;
			image {
				width: 14rpx;
				height: 28rpx;
			}
		}
	}
	.list {
		background-color: #F4F4F4;
		height: 300rpx;
		.list-g {
			border-radius: 15rpx;
			position: relative;
			top: -50rpx;
			background-color: #F4F4F4;
			margin: 0 10rpx;
			white-space: nowrap;
			overflow: hidden;
			.goods-item {
				border-left:solid 1rpx #F4F4F4;
				border-right:solid 1rpx #F4F4F4;
				padding: 20rpx;
				background-color: #fff;
				display: inline-block;
				.name {
					width: 174rpx;
					//超出文字隐藏
					overflow: hidden;
					//当文本溢出，省略号代替
					text-overflow:ellipsis;
					font-size: 31rpx;
					}
				.ot_price {
					color: #999999;
					font-size: 20rpx;
					text-decoration: line-through
				}
				.price {
					color: #EF3A55;
					font-size: 35rpx;
				}
				.item-img {
					image {
						width: 174rpx;
						height: 174rpx;
					}
				}
			}
		}
	}
</style>
