Browse Source

商品列表置顶

ltx529596 4 years ago
parent
commit
3e1841ccf4
2 changed files with 13 additions and 4 deletions
  1. 4 4
      src/pages/shop/shop.vue
  2. 9 0
      src/utils/request/request.js

+ 4 - 4
src/pages/shop/shop.vue

@@ -312,11 +312,11 @@ export default {
     // 置顶
     sticktop(id) {
       console.log(id);
-      this.$http.put('/goods/changeSort',{
-        id: id,
-        sort: -1
-      }).then(res=>{
+      this.$http.PUT("/goods/changeSort?id="+id+'&sort=-1').then(res=>{
         console.log(res);
+        if (res.code === 200) {
+          this.getTicketShopList()
+        }
       })
     },
     // 跳转详情

+ 9 - 0
src/utils/request/request.js

@@ -211,6 +211,15 @@ export default class Request {
     })
   }
 
+  PUT (url,data,options={}){
+    return this.request({
+      url,
+      data,
+      method: 'PUT',
+      ...options
+    })
+  }
+
   // #ifndef MP-ALIPAY
   put (url, data, options = {}) {
     return this.request({