cr 3 роки тому
батько
коміт
ebd74e3e03
1 змінених файлів з 18 додано та 12 видалено
  1. 18 12
      src/pages/goods/list2.vue

+ 18 - 12
src/pages/goods/list2.vue

@@ -414,15 +414,15 @@ export default {
414 414
             shopGoodAsc: -1,
415 415
             shopGoodSort: -1,
416 416
             shopGoodsList: [],
417
-            cartList:[]
417
+            cartList: [],
418 418
         };
419 419
     },
420 420
 
421 421
     onLoad(opts) {
422 422
         const self = this;
423 423
         self.fn.shareMenu();
424
-        console.log(opts)
425
-        self.curTab = opts.curTab || '0';
424
+        console.log(opts);
425
+        self.curTab = opts.curTab || "0";
426 426
 
427 427
         if (!self.loading) {
428 428
             uni.showLoading({
@@ -436,7 +436,9 @@ export default {
436 436
 
437 437
         await self.fn.init();
438 438
         self.fn.shareMenu();
439
-        self.keyword = decodeURIComponent(self.$mp.query.title);
439
+        if (self.$mp.query.title) {
440
+            self.keyword = decodeURIComponent(self.$mp.query.title);
441
+        }
440 442
         self.fn.setTitle(self.keyword);
441 443
         this.tabClick(self.curTab);
442 444
     },
@@ -447,13 +449,15 @@ export default {
447 449
             ...self.$mp.query,
448 450
             shopId: this.activeShop.id,
449 451
             uid: this.user.user.id,
450
-            title:self.keyword
451 452
         };
453
+        if (self.keyword) {
454
+            obj.title = self.keyword;
455
+        }
452 456
 
453 457
         if (this.activeShop.store) {
454 458
             obj.storeId = this.activeShop.store.id;
455 459
         }
456
-        console.log(self.router.getPath(self.$mp.page.route, obj),111)
460
+        console.log(self.router.getPath(self.$mp.page.route, obj), 111);
457 461
         return {
458 462
             title: self.siteTitle,
459 463
             path: self.router.getPath(self.$mp.page.route, obj),
@@ -883,7 +887,7 @@ export default {
883 887
                     uni.hideLoading();
884 888
                 });
885 889
         },
886
-        
890
+
887 891
         setGoodsList() {
888 892
             // 删除全部
889 893
             for (let item of this.goodsList) {
@@ -893,12 +897,12 @@ export default {
893 897
             for (let item of this.shopGoodsList) {
894 898
                 for (let cart of this.cartList) {
895 899
                     if (cart.productId === item.id) {
896
-                        if(item.skus.length === 0){
900
+                        if (item.skus.length === 0) {
897 901
                             item.cart = cart;
898
-                        }else{
899
-                            if(item.cart){
902
+                        } else {
903
+                            if (item.cart) {
900 904
                                 item.cart.push(cart);
901
-                            }else{
905
+                            } else {
902 906
                                 item.cart = [cart];
903 907
                             }
904 908
                         }
@@ -926,7 +930,9 @@ export default {
926 930
                         self.isHaveMore = false;
927 931
                     }
928 932
 
929
-                    self.shopGoodsList = self.shopGoodsList.concat(res.data.data);
933
+                    self.shopGoodsList = self.shopGoodsList.concat(
934
+                        res.data.data
935
+                    );
930 936
                     this.setShopGoodsList();
931 937
                     this.setGoodsList();
932 938
                 });