平台订单详情:BMPA禁用原因合并为治理提示块

This commit is contained in:
萝卜
2026-03-14 00:13:01 +00:00
parent 45ac72eb21
commit 61d50090a6
2 changed files with 99 additions and 11 deletions

View File

@@ -184,17 +184,28 @@
<button type="submit" @disabled(! $canMarkPaid || $markPaidBlockedByRefund || $markPaidBlockedByReceiptMismatch)>标记支付并生效</button> <button type="submit" @disabled(! $canMarkPaid || $markPaidBlockedByRefund || $markPaidBlockedByReceiptMismatch)>标记支付并生效</button>
</form> </form>
@if($markPaidBlockedByRefund) @if($markPaidBlockedByRefund || $markPaidBlockedByReceiptMismatch)
<div class="muted text-danger" style="margin-top:6px; width:100%;"> <div class="card" style="margin-top:10px; width:100%; border:1px solid #f5c2c7; background:#fff5f5;">
提示:当前订单已存在退款记录/退款汇总,建议先核对退款轨迹与状态后再进行「标记支付并生效」。 <div class="muted text-danger"><strong>BMPA 治理提示</strong>(当前不建议/不可直接标记支付并生效)</div>
<span class="muted"></span> <div class="muted muted-xs" style="margin-top:6px;">
<a class="link" href="#refund-receipts">去核对退款</a> @if($markPaidBlockedByRefund)
</div> <div>
@elseif($markPaidBlockedByReceiptMismatch) 原因:当前订单已存在退款记录/退款汇总。
<div class="muted text-danger" style="margin-top:6px; width:100%;"> <span class="muted"></span>
提示:当前订单已存在支付回执,但回执总额与订单金额不一致,建议先补齐/修正回执后再进行「标记支付并生效」。 <a class="link" href="#refund-receipts">去核对退款</a>
<span class="muted"></span> </div>
<a class="link" href="#add-payment-receipt">去补回执</a> @endif
@if($markPaidBlockedByReceiptMismatch)
<div>
原因:当前订单已存在支付回执,但回执总额与订单金额不一致。
<span class="muted"></span>
<a class="link" href="#add-payment-receipt">去补回执</a>
</div>
@endif
<div style="margin-top:6px;">
建议:先补齐/修正回执与退款轨迹(使金额与状态口径一致),再执行 BMPA。
</div>
</div>
</div> </div>
@endif @endif

View File

@@ -0,0 +1,77 @@
<?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 AdminPlatformOrderShowMarkPaidAndActivateGovernanceBlockTest 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_should_render_governance_block_when_bmpa_blocked(): void
{
$this->loginAsPlatformAdmin();
$merchant = Merchant::query()->firstOrFail();
$plan = Plan::query()->create([
'code' => 'po_show_bmpa_gov_block_plan',
'name' => 'BMPA治理提示块测试套餐',
'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_BMPA_GOV_BLOCK_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(),
'meta' => [
'refund_receipts' => [
[
'type' => 'refund',
'channel' => 'offline',
'amount' => 1,
'refunded_at' => now()->toDateTimeString(),
'note' => 'test-refund',
'created_at' => now()->toDateTimeString(),
'admin_id' => 1,
],
],
],
]);
$res = $this->get('/admin/platform-orders/' . $order->id);
$res->assertOk();
$res->assertSee('BMPA 治理提示', false);
$res->assertSee('去核对退款', false);
$res->assertSee('href="#refund-receipts"', false);
}
}