diff --git a/resources/views/admin/site_subscriptions/index.blade.php b/resources/views/admin/site_subscriptions/index.blade.php
index 6c579b1..a6f7923 100644
--- a/resources/views/admin/site_subscriptions/index.blade.php
+++ b/resources/views/admin/site_subscriptions/index.blade.php
@@ -129,14 +129,32 @@
工具
-
+
+
+
+ @php
+ $q = [
+ 'order_type' => 'renewal',
+ 'back' => $selfWithoutBack,
+ ];
+ 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'];
+ }
+ $createOrderFromSubIndexUrl = '/admin/platform-orders/create?' . \Illuminate\Support\Arr::query($q);
+ @endphp
+
创建续费订单(带当前筛选)
+
+
用于运营从订阅目录快速补单/续费:会把当前 merchant_id/plan_id/site_subscription_id 作为默认值带到下单页。
diff --git a/tests/Feature/AdminSiteSubscriptionIndexCreateRenewalOrderLinkTest.php b/tests/Feature/AdminSiteSubscriptionIndexCreateRenewalOrderLinkTest.php
new file mode 100644
index 0000000..fe1b21a
--- /dev/null
+++ b/tests/Feature/AdminSiteSubscriptionIndexCreateRenewalOrderLinkTest.php
@@ -0,0 +1,103 @@
+seed();
+
+ $this->post('/admin/login', [
+ 'email' => 'platform.admin@demo.local',
+ 'password' => 'Platform@123456',
+ ])->assertRedirect('/admin');
+ }
+
+ public function test_index_should_render_create_renewal_order_link_with_current_filters_and_safe_back(): void
+ {
+ $this->loginAsPlatformAdmin();
+
+ $merchant = Merchant::query()->firstOrFail();
+ $plan = Plan::query()->create([
+ 'code' => 'sub_index_create_order_plan',
+ 'name' => '订阅列表创建续费订单测试套餐',
+ 'billing_cycle' => 'monthly',
+ 'price' => 10,
+ 'list_price' => 10,
+ 'status' => 'active',
+ 'sort' => 10,
+ 'published_at' => now(),
+ ]);
+
+ SiteSubscription::query()->create([
+ 'merchant_id' => $merchant->id,
+ 'plan_id' => $plan->id,
+ 'status' => 'activated',
+ 'source' => 'manual',
+ 'subscription_no' => 'SUB_INDEX_CREATE_ORDER_0001',
+ 'plan_name' => $plan->name,
+ 'billing_cycle' => $plan->billing_cycle,
+ 'period_months' => 1,
+ 'amount' => 10,
+ 'starts_at' => now()->subDay(),
+ 'ends_at' => now()->addMonth(),
+ 'activated_at' => now()->subDay(),
+ ]);
+
+ // 模拟:订阅列表本身带 back(避免嵌套),同时带 merchant_id/plan_id 筛选
+ $currentUrl = '/admin/site-subscriptions?' . Arr::query([
+ 'merchant_id' => $merchant->id,
+ 'plan_id' => $plan->id,
+ 'status' => 'activated',
+ 'back' => '/admin',
+ ]);
+
+ $res = $this->get($currentUrl);
+ $res->assertOk();
+
+ $selfWithoutBack = '/admin/site-subscriptions?' . Arr::query([
+ 'merchant_id' => $merchant->id,
+ 'plan_id' => $plan->id,
+ 'status' => 'activated',
+ ]);
+
+ // 不依赖 query 顺序:解析 href 后按键值断言
+ $html = $res->getContent();
+
+ preg_match_all('/href="([^"]+)"/', $html, $matches);
+ $hrefs = $matches[1] ?? [];
+
+ $createUrls = array_values(array_filter($hrefs, fn ($u) => str_contains($u, '/admin/platform-orders/create?')));
+ $this->assertNotEmpty($createUrls, '未找到创建续费订单链接');
+
+ $found = false;
+ foreach ($createUrls as $u) {
+ $parts = parse_url($u);
+ parse_str($parts['query'] ?? '', $q);
+
+ if (($q['order_type'] ?? '') === 'renewal'
+ && (string) ($q['merchant_id'] ?? '') === (string) $merchant->id
+ && (string) ($q['plan_id'] ?? '') === (string) $plan->id
+ && (string) ($q['back'] ?? '') === $selfWithoutBack) {
+ $found = true;
+ break;
+ }
+ }
+
+ $this->assertTrue($found, '未找到包含当前筛选条件与 back 的创建续费订单链接');
+ $res->assertSee('创建续费订单(带当前筛选)', false);
+
+ // 防 back 嵌套
+ $res->assertDontSee('back%3D', false);
+ }
+}