fix(waybill): 快递接口缺失/未绑定的提示改为「原因在前」
WMS 会把失败原因写进订单操作日志并截断长文案,原来「未绑定到快递接口」在最前面、 真正原因(该平台暂无面单模板 / 没有该快递公司的模板)在末尾括号里,很容易被截掉, 运维看不出到底缺什么。改成: - 平台无任何模板:`平台1688(阿里巴巴)暂无面单模板(账号xxx):请到 OMS 店铺管理→ 外部打单平台→快递接口 点「从平台同步数据」,再为快递STO(申通快递)绑定` - 有模板但缺该快递公司:`平台TB(淘宝)没有快递JD(京东物流)的面单模板(账号xxx):…` - 有模板但该快递未绑定 / 重复绑定:同样把具体问题放在前面 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
5f605b5412
commit
1e454d399c
@ -283,7 +283,8 @@ async function buildTemplateMissingMessage(ctx, { account, platformCode, express
|
||||
const { name: expressName, exists: expressExists, disabled: expressDisabled } = await findExpressCode(ctx, expressCode, principalId);
|
||||
const expressLabel = labelWithName(expressCode, expressName);
|
||||
const accountText = account.account ? `账号${account.account}` : `账号#${account.id}`;
|
||||
const head = `平台${platformLabel}快递${expressLabel}在${accountText}下未绑定到快递接口,请到 OMS 店铺管理→外部打单平台→快递接口 查看绑定对应的快递接口`;
|
||||
// WMS 侧日志/页面会截断长文案,这里把「真正原因」放最前面,操作指引放后面
|
||||
const guide = 'OMS 店铺管理→外部打单平台→快递接口';
|
||||
|
||||
// 快递编码在系统字典与自定义字典里都没有:先让运营把编码建出来(否则绑定页也选不到它)
|
||||
if (!expressExists) {
|
||||
@ -301,21 +302,26 @@ async function buildTemplateMissingMessage(ctx, { account, platformCode, express
|
||||
limit: 50,
|
||||
});
|
||||
} catch (err) {
|
||||
return head;
|
||||
return `平台${platformLabel}快递${expressLabel}(${accountText})未绑定到快递接口:请到 ${guide} 绑定`;
|
||||
}
|
||||
|
||||
if (!rows.length) return `${head}(该平台暂无面单模板,请先点「从平台同步数据」)`;
|
||||
// 该平台一条模板都没有:不是绑定漏了,而是店管家侧没有这个平台的电子面单模板
|
||||
if (!rows.length) {
|
||||
return `平台${platformLabel}暂无面单模板(${accountText}):请到 ${guide} 点「从平台同步数据」,再为快递${expressLabel}绑定`;
|
||||
}
|
||||
|
||||
// 同一编码被多个模板绑定 → resolveByCode 视为未命中
|
||||
const duplicated = rows.filter(row => String(row.custom_code || '').trim() === expressCode);
|
||||
if (duplicated.length > 1) {
|
||||
return `平台${platformLabel}快递${expressLabel}在${accountText}下绑定了 ${duplicated.length} 个快递接口,请到 OMS 店铺管理→外部打单平台→快递接口 只保留一个后重试`;
|
||||
return `平台${platformLabel}快递${expressLabel}(${accountText})绑定了 ${duplicated.length} 个快递接口:请到 ${guide} 只保留一个后重试`;
|
||||
}
|
||||
|
||||
const codeKey = String(expressCode).trim().toUpperCase();
|
||||
const hasSameCompany = rows.some(row => String(row.express_company_code || '').trim().toUpperCase() === codeKey);
|
||||
if (!hasSameCompany) return `${head}(该平台暂无对应快递公司的模板,请先点「从平台同步数据」)`;
|
||||
return head;
|
||||
if (!hasSameCompany) {
|
||||
return `平台${platformLabel}没有快递${expressLabel}的面单模板(${accountText}):请到 ${guide} 点「从平台同步数据」,再为该快递绑定`;
|
||||
}
|
||||
return `平台${platformLabel}快递${expressLabel}(${accountText})未绑定到快递接口:请到 ${guide} 选择对应模板绑定`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user