diff --git a/b/product/product_category_search.dspy b/b/product/product_category_search.dspy index 3f37b8a..aefc157 100644 --- a/b/product/product_category_search.dspy +++ b/b/product/product_category_search.dspy @@ -40,7 +40,10 @@ async def product_category_search(ns={}): async with db.sqlorContext('kboss') as sor: # 首页不登录 通过域名筛选 if to_page == 'show': - find_sql = """SELECT * FROM user_publish_product_category WHERE domain_name = '%s' AND del_flg = '0' ORDER BY priority;""" % domain_name + if ns.get('first_level_id'): + find_sql = """SELECT * FROM user_publish_product_category WHERE domain_name = '%s' AND del_flg = '0' AND parentid = '%s' ORDER BY priority;""" % (domain_name, ns.get('first_level_id')) + else: + find_sql = """SELECT * FROM user_publish_product_category WHERE domain_name = '%s' AND del_flg = '0' AND parentid is NULL ORDER BY priority;""" % domain_name result = await sor.sqlExe(find_sql, {}) return { 'status': True, @@ -64,7 +67,7 @@ async def product_category_search(ns={}): orgid = user_list[0]['orgid'] user_role = await get_user_role({'userid': userid, 'sor': sor}) try: - if user_role == '客户' or user_role == '管理员': + if user_role == '客户' or user_role == '管理员': find_sql = """SELECT * FROM user_publish_product_category WHERE domain_name = '%s' AND permission = '1' AND del_flg = '0' ORDER BY priority;""" % domain_name else: find_sql = """SELECT * FROM user_publish_product_category WHERE domain_name = '%s' AND del_flg = '0' ORDER BY priority;""" % domain_name diff --git a/f/web-kboss/src/api/ncmatch/index.js b/f/web-kboss/src/api/ncmatch/index.js index 5d41f5e..86a39d5 100644 --- a/f/web-kboss/src/api/ncmatch/index.js +++ b/f/web-kboss/src/api/ncmatch/index.js @@ -200,4 +200,23 @@ export function reqHomepageCategoryTreeDelete(data){ headers: { 'Content-Type': 'application/json' }, data }) +} + +//供需一级分类 +export function reqSupplyAndDemandFirstCategory(data){ + return request({ + url: '/product/product_category_search.dspy', + method: 'post', + headers: { 'Content-Type': 'application/json' }, + data + }) +} +//供需二级分类 +export function reqSupplyAndDemandSecondCategory(data){ + return request({ + url: '/product/supply_and_demand_first_category.dspy', + method: 'post', + headers: { 'Content-Type': 'application/json' }, + data + }) } \ No newline at end of file diff --git a/f/web-kboss/src/views/homePage/ncmatch/mainPage/menuAside/index.vue b/f/web-kboss/src/views/homePage/ncmatch/mainPage/menuAside/index.vue index 8de5cba..f0830af 100644 --- a/f/web-kboss/src/views/homePage/ncmatch/mainPage/menuAside/index.vue +++ b/f/web-kboss/src/views/homePage/ncmatch/mainPage/menuAside/index.vue @@ -47,7 +47,7 @@
-
{{ product.first_level_name }} @@ -120,12 +120,63 @@ export default { hideTimer: null, categories: [], loading: false, + keyword: '', + publish_type: '', } }, created() { this.getCategories(); }, methods: { + performFormalSearch(keyword, type) { + console.log('=== 执行正式搜索开始 ==='); + console.log('搜索参数:', { keyword, type }); + console.log('当前路由:', this.$route.path); + console.log('事件总线实例:', eventBus); + + reqSearch({ + url_link: window.location.href, + keyword: keyword, + publish_type: type, + display_page: 'list', // 正式搜索使用 list + current_page: 1, + page_size: 8 + }).then(res => { + console.log('正式搜索结果:', res); + + // 准备发送事件数据 + const eventData = { + type: type, + keyword: keyword, + data: res.data + }; + console.log('准备发送事件数据:', eventData); + + // 通过事件总线触发搜索事件,让兄弟组件处理结果 + try { + eventBus.$emit('search', eventData); + console.log('事件总线事件发送成功'); + } catch (error) { + console.error('事件总线事件发送失败:', error); + } + + console.log('正式搜索完成,已触发搜索事件'); + + }).catch(error => { + console.error('正式搜索失败:', error); + this.$message.error('搜索失败,请重试'); + }); + }, + goSearch(product) { + this.keyword = 'A800'; + this.publish_type ='1'; + this.$router.push({ + path: '/ncmatch/search', + + }) + this.performFormalSearch(this.keyword, this.publish_type); + }, + async openTalk() { await this.hideProductList('quick') this.$store.commit('setShowTalk', true); diff --git a/f/web-kboss/src/views/homePage/ncmatch/supplyAndDemandSquare/index.vue b/f/web-kboss/src/views/homePage/ncmatch/supplyAndDemandSquare/index.vue index 90c0c7f..5146e31 100644 --- a/f/web-kboss/src/views/homePage/ncmatch/supplyAndDemandSquare/index.vue +++ b/f/web-kboss/src/views/homePage/ncmatch/supplyAndDemandSquare/index.vue @@ -35,21 +35,21 @@
所属类别
- - {{ category.label }} + + {{ category.product_category || category.label }}
-
+
所属品类
- - {{ category.label }} + + {{ category.product_category || category.label }}
@@ -87,7 +87,7 @@