diff --git a/resources/views/admin/platform_orders/index.blade.php b/resources/views/admin/platform_orders/index.blade.php index 6652788..dd172f9 100644 --- a/resources/views/admin/platform_orders/index.blade.php +++ b/resources/views/admin/platform_orders/index.blade.php @@ -1125,7 +1125,10 @@ {{ $planName }} @endif - {{ $order->order_type }} + + {{ $orderTypeLabels[$order->order_type] ?? $order->order_type }} +
{{ $order->order_type }}
+ {{ $statusLabels[$order->status] ?? $order->status }}
{{ $order->status }}
diff --git a/tests/Feature/AdminPlatformOrderIndexOrderTypeLabelTest.php b/tests/Feature/AdminPlatformOrderIndexOrderTypeLabelTest.php new file mode 100644 index 0000000..0182de6 --- /dev/null +++ b/tests/Feature/AdminPlatformOrderIndexOrderTypeLabelTest.php @@ -0,0 +1,67 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_index_should_render_order_type_label_and_code(): void + { + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + $plan = Plan::query()->create([ + 'code' => 'po_index_type_label_plan', + 'name' => '订单列表订单类型展示测试套餐', + 'billing_cycle' => 'monthly', + 'price' => 10, + 'list_price' => 10, + 'status' => 'active', + 'sort' => 10, + 'published_at' => now(), + ]); + + PlatformOrder::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => $plan->id, + 'order_no' => 'PO_INDEX_TYPE_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' => 10, + 'paid_amount' => 0, + 'placed_at' => now(), + ]); + + $res = $this->get('/admin/platform-orders?' . Arr::query([ + 'view' => 'full', + ])); + + $res->assertOk(); + $res->assertSee('订单类型', false); + $res->assertSee('新购', false); + $res->assertSee('new_purchase', false); + } +}