From 8a09b68ae7362b75101ded59a8765987fde9519a Mon Sep 17 00:00:00 2001 From: abingyyds Date: Mon, 13 Apr 2026 18:26:55 +0800 Subject: [PATCH] Fix dist log pricing display --- src/i18n/locales/en.json | 1 + src/i18n/locales/zh.json | 1 + src/pages/Logs.jsx | 34 +++++++++++++++++++++------------- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 2230ae0..393f4c3 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -211,6 +211,7 @@ "供应商": "Provider", "供应商介绍": "Provider introduction", "供应商定价": "Provider pricing", + "分站定价": "Sub-site pricing", "按次计费": "Per call", "按量计费": "Pay as you go", diff --git a/src/i18n/locales/zh.json b/src/i18n/locales/zh.json index d959d79..78d347a 100644 --- a/src/i18n/locales/zh.json +++ b/src/i18n/locales/zh.json @@ -211,6 +211,7 @@ "供应商": "供应商", "供应商介绍": "供应商介绍", "供应商定价": "供应商定价", + "分站定价": "分站定价", "按次计费": "按次计费", "按量计费": "按量计费", diff --git a/src/pages/Logs.jsx b/src/pages/Logs.jsx index 06dcd3e..09c98ec 100644 --- a/src/pages/Logs.jsx +++ b/src/pages/Logs.jsx @@ -20,24 +20,33 @@ function getLogOther(otherStr) { } } -function formatProviderPriceSnapshot(other, symbol, rate, t) { - if (!other?.provider_billing_mode) return '-'; +function formatSitePriceSnapshot(other, symbol, rate, t) { + if (!other?.site_billing_mode) return '-'; const formatUSD = (amount) => `${symbol}${(Number(amount || 0) * rate).toFixed(6)}`; - if (other.provider_billing_mode === 'per_call') { - const fixedPrice = Number(other?.provider_fixed_price || 0); + if (other.site_billing_mode === 'per_call') { + const fixedPrice = Number(other?.site_fixed_price || 0); if (fixedPrice <= 0) return t('按次计费'); return `${t('按次计费')} · ${formatUSD(fixedPrice)} / ${t('pricing.perCallUnit')}`; } - const inputPrice = Number(other?.provider_input_price || 0); - const outputPrice = Number(other?.provider_output_price || 0); + const inputPrice = Number(other?.site_input_price || 0); + const outputPrice = Number(other?.site_output_price || 0); const parts = [t('按量计费')]; if (inputPrice > 0) parts.push(`${t('输入')} ${formatUSD(inputPrice)} / 1M tokens`); if (outputPrice > 0) parts.push(`${t('输出')} ${formatUSD(outputPrice)} / 1M tokens`); return parts.join(' · '); } +function formatProviderSummary(other, t) { + if (!other?.provider_name) return []; + const items = [{ key: t('供应商'), value: other.provider_name }]; + if (other.provider_description) { + items.push({ key: t('供应商介绍'), value: other.provider_description }); + } + return items; +} + export default function Logs() { const { t } = useTranslation(); const { symbol, rate } = useCurrency(); @@ -110,15 +119,14 @@ export default function Logs() { data.push({ key: t('计费方式'), value: t('订阅抵扣') }); } - if (other.provider_name) { - data.push({ key: t('供应商'), value: other.provider_name }); + const providerInfo = formatProviderSummary(other, t); + data.push(...providerInfo); + + if (other.site_billing_mode) { data.push({ - key: t('供应商定价'), - value: formatProviderPriceSnapshot(other, symbol, rate, t), + key: t('分站定价'), + value: formatSitePriceSnapshot(other, symbol, rate, t), }); - if (other.provider_description) { - data.push({ key: t('供应商介绍'), value: other.provider_description }); - } } return data;