Ver Fonte

易码通商城

chenrui há 9 meses atrás
pai
commit
4373dcf634

+ 1 - 1
src/config/router.config.js

@@ -3598,7 +3598,7 @@ export const asyncRouterMap = [
                 }
               },
               {
-                path: 'chooseProduct',
+                path: 'chooseProduct/:sn',
                 name: 'chooseProductList',
                 component: () => import(/* webpackChunkName: "easyPassManagement" */ '@/views/easyPassManagement/shoppingManagement/chooseProduct.vue'),
                 meta: {

+ 2 - 1
src/views/easyPassManagement/shoppingManagement/addCategoryModal.vue

@@ -17,7 +17,7 @@
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol"
       >
-        <a-form-model-item label="父类名称" v-if="parentData&&parentData.categorySn">
+        <a-form-model-item label="父类名称" v-if="pageType==='addChild'&&parentData&&parentData.categorySn">
           {{ parentData&&parentData.categoryName ||'--' }}
         </a-form-model-item>
         <a-form-model-item label="上传图标" prop="iconUrl">
@@ -155,6 +155,7 @@ export default {
       shopCategoryDetail(ajaxData).then(res => {
         if (res.status == 200) {
           this.form = res.data
+          this.$refs.imageSet.setFileList(res.data.iconUrl)
         }
         this.spinning = false
       })

+ 15 - 333
src/views/easyPassManagement/shoppingManagement/chooseProduct.vue

@@ -8,375 +8,60 @@
             <a-icon type="left" />
             返回列表
           </a>
-          <span style="margin: 0 15px;color: #666;font-weight: bold;">类目名称:{{ detailsData&&detailsData.sparePartsNo }}</span>
+          <span style="margin: 0 15px;color: #666;font-weight: bold;">类目名称:{{ detailsData&&detailsData.categoryName }}</span>
         </template>
       </a-page-header>
       <a-card size="small" :bordered="false" class="chooseProductEdit-cont table-page-search-wrapper">
-        <!-- 搜索条件 -->
-        <div ref="tableSearch">
-          <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
-            <a-row :gutter="15">
-              <a-col :md="6" :sm="24">
-                <a-form-item label="产品名称">
-                  <a-input id="productPricingList-name" v-model.trim="queryParam.name" allowClear placeholder="请输入产品名称"/>
-                </a-form-item>
-              </a-col>
-              <a-col :md="6" :sm="24">
-                <a-form-item label="产品编码/原厂编码">
-                  <a-input id="productPricingList-queryWord" v-model.trim="queryParam.queryWord" allowClear placeholder="请输入产品编码/原厂编码"/>
-                </a-form-item>
-              </a-col>
-              <a-col :md="6" :sm="24">
-                <a-form-item label="品牌">
-                  <ProductBrand id="productPricingList-productBrandSn" v-model="queryParam.productBrandSn"></ProductBrand>
-                </a-form-item>
-              </a-col>
-              <a-col :md="6" :sm="24">
-                <a-form-item label="产品分类">
-                  <ProductType id="productPricingList-productType" placeholder="请选择产品分类" @change="changeProductType" v-model="productType"></ProductType>
-                </a-form-item>
-              </a-col>
-              <a-col :md="6" :sm="24">
-                <a-form-item label="产品商城状态">
-                  <v-select code="ENABLE_FLAG" id="promotionRulesList-enabledFlag" v-model="queryParam.enabledFlag" allowClear placeholder="请选择产品商城状态"></v-select>
-                </a-form-item>
-              </a-col>
-              <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
-                <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="promotionRulesList-refresh">查询</a-button>
-                <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="promotionRulesList-reset">重置</a-button>
-              </a-col>
-            </a-row>
-          </a-form>
-        </div>
-        <!-- 操作按钮 -->
-        <div class="table-operator">
-          <a-button type="primary" @click="handleAddProduct">选择产品</a-button>
-          <span>
-            <a-button type="primary" class="button-info" @click="handleAdd">批量上架</a-button>
-            <a-button @click="handleAdd">批量下架</a-button>
-            <a-button type="primary" class="button-error" ghost @click="handleAdd">批量删除</a-button>
-            <span>已选1项</span>
-          </span>
-        </div>
-        <s-table
-          class="sTable fixPagination"
-          ref="table"
-          size="small"
-          :style="{ height: tableHeight+65+'px' }"
-          :rowKey="(record) => record.id"
-          :columns="columns"
-          :data="loadData"
-          :pageSize="30"
-          :row-selection="{ columnWidth: 40 }"
-          @rowSelection="rowSelectionFun"
-          :scroll="{ y: tableHeight-170 }"
-          :defaultLoadData="false"
-          bordered>
-          <!-- 产品编码 -->
-          <template slot="productCode" slot-scope="text, record">
-            <span style="padding-right: 15px;">{{ record.productCode }}</span>
-            <a-badge count="热" :number-style="{ zoom:'80%' }"></a-badge>
-          </template>
-          <!-- 操作 -->
-          <template slot="action" slot-scope="text, record">
-            <a-button
-              size="small"
-              type="link"
-              v-if="$hasPermissions('B_chooseProductEdit_edit')"
-              @click="handleAddEdit(record)"
-              class="button-info"
-              :id="'chooseProductEdit-edit-btn'+record.id">编辑</a-button>
-            <a-button
-              size="small"
-              type="link"
-              :loading="delLoading"
-              class="button-error"
-              v-if="$hasPermissions('B_chooseProductEdit_del')"
-              @click="handleDel(record)"
-              :id="'chooseProductEdit-del-btn'+record.id">删除</a-button>
-          </template>
-        </s-table>
+        <!-- 主要内容 -->
+        <main-content :itemCategorySn="$route.params.sn"></main-content>
       </a-card>
     </a-spin>
-    <!-- 编辑弹窗-->
-    <editProductModal
-      v-drag
-      :itemSn="itemSn"
-      :openModal="opeEditModal"
-      @ok="resetTable"
-      @close="opeEditModal=false" />
-    <!-- 添加产品 -->
-    <chooseProduct
-      ref="chooseProduct"
-      :chooseType="chooseTypeList"
-      :itemSn="$route.params.sn"
-      :openModal="showProModal"
-      @ok="addProductSuccess"
-      @close="closeProductModal"></chooseProduct>
   </div>
 </template>
 
 <script>
 import { commonMixin } from '@/utils/mixin'
 // 组件
-import { STable, VSelect } from '@/components'
-// import addModal from './addModal.vue'
-// import basicInfoModal from './basicInfoModal.vue'
-import chooseProduct from './chooseProductsModal.vue'
-import ProductType from '@/views/common/productType.js'
-import ProductBrand from '@/views/common/productBrand.js'
+import mainContent from '@/views/easyPassManagement/shoppingProducts/list'
 // 接口
-import { shopProductList } from '@/api/shopProduct'
-import { getThirdStockQty } from '@/api/salesNew'
+import { shopCategoryDetail } from '@/api/shopCategory'
 export default {
   name: 'ChooseProductEdit',
   mixins: [commonMixin],
-  components: { STable, VSelect, ProductType, ProductBrand, chooseProduct },
+  components: { mainContent },
   data () {
     return {
       spinning: false,
-      showDetail: true, // 是否显示基础信息
-      delLoading: false, // 删除loading
-      openAddModal: false, // 打开新增产品弹窗
-      openBasicInfoModal: false, // 打开编辑基础信息弹窗
-      openGuideModal: false, // 导入产品弹窗
-      detailsData: null, // 基础信息数据
-      addMoreLoading: false, // 防止多次添加  加载状态
-      loading: false, // 第三方库存按钮加载状态
-      opeEditModal: false, // 编辑弹窗
-      showProModal: false, // 选择产品弹窗
-      // 查询参数
-      productForm: {
-        productCode: '', // 产品编码
-        productName: '' // 产品名称
-      },
-      statisticsObj: undefined, // 统计明细
-      sparePartsSn: undefined, // 采购入库sn
-      itemSn: undefined, // 列表行 sn
-      itemObj: null, // 基础信息弹窗回显数据
-      queryParam: {
-        name: '',
-        queryWord: '', // 产品编码/原厂编码
-        productBrandSn: undefined, //  产品品牌
-        productTypeSn1: '', //  产品一级分类
-        productTypeSn2: '', //  产品二级分类
-        productTypeSn3: '' //  产品三级分类
-      },
-      productType: [],
-      rowSelectionInfo: null,
-      tableHeight: 0, // 表格高度
-      // 加载数据方法 必须为 Promise 对象
-      loadData: parameter => {
-        this.productForm.sparePartsSn = this.sparePartsSn
-        const parames = Object.assign(parameter, this.productForm)
-        // 获取列表数据  有分页
-        return shopProductList(parames).then(res => {
-          let data
-          if (res.status == 200) {
-            data = res.data
-            // 计算表格序号
-            const no = (data.pageNo - 1) * data.pageSize
-            for (var i = 0; i < data.list.length; i++) {
-              data.list[i].no = no + i + 1
-            }
-          }
-          return data
-        })
-      }
-    }
-  },
-  computed: {
-    // 列表表头配置
-    columns () {
-      const _this = this
-      const arr = [
-        { title: '序号', dataIndex: 'no', align: 'center', width: '4%' },
-        { title: '产品编码', dataIndex: 'productCode', width: '10%', align: 'center', scopedSlots: { customRender: 'productCode' } },
-        { title: '产品名称', dataIndex: 'productName', width: '15%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '原厂编码', dataIndex: 'unit', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
-        { title: '品牌', dataIndex: 'unit', align: 'center', width: '7%', customRender: function (text) { return text || '--' } },
-        { title: '产品分类', dataIndex: 'unit', align: 'center', width: '7%', customRender: function (text) { return text || '--' } },
-        { title: '售价', dataIndex: 'productCost', width: '7%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } },
-        { title: '售价类型', dataIndex: 'unit', align: 'center', width: '7%', customRender: function (text) { return text || '--' } },
-        { title: '终端价', dataIndex: 'productCost', width: '7%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } },
-        { title: '车主价', dataIndex: 'productCost', width: '7%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } },
-        { title: '优先级', dataIndex: 'unit', align: 'center', width: '7%', customRender: function (text) { return text || '--' } },
-        { title: '添加时间', dataIndex: 'unit', align: 'center', width: '7%', customRender: function (text) { return text || '--' } },
-        { title: '产品商城状态', dataIndex: 'unit', align: 'center', width: '9%', customRender: function (text) { return text || '--' } },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
-      ]
-      // if (this.$hasPermissions('M_chooseProductEdit_costPrice')) {
-      //   arr.splice(6, 0, { title: '采购单价', dataIndex: 'productCost', width: '8%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } })
-      //   if (this.detailsData && this.detailsData.supplierName) {
-      //     arr.splice(7, 0, { title: '采购金额', dataIndex: 'subtotal', width: '8%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } })
-      //   } else {
-      //     arr.splice(7, 0, { title: '采购金额', dataIndex: 'subtotal', width: '8%', align: 'right', customRender: function (text) { return text || '--' } })
-      //   }
-      // }
-      return arr
-    },
-    // 计算选中数据条数
-    selectCount () {
-      return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length
+      detailsData: null, // 类目详情
+      tableHeight: 0 // 表格高度
     }
   },
   methods: {
-    // 表格选中项
-    rowSelectionFun (obj) {
-      this.rowSelectionInfo = obj || null
-    },
-    // 添加产品
-    handleAddProduct () {
-      this.showProModal = true
-    },
-    // 新增产品成功 刷新基础信息时间,防止重复提交
-    handleAddOk () {
-      this.pageInit()
-    },
-    // 第三方库存
-    handleThirdQty () {
-      const params = {
-        sparePartsSn: this.sparePartsSn
-      }
-      getThirdStockQty(params).then(res => {
-        if (res.status == 200) {
-          this.handleAddOk(true)
-        }
-      })
-    },
-    // 导入产品
-    hanldleImportOk (listCon) {
-      this.spinning = true
-      purchaseImportBatchInsert(listCon).then(res => {
-        if (res.status == 200) {
-          this.$message.success('导入成功')
-          this.handleAddOk()
-        }
-        this.spinning = false
-      })
-    },
-    // 编辑基础信息
-    handleEditBase () {
-      this.itemObj = { dealerName: this.detailsData.lockBizDealerName, lockBizNo: this.detailsData.lockBizNo, bizRemark: this.detailsData.bizRemark }
-      this.openBasicInfoModal = true
-    },
     //  返回列表并刷新
     handleBack () {
-      this.$router.push({ name: 'purchaseReceiptList', query: { closeLastOldTab: true } })
-    },
-    // 新增/编辑产品
-    handleAddEdit (row) {
-      // if (this.detailsData && !this.detailsData.supplierName) {
-      //   this.$message.warning('供应商不能为空,请先编辑基础信息!')
-      //   return
-      // }
-      // this.itemSn = (row && row.sparePartsDetailSn) ? row.sparePartsDetailSn : null
-      this.openEditModal = true
+      this.$router.push({ name: 'shoppingManagementList', query: { closeLastOldTab: true } })
     },
-    // 导入产品
-    handleImport () {
-      this.openGuideModal = true
-    },
-    // 删除所选产品
-    handleDel (row) {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '确认删除产品吗?',
-        centered: true,
-        closable: true,
-        onOk () {
-          _this.delLoading = true
-          _this.spinning = true
-          purchaseDetailDel({ sn: row.sparePartsDetailSn })
-            .then(res => {
-              if (res.status == 200) {
-                _this.resetTable()
-              }
-              _this.$message.info(res.message)
-              _this.delLoading = false
-              _this.spinning = false
-            })
-            .catch(err => {
-              _this.$message.info(err.message)
-              _this.delLoading = false
-            })
-        }
-      })
-    },
-    // 刷新列表  更新操作时间
-    resetTable () {
-      this.opeEditModal = false
-      this.$refs.table.refresh(true)
-    },
-    //  重置
-    resetSearchForm () {
-      this.queryParam.name = ''
-      this.queryParam.queryWord = ''
-      this.queryParam.productBrandSn = undefined
-      this.queryParam.productTypeSn1 = ''
-      this.queryParam.productTypeSn2 = ''
-      this.queryParam.productTypeSn3 = ''
-      this.productType = []
-      this.$refs.table.refresh(true)
-    },
-    // 提交采购入库
-    handleSubmit (data) {
+    // 获取目录详情
+    getCategoryDetail () {
       this.spinning = true
-      purchaseSubmit({ sn: this.sparePartsSn }).then(res => {
+      shopCategoryDetail({ categorySn: this.$route.params.sn }).then(res => {
         if (res.status == 200) {
-          this.handleBack()
-          this.$message.success(res.message)
+          this.detailsData = res.data || {}
         }
         this.spinning = false
       })
-    },
-    // 初始化
-    pageInit () {
-      this.sparePartsSn = this.$route.query.sn
-      this.$nextTick(() => {
-        this.resetSearchForm()
-        this.setTableH()
-      })
-    },
-    // 计算表格高度
-    setTableH () {
-      const headHeight = this.$refs.tableSearch.offsetHeight
-      this.tableHeight = window.innerHeight - headHeight - 280
-    },
-    // 获取页面统计数据
-    getStatisticsData (ajaxData) {
-      purchaseDetailPageCount(ajaxData).then(res => {
-        if (res.status == 200) {
-          if (res.data) {
-            this.statisticsObj = res.data
-          } else {
-            this.statisticsObj = null
-          }
-        }
-      })
-    },
-    // 获取基础信息
-    getBasicsData () {
-      queryDetailCount({ sn: this.sparePartsSn }).then(res => {
-        if (res.status == 200) {
-          this.detailsData = res.data
-        } else {
-          this.detailsData = null
-        }
-      })
     }
   },
   mounted () {
     if (!this.$store.state.app.isNewTab) {
       // 页签刷新时调用
-      this.pageInit()
+      this.getCategoryDetail()
     }
   },
   activated () {
     // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
     if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
-      this.pageInit()
+      this.getCategoryDetail()
     }
   },
   beforeRouteEnter (to, from, next) {
@@ -395,9 +80,6 @@ export default {
   }
   .chooseProductEdit-cont {
     margin-top: 6px;
-    .table-operator{
-      margin-bottom:6px;
-    }
   }
 }
 </style>

+ 3 - 24
src/views/easyPassManagement/shoppingManagement/chooseProductsModal.vue

@@ -102,7 +102,7 @@ import { STable } from '@/components'
 import ProductBrand from '@/views/common/productBrand.js'
 import productTypeAll from '@/views/common/productTypeAll.js'
 // 接口
-import { queryWaitingProductPage } from '@/api/promoActive'
+import { productList } from '@/api/product'
 export default {
   name: 'ChooseProductsModal',
   components: { STable, ProductBrand, productTypeAll },
@@ -158,9 +158,7 @@ export default {
         productType: [], // 产品分类
         productTypeSn1: '', //  产品一级分类
         productTypeSn2: '', //  产品二级分类
-        productTypeSn3: '', //  产品三级分类
-        hideProductSnList: [], // 已选中产品数据
-        productTypeSnList: []// 已选中分类数据
+        productTypeSn3: '' //  产品三级分类
       },
       disabled: false, //  查询、重置按钮是否可操作
       loading: false, //  表格加载中
@@ -182,10 +180,7 @@ export default {
         this.disabled = true
         this.spinning = true
         const params = Object.assign(parameter, this.queryParam)
-        params.hideProductSnList = this.chooseData
-        params.productTypeSnList = this.chooseType
-        params.promoActiveSn = this.itemSn
-        return queryWaitingProductPage(params).then(res => {
+        return productList(params).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
@@ -194,22 +189,6 @@ export default {
               data.list[i].no = no + i + 1
             }
             this.disabled = false
-            const _this = this
-            // 选中回显
-            if (_this.chooseProduct && _this.chooseProduct.length > 0) {
-              const selectedRows = []
-              let selectedRowKeys = []
-              data.list.forEach(item => {
-                const flag = _this.chooseProduct.includes(item.productSn)
-                if (flag) {
-                  selectedRows.push(item)
-                }
-              })
-              selectedRowKeys = _this.chooseProduct
-              _this.$nextTick(() => { // 页面渲染完成后的回调
-                _this.$refs.table.setTableSelected(selectedRowKeys, selectedRows) // 设置表格选中项
-              })
-            }
           }
           _this.spinning = false
           return data

+ 0 - 187
src/views/easyPassManagement/shoppingManagement/editProductModal.vue

@@ -1,187 +0,0 @@
-<template>
-  <a-modal
-    centered
-    class="edit-product-modal"
-    id="edit-product-modal"
-    :footer="null"
-    :maskClosable="false"
-    :title="编辑"
-    v-model="isShow"
-    @cancel="isShow = false"
-    :width="700">
-    <a-spin :spinning="spinning" tip="Loading...">
-      <a-form-model
-        id="edit-product-form"
-        ref="ruleForm"
-        :model="form"
-        :rules="rules"
-        :label-col="formItemLayout.labelCol"
-        :wrapper-col="formItemLayout.wrapperCol"
-      >
-        <a-form-model-item label="售价类型" prop="logo">
-          <v-select
-            v-model="queryParam.printStatus"
-            code="PRINT_STATUS"
-            placeholder="请选择售价类型"
-            allowClear
-            id="edit-product-printStatus"
-          ></v-select>
-        </a-form-model-item>
-        <a-form-model-item label="售价" prop="name">
-          <a-input-number
-            id="edit-product-price"
-            :min="0"
-            :max="999999999"
-            :precision="2"
-            :step="0.1"
-            placeholder="请输入产品售价" />
-        </a-form-model-item>
-        <a-form-model-item label="热销产品" prop="tip">
-          <v-select
-            v-model="queryParam.printStatus"
-            code="FlAG"
-            id="edit-product-printStatus"
-            placeholder="请选择是否是热销产品"
-            allowClear
-          ></v-select>
-        </a-form-model-item>
-        <a-form-model-item label="热销产品优先级" prop="tip">
-          <a-input-number
-            id="edit-product-money"
-            :min="0"
-            :max="999999999"
-            :precision="0"
-            :step="1"
-            placeholder="请输入正整数,数字越大优先级越低" />
-        </a-form-model-item>
-      </a-form-model>
-      <div class="btn-cont">
-        <a-button id="edit-product-modal-back" @click="isShow = false" style="margin-right: 15px;">取消</a-button>
-        <a-button type="primary" id="edit-product-modal-save" @click="handleSave">保存</a-button>
-      </div>
-    </a-spin>
-  </a-modal>
-</template>
-
-<script>
-import { commonMixin } from '@/utils/mixin'
-// 组件
-import { VSelect } from '@/components'
-// 接口
-import { promoRuleSave } from '@/api/promoRule'
-export default {
-  name: 'AddCategoryModal',
-  mixins: [commonMixin],
-  components: { VSelect },
-  props: {
-    openModal: {//  弹框显示状态
-      type: Boolean,
-      default: false
-    },
-    itemSn: {
-      type: String || Number,
-      default: ''
-    }
-  },
-  data () {
-    return {
-      spinning: false,
-      isShow: this.openModal, //  是否打开弹框
-      formItemLayout: {
-        labelCol: { span: 3 },
-        wrapperCol: { span: 20 }
-      },
-      form: {
-        name: '', //  促销类型
-        tip: '', //  正价品数量
-        logo: undefined //  促销品数量
-      },
-      // 必填项校验
-      rules: {
-        name: [{ required: true, message: '请选择促销类型', trigger: 'change' }],
-        tip: [{ required: true, message: '请输入正价品数量', trigger: 'blur' }],
-        logo: [{ required: true, message: '请输入促销品数量', trigger: 'blur' }]
-      }
-    }
-  },
-  methods: {
-    //  图片上传
-    changeImage (file) {
-      this.form.imageSet = file
-    },
-    //  保存
-    handleSave () {
-      const _this = this
-      //  处理表单校验
-      _this.form.normalGoodsList = this.normalGoodsList.length > 0 ? 'a' : ''
-      _this.form.promoGoodsList = this.promoGoodsList.length > 0 ? 'a' : ''
-      this.$refs.ruleForm.validate(valid => {
-        if (valid) {
-          const form = JSON.parse(JSON.stringify(_this.form))
-          form.normalGoodsList = this.normalGoodsList
-          form.promoGoodsList = this.promoGoodsList
-          form.promoActiveSn = this.$route.params.sn
-          if (form.promoRuleType == 'BUY_PROD_GIVE_MONEY' && form.promoType == 'promo_amount_per') { //  买产品送采购额  百分比
-            form.promoAmountPer = Number(form.promoAmountPer) / 100
-            form.orderAmounts = ''
-            form.promoAmount = ''
-          } else if (form.promoRuleType == 'BUY_PROD_GIVE_MONEY' && form.promoType == 'promo_amount') { //  买产品送采购额  金额
-            form.orderAmount = form.orderAmounts
-            form.promoAmountPer = ''
-          }
-          if (!_this.itemSn) { delete form.id }
-          _this.spinning = true
-          promoRuleSave(form).then(res => {
-            if (res.status == 200) {
-              _this.$message.success(res.message)
-              setTimeout(() => {
-                _this.$emit('ok')
-                _this.isShow = false
-                _this.spinning = false
-              }, 1000)
-            } else {
-              _this.spinning = false
-            }
-          })
-        } else {
-          console.log('error submit!!')
-          return false
-        }
-      })
-    }
-  },
-  watch: {
-    //  父页面传过来的弹框状态
-    openModal (newValue, oldValue) {
-      this.isShow = newValue
-    },
-    //  重定义的弹框状态
-    isShow (newValue, oldValue) {
-      if (!newValue) {
-        this.$emit('close')
-        // this.$refs.ruleForm.resetFields()
-      }
-    },
-    itemSn (newValue, oldValue) {
-      if (this.isShow && newValue) {
-        this.getDetail()
-      }
-    }
-  }
-}
-</script>
-
-<style lang="less">
-.edit-product-modal {
-	.ant-modal-body {
-		padding: 40px 40px 24px;
-	}
-	.btn-cont {
-		text-align: center;
-		margin: 35px 0 10px;
-	}
-  .ant-radio + span{
-    line-height: 40px;
-  }
-}
-</style>

+ 7 - 4
src/views/easyPassManagement/shoppingManagement/list.vue

@@ -43,18 +43,17 @@
             class="button-info"
             @click="handleEdit(record,'edit')"
             :id="'shoppingManagementList-edit-btn'+record.id">编辑</a-button>
+          <!-- v-if="record.type && record.type == 'root'" -->
           <a-button
             size="small"
             type="link"
             class="button-info"
-            v-if="record.type && record.type == 'root'"
             @click="handleEdit(record,'addChild')"
             :id="'shoppingManagementList-addChild-btn'+record.id">添加子类目</a-button>
           <a-button
             size="small"
             type="link"
             class="button-success"
-            v-else
             @click="handleAddProduct(record)"
             :id="'shoppingManagementList-addProduct-btn'+record.id">添加产品</a-button>
           <a-button
@@ -73,7 +72,7 @@
       :pageType="pageType"
       :openModal="openCategoryModal"
       :parentData="parentData"
-      @ok="$refs.table.refresh()"
+      @ok="handleCategoryOk"
       @close="openCategoryModal=false"></addCategoryModal>
   </a-card>
 </template>
@@ -128,6 +127,9 @@ export default {
       this.pageType = typeVal
       this.openCategoryModal = true
     },
+    handleCategoryOk () {
+      this.getTabData()
+    },
     // 编辑  添加子类目
     handleEdit (row, typeVal) {
       this.pageType = typeVal
@@ -165,7 +167,8 @@ export default {
     },
     // 添加产品
     handleAddProduct (row) {
-      this.$router.push({ name: 'chooseProductList', params: { sn: row.shopProductSn } })
+      debugger
+      this.$router.push({ name: 'chooseProductList', params: { sn: row.categorySn } })
     },
     // 删除
     handleDel (row) {

+ 1 - 1
src/views/easyPassManagement/shoppingProducts/editProductModal.vue

@@ -76,7 +76,7 @@ import { VSelect } from '@/components'
 // 接口
 import { shopProductDetail, shopProductSaveProduct } from '@/api/shopProduct'
 export default {
-  name: 'AddCategoryModal',
+  name: 'EditProductModal',
   mixins: [commonMixin],
   components: { VSelect },
   props: {

+ 72 - 42
src/views/easyPassManagement/shoppingProducts/list.vue

@@ -7,7 +7,7 @@
           <a-row :gutter="15">
             <a-col :md="6" :sm="24">
               <a-form-item label="产品名称">
-                <a-input id="shoppingProductsList-name" v-model.trim="queryParam.name" allowClear placeholder="请输入产品名称"/>
+                <a-input id="shoppingProductsList-name" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
@@ -27,12 +27,12 @@
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="产品商城状态">
-                <v-select code="ENABLE_FLAG" id="promotionRulesList-enabledFlag" v-model="queryParam.enabledFlag" allowClear placeholder="请选择产品商城状态"></v-select>
+                <v-select code="ENABLE_FLAG" id="shoppingProductsList-status" v-model="queryParam.status" allowClear placeholder="请选择产品商城状态"></v-select>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
-              <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="promotionRulesList-refresh">查询</a-button>
-              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="promotionRulesList-reset">重置</a-button>
+              <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="shoppingProductsList-refresh">查询</a-button>
+              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="shoppingProductsList-reset">重置</a-button>
             </a-col>
           </a-row>
         </a-form>
@@ -41,11 +41,12 @@
     <a-card size="small" :bordered="false">
       <!-- 操作按钮 -->
       <div class="table-operator">
-        <a-button type="primary" id="shoppingProductsList-name" @click="handleAddProduct">产品导入</a-button>
+        <a-button type="primary" id="shoppingProductsList-addProduct-btn" v-if="itemCategorySn" @click="handleChooseProduct">选择产品</a-button>
+        <a-button type="primary" v-else id="shoppingProductsList-import-btn" @click="handleAddProduct">产品导入</a-button>
         <span>
-          <a-button type="primary" id="shoppingProductsList-name" class="button-info" @click="changeStatus('1')">批量上架</a-button>
-          <a-button @click="changeStatus('0')">批量下架</a-button>
-          <a-button type="primary" class="button-error" id="shoppingProductsList-name" ghost @click="handleDel()">批量删除</a-button>
+          <a-button type="primary" id="shoppingProductsList-grounding-btn" class="button-info" @click="changeStatus('1')">批量上架</a-button>
+          <a-button @click="changeStatus('0')" id="shoppingProductsList-off-btn">批量下架</a-button>
+          <a-button type="primary" class="button-error" id="shoppingProductsList-delProduct-btn" ghost @click="handleDel()">批量删除</a-button>
           <span v-if="rowSelectionInfo&&rowSelectionInfo.selectedRowKeys.length>0">已选{{ rowSelectionInfo&&rowSelectionInfo.selectedRowKeys.length }}项</span>
         </span>
       </div>
@@ -54,7 +55,7 @@
         <s-table
           class="sTable fixPagination"
           ref="table"
-          :style="{ height: tableHeight+70+'px' }"
+          :style="{ height:itemCategorySn?(tableHeight-10+'px'):(tableHeight+70+'px')}"
           size="small"
           :rowKey="(record) => record.shopProductSn"
           rowKeyName="shopProductSn"
@@ -63,7 +64,7 @@
           :pageSize="20"
           :row-selection="{ columnWidth: 40}"
           @rowSelection="rowSelectionFun"
-          :scroll="{ y: tableHeight }"
+          :scroll="{ y: itemCategorySn?tableHeight-100:tableHeight }"
           :defaultLoadData="false"
           bordered>
           <!-- 产品编码 -->
@@ -95,6 +96,12 @@
         </s-table>
       </a-spin>
     </a-card>
+    <!-- 添加产品 -->
+    <chooseProduct
+      ref="chooseProduct"
+      :openModal="showProModal"
+      @ok="addProductSuccess"
+      @close="closeProductModal"></chooseProduct>
     <!-- 导入产品 -->
     <importGuideModal :openModal="openGuideModal" @close="openGuideModal=false" @ok="hanldeOk" />
     <!-- 编辑 -->
@@ -110,28 +117,38 @@ import importGuideModal from './importGuideModal.vue'
 import editProductModal from './editProductModal.vue'
 import productType from '@/views/common/productType.js'
 import productBrand from '@/views/common/productBrand.js'
+import chooseProduct from '@/views/easyPassManagement/shoppingManagement/chooseProductsModal'
 // 接口
 import { shopProductList, saveBatchProduct, shopProductDel, shopProductUpdateStatus } from '@/api/shopProduct'
 export default {
   name: 'ShoppingProductsList',
   mixins: [commonMixin],
-  components: { STable, VSelect, importGuideModal, editProductModal, productType, productBrand },
+  props: {
+    itemCategorySn: {// 当前行类目sn
+      type: String,
+      default: ''
+    }
+  },
+  components: { STable, VSelect, importGuideModal, editProductModal, productType, productBrand, chooseProduct },
   data () {
     const _this = this
     return {
       spinning: false,
-      tableHeight: 0,
+      tableHeight: 0, // 表格高度
       formItemLayout: {
         labelCol: { span: 6 },
         wrapperCol: { span: 16 }
       },
+      chooseTypeList: [],
+      showProModal: false,
       queryParam: {
-        name: '', // 产品名称
+        productName: '', // 产品名称
         queryWord: '', // 产品编码/原厂编码
         productBrandSn: undefined, //  产品品牌
         productTypeSn1: '', //  产品一级分类
         productTypeSn2: '', //  产品二级分类
-        productTypeSn3: '' //  产品三级分类
+        productTypeSn3: '', //  产品三级分类
+        status: undefined
       },
       disabled: false, //  查询、重置按钮是否可操作
       columns: [
@@ -155,6 +172,9 @@ export default {
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
+        if (this.itemCategorySn) {
+          this.queryParam.categorySn = this.itemCategorySn
+        }
         return shopProductList(Object.assign(parameter, this.queryParam)).then(res => {
           let data
           if (res.status == 200) {
@@ -182,27 +202,56 @@ export default {
     rowSelectionFun (obj) {
       this.rowSelectionInfo = obj || null
     },
+    // 选择产品
+    handleChooseProduct () {
+      this.showProModal = true
+    },
+    // 选择产品 成功
+    addProductSuccess (list) {
+      const _this = this
+      _this.spinning = true
+      const newList = list.map(item => {
+        return {
+          categorySn: _this.$route.params.sn,
+          productSn: item.productSn,
+          productCode: item.code,
+          priceType: 'TERMINAL_PRICE',
+          price: item.terminalPrice
+        }
+      })
+      _this.hanldeOk(newList)
+    },
+    // 关闭选择弹窗
+    closeProductModal () {
+      this.showProModal = false
+    },
     // 导入产品
     handleAddProduct () {
       this.openGuideModal = true
     },
-    // 批量审核
-    handleBatchAudit () {
-      const row = this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys
-      if (!this.rowSelectionInfo || (row.length < 1)) {
-        this.$message.warning('请在列表中进行勾选!')
-        return false
-      }
-      this.handleAudit(row)
+    // 导入产品成功
+    hanldeOk (list) {
+      const _this = this
+      _this.spinning = true
+      saveBatchProduct(list).then(res => {
+        if (res.status == 200) {
+          _this.$message.success(res.message)
+          _this.$nextTick(() => {
+            _this.$refs.table.refresh(true)
+          })
+        }
+        _this.spinning = false
+      })
     },
     //  重置
     resetSearchForm () {
-      this.queryParam.name = ''
+      this.queryParam.productName = ''
       this.queryParam.queryWord = ''
       this.queryParam.productBrandSn = undefined
       this.queryParam.productTypeSn1 = ''
       this.queryParam.productTypeSn2 = ''
       this.queryParam.productTypeSn3 = ''
+      this.queryParam.status = ''
       this.$refs.table.refresh(true)
     },
     // 编辑
@@ -285,25 +334,6 @@ export default {
         }
       })
     },
-    //  关闭弹框
-    closeModal () {
-      this.nowData = null
-      this.openModal = false
-    },
-    // 导入产品成功
-    hanldeOk (list) {
-      const _this = this
-      _this.spinning = true
-      saveBatchProduct(list).then(res => {
-        if (res.status == 200) {
-          _this.$message.success(res.message)
-          _this.$nextTick(() => {
-            _this.$refs.table.refresh(true)
-          })
-        }
-        _this.spinning = false
-      })
-    },
     pageInit () {
       const _this = this
       this.$nextTick(() => { // 页面渲染完成后的回调