<template>
	<view
		class="her-scoller"
		:style="{
			'background-color': goodsInfo.backgroundColor,
			'background-image': goodsInfo.backgroundPicUrl,
			'border-color': goodsInfo.goodsStyle == 2 ? 'rgb(226, 226, 226)' : '',
			'padding-top':goodsInfo.PaddingTop+'px',
			'padding-right':goodsInfo.PaddingRight+'px',
			'padding-bottom':goodsInfo.PaddingBottom+'px',
			'padding-left':goodsInfo.PaddingLeft+'px',
		}"
	>
		<view
			class="good-five"
			@click="openGood(item)"
			v-for="(item, gli) in goodList"
			:key="gli"
			
		>
			<view class="img-box" :style="{'width':imgModel?'173px':'97px','height':imgModel?'100px':'70px'}"><image style="width: 100%; height: 100%;border-radius: 4px;" mode="aspectFill" :src="item.picUrl" /></view>
			<view class="good-info" v-if="imgModel==false">
				<view class="good-name" v-if="goodsInfo.showGoodsName">{{ item.name }}</view>
				<view class="good-price-info" v-if="goodsInfo.showsubtitle">
					<span class="price" >{{ item.subtitle }}</span>
				</view>
			</view>
		</view>
		<auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
	</view>
</template>
<script>

import auth from '@/components/auth/index.vue';
export default {
	components: {
		
		auth
	},
	props: ['goodList', 'goodsInfo'],
	data() {
		return {
			mainColor: '',
			activeKey: 0,
			
			showAuth: false,
			u: {},
			imgModel:false,
		};
	},
	created() {
		this.mainColor = this.$uiConfig.mainColor;
		
		if(this.goodsInfo.showGoodsName==false && this.goodsInfo.showsubtitle ==false){
			this.imgModel=true
		}
	},
	methods: {
		
		openGood(item) {
			
			this.u = uni.getStorageSync('mall_UserInfo');
			if (!this.u) {
				this.u = {
					nickName: '未登录',
					avatarUrl: ''
				};
				this.showAuth = true;
			} else {
				uni.navigateTo({ url: '/pages/goods/goods?GoodsId=' + item.id });
			}
		},
		reloadUserinfo() {
			this.u = uni.getStorageSync('mall_UserInfo');
			// this.showAuth = false;
		},
		//关闭登录窗口
		gbAuth() {
			this.showAuth = false;
		}
	}
};
</script>

<style>
.her-scoller {
	overflow-x: auto !important;
	display: flex;
}

.her-scoller .good-five {
	position: relative;
	border-radius: 10rpx;
	display: flex;
	flex-direction: row;
	align-items: center;
	/* float: left; */
}
.her-scoller .good-five .tips {
	width: 64rpx;
	height: 64rpx;
	position: absolute;
	top: 0;
	left: 0;
	z-index: 4;
}
.her-scoller .good-five .img-box {
	width: 97px;
	height: 70px;
	margin-right: 10px;
}


.her-scoller .good-five .good-info {
	padding: 5px 0 ;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	width: 173px;
	height: 70px;
	
	
}
.her-scoller .good-five .good-info .good-name {
	font-size: 13px;
	height: 34px;
	width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	padding-right: 5px;
	
}
.her-scoller .good-five .good-info .good-price-info {
	display: flex;
	justify-items: center;
	align-items: center;
}
.her-scoller .good-five .good-info .good-price-info .price {
	color: #999999;
	flex: 1;
	font-size: 11px;
	white-space: nowrap;
	text-overflow: ellipsis;
	overflow: hidden;
}
.her-scoller .good-five .good-info .good-price-info .buy {
	width: 24px;
	text-align: right;
}
</style>
