feat(admin): subscriptions list links + platform orders count
This commit is contained in:
@@ -27,7 +27,7 @@ class SiteSubscriptionController extends Controller
|
||||
];
|
||||
|
||||
$query = $this->applyFilters(
|
||||
SiteSubscription::query()->with(['merchant', 'plan']),
|
||||
SiteSubscription::query()->with(['merchant', 'plan'])->withCount('platformOrders'),
|
||||
$filters
|
||||
)->orderBy('id');
|
||||
|
||||
@@ -44,6 +44,7 @@ class SiteSubscriptionController extends Controller
|
||||
'订阅号',
|
||||
'站点',
|
||||
'套餐',
|
||||
'关联订单数',
|
||||
'状态',
|
||||
'计费周期',
|
||||
'周期(月)',
|
||||
@@ -81,6 +82,7 @@ class SiteSubscriptionController extends Controller
|
||||
$sub->subscription_no,
|
||||
$sub->merchant?->name ?? '',
|
||||
$sub->plan_name ?: ($sub->plan?->name ?? ''),
|
||||
(int) ($sub->platform_orders_count ?? 0),
|
||||
$statusText,
|
||||
$sub->billing_cycle ?: '',
|
||||
(int) $sub->period_months,
|
||||
@@ -117,7 +119,7 @@ class SiteSubscriptionController extends Controller
|
||||
];
|
||||
|
||||
$query = $this->applyFilters(
|
||||
SiteSubscription::query()->with(['merchant', 'plan']),
|
||||
SiteSubscription::query()->with(['merchant', 'plan'])->withCount('platformOrders'),
|
||||
$filters
|
||||
);
|
||||
|
||||
|
||||
@@ -97,6 +97,7 @@
|
||||
<th>开始时间</th>
|
||||
<th>到期时间</th>
|
||||
<th>到期状态</th>
|
||||
<th>关联订单数</th>
|
||||
<th>生效时间</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -104,9 +105,23 @@
|
||||
@forelse($subscriptions as $subscription)
|
||||
<tr>
|
||||
<td>{{ $subscription->id }}</td>
|
||||
<td>{{ $subscription->subscription_no }}</td>
|
||||
<td>{{ $subscription->merchant?->name ?? '未关联站点' }}</td>
|
||||
<td>{{ $subscription->plan_name ?: ($subscription->plan?->name ?? '未设置') }}</td>
|
||||
<td>
|
||||
<a href="/admin/site-subscriptions?keyword={{ urlencode($subscription->subscription_no) }}">{{ $subscription->subscription_no }}</a>
|
||||
</td>
|
||||
<td>
|
||||
@if($subscription->merchant)
|
||||
<a href="/admin/site-subscriptions?merchant_id={{ $subscription->merchant->id }}">{{ $subscription->merchant->name }}</a>
|
||||
@else
|
||||
未关联站点
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if($subscription->plan)
|
||||
<a href="/admin/site-subscriptions?plan_id={{ $subscription->plan->id }}">{{ $subscription->plan_name ?: $subscription->plan->name }}</a>
|
||||
@else
|
||||
{{ $subscription->plan_name ?: '未设置' }}
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ ($statusLabels[$subscription->status] ?? $subscription->status) }} <span class="muted">({{ $subscription->status }})</span></td>
|
||||
<td>{{ $subscription->billing_cycle ?: '-' }}</td>
|
||||
<td>{{ $subscription->period_months }}</td>
|
||||
@@ -129,11 +144,19 @@
|
||||
@endphp
|
||||
{{ $expiryLabel }}
|
||||
</td>
|
||||
<td>
|
||||
@php $cnt = (int) ($subscription->platform_orders_count ?? 0); @endphp
|
||||
@if($cnt > 0)
|
||||
<a href="/admin/platform-orders?keyword={{ urlencode($subscription->subscription_no) }}">{{ $cnt }}</a>
|
||||
@else
|
||||
<span class="muted">0</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ optional($subscription->activated_at)->format('Y-m-d H:i:s') ?: '-' }}</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="12" class="muted">暂无订阅数据,当前阶段先把订阅主表与总台目录立起来,后续再接订阅创建/激活/续费链路。</td>
|
||||
<td colspan="13" class="muted">暂无订阅数据,当前阶段先把订阅主表与总台目录立起来,后续再接订阅创建/激活/续费链路。</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
|
||||
@@ -63,6 +63,7 @@ class AdminSiteSubscriptionExportTest extends TestCase
|
||||
$this->assertStringContainsString('SUB_EXPORT_0001', $content);
|
||||
$this->assertStringContainsString('到期时间', $content);
|
||||
$this->assertStringContainsString('到期状态', $content);
|
||||
$this->assertStringContainsString('关联订单数', $content);
|
||||
$this->assertStringContainsString('未到期', $content);
|
||||
|
||||
// 状态导出应为“中文标签 + 原始值”
|
||||
|
||||
Reference in New Issue
Block a user