فهرست منبع

Update shopList.vue

lex-xin 4 سال پیش
والد
کامیت
8b0366ed09
1فایلهای تغییر یافته به همراه27 افزوده شده و 11 حذف شده
  1. 27 11
      src/views/businessManager/shopManager/shopList.vue

+ 27 - 11
src/views/businessManager/shopManager/shopList.vue

@@ -213,24 +213,32 @@
                          v-permission="'/purchaseLlist'"
                          @click="onPurchaseList(scope.row)"
                          type="text">进货清单</el-button>
-              <el-popconfirm title="你是否上架该商品?"
+              <!-- <el-popconfirm title="你是否上架该商品?"
                              @confirm="onUpdate(scope.row)"
                              v-if="scope.row.status == 0"
                              v-permission="'goods/updateGoodsStatus'">
                 <el-button slot="reference"
                            type="text">上架</el-button>
-              </el-popconfirm>
+              </el-popconfirm> -->
+              <el-button v-if="scope.row.status == 0"
+                         v-permission="'goods/updateGoodsStatus'"
+                         @click="onUpdate(scope.row, 0)"
+                         type="text">上架</el-button>
               <el-button v-if="scope.row.status == 0"
                          v-permission="scope.row.complementGoodsIdList ? 'goods/update' : '/shopOperation'"
                          @click="onShopOperation('update', scope.row)"
                          type="text">修改</el-button>
-              <el-popconfirm title="你是否下架该商品?"
+              <el-button v-if="scope.row.status == 1"
+                         v-permission="'goods/updateGoodsStatus'"
+                         @click="onUpdate(scope.row, 1)"
+                         type="text">下架</el-button>
+              <!-- <el-popconfirm title="你是否下架该商品?"
                              @confirm="onUpdate(scope.row)"
                              v-if="scope.row.status == 1"
                              v-permission="'goods/updateGoodsStatus'">
                 <el-button slot="reference"
                            type="text">下架</el-button>
-              </el-popconfirm>
+              </el-popconfirm> -->
               <!-- <el-button v-if="scope.row.status == 0"
                          v-permission="'goods/del'"
                          @click="onDelete(scope.row)"
@@ -649,13 +657,21 @@ export default {
         }
       })
     },
-    onUpdate (row) {
-      updateGoodsStatus({
-        goodsId: row.id,
-        status: row.status ? 0 : 1
-      }).then(res => {
-        this.messageTips(row.status ? '下架' : '上架', res)
-      })
+    async onUpdate (row, type) {
+      let title = type == 1 ? '你是否下架该商品?' : '你是否上架该商品?'
+      this.$confirm(title, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(async () => {
+        await updateGoodsStatus({
+          goodsId: row.id,
+          status: row.status ? 0 : 1
+        }).then(res => {
+          this.messageTips(row.status ? '下架' : '上架', res)
+        })
+      }).catch(() => {
+      });
     },
     onPurchaseList (row) {
       let pageInfo = JSON.stringify(this.pageInfo)