fix(pl): 司机回执缺品牌数量时仍保存单据,并按业务结果提示成败。

未填写品牌数量不再拦截照片和备注;已填写的品牌数量仍校验。小程序在 HTTP 200 的业务失败下不再弹出保存成功。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
wuzilongandCursor committed 2026-11-06 23:57:34 +08:00
1 parent 13ed7f5be0
commit af79aa50a2
7 files changed
+97 -4

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
/**
* 门户信封 { code, message, data } 的业务失败文案。
* HTTP 200 仍可能携带 code=400;code 缺失或非数字时视为裸 JSON。
* @param {unknown} data
* @returns {string | null}
*/
export function portalBusinessErrorMessage(data) {
if (!data || typeof data !== 'object' || Array.isArray(data)) return null
if (!Object.prototype.hasOwnProperty.call(data, 'code')) return null
const code = Number(data.code)
if (!Number.isFinite(code) || code === 200 || code === 0) return null
const message = typeof data.message === 'string' ? data.message.trim() : ''
const msg = typeof data.msg === 'string' ? data.msg.trim() : ''
return message || msg || '请求失败'
}