diff --git a/resources/views/admin/site_subscriptions/index.blade.php b/resources/views/admin/site_subscriptions/index.blade.php
index e78a0d0..283b632 100644
--- a/resources/views/admin/site_subscriptions/index.blade.php
+++ b/resources/views/admin/site_subscriptions/index.blade.php
@@ -98,6 +98,27 @@
已过期({{ $summaryStats['expired_subscriptions'] ?? 0 }})
7天内到期({{ $summaryStats['expiring_7d_subscriptions'] ?? 0 }})
+
+ @php
+ // 当已处于“到期集合”视图时,补一个就近的续费下单入口(带回退到当前列表的 back)。
+ $isExpiryView = in_array((string) ($filters['expiry'] ?? ''), ['expired', 'expiring_7d'], true);
+ $renewalCtaUrl = '';
+ if ($isExpiryView) {
+ $q = [
+ 'order_type' => 'renewal',
+ ];
+ if ((int) ($filters['merchant_id'] ?? 0) > 0) {
+ $q['merchant_id'] = (int) $filters['merchant_id'];
+ }
+ if ((int) ($filters['plan_id'] ?? 0) > 0) {
+ $q['plan_id'] = (int) $filters['plan_id'];
+ }
+ $renewalCtaUrl = \App\Support\BackUrl::withBack('/admin/platform-orders/create?' . \Illuminate\Support\Arr::query($q), $selfWithoutBack);
+ }
+ @endphp
+ @if($isExpiryView)
+
创建续费订单(当前集合)
+ @endif
建议:先处理“7天内到期”续费触达,再处理“已过期”补单或关闭。
diff --git a/tests/Feature/AdminSiteSubscriptionIndexExpiryGovernanceRenewalCtaTest.php b/tests/Feature/AdminSiteSubscriptionIndexExpiryGovernanceRenewalCtaTest.php
new file mode 100644
index 0000000..36cdb97
--- /dev/null
+++ b/tests/Feature/AdminSiteSubscriptionIndexExpiryGovernanceRenewalCtaTest.php
@@ -0,0 +1,51 @@
+seed();
+
+ $this->post('/admin/login', [
+ 'email' => 'platform.admin@demo.local',
+ 'password' => 'Platform@123456',
+ ])->assertRedirect('/admin');
+ }
+
+ public function test_expiry_view_should_show_create_renewal_order_cta_with_back_to_self(): void
+ {
+ $this->loginAsPlatformAdmin();
+
+ $res = $this->get('/admin/site-subscriptions?expiry=expiring_7d&merchant_id=2&plan_id=3');
+ $res->assertOk();
+
+ $res->assertSee('创建续费订单(当前集合)');
+
+ // CTA 应带上当前筛选 merchant_id/plan_id,并且 back 回到当前列表(selfWithoutBack)
+ $res->assertSee('href="/admin/platform-orders/create?order_type=renewal&merchant_id=2&plan_id=3&back=%2Fadmin%2Fsite-subscriptions%3Fexpiry%3Dexpiring_7d%26merchant_id%3D2%26plan_id%3D3"', false);
+
+ // 链接不应出现 &(只检查该 CTA 的 href 文本中不含 &)
+ $html = (string) $res->getContent();
+ preg_match('/href="([^"]+)"[^>]*>创建续费订单(当前集合)<\/a>/', $html, $m);
+ $ctaHref = (string) ($m[1] ?? '');
+ $this->assertNotSame('', $ctaHref);
+ $this->assertStringNotContainsString('&', $ctaHref);
+ }
+
+ public function test_non_expiry_view_should_not_show_renewal_cta(): void
+ {
+ $this->loginAsPlatformAdmin();
+
+ $res = $this->get('/admin/site-subscriptions?status=activated');
+ $res->assertOk();
+
+ $res->assertDontSee('创建续费订单(当前集合)');
+ }
+}