From 349091f54dab47b15ca81613f02765490a2ce7d0 Mon Sep 17 00:00:00 2001
From: p-honggang.li <p-honggang.li@pcitc.com>
Date: 星期四, 11 九月 2025 10:50:36 +0800
Subject: [PATCH] 修改买家中心卖家中心产品类型等条件查询问题

---
 src/views/tradeManage/seller/index.vue |  736 ++++++++++++++++++++++++++++++++------------------------
 1 files changed, 423 insertions(+), 313 deletions(-)

diff --git a/src/views/tradeManage/seller/index.vue b/src/views/tradeManage/seller/index.vue
index 59d87cb..8c4f3db 100644
--- a/src/views/tradeManage/seller/index.vue
+++ b/src/views/tradeManage/seller/index.vue
@@ -9,17 +9,33 @@
             <el-input v-model="query.productName" placeholder="璇疯緭鍏ヤ骇鍝佸悕绉�" clearable style="width: 100%" />
           </el-form-item>
           <el-form-item label="琛屼笟棰嗗煙" class="col-25">
-            <el-select v-model="query.industry" placeholder="璇烽�夋嫨琛屼笟棰嗗煙" clearable style="width: 100%">
+            <el-select v-model="query.industry" placeholder="璇烽�夋嫨琛屼笟棰嗗煙" clearable style="width: 100%" @change="handleIndustryChange">
               <el-option v-for="item in industryOptions" :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.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%">
+            <el-select v-model="query.productType" placeholder="璇烽�夋嫨浜у搧绫诲瀷" clearable style="width: 100%" @change="handleProductTypeChange">
               <el-option v-for="item in productTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
             </el-select>
           </el-form-item>
@@ -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"
@@ -89,10 +105,6 @@
                       <span class="label">闇�姹傛柟:</span>
                       <span class="value">{{ row.demandSide }}</span>
                     </div>
-                    <div class="order-item">
-                      <span class="label">渚涘簲鏂�:</span>
-                      <span class="value">{{ row.supplySide }}</span>
-                    </div>
                   </div>
                 </div>
                 <div v-else-if="row.isSpacer" class="spacer-cell"></div>
@@ -106,7 +118,7 @@
               </template>
             </el-table-column>
           </el-table-column>
-          
+
           <!-- 璐拱鏂瑰紡 -->
           <el-table-column label="璐拱鏂瑰紡" align="center">
             <el-table-column label="閿�鍞舰寮�/璐︽埛鏁伴噺" width="150">
@@ -140,7 +152,7 @@
               </template>
             </el-table-column>
           </el-table-column>
-          
+
           <!-- 鎬讳环 -->
           <el-table-column label="鎬讳环" align="center">
             <el-table-column label="鍗曚环" prop="unitPrice" width="90">
@@ -148,16 +160,16 @@
                 <div v-if="row.isSpacer" class="spacer-cell"></div>
                 <div v-else-if="!row.isMainOrder" class="price-info">
                   <span v-if="row.priceType === 'points'" class="price-points">
-                    {{ row.unitPrice }}
+                    绉垎 {{ row.unitPrice }}
                   </span>
                   <span v-else-if="row.priceType === 'currency'" class="price-currency">
-                    {{ row.unitPrice }}
+                    璐у竵 {{ row.unitPrice }}
                   </span>
                   <span v-else-if="row.priceType === 'agreement'" class="price-agreement">
-                    {{ row.unitPrice }}
+                    鍗忚
                   </span>
                   <span v-else-if="row.priceType === 'free'" class="price-free">
-                    {{ row.unitPrice }}
+                    鍏嶈垂
                   </span>
                 </div>
               </template>
@@ -169,20 +181,20 @@
               </template>
             </el-table-column>
           </el-table-column>
-          
+
           <!-- 鏈熼檺(骞�) -->
           <el-table-column label="鏈熼檺(骞�)" align="center" width="80">
             <el-table-column label="" prop="period" width="80">
               <template #default="{ row }">
                 <div v-if="row.isSpacer" class="spacer-cell"></div>
                 <div v-else-if="!row.isMainOrder" class="period-info">
-                  <span>{{ row.period }}</span>
-                  <span v-if="row.isPermanent" class="permanent">姘镐箙</span>
+                  <span v-if="row.period === 0" class="permanent">姘镐箙</span>
+                  <span v-else>{{ row.period }}</span>
                 </div>
               </template>
             </el-table-column>
           </el-table-column>
-          
+
           <!-- 鎿嶄綔 -->
           <el-table-column label="鎿嶄綔" align="center" width="120" class="operation-column">
             <el-table-column label="" width="120">
@@ -192,10 +204,26 @@
                   <div v-if="row.parentOrder && row.parentOrder.subOrders && row.parentOrder.subOrders.findIndex((sub: any) => sub.id === row.id) === 0" class="all-actions">
                     <div class="action-item">
                       <div class="action-buttons">
-                        <span v-if="row.parentOrder.status === 'WAIT_CONFIRM'" class="op-text warning">寰呬氦鏄撶‘璁�</span>
-                        <span v-else-if="row.parentOrder.status === 'WAIT_EVALUATE'" class="op-text warning">寰呰瘎浠�</span>
-                        <span v-else-if="row.parentOrder.status === 'FINISH'" class="op-text">宸插畬鎴�</span>
-                        <el-button type="primary" link size="small" @click="toDetail(row.parentOrder)">鏌ョ湅</el-button>
+                        <template v-for="action in getAvailableActions(row.parentOrder)" :key="action.type">
+                          <el-button
+                            v-if="action.type === ActionType.VIEW"
+                            type="primary"
+                            link
+                            size="small"
+                            @click="handleAction(action, row.parentOrder)"
+                          >
+                            鏌ョ湅
+                          </el-button>
+                          <!-- <el-button
+                            v-else-if="action.type === ActionType.TRACK"
+                            type="primary"
+                            link
+                            size="small"
+                            @click="handleAction(action, row.parentOrder)"
+                          >
+                            杩借釜
+                          </el-button> -->
+                        </template>
                       </div>
                     </div>
                   </div>
@@ -219,6 +247,12 @@
         />
       </div>
     </el-card>
+
+    <!-- 璁㈠崟鐘舵�佸璇濇 -->
+    <ProductOrderStatusDialog
+      v-model="orderStatusDialogVisible"
+      :order-id="currentOrderId"
+    />
   </div>
 </template>
 
@@ -226,54 +260,42 @@
 import { onMounted, reactive, ref } from 'vue'
 import { useRouter } from 'vue-router'
 import { Search, Refresh } from '@element-plus/icons-vue'
+import { ElMessage, ElMessageBox } from 'element-plus'
+import orderApi from '@/api/orderApi'
+import productApi from '@/api/productApi'
+import { useUserInfo } from '@/stores/modules/userInfo'
+import ProductOrderStatusDialog from '@/views/productManage/productOrderStatusDialog/index.vue'
+import { OrderWorkflowController, OrderStatus, ActionType, PageType, StatusMapper } from '@/utils/orderWorkflow'
+import { queryUserDetail } from '@/api/userInfo'
 
 const router = useRouter()
+const userStore = useUserInfo()
+const areaIdTreeRef=ref()
 
-// 鐘舵�侀�夐」
+// 鐘舵�侀�夐」锛堟洿鏂颁负鏂扮殑宸ヤ綔娴佺▼鐘舵�侊級
 const statusOptions = [
   { label: '鍏ㄩ儴', value: '' },
+  { label: '寰呬笂浼犳枃浠�', value: 'WAIT_UPLOAD' },
+  { label: '寰呮巿鏉�', value: 'WAIT_AUTHORIZE' },
   { label: '寰呬氦鏄撶‘璁�', value: 'WAIT_CONFIRM' },
-  { label: '寰呰瘎浠�', value: 'WAIT_EVALUATE' },
-  { label: '宸插畬鎴�', value: 'FINISH' },
+  { label: '宸插畬鎴�', value: 'COMPLETED' },
+  { label: '宸茶瘎浠�', value: 'EVALUATED' },
 ]
 
-// 琛屼笟棰嗗煙閫夐」
-const industryOptions = [
-  { label: '寤虹瓚宸ョ▼', value: 'construction' },
-  { label: '浜ら�氬伐绋�', value: 'transportation' },
-  { label: '姘村埄宸ョ▼', value: 'water' },
-  { label: '鐢靛姏宸ョ▼', value: 'power' },
-]
-
-// 鍗曚綅宸ョ▼閫夐」
-const unitProjectOptions = [
-  { label: '鍦熷缓宸ョ▼', value: 'civil' },
-  { label: '瀹夎宸ョ▼', value: 'installation' },
-  { label: '瑁呴グ宸ョ▼', value: 'decoration' },
-]
-
-// 浜у搧绫诲瀷閫夐」
-const productTypeOptions = [
-  { label: '浼佷笟绉佹湁SaaS鐗堣鍙�', value: 'enterprise_private' },
-  { label: '浼佷笟鍏湁SaaS鐗堣鍙�', value: 'enterprise_public' },
-  { label: '椤圭洰鍏湁SaaS鐗堣鍙�', value: 'project_public' },
-  { label: '涓汉鍏湁SaaS鐗堣鍙�', value: 'personal_public' },
-]
-
-// 浜у搧绫诲瀷瀛愮骇閫夐」
-const productSubTypeOptions = [
-  { label: '鍩虹鐗�', value: 'basic' },
-  { label: '鏍囧噯鐗�', value: 'standard' },
-  { label: '楂樼骇鐗�', value: 'premium' },
-]
+// 鍔ㄦ�侀�夐」鏁版嵁
+const industryOptions = ref<any[]>([])
+const unitProjectOptions = ref<any[]>([])
+const productTypeOptions = ref<any[]>([])
+const productSubTypeOptions = ref<any[]>([])
 
 // 鏌ヨ鏉′欢
 const query = reactive({
   productName: '',
   industry: '',
-  unitProject: '',
+  unitProject: [],
   productType: '',
   productSubType: '',
+  importantDistrictIdList: [],
   orderNo: '',
   status: '',
   dateRange: [],
@@ -282,215 +304,182 @@
 // 鍒嗛〉淇℃伅
 const page = reactive({ current: 1, size: 10, total: 0 })
 
-// 璁㈠崟鍒楄〃鏁版嵁
+// 璁㈠崟鍒楄〃鏁版嵁锛堝寘鍚富璁㈠崟鍜屽瓙璁㈠崟锛�
 const orderList = ref<any[]>([])
 
-// 妯℃嫙鏁版嵁鐢ㄤ簬灞曠ず
-const mockData = [
-  {
-    id: '1',
-    isMainOrder: true,
-    applyTime: '2025-05-21 10:00:00',
-    orderNo: '4348442557619205545',
-    demandSide: '涓浗璺ˉ宸ョ▼鏈夐檺鍏徃',
-    supplySide: '涓氦鏂硅繙绉戞妧鏈夐檺鍏徃',
-    status: 'WAIT_CONFIRM',
-    statusName: '寰呬氦鏄撶‘璁�',
-    subOrders: [
-      {
-        id: '1-1',
-        isMainOrder: false,
-        productName: '涓氦鏂硅繙鏅鸿兘瀹炴祴瀹為噺绠$悊绯荤粺',
-        suiteName: '浼佷笟绉佹湁SaaS鐗堣鍙�',
-        salesForm: '涔版柇',
-        accountCount: 50,
-        demandSide: '涓浗璺ˉ宸ョ▼鏈夐檺鍏徃',
-        customerObject: '浼佷笟',
-        concurrentCount: 50,
-        priceType: 'points',
-        unitPrice: '绉垎: 50,000/濂�',
-        quantity: 1,
-        period: 1,
-        isPermanent: true,
-        status: 'WAIT_CONFIRM',
-      },
-      {
-        id: '1-2',
-        isMainOrder: false,
-        productName: '涓氦鏂硅繙鏅鸿兘瀹炴祴瀹為噺绠$悊绯荤粺',
-        suiteName: '浼佷笟绉佹湁SaaS鐗圤TA鍗囩骇鏈嶅姟',
-        salesForm: 'OTA鏈嶅姟',
-        accountCount: 50,
-        demandSide: '涓浗璺ˉ宸ョ▼鏈夐檺鍏徃',
-        customerObject: '浼佷笟',
-        concurrentCount: 50,
-        priceType: 'currency',
-        unitPrice: '璐у竵: 7,500/濂�/骞�',
-        quantity: 1,
-        period: 1,
-        isPermanent: false,
-        status: 'WAIT_CONFIRM',
-      },
-      {
-        id: '1-3',
-        isMainOrder: false,
-        productName: '涓氦鏂硅繙鏅鸿兘瀹炴祴瀹為噺绠$悊绯荤粺',
-        suiteName: '浼佷笟绉佹湁SaaS鐗堢敤鎴峰閲忓寘',
-        salesForm: '绉佹湁澧為噺鍖�',
-        accountCount: 100,
-        demandSide: '涓浗璺ˉ宸ョ▼鏈夐檺鍏徃',
-        customerObject: '浼佷笟',
-        concurrentCount: 100,
-        priceType: 'agreement',
-        unitPrice: '鍗忚:/骞�',
-        quantity: 1,
-        period: 1,
-        isPermanent: false,
-        status: 'WAIT_CONFIRM',
-      },
-      {
-        id: '1-4',
-        isMainOrder: false,
-        productName: '涓氦鏂硅繙鏅鸿兘瀹炴祴瀹為噺绠$悊绯荤粺',
-        suiteName: '涓汉鍏湁SaaS鐗堣鍙�',
-        salesForm: '绉佹湁澧為噺鍖�',
-        accountCount: 50,
-        demandSide: '涓浗璺ˉ宸ョ▼鏈夐檺鍏徃',
-        customerObject: '涓汉',
-        concurrentCount: 50,
-        priceType: 'free',
-        unitPrice: '鍏嶈垂:/骞�',
-        quantity: 3,
-        period: 3,
-        isPermanent: true,
-        status: 'WAIT_CONFIRM',
-      },
-    ],
-  },
-  {
-    id: '2',
-    isMainOrder: true,
-    applyTime: '2025-05-20 10:00:00',
-    orderNo: '4347442557619205545',
-    demandSide: '涓氦鍏矾瑙勫垝璁捐闄㈡湁闄愬叕鍙�',
-    supplySide: '鍗庝负杞欢鎶�鏈湁闄愬叕鍙�',
-    status: 'WAIT_CONFIRM',
-    statusName: '寰呬氦鏄撶‘璁�',
-    subOrders: [
-      {
-        id: '2-1',
-        isMainOrder: false,
-        productName: '鍩轰簬鍥戒骇鑺墖瀹界獎铻嶅悎鑷粍缃戣澶囩殑搴旂敤',
-        suiteName: '浼佷笟鍏湁SaaS鐗堣鍙�',
-        salesForm: '绉熻祦',
-        accountCount: 100,
-        demandSide: '涓氦鍏矾瑙勫垝璁捐闄㈡湁闄愬叕鍙�',
-        customerObject: '浼佷笟',
-        concurrentCount: 100,
-        priceType: 'currency',
-        unitPrice: '璐у竵: 80,000/骞�',
-        quantity: 1,
-        period: 2,
-        isPermanent: false,
-        status: 'WAIT_CONFIRM',
-      },
-    ],
-  },
-  {
-    id: '3',
-    isMainOrder: true,
-    applyTime: '2025-05-19 10:00:00',
-    orderNo: '4347342557619205545',
-    demandSide: '涓氦绗洓鑸姟宸ョ▼灞�鏈夐檺鍏徃',
-    supplySide: '涓氦绗洓鑸姟宸ョ▼灞�鏈夐檺鍏徃',
-    status: 'WAIT_CONFIRM',
-    statusName: '寰呬氦鏄撶‘璁�',
-    subOrders: [
-      {
-        id: '3-1',
-        isMainOrder: false,
-        productName: '楂樻々鐮佸ご杈呭姪鍑哄浘宸ュ叿绠�',
-        suiteName: '椤圭洰鍏湁SaaS鐗堣鍙�',
-        salesForm: '绉熻祦',
-        accountCount: 50,
-        demandSide: '涓氦绗洓鑸姟宸ョ▼灞�鏈夐檺鍏徃',
-        customerObject: '椤圭洰閮�',
-        concurrentCount: 50,
-        priceType: 'currency',
-        unitPrice: '璐у竵: 60,000/骞�',
-        quantity: 1,
-        period: 3,
-        isPermanent: false,
-        status: 'WAIT_CONFIRM',
-      },
-    ],
-  },
-  {
-    id: '4',
-    isMainOrder: true,
-    applyTime: '2025-05-18 10:00:00',
-    orderNo: '4347442557619205545',
-    demandSide: '涓氦鍏矾瑙勫垝璁捐闄㈡湁闄愬叕鍙�',
-    supplySide: '涓氦鍏矾瑙勫垝璁捐闄㈡湁闄愬叕鍙�',
-    status: 'WAIT_EVALUATE',
-    statusName: '寰呰瘎浠�',
-    subOrders: [
-      {
-        id: '4-1',
-        isMainOrder: false,
-        productName: '鍏矾鏁板瓧鍖栨柟妗堣璁$郴缁�',
-        suiteName: '浼佷笟鍏湁SaaS鐗堣鍙�',
-        salesForm: '绉熻祦',
-        accountCount: 100,
-        demandSide: '涓氦鍏矾瑙勫垝璁捐闄㈡湁闄愬叕鍙�',
-        customerObject: '浼佷笟',
-        concurrentCount: 100,
-        priceType: 'currency',
-        unitPrice: '璐у竵: 80,000/骞�',
-        quantity: 1,
-        period: 1,
-        isPermanent: false,
-        status: 'WAIT_EVALUATE',
-      },
-    ],
-  },
-  {
-    id: '5',
-    isMainOrder: true,
-    applyTime: '2025-05-17 10:00:00',
-    orderNo: '4347342557619205545',
-    demandSide: '涓氦绗洓鑸姟宸ョ▼灞�鏈夐檺鍏徃',
-    supplySide: '涓氦绗笁鑸姟宸ョ▼灞�鏈夐檺鍏徃',
-    status: 'FINISH',
-    statusName: '宸插畬鎴�',
-    subOrders: [
-      {
-        id: '5-1',
-        isMainOrder: false,
-        productName: '鍩轰簬鏃犱汉鏈虹殑浼佷笟绾у彲瑙嗗寲椤圭洰绠$悊绯荤粺',
-        suiteName: '椤圭洰鍏湁SaaS鐗堣鍙�',
-        salesForm: '绉熻祦',
-        accountCount: 50,
-        demandSide: '涓氦绗洓鑸姟宸ョ▼灞�鏈夐檺鍏徃',
-        customerObject: '椤圭洰閮�',
-        concurrentCount: 50,
-        priceType: 'free',
-        unitPrice: '鍏嶈垂:/骞�',
-        quantity: 1,
-        period: 1,
-        isPermanent: true,
-        status: 'FINISH',
-      },
-    ],
-  },
-]
+// 璁㈠崟鐘舵�佸璇濇鐩稿叧
+const orderStatusDialogVisible = ref(false)
+const currentOrderId = ref<string>('')
+
+// 浣跨敤宸ヤ綔娴佺▼鎺у埗鍣ㄧ殑鐘舵�佹槧灏�
+const statusUiToServer: Record<string, string> = {
+  WAIT_UPLOAD: OrderStatus.WAIT_UPLOAD,
+  WAIT_AUTHORIZE: OrderStatus.WAIT_AUTHORIZE,
+  WAIT_CONFIRM: OrderStatus.WAIT_CONFIRM,
+  COMPLETED: OrderStatus.COMPLETED,
+  EVALUATED: OrderStatus.EVALUATED,
+}
+
+const statusServerToUi: Record<string, string> = {
+  [OrderStatus.WAIT_UPLOAD]: 'WAIT_UPLOAD',
+  [OrderStatus.WAIT_AUTHORIZE]: 'WAIT_AUTHORIZE',
+  [OrderStatus.WAIT_CONFIRM]: 'WAIT_CONFIRM',
+  [OrderStatus.COMPLETED]: 'COMPLETED',
+  [OrderStatus.EVALUATED]: 'EVALUATED',
+}
+
+const formatDateTime = (val?: string) => {
+  if (!val) return ''
+  return val.replace('T', ' ').slice(0, 19)
+}
+
+const normalizePriceType = (val?: string): 'points' | 'currency' | 'agreement' | 'free' => {
+  if (!val) return 'currency'
+  const s = String(val)
+  if (/(绉垎|points)/i.test(s)) return 'points'
+  if (/(鍗忚|agreement)/i.test(s)) return 'agreement'
+  if (/(鍏嶈垂|free)/i.test(s)) return 'free'
+  return 'currency'
+}
+
+// 鑾峰彇琛屼笟棰嗗煙閫夐」
+const getIndustryOptions = async () => {
+  try {
+    const res = await productApi.getCategoryByParent({ parentCode: 'business_direction' })
+    if (res?.code === 200 && res.data) {
+      industryOptions.value = res.data.map((item: any) => ({
+        label: item.name,
+        value: item.id
+      }))
+    }
+  } catch (error) {
+    console.error('鑾峰彇琛屼笟棰嗗煙閫夐」澶辫触:', error)
+  }
+}
+
+// 鑾峰彇浜у搧绫诲瀷閫夐」
+const getProductTypeOptions = async () => {
+  try {
+    const res = await productApi.getCategoryByParent({ parentCode: 'ProductTechnologyType' })
+    if (res?.code === 200 && res.data) {
+      productTypeOptions.value = res.data.map((item: any) => ({
+        label: item.name,
+        value: item.id
+      }))
+    }
+  } catch (error) {
+    console.error('鑾峰彇浜у搧绫诲瀷閫夐」澶辫触:', error)
+  }
+}
+
+// 鏍规嵁琛屼笟棰嗗煙鑾峰彇鍗曚綅宸ョ▼閫夐」
+const getUnitProjectOptions = async (industryCode: string) => {
+  if (!industryCode) {
+    unitProjectOptions.value = []
+    return
+  }
+  try {
+    const res = await productApi.getCategoryByParent({ parentId: industryCode })
+    if (res?.code === 200 && res.data) {
+      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
+  }
+}
+
+// 鏍规嵁浜у搧绫诲瀷鑾峰彇浜у搧瀛愮骇閫夐」
+const getProductSubTypeOptions = async (productTypeCode: string) => {
+  if (!productTypeCode) {
+    productSubTypeOptions.value = []
+    return
+  }
+  try {
+    const res = await productApi.getCategoryByParent({ parentId: productTypeCode })
+    if (res?.code === 200 && res.data) {
+      productSubTypeOptions.value = res.data.map((item: any) => ({
+        label: item.name,
+        value: item.id
+      }))
+    }
+  } catch (error) {
+    console.error('鑾峰彇浜у搧瀛愮骇閫夐」澶辫触:', error)
+    productSubTypeOptions.value = []
+  }
+}
+
+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(item.value)
+      }
+    })
+  }
+}
+
+const importantAreaClear=()=>{
+  query.unitProject = []
+  query.importantDistrictIdList = []
+  areaIdTreeRef.value.setCheckedKeys([])
+}
+
+// 澶勭悊琛屼笟棰嗗煙鍙樺寲
+const handleIndustryChange = async (value: string) => {
+  // 娓呯┖鍗曚綅宸ョ▼閫夋嫨
+  query.unitProject = ''
+  // 鑾峰彇瀵瑰簲鐨勫崟浣嶅伐绋嬮�夐」
+  await getUnitProjectOptions(value)
+}
+
+// 澶勭悊浜у搧绫诲瀷鍙樺寲
+const handleProductTypeChange = async (value: string) => {
+  // 娓呯┖浜у搧瀛愮骇閫夋嫨
+  query.productSubType = ''
+  // 鑾峰彇瀵瑰簲鐨勪骇鍝佸瓙绾ч�夐」
+ // await getProductSubTypeOptions(value)
+}
 
 // 鑾峰彇鐘舵�佺被鍨�
 const getStatusType = (status: string) => {
   const statusMap: Record<string, 'warning' | 'danger' | 'success' | 'info'> = {
+    WAIT_UPLOAD: 'warning',
+    WAIT_AUTHORIZE: 'warning',
     WAIT_CONFIRM: 'warning',
-    WAIT_EVALUATE: 'warning',
-    FINISH: 'success',
+    COMPLETED: 'success',
+    EVALUATED: 'success',
   }
   return statusMap[status] || 'info'
 }
@@ -574,23 +563,89 @@
   }
 }
 
-// 鎼滅储澶勭悊
+// 鎼滅储澶勭悊锛堟帴鍏ョ湡瀹炲悗绔級
 const handleSearch = async () => {
-  // 浣跨敤妯℃嫙鏁版嵁
-  const flatData: any[] = []
-  mockData.forEach(order => {
-    flatData.push(order)
-    if (order.subOrders) {
-      order.subOrders.forEach((subOrder: any) => {
-        flatData.push({ ...subOrder, parentOrder: order })
-      })
+  try {
+    // 鑾峰彇鐢ㄦ埛ID浣滀负providerId锛屽鏋滄病鏈夊垯浣跨敤榛樿鍊�
+    const userId = userStore.getUserId
+    const providerId = userId ? userId : '' // 浣跨敤榛樿鍊�1浣滀负涓存椂瑙e喅鏂规
+
+    const payload: any = {
+      pageNum: page.current,
+      pageSize: page.size,
+      productName: query.productName || undefined,
+      orderId: query.orderNo || undefined,
+      providerId: providerId,
     }
-    // 鍦ㄦ瘡涓鍗曞潡鐨勬湯灏炬彃鍏ヤ竴涓垎闅旂┖琛�
-    flatData.push({ isSpacer: true, isMainOrder: false, parentOrder: order })
-  })
-  
-  orderList.value = flatData
-  page.total = mockData.length
+    if (query.status) payload.orderStatus = statusUiToServer[query.status]
+    if (Array.isArray(query.dateRange) && query.dateRange.length === 2) {
+      payload.applyTimeStart = query.dateRange[0]
+      payload.applyTimeEnd = query.dateRange[1]
+    }
+
+    // 娣诲姞浜у搧鏉′欢鏌ヨ
+    if (query.industry) payload.industryId = query.industry
+    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.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 : []
+    page.total = Number(pageData?.total || 0)
+
+    const flatData: any[] = []
+    list.forEach((order: any) => {
+      const uiStatus = statusServerToUi[order.orderStatus] || 'WAIT_UPLOAD'
+      const mainRow: any = {
+        id: order.orderId,
+        isMainOrder: true,
+        applyTime: formatDateTime(order.applyTime || ''),
+        orderNo: order.orderId,
+        demandSide: order.demandSideName || '',
+        supplySide: order.providerName || '',
+        status: uiStatus,
+        statusName: order.orderStatus || '',
+        orderStatus: StatusMapper.toUIStatus(order.orderStatus), // 杞崲涓烘爣鍑嗙姸鎬佹灇涓�
+        workFlowId: order.workflowId || ''
+      }
+
+      const subOrders: any[] = Array.isArray(order?.orderDetails)
+        ? order.orderDetails.map((d: any, i: number) => ({
+            id: `${order.orderId}-${i + 1}`,
+            isMainOrder: false,
+            productName: order.productName || '',
+            suiteName: d.suiteName,
+            salesForm: d.salesForm,
+            accountCount: d.accountLimit,
+            customerObject: d.customerType,
+            concurrentCount: d.concurrentNodes,
+            priceType: normalizePriceType(d.priceType),
+            unitPrice: d.unitPrice,
+            quantity: d.quantity,
+            period: d.duration,
+          }))
+        : []
+
+      ;(mainRow as any).subOrders = subOrders
+
+      flatData.push(mainRow)
+      subOrders.forEach((sub) => flatData.push({ ...sub, parentOrder: mainRow }))
+      flatData.push({ isSpacer: true, isMainOrder: false, parentOrder: mainRow })
+    })
+
+    orderList.value = flatData
+  } catch (error: any) {
+    console.error('鏌ヨ鍗栧璁㈠崟鍒楄〃澶辫触:', error)
+    ElMessage.error(error?.message || '鏌ヨ鍗栧璁㈠崟鍒楄〃澶辫触')
+    orderList.value = []
+    page.total = 0
+  }
 }
 
 // 閲嶇疆
@@ -605,14 +660,69 @@
     status: '',
     dateRange: [],
   })
+  // 娓呯┖鍔ㄦ�侀�夐」
+  unitProjectOptions.value = []
+  productSubTypeOptions.value = []
   page.current = 1
   handleSearch()
+}
+
+// 鑾峰彇鍙敤鎿嶄綔鍒楄〃
+const getAvailableActions = (order: any) => {
+  if (!order.orderStatus) return []
+  return OrderWorkflowController.getAvailableActions(PageType.SELLER_CENTER, order.orderStatus)
+}
+
+// 杩借釜璁㈠崟 - 鏄剧ず璁㈠崟鐘舵�佸璇濇
+const showOrderTrack = (row: any) => {
+  currentOrderId.value = row.id
+  orderStatusDialogVisible.value = true
+}
+
+// 澶勭悊鎿嶄綔鐐瑰嚮
+const handleAction = (action: any, order: any) => {
+  switch (action.type) {
+    case ActionType.VIEW:
+      toDetail(order)
+      break
+    case ActionType.TRACK:
+      showOrderTrack(order)
+      break
+    default:
+      console.warn('鏈煡鐨勬搷浣滅被鍨�:', action.type)
+  }
 }
 
 // 璺敱璺宠浆
 const toDetail = (row: any) => router.push({ name: 'tradeOrderDetail', params: { id: row.id } })
 
-onMounted(handleSearch)
+onMounted(async ()=>{
+  // 鑾峰彇鐢ㄦ埛淇℃伅
+  if (!userStore.getUserId) {
+    try {
+      const res: any = await queryUserDetail()
+      if (res?.code === 200 && res.data) {
+        userStore.updateUserDetail(res.data)
+      } else {
+        ElMessage.error(res?.msg || '鏃犳硶鑾峰彇鐢ㄦ埛淇℃伅锛岃鍏堢櫥褰�')
+        return
+      }
+    } catch (e) {
+      console.error('鑾峰彇鐢ㄦ埛璇︽儏澶辫触:', e)
+      ElMessage.error('鑾峰彇鐢ㄦ埛淇℃伅澶辫触锛岃绋嶅悗閲嶈瘯')
+      return
+    }
+  }
+
+  // 鑾峰彇鍒濆閫夐」鏁版嵁
+  await Promise.all([
+    getIndustryOptions(),
+    getProductTypeOptions()
+  ])
+
+  // 鎵ц鎼滅储
+  handleSearch()
+})
 </script>
 
 <style scoped lang="scss">
@@ -647,7 +757,7 @@
       border-bottom: 2px solid #e4e7ed; // 涓庡垎闅旇涓�鑷寸殑涓嬭竟妗�
     }
   }
-  
+
   // 璋冩暣琛ㄥご楂樺害
   tr:first-child {
     th {
@@ -664,18 +774,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; }
@@ -689,7 +799,7 @@
     .el-form-item {
       margin-bottom: 16px;
       margin-right: 20px;
-      
+
       &:last-child {
         margin-right: 0;
       }
@@ -700,7 +810,7 @@
 .table-container {
   position: relative;
   z-index: 1;
-  
+
   .custom-table {
     // 琛ㄥご绗簩琛屾枃瀛楀ぇ灏忚皟鏁�
     .el-table__header-wrapper {
@@ -713,7 +823,7 @@
         }
       }
     }
-    
+
     // 纭繚琛ㄥご鎵�鏈夎鐨勬枃瀛楀ぇ灏忎竴鑷�
     .el-table__header {
       th {
@@ -723,23 +833,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;
         }
@@ -756,20 +866,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;
@@ -784,22 +894,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;
@@ -811,7 +921,7 @@
   align-items: center;
   gap: 8px;
   font-size: 12px;
-  
+
   .permanent {
     color: #909399;
     font-size: 12px;
@@ -843,18 +953,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;
@@ -875,7 +985,7 @@
   color: #303133;
   text-align: center;
   line-height: 1.4;
-  
+
   .all-actions {
     display: flex;
     flex-direction: column;
@@ -883,10 +993,10 @@
     justify-content: center;
     gap: 6px;
     width: 100%;
-    
+
     .action-item {
       width: 100%;
-      
+
       .action-buttons {
         display: flex;
         flex-direction: column;
@@ -894,7 +1004,7 @@
         align-items: center;
         justify-content: center;
         width: 100%;
-        
+
         .el-button {
           width: 100%;
           text-align: center;
@@ -906,7 +1016,7 @@
           height: auto;
           line-height: 1.2;
         }
-        
+
         .op-text {
           margin: 4px 0;
           text-align: center;
@@ -926,12 +1036,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;
 }
 
@@ -952,11 +1062,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