shish 11 hónapja
szülő
commit
c47c9a62a0
2 módosított fájl, 11 hozzáadás és 38 törlés
  1. 3 13
      hdApp/src/admin/goods/list.vue
  2. 8 25
      mallApp/src/pages/home/category.vue

+ 3 - 13
hdApp/src/admin/goods/list.vue

@@ -354,23 +354,13 @@ export default {
       if (!this.$util.isEmpty(this.searchText)) {
         this.searchTimer = setTimeout(() => {
           this.lastSearchText = this.searchText;
-          this.resetList();
-          getCategoryToGoods({
-            status:'',
-            page:this.list.page,
-            flower:1,
-            searchText:this.searchText,
-            flowerNum:this.flowerNum,
-            priceStatus:this.priceStatus,
-            stockStatus:this.stockStatus
-          }).then(res => {
-            this.completes(res);
-          });
+          this.resetList()
+          this.getGoodsList()
         }, 1000);
       }
     },
     getGoodsList() {
-      return getCategoryToGoods({ status:'', page: this.list.page, catId:this.catId, flowerNum:this.flowerNum, priceStatus:this.priceStatus, stockStatus:this.stockStatus }).then(res => {
+      return getCategoryToGoods({page: this.list.page,searchText:this.lastSearchText,catId:this.catId, flowerNum:this.flowerNum, priceStatus:this.priceStatus, stockStatus:this.stockStatus,requestType:'goodsList'}).then(res => {
         this.completes(res)
       })
     },

+ 8 - 25
mallApp/src/pages/home/category.vue

@@ -15,7 +15,7 @@
 			<view class="search-bar">
 				<app-search-module 
 					v-model="searchText" 
-					:placeholder="isSearching ? '正在搜索...' : '搜索商品名称'" 
+					placeholder="搜索商品" 
 					@input="searchFn" 
 					:height="66"
 					:fontSize="28"
@@ -29,10 +29,6 @@
 				</button>
 			</view>
 		</view>
-		<!-- 搜索状态提示 -->
-		<view v-if="isSearching" class="search-loading">
-			<text class="loading-text">正在搜索...</text>
-		</view>
 
     <scroll-view scroll-y scroll-with-animation class="tab-view" :scroll-top="scrollTop">
       <view v-for="(item,index) in tabbar" :key="index" class="tab-bar-item" :class="[!isSearchMode && currentTab==index ? 'active' : '']" :data-current="index" @tap.stop="swichNav($event ,item)" >
@@ -131,7 +127,6 @@ export default {
       searchText: '', // 搜索文本
       searchTimer: null, // 搜索防抖定时器
       isSearchMode: false, // 是否为搜索模式
-      isSearching: false, // 是否正在搜索
       lastSearchText: '' // 上次搜索的文本,用于优化
     }
   },
@@ -210,8 +205,7 @@ export default {
     },
     // 搜索输入处理(防抖)
     searchFn() {
-      console.log('searchFn----------', this.searchText, 'lastSearchText:', this.lastSearchText)
-      
+
       // 清除之前的定时器
       if (this.searchTimer) {
         clearTimeout(this.searchTimer)
@@ -222,7 +216,6 @@ export default {
       if (this.$util.isEmpty(this.searchText)) {
         // 如果之前也是空文本(首次点击或焦点清空),跳过搜索
         if (this.$util.isEmpty(this.lastSearchText)) {
-          console.log('搜索文本为空且之前也为空,跳过搜索')
           return
         }
         // 如果之前有搜索文本,现在清空了,则恢复分类筛选
@@ -232,7 +225,6 @@ export default {
       
       // 如果搜索文本与上次相同,不重复搜索
       if (this.searchText === this.lastSearchText) {
-        console.log('搜索文本未变化,跳过搜索')
         return
       }
       
@@ -248,10 +240,7 @@ export default {
         return
       }
       
-      console.log('执行搜索:', this.searchText)
-      
       this.isSearchMode = true
-      this.isSearching = true
       this.lastSearchText = this.searchText
       this.resetList()
       this.searchGoods()
@@ -259,9 +248,7 @@ export default {
     
     // 清空搜索,恢复分类筛选
     clearSearch() {
-      console.log('清空搜索,恢复分类筛选')
       this.isSearchMode = false
-      this.isSearching = false
       this.lastSearchText = ''
       
       // 确保搜索框内容被清空
@@ -275,23 +262,21 @@ export default {
     
     // 搜索商品
     searchGoods() {
+      let hdId = this.option.id?this.option.id:0
       return getList({ 
         searchText: this.searchText, 
         page: this.list.page, 
-        pageSize: 10 
+        pageSize: 10,
+        hdId:hdId
       }).then(res => {
-        this.isSearching = false
         this.completes(res)
-        console.log('搜索成功,数据已加载')
       }).catch(err => {
-        this.isSearching = false
-        console.error('搜索失败:', err)
-        this.$msg('搜索失败,请重试')
+        this.$msg('搜索失败')
       })
     },
     reachBottom () {
       console.log('reachBottom----------', this.list.finished)
-      if (this.list.finished == false && !this.isSearching) {
+      if (this.list.finished == false) {
         // 根据是否为搜索模式决定调用哪个方法
         if (this.isSearchMode) {
           this.searchGoods().then(res => {
@@ -371,7 +356,6 @@ export default {
       // 重置搜索相关状态
       this.searchText = ''
       this.isSearchMode = false
-      this.isSearching = false
       this.lastSearchText = ''
       
       // 确保搜索框内容被清空(强制更新)
@@ -444,7 +428,7 @@ export default {
   }
 
   .fadeIn{
-    height:180upx;
+    height:160upx;
     overflow: hidden;
     animation-name: fadeInFrames;
     animation-duration:.3s;
@@ -555,7 +539,6 @@ page {
 /* 搜索框样式 */
 .search-wrap {
 	padding: 15upx 30upx 25upx 30upx;
-	background: linear-gradient(to bottom, #3385FF, #fff);
 	display: flex;
 	align-items: center;
 	gap: 20upx;