From b3fedd4221b807a07058be9d5d5d8ba8998adbcb Mon Sep 17 00:00:00 2001
From: Bang Hu <hu_bang@hotmail.com>
Date: 星期四, 11 九月 2025 21:35:31 +0800
Subject: [PATCH] Bug修改代码提交

---
 src/views/tradeManage/seller/index.vue |  226 ++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 146 insertions(+), 80 deletions(-)

diff --git a/src/views/tradeManage/seller/index.vue b/src/views/tradeManage/seller/index.vue
index 3735a6f..531b440 100644
--- a/src/views/tradeManage/seller/index.vue
+++ b/src/views/tradeManage/seller/index.vue
@@ -14,9 +14,25 @@
             </el-select>
           </el-form-item>
           <el-form-item label="" class="col-17">
-            <el-select v-model="query.unitProject" placeholder="璇烽�夋嫨鍗曚綅宸ョ▼" clearable style="width: 100%">
-              <el-option v-for="item in unitProjectOptions" :key="item.value" :label="item.label" :value="item.value" />
-            </el-select>
+<!--            <el-select v-model="query.unitProject" placeholder="璇烽�夋嫨鍗曚綅宸ョ▼" clearable style="width: 100%">-->
+<!--              <el-option v-for="item in unitProjectOptions" :key="item.value" :label="item.label" :value="item.value" />-->
+<!--            </el-select>-->
+            <el-tree-select
+                ref="areaIdTreeRef"
+                v-model="query.unitProject"
+                :data="unitProjectOptions"
+                placeholder="璇烽�夋嫨鍗曚綅宸ョ▼"
+                multiple
+                collapse-tags
+                collapse-tags-tooltip
+                clearable
+                :default-expand-all="true"
+                :render-after-expand="false"
+                show-checkbox
+                style="width: 170px;"
+                @change="importantAreaCh"
+                @clear="importantAreaClear"
+            />
           </el-form-item>
           <el-form-item label="浜у搧绫诲瀷" class="col-30">
             <el-select v-model="query.productType" placeholder="璇烽�夋嫨浜у搧绫诲瀷" clearable style="width: 100%" @change="handleProductTypeChange">
@@ -35,11 +51,11 @@
               <el-option v-for="s in statusOptions" :key="s.value" :label="s.label" :value="s.value" />
             </el-select>
           </el-form-item>
-          <el-form-item label="" class="col-17">
-            <el-select v-model="query.productSubType" placeholder="璇烽�夋嫨浜у搧绫诲瀷瀛愮骇" clearable style="width: 100%">
-              <el-option v-for="item in productSubTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
-            </el-select>
-          </el-form-item>
+<!--          <el-form-item label="" class="col-17">-->
+<!--            <el-select v-model="query.productSubType" placeholder="璇烽�夋嫨浜у搧绫诲瀷瀛愮骇" clearable style="width: 100%">-->
+<!--              <el-option v-for="item in productSubTypeOptions" :key="item.value" :label="item.label" :value="item.value" />-->
+<!--            </el-select>-->
+<!--          </el-form-item>-->
           <el-form-item label="鐢宠鏃堕棿" class="col-30">
             <el-date-picker
               v-model="query.dateRange"
@@ -102,7 +118,7 @@
               </template>
             </el-table-column>
           </el-table-column>
-          
+
           <!-- 璐拱鏂瑰紡 -->
           <el-table-column label="璐拱鏂瑰紡" align="center">
             <el-table-column label="閿�鍞舰寮�/璐︽埛鏁伴噺" width="150">
@@ -136,10 +152,10 @@
               </template>
             </el-table-column>
           </el-table-column>
-          
-          <!-- 鎬讳环 -->
-          <el-table-column label="鎬讳环" align="center">
-            <el-table-column label="鍗曚环" prop="unitPrice" width="90">
+
+          <!-- 鍗曚环锛堜笌鈥滄湡闄�(骞�)鈥濅繚鎸佺浉鍚岀殑鐖跺瓙琛ㄥご缁撴瀯锛� -->
+          <el-table-column label="鍗曚环" align="center" width="80">
+            <el-table-column label="" prop="unitPrice" width="80">
               <template #default="{ row }">
                 <div v-if="row.isSpacer" class="spacer-cell"></div>
                 <div v-else-if="!row.isMainOrder" class="price-info">
@@ -158,17 +174,21 @@
                 </div>
               </template>
             </el-table-column>
-            <el-table-column label="鏁伴噺" prop="quantity" width="50">
+          </el-table-column>
+
+          <!-- 鏁伴噺锛堜笌鈥滄湡闄�(骞�)鈥濅繚鎸佺浉鍚岀殑鐖跺瓙琛ㄥご缁撴瀯锛� -->
+          <el-table-column label="鏁伴噺" align="center" width="80">
+            <el-table-column label="" prop="quantity" width="80" align="center">
               <template #default="{ row }">
                 <div v-if="row.isSpacer" class="spacer-cell"></div>
                 <div v-else-if="!row.isMainOrder" class="quantity">{{ row.quantity }}</div>
               </template>
             </el-table-column>
           </el-table-column>
-          
+
           <!-- 鏈熼檺(骞�) -->
           <el-table-column label="鏈熼檺(骞�)" align="center" width="80">
-            <el-table-column label="" prop="period" width="80">
+            <el-table-column label="" prop="period" width="80" align="center">
               <template #default="{ row }">
                 <div v-if="row.isSpacer" class="spacer-cell"></div>
                 <div v-else-if="!row.isMainOrder" class="period-info">
@@ -178,7 +198,7 @@
               </template>
             </el-table-column>
           </el-table-column>
-          
+
           <!-- 鎿嶄綔 -->
           <el-table-column label="鎿嶄綔" align="center" width="120" class="operation-column">
             <el-table-column label="" width="120">
@@ -189,20 +209,20 @@
                     <div class="action-item">
                       <div class="action-buttons">
                         <template v-for="action in getAvailableActions(row.parentOrder)" :key="action.type">
-                          <el-button 
+                          <el-button
                             v-if="action.type === ActionType.VIEW"
-                            type="primary" 
-                            link 
-                            size="small" 
+                            type="primary"
+                            link
+                            size="small"
                             @click="handleAction(action, row.parentOrder)"
                           >
                             鏌ョ湅
                           </el-button>
-                          <!-- <el-button 
+                          <!-- <el-button
                             v-else-if="action.type === ActionType.TRACK"
-                            type="primary" 
-                            link 
-                            size="small" 
+                            type="primary"
+                            link
+                            size="small"
                             @click="handleAction(action, row.parentOrder)"
                           >
                             杩借釜
@@ -231,11 +251,11 @@
         />
       </div>
     </el-card>
-    
+
     <!-- 璁㈠崟鐘舵�佸璇濇 -->
-    <ProductOrderStatusDialog 
-      v-model="orderStatusDialogVisible" 
-      :order-id="currentOrderId" 
+    <ProductOrderStatusDialog
+      v-model="orderStatusDialogVisible"
+      :order-id="currentOrderId"
     />
   </div>
 </template>
@@ -254,6 +274,7 @@
 
 const router = useRouter()
 const userStore = useUserInfo()
+const areaIdTreeRef=ref()
 
 // 鐘舵�侀�夐」锛堟洿鏂颁负鏂扮殑宸ヤ綔娴佺▼鐘舵�侊級
 const statusOptions = [
@@ -275,12 +296,13 @@
 const query = reactive({
   productName: '',
   industry: '',
-  unitProject: '',
+  unitProject: [] as string[],
   productType: '',
   productSubType: '',
+  importantDistrictIdList: [] as string[],
   orderNo: '',
   status: '',
-  dateRange: [],
+  dateRange: [] as string[],
 })
 
 // 鍒嗛〉淇℃伅
@@ -342,7 +364,7 @@
 // 鑾峰彇浜у搧绫诲瀷閫夐」
 const getProductTypeOptions = async () => {
   try {
-    const res = await productApi.getCategoryByParent({ parentCode: 'product_type' })
+    const res = await productApi.getCategoryByParent({ parentCode: 'ProductTechnologyType' })
     if (res?.code === 200 && res.data) {
       productTypeOptions.value = res.data.map((item: any) => ({
         label: item.name,
@@ -363,14 +385,40 @@
   try {
     const res = await productApi.getCategoryByParent({ parentId: industryCode })
     if (res?.code === 200 && res.data) {
-      unitProjectOptions.value = res.data.map((item: any) => ({
-        label: item.name,
-        value: item.id
-      }))
+      unitProjectOptions.value = handleIndustryData(res.data)
     }
   } catch (error) {
     console.error('鑾峰彇鍗曚綅宸ョ▼閫夐」澶辫触:', error)
     unitProjectOptions.value = []
+  }
+}
+
+const handleIndustryData=(list:any)=>{
+  if(list&& list.length>0){
+    let data=list.map((item:any)=>{
+      return {
+        label:item.name,
+        value:item.id,
+        parentId:item.parentId,
+        parentName:item.parentName,
+        children:item.childrenList?handleIndustryChildData(item,item.childrenList):[]
+      }
+    })
+    return data
+  }
+}
+const handleIndustryChildData=(parentItem:any,childList:any)=>{
+  if(childList&& childList.length>0){
+    let data=childList.map((item:any)=>{
+      return {
+        parentId:parentItem.id,
+        parentName:parentItem.name,
+        label:item.name,
+        value:item.id,
+        children:item.childrenList?handleIndustryChildData(item,item.childrenList):[]
+      }
+    })
+    return data
   }
 }
 
@@ -394,10 +442,28 @@
   }
 }
 
+const importantAreaCh=()=>{
+  let checkedKeys = areaIdTreeRef.value!.getCheckedNodes(false, true)
+  if(checkedKeys&&checkedKeys.length>0&& query.unitProject.length>0){
+    query.importantDistrictIdList=[]
+    checkedKeys.forEach((item:any)=>{
+      if(item.children&&item.children.length>0){
+        query.importantDistrictIdList.push(String(item.value))
+      }
+    })
+  }
+}
+
+const importantAreaClear=()=>{
+  query.unitProject = []
+  query.importantDistrictIdList = []
+  areaIdTreeRef.value.setCheckedKeys([])
+}
+
 // 澶勭悊琛屼笟棰嗗煙鍙樺寲
 const handleIndustryChange = async (value: string) => {
   // 娓呯┖鍗曚綅宸ョ▼閫夋嫨
-  query.unitProject = ''
+  query.unitProject = []
   // 鑾峰彇瀵瑰簲鐨勫崟浣嶅伐绋嬮�夐」
   await getUnitProjectOptions(value)
 }
@@ -407,10 +473,8 @@
   // 娓呯┖浜у搧瀛愮骇閫夋嫨
   query.productSubType = ''
   // 鑾峰彇瀵瑰簲鐨勪骇鍝佸瓙绾ч�夐」
-  await getProductSubTypeOptions(value)
+ // await getProductSubTypeOptions(value)
 }
-
-
 
 // 鑾峰彇鐘舵�佺被鍨�
 const getStatusType = (status: string) => {
@@ -442,7 +506,7 @@
     // 涓昏鍗曡锛屽悎骞舵墍鏈夊垪鏄剧ず璁㈠崟淇℃伅
     if (columnIndex === 0) { // 绗竴鍒楋紝鍚堝苟鎵�鏈夊垪
       return {
-        colspan: 8, // 鎬诲叡8鍒楋細璁㈠崟淇℃伅2鍒� + 璐拱鏂瑰紡2鍒� + 鎬讳环2鍒� + 鏈熼檺1鍒� + 鎿嶄綔1鍒�
+        colspan: 8, // 鎬诲叡8鍒楋細璁㈠崟淇℃伅2鍒� + 璐拱鏂瑰紡2鍒� + 鍗曚环1鍒� + 鏁伴噺1鍒� + 鏈熼檺1鍒� + 鎿嶄綔1鍒�
         rowspan: 1
       }
     } else {
@@ -525,14 +589,15 @@
 
     // 娣诲姞浜у搧鏉′欢鏌ヨ
     if (query.industry) payload.industryId = query.industry
-    if (query.unitProject) payload.unitProjectId = query.unitProject
+    if (query.unitProject.length > 0) payload.unitProjectId = query.unitProject
+    if (query.importantDistrictIdList.length > 0) payload.importantDistrictId = query.importantDistrictIdList
     if (query.productType) payload.productTypeId = query.productType
     if (query.productSubType) payload.productSubTypeId = query.productSubType
 
     // 鏍规嵁鏄惁鏈変骇鍝佹潯浠堕�夋嫨涓嶅悓鐨凙PI
-    const hasProductConditions = query.industry || query.unitProject || query.productType || query.productSubType
+    const hasProductConditions = query.industry || query.unitProject.length > 0 || query.productType || query.productSubType
     const apiMethod = hasProductConditions ? orderApi.getSellerOrderPageWithProductConditions : orderApi.getSellerOrderPage
-    
+
     const res = (await apiMethod(payload)) as any
     const pageData = res?.data
     const list: any[] = Array.isArray(pageData?.list) ? pageData.list : []
@@ -652,13 +717,13 @@
       return
     }
   }
-  
+
   // 鑾峰彇鍒濆閫夐」鏁版嵁
   await Promise.all([
     getIndustryOptions(),
     getProductTypeOptions()
   ])
-  
+
   // 鎵ц鎼滅储
   handleSearch()
 })
@@ -696,7 +761,7 @@
       border-bottom: 2px solid #e4e7ed; // 涓庡垎闅旇涓�鑷寸殑涓嬭竟妗�
     }
   }
-  
+
   // 璋冩暣琛ㄥご楂樺害
   tr:first-child {
     th {
@@ -713,18 +778,18 @@
 
 .search-card {
   margin-bottom: 20px;
-  
+
   .query-form {
     .form-row {
       display: flex;
       gap: 0;
       width: 100%;
       margin-bottom: 8px;
-      
+
       &.actions {
         justify-content: flex-end;
       }
-      
+
       .el-form-item { margin-right: 0 !important; }
       > .el-form-item { padding-right: 8px; }
       > .el-form-item:last-child { padding-right: 0; }
@@ -738,7 +803,7 @@
     .el-form-item {
       margin-bottom: 16px;
       margin-right: 20px;
-      
+
       &:last-child {
         margin-right: 0;
       }
@@ -749,7 +814,7 @@
 .table-container {
   position: relative;
   z-index: 1;
-  
+
   .custom-table {
     // 琛ㄥご绗簩琛屾枃瀛楀ぇ灏忚皟鏁�
     .el-table__header-wrapper {
@@ -762,7 +827,7 @@
         }
       }
     }
-    
+
     // 纭繚琛ㄥご鎵�鏈夎鐨勬枃瀛楀ぇ灏忎竴鑷�
     .el-table__header {
       th {
@@ -772,23 +837,23 @@
         }
       }
     }
-    
+
     .el-table {
       position: relative;
       z-index: 1;
-      
+
       .main-order-row {
         background-color: #f8f9fa;
         font-weight: 600;
-        
+
         td {
           border-bottom: 2px solid #e4e7ed;
         }
       }
-      
+
       .sub-order-row {
         background-color: #ffffff;
-        
+
         td {
           border-bottom: 1px solid #ebeef5;
         }
@@ -805,20 +870,20 @@
     gap: 20px;
     align-items: center;
     overflow: hidden;
-    
+
     .order-item {
       display: flex;
       align-items: center;
       gap: 8px;
       flex-shrink: 0;
-      
+
       .label {
         color: #909399;
         font-size: 12px;
         min-width: 60px;
         flex-shrink: 0;
       }
-      
+
       .value {
         color: #303133;
         font-size: 12px;
@@ -833,22 +898,22 @@
 
 .price-info {
   font-size: 12px;
-  
+
   .price-points {
     color: #e6a23c;
     font-weight: 500;
   }
-  
+
   .price-currency {
     color: #67c23a;
     font-weight: 500;
   }
-  
+
   .price-agreement {
     color: #409eff;
     font-weight: 500;
   }
-  
+
   .price-free {
     color: #909399;
     font-style: italic;
@@ -858,9 +923,10 @@
 .period-info {
   display: flex;
   align-items: center;
+  justify-content: center;
   gap: 8px;
   font-size: 12px;
-  
+
   .permanent {
     color: #909399;
     font-size: 12px;
@@ -892,18 +958,18 @@
     display: flex;
     align-items: center;
     margin-bottom: 4px;
-    
+
     &:last-child {
       margin-bottom: 0;
     }
-    
+
     .label {
       color: #909399;
       font-size: 12px;
       min-width: 60px;
       flex-shrink: 0;
     }
-    
+
     .value {
       color: #303133;
       font-size: 12px;
@@ -924,7 +990,7 @@
   color: #303133;
   text-align: center;
   line-height: 1.4;
-  
+
   .all-actions {
     display: flex;
     flex-direction: column;
@@ -932,10 +998,10 @@
     justify-content: center;
     gap: 6px;
     width: 100%;
-    
+
     .action-item {
       width: 100%;
-      
+
       .action-buttons {
         display: flex;
         flex-direction: column;
@@ -943,7 +1009,7 @@
         align-items: center;
         justify-content: center;
         width: 100%;
-        
+
         .el-button {
           width: 100%;
           text-align: center;
@@ -955,7 +1021,7 @@
           height: auto;
           line-height: 1.2;
         }
-        
+
         .op-text {
           margin: 4px 0;
           text-align: center;
@@ -975,12 +1041,12 @@
   flex-wrap: wrap;
 }
 
-.op-text { 
-  color: #606266; 
+.op-text {
+  color: #606266;
   font-size: 12px;
 }
-.op-text.warning { 
-  color: #f59e0b; 
+.op-text.warning {
+  color: #f59e0b;
   font-size: 12px;
 }
 
@@ -1001,11 +1067,11 @@
   .el-table__fixed-right {
     z-index: 2 !important;
   }
-  
+
   .el-table__fixed-right-patch {
     z-index: 2 !important;
   }
-  
+
   // 鎿嶄綔鍒楁牱寮忎紭鍖�
   .operation-column {
     .cell {

--
Gitblit v1.8.0