user->attachPermission( Permission::where('name', 'read-admin-panel')->firstOrFail() ); } public function testStoreReceivingAccountPageUsesRebuiltTabsFiltersAndSharedStoreSeed(): void { $synchronizer = Mockery::mock(StoreReceivingAccountSynchronizer::class); $synchronizer->shouldReceive('sync')->once()->with((int) $this->company->id)->andReturn([ 'created' => 0, 'updated' => 0, 'skipped' => 0, 'by_platform' => ['天猫' => 1], ]); $this->app->instance(StoreReceivingAccountSynchronizer::class, $synchronizer); StoreReceivingAccount::query()->create([ 'company_id' => $this->company->id, 'store_platform' => '天猫', 'erp_store_name' => '天猫-测试ERP店', 'shop_name' => '测试店铺名', 'store_status' => '正常', 'store_entity_name' => '测试主体', 'receiving_method' => '支付宝', ]); $this->loginAs()->get(route('business.pages.show', [ 'section' => 'fund-management', 'page' => 'store-receiving-accounts', 'tab' => 'taobao', ])) ->assertOk() ->assertSeeText('淘宝') ->assertSeeText('ERP店铺名称') ->assertSeeText('测试店铺名') ->assertSeeText('测试主体') ->assertSeeText('下载淘宝模板') ->assertSee('aria-label="店铺收款账户筛选"', false) ->assertDontSeeText('安装明细汇总'); } public function testWithdrawalManagementShowsSafeStoreWithdrawalConfiguration(): void { Carbon::setTestNow('2026-09-13 10:00:00'); $store = StoreReceivingAccount::query()->create([ 'company_id' => $this->company->id, 'store_platform' => '天猫', 'erp_store_name' => '提现测试ERP店', 'store_id' => 'TM-TEST-1001', 'shop_name' => '提现测试店铺', 'store_entity_name' => '提现测试主体', 'login_password' => 'must-not-be-visible', 'withdrawal_path' => '支付宝', 'withdrawal_account_name' => '测试提现账户', 'bank_card_last_four' => '4321', ]); StoreReceivingAccount::query()->create([ 'company_id' => $this->company->id, 'store_platform' => '京东', 'erp_store_name' => '未接入测试ERP店', 'shop_name' => '未接入测试店铺', 'store_entity_name' => '未接入测试主体', 'withdrawal_path' => '银行卡', ]); DB::connection('business_mirror')->table(JushuitanShopBalanceRepository::TABLE)->insert([ 'balance_date' => '2026-09-12', 'source_scope' => 'all', 'source_platform' => '天猫', 'store_name' => '天猫-提现测试店铺', 'normalized_store_name' => JushuitanShopBalanceRepository::normalizeStoreName('天猫-提现测试店铺'), 'platform_account_id' => 'fixture-account', 'balance' => 19895.01, 'source_row_key' => hash('sha256', (string) $store->id), 'source_file_name' => 'fixture.json', 'source_sha256' => str_repeat('a', 64), 'imported_at' => now(), 'created_at' => now(), 'updated_at' => now(), ]); DB::connection('business_mirror')->table(JushuitanShopBalanceRepository::TABLE)->insert([ 'balance_date' => '2026-09-10', 'source_scope' => 'all', 'source_platform' => '天猫', 'store_name' => '天猫-提现测试店铺', 'normalized_store_name' => JushuitanShopBalanceRepository::normalizeStoreName('天猫-提现测试店铺'), 'platform_account_id' => 'fixture-account-history', 'balance' => 12345.67, 'source_row_key' => hash('sha256', 'history-' . (string) $store->id), 'source_file_name' => 'fixture-history.json', 'source_sha256' => str_repeat('a', 64), 'imported_at' => now(), 'created_at' => now(), 'updated_at' => now(), ]); $this->assertContains('fund-management/withdrawal-management', \App\Utilities\SidebarPermissions::allKeys()); try { $response = $this->loginAs()->get(route('business.pages.show', [ 'section' => 'fund-management', 'page' => 'withdrawal-management', ])); $unmatchedResponse = $this->loginAs()->get(route('business.pages.show', [ 'section' => 'fund-management', 'page' => 'withdrawal-management', 'balance_status' => 'unmatched', ])); $entityResponse = $this->loginAs()->get(route('business.pages.show', [ 'section' => 'fund-management', 'page' => 'withdrawal-management', 'store_entity' => '提现测试主体', ])); $historyResponse = $this->loginAs()->get(route('business.pages.show', [ 'section' => 'fund-management', 'page' => 'withdrawal-management', 'balance_date' => '2026-09-10', ])); } finally { Carbon::setTestNow(); } $response ->assertOk() ->assertSeeText('提现管理') ->assertSeeText('提现配置') ->assertSeeText('提现测试ERP店') ->assertSeeText('平台店铺ID') ->assertSeeText('TM-TEST-1001') ->assertSeeText('测试提现账户') ->assertSeeText('**** 4321') ->assertSeeText('9月11日店铺余额') ->assertSeeText('9月12日店铺余额') ->assertSeeText('9月10日店铺余额') ->assertSeeText('余额预警') ->assertSeeText('19,895.01') ->assertSeeText('余额源 1 条') ->assertSeeText('已显示余额 1 条') ->assertSeeText('余额状态') ->assertSeeText('店铺主体') ->assertSeeText('预留标准') ->assertSeeText('20,000.00') ->assertSeeText('5,000.00') ->assertSeeText('提现金额') ->assertSeeText('是否达标') ->assertSeeText('待核验') ->assertSee('data-finance-table-name="withdrawal-management-v4"', false) ->assertSee('data-finance-table-native', false) ->assertSee('data-withdrawal-column-menu', false) ->assertSee('data-withdrawal-column-trigger', false) ->assertSee('name="balance_date"', false) ->assertSee('