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) }}