Bläddra i källkod

门店分页优化、门店支持编辑

yingjian.wu 3 månader sedan
förälder
incheckning
ad1bb89a11
1 ändrade filer med 18 tillägg och 7 borttagningar
  1. 18 7
      pages/hexiao/ywy/retail.vue

+ 18 - 7
pages/hexiao/ywy/retail.vue

@@ -15,7 +15,8 @@
       </view>
     </view>
 
-    <scroll-view scroll-y="true" class="list-container with-padding-bottom">
+    <!-- 修改1: 为scroll-view添加scrolltolower事件 -->
+    <scroll-view scroll-y="true" class="list-container with-padding-bottom" @scrolltolower="loadMoreData">
       <view v-if="storeList.length === 0" class="empty-list">
         <text>没有找到相关门店</text>
       </view>
@@ -49,7 +50,10 @@
               <uni-icons type="compose" size="18" color="#3c82f8"></uni-icons>
               <text>数据查看</text>
             </view>
-
+            <view class="action-btn" @click="editStore(store.id)" v-if="ywyId === 0">
+              <uni-icons type="tune-filled" size="18" color="#3c82f8"></uni-icons>
+              <text>编辑</text>
+            </view>
             <view class="action-btn" @click="patrolStore(store.id)" v-if="ywyId === 0">
               <uni-icons type="home-filled" size="18" color="#3c82f8"></uni-icons>
               <text>巡店</text>
@@ -82,15 +86,16 @@ export default {
   data() {
     return {
       searchQuery: '',
-      storeList: [
-        // { id: 6, name: '湖北武汉光谷店6', owner: '张三丰', contact: '18812345678', address: '湖北省武汉市洪山区光谷步行街1号' },
-      ],
+      storeList: [],
       filteredList: [],
       pagination: {
         page: 1,
         limit: 10,
       },
-      ywyId:0,
+      ywyId: 0,
+      // 修改2: 初始化加载状态变量
+      isLoading: false,
+      loadStatus: 'more' // more: 可以继续加载, loading: 加载中, noMore: 没有更多数据
     };
   },
   onShow(){
@@ -170,7 +175,13 @@ export default {
     },
     addNewStore() {
       uni.navigateTo({ url: `/pages/hexiao/ywy/add_retail?edit=1` });
-     }
+    },
+    // 修改:将方法名改为loadMoreData
+    loadMoreData() {
+      // 当滚动到底部时,调用fetchStoreList加载下一页数据
+      // 传入false表示不是刷新操作,而是加载更多
+      this.fetchStoreList(false);
+    }
   }
 }
 </script>