|
|
@@ -3,7 +3,6 @@ import {getMerchantCategory, getSelectMerchant, getSelectMerchantSort} from "~/a
|
|
3
|
3
|
import type {StoreResult} from "~/apis/model/storeModel";
|
|
4
|
4
|
import {StoreParams} from "~/apis/model/storeModel";
|
|
5
|
5
|
import CXBEmpty from "~/components/CXBEmpty/CXBEmpty.vue";
|
|
6
|
|
-import CXBBackTop from "~/components/CXBBackTop/CXBBackTop.vue";
|
|
7
|
6
|
import {USER_LATITUDE, USER_LONGITUDE} from "~/constants";
|
|
8
|
7
|
import {getProductShare} from "~/apis/common";
|
|
9
|
8
|
import {useUserStore} from "~/stores/userStore";
|
|
|
@@ -49,6 +48,9 @@ const state = reactive({
|
|
49
|
48
|
menuDefaultValue: 1
|
|
50
|
49
|
// merchantPageInfo: {}
|
|
51
|
50
|
})
|
|
|
51
|
+//返回顶部标识
|
|
|
52
|
+let flag=ref(false)
|
|
|
53
|
+
|
|
52
|
54
|
const searchValue = ref('')
|
|
53
|
55
|
|
|
54
|
56
|
const {windowHeight} = uni.getSystemInfoSync()
|
|
|
@@ -207,6 +209,11 @@ const onRefresherRefresh = e => {
|
|
207
|
209
|
loadSelectMerchant('reload')
|
|
208
|
210
|
};
|
|
209
|
211
|
|
|
|
212
|
+//小火箭滚动事件
|
|
|
213
|
+const onscroll =e=>{
|
|
|
214
|
+ state.scrollTop=e.detail.scrollTop
|
|
|
215
|
+}
|
|
|
216
|
+
|
|
210
|
217
|
function handleScrollToLower() {
|
|
211
|
218
|
state.status = 'loading';
|
|
212
|
219
|
state.currentPage += 1;
|
|
|
@@ -218,6 +225,24 @@ function handleScrollToLower() {
|
|
218
|
225
|
}
|
|
219
|
226
|
}
|
|
220
|
227
|
|
|
|
228
|
+//返回顶部事件
|
|
|
229
|
+const scrollToTop = function () {
|
|
|
230
|
+ console.log('返回顶部');
|
|
|
231
|
+ state.scrollTop=0
|
|
|
232
|
+
|
|
|
233
|
+}
|
|
|
234
|
+//监视
|
|
|
235
|
+watch(()=>state.scrollTop,()=>{
|
|
|
236
|
+ if(state.scrollTop as number > 400){
|
|
|
237
|
+ flag.value = true
|
|
|
238
|
+ }
|
|
|
239
|
+ if(state.scrollTop as number < 400){
|
|
|
240
|
+ flag.value = false
|
|
|
241
|
+ }
|
|
|
242
|
+})
|
|
|
243
|
+
|
|
|
244
|
+
|
|
|
245
|
+
|
|
221
|
246
|
</script>
|
|
222
|
247
|
<template>
|
|
223
|
248
|
<!-- <nut-category :category="state.merchantCategory" @change="change">-->
|
|
|
@@ -242,6 +267,7 @@ function handleScrollToLower() {
|
|
242
|
267
|
<!-- 左侧 一级分类 -->
|
|
243
|
268
|
<div class="w-1/4">
|
|
244
|
269
|
<scroll-view
|
|
|
270
|
+ ref="ToTop"
|
|
245
|
271
|
:scroll-y="true"
|
|
246
|
272
|
:style="{ height: `${state.scrollHeight}px` }"
|
|
247
|
273
|
class="w-full h-full bg-[#f8f8f8]"
|
|
|
@@ -285,11 +311,14 @@ function handleScrollToLower() {
|
|
285
|
311
|
</nut-menu-item>
|
|
286
|
312
|
</nut-menu>
|
|
287
|
313
|
</div>
|
|
288
|
|
- <CXBBackTop/>
|
|
|
314
|
+ <!-- 返回顶部 -->
|
|
|
315
|
+ <div v-show="flag" class="back-top">
|
|
|
316
|
+ <img @click="scrollToTop" class="back-TopImg" src="../../static/icon/返回顶部@2x.png" alt="">
|
|
|
317
|
+ </div>
|
|
289
|
318
|
<scroll-view
|
|
290
|
319
|
:scroll-y="true"
|
|
291
|
320
|
:style="{ height: `${state.scrollHeight -60}px` }"
|
|
292
|
|
- scroll-with-animation
|
|
|
321
|
+ :scroll-top="state.scrollTop"
|
|
293
|
322
|
class="flex flex-1 flex-col p-3 gap-3 mt-10"
|
|
294
|
323
|
:refresher-enabled="true"
|
|
295
|
324
|
refresher-background="#f5f5f5"
|
|
|
@@ -301,7 +330,7 @@ function handleScrollToLower() {
|
|
301
|
330
|
@refresherAbort="onRefresherAbort"
|
|
302
|
331
|
@refresherrefresh="onRefresherRefresh"
|
|
303
|
332
|
v-if="state.merchantList && state.merchantList.length > 0"
|
|
304
|
|
-
|
|
|
333
|
+ @scroll="onscroll"
|
|
305
|
334
|
>
|
|
306
|
335
|
<div
|
|
307
|
336
|
v-for="(item, index) in state.merchantList" :key="index"
|
|
|
@@ -362,6 +391,20 @@ page {
|
|
362
|
391
|
--nut-menu-bar-box-shadow: none;
|
|
363
|
392
|
--nut-menu-item-active-text-color: #FE0032;
|
|
364
|
393
|
|
|
|
394
|
+ .back-top{
|
|
|
395
|
+ width: 40px;
|
|
|
396
|
+ height: 40px;
|
|
|
397
|
+ position: fixed;
|
|
|
398
|
+ border-radius: 50%;
|
|
|
399
|
+ z-index: 999;
|
|
|
400
|
+ right: 15px;
|
|
|
401
|
+ bottom: 60px;
|
|
|
402
|
+ }
|
|
|
403
|
+ .back-TopImg{
|
|
|
404
|
+ width: 40px;
|
|
|
405
|
+ height: 40px;
|
|
|
406
|
+ border-radius: 50%;
|
|
|
407
|
+ }
|
|
365
|
408
|
.nut-menu {
|
|
366
|
409
|
background: none !important;
|
|
367
|
410
|
}
|