Browse Source

商品列表设置权限

panyong 3 years ago
parent
commit
27f20b81a4
1 changed files with 53 additions and 3 deletions
  1. 53 3
      htmldev/manage/src/views/business/pms/goods/index.vue

+ 53 - 3
htmldev/manage/src/views/business/pms/goods/index.vue

@@ -141,7 +141,7 @@
           </el-form>
           </el-form>
         </template>
         </template>
       </el-table-column>
       </el-table-column>
-      <el-table-column label="ID" prop="id" width="160"></el-table-column>
+      <el-table-column label="ID" prop="id" width="80"></el-table-column>
       <el-table-column label="商品名称" prop="product_name"></el-table-column>
       <el-table-column label="商品名称" prop="product_name"></el-table-column>
       <el-table-column label="商品分类" prop="category_name"></el-table-column>
       <el-table-column label="商品分类" prop="category_name"></el-table-column>
       <el-table-column label="价格(元)">
       <el-table-column label="价格(元)">
@@ -164,8 +164,10 @@
           <p>{{ ['下架', '上架'][scope.row.product_status] }}</p>
           <p>{{ ['下架', '上架'][scope.row.product_status] }}</p>
         </template>
         </template>
       </el-table-column>
       </el-table-column>
-      <el-table-column label="操作" width="100">
+      <el-table-column label="操作" width="160">
         <template slot-scope="scope">
         <template slot-scope="scope">
+          <!--todo 设置按钮权限-->
+          <el-button type="text" :disabled="booLock" @click="showStoragedialogForm(scope.row)">是否售罄</el-button>
           <el-button type="text" v-permission="'business_pms_goods_edit'" @click="edit(scope.row)">编辑</el-button>
           <el-button type="text" v-permission="'business_pms_goods_edit'" @click="edit(scope.row)">编辑</el-button>
           <el-button type="text" v-permission="'business_pms_goods_del'" @click="del(scope.row)">删除</el-button>
           <el-button type="text" v-permission="'business_pms_goods_del'" @click="del(scope.row)">删除</el-button>
         </template>
         </template>
@@ -188,6 +190,28 @@
             :categoryData="categoryArr"
             :categoryData="categoryArr"
             :goodsAttrData="goodsAttrArr"
             :goodsAttrData="goodsAttrArr"
             @success="init"></detail>
             @success="init"></detail>
+    <el-dialog title="商品是否售罄确认"
+               :visible.sync="storagedialogForm">
+      <el-form :model="dialogForm"
+               :rules="formRules"
+               ref="dialogForm">
+        <el-form-item
+          label="是否售罄"
+          prop="order_status"
+          :rules="formRules.required">
+          <el-select
+            v-model="dialogForm.order_status"
+            placeholder="请选择">
+            <el-option label="否" value="0"></el-option>
+            <el-option label="是" value="1"></el-option>
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="storagedialogForm = false">取 消</el-button>
+        <el-button type="primary" @click="storageSet">确 定</el-button>
+      </div>
+    </el-dialog>
   </div>
   </div>
 </template>
 </template>
 
 
@@ -209,7 +233,10 @@ export default {
       },
       },
       searchForm: {},
       searchForm: {},
       tableData: [],
       tableData: [],
-      tableUrl: '/v1/bar/product/list'
+      tableUrl: '/v1/bar/product/list',
+      booLock: false,
+      storagedialogForm: false,
+      dialogForm: {}
     }
     }
   },
   },
   computed: {
   computed: {
@@ -240,6 +267,29 @@ export default {
           this.$store.dispatch('common/fetchGoodsArr')
           this.$store.dispatch('common/fetchGoodsArr')
         }
         }
       }).catch(() => {})
       }).catch(() => {})
+    },
+    showStoragedialogForm (row) {
+      this.storagedialogForm = true
+      this.dialogForm = {}
+      this.$nextTick(() => {
+        this.$set(this.dialogForm, 'id', row.id)
+      })
+    },
+    // TODO 设置是否售罄
+    async storageSet () {
+      this.$refs['dialogForm'].validate(async valid => {
+        if (valid) {
+          this.booLock = true
+          const data = await this.$fetch('', this.dialogForm, 'get')
+          this.booLock = false
+          if (data.code === 200) {
+            this.$message.success('设置成功')
+            this.orderStatusdialogForm = false
+          }
+        } else {
+          console.log('error submit!!')
+        }
+      })
     }
     }
   },
   },
   mounted () {
   mounted () {