<template>
	<view class="content">
		<view class="info">该类商品需购满{{goldLimit}}乐豆才能下单哦！</view>
		<view v-if="goodsList.length">
			<uni-coods :list="goodsList"></uni-coods>
		</view>
		<!-- 购物车 -->
		<uni-cart-fix></uni-cart-fix>
	</view>
</template>

<script>
	import {
		getGoodsList
	} from '@/api/goods.js'
	export default {
		data() {
			return {
				clsId: '',
				goldLimit:0,
				pageNo: 1,
				pageSize: 20,
				goodsList:[]
			};
		},
		onLoad(opts) {
			console.log(opts)
			this.clsId = opts.goodsTypeNo
			this.goldLimit = opts.goldLimit
			this.getGoods()
		},
		methods: {
			// 查询商品
			getGoods(item,index){
				getGoodsList({
					pageNo: this.pageNo,
					pageSize: this.pageSize,
					goodsTypeNo:this.clsId,
				}).then(res => {
					console.log(res,'goodsList')
					if(res.status == 200){
						this.goodsList = res.data.list
					}
				})
			}
		},
	}
</script>

<style lang="scss">
   .content {
	   width: 100%;
		.goods{
			padding: 20upx 0;
		}
		.goods-list{
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;
			padding: 20upx 20upx 0;
			background: #FFFFFF;
			>view{
				margin-bottom: 20upx;
			}
		}
		.info{
			text-align: center;
			color: #DD524D;
			margin-bottom: 20upx;
		}
	}
</style>
