erjikind.vue
4.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<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>