@if ($accounts->isEmpty())
- |
+ |
{{ trans('marketing_account_bills.no_records') }}
|
@@ -113,30 +342,31 @@
form="marketing-account-bills-export-form"
x-model="selected"
aria-label="{{ trans('marketing_account_bills.select_bill') }}"
- class="h-4 w-4 rounded border-gray-300 text-green" />
-
- {{ $account->store_name }} |
- {{ $account->bill_date->format('Y-m-d') }} |
- {{ number_format($account->total_deposit, 2) }} |
- {{ number_format($account->total_transfer_in, 2) }} |
- {{ number_format($account->total_transfer_out, 2) }} |
- {{ number_format($account->non_grant_consumption, 2) }} |
- {{ number_format($account->grant_consumption, 2) }} |
- {{ number_format($account->rebate_redpack_consumption, 2) }} |
- {{ number_format($account->discount_redpack_consumption, 2) }} |
- {{ number_format($account->shared_wallet_consumption, 2) }} |
- {{ number_format($account->shared_grant_consumption, 2) }} |
- {{ number_format($account->daily_total_amount, 2) }} |
- {{ number_format($account->period_end_balance, 2) }} |
- {{ number_format($account->grant_balance, 2) }} |
- {{ number_format($account->non_grant_balance, 2) }} |
-
- {{ \Illuminate\Support\Str::limit($account->notes, 20) }}
+ class="marketing-bills-checkbox h-4 w-4 rounded" />
|
+ @foreach ($columns as $column)
+ $column['kind'] === 'money',
+ 'max-w-xs truncate' => $column['field'] === 'notes',
+ ])
+ @if ($column['field'] === 'notes') title="{{ $account->notes }}" @endif
+ >
+ @if ($column['kind'] === 'date')
+ {{ $account->{$column['field']}?->format('Y-m-d') ?? '—' }}
+ @elseif ($column['kind'] === 'money')
+ {{ number_format((float) $account->{$column['field']}, 2) }}
+ @elseif ($column['field'] === 'notes')
+ {{ \Illuminate\Support\Str::limit((string) $account->{$column['field']}, 20) }}
+ @else
+ {{ $account->{$column['field']} }}
+ @endif
+ |
+ @endforeach
@can('update-banking-accounts')
{{ trans('general.edit') }}
+ class="marketing-bills-edit mr-3">{{ trans('general.edit') }}
@endcan
@can('delete-banking-accounts')
@endcan
|
diff --git a/resources/views/business/pages/show.blade.php b/resources/views/business/pages/show.blade.php
index 3689cb65..ef40d2e6 100644
--- a/resources/views/business/pages/show.blade.php
+++ b/resources/views/business/pages/show.blade.php
@@ -4,6 +4,20 @@
+ @php
+ $isMarketingAccountBillsPage = ($section['slug'] ?? null) === 'billing-transactions'
+ && ($page['slug'] ?? null) === 'marketing-account-bills';
+ $activeContentTitle = $activeTab['title'] ?? ($page['title'] ?? $section['title']);
+
+ if ($isMarketingAccountBillsPage && ($activeTab['slug'] ?? null) === 'taobao-wechat') {
+ $activeContentTitle = 'Alibaba';
+ }
+
+ if ($isMarketingAccountBillsPage && ($activeTab['slug'] ?? null) === 'jd-wallet') {
+ $activeContentTitle = '京东';
+ }
+ @endphp
+
-
+
$isMarketingAccountBillsPage,
+ ])>
@if (is_string(session('success')))
{{ session('success') }}
@endif
@@ -351,10 +401,21 @@
@if ($errors->has('import'))
{{ $errors->first('import') }}
@endif
-
@if ($tabs->isNotEmpty())
@@ -393,7 +454,7 @@
@endphp
@if (!empty($content) && !empty($content['view']))
-
+
@include($content['view'], $content)
@elseif ($pageView)
diff --git a/tests/Feature/Business/MarketingAccountBillsTabsTest.php b/tests/Feature/Business/MarketingAccountBillsTabsTest.php
new file mode 100644
index 00000000..5f657dd7
--- /dev/null
+++ b/tests/Feature/Business/MarketingAccountBillsTabsTest.php
@@ -0,0 +1,70 @@
+allowMarketingAccountBillsPage();
+
+ $this->loginAs()
+ ->get(route('business.pages.show', [
+ 'section' => 'billing-transactions',
+ 'page' => 'marketing-account-bills',
+ 'tab' => 'taobao-wechat',
+ ]))
+ ->assertOk()
+ ->assertSeeText('Alibaba')
+ ->assertSeeText('京东')
+ ->assertSee('class="my-6 business-page--marketing-account-bills"', false);
+ }
+
+ public function testJdWalletHasRechargeAndConsumptionViewsWithoutChangingTheDataSource(): void
+ {
+ $this->allowMarketingAccountBillsPage();
+
+ $base = [
+ 'section' => 'billing-transactions',
+ 'page' => 'marketing-account-bills',
+ 'tab' => 'jd-wallet',
+ ];
+
+ $this->loginAs()
+ ->get(route('business.pages.show', $base))
+ ->assertOk()
+ ->assertSeeText('充值账单')
+ ->assertSeeText('消耗账单')
+ ->assertSeeText('总存入金额(元)')
+ ->assertDontSeeText('非赠款消耗金额(元)');
+
+ $this->loginAs()
+ ->get(route('business.pages.show', array_merge($base, ['jd_ledger' => 'consumption'])))
+ ->assertOk()
+ ->assertSeeText('充值账单')
+ ->assertSeeText('消耗账单')
+ ->assertSeeText('非赠款消耗金额(元)')
+ ->assertDontSeeText('总存入金额(元)');
+ }
+
+ private function allowMarketingAccountBillsPage(): void
+ {
+ $this->user->update(['locale' => 'zh-CN']);
+
+ $this->user->attachPermission(
+ Permission::where('name', 'read-admin-panel')->firstOrFail()
+ );
+
+ $subject = 'user_' . $this->user->id;
+
+ setting()->set('system.sidebar_permissions', json_encode([
+ 'configured' => [$subject],
+ 'subjects' => [
+ $subject => ['billing-transactions/marketing-account-bills'],
+ ],
+ ], JSON_UNESCAPED_UNICODE));
+ }
+}