feat: add withdrawal store entity filter
This commit is contained in:
parent
f04f8907ea
commit
a50d14fc2a
@ -875,6 +875,7 @@ class Pages extends Controller
|
||||
$clean = static fn (mixed $value, int $length = 80): string => mb_substr(trim((string) $value), 0, $length);
|
||||
$platform = $clean(request()->query('platform'));
|
||||
$withdrawalPath = $clean(request()->query('withdrawal_path'));
|
||||
$storeEntity = $clean(request()->query('store_entity'), 191);
|
||||
$keyword = $clean(request()->query('keyword'), 191);
|
||||
$balanceStatus = $clean(request()->query('balance_status'));
|
||||
if (! in_array($balanceStatus, ['matched', 'unmatched', 'ambiguous', 'not_ready'], true)) {
|
||||
@ -897,6 +898,15 @@ class Pages extends Controller
|
||||
->filter()
|
||||
->values()
|
||||
->all();
|
||||
$storeEntities = StoreReceivingAccount::query()
|
||||
->whereNotNull('store_entity_name')
|
||||
->where('store_entity_name', '<>', '')
|
||||
->distinct()
|
||||
->orderBy('store_entity_name')
|
||||
->pluck('store_entity_name')
|
||||
->filter()
|
||||
->values()
|
||||
->all();
|
||||
|
||||
$query = StoreReceivingAccount::query();
|
||||
|
||||
@ -908,6 +918,10 @@ class Pages extends Controller
|
||||
$query->where('receiving_method', $withdrawalPath);
|
||||
}
|
||||
|
||||
if ($storeEntity !== '') {
|
||||
$query->where('store_entity_name', $storeEntity);
|
||||
}
|
||||
|
||||
if ($keyword !== '') {
|
||||
$query->where('store_name', 'like', '%' . addcslashes($keyword, '%_\\') . '%');
|
||||
}
|
||||
@ -963,9 +977,10 @@ class Pages extends Controller
|
||||
return [
|
||||
'view' => 'business.pages.fund-management.withdrawal-management',
|
||||
'withdrawalRows' => $withdrawalRows,
|
||||
'withdrawalFilters' => compact('platform', 'withdrawalPath', 'keyword', 'balanceStatus'),
|
||||
'withdrawalFilters' => compact('platform', 'withdrawalPath', 'storeEntity', 'keyword', 'balanceStatus'),
|
||||
'withdrawalPlatforms' => $platforms,
|
||||
'withdrawalPaths' => $withdrawalPaths,
|
||||
'withdrawalStoreEntities' => $storeEntities,
|
||||
'withdrawalBalances' => $withdrawalBalances,
|
||||
'withdrawalReserveStandards' => $withdrawalReserveStandards,
|
||||
'withdrawalBalanceSummary' => [
|
||||
|
||||
@ -32,6 +32,15 @@
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="biz-filter-field">
|
||||
<label for="withdrawal-store-entity">店铺主体</label>
|
||||
<select id="withdrawal-store-entity" class="biz-filter-select" name="store_entity">
|
||||
<option value="">全部</option>
|
||||
@foreach ($withdrawalStoreEntities as $option)
|
||||
<option value="{{ $option }}" @selected($withdrawalFilters['storeEntity'] === $option)>{{ $option }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="biz-filter-field">
|
||||
<label for="withdrawal-keyword">ERP店铺名称</label>
|
||||
<input id="withdrawal-keyword" class="biz-filter-input" type="search" name="keyword" value="{{ $withdrawalFilters['keyword'] }}" placeholder="输入店铺名称">
|
||||
@ -47,7 +56,7 @@
|
||||
</select>
|
||||
</div>
|
||||
<button type="submit" class="biz-btn biz-btn-primary">筛选</button>
|
||||
@if (request()->hasAny(['platform', 'withdrawal_path', 'keyword', 'balance_status']))
|
||||
@if (request()->hasAny(['platform', 'withdrawal_path', 'store_entity', 'keyword', 'balance_status']))
|
||||
<a class="biz-btn biz-btn-ghost" href="{{ request()->url() }}">重置</a>
|
||||
@endif
|
||||
</form>
|
||||
|
||||
@ -112,6 +112,11 @@ class ManagementCrudTest extends FeatureTestCase
|
||||
'page' => 'withdrawal-management',
|
||||
'balance_status' => 'unmatched',
|
||||
]));
|
||||
$entityResponse = $this->loginAs()->get(route('business.pages.show', [
|
||||
'section' => 'fund-management',
|
||||
'page' => 'withdrawal-management',
|
||||
'store_entity' => '提现测试主体',
|
||||
]));
|
||||
} finally {
|
||||
Carbon::setTestNow();
|
||||
}
|
||||
@ -130,6 +135,7 @@ class ManagementCrudTest extends FeatureTestCase
|
||||
->assertSeeText('余额源 1 条')
|
||||
->assertSeeText('已显示余额 1 条')
|
||||
->assertSeeText('余额状态')
|
||||
->assertSeeText('店铺主体')
|
||||
->assertSeeText('预留标准')
|
||||
->assertSeeText('20,000.00')
|
||||
->assertSeeText('5,000.00')
|
||||
@ -151,6 +157,8 @@ class ManagementCrudTest extends FeatureTestCase
|
||||
'<th>是否达标</th>',
|
||||
], false)
|
||||
->assertSee('aria-label="提现管理筛选"', false)
|
||||
->assertSee('name="store_entity"', false)
|
||||
->assertSee('value="提现测试主体"', false)
|
||||
->assertSee('title="聚水潭店铺:天猫-提现测试店铺;余额日期:2026-09-12"', false)
|
||||
->assertSeeInOrder(['提现测试ERP店', '未接入测试ERP店'])
|
||||
->assertDontSee('<th>店铺名称</th>', false)
|
||||
@ -163,6 +171,14 @@ class ManagementCrudTest extends FeatureTestCase
|
||||
->assertOk()
|
||||
->assertSeeText('未接入测试ERP店')
|
||||
->assertDontSeeText('提现测试ERP店');
|
||||
|
||||
$entityResponse
|
||||
->assertOk()
|
||||
->assertSeeText('提现测试ERP店')
|
||||
->assertSeeText('提现测试主体')
|
||||
->assertDontSeeText('未接入测试ERP店')
|
||||
->assertSee('name="store_entity"', false)
|
||||
->assertSee('value="提现测试主体" selected', false);
|
||||
}
|
||||
|
||||
public function testInstallationDetailsRendersWorkbookHeadersAndImportedRows(): void
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user