From 8f7b4b2de8b92a1b74af689093e9fa2786363891 Mon Sep 17 00:00:00 2001 From: 92451 <924518135@qq.com> Date: Wed, 23 Sep 2026 11:07:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=85=8D=E7=BD=AE=E6=8F=90=E7=8E=B0?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E9=A2=84=E7=95=99=E6=A0=87=E5=87=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Business/WithdrawalReserveStandard.php | 35 +++++++++++++++ app/Http/Controllers/Business/Pages.php | 10 +++++ .../withdrawal-management.blade.php | 3 +- tests/Feature/Business/ManagementCrudTest.php | 2 + .../WithdrawalReserveStandardTest.php | 43 +++++++++++++++++++ 5 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 app/Business/WithdrawalReserveStandard.php create mode 100644 tests/Unit/Business/WithdrawalReserveStandardTest.php diff --git a/app/Business/WithdrawalReserveStandard.php b/app/Business/WithdrawalReserveStandard.php new file mode 100644 index 00000000..1e3e38cd --- /dev/null +++ b/app/Business/WithdrawalReserveStandard.php @@ -0,0 +1,35 @@ + 20000, + '淘宝' => 10000, + '淘宝分销' => 10000, + '阿里巴巴' => 10000, + '京东' => 5000, + '京喜' => 5000, + '抖音' => 5000, + '拼多多' => 5000, + ]; + + public static function amountFor(?string $platform, ?string $erpStoreName): ?int + { + $platform = trim((string) $platform); + $erpStoreName = trim((string) $erpStoreName); + + if ($platform === '天猫' && in_array($erpStoreName, self::TMALL_HIGH_RESERVE_STORES, true)) { + return 50000; + } + + return self::PLATFORM_DEFAULTS[$platform] ?? null; + } +} diff --git a/app/Http/Controllers/Business/Pages.php b/app/Http/Controllers/Business/Pages.php index d8e77296..6db1ffcd 100644 --- a/app/Http/Controllers/Business/Pages.php +++ b/app/Http/Controllers/Business/Pages.php @@ -10,6 +10,7 @@ use App\Business\TableRegistry; use App\Business\UpstreamBusinessInformation; use App\Business\StoreReceivingAccountTemplate; use App\Business\StoreReceivingAccountWorkbookImporter; +use App\Business\WithdrawalReserveStandard; use App\Models\Banking\MarketingAccountBill; use App\Models\Business\CourierAgreementSignature; use App\Models\Business\CourierQuoteSignature; @@ -940,6 +941,14 @@ class Pages extends Controller $page, ['path' => request()->url(), 'query' => request()->except('page')], ); + $withdrawalReserveStandards = $withdrawalRows->getCollection()->mapWithKeys( + static fn (StoreReceivingAccount $row): array => [ + (int) $row->id => WithdrawalReserveStandard::amountFor( + $row->store_platform, + $row->erp_store_name, + ), + ], + )->all(); return [ 'view' => 'business.pages.fund-management.withdrawal-management', @@ -948,6 +957,7 @@ class Pages extends Controller 'withdrawalPlatforms' => $platforms, 'withdrawalPaths' => $withdrawalPaths, 'withdrawalBalances' => $withdrawalBalances, + 'withdrawalReserveStandards' => $withdrawalReserveStandards, 'withdrawalBalanceSummary' => [ 'source' => $this->jushuitanShopBalances->countForDate($balanceDate->toDateString()), 'matched' => (int) $balanceCounts->get('matched', 0), diff --git a/resources/views/business/pages/fund-management/withdrawal-management.blade.php b/resources/views/business/pages/fund-management/withdrawal-management.blade.php index f4da90c1..773c9b7f 100644 --- a/resources/views/business/pages/fund-management/withdrawal-management.blade.php +++ b/resources/views/business/pages/fund-management/withdrawal-management.blade.php @@ -85,6 +85,7 @@ $balanceTitle = $balanceMatch['status'] === 'matched' ? '聚水潭店铺:' . $balanceMatch['source_store_name'] . ';余额日期:' . $withdrawalBalanceDate : '余额日期:' . $withdrawalBalanceDate; + $reserveStandard = $withdrawalReserveStandards[(int) $row->id] ?? null; @endphp {{ $row->store_platform ?: '未配置' }} @@ -95,7 +96,7 @@ {{ $row->withdrawal_account_name ?: '未配置' }} {{ $bankCard }} {{ $balanceText }} - 待配置 + {{ $reserveStandard === null ? '待配置' : number_format($reserveStandard, 2) }} 待接入 待核验 diff --git a/tests/Feature/Business/ManagementCrudTest.php b/tests/Feature/Business/ManagementCrudTest.php index 64d8a68f..89dbdc5b 100644 --- a/tests/Feature/Business/ManagementCrudTest.php +++ b/tests/Feature/Business/ManagementCrudTest.php @@ -131,6 +131,8 @@ class ManagementCrudTest extends FeatureTestCase ->assertSeeText('已显示余额 1 条') ->assertSeeText('余额状态') ->assertSeeText('预留标准') + ->assertSeeText('20,000.00') + ->assertSeeText('5,000.00') ->assertSeeText('提现金额') ->assertSeeText('是否达标') ->assertSeeText('待核验') diff --git a/tests/Unit/Business/WithdrawalReserveStandardTest.php b/tests/Unit/Business/WithdrawalReserveStandardTest.php new file mode 100644 index 00000000..f8354292 --- /dev/null +++ b/tests/Unit/Business/WithdrawalReserveStandardTest.php @@ -0,0 +1,43 @@ +assertSame(50000, WithdrawalReserveStandard::amountFor('天猫', $storeName)); + } + } + + public function test_platform_defaults_are_applied(): void + { + $expected = [ + '天猫' => 20000, + '淘宝' => 10000, + '淘宝分销' => 10000, + '阿里巴巴' => 10000, + '京东' => 5000, + '京喜' => 5000, + '抖音' => 5000, + '拼多多' => 5000, + ]; + + foreach ($expected as $platform => $amount) { + $this->assertSame($amount, WithdrawalReserveStandard::amountFor($platform, '普通店铺')); + } + } + + public function test_unconfigured_platform_has_no_invented_standard(): void + { + $this->assertNull(WithdrawalReserveStandard::amountFor('唯品会', '唯品会-测试店铺')); + } +} -- 2.47.2