细节提示
This commit is contained in:
parent
7bfd2696d5
commit
ac401b0b52
|
|
@ -30,7 +30,6 @@ service.interceptors.response.use(
|
||||||
(response) => response.data,
|
(response) => response.data,
|
||||||
(error) => {
|
(error) => {
|
||||||
const status = error.response?.status
|
const status = error.response?.status
|
||||||
const message = error.response?.data?.message
|
|
||||||
|
|
||||||
if (status === 401) {
|
if (status === 401) {
|
||||||
// 未登录或 token 过期,清除凭证并跳转登录页
|
// 未登录或 token 过期,清除凭证并跳转登录页
|
||||||
|
|
@ -39,9 +38,8 @@ service.interceptors.response.use(
|
||||||
ElMessage.error('登录已过期,请重新登录')
|
ElMessage.error('登录已过期,请重新登录')
|
||||||
} else if (status === 403) {
|
} else if (status === 403) {
|
||||||
ElMessage.error('权限不足')
|
ElMessage.error('权限不足')
|
||||||
} else {
|
|
||||||
ElMessage.error(message || '请求失败')
|
|
||||||
}
|
}
|
||||||
|
// 其他错误(如 400)不在此弹提示,由业务代码自行处理
|
||||||
|
|
||||||
return Promise.reject(error)
|
return Promise.reject(error)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ onMounted(async () => {
|
||||||
const res = await request.get('/admin/dashboard')
|
const res = await request.get('/admin/dashboard')
|
||||||
Object.assign(data, res)
|
Object.assign(data, res)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// 错误已由拦截器处理
|
ElMessage.error('加载数据失败')
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ async function handleLogin() {
|
||||||
ElMessage.success('登录成功')
|
ElMessage.success('登录成功')
|
||||||
router.push('/')
|
router.push('/')
|
||||||
} catch {
|
} catch {
|
||||||
// 错误已由响应拦截器处理
|
ElMessage.error('登录失败,请检查用户名和密码')
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,12 @@
|
||||||
<template v-else-if="row.status === 'WaitConfirm'">
|
<template v-else-if="row.status === 'WaitConfirm'">
|
||||||
<span style="color: #e6a23c">等待用户确认收款</span>
|
<span style="color: #e6a23c">等待用户确认收款</span>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-else-if="row.status === 'Rejected'">
|
||||||
|
<el-tooltip v-if="row.rejectReason" :content="row.rejectReason" placement="top">
|
||||||
|
<span style="color: #f56c6c; cursor: pointer">拒绝:{{ row.rejectReason }}</span>
|
||||||
|
</el-tooltip>
|
||||||
|
<span v-else style="color: #999">已拒绝</span>
|
||||||
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<span style="color: #999">已处理</span>
|
<span style="color: #999">已处理</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -99,7 +105,7 @@ async function handleAction(row, action) {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e !== 'cancel' && e?.toString() !== 'cancel') {
|
if (e !== 'cancel' && e?.toString() !== 'cancel') {
|
||||||
const data = e?.response?.data
|
const data = e?.response?.data
|
||||||
const msg = data?.detail ? `${data.message}:${data.detail}` : (data?.message || '操作失败')
|
const msg = data?.message || '操作失败'
|
||||||
ElMessage.error({ message: msg, duration: 5000 })
|
ElMessage.error({ message: msg, duration: 5000 })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -115,8 +121,8 @@ function statusTagType(s) {
|
||||||
|
|
||||||
function formatTime(str) {
|
function formatTime(str) {
|
||||||
if (!str) return '-'
|
if (!str) return '-'
|
||||||
// 后端存的是UTC时间,确保正确解析为UTC再转本地时间
|
// 后端存的是UTC时间,补 Z 后缀让浏览器按UTC解析,自动转为本地时间显示
|
||||||
const d = new Date(typeof str === 'string' && !str.endsWith('Z') ? str + 'Z' : str)
|
const d = new Date(typeof str === 'string' && !str.endsWith('Z') && !str.includes('+') ? str + 'Z' : str)
|
||||||
const pad = n => String(n).padStart(2, '0')
|
const pad = n => String(n).padStart(2, '0')
|
||||||
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}`
|
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -210,6 +210,7 @@ public static class EarningEndpoints
|
||||||
w.Amount,
|
w.Amount,
|
||||||
PaymentMethod = w.PaymentMethod.ToString(),
|
PaymentMethod = w.PaymentMethod.ToString(),
|
||||||
Status = w.Status.ToString(),
|
Status = w.Status.ToString(),
|
||||||
|
w.RejectReason,
|
||||||
w.CreatedAt,
|
w.CreatedAt,
|
||||||
w.ProcessedAt
|
w.ProcessedAt
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user