From 6ebd3510dba8020cd02518c66e4339bb851e08d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Tue, 10 Mar 2026 14:46:16 +0000 Subject: [PATCH] =?UTF-8?q?feat(subscriptions):=20=E8=AE=A2=E9=98=85?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E6=94=AF=E6=8C=81=E4=B8=80=E9=94=AE=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E7=BB=AD=E8=B4=B9=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Admin/PlatformOrderController.php | 12 ++++++++++++ .../views/admin/platform_orders/form.blade.php | 14 +++++++------- .../views/admin/site_subscriptions/show.blade.php | 2 ++ tests/Feature/AdminSiteSubscriptionShowTest.php | 3 ++- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/Admin/PlatformOrderController.php b/app/Http/Controllers/Admin/PlatformOrderController.php index ad513f0..9e882a9 100644 --- a/app/Http/Controllers/Admin/PlatformOrderController.php +++ b/app/Http/Controllers/Admin/PlatformOrderController.php @@ -27,11 +27,23 @@ class PlatformOrderController extends Controller $merchants = Merchant::query()->orderBy('id')->get(['id', 'name']); $plans = Plan::query()->orderBy('sort')->orderByDesc('id')->get(); + // 支持从其它页面(例如订阅详情)带默认值跳转过来,提高运营效率 + $defaults = [ + 'merchant_id' => (int) $request->query('merchant_id', 0), + 'plan_id' => (int) $request->query('plan_id', 0), + 'order_type' => (string) $request->query('order_type', 'new_purchase'), + 'quantity' => (int) $request->query('quantity', 1), + 'discount_amount' => (float) $request->query('discount_amount', 0), + 'payment_channel' => (string) $request->query('payment_channel', ''), + 'remark' => (string) $request->query('remark', ''), + ]; + return view('admin.platform_orders.form', [ 'merchants' => $merchants, 'plans' => $plans, 'billingCycleLabels' => $this->billingCycleLabels(), 'orderTypeLabels' => $this->orderTypeLabels(), + 'defaults' => $defaults, ]); } diff --git a/resources/views/admin/platform_orders/form.blade.php b/resources/views/admin/platform_orders/form.blade.php index 1350833..5cb8ecb 100644 --- a/resources/views/admin/platform_orders/form.blade.php +++ b/resources/views/admin/platform_orders/form.blade.php @@ -17,7 +17,7 @@ @@ -27,7 +27,7 @@ @foreach(($orderTypeLabels ?? []) as $value => $label) - + @endforeach
diff --git a/resources/views/admin/site_subscriptions/show.blade.php b/resources/views/admin/site_subscriptions/show.blade.php index 22982cc..970fad8 100644 --- a/resources/views/admin/site_subscriptions/show.blade.php +++ b/resources/views/admin/site_subscriptions/show.blade.php @@ -73,6 +73,8 @@ 查看关联平台订单(按订阅ID精确过滤) 查看可同步订单 + + 创建续费订单 @endif
diff --git a/tests/Feature/AdminSiteSubscriptionShowTest.php b/tests/Feature/AdminSiteSubscriptionShowTest.php index 48d1503..d9f8446 100644 --- a/tests/Feature/AdminSiteSubscriptionShowTest.php +++ b/tests/Feature/AdminSiteSubscriptionShowTest.php @@ -96,7 +96,8 @@ class AdminSiteSubscriptionShowTest extends TestCase ->assertSee('同步时间') ->assertSee('失败原因') ->assertSee('查看关联平台订单(按订阅ID精确过滤)') - ->assertSee('查看可同步订单'); + ->assertSee('查看可同步订单') + ->assertSee('/admin/platform-orders/create?merchant_id=' . $merchant->id . '&plan_id=' . $plan->id, false); } public function test_guest_cannot_open_site_subscription_show_page(): void