refactor(api): 将 `message` 字段统一改为 `msg` 并更新相关逻辑
统一接口响应中的 `message` 字段为 `msg`,并在相关页面更新错误提示逻辑,确保一致性。同时在审批处理页面增加对审核图片的校验,并优化错误处理逻辑。
This commit is contained in:
parent
adf5bc4d20
commit
533a94ca9b
|
@ -53,6 +53,11 @@ const validateForm = () => {
|
|||
showConfirmDialog({ title: '提示', message: '退款金额不能超过商品价格' })
|
||||
return false
|
||||
}
|
||||
|
||||
if (!formData.value.auditImages) {
|
||||
showConfirmDialog({ title: '提示', message: '请上传审核图片' })
|
||||
return false
|
||||
}
|
||||
if (formData.value.status === 3 && !formData.value.auditRemark) {
|
||||
showConfirmDialog({ title: '提示', message: '驳回时必须填写审核说明' })
|
||||
return false
|
||||
|
@ -153,7 +158,7 @@ const handleSubmit = async () => {
|
|||
|
||||
submitting.value = true
|
||||
try {
|
||||
const { code } = await handleApprovalApi(formData.value)
|
||||
const { code, msg } = await handleApprovalApi(formData.value)
|
||||
|
||||
if (code === 0) {
|
||||
showSuccessToast('操作成功')
|
||||
|
@ -162,6 +167,12 @@ const handleSubmit = async () => {
|
|||
message: `审批处理已完成`
|
||||
})
|
||||
router.push('/approval/list')
|
||||
} else {
|
||||
console.error('操作失败code:', code, 'msg:', msg)
|
||||
showConfirmDialog({
|
||||
title: '操作失败',
|
||||
message: msg || '操作失败'
|
||||
})
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('提交失败:', error)
|
||||
|
|
|
@ -20,7 +20,7 @@ async function handleOpenCabinet(orderId: number, orderGoodsId: number) {
|
|||
try {
|
||||
const result = await openCabinetApi(orderId, orderGoodsId)
|
||||
if (result.code !== 0) {
|
||||
showFailToast(result.message)
|
||||
showFailToast(result.msg || '开启失败,请稍后重试')
|
||||
return
|
||||
}
|
||||
showSuccessToast('柜口已成功开启')
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
interface ApiResponseData<T> {
|
||||
code: number
|
||||
data: T
|
||||
message: string
|
||||
msg: string
|
||||
}
|
||||
|
||||
interface ApiResponseMsgData<T> {
|
||||
code: number
|
||||
data: T
|
||||
message: string
|
||||
msg: string
|
||||
}
|
Loading…
Reference in New Issue