diff --git a/resources/views/admin/platform_orders/show.blade.php b/resources/views/admin/platform_orders/show.blade.php index c9f7ecc..a0a8e6a 100644 --- a/resources/views/admin/platform_orders/show.blade.php +++ b/resources/views/admin/platform_orders/show.blade.php @@ -157,6 +157,46 @@ 回执数 / 回执总额{{ $receiptCount }} / ¥{{ number_format($receiptTotal, 2) }} 退款笔数 / 退款总额{{ $refundCount }} / ¥{{ number_format($refundTotal, 2) }} 金额容差¥{{ number_format($amountTol, 2) }} + @php + $basRunId = (string) (data_get($order->meta, 'batch_activation.run_id') ?? ''); + $bmpaRunId = (string) (data_get($order->meta, 'batch_mark_paid_and_activate.run_id') ?? ''); + + $basBatchUrl = $basRunId !== '' + ? \App\Support\BackUrl::withBack('/admin/platform-batches/show?' . \Illuminate\Support\Arr::query([ + 'type' => 'bas', + 'run_id' => $basRunId, + ]), $orderShowSelf) + : ''; + + $bmpaBatchUrl = $bmpaRunId !== '' + ? \App\Support\BackUrl::withBack('/admin/platform-batches/show?' . \Illuminate\Support\Arr::query([ + 'type' => 'bmpa', + 'run_id' => $bmpaRunId, + ]), $orderShowSelf) + : ''; + @endphp + + BAS 批次 run_id + + @if($basBatchUrl !== '') + {{ $basRunId }} + (批次复盘) + @else + - + @endif + + + + BMPA 批次 run_id + + @if($bmpaBatchUrl !== '') + {{ $bmpaRunId }} + (批次复盘) + @else + - + @endif + + diff --git a/tests/Feature/AdminPlatformOrderShowBatchRunIdShouldLinkToPlatformBatchShowPageTest.php b/tests/Feature/AdminPlatformOrderShowBatchRunIdShouldLinkToPlatformBatchShowPageTest.php new file mode 100644 index 0000000..ed82213 --- /dev/null +++ b/tests/Feature/AdminPlatformOrderShowBatchRunIdShouldLinkToPlatformBatchShowPageTest.php @@ -0,0 +1,78 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_platform_order_show_batch_run_id_should_link_to_platform_batch_show_page(): void + { + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + $plan = Plan::query()->create([ + 'code' => 'po_show_batch_run_id_plan_01', + 'name' => '平台订单详情批次run_id链接测试套餐', + 'billing_cycle' => 'monthly', + 'price' => 10, + 'list_price' => 10, + 'status' => 'active', + 'sort' => 10, + 'published_at' => now(), + ]); + + $order = PlatformOrder::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => $plan->id, + 'order_no' => 'PO_SHOW_BATCH_RUN_ID_0001', + 'order_type' => 'new_purchase', + 'status' => 'pending', + 'payment_status' => 'paid', + 'plan_name' => $plan->name, + 'billing_cycle' => $plan->billing_cycle, + 'period_months' => 1, + 'quantity' => 1, + 'payable_amount' => 10, + 'paid_amount' => 10, + 'placed_at' => now(), + 'paid_at' => now(), + 'meta' => [ + 'batch_activation' => [ + 'run_id' => 'RUN_BAS_0001', + ], + 'batch_mark_paid_and_activate' => [ + 'run_id' => 'RUN_BMPA_0001', + ], + ], + ]); + + $res = $this->get('/admin/platform-orders/' . $order->id); + $res->assertOk(); + + // BAS run_id 应链接到批次复盘页(携带 back 回到订单详情) + $res->assertSee('RUN_BAS_0001', false); + $res->assertSee('/admin/platform-batches/show?type=bas&run_id=RUN_BAS_0001', false); + $res->assertSee('back=%2Fadmin%2Fplatform-orders%2F' . $order->id, false); + + // BMPA run_id 应链接到批次复盘页(携带 back 回到订单详情) + $res->assertSee('RUN_BMPA_0001', false); + $res->assertSee('/admin/platform-batches/show?type=bmpa&run_id=RUN_BMPA_0001', false); + } +}