ソースを参照

购物车处理

xiejiebiao 2 年 前
コミット
903374d638

+ 1 - 1
src/components/goodsItem/index.vue

@@ -152,7 +152,7 @@ export default {
         goodsIds = [goodsIds]
       }
       this.$request
-        .addCart({ goodsIds: goodsIds })
+        .addCart({ goodsIds })
         .then((res) => {
           if (res) {
             this.getCartCount();

+ 5 - 2
src/pages/goods-detail/bank-detail.vue

@@ -1822,9 +1822,12 @@ export default {
 
       this.getAddCar(this.goodsId);
     },
-    getAddCar(goodsId) {
+    getAddCar(goodsIds) {
+      if (!Array.isArray(goodsIds)) {
+        goodsIds = [goodsIds]
+      }
       this.$request
-        .addCart({ goodsId: goodsId })
+        .addCart({ goodsIds })
         .then((res) => {
           this.getCartCount();
           this.$message({

+ 5 - 2
src/pages/goods-detail/course-detail.vue

@@ -1423,9 +1423,12 @@ export default {
 
       this.getAddCar(this.goodsId);
     },
-    getAddCar(goodsId) {
+    getAddCar(goodsIds) {
+      if (!Array.isArray(goodsIds)) {
+        goodsIds = [goodsIds]
+      }
       this.$request
-        .addCart({ goodsId: goodsId })
+        .addCart({ goodsIds })
         .then((res) => {
           this.getCartCount();
           this.$message({

+ 5 - 2
src/pages/goods-detail/live-detail.vue

@@ -1570,9 +1570,12 @@ export default {
       }
       this.getAddCar(this.goodsId);
     },
-    getAddCar(goodsId) {
+    getAddCar(goodsIds) {
+      if (!Array.isArray(goodsIds)) {
+        goodsIds = [goodsIds]
+      }
       this.$request
-        .addCart({ goodsId: goodsId })
+        .addCart({ goodsIds })
         .then((res) => {
           this.getCartCount();
           this.$message({