Zory 3 روز پیش
والد
کامیت
64a9b4730b

+ 26 - 0
src/api/model/storeCate.js

@@ -0,0 +1,26 @@
+import config from "@/config";
+import http from "@/utils/request";
+
+export default {
+    list: {
+        url: `${config.API_URL}/store/category/list`,
+        name: "-",
+        get: async function (data = {}) {
+            return await http.get(this.url, data);
+        },
+    },
+    batch: {
+        url: `${config.API_URL}/store/category/batch`,
+        name: "-",
+        post: async function (data = {}) {
+            return await http.post(this.url, data);
+        },
+    },
+    del: {
+        url: `${config.API_URL}/store/category/del`,
+        name: "-",
+        post: async function (data = {}) {
+            return await http.post(this.url, data);
+        },
+    },
+}

+ 73 - 0
src/views/manage/shop/index/components/category.vue

@@ -0,0 +1,73 @@
+<template>
+    <el-dialog :title="titleMap[mode]" v-model="visible" :width="800" destroy-on-close @closed="$emit('closed')">
+        <div style="margin-bottom: 10px;">
+            <el-button type="primary">新增品类</el-button>
+        </div>
+        <div style="height: 500px;">
+            <scTable ref="table" :data="categoryData" @selectionChange="selectionChange" row-key="id" hidePagination>
+                <el-table-column label="品类名称" width="200" fixed="left" prop="name"></el-table-column>
+                <el-table-column label="品类ID" prop="category_id" width="200"></el-table-column>
+                <el-table-column label="开通类型" prop="category_id" width="200">
+                    <template #default="scope">
+                        <div class="flex-types" v-if="scope.row.types">
+                            <el-tag v-for="(item,indx) in scope.row.types" :key="indx">{{ item.name }}</el-tag>
+                        </div>
+                        <div v-else>-</div>
+                    </template>
+                </el-table-column>
+                <el-table-column label="操作" width="120" align="left" fixed="right">
+                    <template #default="scope">
+                        <el-button-group>
+                            <el-button type="danger" size="small" @click="table_del(scope.row)" v-if="scope.row.level == 3">删除</el-button>
+                            <el-button text type="danger" size="small" v-else>-</el-button>
+                        </el-button-group>
+                    </template>
+                </el-table-column>
+            </scTable>
+        </div>
+    </el-dialog>
+</template>
+
+<script>
+export default {
+    data(){
+        return {
+            list: {
+                apiObj: this.$API.category.list
+            },
+            loading: false,
+            isSaveing: false,
+            mode:"add",
+            titleMap:{
+                add:"开通品类"
+            },
+            visible:false,
+            categoryData:[]
+        }
+    },
+    methods:{
+        open(mode = 'add'){
+            this.mode = mode;
+            this.visible = true;
+            return this
+        },
+        //表单注入数据
+        setData(data){
+            this.formData = JSON.parse(JSON.stringify(data));
+            this.getCate()
+        },
+        async getCate(){
+            var resp = await this.$API.storeCate.list.get({"poi":this.formData.poi_id})
+            if (resp.code == 0) {
+                this.$message.error(resp.msg)
+                this.visible = false;
+                return ;
+            }
+            this.categoryData = resp.data;
+        }
+    }
+}
+</script>
+<style>
+.flex-types{display: flex;gap: 10px;}
+</style>

+ 0 - 6
src/views/manage/shop/index/components/form.vue

@@ -30,12 +30,6 @@
                 </el-row>
                 <div class="el-form-item-msg">营业时间为必选,否则小程序端无法下单</div>
             </el-form-item>
-            <el-form-item label="可发布商品类型" prop="product_type" v-loading="channelLoad">
-                <el-checkbox-group v-model="formData.product_type">
-                    <el-checkbox-button border :value="item.key" :label="item.key" v-for="(item,indx) in cateData" :key="indx">{{ item.name }}</el-checkbox-button>
-                </el-checkbox-group>
-                <div class="el-form-item-msg"></div>
-            </el-form-item>
             <el-row :gutter="10">
                 <el-col :span="12">
                     <el-form-item label="团购结算费率" prop="life_rate">

+ 12 - 14
src/views/manage/shop/index/components/table.vue

@@ -9,14 +9,6 @@
                 <span class="status-danger" v-else>未设置</span>
             </template>
         </el-table-column>
-        <el-table-column label="商品类型" prop="truename" width="200">
-            <template #default="scope">
-                <div class="tag-flex" v-if="scope.row.type.length > 0">
-                    <el-tag v-for="(item,indx) in scope.row.type" :key="indx">{{ item }}</el-tag>
-                </div>
-                <span class="status-danger" v-else>未开通</span>
-            </template>
-        </el-table-column>
         <el-table-column label="营业时间" prop="agent" width="150">
             <template #default="scope">
                 <span v-if="scope.row.start_at">{{ scope.row.start_at }}-{{ scope.row.end_at }}</span>
@@ -47,25 +39,26 @@
             </template>
         </el-table-column>
         <el-table-column label="创建时间" prop="create_at" width="180"></el-table-column>
-        <el-table-column label="操作" width="140" align="left" fixed="right">
+        <el-table-column label="操作" width="200" align="left" fixed="right">
             <template #default="scope">
-                <el-button-group>
-                    <el-button size="small" @click="table_view(scope.row)">编辑</el-button>
-                    <el-button type="danger" size="small" @click="table_del(scope.row)">删除</el-button>
-                </el-button-group>
+                <el-button type="primary" size="small" @click="table_cate(scope.row)">品类</el-button>
+                <el-button size="small" @click="table_view(scope.row)">编辑</el-button>
+                <el-button type="danger" size="small" @click="table_del(scope.row)">删除</el-button>
             </template>
         </el-table-column>
     </scTable>
     <formMain ref="formMain" @success="handleSuccess"></formMain>
     <comboMain ref="comboMain" @success="handleSuccess"></comboMain>
+    <categoryMain ref="categoryMain" @success="handleSuccess"></categoryMain>
 </template>
 
 <script>
 import formMain from './form';
 import comboMain from './combo';
+import categoryMain from './category';
 export default {
     components: {
-        formMain,comboMain
+        formMain,comboMain,categoryMain
     },
     data(){
         return {
@@ -79,6 +72,11 @@ export default {
     },
     
     methods: {
+        table_cate(data){
+            this.$nextTick(() => {
+                this.$refs.categoryMain.open("add").setData(data)
+            })
+        },
         table_auth(data){
             this.$nextTick(() => {
                 this.$refs.comboMain.open("edit").setData(data)