p-honggang.li
5 天以前 80ca024e9ae633df0dc9f4e8f533f33b526afb3d
src/views/tradeManage/confirm/index.vue
@@ -242,6 +242,7 @@
import createAxios from '@/utils/axios'
import productApi from '@/api/productApi'
import sysUserService from '@/api/sysUser'
import {queryUserDetail} from "@/api/userInfo";
const route = useRoute()
const router = useRouter()
@@ -294,7 +295,24 @@
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 || {}
@@ -432,6 +450,7 @@
  try {
    const orderId = String(route.params.id || '')
    const userId = userStore.getUserId ? Number(userStore.getUserId) : undefined
    console.log(userId)
    
    if (!orderId || !userId) {
      ElMessage.error('订单ID或用户ID不能为空')