feat(gov): 订单详情提示退款状态与退款总额不一致
This commit is contained in:
@@ -77,6 +77,15 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
@php
|
||||||
|
$paidAmountFloat = (float) ($order->paid_amount ?? 0);
|
||||||
|
@endphp
|
||||||
|
@if($order->payment_status === 'refunded' && ($refundTotal + 0.01) < $paidAmountFloat)
|
||||||
|
<div class="muted text-danger" style="margin-top:10px;">提示:当前订单状态为「已退款」,但退款总额小于已付金额,可能存在数据不一致,请核对退款轨迹与订单金额。</div>
|
||||||
|
@elseif($order->payment_status !== 'refunded' && $paidAmountFloat > 0 && $refundTotal >= $paidAmountFloat)
|
||||||
|
<div class="muted text-danger" style="margin-top:10px;">提示:退款总额已达到/超过已付金额,建议核对是否应将支付状态调整为「已退款」。</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
@php
|
@php
|
||||||
$canActivate = ($order->payment_status === 'paid') && ($order->status === 'activated');
|
$canActivate = ($order->payment_status === 'paid') && ($order->status === 'activated');
|
||||||
$alreadySynced = (int) data_get($order->meta, 'subscription_activation.subscription_id', 0) > 0;
|
$alreadySynced = (int) data_get($order->meta, 'subscription_activation.subscription_id', 0) > 0;
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
<?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 AdminPlatformOrderRefundStatusConsistencyHintTest 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_show_page_will_hint_when_refunded_status_but_refund_total_less_than_paid_amount(): void
|
||||||
|
{
|
||||||
|
$this->loginAsPlatformAdmin();
|
||||||
|
|
||||||
|
$merchant = Merchant::query()->firstOrFail();
|
||||||
|
$plan = Plan::query()->create([
|
||||||
|
'code' => 'refund_consistency_hint_01',
|
||||||
|
'name' => '退款一致性提示测试',
|
||||||
|
'billing_cycle' => 'monthly',
|
||||||
|
'price' => 30,
|
||||||
|
'list_price' => 30,
|
||||||
|
'status' => 'active',
|
||||||
|
'sort' => 10,
|
||||||
|
'published_at' => now(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$order = PlatformOrder::query()->create([
|
||||||
|
'merchant_id' => $merchant->id,
|
||||||
|
'plan_id' => $plan->id,
|
||||||
|
'order_no' => 'PO_REFUND_HINT_0001',
|
||||||
|
'order_type' => 'new_purchase',
|
||||||
|
'status' => 'activated',
|
||||||
|
'payment_status' => 'refunded',
|
||||||
|
'plan_name' => $plan->name,
|
||||||
|
'billing_cycle' => $plan->billing_cycle,
|
||||||
|
'period_months' => 1,
|
||||||
|
'quantity' => 1,
|
||||||
|
'payable_amount' => 30,
|
||||||
|
'paid_amount' => 30,
|
||||||
|
'placed_at' => now(),
|
||||||
|
'paid_at' => now(),
|
||||||
|
'activated_at' => now(),
|
||||||
|
'refunded_at' => now(),
|
||||||
|
'meta' => [
|
||||||
|
'refund_summary' => [
|
||||||
|
'count' => 1,
|
||||||
|
'total_amount' => 10,
|
||||||
|
'last_at' => now()->toDateTimeString(),
|
||||||
|
'last_amount' => 10,
|
||||||
|
'last_channel' => 'wechat',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->get('/admin/platform-orders/' . $order->id)
|
||||||
|
->assertOk()
|
||||||
|
->assertSee('提示:当前订单状态为「已退款」,但退款总额小于已付金额');
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user