From 22cc8ce22157a32bfcd4ee14d824769c6e318cec Mon Sep 17 00:00:00 2001
From: p-honggang.li <p-honggang.li@pcitc.com>
Date: 星期一, 08 九月 2025 23:30:57 +0800
Subject: [PATCH] 修改取消订单列表展示的问题

---
 src/views/tradeManage/buyer/index.vue             |    2 +
 src/views/tradeManage/evaluate/index.vue          |   57 +++++++++++++++++++++++++++-
 src/views/approveManage/tradeApproval/approve.vue |    4 +-
 src/utils/orderWorkflow.ts                        |   20 +++++++++-
 4 files changed, 76 insertions(+), 7 deletions(-)

diff --git a/src/utils/orderWorkflow.ts b/src/utils/orderWorkflow.ts
index 14ba710..4a46a8c 100644
--- a/src/utils/orderWorkflow.ts
+++ b/src/utils/orderWorkflow.ts
@@ -10,7 +10,8 @@
   WAIT_APPROVAL_AUTHORIZE = '寰呭鎵规巿鏉�',
   WAIT_CONFIRM = '寰呬氦鏄撶‘璁�',     // 3
   COMPLETED = '宸插畬鎴�',           // 4
-  EVALUATED = '宸茶瘎浠�'            // 5 (鏈�缁堢姸鎬�)
+  EVALUATED = '宸茶瘎浠�',            // 5 (鏈�缁堢姸鎬�)
+  CANCELED = '宸插彇娑�'
 }
 
 // 鎿嶄綔绫诲瀷鏋氫妇
@@ -68,6 +69,10 @@
     [OrderStatus.EVALUATED]: [
       { type: ActionType.VIEW, routeName: 'tradeOrderDetail' },
       { type: ActionType.TRACK }
+    ],
+    [OrderStatus.CANCELED]: [
+      { type: ActionType.VIEW, routeName: 'tradeOrderDetail' },
+      { type: ActionType.TRACK }
     ]
   },
   [PageType.BUYER_CENTER]: {
@@ -101,6 +106,10 @@
     [OrderStatus.EVALUATED]: [
       { type: ActionType.VIEW, routeName: 'tradeOrderDetail' },
       { type: ActionType.TRACK }
+    ],
+    [OrderStatus.CANCELED]: [
+      { type: ActionType.VIEW, routeName: 'tradeOrderDetail' },
+      { type: ActionType.TRACK }
     ]
   },
   [PageType.SELLER_CENTER]: {
@@ -128,6 +137,10 @@
     [OrderStatus.EVALUATED]: [
       { type: ActionType.VIEW, routeName: 'tradeOrderDetail' },
       { type: ActionType.TRACK }
+    ],
+    [OrderStatus.CANCELED]: [
+      { type: ActionType.VIEW, routeName: 'tradeOrderDetail' },
+      { type: ActionType.TRACK }
     ]
   }
 }
@@ -139,7 +152,8 @@
   [OrderStatus.WAIT_APPROVAL_AUTHORIZE]: OrderStatus.WAIT_CONFIRM,
   [OrderStatus.WAIT_CONFIRM]: OrderStatus.COMPLETED,
   [OrderStatus.COMPLETED]: OrderStatus.EVALUATED,
-  [OrderStatus.EVALUATED]: null // 鏈�缁堢姸鎬侊紝鏃犱笅涓�鐘舵��
+  [OrderStatus.EVALUATED]: null, // 鏈�缁堢姸鎬侊紝鏃犱笅涓�鐘舵��
+  [OrderStatus.CANCELED]: null
 }
 
 /**
@@ -271,6 +285,8 @@
         return OrderStatus.COMPLETED
       case '宸茶瘎浠�':
         return OrderStatus.EVALUATED
+      case '宸插彇娑�':
+        return OrderStatus.CANCELED
       default:
         console.warn(`鏈煡鐨勮鍗曠姸鎬�: ${serverStatus}锛岄粯璁よ繑鍥炲緟鎺堟潈鐘舵�乣)
         return OrderStatus.WAIT_AUTHORIZE
diff --git a/src/views/approveManage/tradeApproval/approve.vue b/src/views/approveManage/tradeApproval/approve.vue
index 461641e..5c64ccb 100644
--- a/src/views/approveManage/tradeApproval/approve.vue
+++ b/src/views/approveManage/tradeApproval/approve.vue
@@ -510,7 +510,7 @@
     const orderId = String(route.params.id || '')
     console.log(String(route.params.taskId || ''))
     const taskId1 = taskId.value
-    const userId = userStore.getUserId ? Number(userStore.getUserId) : undefined
+    const userId = userStore.getUserId ? userStore.getUserId : undefined
     const comments = approvalForm.comments.trim()
 
     if (!orderId || !userId) {
@@ -592,7 +592,7 @@
     })
     
     const orderId = String(route.params.id || '')
-    const userId = userStore.getUserId ? Number(userStore.getUserId) : undefined
+    const userId = userStore.getUserId ?  userStore.getUserId : undefined
     const comments = approvalForm.comments.trim()
     const taskId1 = String(route.params.taskId || '')
 
diff --git a/src/views/tradeManage/buyer/index.vue b/src/views/tradeManage/buyer/index.vue
index ae15918..84e7ce4 100644
--- a/src/views/tradeManage/buyer/index.vue
+++ b/src/views/tradeManage/buyer/index.vue
@@ -343,6 +343,7 @@
   [OrderStatus.WAIT_CONFIRM]: 'WAIT_CONFIRM',
   [OrderStatus.COMPLETED]: 'COMPLETED',
   [OrderStatus.EVALUATED]: 'EVALUATED',
+  [OrderStatus.CANCELED]: 'CANCELED'
 }
 
 const formatDateTime = (val?: string) => {
@@ -454,6 +455,7 @@
     WAIT_CONFIRM: 'warning',
     COMPLETED: 'success',
     EVALUATED: 'success',
+    CANCELED: 'danger'
   }
   return statusMap[status] || 'info'
 }
diff --git a/src/views/tradeManage/evaluate/index.vue b/src/views/tradeManage/evaluate/index.vue
index f2d0411..52a0fcd 100644
--- a/src/views/tradeManage/evaluate/index.vue
+++ b/src/views/tradeManage/evaluate/index.vue
@@ -330,6 +330,9 @@
 import orderApi from '@/api/orderApi'
 import { useUserInfo } from '@/stores/modules/userInfo'
 import createAxios from '@/utils/axios'
+import {queryUserDetail} from "@/api/userInfo";
+import productApi from "@/api/productApi";
+import sysUserService from "@/api/sysUser";
 
 const route = useRoute()
 const router = useRouter()
@@ -395,13 +398,61 @@
 onMounted(async () => {
   const orderId = String(route.params.id || '')
   if (!orderId) return
-  
+  // 鑾峰彇鐢ㄦ埛淇℃伅
+  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
+    }
+  }
   try {
     const res = (await orderApi.getOrderDetail(orderId)) as any
     const data = res?.data || {}
 
     const statusName: string = data.orderStatus || ''
     const uiStatus = statusServerToUi[statusName] || 'INFO'
+
+    // 鏍规嵁浜у搧id鑾峰彇浜у搧淇℃伅锛屾洿鏂板ご閮ㄥ睍绀�
+    try {
+      if (data.productId) {
+        const detailRes: any = await productApi.getProductById({ id: data.productId })
+        if (detailRes?.code === 200 && detailRes.data) {
+          // 鐢ㄤ骇鍝佽鎯呰ˉ鍏ㄥご淇℃伅
+          data.productName = detailRes.data.name || data.productName
+          data.providerName = detailRes.data.submissionUnit || data.providerName
+          data.industry = detailRes.data.industrialChainName || data.industry
+          data.productDesc = detailRes.data.describe || data.productDesc
+          data.projectUnit = detailRes.data.importantAreaName || data.productDesc
+          data.productType = detailRes.data.typeName || data.productDesc
+        }
+      }
+    } catch (e) {
+      // 蹇界暐浜у搧璇︽儏澶辫触锛屼笉闃诲璁㈠崟璇︽儏
+    }
+
+    // 鑾峰彇鐢ㄦ埛淇℃伅
+    try {
+      const userRes: any = await sysUserService.getUserdetail({ userId: data.userId })
+      if (userRes?.code === 200 && userRes.data) {
+        // 鐢ㄤ骇鍝佽鎯呰ˉ鍏ㄥご淇℃伅
+        data.unitName = userRes.data.unitName || data.unitName
+        data.userName = userRes.data.name || data.userName
+        data.userDept = userRes.data.departmentName || data.userDept
+        data.userPhone = userRes.data.phone || data.userPhone
+        data.userAccount = userRes.data.username || data.userAccount
+      }
+    }catch (e){
+
+    }
 
     // 鏄犲皠璁㈠崟璇︽儏澶撮儴淇℃伅
     const head = {
@@ -498,7 +549,7 @@
 const submit = async () => {
   try {
     const orderId = String(route.params.id || '')
-    const userId = userStore.getUserId ? Number(userStore.getUserId) : undefined
+    const userId = userStore.getUserId ? userStore.getUserId : undefined
     
     if (!orderId || !userId) {
       ElMessage.error('璁㈠崟ID鎴栫敤鎴稩D涓嶈兘涓虹┖')
@@ -839,7 +890,7 @@
     })
 
     const orderId = String(route.params.id || '')
-    const userId = userStore.getUserId ? Number(userStore.getUserId) : undefined
+    const userId = userStore.getUserId ?  userStore.getUserId : undefined
     const content = evaluationForm.content.trim()
 
     if (!orderId || !userId) {

--
Gitblit v1.8.0