erjikind.vue 4.0 KB
<template>
	<view class="container">
				<view class="want flextwo">
					<view class="wantleft flexone">
						热门品类推荐
					</view>
				</view>
				<goodkind :wantlist="wantlist"></goodkind>
				<view class="want flextwo">
					<view class="wantleft flexone">
						<image src="../../static/meizhuang.png" mode="" class="likeimg"></image>
						近期美妆直播
					</view>
				</view>
				<goodlist :zhigoodlist="zhigoodlist" :dingyuenum="dingyuenum" :nothing="notixing"></goodlist>
				<!-- 这里也有你想要的 -->
				<view class="want flextwo">
					<view class="wantleft flexone">
						<image src="../../static/like.png" mode="" class="likeimg"></image>
						也许这里也又你想要的
					</view>
					<view class="more flexone" @click="more"> 
						更多
						<img src="../../static/yourow.png" alt="" class="yourow">
					</view>
				</view>
				<goodkindone :wantlistone="wantlistone"></goodkindone>
			
	</view>
</template>
<script>
	import app from "../../App.vue";
	import goodkind from "../../compontent/goodkind.vue"
	import goodkindone from "../../compontent/goodkindone.vue"
	import goodlist from "../../compontent/goodlist.vue"
	
	export default {
		components: {
			goodkind,
			goodlist,
			goodkindone,
			
			
		},
		data() {
			return {
				search: false,
				havesou: true,
				goodshow:false,
				wantlist:[],
				showpull:true,
				cate_one_id:'',//一级分类id
				cate_two_id:'',//二级id
				zhigoodlist:[],
				wantlistone:[],
				dingyuenum:[],
				notixing:''
				
			}
		},
		onLoad(options) {
			if(options.type==1){
				this.cate_one_id=options.id;
			}else{
				this.cate_two_id=options.id;
			}
			let notixing = uni.getStorageSync("notixing");
			this.notixing = notixing;
			
			// 近期美妆直播
			this.getnearlist()
		// 获取热门品类
		this.gethotkind();
		// 这里有你想要的
		this.getwant()
		},
		onReachBottom() {
			that=this
			let newpage=that.page;
			newpage++
			that.page=newpage;
			if(that.showpull==true){
				console.log(38493409)
			  Toast('没有更多了~')
			}else{
			   that.getnearlist()
			}
		},
		methods: {
			// 获取热门分类
			gethotkind(){
				let that = this;
				var url = "category/getRandCategory"
				var param={
					cate_one_id:that.cate_one_id,
					type:2
				}
				app.post(url, param, "post").then(res => {
					console.log('三级分类', res)
					that.wantlist=res;
					
				
				}).catch(err => {
					console.log(err)
				})
			},
			// 近期美妆直播
			getnearlist(){
				let that = this;
				var url = "goods/getAnchorTimeGoods"
				var param={
					cate_one_id:that.cate_one_id,
					cate_two_id:that.cate_two_id,
					type:1
				}
				app.post(url, param, "post").then(res => {
					console.log('商品列表', res)
					that.zhigoodlist=that.zhigoodlist.concat(res.data);
					if(that.page>1){
						if(res.data.lenth==0){
							that.showpull=false
						}
					}
					console.log(that.zhigoodlist)
					that.zhigoodlist.forEach(function(value,index,array){
						if(value.user_goods==1){
								if(that.dingyuenum.indexOf(value.id)==-1){
									that.dingyuenum.push(value.id);
									that.dingyuenum=that.dingyuenum
							}
						}
					})
				
				}).catch(err => {
					console.log(err)
				})
			},
			// 你想要的
			getwant(){
				let that = this;
				var url = "category/getRandCategory"
				let param={
					// cate_one_id:that.cate_one_id,
					// cate_two_id:that.cate_two_id,
					limit:8
				}
				app.post(url, param, "post").then(res => {
					console.log('我想要的', res)
					that.wantlistone=res
					
				
				}).catch(err => {
					console.log(err)
				})
			},
			// 查看更多
			more(){
				uni.navigateTo({
					url:"/pages/xinyuan/zhiboknow"
				})
			}

		}

	}
</script>

<style>
	@import url('../../style/xinyuan');

	page {
		padding: 0 32rpx;
		box-sizing: border-box;
	}

	.searhtoppage {
		padding: 0 32rpx;
		box-sizing: border-box;
	}
	.fuzhi{
		margin-top:92rpx
	}
	.copybtn{
		margin:64rpx auto 32rpx
	}
	.fuzhitext{
		text-align: center;
	}
</style>