|
|
@@ -4,14 +4,14 @@
|
|
4
|
4
|
<div class="flex flex-col gap-3 ">
|
|
5
|
5
|
<div style="height: 80rpx;">
|
|
6
|
6
|
<div style="background-color: transparent " class="overflow-hidden fixed top-0 w-full z-10">
|
|
7
|
|
- <nut-searchbar v-model="state.keyword" @search="loadList('reload')" @clear="loadList('reload')">
|
|
|
7
|
+ <nut-searchbar v-model="state.keyword" @search="searchkwd" @clear="clearSearch">
|
|
8
|
8
|
<!-- <template v-slot:leftout>-->
|
|
9
|
9
|
<!-- <div @tap="navBack">-->
|
|
10
|
10
|
<!-- <nut-icon name="left"></nut-icon>-->
|
|
11
|
11
|
<!-- </div>-->
|
|
12
|
12
|
<!-- </template>-->
|
|
13
|
13
|
<template v-slot:rightout>
|
|
14
|
|
- <div @tap="loadList('reload')">
|
|
|
14
|
+ <div @tap="searchkwd">
|
|
15
|
15
|
搜索
|
|
16
|
16
|
</div>
|
|
17
|
17
|
</template>
|
|
|
@@ -23,6 +23,7 @@
|
|
23
|
23
|
<!-- <image :src="homeBanner" mode="widthFix" class="h-10 w-full "></image>-->
|
|
24
|
24
|
|
|
25
|
25
|
<div class="w-screen h-45">
|
|
|
26
|
+ <CXBBackTop :Scroll_X="Scroll_X" :isCss="1" />
|
|
26
|
27
|
<swiper v-if="state.banners" :indicator-dots="state.indicatorDots" indicator-active-color="#e93323"
|
|
27
|
28
|
:autoplay="state.autoplay" :circular="state.circular" :interval="state.interval" :duration="state.duration"
|
|
28
|
29
|
class="w-full h-full">
|
|
|
@@ -97,6 +98,7 @@
|
|
97
|
98
|
import CXBBasePage from "~/components/CXBBasePage/CXBBasePage.vue";
|
|
98
|
99
|
import FSearch from "~/components/FSearch/FSearch.vue";
|
|
99
|
100
|
import { computed } from "vue";
|
|
|
101
|
+import type CXBBackTop from "~/components/CXBBackTop/CXBBackTop.vue";
|
|
100
|
102
|
import { getVipAreaList } from "~/apis/merchant";
|
|
101
|
103
|
import { CDN_URL } from "~/config/app";
|
|
102
|
104
|
import CXBEmpty from "~/components/CXBEmpty/CXBEmpty.vue";
|
|
|
@@ -135,6 +137,8 @@ const list = ref([])
|
|
135
|
137
|
const count = ref()
|
|
136
|
138
|
|
|
137
|
139
|
onLoad((option) => {
|
|
|
140
|
+ console.log(option.shareId);
|
|
|
141
|
+
|
|
138
|
142
|
if (option && option.shareId) {
|
|
139
|
143
|
userStore.setShareId(option.shareId)
|
|
140
|
144
|
}
|
|
|
@@ -143,12 +147,17 @@ onLoad((option) => {
|
|
143
|
147
|
userStore.setShareId(res.share_id)
|
|
144
|
148
|
}
|
|
145
|
149
|
}).catch(message => {
|
|
146
|
|
- // console.log(message)
|
|
|
150
|
+ console.log(message)
|
|
|
151
|
+ // if (message == '请登录') {
|
|
|
152
|
+ // uni.navigateTo({
|
|
|
153
|
+ // url: '/pages/user/login/index'
|
|
|
154
|
+ // })
|
|
|
155
|
+ // }
|
|
147
|
156
|
})
|
|
148
|
157
|
userStore.setRedirectPage(`/pages/vip/index`, 'page')
|
|
149
|
158
|
|
|
150
|
159
|
getHomeBanner("user_banner").then(res => {
|
|
151
|
|
- console.log(res)
|
|
|
160
|
+ console.log("user_banner", res)
|
|
152
|
161
|
state.banners = res
|
|
153
|
162
|
})
|
|
154
|
163
|
loadList('reload')
|
|
|
@@ -156,6 +165,20 @@ onLoad((option) => {
|
|
156
|
165
|
|
|
157
|
166
|
})
|
|
158
|
167
|
|
|
|
168
|
+//搜索全部筛选
|
|
|
169
|
+function searchkwd() {
|
|
|
170
|
+ if (!state.keyword) {
|
|
|
171
|
+ return uni.showToast({
|
|
|
172
|
+ title: '请输入搜索关键字',
|
|
|
173
|
+ icon: 'none'
|
|
|
174
|
+ })
|
|
|
175
|
+ }
|
|
|
176
|
+ state.currentPage = 1
|
|
|
177
|
+ state.pageSize = 10
|
|
|
178
|
+ state.pageSize = state.count
|
|
|
179
|
+ console.log("1111111111", state.currentPage, state.pageSize);
|
|
|
180
|
+ loadList('reload')
|
|
|
181
|
+}
|
|
159
|
182
|
|
|
160
|
183
|
onShareAppMessage(() => {
|
|
161
|
184
|
const shareId = Cache.get('SHARE_ID')
|
|
|
@@ -191,14 +214,12 @@ function loadList(action: 'page' | 'reload', callback?: (items) => void) {
|
|
191
|
214
|
if (state.keyword) {
|
|
192
|
215
|
params.keyword = state.keyword
|
|
193
|
216
|
}
|
|
194
|
|
- console.log(params)
|
|
|
217
|
+ console.log('我是params', params)
|
|
195
|
218
|
|
|
196
|
219
|
getVipAreaList({
|
|
197
|
|
- // page: state.currentPage,
|
|
198
|
|
- // limit: state.pageSize
|
|
199
|
220
|
...params
|
|
200
|
221
|
}).then(res => {
|
|
201
|
|
- // console.log(res.count)
|
|
|
222
|
+ console.log(res.count)
|
|
202
|
223
|
// console.log(res.list)
|
|
203
|
224
|
count.value = res.count
|
|
204
|
225
|
console.log(action);
|
|
|
@@ -208,11 +229,12 @@ function loadList(action: 'page' | 'reload', callback?: (items) => void) {
|
|
208
|
229
|
if (action === 'reload') {
|
|
209
|
230
|
list.value = res.list
|
|
210
|
231
|
}
|
|
211
|
|
- if(callback){
|
|
|
232
|
+ if (callback) {
|
|
212
|
233
|
callback(res)
|
|
213
|
234
|
}
|
|
214
|
235
|
})
|
|
215
|
236
|
}
|
|
|
237
|
+
|
|
216
|
238
|
function handleItemClick(item) {
|
|
217
|
239
|
uni.navigateTo({
|
|
218
|
240
|
url: `/pages/store/product/detail?id=${item.product_id}`
|
|
|
@@ -222,16 +244,6 @@ function handleItemClick(item) {
|
|
222
|
244
|
function handleScrollToLower() {
|
|
223
|
245
|
state.status = 'loading';
|
|
224
|
246
|
state.currentPage += 1;
|
|
225
|
|
- // console.log(state.currentPage)
|
|
226
|
|
- // console.log(state.totalPage)
|
|
227
|
|
- // if (count.value > (state.currentPage*state.pageSize)) {
|
|
228
|
|
- // loadList('page')
|
|
229
|
|
- // } else {
|
|
230
|
|
- // state.status = 'noMore';
|
|
231
|
|
- // setTimeout(() => {
|
|
232
|
|
- // loadList('page')
|
|
233
|
|
- // }, 300)
|
|
234
|
|
- // }
|
|
235
|
247
|
loadList('page', (items) => {
|
|
236
|
248
|
console.log('items', items);
|
|
237
|
249
|
if (!items.length > 0) {
|
|
|
@@ -246,13 +258,45 @@ onReachBottom(() => {
|
|
246
|
258
|
handleScrollToLower()
|
|
247
|
259
|
})
|
|
248
|
260
|
|
|
|
261
|
+//关闭搜索重新加载页面
|
|
|
262
|
+function clearSearch() {
|
|
|
263
|
+ console.log(222);
|
|
|
264
|
+ uni.showLoading()
|
|
|
265
|
+ state.currentPage = 1
|
|
|
266
|
+ state.pageSize = 10
|
|
|
267
|
+ loadList('reload', (items) => {
|
|
|
268
|
+ uni.hideLoading()
|
|
|
269
|
+ // uni.stopPullDownRefresh()
|
|
|
270
|
+ })
|
|
|
271
|
+
|
|
|
272
|
+}
|
|
|
273
|
+
|
|
249
|
274
|
onPullDownRefresh(() => {
|
|
250
|
|
- loadList('reload', items => {
|
|
251
|
|
- setTimeout(() => {
|
|
252
|
|
- uni.stopPullDownRefresh()
|
|
253
|
|
- }, 300)
|
|
|
275
|
+ console.log(111);
|
|
|
276
|
+ uni.showLoading()
|
|
|
277
|
+ state.currentPage = 1
|
|
|
278
|
+ state.pageSize = 10
|
|
|
279
|
+ loadList('reload', (items) => {
|
|
|
280
|
+ uni.hideLoading()
|
|
|
281
|
+ uni.stopPullDownRefresh()
|
|
254
|
282
|
})
|
|
255
|
283
|
})
|
|
|
284
|
+
|
|
|
285
|
+
|
|
|
286
|
+// 距离顶部距离
|
|
|
287
|
+let Scroll_X = ref(0)
|
|
|
288
|
+const headerClass = ref('')
|
|
|
289
|
+onPageScroll((page) => {
|
|
|
290
|
+ Scroll_X.value = Number(page.scrollTop.toFixed())
|
|
|
291
|
+ // page.scrollTop
|
|
|
292
|
+ if (page.scrollTop >= 76) {
|
|
|
293
|
+ headerClass.value = '!bg-primary !text-white'
|
|
|
294
|
+ } else {
|
|
|
295
|
+ headerClass.value = ''
|
|
|
296
|
+ }
|
|
|
297
|
+})
|
|
|
298
|
+
|
|
|
299
|
+
|
|
256
|
300
|
</script>
|
|
257
|
301
|
|
|
258
|
302
|
<route lang="yaml">
|