Browse Source

解决店铺详情页抢购列表购买和加入购物车功能bug

yangc 8 years ago
parent
commit
0d96607176

+ 7 - 3
components/product/brand/BrandComponent.vue

@@ -84,9 +84,13 @@
         this.pageParams.page = 1
         this.pageCmpGoods(this.pageParams)
       },
-      async pageCmpGoods (params) {
-        let { data } = await this.$http.get('/api/product/component/list', { params })
-        this.$store.commit('brandComponent/GET_COMPONENT_SUCCESS', data)
+//      async pageCmpGoods (params) {
+      pageCmpGoods (params) {
+//        let { data } = await this.$http.get('/api/product/component/list', { params })
+//        this.$store.commit('brandComponent/GET_COMPONENT_SUCCESS', data)
+        this.$http.get('/api/product/component/list', { params }).then(response => {
+          this.$store.commit('brandComponent/GET_COMPONENT_SUCCESS', response)
+        })
       },
       handleCurrentChange (page) {
         this.pageParams.page = page

+ 12 - 6
components/store/CommodityList.vue

@@ -183,17 +183,23 @@ export default {
       this.pageParams.page = 1
       this.pageCommodity(this.pageParams, this.ids, keyword)
     },
-    async pageCommodity (pageParams, kindId, keyword) {
+//    async pageCommodity (pageParams, kindId, keyword) {
+    pageCommodity (pageParams, kindId, keyword) {
       let params = { storeid: this.$route.params.uuid, origin: 'store', kindUuid: kindId, code: keyword }
       params.page = pageParams.page
       params.count = pageParams.count
 
-      try {
-        let { data } = await this.$http.get('/api/commodity/commodities', { params })
-        this.$store.commit('shop/storeInfo/GET_STORE_COMMODITY_SUCCESS', data)
-      } catch (err) {
+//      try {
+//        let { data } = await this.$http.get('/api/commodity/commodities', { params })
+//        this.$store.commit('shop/storeInfo/GET_STORE_COMMODITY_SUCCESS', data)
+//      } catch (err) {
+//        this.$store.commit('shop/storeInfo/GET_STORE_COMMODITY_FAILURE', err)
+//      }
+      this.$http.get('/api/commodity/commodities', { params }).then(response => {
+        this.$store.commit('shop/storeInfo/GET_STORE_COMMODITY_SUCCESS', response)
+      }, err => {
         this.$store.commit('shop/storeInfo/GET_STORE_COMMODITY_FAILURE', err)
-      }
+      })
     },
     handleCurrentChange (page) {
       this.pageParams.page = page

+ 2 - 2
components/store/RecommendProduct.vue

@@ -63,10 +63,10 @@
                   console.log(err)
                 })
             } else {
+              console.log(item)
               // this.$store.dispatch('user/addCar', {uuid: item.uuid, batchCode: item.batchCode, number: item.minBuyQty})
-              axios.post('trade/cart/add', {uuid: item.uuid, batchCode: item.batchCode, number: item.minBuyQty})
+              axios.post('trade/cart/add', {uuid: item.comUuid, batchCode: item.batchCode, number: item.minBuyQty, currencyName: item.currency})
                 .then(response => {
-                  console.log(response.data)
                   if (response.data.success) {
                     this.$message({
                       message: '添加购物车成功',