Jelajahi Sumber

添加商品分类列表

zhh 6 tahun lalu
induk
melakukan
8a9004844d

+ 8 - 0
src/api/productCate.js

@@ -0,0 +1,8 @@
+import request from '@/utils/request'
+export function fetchList(parentId,params) {
+  return request({
+    url:'/productCategory/list/'+parentId,
+    method:'get',
+    params:params
+  })
+}

+ 1 - 1
src/router/index.js

@@ -65,7 +65,7 @@ export const constantRouterMap = [
       {
         path: 'productCate',
         name: 'productCate',
-        component: () => import('@/views/pms/product/index'),
+        component: () => import('@/views/pms/productCate/index'),
         meta: {title: '商品分类', icon: 'product-cate'}
       },
       {

+ 3 - 3
src/views/pms/brand/index.vue

@@ -41,7 +41,7 @@
                 v-loading="listLoading"
                 border>
         <el-table-column type="selection" width="60" align="center"></el-table-column>
-        <el-table-column label="编号" width="80" align="center">
+        <el-table-column label="编号" width="100" align="center">
           <template slot-scope="scope">{{scope.row.id}}</template>
         </el-table-column>
         <el-table-column label="品牌名称" align="center">
@@ -50,7 +50,7 @@
         <el-table-column label="品牌首字母" width="100" align="center">
           <template slot-scope="scope">{{scope.row.firstLetter}}</template>
         </el-table-column>
-        <el-table-column label="排序" width="80" align="center">
+        <el-table-column label="排序" width="100" align="center">
           <template slot-scope="scope">{{scope.row.sort}}</template>
         </el-table-column>
         <el-table-column label="品牌制造商" width="100" align="center">
@@ -89,7 +89,7 @@
             </el-button>
           </template>
         </el-table-column>
-        <el-table-column label="操作" width="220" align="center">
+        <el-table-column label="操作" width="200" align="center">
           <template slot-scope="scope">
             <el-button
               size="mini"

+ 2 - 2
src/views/pms/productAttr/productAttrList.vue

@@ -19,7 +19,7 @@
                 v-loading="listLoading"
                 border>
         <el-table-column type="selection" width="60" align="center"></el-table-column>
-        <el-table-column label="编号" width="80" align="center">
+        <el-table-column label="编号" width="100" align="center">
           <template slot-scope="scope">{{scope.row.id}}</template>
         </el-table-column>
         <el-table-column label="属性名称" width="140" align="center">
@@ -37,7 +37,7 @@
         <el-table-column label="可选值列表" align="center">
           <template slot-scope="scope">{{scope.row.inputList}}</template>
         </el-table-column>
-        <el-table-column label="排序" width="120" align="center">
+        <el-table-column label="排序" width="100" align="center">
           <template slot-scope="scope">{{scope.row.sort}}</template>
         </el-table-column>
         <el-table-column label="操作" width="200" align="center">

+ 172 - 0
src/views/pms/productCate/index.vue

@@ -0,0 +1,172 @@
+<template>
+  <div class="app-container">
+    <div class="operate-container container-frame">
+      <i class="el-icon-tickets" style="margin-top: 5px"></i>
+      <span style="margin-top: 5px">数据列表</span>
+      <el-button
+        class="btn-add"
+        @click="handleAddProductCate()"
+        size="mini">
+        添加
+      </el-button>
+    </div>
+    <div class="table-container">
+      <el-table ref="productCateTable"
+                style="width: 100%"
+                :data="list"
+                v-loading="listLoading" border>
+        <el-table-column label="编号" width="100" align="center">
+          <template slot-scope="scope">{{scope.row.id}}</template>
+        </el-table-column>
+        <el-table-column label="分类名称" align="center">
+          <template slot-scope="scope">{{scope.row.name}}</template>
+        </el-table-column>
+        <el-table-column label="级别" width="100" align="center">
+          <template slot-scope="scope">{{scope.row.level | levelFilter}}</template>
+        </el-table-column>
+        <el-table-column label="商品数量" width="100" align="center">
+          <template slot-scope="scope">{{scope.row.productCount }}</template>
+        </el-table-column>
+        <el-table-column label="数量单位" width="100" align="center">
+          <template slot-scope="scope">{{scope.row.productUnit }}</template>
+        </el-table-column>
+        <el-table-column label="导航栏" width="100" align="center">
+          <template slot-scope="scope">
+            <el-switch
+              @change="handleNavStatusChange(scope.$index, scope.row)"
+              :active-value="1"
+              :inactive-value="0"
+              v-model="scope.row.navStatus">
+            </el-switch>
+          </template>
+        </el-table-column>
+        <el-table-column label="是否显示" width="100" align="center">
+          <template slot-scope="scope">
+            <el-switch
+              @change="handleShowStatusChange(scope.$index, scope.row)"
+              :active-value="1"
+              :inactive-value="0"
+              v-model="scope.row.showStatus">
+            </el-switch>
+          </template>
+        </el-table-column>
+        <el-table-column label="排序" width="100" align="center">
+          <template slot-scope="scope">{{scope.row.sort }}</template>
+        </el-table-column>
+        <el-table-column label="设置" width="200" align="center">
+          <template slot-scope="scope">
+            <el-button
+              size="mini"
+              @click="handleShowNextLevel(scope.$index, scope.row)">查看下级
+            </el-button>
+            <el-button
+              size="mini"
+              @click="handleTransferProduct(scope.$index, scope.row)">转移商品
+            </el-button>
+          </template>
+        </el-table-column>
+        <el-table-column label="操作" width="200" align="center">
+          <template slot-scope="scope">
+            <el-button
+              size="mini"
+              @click="handleUpdate(scope.$index, scope.row)">编辑
+            </el-button>
+            <el-button
+              size="mini"
+              type="danger"
+              @click="handleDelete(scope.$index, scope.row)">删除
+            </el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+    </div>
+    <div class="pagination-container">
+      <el-pagination
+        background
+        @size-change="handleSizeChange"
+        @current-change="handleCurrentChange"
+        layout="total, sizes,prev, pager, next,jumper"
+        :page-size="listQuery.pageSize"
+        :page-sizes="[5,10,15]"
+        :current-page.sync="listQuery.pageNum"
+        :total="total">
+      </el-pagination>
+    </div>
+  </div>
+</template>
+
+<script>
+  import {fetchList} from '@/api/productCate'
+
+  export default {
+    name: "productCateList",
+    data() {
+      return {
+        list: null,
+        total: null,
+        listLoading: true,
+        listQuery: {
+          pageNum: 1,
+          pageSize: 5
+        },
+        parentId: 0
+      }
+    },
+    created() {
+      this.getList();
+    },
+    methods: {
+      handleAddProductCate() {
+        console.log('handleAddProductCate');
+      },
+      getList() {
+        this.listLoading = true;
+        fetchList(this.parentId, this.listQuery).then(response => {
+          this.listLoading = false;
+          this.list = response.data.list;
+          this.total = response.data.total;
+        });
+      },
+      handleSizeChange(val) {
+        this.listQuery.pageNum = 1;
+        this.listQuery.pageSize = val;
+        this.getList();
+      },
+      handleCurrentChange(val) {
+        this.listQuery.pageNum = val;
+        this.getList();
+      },
+      handleNavStatusChange(index, row) {
+        console.log('handleAddProductCate');
+      },
+      handleShowStatusChange(index, row) {
+        console.log('handleAddProductCate');
+      },
+      handleShowNextLevel(index, row) {
+        console.log('handleAddProductCate');
+      },
+      handleTransferProduct(index, row) {
+        console.log('handleAddProductCate');
+      },
+      handleUpdate(index, row) {
+        console.log('handleAddProductCate');
+      },
+      handleDelete(index, row) {
+        console.log('handleAddProductCate');
+      }
+    },
+    filters: {
+      levelFilter(value) {
+        if (value === 0) {
+          return '一级';
+        } else if (value === 1) {
+          return '二级';
+        }
+      }
+    }
+  }
+</script>
+
+<style scoped>
+
+</style>