<template>
	<view class="page">
		<view class="p-content" >
			<singleList ref="listRef" url="goods.list" :sendData="reqData" @reqEnd="searchEnd">
				<template v-slot:items="{list}">
          			<proItem :info="item" v-for="(item,i) in list" :key="i" />
				    <empty v-if="sRes && sRes==='empty'"/>
				</template>
			</singleList>
		</view>
	</view>
</template>

<script>
	import proItem from './components/pro-item.vue'
	export default {
		components:{
			proItem
		},
		data() {
			return {
				// keyword:'',
				// search_lishi:[],
				reqData:{}, //请求数据
				sRes:'', //搜索结果 empty,noMore
			};
		},
		onLoad(e) {
			this.id = e.id;
			let name = e.name;
			uni.setNavigationBarTitle({
				title: name
			})
		},
		onShow(){  //这里一进来就查询之前留下的搜索内容  别忘了退出登录的时候删掉
			this.$nextTick(()=>{
				this.reqData = {goods_cate_id:this.id}
				// this.$refs.listRef.getList(true);
			})
		},
		onReachBottom() {
			this.$refs.listRef.getList();
		},
		methods:{
			searchEnd({loadingType,pageOneRes}){
				if(loadingType === 'noMore' && pageOneRes && pageOneRes.length === 0){
					this.sRes='empty';
				}else{
					this.sRes=loadingType;
				}
			},
		},
	}
</script>

<style lang="scss">
page{
	background-color: #f8f8f8;
}
.page{
	padding: 30rpx;
}
.p-bar{
	.bar {
	  flex: 1 1 auto;
	  border-radius: 32rpx;
	  height: 64rpx;
	  border: solid 2rpx #92b99c;
	  padding: 0 20rpx;
	}
	.image_5 {
	  flex-shrink: 0;
	  width: 31rpx;
	  height: 31rpx;
	}
	.inpt {
	  margin-left: 17rpx;
	  height: 60rpx;
	  line-height: 60rpx;
	  color: #333;
	  font-size: 28rpx;
	  font-family: PingFang;
	  letter-spacing: 1.12rpx;
	}
	.image_6 {
	  margin-bottom: 3rpx;
	  width: 28rpx;
	  height: 28rpx;
	}
	.text_3 {
	  margin-left: 28rpx;
	  margin-right: 4rpx;
	  align-self: center;
	  color: #92b99c;
	  font-size: 28rpx;
	  font-family: PingFang;
	  line-height: 27rpx;
	  letter-spacing: 1.12rpx;
	}
}
.p-history{
	padding-top: 10rpx;
	.title{
		height: 90rpx;
		line-height: 90rpx;
		font-size: 32rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #333333;
	}
	.item-wrap{
		flex-wrap: wrap;
	}
	.item{
		height: 54rpx;
		line-height: 54rpx;
		padding: 0 20rpx;
		background: #ECEFED;
		border-radius: 27px;
		margin-right: 24rpx;
		margin-bottom: 24rpx;
		
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #333333;
	}
}
.p-content{
}
</style>
