xinyuan.vue
6.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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
<template>
<view class="container">
<view class="searhtoppage">
<view class="searchtop flextwo" @click="search">
<view class='searchleft'>
输入您搜索的内容
<!-- <input type="text" placeholder="输入您搜索的内容" /> -->
</view>
<image src="../../static/search.png" mode="" class="search"></image>
</view>
</view>
<view class="xinyuanbox">
<view class="gookindpage flexone">
<view class="goodkindleft" @click='all("")'>
<view class="goodkindname">全部品类</view>
<view class="secname allname">香奈儿奢华至臻</view>
<view class="goodkindimgbox">
<view class="gookindimg">
<image src="../../static/goodimg.png" mode=""></image>
</view>
</view>
</view>
<view class="goodkindright">
<view class="goodkindrighttop flexone" @click='all(kindlist[0].id)'>
<view>
<view class="goodkindname">{{kindlist[0].name}}</view>
<view class="secname">{{kindlist[0].description}}</view>
</view>
<view class="gookindimgk">
<image :src="kindlist[0].image" mode=""></image>
</view>
</view>
<view class="goodkindrighttopge flexone" @click='all(kindlist[1].id)'>
<view>
<view class="goodkindname">{{kindlist[1].name}}</view>
<view class="secname">{{kindlist[1].description}}</view>
</view>
<view class="gookindimgk">
<image :src="kinlist[1].image" mode=""></image>
</view>
</view>
</view>
</view>
<view class="xinyuanbotbox flextwo">
<view class="xinyuanbotitem flexone" @click='all(kindlist[2].id)'>
<view>
<view class="goodkindnamek">{{kindlist[2].name}}</view>
<view class="secnamek">{{kindlist[2].description}}</view>
</view>
<view class="goodkindimg">
<image :src="kindlist[2].image" mode=""></image>
</view>
</view>
<view class="xinyuanbotitem flexone" @click='all(kindlist[3].id)'>
<view>
<view class="goodkindnamek">{{kindlist[3].name}}</view>
<view class="secnamek">{{kindlist[3].description}}</view>
</view>
<view class="goodkindimg">
<image :src="kindlist[3].image" mode=""></image>
</view>
</view>
<view class="xinyuanbotitem flexone" @click='all(kindlist[4].id)'>
<view>
<view class="goodkindnamek">{{kindlist[4].name}}</view>
<view class="secnamek">{{kindlist[4].description}}</view>
</view>
<view class="goodkindimg">
<image :src="kindlist[4].image" mode=""></image>
</view>
</view>
</view>
<!-- 直播好物推荐 -->
<view class="goodbox flexone">
<image src="../../static/today.png" mode="" class="todayimg"></image>
<view class="todayname">直播好物推荐</view>
</view>
<!-- 商品列表 -->
<goodlist :zhigoodlist="zhigoodlist" :notixing="notixing" @tixing='tixing' :dingyuenum="dingyuenum"></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>
<goodkind :wantlist="wantlist"></goodkind>
</view>
</view>
</template>
<script>
import app from "../../App.vue";
import goodlist from "../../compontent/goodlist.vue";
import goodkind from "../../compontent/goodkind.vue";
import {
Toast
} from "../../utils/toast.js"
var that
export default {
components: {
goodlist,
goodkind
},
data() {
return {
// 列表
kindlist: [],
showpull: true,
wantlist: [],
page: 1,
zhigoodlist: [],
notixing:'',
dingyuenum:[]
}
},
onReachBottom() {
that = this
let newpage = that.page;
newpage++
that.page = newpage;
if (that.showpull == true) {
console.log(38493409)
Toast('没有更多了~')
} else {
that.getgoodlist()
}
},
onShow() {
let notixing = uni.getStorageSync("notixing");
this.notixing = notixing;
console.log(this.notixing)
this.page=1;
this.zhigoodlist=[]
// 获取直播好物
this.getgoodlist();
},
onLoad() {
this.gettopkind();
// 获取你想要的
this.getwant()
},
methods: {
// 接收子组件的值
tixing(e) {
this.zhigoodlist = e;
},
// 获取顶部列表
gettopkind() {
let that = this;
var url = "category/getIndexCategory"
app.post(url, {}, "post").then(res => {
console.log('列表信息', res)
that.kindlist = res;
console.log(that.kindlist)
}).catch(err => {
})
},
// 获取直播好物推荐
getgoodlist() {
let that = this;
var url = "goods/getAnchorTimeGoods"
var param = {
page: 1,
per_page: 20
}
app.post(url, {}, "post").then(res => {
console.log('商品列表', res)
that.zhigoodlist = that.zhigoodlist.concat(res.data);
if (that.page > 1) {
if (res.data.length == 0) {
that.showpull = false
}
}
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 = {
type: 2,
limit: 8
}
app.post(url, param, "post").then(res => {
console.log('我想要的', res)
that.wantlist = res
}).catch(err => {
console.log(err)
})
},
// 更多分类
more() {
uni.navigateTo({
url: "/pages/xinyuan/zhiboknow"
})
},
// 进入搜索页面
search() {
uni.navigateTo({
url: '/pages/xinyuan/search'
})
},
// 进入分类页面
all(id){
uni.navigateTo({
url:'/pages/xinyuan/zhiboknow?id='+id
})
}
}
}
</script>
<style>
@import url('../../style/xinyuan');
</style>