浏览代码

类目搜索

chenrui 9 月之前
父节点
当前提交
f550aadd5a
共有 2 个文件被更改,包括 41 次插入18 次删除
  1. 12 0
      src/api/shopProduct.js
  2. 29 18
      src/views/numsGoodsShelves/easyPassShopping/index.vue

+ 12 - 0
src/api/shopProduct.js

@@ -37,3 +37,15 @@ export const updateMallParam = (params) => {
     }
   })
 }
+
+// 商城目录 列表  无分页
+export const queryExtList = (params) => {
+  return axios({
+    url: '/shopCategory/queryExtList',
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('商城目录列表')
+    }
+  })
+}

+ 29 - 18
src/views/numsGoodsShelves/easyPassShopping/index.vue

@@ -32,7 +32,7 @@
               <a-form-item label="产品名称"><a-input id="easyPassShopping-name" 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="easyPassShopping-code" v-model.trim="queryParam.queryWord" allowClear placeholder="请输入产品编码/原厂编码" /></a-form-item>
+              <a-form-item label="产品编码/原厂编码"><a-input id="easyPassShopping-code" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码/原厂编码" /></a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="产品品牌">
@@ -46,13 +46,14 @@
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="商城类目">
-                <v-select
-                  code="ENABLE_FLAG"
+                <a-cascader
                   id="easyPassShopping-category"
-                  v-model="category"
-                  @change="changeCategory"
+                  expandTrigger="hover"
+                  :fieldNames="fieldNames"
+                  :options="categoryOptions"
+                  placeholder="请选择商城类目"
                   allowClear
-                  placeholder="请选择商城类目"></v-select>
+                  v-model="category" />
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
@@ -105,7 +106,7 @@ import { STable, VSelect } from '@/components'
 import productType from '@/views/common/productType.js'
 import productBrand from '@/views/common/productBrand.js'
 // 接口
-import { shopProductList, findMallParam, updateMallParam } from '@/api/shopProduct'
+import { shopProductList, findMallParam, updateMallParam, queryExtList } from '@/api/shopProduct'
 export default {
   name: 'ShelfProductTemplList',
   components: { STable, VSelect, productType, productBrand },
@@ -120,17 +121,18 @@ export default {
       //  查询条件
       queryParam: {
         productName: '', //  产品名称
-        queryWord: '', //  产品编码/原厂编码
+        productCode: '', //  产品编码/原厂编码
         productBrandSn: undefined, //  产品品牌
         productTypeSn1: '', //  产品一级分类
         productTypeSn2: '', //  产品二级分类
         productTypeSn3: '', //  产品三级分类
         status: undefined, //  状态
-        categorysn1: undefined, // 产品一级类目
-        categorysn2: undefined// 产品二级类目
+        categorySn: undefined // 产品类目
       },
       productType: [], // 产品分类
-      category: [], // 产品类目
+      categoryOptions: [], // 产品类目列表
+      category: [],
+      fieldNames: { label: 'categoryName', value: 'categorySn', children: 'shopCategoryList' },
       shoppingMallStatus: '0', // 商城状态1:开启   0 关闭
       // 表头
       columns: [
@@ -152,6 +154,7 @@ export default {
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
+        this.queryParam.categorySn = (this.category && this.category.length > 1) ? this.category[1] : this.category[0]
         return shopProductList(Object.assign(parameter, this.queryParam)).then(res => {
           let data
           if (res.status == 200) {
@@ -176,22 +179,29 @@ export default {
       this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
       this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
     },
-    // 产品类目 change
-    changeCategory (val) {
-      this.queryParam.categorysn1 = val[0] ? val[0] : ''
-      this.queryParam.categorysn2 = val[1] ? val[1] : ''
+    // 获取产品类目列表
+    getCategoryList () {
+      const _this = this
+      _this.spinning = true
+      queryExtList({}).then(res => {
+        if (res.status == 200) {
+          this.categoryOptions = res.data || []
+        }
+        _this.spinning = false
+      })
     },
     // 重置
     resetSearchForm () {
       this.queryParam.productName = ''
-      this.queryParam.queryWord = ''
+      this.queryParam.productCode = ''
       this.queryParam.productBrandSn = undefined
       this.queryParam.productTypeSn1 = undefined
       this.queryParam.productTypeSn2 = undefined
       this.queryParam.productTypeSn3 = undefined
       this.queryParam.status = undefined
-      this.queryParam.categorysn1 = undefined
-      this.queryParam.categorysn2 = undefined
+      this.queryParam.categorySn = undefined
+      this.productType = []
+      this.category = []
       this.$refs.table.refresh(true)
     },
     // 获取初始商城打开、关闭状态
@@ -236,6 +246,7 @@ export default {
     pageInit () {
       const _this = this
       this.getShoppingStatus()
+      this.getCategoryList()
       this.$nextTick(() => { // 页面渲染完成后的回调
         _this.setTableH()
       })