From d767f1647a7e21adc9eacf849c213f72f992314b Mon Sep 17 00:00:00 2001 From: huliyong <2783385703@qq.com> Date: Fri, 27 Jun 2025 19:25:21 +0800 Subject: [PATCH] 1 --- api/model/recyclingDestination.js | 2 +- pages/component/home.vue | 1 + pages/component/recycle.vue | 56 ++++++++++++++++++++++++++++++--------- pages/mine/questionDetail.vue | 2 +- 4 files changed, 46 insertions(+), 15 deletions(-) diff --git a/api/model/recyclingDestination.js b/api/model/recyclingDestination.js index 53cd16f..1a7c362 100644 --- a/api/model/recyclingDestination.js +++ b/api/model/recyclingDestination.js @@ -14,7 +14,7 @@ const api = { }, // 联系客服问题相关详情 getQuestionListDetail: { - url: '/recycle-admin/applet/index/getQuestionListDetail', + url: '/recycle-admin/applet/order/getQuestionListDetail', method: 'GET', auth : false, }, diff --git a/pages/component/home.vue b/pages/component/home.vue index 5657390..30993a7 100644 --- a/pages/component/home.vue +++ b/pages/component/home.vue @@ -734,6 +734,7 @@ image { width: 60rpx; height: 60rpx; + border-radius: 50%; } .location { diff --git a/pages/component/recycle.vue b/pages/component/recycle.vue index b004398..0a261b5 100644 --- a/pages/component/recycle.vue +++ b/pages/component/recycle.vue @@ -232,13 +232,13 @@ 可回收的品牌 - + {{letter}} - + {{brand.name}} @@ -286,7 +286,7 @@ 品牌确认提示 - + {{ brandConfirmInfo.name }} 请确认所选品牌是否与实物品牌信息一致,否则将无法进行回收。 @@ -306,7 +306,7 @@ - + {{brand.name}} @@ -338,7 +338,7 @@ export default { showPickupConfirm: false, showBrandConfirm: false, brandConfirmInfo: { - image: '', + logo: '', name: '' }, brandList: [], @@ -359,6 +359,8 @@ export default { loadOptions: null, // 保存options参数 userInfo: null, // 用户信息 isUserBlacklisted: false, // 用户是否被拉黑 + currentProductId: null, // 当前查看品牌的商品ID + searchTimer: null, // 搜索防抖定时器 } }, computed: { @@ -472,7 +474,7 @@ export default { quantity: quantity, brandId: brandId, brandName: brandInfo ? brandInfo.name : '未知品牌', - brandImage: brandInfo ? brandInfo.image : '', + brandImage: brandInfo ? brandInfo.logo : '', uniqueKey: `${item.id}_${brandId}` // 用于区分同商品不同品牌 }) } @@ -488,9 +490,7 @@ export default { return products }, filteredBrandList() { - if (!this.brandSearch) return this.brandList - const keyword = this.brandSearch.trim().toLowerCase() - return this.brandList.filter(b => b.name.toLowerCase().includes(keyword)) + return this.brandList }, bannerList() { return getApp().globalData.bannerList || [] @@ -585,7 +585,7 @@ export default { brandId, quantity, name: brandInfo ? brandInfo.name : '未知品牌', - image: brandInfo ? brandInfo.image : '' + logo: brandInfo ? brandInfo.logo : '' } }) this.showBrandReducePopup = true @@ -765,6 +765,13 @@ export default { // 如果用户取消品牌选择,重置状态 this.pendingBrandIndex = null; this.isWaitingForBrandSelection = false; + // 清理搜索状态 + this.brandSearch = '' + this.currentProductId = null + if (this.searchTimer) { + clearTimeout(this.searchTimer) + this.searchTimer = null + } }, scrollToLetter(letter) { this.currentLetter = letter @@ -903,7 +910,7 @@ export default { openBrandConfirm(brand) { this.brandConfirmInfo = { id: brand.id, - image: brand.image, + logo: brand.logo, name: brand.name } this.showBrandConfirm = true @@ -936,8 +943,14 @@ export default { this.pendingBrandIndex = null } }, - getGoodsBrandList(productId) { - this.$api('getGoodsBrandList', { productId }, res => { + getGoodsBrandList(productId, searchName = '') { + this.currentProductId = productId + const params = { productId } + if (searchName.trim()) { + params.name = searchName.trim() + } + + this.$api('getGoodsBrandList', params, res => { // console.log(res,'res') if (res && res.success && res.result && res.result.records) { this.brandList = res.result.records.map(item => { @@ -973,6 +986,23 @@ export default { return '#' }, + + // 品牌搜索输入事件处理 + onBrandSearchInput(e) { + const searchValue = e.detail.value + + // 清除之前的定时器 + if (this.searchTimer) { + clearTimeout(this.searchTimer) + } + + // 设置防抖,500ms后执行搜索 + this.searchTimer = setTimeout(() => { + if (this.currentProductId) { + this.getGoodsBrandList(this.currentProductId, searchValue) + } + }, 500) + }, // 初始化页面数据的方法 initializePageData() { diff --git a/pages/mine/questionDetail.vue b/pages/mine/questionDetail.vue index 7a7f0f5..9dc27bd 100644 --- a/pages/mine/questionDetail.vue +++ b/pages/mine/questionDetail.vue @@ -5,7 +5,7 @@ @leftClick="$utils.navigateBack" /> - +