Browse Source

commit -m 搜索 分类列表 筛选项

zhengjinyi 3 years ago
parent
commit
505e87051d

+ 19 - 0
src/main/resources/static/js/common/serviceapi/product.service.js

@@ -416,4 +416,23 @@ var ProductApi = {
                     callback(res);
                 });
         },
+        /**
+         * @商品筛选品牌项
+         * @param:keyword 关键词
+         * @param:id 分类Id
+         * @param:idType 1 一级分类 2 二级分类 3 三级分类
+         * @param:identity
+         */
+        getCommoditySearchQUeryBrand:function (params, callback) {//获取商品收藏列表
+            Http.AjaxService({
+                url:'/commodity/search/query/brand',
+                type:'get',
+                data:params,
+                json:true,
+                isHost:true
+            })
+                .then(function(res){
+                    callback(res);
+                });
+        },
 };

+ 41 - 15
src/main/resources/static/js/product/list.js

@@ -27,19 +27,14 @@ var productList = new Vue({
         userIdentity: '',
         userToken: '',
         addhtml:'<span class="tag">美博会</span>',
-        brandLists: [
-            { name: '斯蒂芬斯', isChecked: false },
-            { name: 'Beautsecre', isChecked: false },
-            { name: '意大利DEP', isChecked: false },
-            { name: '美生美', isChecked: false },
-            { name: '三诺激光', isChecked: false },
-            { name: '三诺激光', isChecked: false },
-            { name: '三诺激光', isChecked: false },
-            { name: '三诺激光', isChecked: false },
-            { name: '三诺激光', isChecked: false },
-            { name: '三诺激光', isChecked: false },
-            { name: '三诺激光', isChecked: false },
-        ],
+        brandParam: {
+            keyword: '',
+            id: '',
+            idType: '',
+            identity: 0
+        },
+        brandLists: [],
+        defaultBrandLists:[],
         checkedBrandList:[],
         checkedBrandLength:0,
         isProductScreen:false,
@@ -142,6 +137,23 @@ var productList = new Vue({
                 }
             });
         },
+        getCommoditySearchQUeryBrand:function() { // 查询筛选项品牌
+            var _self = this;
+            ProductApi.getCommoditySearchQUeryBrand(_self.brandParam,function (response) {
+                console.log(response);
+                if (response.code === 0 && response.data ) {
+                    var data = response.data;
+                    _self.defaultBrandLists = data.map((el, index) => {
+                        el.isChecked = false;
+                        return el;
+                    })
+                    _self.brandLists = _self.defaultBrandLists.slice(0,8)
+                    console.log('品牌=============>', this.brandLists)
+                }else {
+                    console.log('查询品牌列表异常')
+                }
+            });
+        },
         choiceBrand:function(brand,index){// 选择品牌
             var _self = this;
             brand.isChecked = !brand.isChecked
@@ -158,15 +170,27 @@ var productList = new Vue({
         },
         hanldCheckedActivi:function(){// 选择促销商品选项
             this.isActiviChecked = !this.isActiviChecked;
+            if(this.isActiviChecked){
+                this.listQuery.promotionFlag = 1
+            }else{
+                this.listQuery.promotionFlag = 0
+            }
         },
         hanldCheckedNews:function(){// 选择新品选项
             this.isNewsChecked = !this.isNewsChecked;
+            if(this.isNewsChecked){
+                this.listQuery.newFlag = 1
+            }else{
+                this.listQuery.newFlag = 0
+            }
         },
         showIsProductScreen:function(){//
             this.isProductScreen = true;
         },
         handleConfirmScreen:function(){
             this.isProductScreen = false;
+            this.params.num = 1;
+            this.getListByKeyword();
         }
         // getListByCategory: function (path, categoryId) {
         //     var _self = this;
@@ -208,7 +232,7 @@ var productList = new Vue({
             this.params.size = 10;
             this.params.num = 1;
         }
-        this.params.keyword = getUrlParam("keyword") ? getUrlParam("keyword") : "";
+        this.params.keyword = this.brandParam.keyword = getUrlParam("keyword") ? getUrlParam("keyword") : "";
         // 搜索框赋值
         $('#topSearch').find('[data-select]').attr("data-select", 0).text("产品");
         $('#topSearch').find('.jqSelect').find('select').val(0);
@@ -228,7 +252,8 @@ var productList = new Vue({
         }
         // 获取列表数据
         this.getListByKeyword();
-
+        // 获取对应品牌列表
+        this.getCommoditySearchQUeryBrand();
         // if (this.searchFlag) {
         //     // 获取列表数据
         //     this.getListByKeyword();
@@ -274,6 +299,7 @@ var productList = new Vue({
                             _self.params.num = next;
                             // 获取列表数据
                             _self.getListByKeyword();
+
                             // if (_self.searchFlag) {
                             //     // 获取列表数据
                             //     _self.getListByKeyword();

+ 38 - 14
src/main/resources/static/js/product/produce-list.js

@@ -23,19 +23,14 @@ var productList = new Vue({
             idType:1
         },
         addhtml:'<span class="tag">美博会</span>',
-        brandLists: [
-            { name: '斯蒂芬斯', isChecked: false },
-            { name: 'Beautsecre', isChecked: false },
-            { name: '意大利DEP', isChecked: false },
-            { name: '美生美', isChecked: false },
-            { name: '三诺激光', isChecked: false },
-            { name: '三诺激光', isChecked: false },
-            { name: '三诺激光', isChecked: false },
-            { name: '三诺激光', isChecked: false },
-            { name: '三诺激光', isChecked: false },
-            { name: '三诺激光', isChecked: false },
-            { name: '三诺激光', isChecked: false },
-        ],
+        brandParam: {
+            keyword: '',
+            id: '',
+            idType: '',
+            identity: 0
+        },
+        brandLists: [],
+        defaultBrandLists:[],
         checkedBrandList:[],
         checkedBrandLength:0,
         isProductScreen:false,
@@ -123,6 +118,23 @@ var productList = new Vue({
             }
             return false
         },
+        getCommoditySearchQUeryBrand:function() { // 查询筛选项品牌
+            var _self = this;
+            ProductApi.getCommoditySearchQUeryBrand(_self.brandParam,function (response) {
+                console.log(response);
+                if (response.code === 0 && response.data ) {
+                    var data = response.data;
+                    _self.defaultBrandLists = data.map((el, index) => {
+                        el.isChecked = false;
+                        return el;
+                    })
+                    _self.brandLists = _self.defaultBrandLists.slice(0,8)
+                    console.log('品牌=============>', this.brandLists)
+                }else {
+                    console.log('查询品牌列表异常')
+                }
+            });
+        },
         choiceBrand:function(brand,index){// 选择品牌
             var _self = this;
             brand.isChecked = !brand.isChecked
@@ -139,15 +151,27 @@ var productList = new Vue({
         },
         hanldCheckedActivi:function(){// 选择促销商品选项
             this.isActiviChecked = !this.isActiviChecked;
+            if(this.isActiviChecked){
+                this.listQuery.promotionFlag = 1
+            }else{
+                this.listQuery.promotionFlag = 0
+            }
         },
         hanldCheckedNews:function(){// 选择新品选项
             this.isNewsChecked = !this.isNewsChecked;
+            if(this.isNewsChecked){
+                this.listQuery.newFlag = 1
+            }else{
+                this.listQuery.newFlag = 0
+            }
         },
         showIsProductScreen:function(){//
             this.isProductScreen = true;
         },
-        handleConfirmScreen:function(){
+        handleConfirmScreen:function(){// 确定筛选项
             this.isProductScreen = false;
+            this.params.pageNum = 1;
+            this.getListByKeyword();
         }
     },
     created:function () {