panhui 3 жил өмнө
parent
commit
ff24b267b3

+ 21 - 9
src/views/product/Search.vue

@@ -1,11 +1,9 @@
 <template>
-    <van-pull-refresh
+    <div
         class="search"
         success-text="加载成功"
         success-duration="500"
         :style="{ backgroundColor: isSearch ? $colors.bg3 : $colors.bg2 }"
-        v-model="isLoading"
-        @refresh="onRefresh"
         pageType="light"
     >
         <van-sticky v-if="!isSearch" ref="top" class="list-top" :offset-top="bar && bar.show ? bar.height : 0">
@@ -103,14 +101,14 @@
             :finished="finished"
             finished-text=""
             @load="getData"
-            v-if="isSearch"
+            v-show="isSearch"
         >
             <template v-for="(item, index) in list" :key="index">
                 <product-info v-model:info="list[index]" @update:info="init"></product-info>
             </template>
             <van-empty v-if="empty" description="什么都没有搜到哦~" :image="require('@assets/kong_png_wusousuo.png')" />
         </van-list>
-        <div class="search-content" v-else>
+        <div class="search-content" v-show="!isSearch">
             <div class="hot-content" v-if="historys.length > 0">
                 <div class="title">
                     <span>最近搜索</span>
@@ -127,7 +125,7 @@
                 </div>
             </div>
 
-            <swiper pagination slides-per-view="auto" :space-between="16" class="mySwiper">
+            <swiper slides-per-view="auto" :space-between="16" class="mySwiper">
                 <swiper-slide class="tab-slide" v-for="item in tabs" :key="item.id">
                     <div class="tab-top">
                         <img src="@assets/png-sosuo-bg.png" alt="" />
@@ -142,8 +140,9 @@
                         >
                             <div class="num">{{ childIndex + 1 }}</div>
                             <div class="text1">{{ child.name }}</div>
-                            <div class="new">新</div>
+                            <div class="new" v-if="isNew(child)">新</div>
                         </div>
+                        <div class="tab-item"></div>
                     </div>
                     <div class="more">
                         <img src="@assets/down.png" alt="" />
@@ -152,7 +151,7 @@
                 </swiper-slide>
             </swiper>
         </div>
-    </van-pull-refresh>
+    </div>
 </template>
 
 <script>
@@ -376,6 +375,11 @@ export default {
                 // });
                 // this.getHistory();
             }
+        },
+        isNew(info) {
+            let date1 = this.dayjs(info.createdAt).add(1, 'week');
+
+            return date1.isAfter(this.dayjs());
         }
     },
     activated() {
@@ -573,7 +577,9 @@ export default {
     overflow: auto;
     position: relative;
     .tab-top {
-        position: relative;
+        position: sticky;
+        top: 0;
+        z-index: 2;
         img {
             width: 240px;
             height: 44px;
@@ -661,6 +667,12 @@ export default {
                 z-index: 2;
             }
         }
+
+        &:nth-last-child(2) {
+            &::after {
+                content: none;
+            }
+        }
     }
 
     .more {