فهرست منبع

新增商品规格

wenjie 1 سال پیش
والد
کامیت
f96d40062d

+ 33 - 10
src/router/index.js

@@ -289,6 +289,39 @@ export let constantRoutes = [{
           },
         ]
       },
+      {
+        id: 0,
+        path: '/operationManage/goodsType/index',
+        component: operationLayout,
+        meta: {
+          title: '规格模板',
+          icon: ''
+        },
+        alwaysShow: true,
+        children: [{
+            id: 1,
+            path: '/operationManage/goodsType/index',
+            name: '/operationManage/goodsType/index',
+            component: () => import('@/views/operationManage/goodsType/index.vue'),
+            meta: {
+              title: '商品规格',
+              icon: ''
+            },
+          },
+          {
+            id: 1,
+            path: '/operationManage/goodsType/addGoodsType',
+            name: '/operationManage/goodsType/addGoodsType',
+            hidden:true,
+            component: () => import('@/views/operationManage/goodsType/addGoodsType.vue'),
+            meta: {
+              title: '添加规格',
+              icon: '',
+              activeMenu: '/operationManage/goodsType/index'
+            },
+          },
+        ]
+      },
       {
         id: 0,
         path: '/operationManage/goodsManage/index',
@@ -308,16 +341,6 @@ export let constantRoutes = [{
               icon: ''
             },
           },
-          // {
-          //   id: 1,
-          //   path: '/operationManage/goodsManage/addGoods',
-          //   name: '/operationManage/goodsManage/addGoods',
-          //   component: () => import('@/views/operationManage/goodsManage/addGoods.vue'),
-          //   meta: {
-          //     title: '添加商品',
-          //     icon: ''
-          //   },
-          // },
           {
             id: 1,
             path: '/operationManage/goodsManage/goodsDetail',

+ 153 - 0
src/views/operationManage/goodsType/addGoodsType.vue

@@ -0,0 +1,153 @@
+<template>
+  <div class="addGoodsType app-container" v-loading="loading1">
+    <el-form
+      :model="setQuery"
+      ref="setQuery"
+      :rules="rules"
+      label-width="130px"
+    >
+      <el-form-item label="模版名称:" prop="setMealName">
+        <el-input
+          v-model="setQuery.setMealName"
+          :maxlength="11"
+          class="item-width-300"
+        ></el-input>
+      </el-form-item>
+      <el-form-item label="所属商品:" prop="setMealCode">
+        <el-input
+          v-model="setQuery.setMealCode"
+          :maxlength="11"
+          class="item-width-300"
+        ></el-input>
+      </el-form-item>
+      <el-form-item :label="'商品属性'+(index+1)+':'" v-for="(item,index) in setQuery.list" :key="index"  :prop="'list.' + index + '.key'" :rules="{
+      required: true, message: '商品属性不能为空', trigger: 'blur'
+    }">
+        <div class="item" >
+          <el-input
+            placeholder="请输入属性名称"
+            v-model="item.key"
+            class="item-width-300"
+          >
+          </el-input>
+          <i class="icon el-icon-plus" @click="add(index,'list')"></i>
+          <i class="icon el-icon-minus" @click="remove(index,'list')"></i>
+        </div>
+      </el-form-item>
+      <el-form-item :label="'商品规格'+(index+1)+':'" v-for="(item,index) in setQuery.list1" :key="index"  :prop="'list.' + index + '.key'" :rules="{
+      required: true, message: '商品规格不能为空', trigger: 'blur'
+    }">
+        <div class="item" >
+          <el-input
+            placeholder="请输入属性名称"
+            v-model="item.key"
+            class="item-width-300"
+          >
+          </el-input>
+          <i class="icon el-icon-plus" @click="add(index,'list1')"></i>
+          <i class="icon el-icon-minus" @click="remove(index,'list1')"></i>
+        </div>
+      </el-form-item>
+    </el-form>
+
+    <div class="btn-group">
+      <el-button>取 消</el-button>
+      <el-button type="primary" :loading="loading" @click="save"
+        >确 定</el-button
+      >
+    </div>
+  </div>
+</template>
+
+<script>
+import { addOrUpdate } from "@/api/common";
+export default {
+  data() {
+    return {
+      loading: false,
+      loading1: false,
+      setQuery: {
+        setMealCode: 0,
+        setMealDetail: "",
+        setMealId: 0,
+        setMealName: "",
+         list:[
+            {
+              key:''
+            },
+          ],
+          list1:[
+            {
+              key:''
+            },
+          ],
+      },
+      rules: {
+        setMealCode: [
+          { required: true, message: "请输入套餐code", trigger: "blur" },
+        ],
+        setMealName: [
+          { required: true, message: "请输入套餐名称", trigger: "blur" },
+        ],
+      },
+    };
+  },
+  methods: {
+    add(index){
+      this.setQuery.list.splice(index+1,0,{key:''})
+    },
+    remove(index){
+      if(this.setQuery.list.length == 1) return
+      this.setQuery.list.splice(index,1)
+    },
+    save() {
+      // this.loading = true;
+      this.$refs.setQuery.validate((v) => {
+        if (v) {
+          // addOrUpdate(this.setQuery).then((res) => {
+          //   this.loading = false;
+          //   if (res.state == "Success") {
+          //     this.$notify({
+          //       title: "成功",
+          //       message: "操作成功",
+          //       type: "success",
+          //     });
+          //     this.setQuery = {
+          //       setMealCode: 0,
+          //       setMealDetail: "",
+          //       setMealId: 0,
+          //       setMealName: "",
+          //     };
+          //     this.$router.push("/operationManage/goodsType/index");
+          //   }
+          // });
+        }
+      });
+    },
+  },
+  created () {
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.addGoodsType {
+  padding-bottom: 40px;
+  .item{
+    display: flex;
+    align-items: center;
+    margin-bottom: 10px;
+    .icon{
+      font-size: 18px;
+      font-weight: bold;
+      margin-left: 10px;
+      cursor: pointer;
+    }
+  }
+  .btn-group {
+    display: flex;
+    align-items: center;
+    justify-content: center;
+  }
+}
+</style>

+ 187 - 0
src/views/operationManage/goodsType/index.vue

@@ -0,0 +1,187 @@
+
+<template>
+  <div class="goodsType app-container">
+    <div class="search">
+      <el-button class="add-btn" type="primary" size="small" @click="handleAdd"
+        >添加</el-button
+      >
+    </div>
+
+    <el-table
+      :data="tableData"
+      tooltip-effect="dark"
+      border
+      v-loading="loading"
+      style="width: 100%"
+    >
+      <el-table-column
+        align="center"
+        label="模版名称"
+        prop="setMealCode"
+        show-overflow-tooltip
+      >
+      </el-table-column>
+      <el-table-column
+        prop="setMealName"
+        align="center"
+        label="商品类型"
+        show-overflow-tooltip
+      >
+      </el-table-column>
+  
+      <el-table-column
+        prop="createTime"
+        align="center"
+        label="状态"
+        show-overflow-tooltip
+      >
+        <template slot-scope="scope">
+          <span :class="[scope.row.status == 1?'green':'red']">{{ scope.row.status == 1 ? "启用" : "禁用"}}</span>
+        </template>
+      </el-table-column>
+      <el-table-column align="center" label="操作">
+        <template slot-scope="scope">
+          <el-button
+            type="text"
+            size="small"
+            @click="handle(scope.row)"
+            >{{ scope.row.status == 1 ? "禁用" : "启用" }}</el-button
+          >
+          <el-button type="text" size="small" @click="handleEdit(scope.row.id)"
+            >修改</el-button
+          >
+          <el-button type="text" size="small" @click="handleDel(scope.row)"
+            >删除</el-button
+          >
+        </template>
+      </el-table-column>
+    </el-table>
+    <div class="page-box">
+      <el-pagination
+        @size-change="handleSizeChange"
+        @current-change="handleCurrentChange"
+        background
+        :current-page="query.currentPage"
+        :page-sizes="[10, 20, 30, 40]"
+        :page-size="query.pageSize"
+        layout="total, sizes, prev, pager, next, jumper"
+        :total="total"
+      >
+      </el-pagination>
+    </div>
+  </div>
+</template>
+  
+  <script>
+import { debounce } from "@/utils/index";
+import { getList,operate } from "@/api/common";
+export default {
+  name: "goodsType",
+  data() {
+    return {
+      options: [
+        {
+          value: "0",
+          label: "全部状态",
+        },
+        {
+          value: "1",
+          label: "已完成",
+        },
+        {
+          value: "2",
+          label: "进行中",
+        },
+        {
+          value: "3",
+          label: "失败",
+        },
+      ],
+      tableData: [],
+      loading: false,
+      query: {
+        currentPage: 1,
+        pageSize: 10,
+      },
+      title: "",
+      total: 0,
+    };
+  },
+  watch: {
+    query: {
+      handler: debounce(function (val) {
+          this.getList()
+
+      }),
+      deep: true,
+    },
+  },
+  methods: {
+    handle(row){
+       this.$confirm(`此操作将${row.status == 1?'禁用':'启用'}该条数据, 是否继续?`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          operate({setMealId:row.id,status:row.status == 1?2:1}).then(res=>{
+            if (res.state == "Success") {
+              this.$notify({
+                title: '提示',
+                message: '操作成功',
+                type: 'success'
+              });
+              this.getList()
+            }
+          })
+         
+        })
+      
+    },
+    handleEdit(id){
+      this.$router.push({
+        path:"/operationManage/goodsType/addGoodsType",
+        query:{
+          id
+        }
+      });
+    },
+    handleAdd() {
+      this.$router.push("/operationManage/goodsType/addGoodsType");
+    },
+    handleDel(row) {},
+    handleSizeChange(val) {
+      this.query.currentPage = 1;
+      this.query.pageSize = val;
+      this.getList();
+    },
+    handleCurrentChange(val) {
+      this.query.currentPage = val;
+      this.getList();
+    },
+
+    search() {
+      this.query.currentPage = 1;
+      this.getList();
+    },
+    getList() {
+      this.loading = true
+      getList(this.query).then((res) => {
+        this.loading = false
+        if (res.state == "Success") {
+          this.tableData = res.content.records;
+          this.total = res.content.total
+        }
+      });
+    },
+  },
+  created() {
+    this.getList();
+  },
+};
+</script>
+  
+<style lang="scss" >
+.goodsType {
+}
+</style>
+  

+ 7 - 1
src/views/operationManage/shopManage/shopAdd.vue

@@ -2,7 +2,7 @@
  * @Author: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
  * @Date: 2023-05-26 16:37:34
  * @LastEditors: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
- * @LastEditTime: 2024-02-22 16:21:34
+ * @LastEditTime: 2024-02-22 16:36:27
  * @FilePath: \admin-manage\src\views\operationManage\shopManage\shopAdd.vue
  * @Description: 
  * 
@@ -104,6 +104,12 @@
         </el-input>
       </el-form-item>
       
+      <!-- <el-form-item label="店铺状态:">
+        <el-radio-group v-model="setQuery.doorImg">
+            <el-radio :label="1">关闭</el-radio>
+            <el-radio :label="2">运营中</el-radio>
+          </el-radio-group>
+      </el-form-item> -->
    
     </el-form>