<template>
	<view class="p-t-15 p-b-15 sh-flex commodity-box" >
			<view class="commodity-li m-b-16" v-for="(item,index) in goodsList" :key="index" @click="$Router.push({ path: '/pages/goods/detail',query:{goodsId:item.goodsId}})">
				<view class="commodity-img ">
					<image class="p-t-40 "  :src="item.photoUrl" mode="heightFix"></image>
				</view>	
				<view class="commodity-content m-t-40">
					<view class="u-m-b-15 commodity-name fs-14 ">
						<sh-tag v-if="supItem.supplierType == item.supplierType" v-for="supItem in supplierList" :key="supItem.supplierType" class="sh-tag" :text="supItem.supplierName"  :bgColor="supItem.color"></sh-tag>
						{{item.goodsName}} 
					</view>
					<!-- <text class="tag-init">
						<u-tag  text="标签" size="mini" icon="map" plain></u-tag>
					</text> -->
					<text class="t-color commodity-price">{{item.sellPrice}}</text>
					<!-- <text class="commodity-"></text> -->
					
				</view>	
			</view>	 
		
	</view>
</template>

<script>
	import http from '@/shopro/request/index';
	export default {
		props:['goodsList'],
		name:"commodity",
		data() {
			return {
				supplierList:[]
			};
		},
		methods:{
			// 获取供应商列表
			getSupplierList(){
				http('goods.supplierList', this.listParams).then(res => {
					if (!res.code) {
						 this.supplierList = res.data.list;
					}else{
						this.$u.toast(res.msg);
					} 
				})
			}
		},
		onReady() {
			this.getSupplierList();
		}
	}
</script>

<style lang="scss" scoped>
	// .commodity-item{
		// padding-top:20rpx;
		// padding: 10rpx 10rpx;
	.commodity-box{
		margin: 0 20rpx;
		flex-wrap:wrap;
		justify-content: space-between;
	}
		.commodity-li{
			background-color: #fff;
			border-radius: 20rpx;
			width:49%;
			box-sizing: border-box;
		}
		.commodity-li:nth-child(2){
			margin-right: 0px;
		}
		.commodity-img{
			text-align: center;
			.p-t-40{
				height: 240rpx;
			}
		}
		.commodity-content{
			margin:20rpx;	
			 
			.commodity-name{
				display: -webkit-box;
				-webkit-box-orient: vertical;
				-webkit-line-clamp: 2;
				overflow: hidden;
			}
			.commodity-price{
				font-weight: bold;
				margin-top: 20rpx;
			}
		}
		
	// }

</style>