xiaohaizhao 1 месяц назад
Родитель
Сommit
76fbc5602a

+ 1 - 1
packageA/market/detail.wxml

@@ -15,7 +15,7 @@
     <view class="title">
         {{detail.itemname}}
         <text wx:if="{{isShowFavorites}}" class="{{detail.iscollection?'cuIcon-favorfill':'cuIcon-favor'}}" style="color:{{detail.iscollection?'#FADB14':''}};padding: 6rpx;" id='addToFavorites' bind:tap="{{'clickBut'}}" />
-        <van-tag size='medium' type="warning">{{detail.delistingstatus}}</van-tag>
+        <van-tag wx:if="{{detail.delistingstatus}}" size='medium' type="warning">{{detail.delistingstatus}}</van-tag>
     </view>
     <view class="tags">
         <text wx:if="{{detail.iscustomsize==1}}" style="background-color: #EE0A24;color: #fff;">定制</text>

+ 1 - 1
packageA/orderForm/detail.wxml

@@ -76,7 +76,7 @@
 <view class="footer">
     <view class="price">
         <view class="count">
-            {{handleHide.verify(amount,'详情金额',privacyFieldC)}}
+            {{handleHide.verify(amount,'详情金额',privacyFieldC)}}
         </view>
         <view>
             {{logistics}}

+ 1 - 1
packageA/orderForm/index.wxml

@@ -15,7 +15,7 @@
         <van-tab title="关闭" />
     </van-tabs>
     <view class="tips">
-        共计{{total}}单,合计{{handleHide.verify(amount,'订货单列表金额',privacyFieldC)}}
+        共计{{total}}单,合计{{handleHide.verify(amount,'订货单列表金额',privacyFieldC)}}
     </view>
     <Yl_ListBox id='ListBox' bind:getlist='getList'>
         <List list="{{list}}" privacyFieldC='{{privacyFieldC}}' />

+ 39 - 36
pages/index/market_new/index.js

@@ -20,6 +20,8 @@ Component({
     sidebarItems: [],
     firstClassList: [],
     currentFirstClass: null,
+    showSidebar: false,
+    condition: ''
   },
   methods: {
     openAction() {
@@ -134,19 +136,26 @@ Component({
           // 保存完整的分类数据
           this.allCategories = res.data[0].ttemclass;
           console.log('allCategories:', this.allCategories);
-
-          const firstClassList = this.allCategories.map(v => {
+          
+          // 添加"全部"选项
+          const firstClassList = [{
+            itemclassid: "",
+            itemclassname: "全部",
+            name: "全部",
+            subdep: []
+          }].concat(this.allCategories.map(v => {
             v.name = v.itemclassname;
             return v;
-          });
-
+          }));
+          
           this.setData({
             firstClassList: firstClassList,
-            currentFirstClass: this.allCategories[0]
+            currentFirstClass: firstClassList[0],
+            showSidebar: false
           });
-
-          // 初始显示第一个一级分类的末级分类
-          this.updateSidebarItems(this.allCategories[0]);
+          
+          // 初始不显示侧边栏(因为默认选中"全部")
+          content.where.itemclassid = "";
         }
         this.getList(true);
       })
@@ -217,21 +226,24 @@ Component({
       }
       console.log('选中的索引:', index);
 
-      // 确保allCategories存在
-      if (!this.allCategories || this.allCategories.length === 0) {
-        console.log('allCategories未定义或为空');
-        return;
-      }
-
-      console.log('allCategories:', this.allCategories);
-      const selectedClass = this.allCategories[index];
+      // 获取选中的分类
+      const selectedClass = this.data.firstClassList[index];
       console.log('选中的分类:', selectedClass);
 
       if (selectedClass) {
         this.setData({
-          currentFirstClass: selectedClass
+          currentFirstClass: selectedClass,
+          showSidebar: index > 0 // 索引为0时是"全部",不显示侧边栏
         });
-        this.updateSidebarItems(selectedClass);
+        
+        if (index > 0) {
+          // 选择了具体的一级分类,更新侧边栏
+          this.updateSidebarItems(selectedClass);
+        } else {
+          // 选择了"全部",清空分类ID
+          content.where.itemclassid = "";
+        }
+        
         this.getList(true);
       } else {
         console.log('未找到选中的分类');
@@ -272,10 +284,16 @@ Component({
         })
       })
     },
+    /* 搜索输入变化 */
+    onChange(e) {
+      const value = e.detail;
+      this.setData({
+        condition: value
+      });
+    },
     /* 开始搜索 */
-    onSearch({
-      detail
-    }) {
+    onSearch(e) {
+      const detail = this.data.condition;
       content.where.condition = detail;
       wx.showLoading({
         title: '搜索中...',
@@ -285,21 +303,6 @@ Component({
       })
       this.getList(true)
     },
-    onChange({
-      detail
-    }) {
-      content.where.condition = detail
-      this.setData({
-        'condition': detail
-      })
-    },
-    
-    /* 跳转到搜索页面 */
-    goToSearch() {
-      wx.navigateTo({
-        url: '/pages/index/search/index'
-      });
-    },
 
 
 

+ 4 - 0
pages/index/market_new/index.scss

@@ -21,7 +21,11 @@ page {
 	z-index: 100;
 
 	.active-tab {
+		position: relative;
 		font-weight: bold;
+		z-index: 999;
+		background-color: #3874F6;
+		border-radius: 8rpx;
 	}
 }
 

+ 11 - 16
pages/index/market_new/index.wxml

@@ -1,28 +1,24 @@
-<view bind:tap="goToSearch" style="cursor: pointer;">
-	<van-search use-action-slot custom-class="van-search" placeholder='请输入搜索关键词' shape='round' disabled>
-		<navigator url="#" wx:if="{{tradefieList.length>1}}" style="padding: 0 10rpx;" slot="action" bind:tap="openAction">
-			{{tradefield||'领域'}}</navigator>
-	</van-search>
-</view>
+<van-search use-action-slot custom-class="van-search" placeholder='请输入搜索关键词' shape='round' bind:change='onChange' bind:blur="onSearch" bind:clear="onSearch">
+	<navigator url="#" wx:if="{{tradefieList.length>1}}" style="padding: 0 10rpx;" slot="action" bind:tap="openAction">
+		{{tradefield||'领域'}}
+	</navigator>
+</van-search>
 
 <!-- 一级分类 -->
-<van-tabs active="0" bind:change="firstClassChange" title-active-color="#3874F6" color="#3874F6"
-	custom-class="class-box" tab-active-class="active-tab">
-	<van-tab wx:for="{{firstClassList}}" wx:key="{{item.itemclassid}}" title="{{item.itemclassname}}">
-	</van-tab>
+<van-tabs wx:if="{{firstClassList.length}}" line-height='0' ellipsis='{{false}}' active="0" bind:change="firstClassChange" title-active-color="#fff" color="#3874F6" custom-class="class-box" tab-active-class="active-tab">
+	<van-tab wx:for="{{firstClassList}}" wx:key="{{item.itemclassid}}" title="{{item.itemclassname}}" />
 </van-tabs>
 <view class="container">
 	<!-- 左侧边栏 -->
-	<view class="sidebar-container">
+	<view wx:if="{{ showSidebar }}" class="sidebar-container">
 		<van-sidebar active-key="{{ activeKey }}" bind:change="onSidebarChange">
-			<van-sidebar-item custom-class="sidebar-item" wx:for="{{sidebarItems}}" wx:key="{{item.id}}"
-				title="{{item.title}}" />
+			<van-sidebar-item custom-class="sidebar-item" wx:for="{{sidebarItems}}" wx:key="{{item.id}}" title="{{item.title}}" />
 		</van-sidebar>
 		<view style="height: 400rpx;" />
 	</view>
 
 	<!-- 右侧内容区 -->
-	<view class="content-container">
+	<view class="content-container" style="{{ showSidebar ? '' : 'margin-left: 0; flex: 1;' }}">
 		<Yl_ListBox id='ListBox' bind:getlist='getList' style="height: 100%;">
 			<List list="{{list}}" />
 			<view style="height: 400rpx;" />
@@ -30,5 +26,4 @@
 	</view>
 </view>
 
-<van-action-sheet z-index='99999999' actions='{{tradefieList}}' show="{{ showAction }}" bind:cancel='closeAction'
-	bind:click-overlay='closeAction' bind:select='onSelect' cancel-text="取消" />
+<van-action-sheet z-index='99999999' actions='{{tradefieList}}' show="{{ showAction }}" bind:cancel='closeAction' bind:click-overlay='closeAction' bind:select='onSelect' cancel-text="取消" />