From e25e7b3f2d010f9e13751fe7934cd52d12dc3807 Mon Sep 17 00:00:00 2001 From: erio Date: Thu, 9 Apr 2026 22:07:06 +0800 Subject: [PATCH] fix(admin): fix refund dialog amount for REFUND_REQUESTED, improve button styles - Don't treat refund_amount as "already refunded" in REFUND_REQUESTED status (it's the requested amount, not actually refunded) - Pre-fill refund amount with user's requested amount - Show "already refunded" only for PARTIALLY_REFUNDED/REFUNDED orders - Change action buttons from stacked icon+text to compact inline style --- .../admin/payment/AdminRefundDialog.vue | 22 ++++++++++--- .../views/admin/orders/AdminOrdersView.vue | 33 ++++++++----------- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/frontend/src/components/admin/payment/AdminRefundDialog.vue b/frontend/src/components/admin/payment/AdminRefundDialog.vue index 05e72befcf..88dfd2ce45 100644 --- a/frontend/src/components/admin/payment/AdminRefundDialog.vue +++ b/frontend/src/components/admin/payment/AdminRefundDialog.vue @@ -37,9 +37,9 @@ {{ t('payment.orders.amount') }} ${{ order?.pay_amount?.toFixed(2) }} -
+
{{ t('payment.admin.alreadyRefunded') }} - ${{ order.refund_amount.toFixed(2) }} + ${{ actuallyRefunded.toFixed(2) }}
@@ -188,9 +188,18 @@ const form = reactive({ force: false, }) +// In REFUND_REQUESTED status, refund_amount is the REQUESTED amount, not actually refunded. +// Only PARTIALLY_REFUNDED / REFUNDED have real refund amounts. +const actuallyRefunded = computed(() => { + if (!props.order) return 0 + const s = props.order.status + if (s === 'PARTIALLY_REFUNDED' || s === 'REFUNDED') return props.order.refund_amount || 0 + return 0 +}) + const maxRefundable = computed(() => { if (!props.order) return 0 - return props.order.pay_amount - (props.order.refund_amount || 0) + return props.order.pay_amount - actuallyRefunded.value }) const balanceInsufficient = computed(() => { @@ -200,7 +209,12 @@ const balanceInsufficient = computed(() => { watch(() => props.show, (val) => { if (val && props.order) { - form.amount = maxRefundable.value + // For REFUND_REQUESTED, pre-fill with the requested amount + if (props.order.status === 'REFUND_REQUESTED' && props.order.refund_amount) { + form.amount = props.order.refund_amount + } else { + form.amount = maxRefundable.value + } form.reason = props.order.refund_request_reason || '' form.deduct_balance = true form.force = false diff --git a/frontend/src/views/admin/orders/AdminOrdersView.vue b/frontend/src/views/admin/orders/AdminOrdersView.vue index dc9472ab5a..6ea7169e44 100644 --- a/frontend/src/views/admin/orders/AdminOrdersView.vue +++ b/frontend/src/views/admin/orders/AdminOrdersView.vue @@ -41,38 +41,33 @@ {{ formatDateTime(value) }}