瀏覽代碼

修改商品

王新雷 4 年之前
父節點
當前提交
0a7f6bcd49

+ 9 - 0
src/api/businessManager.js

@@ -19,6 +19,15 @@ export function goodsSingleQuery (data) {
   })
 }
 
+// 修改上架下架状态
+export function updateGoodsStatus (data) {
+  return request({
+    url: api + `/goods/updateGoodsStatus`,
+    method: 'post',
+    data: qs.stringify(data)
+  })
+}
+
 // 新增商品(教材、辅件)
 export function goodsAdd (data) {
   return request({

+ 25 - 1
src/views/businessManager/shopManager/purchase-llist.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="m-container">
     <h2>
-      <div class="squrt"></div>进货清单
+      <el-page-header @back="onCancel" content="进货清单"></el-page-header>
     </h2>
     <div class="m-core">
       <el-form
@@ -150,7 +150,22 @@ export default {
     ]
     this.getList()
   },
+  created() {
+    this.init()
+  },
+  activated() {
+    this.init()
+  },
   methods: {
+    init() {
+      let query = this.$route.query
+      if (query.search) {
+        this.Fsearch = query.search;
+      }
+      if (query.pageInfo) {
+        this.Frules = query.pageInfo
+      }
+    },
     searchOrderDate(val) {
       console.log(val)
     },
@@ -172,6 +187,15 @@ export default {
           }
         })
     },
+    onCancel() {
+      this.$router.push({
+        path: '/shopManager/shopManager',
+        query: {
+          pageInfo: this.Frules,
+          searchForm: this.Fsearch
+        }
+      })
+    },
     onReSet () {
       this.orderDate = []
       this.searchForm = {

+ 20 - 6
src/views/businessManager/shopManager/shopList.vue

@@ -113,13 +113,13 @@
           <el-table-column align='center' width="180px" label="操作" fixed="right">
             <template slot-scope="scope">
               <!-- 组合商品没有进货清单按钮 -->
-              <el-button v-if="!scope.row.complementGoodsIdList" type="text">进货清单</el-button>
-              <el-popconfirm title="你是否上架该商品?" @onConfirm="onUpdate(scope.row)" v-if="scope.row.status == 0" v-permission="'goods/update'">
+              <el-button v-if="!scope.row.complementGoodsIdList" @click="onPurchaseList(scope.row)" type="text">进货清单</el-button>
+              <el-popconfirm title="你是否上架该商品?" @onConfirm="onUpdate(scope.row)" v-if="scope.row.status == 0" v-permission="'goods/updateGoodsStatus'">
                  <el-button slot="reference" type="text">上架</el-button>
               </el-popconfirm>
               <el-button v-if="scope.row.status == 0" v-permission="'/shopOperation'" @click="onShopOperation('update', scope.row)"
                 type="text">修改</el-button>
-              <el-popconfirm title="你是否下架该商品?" @onConfirm="onUpdate(scope.row)" v-if="scope.row.status == 1" v-permission="'goods/update'">
+              <el-popconfirm title="你是否下架该商品?" @onConfirm="onUpdate(scope.row)" v-if="scope.row.status == 1" v-permission="'goods/updateGoodsStatus'">
                  <el-button slot="reference" type="text">下架</el-button>
               </el-popconfirm>
               <!-- <el-button v-if="scope.row.status == 0"
@@ -217,7 +217,8 @@
     goodsQuery,
     goodsAdd,
     goodsUpdate,
-    goodsDelete
+    goodsDelete,
+    updateGoodsStatus
   } from '@/api/businessManager'
   import cleanDeep from 'clean-deep'
   import store from '@/store'
@@ -467,13 +468,24 @@
         })
       },
       onUpdate(row) {
-        goodsUpdate({
-          id: row.id,
+        updateGoodsStatus({
+          goodsId: row.id,
           status: row.status ? 0 : 1
         }).then(res => {
           this.messageTips(row.status ? '下架' : '上架', res)
         })
       },
+      onPurchaseList(row) {
+        let pageInfo = JSON.stringify(this.pageInfo)
+        let search = JSON.stringify(this.searchForm)
+        this.$router.push({
+          path: '/shopManager/purchaseLlist',
+          query: {
+            pageInfo,
+            search
+          }
+        })
+      },
       onDelete(row) {
         this.$confirm('您确定删除该商品吗?', '提示', {
           confirmButtonText: '确定',
@@ -546,10 +558,12 @@
           params.id = row.id
         }
         let pageInfo = JSON.stringify(this.pageInfo)
+        let searchForm = JSON.stringify(this.searchForm)
         let paramInfo = JSON.stringify(params)
         this.$router.push({
           path: '/shopManager/shopOperation',
           query: {
+            searchForm,
             paramInfo,
             pageInfo
           }