From 23fb9549e01454781f6184e2a8377fdd754e3138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Tue, 17 Mar 2026 11:57:22 +0800 Subject: [PATCH] ui(platform-orders): show audit labels for receipt actions --- .../admin/platform_orders/show.blade.php | 2 + ...howAuditReceiptActionsShouldRenderTest.php | 90 +++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 tests/Feature/AdminPlatformOrderShowAuditReceiptActionsShouldRenderTest.php diff --git a/resources/views/admin/platform_orders/show.blade.php b/resources/views/admin/platform_orders/show.blade.php index c095a25..1d4dda1 100644 --- a/resources/views/admin/platform_orders/show.blade.php +++ b/resources/views/admin/platform_orders/show.blade.php @@ -836,6 +836,8 @@ 'mark_refunded' => '手动标记为已退款', 'mark_partially_refunded' => '手动标记为部分退款', 'mark_paid_status' => '手动标记为已支付', + 'add_payment_receipt' => '追加支付回执', + 'add_refund_receipt' => '追加退款回执', ]; @endphp diff --git a/tests/Feature/AdminPlatformOrderShowAuditReceiptActionsShouldRenderTest.php b/tests/Feature/AdminPlatformOrderShowAuditReceiptActionsShouldRenderTest.php new file mode 100644 index 0000000..2aba0c0 --- /dev/null +++ b/tests/Feature/AdminPlatformOrderShowAuditReceiptActionsShouldRenderTest.php @@ -0,0 +1,90 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_show_page_should_render_audit_action_labels_for_receipt_entries(): void + { + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + $plan = Plan::query()->create([ + 'code' => 'audit_receipt_action_labels_plan', + 'name' => '审计回执动作名测试套餐', + 'billing_cycle' => 'monthly', + 'price' => 30, + 'list_price' => 30, + 'status' => 'active', + 'sort' => 10, + 'published_at' => now(), + ]); + + $order = PlatformOrder::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => $plan->id, + 'order_no' => 'PO_AUDIT_RECEIPT_ACTIONS_0001', + 'order_type' => 'new_purchase', + 'status' => 'pending', + 'payment_status' => 'unpaid', + 'plan_name' => $plan->name, + 'billing_cycle' => $plan->billing_cycle, + 'period_months' => 1, + 'quantity' => 1, + 'payable_amount' => 30, + 'paid_amount' => 0, + 'placed_at' => now(), + 'meta' => [ + 'audit' => [ + [ + 'action' => 'add_payment_receipt', + 'scope' => 'single', + 'at' => now()->toDateTimeString(), + 'admin_id' => 1, + 'snapshot' => [ + 'amount' => 30, + 'channel' => 'icbc', + 'paid_at' => now()->toDateTimeString(), + ], + 'note' => '追加支付回执', + ], + [ + 'action' => 'add_refund_receipt', + 'scope' => 'single', + 'at' => now()->toDateTimeString(), + 'admin_id' => 1, + 'snapshot' => [ + 'amount' => 10, + 'channel' => 'icbc', + 'refunded_at' => now()->toDateTimeString(), + ], + 'note' => '追加退款回执', + ], + ], + ], + ]); + + $this->get('/admin/platform-orders/' . $order->id) + ->assertOk() + ->assertSee('追加支付回执') + ->assertSee('追加退款回执'); + } +}