Platform order show: link BAS/BMPA run_id to batch replay page
This commit is contained in:
@@ -157,6 +157,46 @@
|
||||
<tr><th>回执数 / 回执总额</th><td>{{ $receiptCount }} / ¥{{ number_format($receiptTotal, 2) }}</td></tr>
|
||||
<tr><th>退款笔数 / 退款总额</th><td>{{ $refundCount }} / ¥{{ number_format($refundTotal, 2) }}</td></tr>
|
||||
<tr><th>金额容差</th><td>¥{{ number_format($amountTol, 2) }}</td></tr>
|
||||
@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
|
||||
<tr>
|
||||
<th>BAS 批次 run_id</th>
|
||||
<td>
|
||||
@if($basBatchUrl !== '')
|
||||
<a class="link" href="{!! $basBatchUrl !!}">{{ $basRunId }}</a>
|
||||
<span class="muted">(批次复盘)</span>
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>BMPA 批次 run_id</th>
|
||||
<td>
|
||||
@if($bmpaBatchUrl !== '')
|
||||
<a class="link" href="{!! $bmpaBatchUrl !!}">{{ $bmpaRunId }}</a>
|
||||
<span class="muted">(批次复盘)</span>
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\Merchant;
|
||||
use App\Models\Plan;
|
||||
use App\Models\PlatformOrder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminPlatformOrderShowBatchRunIdShouldLinkToPlatformBatchShowPageTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
protected function loginAsPlatformAdmin(): void
|
||||
{
|
||||
$this->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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user