From 714cbe7ba435cc0a679e8e6cab6aa4536ad981e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Sat, 14 Mar 2026 13:11:39 +0000 Subject: [PATCH] platform_orders index: introduce row-warn helper class for inline governance hints --- public/css/admin-components.css | 1 + .../admin/platform_orders/index.blade.php | 8 +- ...dminPlatformOrderIndexRowWarnClassTest.php | 79 +++++++++++++++++++ 3 files changed, 84 insertions(+), 4 deletions(-) create mode 100644 tests/Feature/AdminPlatformOrderIndexRowWarnClassTest.php diff --git a/public/css/admin-components.css b/public/css/admin-components.css index cad0bd8..c7483ac 100644 --- a/public/css/admin-components.css +++ b/public/css/admin-components.css @@ -90,6 +90,7 @@ .platform-orders-table.is-compact td{padding-top:8px;padding-bottom:8px;} .platform-orders-table.is-compact .muted-xs{font-size:12px;} .platform-orders-table .row-meta{margin-top:2px;} +.platform-orders-table .row-warn{margin-top:4px;} /* 平台订单列表:精简视图也要可达的治理提示(对账/退款不一致) */ .platform-orders-table .governance-hints{margin-bottom:6px;} diff --git a/resources/views/admin/platform_orders/index.blade.php b/resources/views/admin/platform_orders/index.blade.php index 3c8f545..e9168ba 100644 --- a/resources/views/admin/platform_orders/index.blade.php +++ b/resources/views/admin/platform_orders/index.blade.php @@ -1081,7 +1081,7 @@ $noReceiptFixUrlRow = '/admin/platform-orders/' . $order->id . '?' . \Illuminate\Support\Arr::query(['back' => $selfWithoutBack]) . '#add-payment-receipt'; @endphp @if($order->payment_status === 'paid' && ! $hasReceiptEvidenceRow) -
+
无回执 去补回执 @@ -1132,10 +1132,10 @@ @if(! $isFullView) @if($syncErr !== '') -
原因:{{ mb_substr($syncErr, 0, $SYNC_FAILED_REASON_TRUNCATE_LEN) }}
+
原因:{{ mb_substr($syncErr, 0, $SYNC_FAILED_REASON_TRUNCATE_LEN) }}
@endif @if($bmpaErrCompact !== '') -
BMPA:{{ mb_substr($bmpaErrCompact, 0, $SYNC_FAILED_REASON_TRUNCATE_LEN) }}
+
BMPA:{{ mb_substr($bmpaErrCompact, 0, $SYNC_FAILED_REASON_TRUNCATE_LEN) }}
@endif @endif @@ -1373,7 +1373,7 @@ @endphp @if($needReconcileFix || $needRefundFix) -
+
@if($needReconcileFix)
对账不一致 diff --git a/tests/Feature/AdminPlatformOrderIndexRowWarnClassTest.php b/tests/Feature/AdminPlatformOrderIndexRowWarnClassTest.php new file mode 100644 index 0000000..2e0a759 --- /dev/null +++ b/tests/Feature/AdminPlatformOrderIndexRowWarnClassTest.php @@ -0,0 +1,79 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_row_warn_class_is_used_for_sync_bmpa_and_no_receipt_hints(): void + { + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + + $plan = Plan::query()->create([ + 'code' => 'po_index_row_warn_class_plan', + 'name' => '平台订单列表 row-warn class 测试套餐', + '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_ROW_WARN_0001', + 'order_type' => 'new_purchase', + 'status' => 'activated', + '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(), + 'activated_at' => now(), + // 关键:已支付但无任何回执证据 + 同时带 sync/bmpa error,触发多类提示 + 'meta' => [ + 'subscription_activation_error' => [ + 'message' => 'SIM_SYNC_ERR', + 'at' => now()->toDateTimeString(), + ], + 'batch_mark_paid_and_activate_error' => [ + 'message' => 'SIM_BMPA_ERR', + 'at' => now()->toDateTimeString(), + ], + ], + ]); + + $res = $this->get('/admin/platform-orders?keyword=PO_INDEX_ROW_WARN_0001'); + $res->assertOk(); + + $res->assertSee('row-warn', false); + $res->assertSee('原因:SIM_SYNC_ERR', false); + $res->assertSee('BMPA:SIM_BMPA_ERR', false); + $res->assertSee('无回执', false); + } +}