Browse Source

await优化

yangc 8 years ago
parent
commit
01d03804ea
1 changed files with 12 additions and 6 deletions
  1. 12 6
      components/provider/Suppliers.vue

+ 12 - 6
components/provider/Suppliers.vue

@@ -87,15 +87,21 @@ export default {
       }
       return description.slice(0, 160)
     },
-    async pageCommodity (pageParams) {
+//    async pageCommodity (pageParams) {
+    pageCommodity (pageParams) {
       pageParams.op = 'pageByType'
 
-      try {
-        let { data } = await this.$http.get('/api/store-service/stores', { params: pageParams })
-        this.$store.commit('provider/stores/GET_STORE_LIST_SUCCESS', data)
-      } catch (err) {
+//      try {
+//        let { data } = await this.$http.get('/api/store-service/stores', { params: pageParams })
+//        this.$store.commit('provider/stores/GET_STORE_LIST_SUCCESS', data)
+//      } catch (err) {
+//        this.$store.commit('provider/stores/GET_STORE_LIST_FAILURE', err)
+//      }
+      this.$http.get('/api/store-service/stores', { params: pageParams }).then(response => {
+        this.$store.commit('provider/stores/GET_STORE_LIST_SUCCESS', response)
+      }, err => {
         this.$store.commit('provider/stores/GET_STORE_LIST_FAILURE', err)
-      }
+      })
     },
     handleCurrentChange (page) {
       this.pageParams.page = page