feat: add more zhongcai platform tabs
This commit is contained in:
parent
5ecb3598c4
commit
ea682327ab
@ -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 @@
|
||||
|
||||
<div class="mb-4 flex flex-wrap items-center gap-2" role="tablist" aria-label="平台筛选">
|
||||
<span class="mr-2 text-sm font-medium text-gray-700">平台筛选</span>
|
||||
@foreach ([
|
||||
'all' => '全部',
|
||||
'jd' => '京东',
|
||||
'douyin' => '抖音',
|
||||
'tmall' => '天猫',
|
||||
] as $key => $label)
|
||||
@foreach ($platformTabs as $key => $label)
|
||||
<button type="button"
|
||||
role="tab"
|
||||
aria-controls="zhongcai-reconciliation-table"
|
||||
@ -160,7 +166,13 @@
|
||||
? 'jd'
|
||||
: (str_contains($platform, '抖音')
|
||||
? 'douyin'
|
||||
: (str_contains($platform, '天猫') ? 'tmall' : 'other'));
|
||||
: (str_contains($platform, '天猫')
|
||||
? 'tmall'
|
||||
: (str_contains($platform, '拼多多')
|
||||
? 'pdd'
|
||||
: (str_contains($platform, '淘宝')
|
||||
? 'taobao'
|
||||
: (str_contains($platform, '京喜') ? 'jingxi' : 'other')))));
|
||||
@endphp
|
||||
<tr x-show="activePlatform === 'all' || activePlatform === '{{ $platformKey }}'"
|
||||
x-cloak
|
||||
@ -208,7 +220,7 @@
|
||||
</tr>
|
||||
@endforeach
|
||||
@endif
|
||||
@foreach (['jd' => '京东', 'douyin' => '抖音', 'tmall' => '天猫'] as $key => $label)
|
||||
@foreach ($platformTabs as $key => $label)
|
||||
@if (count($platformIds[$key]) === 0)
|
||||
<tr x-show="activePlatform === '{{ $key }}'" x-cloak>
|
||||
<td colspan="23" class="px-5 py-10 text-center text-gray-400">
|
||||
|
||||
@ -23,6 +23,9 @@ class ZhongcaiReconciliationPlatformTest extends FeatureTestCase
|
||||
['platform' => '京东商城', 'order' => 'JD-TEST-001'],
|
||||
['platform' => '抖音小店', 'order' => 'DY-TEST-001'],
|
||||
['platform' => '天猫旗舰店', 'order' => 'TM-TEST-001'],
|
||||
['platform' => '拼多多店铺', 'order' => 'PDD-TEST-001'],
|
||||
['platform' => '淘宝店铺', 'order' => 'TB-TEST-001'],
|
||||
['platform' => '京喜店铺', 'order' => 'JX-TEST-001'],
|
||||
] as $row) {
|
||||
StoreZhongcaiReconciliation::create([
|
||||
'company_id' => $this->company->id,
|
||||
@ -40,16 +43,25 @@ class ZhongcaiReconciliationPlatformTest extends FeatureTestCase
|
||||
$response
|
||||
->assertOk()
|
||||
->assertSee('平台筛选', false)
|
||||
->assertSee('>全部<', false)
|
||||
->assertSee('>京东<', false)
|
||||
->assertSee('>抖音<', false)
|
||||
->assertSee('>天猫<', false)
|
||||
->assertSee('>拼多多<', false)
|
||||
->assertSee('>淘宝<', false)
|
||||
->assertSee('>京喜<', false)
|
||||
->assertDontSee('>全部<', false)
|
||||
->assertSee('data-platform="jd"', false)
|
||||
->assertSee('data-platform="douyin"', false)
|
||||
->assertSee('data-platform="tmall"', false)
|
||||
->assertSee('data-platform="pdd"', false)
|
||||
->assertSee('data-platform="taobao"', false)
|
||||
->assertSee('data-platform="jingxi"', false)
|
||||
->assertSee('JD-TEST-001')
|
||||
->assertSee('DY-TEST-001')
|
||||
->assertSee('TM-TEST-001');
|
||||
->assertSee('TM-TEST-001')
|
||||
->assertSee('PDD-TEST-001')
|
||||
->assertSee('TB-TEST-001')
|
||||
->assertSee('JX-TEST-001');
|
||||
}
|
||||
|
||||
public function testReconciliationPageShowsPlatformSpecificEmptyState(): void
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user