报价缺价文案提成具名常量
- src/components/image-editor/model3d-generation/Model3dGenerationFormModel.ts:底价缺失与加价项缺失两句文案按模块既有约定提成 MODEL3D_PRICING_MISSING_BASE_PRICE_REASON 与 resolveModel3dPricingMissingAddOnReason,不再散落在计算路径里
This commit is contained in:
@@ -46,6 +46,13 @@ export function isModel3dGenerationMode(
|
||||
export const MODEL3D_GENERATION_DIALOG_LABEL = '3D 模型生成';
|
||||
export const MODEL3D_GENERATION_SUBMIT_LABEL = '生成 3D 模型';
|
||||
export const MODEL3D_PRICING_UNAVAILABLE_REASON = '3D 模型定价尚未配置';
|
||||
/** 当前模型版本在这个端点没有底价:与「整段没配」分开说,用户才知道该改哪里。 */
|
||||
export const MODEL3D_PRICING_MISSING_BASE_PRICE_REASON =
|
||||
'3D 模型定价缺少该档位底价';
|
||||
/** 某个加价项缺价:报价必须整项算得出来才算数,缺一项就不可提交。 */
|
||||
export function resolveModel3dPricingMissingAddOnReason(addOn: string) {
|
||||
return `3D 模型定价缺少 ${addOn} 价格`;
|
||||
}
|
||||
/** 面板本身不是 3D 生成模式:与「定价缺失」是两回事,不能共用一句话。 */
|
||||
export const MODEL3D_MODE_UNSUPPORTED_REASON = '当前面板不是 3D 模型模式';
|
||||
|
||||
@@ -302,13 +309,16 @@ export function resolveModel3dPrice({
|
||||
params.texture ? basePriceRow?.texture : basePriceRow?.noTexture,
|
||||
);
|
||||
if (basePrice === null) {
|
||||
return { ok: false, reason: '3D 模型定价缺少该档位底价' };
|
||||
return { ok: false, reason: MODEL3D_PRICING_MISSING_BASE_PRICE_REASON };
|
||||
}
|
||||
let price = basePrice;
|
||||
for (const key of resolveModel3dAddOnKeys(params)) {
|
||||
const addOnPrice = readPrice(pricing.addOnPrices?.[key]);
|
||||
if (addOnPrice === null) {
|
||||
return { ok: false, reason: `3D 模型定价缺少 ${key} 价格` };
|
||||
return {
|
||||
ok: false,
|
||||
reason: resolveModel3dPricingMissingAddOnReason(key),
|
||||
};
|
||||
}
|
||||
price += addOnPrice;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user