From 81a52d919e9e3734c902ccde08417eaf6ba3de00 Mon Sep 17 00:00:00 2001 From: shanshi <3316401569@qq.com> Date: Wed, 25 Nov 2026 11:06:06 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=B4=A2=E5=8A=A1=E5=8F=B0=E8=B4=A6):=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BD=99=E9=A2=9D=E6=9B=B4=E6=96=B0=E6=97=B6?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/NonStoreAccountMonitorPageData.php | 16 ++++++++++++++++ .../non-store-accounts.blade.php | 19 +++++++++++++++---- .../platform-account-detail.blade.php | 7 +++++-- .../Business/NonStoreAccountMonitorTest.php | 16 ++++++++++++++-- 4 files changed, 50 insertions(+), 8 deletions(-) diff --git a/modules/EcommerceFinance/View/NonStoreAccountMonitorPageData.php b/modules/EcommerceFinance/View/NonStoreAccountMonitorPageData.php index d1c509f9..20ac6ae0 100644 --- a/modules/EcommerceFinance/View/NonStoreAccountMonitorPageData.php +++ b/modules/EcommerceFinance/View/NonStoreAccountMonitorPageData.php @@ -69,6 +69,7 @@ final class NonStoreAccountMonitorPageData 'current_balance', 'available_balance', 'blocked_balance', + 'balance_updated_at', 'activity_days', 'account_no', 'bank_name', @@ -556,6 +557,7 @@ final class NonStoreAccountMonitorPageData 'current_balance' => round((float) ($account->current_balance ?? 0), 2), 'available_balance' => round((float) ($account->daily_available ?? 0), 2), 'blocked_balance' => round((float) ($account->blocked_amount ?? 0), 2), + 'balance_updated_at' => '', 'is_retained' => $isRetained, 'is_account_archive_visible' => $isRetained, 'keep_label' => $keepLabel, @@ -635,6 +637,7 @@ final class NonStoreAccountMonitorPageData 'bank_direct_snapshot_available' => $snapshotAvailable, 'bank_direct_balance_date' => $snapshot['balance_date'], 'bank_direct_balance_at' => $snapshot['balance_at'], + 'balance_updated_at' => $this->dateTimeValue($snapshot['imported_at'] ?? null), ]); } unset($row); @@ -1151,6 +1154,7 @@ final class NonStoreAccountMonitorPageData $this->column('current_balance', '当前余额', 'number', '资金信息', false), $this->column('available_balance', '可用金额', 'number', '资金信息', false), $this->column('blocked_balance', '不可用金额', 'number', '资金信息', false), + $this->column('balance_updated_at', '余额更新时间', 'date', '资金信息', true), $this->column('activity_days', '活跃天数', 'integer', '资金信息', false), ]; @@ -1365,6 +1369,8 @@ final class NonStoreAccountMonitorPageData 'income', 'expense', 'balance', + 'imported_at', + 'updated_at', ]) ->groupBy(static function (object $row): string { return (string) $row->bank_name @@ -1433,6 +1439,9 @@ final class NonStoreAccountMonitorPageData $row['available_balance'] = round($closingBalance - $blocked, 2); $row['bank_bill_latest_date'] = substr((string) $latestBalance->txn_date, 0, 10); $row['bank_bill_latest_at'] = $latestBalance->txn_at; + $row['balance_updated_at'] = $this->dateTimeValue( + $latestBalance->imported_at ?? $latestBalance->updated_at ?? null, + ); $row['bank_bill_period_income'] = $income; $row['bank_bill_period_expense'] = $expense; } @@ -1524,6 +1533,13 @@ final class NonStoreAccountMonitorPageData return $text === '' ? '' : substr($text, 0, 10); } + private function dateTimeValue(mixed $value): string + { + $text = trim((string) ($value ?? '')); + + return $text === '' ? '' : substr($text, 0, 16); + } + private function db() { return DB::connection((string) config('upstream_mirrors.connection', 'business_mirror')); diff --git a/resources/views/business/pages/financial-operations/non-store-accounts.blade.php b/resources/views/business/pages/financial-operations/non-store-accounts.blade.php index f6e9bd94..d221b7fd 100644 --- a/resources/views/business/pages/financial-operations/non-store-accounts.blade.php +++ b/resources/views/business/pages/financial-operations/non-store-accounts.blade.php @@ -45,7 +45,7 @@ 'to' => (string) ($period['to'] ?? now()->endOfMonth()->toDateString()), ]); }; - $accountStorageKey = 'caiwu.non-store-accounts.columns.v5.' + $accountStorageKey = 'caiwu.non-store-accounts.columns.v6.' . auth()->id() . '.' . company_id() . '.' . ($accountFilters['category'] ?? 'all'); @endphp @@ -814,7 +814,7 @@ } .nsm-bank-inline-table { - min-width: 68rem; + min-width: 76rem; } .nsm-bank-inline-table [data-bank-detail-row][hidden] { @@ -920,6 +920,12 @@ white-space: nowrap; } + .nsm-balance-updated { + color: var(--nsm-muted); + font-variant-numeric: tabular-nums; + white-space: nowrap; + } + .nsm-column-filter-toggle { display: inline-flex; width: 1.45rem; @@ -2357,7 +2363,7 @@
@include('business.pages.financial-operations.partials.detail-column-settings', [ - 'storageKey' => 'caiwu.non-store-accounts.detail.bank-inline.columns.v1', + 'storageKey' => 'caiwu.non-store-accounts.detail.bank-inline.columns.v2', 'columns' => [ '公共信息' => [ ['key' => 'company_name', 'label' => '公司名称'], @@ -2374,6 +2380,7 @@ ['key' => 'current_balance', 'label' => '期末余额'], ['key' => 'available_balance', 'label' => '可用金额'], ['key' => 'blocked_balance', 'label' => '不可用金额'], + ['key' => 'balance_updated_at', 'label' => '余额更新时间'], ], ], ]) @@ -2400,6 +2407,7 @@ 期末余额 可用金额 不可用金额 + 余额更新时间 @@ -2440,6 +2448,7 @@ {{ number_format((float) $account['available_balance'], 2) }} {{ number_format((float) $account['blocked_balance'], 2) }} + {{ $account['balance_updated_at'] ?: '—' }} @endforeach @@ -2821,6 +2830,8 @@ 'nsm-status--success' => $value === '银企直连', 'nsm-status--warning' => $value === '未填写', ])>{{ $value }} + @elseif ($key === 'balance_updated_at') + {{ filled($value) ? $value : '—' }} @else {{ filled($value) ? $value : '—' }} @endif @@ -4015,7 +4026,7 @@ const pickerButton = root.querySelector('[data-column-picker-toggle]'); const columnPanel = root.querySelector('[data-column-panel]'); const toggles = [...root.querySelectorAll('[data-column-toggle]')]; - const storageKey = table.dataset.columnStorageKey || 'caiwu.non-store-accounts.columns.v5'; + const storageKey = table.dataset.columnStorageKey || 'caiwu.non-store-accounts.columns.v6'; const readStoredColumns = () => { try { diff --git a/resources/views/business/pages/financial-operations/partials/platform-account-detail.blade.php b/resources/views/business/pages/financial-operations/partials/platform-account-detail.blade.php index 766c5054..9fc5d71e 100644 --- a/resources/views/business/pages/financial-operations/partials/platform-account-detail.blade.php +++ b/resources/views/business/pages/financial-operations/partials/platform-account-detail.blade.php @@ -22,6 +22,7 @@ ['key' => 'current_balance', 'label' => '当前余额'], ['key' => 'available_balance', 'label' => '可用金额'], ['key' => 'blocked_balance', 'label' => '不可用金额'], + ['key' => 'balance_updated_at', 'label' => '余额更新时间'], ], ]; @endphp @@ -38,7 +39,7 @@ {{ $description }}
@include('business.pages.financial-operations.partials.detail-column-settings', [ - 'storageKey' => 'caiwu.non-store-accounts.detail.' . $detailId . '.columns.v1', + 'storageKey' => 'caiwu.non-store-accounts.detail.' . $detailId . '.columns.v2', 'columns' => $detailColumns, ]) @@ -55,6 +56,7 @@ 当前余额 可用金额 不可用金额 + 余额更新时间 @@ -95,10 +97,11 @@ {{ number_format((float) $account['current_balance'], 2) }} {{ number_format((float) $account['available_balance'], 2) }} {{ number_format((float) $account['blocked_balance'], 2) }} + {{ $account['balance_updated_at'] ?: '—' }} @empty - {{ $emptyMessage }} + {{ $emptyMessage }} @endforelse diff --git a/tests/Feature/Business/NonStoreAccountMonitorTest.php b/tests/Feature/Business/NonStoreAccountMonitorTest.php index 18eac16a..51b7c6c7 100644 --- a/tests/Feature/Business/NonStoreAccountMonitorTest.php +++ b/tests/Feature/Business/NonStoreAccountMonitorTest.php @@ -160,14 +160,15 @@ class NonStoreAccountMonitorTest extends FeatureTestCase $this->assertGreaterThanOrEqual(8, substr_count($html, 'data-detail-column-picker-toggle')); $this->assertStringContainsString('data-detail-column-table', $html); $this->assertStringContainsString( - 'caiwu.non-store-accounts.detail.bank-inline.columns.v1', + 'caiwu.non-store-accounts.detail.bank-inline.columns.v2', $html, ); $this->assertStringContainsString( - 'caiwu.non-store-accounts.detail.nsm-alipay-drilldown.columns.v1', + 'caiwu.non-store-accounts.detail.nsm-alipay-drilldown.columns.v2', $html, ); $this->assertStringContainsString('data-detail-column="current_balance"', $html); + $this->assertStringContainsString('data-detail-column="balance_updated_at">余额更新时间', $html); $this->assertStringContainsString('const initializeDetailColumnPickers', $html); $this->assertStringContainsString( "const rows = bankInlineDetail.querySelectorAll('[data-bank-detail-row]');", @@ -271,6 +272,7 @@ class NonStoreAccountMonitorTest extends FeatureTestCase 'income' => 0, 'expense' => 0, 'balance' => 100000, + 'imported_at' => null, 'row_key' => hash('sha256', 'bill-open'), ], [ @@ -284,6 +286,7 @@ class NonStoreAccountMonitorTest extends FeatureTestCase 'income' => 50000, 'expense' => 0, 'balance' => 150000, + 'imported_at' => null, 'row_key' => hash('sha256', 'bill-in'), ], [ @@ -297,6 +300,7 @@ class NonStoreAccountMonitorTest extends FeatureTestCase 'income' => 0, 'expense' => 20000, 'balance' => 130000, + 'imported_at' => '2026-11-03 11:45:00', 'row_key' => hash('sha256', 'bill-out'), ], ]); @@ -328,6 +332,8 @@ class NonStoreAccountMonitorTest extends FeatureTestCase $response->assertSee('data-retained-period-available="260000"', false); $response->assertSeeText('招行账单测试'); $response->assertSeeText('130,000.00'); + $response->assertSeeText('余额更新时间'); + $response->assertSeeText('2026-11-03 11:45'); $accountHtml = $this->loginAs()->get($this->pageUrl([ 'view' => 'accounts', @@ -338,6 +344,8 @@ class NonStoreAccountMonitorTest extends FeatureTestCase ]))->assertOk()->getContent(); $this->assertStringContainsString('招行账单测试', $accountHtml); + $this->assertStringContainsString('余额更新时间', $accountHtml); + $this->assertStringContainsString('2026-11-03 11:45', $accountHtml); $this->assertMatchesRegularExpression( '/招行账单测试.*?20,000\.00.*?50,000\.00.*?130,000\.00/s', $accountHtml, @@ -370,6 +378,7 @@ class NonStoreAccountMonitorTest extends FeatureTestCase 'income' => 200, 'expense' => 0, 'balance' => 200, + 'imported_at' => null, 'row_key' => hash('sha256', 'ws-balance-1'), ], [ @@ -383,6 +392,7 @@ class NonStoreAccountMonitorTest extends FeatureTestCase 'income' => 100, 'expense' => 0, 'balance' => 300, + 'imported_at' => '2026-11-03 10:28:00', 'row_key' => hash('sha256', 'ws-balance-2'), ], ]); @@ -406,6 +416,8 @@ class NonStoreAccountMonitorTest extends FeatureTestCase $this->assertStringContainsString('网商余额同步测试', $html); $this->assertStringContainsString('300.00', $html); + $this->assertStringContainsString('余额更新时间', $html); + $this->assertStringContainsString('2026-11-03 10:28', $html); $this->assertStringNotContainsString('999,999.00', $html); } -- 2.47.2