From 3053c56cacc50df51030e526a2dfd16964677f50 Mon Sep 17 00:00:00 2001 From: erio Date: Wed, 15 Apr 2026 01:20:46 +0800 Subject: [PATCH] fix(payment): show full amount breakdown on payment result page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Show base amount (充值金额) as first line - Show fee amount with percentage when fee_rate > 0 - Show pay_amount (实付金额) in bold primary color - Show credited amount (到账金额) when different from pay_amount - Compute baseAmount and feeAmount from backend order data --- frontend/src/views/user/PaymentResultView.vue | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/user/PaymentResultView.vue b/frontend/src/views/user/PaymentResultView.vue index 8e622ca3..6431ddf6 100644 --- a/frontend/src/views/user/PaymentResultView.vue +++ b/frontend/src/views/user/PaymentResultView.vue @@ -37,12 +37,16 @@ {{ order.out_trade_no }}
- {{ t('payment.orders.payAmount') }} - ¥{{ order.pay_amount.toFixed(2) }} + {{ t('payment.orders.baseAmount') }} + ¥{{ baseAmount.toFixed(2) }}
{{ t('payment.orders.fee') }} ({{ order.fee_rate }}%) - {{ t('payment.orders.includedInPayAmount') }} + ¥{{ feeAmount.toFixed(2) }} +
+
+ {{ t('payment.orders.payAmount') }} + ¥{{ order.pay_amount.toFixed(2) }}
{{ t('payment.orders.creditedAmount') }} @@ -112,6 +116,18 @@ const returnInfo = ref(null) const SUCCESS_STATUSES = new Set(['COMPLETED', 'PAID', 'RECHARGING']) +/** 充值金额 = pay_amount / (1 + fee_rate/100),fee_rate=0 时等于 pay_amount */ +const baseAmount = computed(() => { + if (!order.value || order.value.fee_rate <= 0) return order.value?.pay_amount ?? 0 + return Math.round((order.value.pay_amount / (1 + order.value.fee_rate / 100)) * 100) / 100 +}) + +/** 手续费 = pay_amount - baseAmount */ +const feeAmount = computed(() => { + if (!order.value || order.value.fee_rate <= 0) return 0 + return Math.round((order.value.pay_amount - baseAmount.value) * 100) / 100 +}) + const isSuccess = computed(() => { // Always prioritize actual order status from backend if (order.value) {