Ver Fonte

产品管理

chenrui há 4 anos atrás
pai
commit
6e1dec0fbe

+ 61 - 0
src/api/dealerProduct.js

@@ -0,0 +1,61 @@
+import { axios } from '@/utils/request'
+
+//  产品列表  分页
+export const dealerProductList = (params) => {
+  const url = `/dealerProduct/findPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+//  产品列表  无分页
+export const dealerProductQuery = (params) => {
+  const url = `/dealerProduct/query`
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 新增/编辑产品
+export const dealerProductSave = params => {
+  return axios({
+    url: '/dealerProduct/save',
+    data: params,
+    method: 'post'
+  })
+}
+
+// 产品 更改状态
+export const dealerProductUpdate = params => {
+  return axios({
+    url: '/dealerProduct/updateStatus',
+    data: params,
+    method: 'post'
+  })
+}
+
+// 产品 导出
+export const dealerProductExport = params => {
+  return axios({
+    url: '/dealerProduct/export',
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}
+
+//  产品  详情
+export const dealerProductDetail = (params) => {
+  const url = `/dealerProduct/findById/${params.id}`
+  return axios({
+    url: url,
+    data: params,
+    method: 'get'
+  })
+}

+ 2 - 7
src/views/basicData/supplierManagement/edit.vue

@@ -148,11 +148,6 @@ export default {
       addrDistrictList: [] //  区下拉
     }
   },
-  computed: {
-    isEdit () {
-      return this.$route.name === 'supplierManagementEdit'
-    }
-  },
   methods: {
     //  获取供应商信息
     getGoodsDetail () {
@@ -170,7 +165,7 @@ export default {
         if (valid) {
           const form = values.form
           form.desc = _this.form.desc
-          form.id = this.isEdit ? this.$route.params.id : null
+          form.id = this.$route.params.id ? this.$route.params.id : null
           console.log(form,'-----提交信息')
           // goodsSave(form).then(res => {
           //   if (res.status == 200) {
@@ -247,7 +242,7 @@ export default {
     next(vm => {
       vm.getProvinceList()
       vm.$refs.ruleForm.resetFields()
-      if (vm.isEdit) { //  编辑页
+      if (vm.$route.params.id) { //  编辑页
         vm.getGoodsDetail()
       }
     })

+ 1 - 1
src/views/productManagement/productBrand/list.vue

@@ -130,7 +130,7 @@ export default {
       		_this.$message.success(res.message)
       		_this.$refs.table.refresh()
       	} else {
-      		record.enabledFlag = !record.enabledFlag
+      		_this.$refs.table.refresh()
       	}
       })
     },

+ 1 - 1
src/views/productManagement/productCategory/editModal.vue

@@ -22,7 +22,7 @@
           {{ parentType }}
         </a-form-model-item>
         <a-form-model-item label="产品类别名称" prop="productTypeName">
-          <a-input v-model.trim="form.productTypeName" id="productCategory-name" :maxLength="30" allowClear placeholder="请输入产品类别名称(最多30个字符)" />
+          <a-input v-model.trim="form.productTypeName" id="productCategoryEdit-name" :maxLength="30" allowClear placeholder="请输入产品类别名称(最多30个字符)" />
         </a-form-model-item>
       </a-form-model>
       <div class="btn-cont">

+ 1 - 1
src/views/productManagement/productCategory/list.vue

@@ -62,7 +62,7 @@ export default {
       },
       columns: [
         { title: '产品类别名称', dataIndex: 'productTypeName', width: 200, align: 'left' },
-        { title: '首字母', dataIndex: 'sss', width: 150, align: 'center' },
+        { title: '首字母', dataIndex: 'firstChar', width: 150, align: 'center' },
         { title: '创建时间', dataIndex: 'createDate', width: 150, align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: 150, align: 'center' }
       ],

+ 27 - 74
src/views/productManagement/productInfo/detailModal.vue

@@ -4,74 +4,32 @@
     class="productInfoDetail-modal"
     :footer="null"
     :maskClosable="false"
-    :title="modalTit"
+    title="产品详情"
     v-model="isShow"
     @cancle="isShow=false"
     width="80%">
     <!-- 产品详情 -->
-    <div>
-    <!-- <div v-if="detailsData"> -->
-      <a-row :gutter="35">
-        <a-col :span="8" class="item-cont">
-          <p class="item-label">产品名称:</p>
-          <p class="item-main">名称思密达</p>
-          <!-- <p class="item-main">{{ detailsData.name }}</p> -->
-        </a-col>
-        <a-col :span="8" class="item-cont">
-          <p class="item-label">产品编码:</p>
-          <p class="item-main">名称思密达</p>
-          <!-- <p class="item-main">{{ detailsData.name }}</p> -->
-        </a-col>
-        <a-col :span="8" class="item-cont">
-          <p class="item-label">原厂编码:</p>
-          <p class="item-main">名称思密达</p>
-          <!-- <p class="item-main">{{ detailsData.name }}</p> -->
-        </a-col>
-      </a-row>
-      <a-row :gutter="35">
-        <a-col :span="8" class="item-cont">
-          <p class="item-label">基本单位:</p>
-          <p class="item-main">陕西省西安市未央区凤城八路</p>
-          <!-- <p class="item-main">{{ detailsData.provinceName }}{{ detailsData.cityName }}{{ detailsData.districtName }}{{ detailsData.address }}</p> -->
-        </a-col>
-        <a-col :span="8" class="item-cont">
-          <p class="item-label">产品品牌:</p>
-          <p class="item-main">名称思密达</p>
-          <!-- <p class="item-main">{{ detailsData.name }}</p> -->
-        </a-col>
-        <a-col :span="8" class="item-cont">
-          <p class="item-label">产品类别:</p>
-          <p class="item-main">名称思密达</p>
-          <!-- <p class="item-main">{{ detailsData.name }}</p> -->
-        </a-col>
-      </a-row>
-      <a-row :gutter="35">
-        <a-col :span="8" class="item-cont">
-          <p class="item-label">经销批发价:</p>
-          <p class="item-main">名称思密达</p>
-          <!-- <p class="item-main">{{ detailsData.name }}</p> -->
-        </a-col>
-        <a-col :span="8" class="item-cont">
-          <p class="item-label">终端价:</p>
-          <p class="item-main">名称思密达</p>
-          <!-- <p class="item-main">{{ detailsData.name }}</p> -->
-        </a-col>
-        <a-col :span="8" class="item-cont">
-          <p class="item-label">车主价:</p>
-          <p class="item-main">名称思密达</p>
-          <!-- <p class="item-main">{{ detailsData.name }}</p> -->
-        </a-col>
-      </a-row>
+    <div v-if="detailsData">
+      <a-descriptions bordered size="default">
+        <a-descriptions-item label="产品名称:">{{ detailsData.productName || '--' }}</a-descriptions-item>
+        <a-descriptions-item label="产品编码:">{{ detailsData.productCode || '--' }}</a-descriptions-item>
+        <a-descriptions-item label="原厂编码:">{{ detailsData.origCode || '--' }}</a-descriptions-item>
+        <a-descriptions-item label="基本单位:">{{ detailsData.unit || '--' }}</a-descriptions-item>
+        <a-descriptions-item label="产品品牌:">{{ detailsData.productBrandName || '--' }}</a-descriptions-item>
+        <a-descriptions-item label="产品类别:">{{ productTypeName || '--' }}</a-descriptions-item>
+        <a-descriptions-item label="经销批发价:">{{ (detailsData.wholesalePrice || detailsData.wholesalePrice==0) ? detailsData.wholesalePrice : '--' }}</a-descriptions-item>
+        <a-descriptions-item label="终端价:">{{ (detailsData.terminalPrice || detailsData.terminalPrice==0) ? detailsData.terminalPrice : '--' }}</a-descriptions-item>
+        <a-descriptions-item label="车主价:">{{ (detailsData.carOwnerPrice || detailsData.carOwnerPrice==0) ? detailsData.carOwnerPrice : '--' }}</a-descriptions-item>
+      </a-descriptions>
       <div class="btn-cont"><a-button id="product-management-detail-modal-back" @click="isShow = false">返回列表</a-button></div>
     </div>
   </a-modal>
 </template>
 
 <script>
-import { STable } from '@/components'
+import { dealerProductDetail } from '@/api/dealerProduct'
 export default {
   name: 'productInfoDetailModal',
-  components: { STable },
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
@@ -83,20 +41,29 @@ export default {
     }
   },
   computed: {
-    modalTit () {
-      return '产品详情'
+    productTypeName () {
+      const productTypeName1 = this.detailsData.productTypeName1 ? this.detailsData.productTypeName1 : ''
+      const productTypeName2 = this.detailsData.productTypeName2 ? ' > ' + this.detailsData.productTypeName2 : ''
+      const productTypeName3 = this.detailsData.productTypeName3 ? ' > ' + this.detailsData.productTypeName3 : ''
+      return productTypeName1 + productTypeName2 + productTypeName3
     }
   },
   data () {
     return {
       isShow: this.openModal, //  是否打开弹框
-      detailsData: null, //  网点数据
+      detailsData: null, //  详情数据
     }
   },
   methods: {
     //  获取详情
     getDetail(){
-      
+      dealerProductDetail({ id: this.itemId }).then(res => {
+        if (res.status == 200) {
+          this.detailsData = res.data
+        }else{
+          this.detailsData = null
+        }
+      })
     }
   },
   watch: {
@@ -124,20 +91,6 @@ export default {
     .ant-modal-body {
     	padding: 40px 40px 24px;
     }
-    .item-cont {
-    	margin-bottom: 15px;
-    	display: flex;
-    	.item-label {
-    		width: 115px;
-    		font-size: 14px;
-    		color: rgba(0, 0, 0, 0.85);
-    		flex-shrink: 0;
-    	}
-    	.item-main {
-    		flex-grow: 1;
-        word-break: break-all;
-    	}
-    }
     .btn-cont {
     	text-align: center;
     	margin: 35px 0 10px;

+ 83 - 100
src/views/productManagement/productInfo/edit.vue

@@ -8,60 +8,52 @@
       :label-col="formItemLayout.labelCol"
       :wrapper-col="formItemLayout.wrapperCol"
     >
-      <a-form-model-item label="产品名称" prop="name">
+      <a-form-model-item label="产品名称" prop="productName">
         <a-input
-          id="productInfoEdit-name"
+          id="productInfoEdit-productName"
           :maxLength="30"
-          v-model="form.name"
+          v-model="form.productName"
           placeholder="请输入产品名称(最多30个字符)"
           allowClear />
       </a-form-model-item>
-      <a-form-model-item label="产品编码" prop="contactName">
+      <a-form-model-item label="产品编码" prop="productCode">
         <a-input
-          id="productInfoEdit-contactName"
+          id="productInfoEdit-productCode"
           :maxLength="30"
-          :disabled="isEdit"
-          v-model="form.contactName"
+          :disabled="!!$route.params.id"
+          v-model="form.productCode"
           placeholder="请输入产品编码(最多30个字符)"
           allowClear />
       </a-form-model-item>
-      <a-form-model-item label="原厂编码" prop="contactPhone">
+      <a-form-model-item label="原厂编码" prop="origCode">
         <a-input
-          id="productInfoEdit-contactPhone"
+          id="productInfoEdit-origCode"
           :maxLength="30"
-          v-model="form.contactPhone"
+          v-model="form.origCode"
           placeholder="请输入原厂编码(最多30个字符)"
           allowClear />
       </a-form-model-item>
-      <a-form-model-item label="基本单位" prop="contactPhone">
+      <a-form-model-item label="基本单位" prop="unit">
         <a-input
-          id="productInfoEdit-contactPhone"
+          id="productInfoEdit-unit"
           :maxLength="30"
-          v-model="form.contactPhone"
+          v-model="form.unit"
           placeholder="请输入基本单位(最多30个字符)"
           allowClear />
       </a-form-model-item>
-      <a-form-model-item label="辅助单位" prop="contactPhone">
-        <a-input
-          id="productInfoEdit-contactPhone"
-          :maxLength="30"
-          v-model="form.contactPhone"
-          placeholder="请输入辅助单位(最多30个字符)"
-          allowClear />
-      </a-form-model-item>
-      <a-form-model-item label="产品品牌" prop="productBrand">
-        <a-select placeholder="请输入名称或拼音查询,如果没有请点击 '+' 新增" :disabled="isEdit" allowClear v-model="form.productBrand" :showSearch="true" option-filter-prop="children" :filter-option="filterOption" style="width: 90%;">
-        	<a-select-option v-for="item in productBrandList" :key="item.id" :value="item.id">{{ item.productBrandName }}</a-select-option>
+      <a-form-model-item label="产品品牌" prop="productBrandSn">
+        <a-select id="productInfoEdit-productBrand" placeholder="请输入名称或拼音查询,如果没有请点击 '+' 新增" :disabled="!!$route.params.id" allowClear v-model="form.productBrandSn" :showSearch="true" option-filter-prop="children" :filter-option="filterOption" style="width: 90%;">
+        	<a-select-option v-for="item in productBrandList" :key="item.productBrandSn" :value="item.productBrandSn" :disabled="item.enabledFlag==0">{{ item.productBrandName }}</a-select-option>
         </a-select>
         <a-button @click="openModal=true" icon="plus" size="small" id="productInfoEdit-add-btn" style="margin-left: 5px;"></a-button>
       </a-form-model-item>
       <a-form-model-item label="产品类别" prop="productType">
-        <a-cascader @change="changeProductType" :options="productTypeList" :fieldNames="{ label: 'productTypeName', value: 'id', children: 'children' }" id="productInfoEdit-productType" placeholder="请选择产品类别" allowClear v-model="form.productType" />
+        <a-cascader :disabled="!!$route.params.id" @change="changeProductType" :options="productTypeList" :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }" id="productInfoEdit-productType" placeholder="请选择产品类别" allowClear v-model="form.productType" />
       </a-form-model-item>
-      <a-form-model-item label="经销批发价" prop="name">
+      <a-form-model-item label="经销批发价" prop="wholesalePrice">
         <a-input-number
-          id="productInfoEdit-districtCode"
-          v-model="form.goldNum"
+          id="productInfoEdit-wholesalePrice"
+          v-model="form.wholesalePrice"
           :min="0"
           :max="999999"
           :precision="2"
@@ -69,21 +61,21 @@
           placeholder="请输入经销批发价(0~999999)"
           allowClear /><span>元</span>
       </a-form-model-item>
-      <a-form-model-item label="终端价(原售价)" prop="name">
+      <a-form-model-item label="终端价" prop="terminalPrice">
         <a-input-number
-          id="productInfoEdit-districtCode"
-          v-model="form.goldNum"
+          id="productInfoEdit-terminalPrice"
+          v-model="form.terminalPrice"
           :min="0"
           :max="999999"
           :precision="2"
           style="width: 90%;margin-right: 5px;"
-          placeholder="请输入终端价(原售价)(0~999999)"
+          placeholder="请输入终端价(0~999999)"
           allowClear /><span>元</span>
       </a-form-model-item>
-      <a-form-model-item label="车主价" prop="name">
+      <a-form-model-item label="车主价" prop="carOwnerPrice">
         <a-input-number
-          id="productInfoEdit-districtCode"
-          v-model="form.goldNum"
+          id="productInfoEdit-carOwnerPrice"
+          v-model="form.carOwnerPrice"
           :min="0"
           :max="999999"
           :precision="2"
@@ -106,7 +98,7 @@ import { STable, VSelect } from '@/components'
 import productBrandEditModal from '../productBrand/editModal.vue'
 import { dealerProductBrandQuery } from '@/api/dealerProductBrand'
 import { dealerProductTypeQuery } from '@/api/dealerProductType'
-// import { goodsSave, goodsFind } from '@/api/goods'
+import { dealerProductSave, dealerProductDetail } from '@/api/dealerProduct'
 export default {
   name: 'productInfoEdit',
   components: { STable, VSelect, productBrandEditModal },
@@ -117,56 +109,50 @@ export default {
         wrapperCol: { span: 16 }
       },
       form: {
-        name: '', // 供应商名称
-        productType: undefined, //  产品类别
+        productName: '', // 产品名称
+        productCode: '',  //  产品编码
+        origCode: '',  //  原厂编码
+        unit: '',  //  基本单位
+        productBrandSn: undefined,  //  产品品牌
+        productTypeSn3: '',  //  产品三级类别
+        productType: [], //  产品类别
+        wholesalePrice: '',  //  经销价
+        terminalPrice: '',  //  终端价
+        carOwnerPrice: '',  //  车主价
       },
       rules: {
-        name: [
-          { required: true, message: '请输入供应商名称', trigger: 'blur' }
-        ],
-        provinceCode: [
-          { required: true, message: '请选择省', trigger: 'change' }
-        ],
-        cityCode: [
-          { required: true, message: '请选择市', trigger: 'change' }
-        ],
-        districtCode: [
-          { required: true, message: '请选择区/县', trigger: 'change' }
+        productName: [
+          { required: true, message: '请输入产品名称', trigger: 'blur' }
         ],
-        address: [
-          { required: true, message: '请输入详细地址', trigger: 'blur' }
+        productCode: [
+          { required: true, message: '请输入产品编码', trigger: 'blur' }
         ],
-        contactName: [
-          { required: true, message: '请输入联系人', trigger: 'blur' }
+        productBrandSn: [
+          { required: true, message: '请选择产品品牌', trigger: 'change' }
         ],
-        contactPhone: [
-          { required: true, message: '请输入联系人电话', trigger: 'blur' }
+        productType: [
+          { required: true, message: '请选择产品类别', trigger: 'change' }
         ],
-        state: [
-          { required: true, message: '请选择状态', trigger: 'change' }
-        ]
       },
-      addrProvinceList: [], //  省下拉
-      addrCityList: [], //  市下拉
-      addrDistrictList: [], //  区下拉
       productBrandList: [],  //  品牌下拉数据
       productTypeList: [],  //  类别下拉数据
       openModal: false,  //  新增编辑  弹框
     }
   },
-  computed: {
-    isEdit () {
-      return this.$route.name === 'productInfoEdit'
-    }
-  },
   methods: {
     //  获取供应商信息
     getGoodsDetail () {
-      // goodsFind({ id: this.$route.params.id }).then(res => {
-      //   if (res.status == 200) {
-      //     this.form = Object.assign(this.form, res.data)
-      //   }
-      // })
+      dealerProductDetail({ id: this.$route.params.id }).then(res => {
+        if (res.status == 200) {
+          this.form = Object.assign(this.form, res.data)
+          const productTypeSn1 = res.data.productTypeSn1 ? res.data.productTypeSn1 : ''
+          const productTypeSn2 = res.data.productTypeSn2 ? res.data.productTypeSn2 : ''
+          const productTypeSn3 = res.data.productTypeSn3 ? res.data.productTypeSn3 : ''
+          this.form.productType = [productTypeSn1, productTypeSn2, productTypeSn3]
+        }else{
+          this.$refs.ruleForm.resetFields()
+        }
+      })
     },
     //  保存
     handleSubmit (e) {
@@ -174,31 +160,31 @@ export default {
       const _this = this
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
-          const form = values.form
-          form.desc = _this.form.desc
-          form.id = this.isEdit ? this.$route.params.id : null
-          console.log(form,'-----提交信息')
-          // goodsSave(form).then(res => {
-          //   if (res.status == 200) {
-          //     _this.$message.success(res.message)
-          //     setTimeout(() => {
-          //       _this.$router.push({ path: '/shop/goods/list' })
-          //     }, 1000)
-          //   }
-          // })
+          const form = JSON.parse(JSON.stringify(_this.form))
+          form.id = _this.$route.params.id ? _this.$route.params.id : null
+          delete form.productType
+          dealerProductSave(form).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              setTimeout(() => {
+                _this.$router.push({ path: '/productManagement/productInfo/list' })
+              }, 1000)
+            }
+          })
         } else {
           console.log('error submit!!')
           return false
         }
       })
     },
+    //  产品类别  change
     changeProductType(val, opt){
-      console.log(val, opt)
-      console.log(this.form.productType)
+      this.form.productTypeSn3 = val[2] ? val[2] : ''
     },
     //  新增品牌  成功
     handleOk(){
       //  获取品牌数据列表,并赋值
+      this.getProductBrand('val')
     },
     filterOption(input, option) {
     	return (
@@ -210,10 +196,13 @@ export default {
       this.$router.push({ path: '/productManagement/productInfo/list' })
     },
     //  产品品牌  列表
-    getProductBrand(){
+    getProductBrand(val){
       dealerProductBrandQuery({}).then(res => {
         if(res.status == 200){
           this.productBrandList = res.data
+          if(val){  //  需将新增加的品牌回填到产品品牌的地方,即不需要用户再选一下
+            this.form.productBrandSn = this.productBrandList[0].productBrandSn
+          }
         }else{
           this.productBrandList = []
         }
@@ -230,21 +219,15 @@ export default {
       })
     },
   },
-  beforeRouteEnter (to, from, next) {
-    next(vm => {
-      vm.getProductBrand()
-      vm.getProductType()
-      vm.$refs.ruleForm.resetFields()
-      if (vm.isEdit) { //  编辑页
-        vm.getGoodsDetail()
-      }
-    })
+  mounted(){  // 不使用beforeRouteEnter:由于页面路由动态id导致页面表现方式不同但路由相同,则会出现数据不重新请求问题
+    this.getProductBrand()
+    this.getProductType()
+    this.$refs.ruleForm.resetFields()
+    if (this.$route.params.id) { //  编辑页
+      this.getGoodsDetail()
+    }
   }
 }
 </script>
 
-<style lang="less">
-  .productInfoEdit-table-page-wrapper{
-    
-  }
-</style>
+<style lang="less"></style>

+ 143 - 97
src/views/productManagement/productInfo/list.vue

@@ -6,41 +6,36 @@
         <a-row :gutter="15">
           <a-col :md="6" :sm="24">
             <a-form-item label="产品编码">
-              <a-input id="productInfoList-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="请输入产品编码"/>
+              <a-input id="productInfoList-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="24">
             <a-form-item label="产品名称">
-              <a-input id="productInfoList-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="请输入产品名称"/>
+              <a-input id="productInfoList-productName" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="24">
             <a-form-item label="原厂编码">
-              <a-input id="productInfoList-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="请输入原厂编码"/>
+              <a-input id="productInfoList-origCode" v-model.trim="queryParam.origCode" allowClear placeholder="请输入原厂编码"/>
             </a-form-item>
           </a-col>
           <template v-if="advanced">
             <a-col :md="6" :sm="24">
-            <a-form-item label="产品品牌">
-              <a-select placeholder="请选择" id="productInfoList-state" allowClear v-model="queryParam.dataSourceNo" :showSearch="true" option-filter-prop="children" :filter-option="filterOption">
-                <a-select-option v-for="item in brandData" :key="item.salesChannelNo" :value="item.salesChannelNo">{{ item.salesChannelName }}</a-select-option>
-              </a-select>
-            </a-form-item>
-            </a-col>
-            <a-col :md="6" :sm="24">
-            <a-form-item label="产品类别">
-              <a-cascader :options="typeData" id="productInfoList-state" placeholder="请选择产品类别" allowClear v-model="queryParam.brand" />
-            </a-form-item>
+              <a-form-item label="产品品牌">
+                <a-select placeholder="请选择" id="productInfoList-productBrandSn" allowClear v-model="queryParam.productBrandSn" :showSearch="true" option-filter-prop="children" :filter-option="filterOption">
+                  <a-select-option v-for="item in productBrandList" :key="item.productBrandSn" :value="item.productBrandSn">{{ item.productBrandName }}</a-select-option>
+                </a-select>
+              </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
-            <a-form-item label="状态">
-              <v-select code="CHECK_ENABLE_STATE" id="productInfoList-state" v-model="queryParam.state" allowClear placeholder="请选择状态"></v-select>
-            </a-form-item>
+              <a-form-item label="产品类别">
+                <a-cascader @change="changeProductType" change-on-select :options="productTypeList" :fieldNames="{ label: 'productTypeName', value: 'id', children: 'children' }" id="productInfoList-productType" placeholder="请选择产品类别" allowClear />
+              </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
-            <a-form-item label="产品来源">
-              <v-select code="CHECK_ENABLE_STATE" id="productInfoList-state" v-model="queryParam.state" allowClear placeholder="请选择产品来源"></v-select>
-            </a-form-item>
+              <a-form-item label="状态">
+                <v-select code="ENABLED_FLAG" id="productInfoList-enabledFlag" v-model="queryParam.enabledFlag" allowClear placeholder="请选择状态"></v-select>
+              </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
             <a-form-item label="创建时间">
@@ -48,7 +43,7 @@
                 style="width:100%"
                 id="customerManagementList-creatTime"
                 :disabledDate="disabledDate"
-                v-model="creatTime"
+                @change="creatTimechange"
                 :format="dateFormat"
                 :placeholder="['开始时间', '结束时间']" />
               </a-form-item>
@@ -71,7 +66,6 @@
     <div class="table-operator">
       <a-button id="productInfoList-add" type="primary" @click="handleEdit()">新增产品</a-button>
       <a-button id="productInfoList-import" @click="handleImport" style="margin: 0 15px;">批量导入产品</a-button>
-      <a-button id="productInfoList-state" @click="handleEditState">批量修改状态</a-button>
     </div>
     <!-- 列表 -->
     <s-table
@@ -82,16 +76,12 @@
       :columns="columns"
       :data="loadData"
       bordered>
-      <!-- 产品编码 -->
-      <template slot="productCode" slot-scope="text, record">
-        <a-badge count="箭是冠" :offset="[28,-10]" :number-style="{ backgroundColor: '#fff', color: '#ed1c24', boxShadow: '0 0 0 1px #d9d9d9 inset', }" > {{record.productCode}} </a-badge>
-      </template>
       <!-- 产品类别 -->
       <!-- 自定义表头 -->
       <template slot="productTypeCustomTitle">
         <a-tooltip placement="top">
           <template slot="title">
-            <span>列表中只显示第三级分类的名称,鼠标移动至文字上,查看上级分类</span>
+            <span>列表中只显示第三级分类的名称,鼠标移动至文字上,查看上级分类。“>”为分隔符</span>
           </template>
           产品类别<a-icon type="question-circle" :style="{ color: '#ed1c24', marginLeft: '10px' }" />
         </a-tooltip>
@@ -99,14 +89,20 @@
       <template slot="productType" slot-scope="text, record">
         <a-tooltip placement="top">
           <template slot="title">
-            <span>{{record.productType}}</span>
+            <span>{{record.productTypeName}}</span>
           </template>
-          {{record.productType}}
+          {{record.productTypeName3}}
         </a-tooltip>
       </template>
       <!-- 状态 -->
-      <template slot="state" slot-scope="text, record">
-        <span>{{record.state == 1 ? '已启用' : '已禁用'}}</span>
+      <template slot="enabledFlag" slot-scope="text, record">
+        <a-switch
+          id="productBrandList-enable"
+          checkedChildren="启用"
+          unCheckedChildren="禁用"
+          @change="changeStatus(record)"
+          :checked="record.enabledFlag == 1 ? true : false" />
+        <!-- <span :class="record.enabledFlag==1?'green':'red'" v-else> {{ record.enabledFlag==1? '已启用': '已禁用' }} </span> -->
       </template>
       <!-- 操作 -->
       <template slot="action" slot-scope="text, record">
@@ -121,7 +117,9 @@
 
 <script>
 import moment from 'moment'
-// import { customerBundleDelayList, customerBundleExportDelay } from '@/api/FinancialManagement'
+import { dealerProductBrandQuery } from '@/api/dealerProductBrand'
+import { dealerProductTypeQuery } from '@/api/dealerProductType'
+import { dealerProductList, dealerProductUpdate, dealerProductExport } from '@/api/dealerProduct'
 import { STable, VSelect } from '@/components'
 import productInfoDetailModal from './detailModal.vue'
 export default {
@@ -130,58 +128,53 @@ export default {
     return {
       advanced: false,  // 高级搜索 展开/关闭
       queryParam: { //  查询条件
-        bundleName: '', //  供应商名称
-        state: undefined,  //  状态
+        productCode: '',  //  产品编码
+        productName: '', //  产品名称
+        origCode: '',  //  原厂编码
+        productBrandSn: undefined,  //  产品品牌
+        productTypeSn1: '',  //  产品一级类别
+        productTypeSn2: '',  //  产品二级类别
+        productTypeSn3: '',  //  产品三级类别
+        enabledFlag: undefined,  //  状态
+        beginDate: '',  //  创建时间  开始时间
+        endDate: '',  //  创建时间  结束时间
       },
       disabled: false, //  查询、重置按钮是否可操作
       exportLoading: false, // 导出loading
-      brandData: [],  //  下拉数据
-      typeData: [],  //  产品类别  下拉数据
       dateFormat: 'YYYY-MM-DD',
-      creatTime: [],  //  创建时间
       columns: [
         { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
-        { title: '产品编码', scopedSlots: { customRender: 'productCode' }, width: 200, align: 'center' },
-        { title: '产品名称', dataIndex: 'productOldNum', width: 160, align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
-        { title: '原厂编码', dataIndex: 'productBrand', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品品牌', dataIndex: 'productType', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productCode', width: 200, align: 'center' },
+        { title: '产品名称', dataIndex: 'productName', width: 160, align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
+        { title: '原厂编码', dataIndex: 'origCode', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品品牌', dataIndex: 'productBrandName', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
         { slots: { title: 'productTypeCustomTitle' }, scopedSlots: { customRender: 'productType' }, width: 180, align: 'center' },
-        { title: '终端价(售价)', dataIndex: 'inventoryMoney', width: 180, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '创建时间', dataIndex: 'createTime', width: 180, align: 'center' },
-        { title: '状态', scopedSlots: { customRender: 'state' }, width: 180, align: 'center' },
+        { title: '终端价', dataIndex: 'terminalPrice', width: 180, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '创建时间', dataIndex: 'createDate', width: 180, align: 'center' },
+        { title: '状态', scopedSlots: { customRender: 'enabledFlag' }, width: 180, align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: 240, align: 'center' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
-        // return customerBundleDelayList( Object.assign(parameter, this.queryParam) ).then(res => {
-        //   const 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
-        //   }
-        //   this.disabled = false
-        //   return data
-        // })
-        const _this = this
-        return new Promise(function(resolve, reject){
-          const data = {
-            pageNo: 1,
-            pageSize: 10,
-            list: [
-              { id: '1', productCode: '产品编码12', productNum: 'jgqp11111111111', productName: '产品1', productOldNum: 'jgqp111123545', productBrand: '箭冠品牌', productType: '产品分类1', inventoryNum: '5', inventoryMoney: '122' }
-            ]
-          }
+        return dealerProductList( Object.assign(parameter, this.queryParam) ).then(res => {
+          const 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
+            const productTypeName1 = data.list[i].productTypeName1 ? data.list[i].productTypeName1 : ''
+            const productTypeName2 = data.list[i].productTypeName2 ? ' > ' + data.list[i].productTypeName2 : ''
+            const productTypeName3 = data.list[i].productTypeName3 ? ' > ' + data.list[i].productTypeName3 : ''
+            data.list[i].productTypeName = productTypeName1 + productTypeName2 + productTypeName3
           }
-          _this.disabled = false
-          resolve(data)
+          this.disabled = false
+          return data
         })
       },
       openModal: false,  //  查看客户详情  弹框
-      itemId: ''  //  当前产品id
+      itemId: '',  //  当前产品id
+      productBrandList: [],  //  品牌下拉数据
+      productTypeList: [],  //  类别下拉数据
     }
   },
   methods: {
@@ -189,30 +182,37 @@ export default {
     disabledDate (date, dateStrings) {
       return date && date.valueOf() > Date.now()
     },
+    //  创建时间  change
+    creatTimechange(dates, dateStrings){
+      this.queryParam.beginDate = dateStrings[0]
+      this.queryParam.endDate = dateStrings[1]
+    },
     //  重置
     resetSearchForm () {
-      this.queryParam.orderBundleNo = ''
-      this.queryParam.orderBundle.custMobile = ''
-      this.queryParam.bundleName = ''
-      this.queryParam.itemName = ''
-      this.oldTime = undefined
-      this.newTime = undefined
+      this.queryParam.productCode = ''
+      this.queryParam.productName = ''
+      this.queryParam.origCode = ''
+      this.queryParam.productBrandSn = undefined
+      this.queryParam.productTypeSn1 = ''
+      this.queryParam.productTypeSn2 = ''
+      this.queryParam.productTypeSn3 = ''
+      this.queryParam.enabledFlag = undefined
+      this.queryParam.beginDate = ''
+      this.queryParam.endDate = ''
       this.$refs.table.refresh(true)
     },
-	//  新增/编辑
-	handleEdit(row){
-	  if(row){  //  编辑
-	    this.$router.push({ path: `/productManagement/productInfo/edit/${row.id}` })
-	  }else{  //  新增
-	    this.$router.push({ path: '/productManagement/productInfo/add' })
-	  }
-	},
+    //  新增/编辑
+    handleEdit(row){
+      if(row){  //  编辑
+        this.$router.push({ path: `/productManagement/productInfo/edit/${row.id}` })
+      }else{  //  新增
+        this.$router.push({ path: '/productManagement/productInfo/add' })
+      }
+    },
     //  批量导入
     handleImport(){
       
     },
-    //  批量修改
-    handleEditState(){},
     filterOption(input, option) {
     	return (
     		option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
@@ -228,25 +228,45 @@ export default {
       this.itemId = ''
       this.openModal = false
     },
-    //  导出
-    handleExport () {
-      const params = this.queryParam
-      if (this.oldTime && this.oldTime.length > 0) {
-        params.beginOldExpiryDate = moment(this.oldTime[0]).format('YYYY-MM-DD')
-        params.endOldExpirydDate = moment(this.oldTime[1]).format('YYYY-MM-DD')
+    //  产品类别  change
+    changeProductType(val, opt){
+      this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
+      this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
+      this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
+    },
+    // 启用 禁用
+    changeStatus (record) {
+      if (record.enabledFlag=='1') {
+        this.$confirm({
+          title: '提示',
+          content: '产品被禁用后,不能再销售,确定禁用吗?',
+          onOk: () => {
+            this.setEnable(record)
+          }
+        })
       } else {
-        params.beginOldExpiryDate = ''
-        params.endOldExpirydDate = ''
+        this.setEnable(record)
       }
-      if (this.newTime && this.newTime.length > 0) {
-        params.beginDate = moment(this.newTime[0]).format('YYYY-MM-DD')
-        params.endDate = moment(this.newTime[1]).format('YYYY-MM-DD')
-      } else {
-        params.beginDate = ''
-        params.endDate = ''
+    },
+    // 启用 禁用
+    setEnable (record) {
+      const params = {
+        id: record.id,
+        enabledFlag: record.enabledFlag == 1 ? '0' : '1'
       }
+      dealerProductUpdate(params).then(res => {
+        if (res.status == 200) {
+          this.$message.success(res.message)
+          this.$refs.table.refresh()
+        } else {
+          this.$refs.table.refresh()
+        }
+      })
+    },
+    //  导出
+    handleExport () {
       this.exportLoading = true
-      customerBundleExportDelay(params).then(res => {
+      dealerProductExport(this.queryParam).then(res => {
         this.exportLoading = false
         this.download(res)
       })
@@ -258,11 +278,37 @@ export default {
       link.style.display = 'none'
       link.href = url
       const a = moment().format('YYYYMMDDHHmmss')
-      const fname = '产品信息表' + a
+      const fname = '自建产品列表' + a
       link.setAttribute('download', fname + '.xlsx')
       document.body.appendChild(link)
       link.click()
-    }
+    },
+    //  产品品牌  列表
+    getProductBrand(){
+      dealerProductBrandQuery({}).then(res => {
+        if(res.status == 200){
+          this.productBrandList = res.data
+        }else{
+          this.productBrandList = []
+        }
+      })
+    },
+    //  产品类别  列表
+    getProductType(){
+      dealerProductTypeQuery({}).then(res => {
+        if(res.status == 200){
+          this.productTypeList = res.data
+        }else{
+          this.productTypeList = []
+        }
+      })
+    },
+  },
+  beforeRouteEnter(to, from, next) {
+  	next(vm => {
+  		vm.getProductBrand()
+  		vm.getProductType()
+  	})
   }
 }
 </script>