Forráskód Böngészése

产品类别的修改

zhuliu 1 éve
szülő
commit
868c0ac1d2

+ 41 - 10
src/router/index.js

@@ -45,12 +45,13 @@ export const asyncRouterMap = [
     redirect: '/pms/product',
     name: 'pms',
     meta: {title: '爆款产品', icon: 'product'},
-    children: [{
-      path: 'product',
-      name: 'product',
-      component: () => import('@/views/pms/product/index'),
-      meta: {title: '爆款产品列表', icon: 'product-list'}
-    },
+    children: [
+      {
+        path: 'product',
+        name: 'product',
+        component: () => import('@/views/pms/product/index'),
+        meta: {title: '爆款产品列表', icon: 'product-list'}
+      },
       {
         path: 'addProduct',
         name: 'addProduct',
@@ -64,24 +65,54 @@ export const asyncRouterMap = [
         meta: {title: '修改爆款产品', icon: 'product-add'},
         hidden: true
       },
+      // {
+      //   path: 'productCate',
+      //   name: 'productCate',
+      //   component: () => import('@/views/pms/productCate/index'),
+      //   meta: {title: '产品类别', icon: 'product-cate'}
+      // },
+      // {
+      //   path: 'addProductCate',
+      //   name: 'addProductCate',
+      //   component: () => import('@/views/pms/productCate/add'),
+      //   meta: {title: '添加产品类别'},
+      //   hidden: true
+      // },
+      // {
+      //   path: 'updateProductCate',
+      //   name: 'updateProductCate',
+      //   component: () => import('@/views/pms/productCate/update'),
+      //   meta: {title: '修改产品类别'},
+      //   hidden: true
+      // },
+
+    ]
+  },
+  {
+    path: '/pms',
+    component: Layout,
+    redirect: '/pms/productCate',
+    name: 'pms2',
+    meta: {title: '产品类别', icon: 'product-cate'},
+    children: [
       {
         path: 'productCate',
         name: 'productCate',
         component: () => import('@/views/pms/productCate/index'),
-        meta: {title: '产品类别', icon: 'product-cate'}
+        meta: {title: '产品类别列表', icon: 'product-cate'}
       },
       {
         path: 'addProductCate',
         name: 'addProductCate',
         component: () => import('@/views/pms/productCate/add'),
-        meta: {title: '添加产品类别'},
-        hidden: true
+        meta: {title: '添加产品类别',icon: 'product-add'},
+        // hidden: true
       },
       {
         path: 'updateProductCate',
         name: 'updateProductCate',
         component: () => import('@/views/pms/productCate/update'),
-        meta: {title: '修改产品类别'},
+        meta: {title: '修改产品类别',icon: 'product-add'},
         hidden: true
       },
 

+ 20 - 0
src/utils/common.js

@@ -38,4 +38,24 @@ export default {
 
     return arr
   },
+
+  //导出
+  downLoad(guid){
+    const href = this.getFile(guid)
+    const anchor = document.createElement('a');
+    const fileName = 'download';
+    if ('download' in anchor) {
+      anchor.href = href;
+      anchor.setAttribute("download", fileName);
+      anchor.className = "download-js-link";
+      anchor.innerHTML = "downloading...";
+      anchor.style.display = "none";
+      document.body.appendChild(anchor);
+      setTimeout(function () {
+        anchor.click();
+        document.body.removeChild(anchor);
+      }, 66);
+      return true;
+    }
+  },
 }

+ 1 - 17
src/views/oms/order/orderDetail.vue

@@ -386,23 +386,7 @@
     },
     methods: {
       downLoad(guid){
-        const href = this.$commonJS.getFile(guid)
-        console.log(href)
-        const anchor = document.createElement('a');
-        const fileName = 'download';
-        if ('download' in anchor) {
-          anchor.href = href;
-          anchor.setAttribute("download", fileName);
-          anchor.className = "download-js-link";
-          anchor.innerHTML = "downloading...";
-          anchor.style.display = "none";
-          document.body.appendChild(anchor);
-          setTimeout(function () {
-            anchor.click();
-            document.body.removeChild(anchor);
-          }, 66);
-          return true;
-        }
+        this.$commonJs.downLoad(guid)
       },
       review(guid,type){
         var router = this.$router.resolve(

+ 117 - 0
src/views/pms/components/importDialog.vue

@@ -0,0 +1,117 @@
+<template> 
+  <el-dialog title="导入数据" :visible.sync="visible" :before-close="handleClose" width="40%">
+    <div>
+      <p>
+        请上传需要导入的文件(仅支持excel文件),如有疑问,请<el-link type="primary" @click="downLoad">下载示例</el-link>参考
+      </p>
+      <myUpload :file-list="files" @on-change="onChange" @on-remove="onRemove" :autoUpload="false" :limit="1"></myUpload>
+    </div>
+    <span slot="footer" class="dialog-footer">
+      <el-button @click="handleClose">取 消</el-button>
+      <el-button type="primary" @click="submit">确 定</el-button>
+    </span>
+  </el-dialog>
+</template>
+<script>
+  export default {
+    name:'logisticsDialog',
+    props: {
+    },
+    computed:{
+
+    },
+    data() {
+      return {
+        visible:false,
+        files:[]
+      }
+    },
+    methods:{
+      /**
+       *  打开导入数据弹框
+       * @param {*} type - 要处理的值,必须是 '1', '2'  中的一个
+       * @throws {Error} 如果传入的 `value` 不是有效的选项。
+       *  {
+       *    1:导入产品类别模板
+       *    2: 导入产品模板
+       *  }
+       */
+      open(type){
+        const validValues = ['1', '2'];
+        if (!validValues.includes(type.toString())) {
+            throw new Error(`Invalid value: ${type}. Expected one of: ${validValues.join(', ')}`);
+        }
+        this.type = type
+        this.visible = true
+      },
+      handleClose(){
+        this.visible = false
+        this.$nextTick(()=>{
+          this.files = []
+        })
+      },
+      onChange(file, fileList){
+        if(!this.files){
+          this.$set(this,'files',[])
+        }
+        if (file.guid) {
+          let index = this.files.findIndex(item => {
+            return item.uid == file.uid
+          })
+          if (index != -1) {
+            this.files.splice(index, 1, file)
+          }
+        } else {
+          this.files.push(file.raw)
+        }
+      },
+      // 删除上传的文件
+      onRemove(file, fileList) {
+        let index = this.files.findIndex(item => {
+          return item.uid == file.uid
+        })
+        if (index != -1) {
+          this.files.splice(index, 1)
+        }
+      },
+      //确定导入
+      submit(){
+        if(!this.files && this.files.length == 0){
+          this.$message.warning("请先上传文件")
+          return
+        }
+        let formData = new FormData()
+        for (var i = 0; i < this.files.length; i++) {
+          formData.append('file', this.files[i])//文件数据
+        }
+        var api = {
+          '2':'ImportProductBatch'
+        }
+        this.$api[api[this.type]](formData).then(res=>{
+          if(res.code == 200){
+            this.$message.success("正在导入中")
+            this.$emit('downLoad')
+            this.handleClose()
+          }
+        }).catch(error=>{
+          this.$message.error("导入失败")
+        })
+      },
+      //下载示例
+      downLoad(){
+        var params ={
+          type:this.type
+        }
+        this.$api.getTemplate(params).then(res=>{
+          if(res.code == 200){
+            var guid = res.data.data[0].guid
+            this.$commonJS.downLoad(guid)
+          }
+        })
+      },
+    }
+  }
+</script>
+<style></style>
+
+

+ 0 - 640
src/views/pms/product/components/ProductAttrDetail.vue

@@ -1,640 +0,0 @@
-<template>
-  <div style="margin-top: 50px">
-    <el-form :model="value" ref="productAttrForm" label-width="120px" class="form-inner-container" size="small">
-      <el-form-item label="属性类型:">
-        <el-select v-model="value.productAttributeCategoryId"
-                   placeholder="请选择属性类型"
-                   @change="handleProductAttrChange">
-          <el-option
-            v-for="item in productAttributeCategoryOptions"
-            :key="item.value"
-            :label="item.label"
-            :value="item.value">
-          </el-option>
-        </el-select>
-      </el-form-item>
-      <el-form-item label="商品规格:">
-        <el-card shadow="never" class="cardBg">
-          <div v-for="(productAttr,idx) in selectProductAttr">
-            {{productAttr.name}}:
-            <el-checkbox-group v-if="productAttr.handAddStatus===0" v-model="selectProductAttr[idx].values">
-              <el-checkbox v-for="item in getInputListArr(productAttr.inputList)" :label="item" :key="item"
-                           class="littleMarginLeft"></el-checkbox>
-            </el-checkbox-group>
-            <div v-else>
-              <el-checkbox-group v-model="selectProductAttr[idx].values">
-                <div v-for="(item,index) in selectProductAttr[idx].options" style="display: inline-block"
-                     class="littleMarginLeft">
-                  <el-checkbox :label="item" :key="item"></el-checkbox>
-                  <el-button type="text" class="littleMarginLeft" @click="handleRemoveProductAttrValue(idx,index)">删除
-                  </el-button>
-                </div>
-              </el-checkbox-group>
-              <el-input v-model="addProductAttrValue" style="width: 160px;margin-left: 10px" clearable></el-input>
-              <el-button class="littleMarginLeft" @click="handleAddProductAttrValue(idx)">增加</el-button>
-            </div>
-          </div>
-        </el-card>
-        <el-table style="width: 100%;margin-top: 20px"
-                  :data="value.skuStockList"
-                  border>
-          <el-table-column
-            v-for="(item,index) in selectProductAttr"
-            :label="item.name"
-            :key="item.id"
-            align="center">
-            <template slot-scope="scope">
-              {{getProductSkuSp(scope.row,index)}}
-            </template>
-          </el-table-column>
-          <el-table-column
-            label="销售价格"
-            width="100"
-            align="center">
-            <template slot-scope="scope">
-              <el-input v-model="scope.row.price"></el-input>
-            </template>
-          </el-table-column>
-          <el-table-column
-            label="促销价格"
-            width="100"
-            align="center">
-            <template slot-scope="scope">
-              <el-input v-model="scope.row.promotionPrice"></el-input>
-            </template>
-          </el-table-column>
-          <el-table-column
-            label="商品库存"
-            width="80"
-            align="center">
-            <template slot-scope="scope">
-              <el-input v-model="scope.row.stock"></el-input>
-            </template>
-          </el-table-column>
-          <el-table-column
-            label="库存预警值"
-            width="80"
-            align="center">
-            <template slot-scope="scope">
-              <el-input v-model="scope.row.lowStock"></el-input>
-            </template>
-          </el-table-column>
-          <el-table-column
-            label="SKU编号"
-            width="160"
-            align="center">
-            <template slot-scope="scope">
-              <el-input v-model="scope.row.skuCode"></el-input>
-            </template>
-          </el-table-column>
-          <el-table-column
-            label="操作"
-            width="80"
-            align="center">
-            <template slot-scope="scope">
-              <el-button
-                type="text"
-                @click="handleRemoveProductSku(scope.$index, scope.row)">删除
-              </el-button>
-            </template>
-          </el-table-column>
-        </el-table>
-        <el-button
-          type="primary"
-          style="margin-top: 20px"
-          @click="handleRefreshProductSkuList">刷新列表
-        </el-button>
-        <el-button
-          type="primary"
-          style="margin-top: 20px"
-          @click="handleSyncProductSkuPrice">同步价格
-        </el-button>
-        <el-button
-          type="primary"
-          style="margin-top: 20px"
-          @click="handleSyncProductSkuStock">同步库存
-        </el-button>
-      </el-form-item>
-      <el-form-item label="属性图片:" v-if="hasAttrPic">
-        <el-card shadow="never" class="cardBg">
-          <div v-for="(item,index) in selectProductAttrPics">
-            <span>{{item.name}}:</span>
-            <single-upload v-model="item.pic"
-                           style="width: 300px;display: inline-block;margin-left: 10px"></single-upload>
-          </div>
-        </el-card>
-      </el-form-item>
-      <el-form-item label="商品参数:">
-        <el-card shadow="never" class="cardBg">
-          <div v-for="(item,index) in selectProductParam" :class="{littleMarginTop:index!==0}">
-            <div class="paramInputLabel">{{item.name}}:</div>
-            <el-select v-if="item.inputType===1" class="paramInput" v-model="selectProductParam[index].value">
-              <el-option
-                v-for="item in getParamInputList(item.inputList)"
-                :key="item"
-                :label="item"
-                :value="item">
-              </el-option>
-            </el-select>
-            <el-input v-else class="paramInput" v-model="selectProductParam[index].value"></el-input>
-          </div>
-        </el-card>
-      </el-form-item>
-      <el-form-item label="商品相册:">
-        <multi-upload v-model="selectProductPics"></multi-upload>
-      </el-form-item>
-      <el-form-item label="商品详情:">
-        <el-tabs v-model="activeHtmlName" type="card">
-          <el-tab-pane label="电脑端详情" name="pc">
-            <tinymce :width="595" :height="300" v-model="value.detailHtml"></tinymce>
-          </el-tab-pane>
-          <el-tab-pane label="移动端详情" name="mobile">
-            <tinymce :width="595" :height="300" v-model="value.detailMobileHtml"></tinymce>
-          </el-tab-pane>
-        </el-tabs>
-      </el-form-item>
-      <el-form-item style="text-align: center">
-        <el-button size="medium" @click="handlePrev">上一步,填写商品促销</el-button>
-        <el-button type="primary" size="medium" @click="handleNext">下一步,选择商品关联</el-button>
-      </el-form-item>
-    </el-form>
-  </div>
-</template>
-
-<script>
-  import {fetchList as fetchProductAttrCateList} from '@/api/productAttrCate'
-  import {fetchList as fetchProductAttrList} from '@/api/productAttr'
-  import SingleUpload from '@/components/Upload/singleUpload'
-  import MultiUpload from '@/components/Upload/multiUpload'
-  import Tinymce from '@/components/Tinymce'
-
-  export default {
-    name: "ProductAttrDetail",
-    components: {SingleUpload, MultiUpload, Tinymce},
-    props: {
-      value: Object,
-      isEdit: {
-        type: Boolean,
-        default: false
-      }
-    },
-    data() {
-      return {
-        //编辑模式时是否初始化成功
-        hasEditCreated:false,
-        //商品属性分类下拉选项
-        productAttributeCategoryOptions: [],
-        //选中的商品属性
-        selectProductAttr: [],
-        //选中的商品参数
-        selectProductParam: [],
-        //选中的商品属性图片
-        selectProductAttrPics: [],
-        //可手动添加的商品属性
-        addProductAttrValue: '',
-        //商品富文本详情激活类型
-        activeHtmlName: 'pc'
-      }
-    },
-    computed: {
-      //是否有商品属性图片
-      hasAttrPic() {
-        if (this.selectProductAttrPics.length < 1) {
-          return false;
-        }
-        return true;
-      },
-      //商品的编号
-      productId(){
-        return this.value.id;
-      },
-      //商品的主图和画册图片
-      selectProductPics:{
-        get:function () {
-          let pics=[];
-          if(this.value.pic===undefined||this.value.pic==null||this.value.pic===''){
-            return pics;
-          }
-          pics.push(this.value.pic);
-          if(this.value.albumPics===undefined||this.value.albumPics==null||this.value.albumPics===''){
-            return pics;
-          }
-          let albumPics = this.value.albumPics.split(',');
-          for(let i=0;i<albumPics.length;i++){
-            pics.push(albumPics[i]);
-          }
-          return pics;
-        },
-        set:function (newValue) {
-          if (newValue == null || newValue.length === 0) {
-            this.value.pic = null;
-            this.value.albumPics = null;
-          } else {
-            this.value.pic = newValue[0];
-            this.value.albumPics = '';
-            if (newValue.length > 1) {
-              for (let i = 1; i < newValue.length; i++) {
-                this.value.albumPics += newValue[i];
-                if (i !== newValue.length - 1) {
-                  this.value.albumPics += ',';
-                }
-              }
-            }
-          }
-        }
-      }
-    },
-    created() {
-      this.getProductAttrCateList();
-    },
-    watch: {
-      productId:function (newValue) {
-        if(!this.isEdit)return;
-        if(this.hasEditCreated)return;
-        if(newValue===undefined||newValue==null||newValue===0)return;
-        this.handleEditCreated();
-      }
-    },
-    methods: {
-      handleEditCreated() {
-        //根据商品属性分类id获取属性和参数
-        if(this.value.productAttributeCategoryId!=null){
-          this.handleProductAttrChange(this.value.productAttributeCategoryId);
-        }
-        this.hasEditCreated=true;
-      },
-      getProductAttrCateList() {
-        let param = {pageNum: 1, pageSize: 100};
-        fetchProductAttrCateList(param).then(response => {
-          this.productAttributeCategoryOptions = [];
-          let list = response.data.list;
-          for (let i = 0; i < list.length; i++) {
-            this.productAttributeCategoryOptions.push({label: list[i].name, value: list[i].id});
-          }
-        });
-      },
-      getProductAttrList(type, cid) {
-        let param = {pageNum: 1, pageSize: 100, type: type};
-        fetchProductAttrList(cid, param).then(response => {
-          let list = response.data.list;
-          if (type === 0) {
-            this.selectProductAttr = [];
-            for (let i = 0; i < list.length; i++) {
-              let options = [];
-              let values = [];
-              if (this.isEdit) {
-                if (list[i].handAddStatus === 1) {
-                  //编辑状态下获取手动添加编辑属性
-                  options = this.getEditAttrOptions(list[i].id);
-                }
-                //编辑状态下获取选中属性
-                values = this.getEditAttrValues(i);
-              }
-              this.selectProductAttr.push({
-                id: list[i].id,
-                name: list[i].name,
-                handAddStatus: list[i].handAddStatus,
-                inputList: list[i].inputList,
-                values: values,
-                options: options
-              });
-            }
-            if(this.isEdit){
-              //编辑模式下刷新商品属性图片
-              this.refreshProductAttrPics();
-            }
-          } else {
-            this.selectProductParam = [];
-            for (let i = 0; i < list.length; i++) {
-              let value=null;
-              if(this.isEdit){
-                //编辑模式下获取参数属性
-                value= this.getEditParamValue(list[i].id);
-              }
-              this.selectProductParam.push({
-                id: list[i].id,
-                name: list[i].name,
-                value: value,
-                inputType: list[i].inputType,
-                inputList: list[i].inputList
-              });
-            }
-          }
-        });
-      },
-      //获取设置的可手动添加属性值
-      getEditAttrOptions(id) {
-        let options = [];
-        for (let i = 0; i < this.value.productAttributeValueList.length; i++) {
-          let attrValue = this.value.productAttributeValueList[i];
-          if (attrValue.productAttributeId === id) {
-            let strArr = attrValue.value.split(',');
-            for (let j = 0; j < strArr.length; j++) {
-              options.push(strArr[j]);
-            }
-            break;
-          }
-        }
-        return options;
-      },
-      //获取选中的属性值
-      getEditAttrValues(index) {
-        let values = new Set();
-        if (index === 0) {
-          for (let i = 0; i < this.value.skuStockList.length; i++) {
-            let sku = this.value.skuStockList[i];
-            let spData = JSON.parse(sku.spData);
-            if (spData!= null && spData.length>=1) {
-              values.add(spData[0].value);
-            }
-          }
-        } else if (index === 1) {
-          for (let i = 0; i < this.value.skuStockList.length; i++) {
-            let sku = this.value.skuStockList[i];
-            let spData = JSON.parse(sku.spData);
-            if (spData!= null && spData.length>=2) {
-              values.add(spData[1].value);
-            }
-          }
-        } else {
-          for (let i = 0; i < this.value.skuStockList.length; i++) {
-            let sku = this.value.skuStockList[i];
-            let spData = JSON.parse(sku.spData);
-            if (spData!= null && spData.length>=3) {
-              values.add(spData[2].value);
-            }
-          }
-        }
-        return Array.from(values);
-      },
-      //获取属性的值
-      getEditParamValue(id){
-        for(let i=0;i<this.value.productAttributeValueList.length;i++){
-          if(id===this.value.productAttributeValueList[i].productAttributeId){
-            return this.value.productAttributeValueList[i].value;
-          }
-        }
-      },
-      handleProductAttrChange(value) {
-        this.getProductAttrList(0, value);
-        this.getProductAttrList(1, value);
-      },
-      getInputListArr(inputList) {
-        return inputList.split(',');
-      },
-      handleAddProductAttrValue(idx) {
-        let options = this.selectProductAttr[idx].options;
-        if (this.addProductAttrValue == null || this.addProductAttrValue == '') {
-          this.$message({
-            message: '属性值不能为空',
-            type: 'warning',
-            duration: 1000
-          });
-          return
-        }
-        if (options.indexOf(this.addProductAttrValue) !== -1) {
-          this.$message({
-            message: '属性值不能重复',
-            type: 'warning',
-            duration: 1000
-          });
-          return;
-        }
-        this.selectProductAttr[idx].options.push(this.addProductAttrValue);
-        this.addProductAttrValue = null;
-      },
-      handleRemoveProductAttrValue(idx, index) {
-        this.selectProductAttr[idx].options.splice(index, 1);
-      },
-      getProductSkuSp(row, index) {
-        let spData = JSON.parse(row.spData);
-        if(spData!=null&&index<spData.length){
-          return spData[index].value;
-        }else{
-          return null;
-        }
-      },
-      handleRefreshProductSkuList() {
-        this.$confirm('刷新列表将导致sku信息重新生成,是否要刷新', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-          this.refreshProductAttrPics();
-          this.refreshProductSkuList();
-        });
-      },
-      handleSyncProductSkuPrice(){
-        this.$confirm('将同步第一个sku的价格到所有sku,是否继续', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-          if(this.value.skuStockList!==null&&this.value.skuStockList.length>0){
-            let tempSkuList = [];
-            tempSkuList = tempSkuList.concat(tempSkuList,this.value.skuStockList);
-            let price=this.value.skuStockList[0].price;
-            for(let i=0;i<tempSkuList.length;i++){
-              tempSkuList[i].price=price;
-            }
-            this.value.skuStockList=[];
-            this.value.skuStockList=this.value.skuStockList.concat(this.value.skuStockList,tempSkuList);
-          }
-        });
-      },
-      handleSyncProductSkuStock(){
-        this.$confirm('将同步第一个sku的库存到所有sku,是否继续', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-          if(this.value.skuStockList!==null&&this.value.skuStockList.length>0){
-            let tempSkuList = [];
-            tempSkuList = tempSkuList.concat(tempSkuList,this.value.skuStockList);
-            let stock=this.value.skuStockList[0].stock;
-            let lowStock=this.value.skuStockList[0].lowStock;
-            for(let i=0;i<tempSkuList.length;i++){
-              tempSkuList[i].stock=stock;
-              tempSkuList[i].lowStock=lowStock;
-            }
-            this.value.skuStockList=[];
-            this.value.skuStockList=this.value.skuStockList.concat(this.value.skuStockList,tempSkuList);
-          }
-        });
-      },
-      refreshProductSkuList() {
-        this.value.skuStockList = [];
-        let skuList = this.value.skuStockList;
-        //只有一个属性时
-        if (this.selectProductAttr.length === 1) {
-          let attr = this.selectProductAttr[0];
-          for (let i = 0; i < attr.values.length; i++) {
-            skuList.push({
-              spData: JSON.stringify([{key:attr.name,value:attr.values[i]}])
-            });
-          }
-        } else if (this.selectProductAttr.length === 2) {
-          let attr0 = this.selectProductAttr[0];
-          let attr1 = this.selectProductAttr[1];
-          for (let i = 0; i < attr0.values.length; i++) {
-            if (attr1.values.length === 0) {
-              skuList.push({
-                spData: JSON.stringify([{key:attr0.name,value:attr0.values[i]}])
-              });
-              continue;
-            }
-            for (let j = 0; j < attr1.values.length; j++) {
-              let spData = [];
-              spData.push({key:attr0.name,value:attr0.values[i]});
-              spData.push({key:attr1.name,value:attr1.values[j]});
-              skuList.push({
-                spData: JSON.stringify(spData)
-              });
-            }
-          }
-        } else {
-          let attr0 = this.selectProductAttr[0];
-          let attr1 = this.selectProductAttr[1];
-          let attr2 = this.selectProductAttr[2];
-          for (let i = 0; i < attr0.values.length; i++) {
-            if (attr1.values.length === 0) {
-              skuList.push({
-                spData: JSON.stringify([{key:attr0.name,value:attr0.values[i]}])
-              });
-              continue;
-            }
-            for (let j = 0; j < attr1.values.length; j++) {
-              if (attr2.values.length === 0) {
-                let spData = [];
-                spData.push({key:attr0.name,value:attr0.values[i]});
-                spData.push({key:attr1.name,value:attr1.values[j]});
-                skuList.push({
-                  spData: JSON.stringify(spData)
-                });
-                continue;
-              }
-              for (let k = 0; k < attr2.values.length; k++) {
-                let spData = [];
-                spData.push({key:attr0.name,value:attr0.values[i]});
-                spData.push({key:attr1.name,value:attr1.values[j]});
-                spData.push({key:attr2.name,value:attr2.values[k]});
-                skuList.push({
-                  spData: JSON.stringify(spData)
-                });
-              }
-            }
-          }
-        }
-      },
-      refreshProductAttrPics() {
-        this.selectProductAttrPics = [];
-        if (this.selectProductAttr.length >= 1) {
-          let values = this.selectProductAttr[0].values;
-          for (let i = 0; i < values.length; i++) {
-            let pic=null;
-            if(this.isEdit){
-              //编辑状态下获取图片
-              pic=this.getProductSkuPic(values[i]);
-            }
-            this.selectProductAttrPics.push({name: values[i], pic: pic})
-          }
-        }
-      },
-      //获取商品相关属性的图片
-      getProductSkuPic(name){
-        for(let i=0;i<this.value.skuStockList.length;i++){
-          let spData = JSON.parse(this.value.skuStockList[i].spData);
-          if(name===spData[0].value){
-            return this.value.skuStockList[i].pic;
-          }
-        }
-        return null;
-      },
-      //合并商品属性
-      mergeProductAttrValue() {
-        this.value.productAttributeValueList = [];
-        for (let i = 0; i < this.selectProductAttr.length; i++) {
-          let attr = this.selectProductAttr[i];
-          if (attr.handAddStatus === 1 && attr.options != null && attr.options.length > 0) {
-            this.value.productAttributeValueList.push({
-              productAttributeId: attr.id,
-              value: this.getOptionStr(attr.options)
-            });
-          }
-        }
-        for (let i = 0; i < this.selectProductParam.length; i++) {
-          let param = this.selectProductParam[i];
-          this.value.productAttributeValueList.push({
-            productAttributeId: param.id,
-            value: param.value
-          });
-        }
-      },
-      //合并商品属性图片
-      mergeProductAttrPics() {
-        for (let i = 0; i < this.selectProductAttrPics.length; i++) {
-          for (let j = 0; j < this.value.skuStockList.length; j++) {
-            let spData = JSON.parse(this.value.skuStockList[j].spData);
-            if (spData[0].value === this.selectProductAttrPics[i].name) {
-              this.value.skuStockList[j].pic = this.selectProductAttrPics[i].pic;
-            }
-          }
-        }
-      },
-      getOptionStr(arr) {
-        let str = '';
-        for (let i = 0; i < arr.length; i++) {
-          str += arr[i];
-          if (i != arr.length - 1) {
-            str += ',';
-          }
-        }
-        return str;
-      },
-      handleRemoveProductSku(index, row) {
-        let list = this.value.skuStockList;
-        if (list.length === 1) {
-          list.pop();
-        } else {
-          list.splice(index, 1);
-        }
-      },
-      getParamInputList(inputList) {
-        return inputList.split(',');
-      },
-      handlePrev() {
-        this.$emit('prevStep')
-      },
-      handleNext() {
-        this.mergeProductAttrValue();
-        this.mergeProductAttrPics();
-        this.$emit('nextStep')
-      }
-    }
-  }
-</script>
-
-<style scoped>
-  .littleMarginLeft {
-    margin-left: 10px;
-  }
-
-  .littleMarginTop {
-    margin-top: 10px;
-  }
-
-  .paramInput {
-    width: 250px;
-  }
-
-  .paramInputLabel {
-    display: inline-block;
-    width: 100px;
-    text-align: right;
-    padding-right: 10px
-  }
-
-  .cardBg {
-    background: #F8F9FC;
-  }
-</style>

+ 1 - 1
src/views/pms/product/components/ProductDetail.vue

@@ -60,7 +60,7 @@
         }
         this.$api.queryHotProductDetail(params).then(response=>{
           this.productParam=response.data.data;
-          
+
         });
       },
       //提交信息

+ 9 - 6
src/views/pms/product/components/ProductInfoDetail.vue

@@ -77,7 +77,7 @@
             {required: true, message: '请输入产品名称', trigger: 'blur'},
             {min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
           ],
-          productCategoryId: [{required: true, message: '请选择产品分类', trigger: 'change'}],
+          productCategoryId: [{required: true, message: '请选择产品分类', trigger: 'blur'}],
         }
       };
     },
@@ -106,7 +106,7 @@
       //   }
       // },
       value(){
-        this.files = this.value.systemFileList
+        this.files = this.value.systemFileList || []
       }
     },
     mounted(){
@@ -167,14 +167,16 @@
         //查询产品类别
       getProductCateList(parentId,fn) {
         var params = {
-          current:1,
-          size:100000,
           parentId:parentId
         }
         this.$api.queryCategory(params).then(response => {
           let list = response.data.data;
           // this.productCateOptions = list
-          fn(list)
+          if(list.length>0){
+              fn(list)
+            }else{
+              fn(null)
+            }
         });
       },
 
@@ -198,8 +200,9 @@
         }
         this.value.fileGuids = guids
         if(this.selectProductCateValue && this.selectProductCateValue.length>0){
-          this.productCate.parentId = this.parentId[this.selectProductCateValue.length-1]
+          this.value.productCategoryId = this.selectProductCateValue[this.selectProductCateValue.length-1]
         }
+        console.log(this.selectProductCateValue)
         this.$refs[formName].validate((valid) => {
           if (valid) {
             this.$emit('finishCommit');

+ 0 - 145
src/views/pms/product/components/ProductRelationDetail.vue

@@ -1,145 +0,0 @@
-<template>
-  <div style="margin-top: 50px">
-    <el-form :model="value"
-             ref="productRelationForm"
-             label-width="120px"
-             class="form-inner-container"
-             size="small">
-      <el-form-item label="关联专题:">
-        <el-transfer
-          style="display: inline-block"
-          filterable
-          :filter-method="filterMethod"
-          filter-placeholder="请输入专题名称"
-          v-model="selectSubject"
-          :titles="subjectTitles"
-          :data="subjectList">
-        </el-transfer>
-      </el-form-item>
-      <el-form-item label="关联优选:">
-        <el-transfer
-          style="display: inline-block"
-          filterable
-          :filter-method="filterMethod"
-          filter-placeholder="请输入优选名称"
-          v-model="selectPrefrenceArea"
-          :titles="prefrenceAreaTitles"
-          :data="prefrenceAreaList">
-        </el-transfer>
-      </el-form-item>
-      <el-form-item style="text-align: center">
-        <el-button size="medium" @click="handlePrev">上一步,填写商品属性</el-button>
-        <el-button type="primary" size="medium" @click="handleFinishCommit">完成,提交商品</el-button>
-      </el-form-item>
-    </el-form>
-  </div>
-</template>
-
-<script>
-  import {fetchListAll as fetchSubjectList} from '@/api/subject'
-  import {fetchList as fetchPrefrenceAreaList} from '@/api/prefrenceArea'
-
-  export default {
-    name: "ProductRelationDetail",
-    props: {
-      value: Object,
-      isEdit: {
-        type: Boolean,
-        default: false
-      }
-    },
-    data() {
-      return {
-        //所有专题列表
-        subjectList: [],
-        //专题左右标题
-        subjectTitles: ['待选择', '已选择'],
-        //所有专题列表
-        prefrenceAreaList: [],
-        //专题左右标题
-        prefrenceAreaTitles: ['待选择', '已选择']
-      };
-    },
-    created() {
-      this.getSubjectList();
-      this.getPrefrenceAreaList();
-    },
-    computed:{
-      //选中的专题
-      selectSubject:{
-        get:function () {
-          let subjects =[];
-          if(this.value.subjectProductRelationList==null||this.value.subjectProductRelationList.length<=0){
-            return subjects;
-          }
-          for(let i=0;i<this.value.subjectProductRelationList.length;i++){
-            subjects.push(this.value.subjectProductRelationList[i].subjectId);
-          }
-          return subjects;
-        },
-        set:function (newValue) {
-          this.value.subjectProductRelationList=[];
-          for(let i=0;i<newValue.length;i++){
-            this.value.subjectProductRelationList.push({subjectId:newValue[i]});
-          }
-        }
-      },
-      //选中的优选
-      selectPrefrenceArea:{
-        get:function () {
-          let prefrenceAreas =[];
-          if(this.value.prefrenceAreaProductRelationList==null||this.value.prefrenceAreaProductRelationList.length<=0){
-            return prefrenceAreas;
-          }
-          for(let i=0;i<this.value.prefrenceAreaProductRelationList.length;i++){
-            prefrenceAreas.push(this.value.prefrenceAreaProductRelationList[i].prefrenceAreaId);
-          }
-          return prefrenceAreas;
-        },
-        set:function (newValue) {
-          this.value.prefrenceAreaProductRelationList=[];
-          for(let i=0;i<newValue.length;i++){
-            this.value.prefrenceAreaProductRelationList.push({prefrenceAreaId:newValue[i]});
-          }
-        }
-      }
-    },
-    methods: {
-      filterMethod(query, item) {
-        return item.label.indexOf(query) > -1;
-      },
-      getSubjectList() {
-        fetchSubjectList().then(response => {
-          let list = response.data;
-          for (let i = 0; i < list.length; i++) {
-            this.subjectList.push({
-              label: list[i].title,
-              key: list[i].id
-            });
-          }
-        });
-      },
-      getPrefrenceAreaList() {
-        fetchPrefrenceAreaList().then(response=>{
-          let list = response.data;
-          for (let i = 0; i < list.length; i++) {
-            this.prefrenceAreaList.push({
-              label: list[i].name,
-              key: list[i].id
-            });
-          }
-        });
-      },
-      handlePrev(){
-        this.$emit('prevStep')
-      },
-      handleFinishCommit(){
-        this.$emit('finishCommit',this.isEdit);
-      }
-    }
-  }
-</script>
-
-<style scoped>
-
-</style>

+ 0 - 306
src/views/pms/product/components/ProductSaleDetail.vue

@@ -1,306 +0,0 @@
-<template>
-  <div style="margin-top: 50px">
-    <el-form :model="value" ref="productSaleForm" label-width="120px" class="form-inner-container" size="small">
-      <el-form-item label="赠送积分:">
-        <el-input v-model="value.giftPoint"></el-input>
-      </el-form-item>
-      <el-form-item label="赠送成长值:">
-        <el-input v-model="value.giftGrowth"></el-input>
-      </el-form-item>
-      <el-form-item label="积分购买限制:">
-        <el-input v-model="value.usePointLimit"></el-input>
-      </el-form-item>
-      <el-form-item label="预告商品:">
-        <el-switch
-          v-model="value.previewStatus"
-          :active-value="1"
-          :inactive-value="0">
-        </el-switch>
-      </el-form-item>
-      <el-form-item label="商品上架:">
-        <el-switch
-          v-model="value.publishStatus"
-          :active-value="1"
-          :inactive-value="0">
-        </el-switch>
-      </el-form-item>
-      <el-form-item label="商品推荐:">
-        <span style="margin-right: 10px">新品</span>
-        <el-switch
-          v-model="value.newStatus"
-          :active-value="1"
-          :inactive-value="0">
-        </el-switch>
-        <span style="margin-left: 10px;margin-right: 10px">推荐</span>
-        <el-switch
-          v-model="value.recommandStatus"
-          :active-value="1"
-          :inactive-value="0">
-        </el-switch>
-      </el-form-item>
-      <el-form-item label="服务保证:">
-        <el-checkbox-group v-model="selectServiceList">
-          <el-checkbox :label="1">无忧退货</el-checkbox>
-          <el-checkbox :label="2">快速退款</el-checkbox>
-          <el-checkbox :label="3">免费包邮</el-checkbox>
-        </el-checkbox-group>
-      </el-form-item>
-      <el-form-item label="详细页标题:">
-        <el-input v-model="value.detailTitle"></el-input>
-      </el-form-item>
-      <el-form-item label="详细页描述:">
-        <el-input v-model="value.detailDesc"></el-input>
-      </el-form-item>
-      <el-form-item label="商品关键字:">
-        <el-input v-model="value.keywords"></el-input>
-      </el-form-item>
-      <el-form-item label="商品备注:">
-        <el-input v-model="value.note" type="textarea" :autoSize="true"></el-input>
-      </el-form-item>
-      <el-form-item label="选择优惠方式:">
-        <el-radio-group v-model="value.promotionType" size="small">
-          <el-radio-button :label="0">无优惠</el-radio-button>
-          <el-radio-button :label="1">特惠促销</el-radio-button>
-          <el-radio-button :label="2">会员价格</el-radio-button>
-          <el-radio-button :label="3">阶梯价格</el-radio-button>
-          <el-radio-button :label="4">满减价格</el-radio-button>
-        </el-radio-group>
-      </el-form-item>
-      <el-form-item v-show="value.promotionType===1">
-        <div>
-          开始时间:
-          <el-date-picker
-            v-model="value.promotionStartTime"
-            type="datetime"
-            :picker-options="pickerOptions1"
-            placeholder="选择开始时间">
-          </el-date-picker>
-        </div>
-        <div class="littleMargin">
-          结束时间:
-          <el-date-picker
-            v-model="value.promotionEndTime"
-            type="datetime"
-            :picker-options="pickerOptions1"
-            placeholder="选择结束时间">
-          </el-date-picker>
-        </div>
-        <div class="littleMargin">
-          促销价格:
-          <el-input style="width: 220px" v-model="value.promotionPrice" placeholder="输入促销价格"></el-input>
-        </div>
-
-      </el-form-item>
-      <el-form-item v-show="value.promotionType===2">
-        <div v-for="(item, index) in value.memberPriceList" :class="{littleMargin:index!==0}">
-          {{item.memberLevelName}}:
-          <el-input v-model="item.memberPrice" style="width: 200px"></el-input>
-        </div>
-      </el-form-item>
-      <el-form-item v-show="value.promotionType===3">
-        <el-table :data="value.productLadderList"
-                  style="width: 80%" border>
-          <el-table-column
-            label="数量"
-            align="center"
-            width="120">
-            <template slot-scope="scope">
-              <el-input v-model="scope.row.count"></el-input>
-            </template>
-          </el-table-column>
-          <el-table-column
-            label="折扣"
-            align="center"
-            width="120">
-            <template slot-scope="scope">
-              <el-input v-model="scope.row.discount"></el-input>
-            </template>
-          </el-table-column>
-          <el-table-column
-            align="center"
-            label="操作">
-            <template slot-scope="scope">
-              <el-button type="text" @click="handleRemoveProductLadder(scope.$index, scope.row)">删除</el-button>
-              <el-button type="text" @click="handleAddProductLadder(scope.$index, scope.row)">添加</el-button>
-            </template>
-          </el-table-column>
-        </el-table>
-      </el-form-item>
-      <el-form-item v-show="value.promotionType===4">
-        <el-table :data="value.productFullReductionList"
-                  style="width: 80%" border>
-          <el-table-column
-            label="满"
-            align="center"
-            width="120">
-            <template slot-scope="scope">
-              <el-input v-model="scope.row.fullPrice"></el-input>
-            </template>
-          </el-table-column>
-          <el-table-column
-            label="立减"
-            align="center"
-            width="120">
-            <template slot-scope="scope">
-              <el-input v-model="scope.row.reducePrice"></el-input>
-            </template>
-          </el-table-column>
-          <el-table-column
-            align="center"
-            label="操作">
-            <template slot-scope="scope">
-              <el-button type="text" @click="handleRemoveFullReduction(scope.$index, scope.row)">删除</el-button>
-              <el-button type="text" @click="handleAddFullReduction(scope.$index, scope.row)">添加</el-button>
-            </template>
-          </el-table-column>
-        </el-table>
-      </el-form-item>
-      <el-form-item style="text-align: center">
-        <el-button size="medium" @click="handlePrev">上一步,填写商品信息</el-button>
-        <el-button type="primary" size="medium" @click="handleNext">下一步,填写商品属性</el-button>
-      </el-form-item>
-    </el-form>
-  </div>
-</template>
-
-<script>
-  import {fetchList as fetchMemberLevelList} from '@/api/memberLevel'
-
-  export default {
-    name: "ProductSaleDetail",
-    props: {
-      value: Object,
-      isEdit: {
-        type: Boolean,
-        default: false
-      }
-    },
-    data() {
-      return {
-        //日期选择器配置
-        pickerOptions1: {
-          disabledDate(time) {
-            return time.getTime() < Date.now();
-          }
-        }
-      }
-    },
-    created() {
-      if (this.isEdit) {
-        // this.handleEditCreated();
-      } else {
-        fetchMemberLevelList({defaultStatus: 0}).then(response => {
-          let memberPriceList = [];
-          for (let i = 0; i < response.data.length; i++) {
-            let item = response.data[i];
-            memberPriceList.push({memberLevelId: item.id, memberLevelName: item.name})
-          }
-          this.value.memberPriceList = memberPriceList;
-        });
-      }
-    },
-    computed: {
-      //选中的服务保证
-      selectServiceList: {
-        get() {
-          let list = [];
-          if (this.value.serviceIds === undefined || this.value.serviceIds == null || this.value.serviceIds === '') return list;
-          let ids = this.value.serviceIds.split(',');
-          for (let i = 0; i < ids.length; i++) {
-            list.push(Number(ids[i]));
-          }
-          return list;
-        },
-        set(newValue) {
-          let serviceIds = '';
-          if (newValue != null && newValue.length > 0) {
-            for (let i = 0; i < newValue.length; i++) {
-              serviceIds += newValue[i] + ',';
-            }
-            if (serviceIds.endsWith(',')) {
-              serviceIds = serviceIds.substr(0, serviceIds.length - 1)
-            }
-            this.value.serviceIds = serviceIds;
-          } else {
-            this.value.serviceIds = null;
-          }
-        }
-      }
-    },
-    methods: {
-      handleEditCreated() {
-        let ids = this.value.serviceIds.split(',');
-        console.log('handleEditCreated', ids);
-        for (let i = 0; i < ids.length; i++) {
-          this.selectServiceList.push(Number(ids[i]));
-        }
-      },
-      handleRemoveProductLadder(index, row) {
-        let productLadderList = this.value.productLadderList;
-        if (productLadderList.length === 1) {
-          productLadderList.pop();
-          productLadderList.push({
-            count: 0,
-            discount: 0,
-            price: 0
-          })
-        } else {
-          productLadderList.splice(index, 1);
-        }
-      },
-      handleAddProductLadder(index, row) {
-        let productLadderList = this.value.productLadderList;
-        if (productLadderList.length < 3) {
-          productLadderList.push({
-            count: 0,
-            discount: 0,
-            price: 0
-          })
-        } else {
-          this.$message({
-            message: '最多只能添加三条',
-            type: 'warning'
-          });
-        }
-      },
-      handleRemoveFullReduction(index, row) {
-        let fullReductionList = this.value.productFullReductionList;
-        if (fullReductionList.length === 1) {
-          fullReductionList.pop();
-          fullReductionList.push({
-            fullPrice: 0,
-            reducePrice: 0
-          });
-        } else {
-          fullReductionList.splice(index, 1);
-        }
-      },
-      handleAddFullReduction(index, row) {
-        let fullReductionList = this.value.productFullReductionList;
-        if (fullReductionList.length < 3) {
-          fullReductionList.push({
-            fullPrice: 0,
-            reducePrice: 0
-          });
-        } else {
-          this.$message({
-            message: '最多只能添加三条',
-            type: 'warning'
-          });
-        }
-      },
-      handlePrev() {
-        this.$emit('prevStep')
-      },
-      handleNext() {
-        this.$emit('nextStep')
-      }
-    }
-  }
-</script>
-
-<style scoped>
-  .littleMargin {
-    margin-top: 10px;
-  }
-</style>

+ 17 - 6
src/views/pms/product/index.vue

@@ -166,11 +166,11 @@
         :total="total">
       </el-pagination>
     </div>
-
+    <importDialog ref="importDialog" @downLoad="downLoad"></importDialog>
   </div>
 </template>
 <script>
-
+  import importDialog from '../components/importDialog.vue';
   const defaultListQuery = {
     name: null,
     current: 1,
@@ -180,7 +180,11 @@
     productCategoryIds : null,
     bestSellingBrand : null
   };
+
   export default {
+    components:{
+      importDialog
+    },
     name: "productList",
     data() {
       return {
@@ -267,14 +271,16 @@
         //查询产品类别
         getProductCateList(parentId,fn) {
           var params = {
-            current:1,
-            size:100000,
             parentId:parentId
           }
           this.$api.queryCategory(params).then(response => {
             let list = response.data.data;
             // this.productCateOptions = list
-            fn(list)
+            if(list.length>0){
+              fn(list)
+            }else{
+              fn(null)
+            }
           });
         },
 
@@ -289,7 +295,12 @@
         this.$router.push({path:'/pms/addProduct'});
       },
       //导入爆款产品
-      handleImportProduct(){},
+      handleImportProduct(){
+        this.$refs.importDialog.open(2)
+      },
+      downLoad(){
+        
+      },
       //批量操作
       handleBatchOperate() {
         if(this.operateType==null){

+ 16 - 4
src/views/pms/productCate/components/ProductCateDetail.vue

@@ -102,8 +102,14 @@
           id:this.productCateId
         }
         this.$api.selectCategoryDetail(params).then(response => {
-          this.productCate = response.data.data;
-          this.files = response.data.data.systemFileList
+          this.productCate = response.data;
+          this.files = response.data.systemFileList||[]
+          if(response.data.path){
+            var arr = response.data.path.split('/')
+            arr.pop()
+            this.$set(this,'parentId',arr.map(item=>parseInt(item)))
+          }
+
         });
       },
       //获取文件
@@ -162,7 +168,12 @@
             //   list.unshift({id: 0, name: '无上级类别'})
             // }
             // this.productCateOptions = list
-            fn(list)
+            if(list.length>0){
+              fn(list)
+            }else{
+              fn(null)
+            }
+
           });
 
       },
@@ -223,7 +234,8 @@
       resetForm(formName) {
         this.$refs[formName].resetFields();
         this.productCate = Object.assign({}, defaultProductCate);
-
+        this.parentId=null,
+        this.files=[]
       },
 
 

+ 13 - 4
src/views/pms/productCate/index.vue

@@ -41,7 +41,7 @@
           <template slot-scope="scope">{{scope.row.level}}</template>
         </el-table-column>
         <el-table-column label="路径" align="center">
-          <template slot-scope="scope">{{scope.row.path}}</template>
+          <template slot-scope="scope">{{scope.row.echoPath}}</template>
         </el-table-column>
         <el-table-column label="关键词" align="center">
           <template slot-scope="scope">{{scope.row.searchCondition}}</template>
@@ -98,12 +98,17 @@
         :total="total">
       </el-pagination>
     </div>
+
+    <importDialog ref="importDialog" @downLoad="downLoad"></importDialog>
   </div>
 </template>
 
 <script>
-
+import importDialog from '../components/importDialog.vue';
   export default {
+    components:{
+      importDialog
+    },
     name: "productCateList",
     data() {
       return {
@@ -114,7 +119,7 @@
         listLoading: false,
         listQuery: {
           current: 1,
-          size: 5
+          size: 10
         },
         parentId: 0
       }
@@ -143,8 +148,12 @@
         this.$router.push('/pms/addProductCate');
       },
       //导入产品类别
-      handleImportProductCate(){},
+      handleImportProductCate(){
+        this.$refs.importDialog.open(1)
+      },
+      downLoad(){
 
+      },
       //获取产品类别列表
       getList() {
         var params = {