<template>
	<view style="width:100%;padding: 12px;" :style="{
			'background-color': goodsInfo.backgroundColor,
		}">
		<view :style="{
			'padding-top':goodsInfo.PaddingTop+'px',
			'padding-right':goodsInfo.PaddingRight+'px',
			'padding-bottom':goodsInfo.PaddingBottom+'px',
			'padding-left':goodsInfo.PaddingLeft+'px'
		}">
			<view class="good-four-study" v-for="(item, gli) in goodsInfo.list" :key="gli" :style="{'borderRadius':goodsInfo.SearchFilletPX+'px'}" @click="openGood(item)">
				<view class="img-box">
					<image style="width: 100%; height: 100%;" mode="aspectFill" :src="item.picUrl" />
				</view>
				<view class="good-info">
					<view class="good-name" v-if="item.name">{{ item.name }}</view>
					<view>
						<view style="display:inline-block;padding: 2px 4px;border-radius: 2px;font-size: 10px;color: #FAF8F9;margin-right:5px" 
						:style="{background:mainColor}" v-for="(subItem,subIndex) in item.lableNameList" :key="subIndex">
							{{subItem}}
						</view>
					</view>
				</view>
			</view>
		</view>
		<auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
	</view>
</template>

<script>
	import goodSku from '../goods/goodsku';
	import auth from '@/components/auth/index.vue';
	export default {
		components: {
			auth
		},
		props: ['goodsInfo'],
		data() {
			return {
				mainColor: '',
				showAuth: false,
				u: {},
			};
		},
		created() {
			this.mainColor = this.$uiConfig.mainColor;
			
		},
		mounted(){
		    
		},
		methods: {
			openGood(item) {
				this.u = uni.getStorageSync('mall_UserInfo');
			
					
					uni.navigateTo({ url: "/pages/kotra/activeInner?Id=" + item.id });
				
			},
			reloadUserinfo() {
				this.u = uni.getStorageSync('mall_UserInfo');
				// this.showAuth = false;
			},
			//关闭登录窗口
			gbAuth() {
				this.showAuth = false;
			}
		}
	};
</script>

<style>
	.good-four-study {
		position: relative;
		margin-bottom: 14px;
		display: flex;
		box-sizing: border-box;
		padding: 0 1px 1px 0;
		overflow: hidden;
	}
	.good-four-study:last-child{
		margin-bottom:0!important;
	}
	.good-four-study .img-box {
		width: 125px;
		height: 80px;
		border-radius: 4px;
		overflow: hidden;
		box-shadow: 0 4px 10px 1px #D2D2D2;
	}

	.good-four-study .good-info {
		padding: 0 12px 12px 12px;
		flex: 1;
		width: 1rpx;
		border: 10rpx;
		padding-bottom: 0;
		display: flex;
		flex-direction: column;
		/* width:20%; */
	}

	.good-four-study .good-info .good-name {
		font-size: 13px;
		margin-bottom:5px;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
	}

	.good-four-study .good-info .good-price-info {
		display: flex;
		justify-items: center;
		align-items: flex-end;
		height: 22px;
		flex: 1;
		padding-bottom: 10rpx;
	}

	.good-four-study .good-info .good-price-info .price {
		color: #999999;
		flex: 1;
		font-size: 14px;
		white-space: nowrap;
		text-overflow: ellipsis;
		overflow: hidden;
	}

	.good-four-study .good-info .good-price-info .buy {
		width: 24px;
		text-align: right;
	}
</style>
