From 51450007d40a58367afee6b32d92566b397594bb Mon Sep 17 00:00:00 2001 From: qiuxiang Date: Tue, 1 Sep 2026 11:56:16 +0800 Subject: [PATCH 1/9] feat: add zhongcai reconciliation platform tabs --- .../partials/embedded-table.blade.php | 78 +++++++++++++++++-- .../ZhongcaiReconciliationPlatformTest.php | 74 ++++++++++++++++++ 2 files changed, 145 insertions(+), 7 deletions(-) create mode 100644 tests/Feature/Business/ZhongcaiReconciliationPlatformTest.php diff --git a/resources/views/store_receivables/zhongcai_reconciliations/partials/embedded-table.blade.php b/resources/views/store_receivables/zhongcai_reconciliations/partials/embedded-table.blade.php index a4472292..2615216a 100644 --- a/resources/views/store_receivables/zhongcai_reconciliations/partials/embedded-table.blade.php +++ b/resources/views/store_receivables/zhongcai_reconciliations/partials/embedded-table.blade.php @@ -1,5 +1,6 @@ -@php $pageIds = $records->pluck('id')->map(fn($id) => (string) $id)->values(); @endphp +@php + $pageIds = $records->pluck('id')->map(fn($id) => (string) $id)->values(); + $platformIds = [ + 'all' => $pageIds->all(), + 'jd' => [], + 'douyin' => [], + 'tmall' => [], + ]; -
+ foreach ($records as $record) { + $platform = (string) $record->responsible_platform; + $platformKey = str_contains($platform, '京东') + ? 'jd' + : (str_contains($platform, '抖音') + ? 'douyin' + : (str_contains($platform, '天猫') ? 'tmall' : null)); + + if ($platformKey !== null) { + $platformIds[$platformKey][] = (string) $record->id; + } + } +@endphp + +
@@ -63,16 +85,39 @@
@endif +
+ 平台筛选 + @foreach ([ + 'all' => '全部', + 'jd' => '京东', + 'douyin' => '抖音', + 'tmall' => '天猫', + ] as $key => $label) + + @endforeach +
+ {{-- 21列数据表格 --}}
- +
@@ -101,14 +146,24 @@ @if ($records->isEmpty()) - + @else @foreach ($records as $r) - + @php + $platform = (string) $r->responsible_platform; + $platformKey = str_contains($platform, '京东') + ? 'jd' + : (str_contains($platform, '抖音') + ? 'douyin' + : (str_contains($platform, '天猫') ? 'tmall' : 'other')); + @endphp + + + + @endif + @endforeach
isEmpty()) disabled @endif - x-on:change="selected = $event.target.checked ? @js($pageIds) : []" - x-bind:checked="selected.length === {{ $pageIds->count() }} && selected.length > 0" + x-on:change="selected = $event.target.checked ? platformIds[activePlatform] : []" + x-bind:checked="selected.length === platformIds[activePlatform].length && selected.length > 0" class="h-4 w-4 rounded border-gray-300 text-green" /> {{ trans('store_zhongcai_reconciliations.bill_date') }}
{{ trans('store_zhongcai_reconciliations.no_records') }}
@endforeach @endif + @foreach (['jd' => '京东', 'douyin' => '抖音', 'tmall' => '天猫'] as $key => $label) + @if (count($platformIds[$key]) === 0) +
+ 当前页暂无{{ $label }}平台数据 +
diff --git a/tests/Feature/Business/ZhongcaiReconciliationPlatformTest.php b/tests/Feature/Business/ZhongcaiReconciliationPlatformTest.php new file mode 100644 index 00000000..d1ffd4da --- /dev/null +++ b/tests/Feature/Business/ZhongcaiReconciliationPlatformTest.php @@ -0,0 +1,74 @@ +user->attachPermission( + Permission::where('name', 'read-admin-panel')->firstOrFail() + ); + } + + public function testReconciliationPageProvidesPlatformTabsForCurrentPageRows(): void + { + foreach ([ + ['platform' => '京东商城', 'order' => 'JD-TEST-001'], + ['platform' => '抖音小店', 'order' => 'DY-TEST-001'], + ['platform' => '天猫旗舰店', 'order' => 'TM-TEST-001'], + ] as $row) { + StoreZhongcaiReconciliation::create([ + 'company_id' => $this->company->id, + 'bill_date' => '2026-08-01', + 'planting_order_no' => $row['order'], + 'responsible_platform' => $row['platform'], + ]); + } + + $response = $this->loginAs()->get(route('business.pages.show', [ + 'section' => 'store-receivables', + 'page' => 'zhongcai-reconciliation', + ])); + + $response + ->assertOk() + ->assertSee('平台筛选', false) + ->assertSee('>全部<', false) + ->assertSee('>京东<', false) + ->assertSee('>抖音<', false) + ->assertSee('>天猫<', false) + ->assertSee('data-platform="jd"', false) + ->assertSee('data-platform="douyin"', false) + ->assertSee('data-platform="tmall"', false) + ->assertSee('JD-TEST-001') + ->assertSee('DY-TEST-001') + ->assertSee('TM-TEST-001'); + } + + public function testReconciliationPageShowsPlatformSpecificEmptyState(): void + { + StoreZhongcaiReconciliation::create([ + 'company_id' => $this->company->id, + 'bill_date' => '2026-08-01', + 'planting_order_no' => 'JD-TEST-002', + 'responsible_platform' => '京东', + ]); + + $response = $this->loginAs()->get(route('business.pages.show', [ + 'section' => 'store-receivables', + 'page' => 'zhongcai-reconciliation', + ])); + + $response + ->assertOk() + ->assertSee('当前页暂无抖音平台数据', false) + ->assertSee('当前页暂无天猫平台数据', false); + } +} -- 2.47.2 From 1f5ed4efe99de75609304e1b764eeaef5301202b Mon Sep 17 00:00:00 2001 From: qiuxiang Date: Tue, 1 Sep 2026 11:58:26 +0800 Subject: [PATCH 2/9] fix: disable empty platform selection --- .../zhongcai_reconciliations/partials/embedded-table.blade.php | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/views/store_receivables/zhongcai_reconciliations/partials/embedded-table.blade.php b/resources/views/store_receivables/zhongcai_reconciliations/partials/embedded-table.blade.php index 2615216a..6d23b413 100644 --- a/resources/views/store_receivables/zhongcai_reconciliations/partials/embedded-table.blade.php +++ b/resources/views/store_receivables/zhongcai_reconciliations/partials/embedded-table.blade.php @@ -116,6 +116,7 @@ isEmpty()) disabled @endif + x-bind:disabled="platformIds[activePlatform].length === 0" x-on:change="selected = $event.target.checked ? platformIds[activePlatform] : []" x-bind:checked="selected.length === platformIds[activePlatform].length && selected.length > 0" class="h-4 w-4 rounded border-gray-300 text-green" /> -- 2.47.2 From ea682327ab52874074f71bb54e2d2b6420966ae8 Mon Sep 17 00:00:00 2001 From: qiuxiang Date: Tue, 1 Sep 2026 13:11:09 +0800 Subject: [PATCH 3/9] feat: add more zhongcai platform tabs --- .../partials/embedded-table.blade.php | 38 ++++++++++++------- .../ZhongcaiReconciliationPlatformTest.php | 16 +++++++- 2 files changed, 39 insertions(+), 15 deletions(-) diff --git a/resources/views/store_receivables/zhongcai_reconciliations/partials/embedded-table.blade.php b/resources/views/store_receivables/zhongcai_reconciliations/partials/embedded-table.blade.php index 6d23b413..f3b49382 100644 --- a/resources/views/store_receivables/zhongcai_reconciliations/partials/embedded-table.blade.php +++ b/resources/views/store_receivables/zhongcai_reconciliations/partials/embedded-table.blade.php @@ -11,12 +11,17 @@ @php $pageIds = $records->pluck('id')->map(fn($id) => (string) $id)->values(); + $platformTabs = [ + 'jd' => '京东', + 'douyin' => '抖音', + 'tmall' => '天猫', + 'pdd' => '拼多多', + 'taobao' => '淘宝', + 'jingxi' => '京喜', + ]; $platformIds = [ 'all' => $pageIds->all(), - 'jd' => [], - 'douyin' => [], - 'tmall' => [], - ]; + ] + array_fill_keys(array_keys($platformTabs), []); foreach ($records as $record) { $platform = (string) $record->responsible_platform; @@ -24,7 +29,13 @@ ? 'jd' : (str_contains($platform, '抖音') ? 'douyin' - : (str_contains($platform, '天猫') ? 'tmall' : null)); + : (str_contains($platform, '天猫') + ? 'tmall' + : (str_contains($platform, '拼多多') + ? 'pdd' + : (str_contains($platform, '淘宝') + ? 'taobao' + : (str_contains($platform, '京喜') ? 'jingxi' : null))))); if ($platformKey !== null) { $platformIds[$platformKey][] = (string) $record->id; @@ -87,12 +98,7 @@
平台筛选 - @foreach ([ - 'all' => '全部', - 'jd' => '京东', - 'douyin' => '抖音', - 'tmall' => '天猫', - ] as $key => $label) + @foreach ($platformTabs as $key => $label)