From 7312e62e91570b40ca190fc70a60382c3cb0f2e9 Mon Sep 17 00:00:00 2001 From: abingyyds Date: Sat, 18 Apr 2026 20:47:24 +0800 Subject: [PATCH] Fix distributor package settlement visibility --- src/i18n/locales/en.json | 6 +++++ src/i18n/locales/zh.json | 6 +++++ src/pages/Logs.jsx | 52 ++++++++++++++++++++++++++++++++-------- 3 files changed, 54 insertions(+), 10 deletions(-) diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index caa3acb..2b98e84 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -416,6 +416,12 @@ "是": "Yes", "否": "No", "首字时间": "First Token Time", + "实际扣费来源": "Actual Billing Source", + "钱包": "Wallet", + "订阅": "Subscription", + "分站套餐": "Distributor Package", + "主站订阅": "Main-Site Subscription", + "后台订阅": "Admin Subscription", "计费方式": "Billing Method", "订阅抵扣": "Subscription Deduction", "定价方式": "Pricing", diff --git a/src/i18n/locales/zh.json b/src/i18n/locales/zh.json index 4768b01..bb09df6 100644 --- a/src/i18n/locales/zh.json +++ b/src/i18n/locales/zh.json @@ -416,6 +416,12 @@ "是": "是", "否": "否", "首字时间": "首字时间", + "实际扣费来源": "实际扣费来源", + "钱包": "钱包", + "订阅": "订阅", + "分站套餐": "分站套餐", + "主站订阅": "主站订阅", + "后台订阅": "后台订阅", "计费方式": "计费方式", "订阅抵扣": "订阅抵扣", "定价方式": "定价方式", diff --git a/src/pages/Logs.jsx b/src/pages/Logs.jsx index d18954b..8b23ab8 100644 --- a/src/pages/Logs.jsx +++ b/src/pages/Logs.jsx @@ -32,6 +32,20 @@ function getProviderSummary(other) { return other.provider_name; } +function getBillingSourceLabel(other, t) { + if (!other?.billing_source) return ''; + if (other.billing_source === 'subscription') { + if (other.subscription_source === 'dist_package') return t('分站套餐'); + if (other.subscription_source === 'order') return t('主站订阅'); + if (other.subscription_source === 'admin') return t('后台订阅'); + return t('订阅'); + } + if (other.billing_source === 'wallet') { + return t('钱包'); + } + return ''; +} + function getSitePricingDetails(other, symbol, rate, t) { if (!other?.site_billing_mode) return []; @@ -127,12 +141,17 @@ export default function Logs() { if (!other) return []; const data = []; + const billingSourceLabel = getBillingSourceLabel(other, t); const providerSummary = getProviderSummary(other); if (providerSummary) { data.push({ key: t('供应商'), value: providerSummary }); } + if (billingSourceLabel) { + data.push({ key: t('实际扣费来源'), value: billingSourceLabel }); + } + data.push(...getSitePricingDetails(other, symbol, rate, t)); if (other.cache_tokens > 0) { @@ -164,11 +183,6 @@ export default function Logs() { data.push({ key: t('首字时间'), value: `${frtSeconds}s` }); } - // Billing source - if (other.billing_source === 'subscription') { - data.push({ key: t('计费方式'), value: t('订阅抵扣') }); - } - return data; }, [rate, symbol, t]); @@ -239,6 +253,7 @@ export default function Logs() { const expandData = getExpandData(log); const hasExpandData = expandData.length > 0; const isExpanded = expandedRows[log.id]; + const billingSourceLabel = getBillingSourceLabel(getLogOther(log.other), t); return ( {log.token_name || '-'} {log.prompt_tokens?.toLocaleString() || '0'} {log.completion_tokens?.toLocaleString() || '0'} - - {log.quota > 0 ? `${symbol}${(log.quota / Q * rate).toFixed(6)}` : '-'} + +
+ + {log.quota > 0 ? `${symbol}${(log.quota / Q * rate).toFixed(6)}` : '-'} + + {billingSourceLabel && ( + + {billingSourceLabel} + + )} +
{log.use_time > 0 ? `${log.use_time}s` : '-'} @@ -291,6 +315,7 @@ export default function Logs() { const expandData = getExpandData(log); const hasExpandData = expandData.length > 0; const isExpanded = expandedRows[log.id]; + const billingSourceLabel = getBillingSourceLabel(getLogOther(log.other), t); return (
{log.model_name || '-'}
- - {log.quota > 0 ? `${symbol}${(log.quota / Q * rate).toFixed(6)}` : '-'} - +
+ + {log.quota > 0 ? `${symbol}${(log.quota / Q * rate).toFixed(6)}` : '-'} + + {billingSourceLabel && ( + + {billingSourceLabel} + + )} +
{formatTime(log.created_at)}