فهرست منبع

商品管理完成

sunlupeng 8 ماه پیش
والد
کامیت
3a7c45e4e6

+ 1 - 1
index.html

@@ -5,7 +5,7 @@
 		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
 		<meta name="renderer" content="webkit">
 		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
-		<title>积分商城后台管理</title>
+		<title>叶盏进销存</title>
 	</head>
 	<script src=<%= htmlWebpackPlugin.options.path %>/tinymce4.7.11/tinymce.min.js></script>
 	<body>

+ 6 - 31
src/api/certManage.js

@@ -3,7 +3,7 @@ import request from '@/utils/request'
 // 查询证书列表
 export function listDept(query) {
   return request({
-    url: '/mall-certificat/list',
+    url: '/product-category/list',
     method: 'get',
     params: query
   })
@@ -12,7 +12,7 @@ export function listDept(query) {
 // 查询证书列表(排除节点)
 export function listDeptExcludeChild(query) {
   return request({
-    url: '/mall-certificat/list/excludeChild',
+    url: '/product-category/list/excludeChild',
     method: 'get',
     params: query
   })
@@ -21,7 +21,7 @@ export function listDeptExcludeChild(query) {
 // 查询证书详细
 export function getDept(query) {
   return request({
-    url: '/mall-certificat/getInfo',
+    url: '/product-category/getInfo',
     method: 'get',
     params: query
   })
@@ -30,7 +30,7 @@ export function getDept(query) {
 // 新增证书
 export function addDept(data) {
   return request({
-    url: '/mall-certificat/add',
+    url: '/product-category/add',
     method: 'post',
     data: data
   })
@@ -39,7 +39,7 @@ export function addDept(data) {
 // 修改证书
 export function updateDept(data) {
   return request({
-    url: '/mall-certificat/edit',
+    url: '/product-category/edit',
     method: 'post',
     data: data
   })
@@ -48,36 +48,11 @@ export function updateDept(data) {
 // 删除证书
 export function delDept(query) {
   return request({
-    url: '/mall-certificat/remove',
+    url: '/product-category/remove',
     method: 'post',
     params: query
   })
 }
 
-export function list(query) {
-  return request({
-    url: '/mall-integral-obtain/certificate/sys/page',
-    method: 'get',
-    params:query
-  })
-}
-
-export function complete(query) {
-  return request({
-    url: '/mall-integral-obtain/certificate/complete',
-    method: 'post',
-    params:query
-  })
-}
-
-export function types(query) {
-  return request({
-    url: '/mall-integral-obtain/certificate/types',
-    method: 'get',
-    params:query
-  })
-}
-
-
 
 

+ 5 - 28
src/api/goodsManage.js

@@ -1,24 +1,9 @@
 import request from '@/utils/request'
 
-export function goodsExchangeRulesDetail(query) {
-  return request({
-    url: '/news/mall/getNotice',
-    method: 'get',
-    params: query
-  })
-}
-
-export function updateGoodsExchangeRules(query) {
-  return request({
-    url: '/news/update',
-    method: 'post',
-    data: query
-  })
-}
 
 export function createItem(data) {
   return request({
-    url: '/mall-sku/integral/add',
+    url: '/product/add',
     method: 'post',
     data
   })
@@ -26,7 +11,7 @@ export function createItem(data) {
 
 export function updateItem(query) {
   return request({
-    url: '/mall-sku/integral/edit',
+    url: '/product-category/edit',
     method: 'post',
     data:query
   })
@@ -34,23 +19,15 @@ export function updateItem(query) {
 
 export function goodsList(query) {
   return request({
-    url: '/mall-sku/integral/page',
-    method: 'post',
-    params:query
-  })
-}
-
-export function goodsState(query) {
-  return request({
-    url: '/mall-sku/modify/status',
+    url: '/product/page',
     method: 'post',
     params:query
   })
 }
 
-export function exchangeHistory(query) {
+export function removeItem(query) {
   return request({
-    url: '/mall-sku/skuLog',
+    url: '/product/remove',
     method: 'post',
     params:query
   })

+ 0 - 86
src/views/goodsManage/goodsExchangeRules.vue

@@ -1,86 +0,0 @@
-<template>
-    <div class="app-container calendar-list-container" style="padding-bottom: 80px;">
-        <el-form v-loading="loading" :rules="rules" ref="dataForm" :model="dataForm" status-icon label-position="left" label-width="100px" style='width: 85%; margin-left:50px;'>
-         <el-form-item  label="标题" prop="title">
-              <el-input v-model="dataForm.title"></el-input>
-            </el-form-item>
-            <el-form-item
-              style="width: 100%"
-              label="内容"
-              prop="content"
-            >
-              <tinymce v-model="dataForm.content" ref="tinymce"></tinymce>
-            </el-form-item>
-  
-        </el-form>
-        <el-button style="float: right;margin-right: 120px;" type="primary" @click="updateData">修改</el-button>
-    
-        
-    </div>
-   
-  </template>
-  
-  <style>
-    
-  </style>
-  
-  
-  <script>
-   import {goodsExchangeRulesDetail, updateGoodsExchangeRules} from "@/api/goodsManage";
-    import waves from "@/directive/waves"; // 水波纹指令
-    import Tinymce from '@/components/Tinymce'
-    export default {
-    name: 'goodsExchangeRules',
-    components: { Tinymce },
-    directives: { waves },
-    data() {
-      return {
-        dataForm: {
-          type:'goodsNotice',
-          title: '',
-          content: "",
-        },
-        loading: false,
-        rules: {
-            title: [{ required: true, message: "标题不能为空", trigger: "blur" }],
-            content: [{ required: true, message: "积分规则不能为空", trigger: "blur" }],
-        },
-      }
-    },
-    created() {
-        this.getDetail();
-    },
-    methods: {
-    
-      getDetail() {
-          this.loading = true
-          goodsExchangeRulesDetail({noticeType:'goodsNotice '}).then(response => {
-            this.dataForm.title = response.data.data.title;
-            this.dataForm.content = response.data.data.content;
-            this.dataForm.id = response.data.data.id;
-            this.loading = false;
-          }).catch(() => {})
-      },
-      updateData() {
-        this.$refs['dataForm'].validate((valid) => {
-          if (valid) {
-            this.loading = true;
-            updateGoodsExchangeRules(this.dataForm).then(() => {
-              this.loading = false;
-                this.$notify({
-                  title: '成功',
-                  message: '更新成功',
-                  type: 'success',
-                  duration: 2000
-                })
-                this.getDetail();
-              }) 
-          }
-        })
-      },
-  
-      
-    }
-  }
-  </script>
-  

+ 368 - 401
src/views/goodsManage/goodsList.vue

@@ -1,72 +1,59 @@
-<template>
+categoryOptions<template>
     <div class="app-container calendar-list-container">
 
         <!-- 查询和其他操作 -->
         <div class="filter-container">
             <el-input clearable class="filter-item" style="width: 200px;" placeholder="商品名称"
-                v-model="listQuery.name"></el-input>
-            <el-input clearable class="filter-item" style="width: 200px;" placeholder="商品编号"
-                v-model="listQuery.seq"></el-input>
+                v-model="listQuery.productName"></el-input>
+            <el-input clearable class="filter-item" style="width: 200px;" placeholder="商品简称"
+                v-model="listQuery.productShortForm"></el-input>
+
+            <treeselect class="filter-item" default-expand-all v-model="listQuery.categoryId" :options="categoryOptions"
+                :normalizer="normalizer" placeholder="商品类别" style="width: 200px" />
+            <el-select class="filter-item" style="width: 200px" v-model="listQuery.brandId" filterable placeholder="品牌">
+                <el-option v-for="item in brandOptions" :key="item.value" :label="item.label" :value="item.value">
+                </el-option>
+            </el-select>
             <el-select v-model="listQuery.status" clearable placeholder="状态" class="filter-item" style="width: 200px;">
                 <el-option :key="item.type" v-for="item in goodsStatusList" :label="item.name" :value="item.type">
                 </el-option>
             </el-select>
-            <el-select v-model="listQuery.productAttribute" clearable placeholder="商品属性" class="filter-item" style="width: 200px">
-                        <el-option :key="item.dictValue" v-for="item in productAttributeList" :label="item.dictLabel"
-                            :value="item.dictValue">
-                        </el-option>
-                    </el-select>
-            <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查找</el-button>
-            <el-button class="filter-item" type="primary" @click="handleCreate" icon="el-icon-edit">添加</el-button>
 
+            <el-button class="filter-item" type="primary" v-waves icon="el-icon-search"
+                @click="handleQuery">查找</el-button>
+                <el-button class="filter-item" icon="el-icon-refresh" @click="resetQuery">重置</el-button>
+            <el-button class="filter-item" type="primary" @click="handleAdd" icon="el-icon-plus">添加</el-button>
+            <el-button class="filter-item" :loading="downloadLoading" v-waves icon="el-icon-download" @click="handleDownload">导出</el-button>
         </div>
 
         <!-- 查询结果 -->
         <el-table size="small" :data="list" v-loading="listLoading" element-loading-text="正在查询中。。。" border fit
             highlight-current-row>
-            <el-table-column type="index" label="序号" header-align="center" align="center">
-            </el-table-column>
-
-            <el-table-column align="center" min-width="200px" label="商品名称" prop="name">
-            </el-table-column>
-
-            <el-table-column align="center" min-width="120px" label="商品编号" prop="seq">
+            <el-table-column align="center" min-width="120px" label="商品编号" prop="productCode">
             </el-table-column>
-
-            <el-table-column align="center" min-width="80px" label="商品属性" prop="productAttributeName">
-            </el-table-column>
-            <el-table-column align="center" min-width="80px" label="积分" prop="price">
-            </el-table-column>
-            <el-table-column align="center" min-width="80px" label="参考价格" prop="hisPrice">
+            <el-table-column align="center" min-width="200px" label="商品名称" prop="productName">
             </el-table-column>
-            <el-table-column align="center" min-width="80px" label="折扣比例" prop="discountRatio">
+            <el-table-column align="center" min-width="80px" label="商品简称" prop="productShortForm">
             </el-table-column>
-            <el-table-column align="center" min-width="100px" label="库存量" prop="actualStock">
+            <el-table-column align="center" min-width="80px" label="商品类别" prop="categoryName">
             </el-table-column>
-            <el-table-column align="center" min-width="100px" label="可兑换库存量" prop="stock">
+            <el-table-column align="center" min-width="80px" label="品牌" prop="brandName">
             </el-table-column>
-            <!-- <el-table-column align="center" min-width="100px" label="商品所在地" prop="location">
-            </el-table-column> -->
-            <el-table-column align="center" min-width="80px" label="商品状态">
-                <template slot-scope="props">
-                    <span v-if="props.row.status == 1">上架</span>
-                    <span v-if="props.row.status == 0">下架</span>
+            <el-table-column align="center" min-width="100px" label="主图" prop="imgUrl">
+                <template slot-scope="scope">
+                    <img class="good-img" :src="scope.row.imgUrl ? scope.row.imgUrl : require('@/assets/avatar.gif')">
                 </template>
             </el-table-column>
-            <el-table-column align="center" min-width="80px" label="兑换记录">
+            <el-table-column align="center" min-width="80px" label="状态">
                 <template slot-scope="props">
-                    <span @click="handleView(props.row)" style="color:green;cursor: pointer;">查看</span>
+                    <span v-if="props.row.status == 0" style="color: #67C23A;font-weight: bold;">启用</span>
+                    <span v-if="props.row.status == 1" style="color: #E6A23C;font-weight: bold;">停用</span>
                 </template>
             </el-table-column>
-            <!-- fixed="right" -->
             <el-table-column align="center" label="操作" width="240px" class-name="small-padding fixed-width">
                 <template slot-scope="scope">
                     <el-button type="primary" size="small" @click="handleUpdate(scope.row)">编辑</el-button>
-                    <el-button v-if="scope.row.status == 0" type="success" size="small"
-                        @click="changeGoodsState(scope.row.skuId, 1)">上架</el-button>
-                    <el-button v-if="scope.row.status == 1" type="warning" size="small"
-                        @click="changeGoodsState(scope.row.skuId, 0)">下架</el-button>
-                    <el-button type="danger" size="small" @click="handleDelete(scope.row.skuId, -1)">删除</el-button>
+                    <el-button type="danger" size="small" @click="handleDelete(scope.row.productCode)">删除</el-button>
                 </template>
             </el-table-column>
         </el-table>
@@ -78,132 +65,134 @@
                 layout="total, sizes, prev, pager, next, jumper" :total="total">
             </el-pagination>
         </div>
-
-        <!-- 员工积分记录列表 -->
-        <el-dialog :close-on-click-modal="false" title="兑换记录" :visible.sync="dialogListVisible" width="70%" style="overflow: auto;">
-            <div class="filter-container">
-                <el-select filterable v-model="itemListQuery.deptId" clearable placeholder="部门" style="top: -4px;width: 200px;">
-                    <el-option :key="item.deptId" v-for="item in depTypeList" :label="item.deptName" :value="item.deptId">
-                    </el-option>
-                </el-select>
-                <el-input clearable class="filter-item" style="width: 200px;" placeholder="员工名称"
-                    v-model="itemListQuery.userName"></el-input>
-                <el-button class="filter-item" type="primary" v-waves icon="el-icon-search"
-                    @click="itemHandleFilter">查找</el-button>
-                <el-button class="filter-item" type="primary" @click="handleDownLoad" v-waves icon="el-icon-download">导出</el-button>
-
-            </div>
-            <!-- 查询结果 -->
-            <el-table size="small" :data="itemList" v-loading="listLoading" element-loading-text="正在查询中。。。" border fit
-            highlight-current-row>
-            <el-table-column type="index" label="序号" header-align="center" align="center">
-                </el-table-column>
-                <el-table-column align="center" width="200px" label="部门" prop="deptName">
-                </el-table-column>
-                <el-table-column align="center" label="员工姓名" prop="purchaser">
-                </el-table-column>
-                <el-table-column align="center" label="兑换数量" prop="skuCount">
-                </el-table-column>
-                <el-table-column align="center" label="联系人" prop="contact">
-                </el-table-column>
-                <el-table-column align="center" width="120px" label="联系方式" prop="contactPhone">
-                </el-table-column>
-                <el-table-column align="center" width="200px" label="地址" prop="contactAddr">
-                </el-table-column>
-                <!-- <el-table-column align="center" width="200px" label="邮箱" prop="contactEmail">
-                </el-table-column> -->
-                <el-table-column align="center" width="150px" label="兑换时间" prop="createTime">
-                </el-table-column>
-        </el-table>
-            <!-- 分页 -->
-            <div class="pagination-container">
-                <el-pagination background @size-change="itemHandleSizeChange" @current-change="itemHandleCurrentChange"
-                    :current-page="itemListQuery.page" :page-sizes="[10, 20, 30, 50]" :page-size="itemListQuery.limit"
-                    layout="total, sizes, prev, pager, next, jumper" :total="itemTotal">
-                </el-pagination>
-            </div>
-        </el-dialog>
         <!-- 添加或修改对话框 -->
-        <el-dialog :close-on-click-modal="false" :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="70%">
-            <el-form :rules="rules" ref="dataForm" :model="dataForm" status-icon label-position="left" label-width="100px" style='width:700px; margin-left:50px;'>
-                <el-form-item label="商品编号" prop="seq">
-                    <el-input disabled placeholder="添加成功后自动生成" readonly v-model="dataForm.seq"></el-input>
-                </el-form-item>
-                <el-form-item label="商品简介" prop="brief">
-                    <el-input v-model="dataForm.brief"></el-input>
-                </el-form-item>
-                <el-form-item label="商品名称" prop="name">
-                    <el-input v-model="dataForm.name"></el-input>
-                </el-form-item>
+        <el-dialog :close-on-click-modal="false" :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible"
+            width="70%">
+            <el-form :rules="rules" ref="dataForm" :model="dataForm" status-icon label-position="left"
+                label-width="100px" style='margin: 0 50px;'>
+                <el-tabs v-model="activeName" @tab-click="handleClick">
+                    <el-tab-pane label="基本信息" name="first">
+                        <el-form-item label="商品名称" prop="productName">
+                            <el-input v-model="dataForm.productName" placeholder="请输入商品名称"></el-input>
+                        </el-form-item>
+                        <el-form-item label="商品编号" prop="productCode">
+                            <el-input placeholder="请输入商品编号" v-model="dataForm.productCode"></el-input>
+                        </el-form-item>
+                        <el-form-item label="商品简介" prop="productShortForm">
+                            <el-input v-model="dataForm.productShortForm" placeholder="请输入商品简介"></el-input>
+                        </el-form-item>
+
+
+                        <el-form-item label="商品类别" prop="categoryId">
+                            <treeselect default-expand-all v-model="dataForm.categoryId" :options="categoryOptions"
+                                :normalizer="normalizer" placeholder="请选择商品类别" />
+                        </el-form-item>
+
+                        <el-form-item label="品牌" prop="brandId">
+                            <el-select style="width: 100%" v-model="dataForm.brandId" filterable placeholder="品牌">
+                                <el-option v-for="item in brandOptions" :key="item.value" :label="item.label" :value="item.value">
+                                </el-option>
+                            </el-select>
+                        </el-form-item>
+                        <el-form-item label="零售价(元)" prop="price">
+                            <el-input v-model="dataForm.price" placeholder="请输入零售价"></el-input>
+                        </el-form-item>
+                        <el-form-item label="销售价(元)" prop="salePrice">
+                            <el-input v-model="dataForm.salePrice" placeholder="请输入销售价"></el-input>
+                        </el-form-item>
+                        <el-form-item label="成本价(元)" prop="costPrice">
+                            <el-input v-model="dataForm.costPrice" placeholder="请输入成本价"></el-input>
+                        </el-form-item>
+                        <el-form-item label="重量(g)" prop="weight">
+                            <el-input v-model="dataForm.weight" placeholder="请输入重量"></el-input>
+                        </el-form-item>
+                        <el-form-item label="状态" prop="freightType">
+                            <el-radio-group v-model="dataForm.freightType">
+                                <el-radio :label="'0'">启用</el-radio>
+                                <el-radio :label="'1'">停用</el-radio>
+                            </el-radio-group>
+                        </el-form-item>
+                        <el-form-item style="width: 800px" label="商品图片" prop="imgUrl">
+                            <el-upload :limit="1" :action="fileImgUrl" list-type="picture-card"
+                                :file-list="dataForm.images" :on-success="handleImgSucess" :on-exceed="handleExceed"
+                                :before-upload="beforeUploadImg" :on-remove="handleRemoveImg">
+                                <i class="el-icon-plus"></i>
+                            </el-upload>
+                        </el-form-item>
+
+                    </el-tab-pane>
+                    <el-tab-pane label="茶叶属性" name="second">
+                        <el-form-item label="茶叶品牌">
+                            <el-select v-model="dataForm.teaTypeId" filterable placeholder="请选择" style="width: 100%">
+                                <el-option :key="item.dictLabel" v-for="item in tes_type" :label="item.dictLabel"
+                                    :value="item.dictLabel">
+                                </el-option>
+                            </el-select>
+                        </el-form-item>
+                        <el-form-item label="茶叶级别">
+                            <el-select v-model="dataForm.teaLevel" filterable placeholder="请选择" style="width: 100%">
+                                <el-option :key="item.dictLabel" v-for="item in tes_level" :label="item.dictLabel"
+                                    :value="item.dictLabel">
+                                </el-option>
+                            </el-select>
+                        </el-form-item>
+                        <el-form-item label="茶叶系列">
+                            <el-select v-model="dataForm.teaSeries" filterable placeholder="请选择" style="width: 100%">
+                                <el-option :key="item.dictLabel" v-for="item in tes_series" :label="item.dictLabel"
+                                    :value="item.dictLabel">
+                                </el-option>
+                            </el-select>
+                        </el-form-item>
+                        <el-form-item label="包装形式">
+                            <el-select v-model="dataForm.teaPackageFormat" filterable placeholder="请选择"
+                                style="width: 100%">
+                                <el-option :key="item.dictLabel" v-for="item in tes_package_format" :label="item.dictLabel"
+                                    :value="item.dictLabel">
+                                </el-option>
+                            </el-select>
+                        </el-form-item>
+                        <el-form-item label="产地">
+                            <el-input v-model="dataForm.teaOrigin" placeholder="请输入产地"></el-input>
+                        </el-form-item>
+                        <el-form-item label="采摘季节">
+                            <el-radio-group v-model="dataForm.teaGetSeason">
+                                <el-radio v-for="item in tes_get_season" :key="item.dictLabel" :label="item.dictLabel"></el-radio>
+                            </el-radio-group>
+                        </el-form-item>
+                        <el-form-item label="保质期">
+                            <el-input placeholder="数值" v-model="dataForm.teaSellbyDate" class="input-with-select">
+                                <el-select style="width: 80px;" v-model="dataForm.selectType" slot="prepend"
+                                    placeholder="请选择">
+                                    <el-option label="年" value="1"></el-option>
+                                    <el-option label="月" value="2"></el-option>
+                                    <el-option label="日" value="3"></el-option>
+                                </el-select>
+                            </el-input>
+                        </el-form-item>
+                        <el-form-item label="生产日期">
+                            <el-date-picker style="width: 100%;" v-model="dataForm.date" type="date"
+                                placeholder="选择日期"></el-date-picker>
+                        </el-form-item>
+                        <el-form-item label="陈华年份">
+                            <el-input v-model="dataForm.teaAgingYear" placeholder="输入陈华年份"></el-input>
+                        </el-form-item>
+                        <el-form-item label="溯源信息" prop="teaFileUrl">
+                            <el-upload :limit="1" :action="fileImgUrl" :file-list="dataForm.files" :on-success="handleFileSuccess"
+                                :before-upload="beforeUploadFile" :on-remove="handleRemoveFile">
+                                <el-button size="small" type="primary">点击上传</el-button>
+                            </el-upload>
+                        </el-form-item>
+                        <el-form-item label="存储要求">
+                            <el-checkbox-group v-model="dataForm.teaStorageRequire">
+                                <el-checkbox label="避光" name="type"></el-checkbox>
+                                <el-checkbox label="防潮" name="type"></el-checkbox>
+                                <el-checkbox label="通风" name="type"></el-checkbox>
+                                <el-checkbox label="冷藏" name="type"></el-checkbox>
+                            </el-checkbox-group>
+                        </el-form-item>
+                    </el-tab-pane>
+                </el-tabs>
 
-                
-
-                <el-form-item label="商品属性" prop="productAttribute">
-                    <el-select v-model="dataForm.productAttribute" filterable placeholder="请选择" style="width: 350px"
-                        value-key="value" @change="changeProductAttribute">
-                        <el-option :key="item.dictValue" v-for="item in productAttributeList" :label="item.dictLabel"
-                            :value="item.dictValue">
-                        </el-option>
-                    </el-select>
-                </el-form-item>
-                <el-form-item label="兑换方式" prop="deliveryTypes">
-                    <el-select v-model="dataForm.deliveryTypes" multiple filterable placeholder="请选择" style="width: 350px">
-                        <el-option :key="item.dictValue" v-for="item in deliveryTypeList" :label="item.dictLabel" :value="item.dictValue">
-                        </el-option>
-                    </el-select>
-                </el-form-item>
-                <el-form-item v-if="dataForm.deliveryTypes.includes('1')" label="快递方式">
-                    <el-radio-group v-model="dataForm.freightType">
-                        <el-radio :label="'0'">不包邮</el-radio>
-                        <el-radio :label="'1'">包邮</el-radio>
-                    </el-radio-group>
-                </el-form-item>
-                <!-- <el-form-item v-if="dataForm.deliveryTypes==0" label="商品所在地" prop="location">
-                    <el-select v-model="dataForm.location" filterable placeholder="请选择" style="width: 350px">
-                        <el-option :key="item.dictLabel" v-for="item in locationList" :label="item.dictLabel" :value="item.dictLabel">
-                        </el-option>
-                    </el-select>
-                </el-form-item> -->
-                <el-form-item style="width: 800px" label="商品图片" prop="imgUrl">
-                    <el-upload :limit="1" :action="fileImgUrl" list-type="picture-card" :file-list="dataForm.images"
-                            :on-success="handleGallerySucess" :on-exceed="handleExceed" :before-upload="uploadBannerImg"
-                            :on-remove="handleRemove">
-                            <i class="el-icon-plus"></i>
-                        </el-upload>
-                </el-form-item>
-                <el-form-item label="积分" prop="price">
-                    <el-input v-model="dataForm.price"></el-input>
-                </el-form-item>
-                <el-form-item label="参考价格" prop="hisPrice">
-                    <el-input v-model="dataForm.hisPrice"></el-input>
-                </el-form-item>
-                <el-form-item label="折扣比例" prop="discountRatio">
-                    <el-input-number v-model="dataForm.discountRatio" :precision="2" :step="0.01" :min="0" :max="1"></el-input-number>
-                </el-form-item>
-                <el-form-item label="库存量" prop="actualStock">
-                    <el-input-number :precision="0" :step="1" v-model="dataForm.actualStock"></el-input-number>
-                </el-form-item>
-                <el-form-item
-                    style="width: 800px"
-                    label="兑换说明"
-                    prop="comment"
-                    >
-                <tinymce v-model="dataForm.comment" ref="tinymce"></tinymce>
-                </el-form-item>
-                <el-form-item style="width: 800px" label="商品副图">
-                    <el-upload :action="fileImgUrl" list-type="picture-card" :file-list="dataForm.imgUrls"
-                            :on-success="handleAvatarSuccess"
-                            :on-remove="handleRemoveImgs">
-                            <i class="el-icon-plus"></i>
-                        </el-upload>
-                </el-form-item>
-                <el-form-item
-                    style="width: 800px"
-                    label="物品介绍"
-                    prop="skuDesc"
-                    >
-                <skuDesc v-model="dataForm.skuDesc" ref="skuDesc"></skuDesc>
-                </el-form-item>
             </el-form>
             <div slot="footer" class="dialog-footer">
                 <el-button @click="dialogFormVisible = false">取消</el-button>
@@ -214,90 +203,82 @@
 
     </div>
 </template>
-  
-<style>
-.demo-table-expand {
-    font-size: 0;
-}
-
-.demo-table-expand label {
-    width: 200px;
-    color: #99a9bf;
-}
-
-.demo-table-expand .el-form-item {
-    margin-right: 0;
-    margin-bottom: 0;
-}
-</style>
-  
 <script>
-import { createItem, updateItem, goodsList, goodsState, exchangeHistory } from "@/api/goodsManage";
-import { depTypeList,dataTypeList } from "@/api/public";
+import { createItem, updateItem, goodsList, removeItem } from "@/api/goodsManage";
+import { listDept } from "@/api/certManage";
+import { listBrand } from '@/api/brand';
+import Treeselect from "@riophae/vue-treeselect";
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import { dataTypeList } from "@/api/public";
 import waves from "@/directive/waves"; // 水波纹指令
-import Tinymce from '@/components/Tinymce';
-import SkuDesc from '@/components/SkuDesc'
 
 export default {
     name: 'goodsList',
-    components: { Tinymce,SkuDesc },
+    components: { Treeselect },
     directives: { waves },
     data() {
         return {
-            locationList:[],
-            productAttributeList: [],
-            deliveryTypeList: [],
+            downloadLoading: false,
+            tes_type:[],
+            tes_level:[],
+            tes_series:[],
+            tes_package_format:[],
+            tes_get_season:[],
+            // 树选项
+            categoryOptions: [],
+            activeName: 'first',
+            brandOptions: [],
             goodsStatusList: [
                 {
-                    type: 1,
-                    name: '上架'
+                    type: 0,
+                    name: '启用'
                 },
                 {
-                    type: 0,
-                    name: '下架'
+                    type: 1,
+                    name: '停用'
                 },
             ],
-            depTypeList: [],
             list: [],
-            itemList: [],
             total: 0,
-            itemTotal: 0,
             listLoading: false,
-            downloadLoading: false,
             listQuery: {
-                skuType:0,
                 page: 1,
                 limit: 10,
-                name: '',
-                seq: '',
+                productName: '',
+                productShortForm: '',
+                categoryId: '',
+                brandId: '',
                 status: '',
-                productAttribute:'',
             },
-            itemListQuery: {
-                skuType:0,
-                page: 1,
-                limit: 10,
-                skuId:'',
-                deptId: '',
-                userName: '',
+            listBrandQuery: {
+                limit: 1000,
+                sort: '+id'
             },
             dataForm: {
-                skuType:0,
-                brief: undefined,
-                name: undefined,
-                seq: undefined,
-                productAttribute: undefined,
-                imgUrl: undefined,
+                productName: undefined,
+                productCode: undefined,
+                productShortForm: undefined,
+                categoryId: undefined,
+                brandId: undefined,
                 price: undefined,
-                hisPrice:undefined,
-                discountRatio:1,
-                actualStock: undefined,
-                deliveryTypes: [],
-                freightType:'0',
-                // location: undefined,
-                images: [],
-                imgIds: '',
-                imgUrls:[],
+                salePrice: undefined,
+                costPrice: undefined,
+                weight: undefined,
+                freightType: '0',
+                imgUrl: undefined,
+                teaTypeId: undefined,
+                teaLevel: undefined,
+                teaSeries: undefined,
+                teaPackageFormat: undefined,
+                teaOrigin: undefined,
+                teaGetSeason: undefined,
+                teaSellbyDate: undefined,
+                selectType: undefined,
+                date: undefined,
+                teaAgingYear: undefined,
+                teaFileUrl: undefined,
+                files: [],
+                teaStorageRequire: undefined,
             },
             dialogFormVisible: false,
             dialogStatus: '',
@@ -306,60 +287,94 @@ export default {
                 create: "创建",
             },
             rules: {
-                brief: [{ required: true, message: "请填写商品简介", trigger: "blur" }],
-                name: [{ required: true, message: "请填写商品名称", trigger: "blur" }],
-                imgUrl: [{ required: true, message: "请上传商品图片", trigger: "blur" }],
-                imgIds: [{ required: true, message: "请上传商品副图", trigger: "blur" }],
-                productAttribute: [{ required: true, message: "请选择商品属性", trigger: "blur" }],
-                price: [{ required: true, message: "请填写商品积分", trigger: "blur" }],
-                hisPrice: [{ required: true, message: "请填写商品参考价格", trigger: "blur" }],
-                actualStock: [{ required: true, message: "请设置库存量", trigger: "blur" }],
-                deliveryTypes: [{ required: true, message: "请选择兑换方式", trigger: "blur" }],
-                // location: [{ required: true, message: "请选择商品所在地", trigger: "blur" }],
-                comment: [{ required: true, message: "说明不能为空", trigger: "blur" }],
-                skuDesc: [{ required: true, message: "商品介绍不能为空", trigger: "blur" }],
+                productName: [{ required: true, message: "请填写商品名称", trigger: "blur" }],
+                productCode: [{ required: true, message: "请填写商品编号", trigger: "blur" }],
+                categoryId: [{ required: true, message: "请选择商品类别", trigger: "blur" }],
+                price: [{ required: true, message: "请填写零售价", trigger: "blur" }],
+                salePrice: [{ required: true, message: "请填写销售价", trigger: "blur" }],
+                costPrice: [{ required: true, message: "请填写成本价", trigger: "blur" }],
+                weight: [{ required: true, message: "请填写重量", trigger: "blur" }],
+                freightType: [{ required: true, message: "请选择状态", trigger: "blur" }],
             },
             dialogListVisible: false,
             fileImgUrl: this.upLoadUrl,
         }
     },
     created() {
-        this.getProductAttributeList();
-        this.getDataTypeList(); 
-        this.getDepTypeList(); 
+        this.getListCategory();
+        this.getBrandList();
+        this.getDictType();
         this.getList();
     },
     methods: {
-        getDeliveryTypeList(val){
-            dataTypeList({dictType:val}).then(response => {
-                this.deliveryTypeList = response.data.data;
+        handleDownLoad(){
+            window.location.href = process.env.BASE_API + '/product/export/category?productName=' + this.listQuery.productName + '&productShortForm=' + this.listQuery.productShortForm;
+        },
+        getListCategory() {
+            listDept().then(response => {
+                this.categoryOptions = this.handleTree(response.data.data, "id");
             });
         },
-        handleDownLoad(){
-            window.location.href = process.env.BASE_API + '/mall-sku/exportSkuLog?skuId=' + this.itemListQuery.skuId + '&deptId=' + this.itemListQuery.deptId + '&userName=' + this.itemListQuery.userName;
+        /** 转换证书数据结构 */
+        normalizer(node) {
+            if (node.children && !node.children.length) {
+                delete node.children;
+            }
+            return {
+                id: node.id,
+                label: node.typeName,
+                children: node.children
+            };
+        },
+        handleClick(tab, event) {
+            console.log(tab, event);
         },
-        changeProductAttribute(val) {
-            debugger
-            this.dataForm.deliveryTypes = [];
-            // this.dataForm.location = undefined;
-            this.getDeliveryTypeList(val);
+        getDictType(){
+            //茶叶品牌tes_type
+            dataTypeList({ dictType: 'tes_type' }).then(response => {
+                this.tes_type = response.data.data;
+            });
+            //茶叶级别tes_level
+            dataTypeList({ dictType: 'tes_level' }).then(response => {
+                this.tes_level = response.data.data;
+            });
+            //茶叶系列tes_series
+            dataTypeList({ dictType: 'tes_series' }).then(response => {
+                this.tes_series = response.data.data;
+            });
+            //包装形式tes_package_format
+            dataTypeList({ dictType: 'tes_package_format' }).then(response => {
+                this.tes_package_format = response.data.data;
+            });
+            //采摘季节tes_get_season
+            dataTypeList({ dictType: 'tes_get_season' }).then(response => {
+                this.tes_get_season = response.data.data;
+            });
         },
-        handleRemove(file, fileList) {
+        handleRemoveFile(file, fileList) {
             console.log(file, fileList);
-            let images = [];
+            let teaFileUrl = [];
             for (let i in fileList) {
-                let response = fileList[i].response;
-                let url = response.data.url;
-                images.push(url);
-                this.dataForm.imgUrl = images.join(",");
+                let id = fileList[i].response.data.id;
+                teaFileUrl.push(id);
             }
+            this.dataForm.teaFileUrl = teaFileUrl.join(",");
         },
-        handleAvatarSuccess(res, file, fileList) {
+        beforeUploadFile(file) {
+            console.log(file);
+            const size = file.size / 1024 / 1024;
+            console.log(size);
+            if (size > 10) {
+                this.$message.error("文件大小不能超过10MB!");
+                return false;
+            }
+        },
+        handleFileSuccess(res, file, fileList) {
             console.log(file, fileList);
             console.log("------", "==========");
             console.log("res = ", res);
 
-            let fileIds = [];
+            let teaFileUrl = [];
             for (let i in fileList) {
                 let response = fileList[i].response;
                 if (response.errno && response.errno != "0") {
@@ -368,21 +383,22 @@ export default {
                 fileList.splice(i, 1);
                 } else {
                 let id = fileList[i].response.data.id;
-                fileIds.push(id);
+                teaFileUrl.push(id);
                 }
             }
-            this.dataForm.imgIds = fileIds.join(",");
+            this.dataForm.teaFileUrl = teaFileUrl.join(",");
         },
-        handleRemoveImgs(file, fileList) {
+        handleRemoveImg(file, fileList) {
             console.log(file, fileList);
-            let fileIds = [];
+            let images = [];
             for (let i in fileList) {
-                let id = fileList[i].response.data.id;
-                fileIds.push(id);
+                let response = fileList[i].response;
+                let url = response.data.url;
+                images.push(url);
+                this.dataForm.imgUrl = images.join(",");
             }
-            this.dataForm.imgIds = fileIds.join(",");
         },
-        uploadBannerImg(file) {
+        beforeUploadImg(file) {
             const isJPGs = file.type === "image/jpeg";
             console.log(isJPGs);
         },
@@ -392,7 +408,7 @@ export default {
                 } 个文件`
             );
         },
-        handleGallerySucess(res, file, fileList) {
+        handleImgSucess(res, file, fileList) {
             this.dataForm.imgUrl = ""; // 清空画廊图片数组
 
             let images = [];
@@ -412,66 +428,65 @@ export default {
         },
         resetForm() {
             this.dataForm = {
-                skuType:0,
-                comment: undefined,
-                skuDesc: undefined,
-                brief: undefined,
-                name: undefined,
-                seq: undefined,
-                productAttribute: undefined,
-                imgUrl: undefined,
+                productName: undefined,
+                productCode: undefined,
+                productShortForm: undefined,
+                categoryId: undefined,
+                brandId: undefined,
                 price: undefined,
-                hisPrice:undefined,
-                discountRatio:1,
-                actualStock: undefined,
-                deliveryTypes: [],
-                freightType:'0',
-                // location: undefined,
+                salePrice: undefined,
+                costPrice: undefined,
+                weight: undefined,
+                freightType: '0',
+                imgUrl: undefined,
                 images: [],
-                imgIds: '',
-                imgUrls:[],
+                teaTypeId: undefined,
+                teaLevel: undefined,
+                teaSeries: undefined,
+                teaPackageFormat: undefined,
+                teaOrigin: undefined,
+                teaGetSeason: undefined,
+                teaSellbyDate: undefined,
+                selectType: undefined,
+                date: undefined,
+                teaAgingYear: undefined,
+                teaFileUrl: undefined,
+                files: [],
+                teaStorageRequire: undefined,
             };
         },
-        handleCreate() {
+        handleAdd() {
             this.resetForm();
 
             this.dialogFormVisible = true;
             this.dialogStatus = "create";
 
             this.$nextTick(() => {
-                this.$refs.tinymce.setContent("");
-                this.$refs.skuDesc.setContent("");
                 this.$refs["dataForm"].clearValidate();
             });
         },
         createData() {
-            
             this.$refs["dataForm"].validate((valid) => {
                 if (valid) {
                     console.log(this.dataForm);
                     createItem(this.dataForm)
-                            .then((response) => {
-                                this.getList();
-                                this.dialogFormVisible = false;
-                                this.$notify({
-                                    title: "成功",
-                                    message: "创建成功",
-                                    type: "success",
-                                    duration: 2000,
-                                });
-                                this.reload();
-                            })
-                            .catch(() => { });
+                        .then((response) => {
+                            this.getList();
+                            this.dialogFormVisible = false;
+                            this.$notify({
+                                title: "成功",
+                                message: "创建成功",
+                                type: "success",
+                                duration: 2000,
+                            });
+                            this.reload();
+                        })
+                        .catch(() => { });
                 }
             });
         },
         handleUpdate(row) {
             this.dataForm = Object.assign({}, row);
-            this.dataForm.productAttribute = row.productAttribute.toString();
-            let comment = this.dataForm.comment;
-            let skuDesc = this.dataForm.skuDesc?this.dataForm.skuDesc:'';
-            let val = row.productAttribute;
-            this.getDeliveryTypeList(val);
             if (this.dataForm.imgUrl) {
                 let images = this.dataForm.imgUrl.split(",");
                 this.dataForm.images = [];
@@ -486,25 +501,24 @@ export default {
                     });
                 }
             }
-            if (this.dataForm.imgs) {
-                let imgs = this.dataForm.imgs;
-                this.dataForm.imgUrls = [];
-                for (let i in imgs) {
-                    let url = imgs[i].url;
-                    let name = "image_" + i;
-
-                    this.dataForm.imgUrls.push({
+            if (this.dataForm.teaFileUrl) {
+                let files = this.dataForm.teaFileUrl;
+                this.dataForm.files = [];
+                for (let i in files) {
+                    let url = files[i].url;
+                    let name = files[i].oldName;
+                    let id = files[i].id;
+
+                    this.dataForm.files.push({
                         name: name,
                         url: url,
-                        response: { error: "0", data: imgs[i] },
+                        response: { error: "0", data: { url: url,id:id } },
                     });
                 }
             }
             this.dialogStatus = 'update'
             this.dialogFormVisible = true
             this.$nextTick(() => {
-                this.$refs.tinymce.setContent(comment);
-                this.$refs.skuDesc.setContent(skuDesc);
                 this.$refs['dataForm'].clearValidate()
             })
         },
@@ -512,38 +526,27 @@ export default {
             this.$refs['dataForm'].validate((valid) => {
                 if (valid) {
                     updateItem(this.dataForm).then(() => {
-                            this.dialogFormVisible = false
-                            this.$notify({
-                                title: '成功',
-                                message: '更新成功',
-                                type: 'success',
-                                duration: 2000
-                            })
-                            this.getList()
+                        this.dialogFormVisible = false
+                        this.$notify({
+                            title: '成功',
+                            message: '更新成功',
+                            type: 'success',
+                            duration: 2000
                         })
+                        this.getList()
+                    })
 
                 }
 
             })
         },
-        changeGoodsState(id, index) {
-            goodsState({ skuType:0,skuId: id, status: index }).then(response => {
-                this.$notify({
-                    title: '成功',
-                    message: '商品状态修改成功',
-                    type: 'success',
-                    duration: 2000
-                })
-                this.getList()
-            })
-        },
-        handleDelete(id, index) {
+        handleDelete(productCode) {
             this.$confirm('确认删除吗?', '提示', {
                 confirmButtonText: '确定',
                 cancelButtonText: '取消',
                 type: 'warning'
             }).then(() => {
-                goodsState({skuType:0, skuId: id, status: index }).then(response => {
+                removeItem({ productCode: productCode }).then(response => {
                     this.$notify({
                         title: '成功',
                         message: '删除成功',
@@ -557,20 +560,15 @@ export default {
             })
 
         },
-        getDataTypeList() {
-            dataTypeList({dictType:'mall_sku_location'}).then(response => {
-                this.locationList = response.data.data;
-            }).catch(() => {});
-        },
-        getProductAttributeList(){
-            dataTypeList({dictType:'mall_sku_attribute'}).then(response => {
-                this.productAttributeList = response.data.data;
-            }).catch(() => {});
-        },
-        getDepTypeList() {
-            depTypeList().then(response => {
-                this.depTypeList = response.data.data;
-            }).catch(() => {});
+        getBrandList() {
+            // 获取品牌信息
+            listBrand(this.listBrandQuery).then(response => {
+                this.brandOptions = response.data.data.items.map((item) => {
+                    return { value: item.id, label: item.name }
+                });
+            }).catch(() => {
+                this.brandOptions = [];
+            })
         },
         getList() {
             this.listLoading = true
@@ -578,21 +576,26 @@ export default {
                 this.list = response.data.data.items
                 this.total = response.data.data.total
                 this.listLoading = false
-            }).catch(() => {})
-        },
-        getItemList() {
-            this.listLoading = true
-            exchangeHistory(this.itemListQuery).then(response => {
-                this.itemList = response.data.data.items
-                this.itemLotal = response.data.data.total
-                this.listLoading = false
-            }).catch(() => {})
+            }).catch(() => { })
         },
 
-        handleFilter() {
+        handleQuery() {
             this.listQuery.page = 1
             this.getList()
         },
+        /** 重置按钮操作 */
+        resetQuery() {
+            this.listQuery = {
+                page: 1,
+                limit: 10,
+                productName: '',
+                productShortForm: '',
+                categoryId: '',
+                brandId: '',
+                status: '',
+            };
+            this.handleQuery();
+        },
         handleSizeChange(val) {
             this.listQuery.limit = val
             this.getList()
@@ -601,52 +604,16 @@ export default {
             this.listQuery.page = val
             this.getList()
         },
-
-        itemHandleFilter() {
-            this.itemListQuery.page = 1
-            this.getItemList()
-        },
-        itemHandleSizeChange(val) {
-            this.itemListQuery.limit = val
-            this.getItemList()
-        },
-        itemHandleCurrentChange(val) {
-            this.itemListQuery.page = val
-            this.getItemList()
-        },
-
-        handleView(row) {
-            this.itemListQuery.skuId = row.skuId;
-            this.getItemList();
-            this.dialogListVisible = true
-        },
     }
 }
 </script>
 <style>
-.ad-avatar-uploader .el-upload {
-    border: 1px dashed #d9d9d9;
-    border-radius: 6px;
-    cursor: pointer;
-    position: relative;
-    overflow: hidden;
-}
-
-.ad-avatar-uploader .el-upload:hover {
-    border-color: #409EFF;
-}
-
-.ad-avatar-uploader-icon {
-    font-size: 28px;
-    color: #8c939d;
-    width: 178px;
-    height: 178px;
-    line-height: 178px;
-    text-align: center;
+.good-img {
+    width: 50px;
+    height: 50px;
 }
 
-.ad-avatar {
-    display: block;
+.input-with-select .el-input-group__prepend {
+    background-color: #fff;
 }
-</style>
-  
+</style>

+ 67 - 83
src/views/goodsManage/goodsTypeList.vue

@@ -1,31 +1,28 @@
 <template>
     <div class="app-container">
-      <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
-        <el-form-item label="类别编号" prop="typeNumber">
-          <el-input
-            v-model="queryParams.typeName"
+       <!-- 查询和其他操作 -->
+       <div class="filter-container">
+        <el-input
+        class="filter-item" style="width: 200px;"
+            v-model="listQuery.categoryCode"
             placeholder="请输入类别编号"
             clearable
             @keyup.enter.native="handleQuery"
           />
-        </el-form-item>
-        <el-form-item label="类别名称" prop="typeName">
           <el-input
-            v-model="queryParams.typeName"
+          class="filter-item" style="width: 200px;"
+            v-model="listQuery.categoryName"
             placeholder="请输入类别名称"
             clearable
             @keyup.enter.native="handleQuery"
-          />
-        </el-form-item>
-        <el-form-item>
+          />   
           <el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleQuery">查找</el-button>
           <el-button class="filter-item" icon="el-icon-refresh" @click="resetQuery">重置</el-button>
           <el-button class="filter-item" type="primary" icon="el-icon-plus" @click="handleAdd">添加</el-button>
           <el-button class="filter-item" :loading="downloadLoading" v-waves icon="el-icon-download" @click="handleDownload">导出</el-button>
           <el-button class="filter-item" type="info" icon="el-icon-sort" @click="toggleExpandAll">展开/折叠</el-button>
-        </el-form-item>
-      </el-form>
-      <!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> -->
+
+        </div>
       <el-table
         v-if="refreshTable"
         v-loading="loading"
@@ -35,26 +32,26 @@
         :default-expand-all="isExpandAll"
         :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
       >
-        <el-table-column prop="orderNum" label="类型编号" align="center"></el-table-column>
-        <el-table-column prop="typeName" label="类型名称" min-width="180px"></el-table-column>
-        <el-table-column prop="integral" label="备注" align="center"></el-table-column>
-        <el-table-column label="创建时间" align="center" prop="createTime">
+        <el-table-column prop="categoryCode" label="类型编号" align="center"></el-table-column>
+        <el-table-column prop="categoryName" label="类型名称" min-width="180px"></el-table-column>
+        <!-- <el-table-column prop="categoryParentId" label="备注" align="center"></el-table-column> -->
+        <el-table-column label="创建时间" align="center" prop="createDate">
         </el-table-column>
         <el-table-column label="操作" align="center" min-width="110px">
           <template slot-scope="scope">
             <el-button
-              size="mini"
+              size="small"
               type="primary"
               @click="handleUpdate(scope.row)"
             >修改</el-button>
             <el-button
-              size="mini"
+              size="small"
               type="success"
               @click="handleAdd(scope.row)"
             >添加</el-button>
             <el-button
-              v-if="scope.row.parentId != 0"
-              size="mini"
+              v-if="scope.row.categoryParentId != 0"
+              size="small"
               type="danger"
               @click="handleDelete(scope.row)"
             >删除</el-button>
@@ -62,34 +59,34 @@
         </el-table-column>
       </el-table>
   
-      <!-- 添加或修改证书对话框 -->
+      <!-- 添加或修改类别对话框 -->
       <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
         <el-form ref="form" :model="form" :rules="rules" label-width="80px">
           <el-row>
-            <el-col :span="24" v-if="form.parentId">
-              <el-form-item label="上级名称" prop="parentId">
-                <treeselect default-expand-all v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级类型" />
+            <el-col :span="24" v-if="form.categoryParentId">
+              <el-form-item label="上级名称" prop="categoryParentId">
+                <treeselect default-expand-all v-model="form.categoryParentId" @select="departTreeSelected" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级类型" />
               </el-form-item>
             </el-col>
           </el-row>
-          <!-- <el-row>
-            <el-col :span="24" v-if="form.parentId">
-              <el-form-item label="上级编号" prop="integral">
-                <el-input v-model="form.integral" readonly />
+          <el-row>
+            <el-col :span="24" v-if="form.categoryParentId">
+              <el-form-item label="上级编号" prop="categoryParentId">
+                <el-input v-model="form.categoryParentId" readonly />
               </el-form-item>
             </el-col>
-          </el-row> -->
+          </el-row>
           <el-row>
             <el-col :span="24">
-              <el-form-item label="类别名称" prop="typeName">
-                <el-input v-model="form.typeName" placeholder="请输入证书类型" />
+              <el-form-item label="类别名称" prop="categoryName">
+                <el-input v-model="form.categoryName" placeholder="请输入类别类型" />
               </el-form-item>
             </el-col>
           </el-row>
           <el-row>
             <el-col :span="24">
-              <el-form-item label="类别编号" prop="orderNum">
-                <el-input v-model="form.orderNum" placeholder="请输入类别编号" />
+              <el-form-item label="类别编号" prop="categoryCode">
+                <el-input v-model="form.categoryCode" placeholder="请输入类别编号" />
               </el-form-item>
             </el-col>
           </el-row>
@@ -115,11 +112,9 @@
         downloadLoading: false,
         // 遮罩层
         loading: true,
-        // 显示搜索条件
-        showSearch: true,
         // 表格树数据
         deptList: [],
-        // 证书树选项
+        // 类别树选项
         deptOptions: [],
         // 弹出层标题
         title: "",
@@ -130,40 +125,26 @@
         // 重新渲染表格状态
         refreshTable: true,
         // 查询参数
-        queryParams: {
-          typeNumber: undefined,
-          typeName: undefined,
+        listQuery: {
+          categoryCode: undefined,
+          categoryName: undefined,
         },
         // 表单参数
         form: {},
         // 表单校验
         rules: {
-          parentId: [
+          categoryParentId: [
             { required: true, message: "上级类型不能为空", trigger: "blur" }
           ],
-          typeName: [
-            { required: true, message: "证书类型不能为空", trigger: "blur" }
+          categoryParentCode: [
+            { required: true, message: "上级编号不能为空", trigger: "blur" }
           ],
-          orderNum: [
-            { required: true, message: "显示排序不能为空", trigger: "blur" }
+          categoryName: [
+            { required: true, message: "类别名称不能为空", trigger: "blur" }
           ],
-          integral: [
-            { required: true, message: "积分不能为空", trigger: "blur" }
+          categoryCode: [
+            { required: true, message: "类别编号不能为空", trigger: "blur" }
           ],
-          email: [
-            {
-              type: "email",
-              message: "请输入正确的邮箱地址",
-              trigger: ["blur", "change"]
-            }
-          ],
-          phone: [
-            {
-              pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
-              message: "请输入正确的手机号码",
-              trigger: "blur"
-            }
-          ]
         }
       };
     },
@@ -171,32 +152,31 @@
       this.getList();
     },
     methods: {
-      handleDownload() {
-        this.downloadLoading = true
-        import('@/vendor/Export2Excel').then(excel => {
-          const tHeader = ['用户ID', '用户名称','用户昵称', '用户头像']
-          const filterVal = ['id', 'username', 'nickname', 'avatar']
-          excel.export_json_to_excel2(tHeader, this.list, filterVal, '用户信息')
-          this.downloadLoading = false
-        })
+      //选中树形部门选项
+      departTreeSelected(node,instanceId){
+        console.log(node,instanceId);
+        this.form.categoryParentCode = node.categoryCode;
       },
-      /** 查询证书列表 */
+      handleDownLoad(){
+            window.location.href = process.env.BASE_API + '/product-category/export/category?categoryCode=' + this.listQuery.categoryCode + '&categoryName=' + this.listQuery.categoryName;
+        },
+      /** 查询类别列表 */
       getList() {
         this.loading = true;
-        listDept(this.queryParams).then(response => {
+        listDept(this.listQuery).then(response => {
           this.deptList = this.handleTree(response.data.data,'id');
           console.log(this.deptList);
           this.loading = false;
         });
       },
-      /** 转换证书数据结构 */
+      /** 转换类别数据结构 */
       normalizer(node) {
         if (node.children && !node.children.length) {
           delete node.children;
         }
         return {
           id: node.id,
-          label: node.typeName,
+          label: node.categoryName,
           children: node.children
         };
       },
@@ -209,10 +189,10 @@
       reset() {
         this.form = {
           id: undefined,
-          parentId: undefined,
-          typeName: undefined,
-          orderNum: undefined,
-          integral:undefined,
+          categoryParentId: undefined,
+          categoryName: undefined,
+          categoryCode: undefined,
+          categoryParentId:undefined,
           leader: undefined,
           phone: undefined,
           email: undefined,
@@ -226,17 +206,20 @@
       },
       /** 重置按钮操作 */
       resetQuery() {
-        this.resetForm("queryForm");
+        this.listQuery = {
+          categoryCode: undefined,
+          categoryName: undefined,
+        };
         this.handleQuery();
       },
       /** 新增按钮操作 */
       handleAdd(row) {
         this.reset();
         if (row.id) {
-          this.form.parentId = row.id;
+          this.form.categoryParentId = row.id;
         }
         this.open = true;
-        this.title = "添加证书";
+        this.title = "添加类别";
         listDept().then(response => {
           this.deptOptions = this.handleTree(response.data.data, "id");
         });
@@ -255,11 +238,12 @@
         getDept({id:row.id}).then(response => {
           this.form = response.data.data;
           this.open = true;
-          this.title = "修改证书";
+          this.title = "修改类别";
           listDeptExcludeChild({id:row.id}).then(response => {
             this.deptOptions = this.handleTree(response.data.data, "id");
             if (this.deptOptions.length == 0) {
-              const noResultsOptions = { id: this.form.parentId, typeName: this.form.parentName, children: [] };
+              const noResultsOptions = { id: this.form.categoryParentId, children: [] };
+              // const noResultsOptions = { id: this.form.categoryParentId, categoryName: this.form.parentName, children: [] };
               this.deptOptions.push(noResultsOptions);
             }
           });
@@ -297,7 +281,7 @@
       },
       /** 删除按钮操作 */
       handleDelete(row) {
-        this.$confirm('是否确认删除名称为"' + row.typeName + '"的数据项?', "提示", {
+        this.$confirm('是否确认删除名称为"' + row.categoryName + '"的数据项?', "提示", {
                 confirmButtonText: "确定",
                 cancelButtonText: "取消",
                 type: "warning",

+ 2 - 2
src/views/stock/warehousing/warehousingAdd.vue

@@ -30,7 +30,7 @@
                     placeholder="请输入采购说明 最大120字"></el-input>
             </el-form-item>
             <el-form-item label="附件:" prop="fileIds">
-                <el-upload :limit="1" :action="fileUrl" :file-list="addForm.files" :on-success="handleAvatarSuccess"
+                <el-upload :limit="1" :action="fileUrl" :file-list="addForm.files" :on-success="handleFileSuccess"
                     :before-upload="beforeUploadFile" :on-remove="handleRemove">
                     <el-button size="small" type="primary">点击上传</el-button>
                 </el-upload>
@@ -170,7 +170,7 @@ export default {
             return false;
         }
         },
-        handleAvatarSuccess(res, file, fileList) {
+        handleFileSuccess(res, file, fileList) {
         console.log(file, fileList);
         console.log("------", "==========");
         console.log("res = ", res);