zhengjinyi преди 1 година
родител
ревизия
6ac8bc3358
променени са 1 файла, в които са добавени 11 реда и са изтрити 7 реда
  1. 11 7
      src/main/resources/static/js/supplier/index.js

+ 11 - 7
src/main/resources/static/js/supplier/index.js

@@ -109,7 +109,7 @@ var supplierHome = new Vue({
             this.choiceIndex = ''
             this.isShopAll = true
             this.getMainProducts()
-            this.getProductLists()
+            this.getProductLists(false)
         },
         handleCategory(category, index){
             this.isShopAll = false
@@ -171,7 +171,7 @@ var supplierHome = new Vue({
                 }
             );
         },
-        getProductLists(){
+        getProductLists(flag){
             const _self = this;
             SupplierApi.GetSearchQueryProductSupplier(
                 {
@@ -185,15 +185,19 @@ var supplierHome = new Vue({
                     if (res.code === 0 && res.data) {
                         const result = JSON.parse(res.data);
                         _self.listRecord = result.total;
-                        var resultData = setSearchProductList(result.items, _self.userId, function () {
+                        const resultData = setSearchProductList(result.items, _self.userId, function () {
                             _self.$forceUpdate();
                             setTimeout(function () {
                                 // 图片懒加载
                                 $("img[data-original]").lazyload();
                             }, 500);
                         });
-                        console.log('resultData',resultData)
-                        _self.productLists = _self.productLists.concat(resultData);
+                        if(flag){
+                            _self.productLists = _self.productLists.concat(resultData);
+                        }else{
+                            _self.productLists = []
+                            _self.productLists = resultData
+                        }
                         console.log('productLists',_self.productLists)
                         _self.requestFlag = true;
                     }
@@ -240,7 +244,7 @@ var supplierHome = new Vue({
             this.choiceIndex = ''
             this.isShopAll = true
             this.productLists = [];
-            this.getProductLists();
+            this.getProductLists(false);
             var floorScroll = $('#supProduct').offset().top;
             $('html,body').animate({scrollTop: floorScroll},600);
         },
@@ -278,7 +282,7 @@ var supplierHome = new Vue({
                     if (_self.requestFlag){
                         _self.params.num = next;
                         // 获取列表数据
-                        _self.getProductLists();
+                        _self.getProductLists(true);
                     }
                     _self.requestFlag = false;
                 }