p-honggang.li
5 天以前 22cc8ce22157a32bfcd4ee14d824769c6e318cec
修改取消订单列表展示的问题
4个文件已修改
83 ■■■■■ 已修改文件
src/utils/orderWorkflow.ts 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/approveManage/tradeApproval/approve.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tradeManage/buyer/index.vue 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tradeManage/evaluate/index.vue 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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
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 || '')
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'
}
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或用户ID不能为空')
@@ -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) {