Kaynağa Gözat

书架排序

natasha 4 gün önce
ebeveyn
işleme
0b6c692399
1 değiştirilmiş dosya ile 17 ekleme ve 8 silme
  1. 17 8
      src/views/bookShelf/index.vue

+ 17 - 8
src/views/bookShelf/index.vue

@@ -267,12 +267,13 @@ export default {
       userMessage: getToken() ? JSON.parse(getToken()) : null,
       loginFlag: false,
       toUrl: "",
+      stopLoad: false,
     };
   },
   //计算属性 类似于data概念
   computed: {
     disabled() {
-      return this.loading || this.noMore;
+      return this.loading || this.noMore || this.stopLoad;
     },
   },
   //监控data中数据变化
@@ -280,6 +281,7 @@ export default {
   //方法集合
   methods: {
     handleClick(item, index) {
+      this.stopLoad = true;
       this.typeIndex = index;
       this.pageNumber = 1;
       if (item.hasOwnProperty("value")) {
@@ -302,6 +304,7 @@ export default {
               skeleton: true,
             },
           ];
+          this.stopLoad = false;
           this.getList();
         } else {
           this.BookList = [];
@@ -346,6 +349,7 @@ export default {
       this.getList();
     },
     SortEvent(type, name, sortName) {
+      this.stopLoad = true;
       let sort = "";
       this.changeList.forEach((item) => {
         if (item.name == name) {
@@ -374,6 +378,7 @@ export default {
         },
         200
       );
+      this.stopLoad = false;
       this.pageNumber = 1;
       this.getList();
     },
@@ -389,6 +394,8 @@ export default {
           // 升序不传值
           order_column_list = [this.sortField];
         }
+      } else {
+        order_column_list = ["buy_time:desc"];
       }
       let data = {
         goods_name: this.searchNameValue.trim(),
@@ -408,13 +415,15 @@ export default {
                   {}
                 ).then((ress) => {
                   if (ress.status === 1) {
-                    this.orderPeruseNumber = ress.valid_period_list.length;
-                    ress.valid_period_list.forEach((items) => {
-                      items.type = 30;
-                    });
-                    this.BookList = ress.valid_period_list.concat(
-                      res.goods_list
-                    );
+                    if (res.cur_page === 1) {
+                      this.orderPeruseNumber = ress.valid_period_list.length;
+                      ress.valid_period_list.forEach((items) => {
+                        items.type = 30;
+                      });
+                      this.BookList = ress.valid_period_list.concat(
+                        res.goods_list
+                      );
+                    }
                   } else {
                     this.BookList = res.goods_list;
                   }