Эх сурвалжийг харах

fix: 部分退款后保留退款入口,仅全额退款才标记REFUNDED

- PaymentServiceImpl 只在累计退款>=实付金额时设 refundStatus=REFUNDED
- 部分退款不再错误标记为已退款,前端按退款金额判断按钮显隐

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
skyline 2 долоо хоног өмнө
parent
commit
4a1817da5a

+ 1 - 1
haha-admin-web/src/views/order/index.vue

@@ -227,7 +227,7 @@ async function doPayScoreCancel() {
               详情
             </el-button>
             <el-button
-              v-if="row.status === 1 && row.refundStatus !== 'REFUNDED'"
+              v-if="row.status === 1 && (row.refundAmount || 0) < (row.paidAmount || row.totalAmount || 0)"
               class="reset-margin"
               link
               type="danger"

+ 2 - 1
haha-service/src/main/java/com/haha/service/payment/impl/PaymentServiceImpl.java

@@ -624,7 +624,6 @@ public class PaymentServiceImpl implements PaymentService {
         BigDecimal existingRefund = order.getRefundAmount() != null ? order.getRefundAmount() : BigDecimal.ZERO;
         BigDecimal cumulativeAmount = existingRefund.add(amount);
 
-        order.setRefundStatus(RefundStatus.REFUNDED.getCode());
         order.setRefundAmount(cumulativeAmount);
         order.setRefundTime(LocalDateTime.now());
         order.setRefundReason(reason);
@@ -632,10 +631,12 @@ public class PaymentServiceImpl implements PaymentService {
         // 仅当累计退款 >= 实付金额时,才标记为全额退款
         BigDecimal paidAmount = order.getPaidAmount() != null ? order.getPaidAmount() : order.getTotalAmount();
         if (cumulativeAmount.compareTo(paidAmount) >= 0) {
+            order.setRefundStatus(RefundStatus.REFUNDED.getCode());
             order.setPayStatus(OrderConstants.PAY_STATUS_REFUND);
             log.info("订单全额退款完成 - orderId={}, cumulativeAmount={}, paidAmount={}",
                     order.getId(), cumulativeAmount, paidAmount);
         } else {
+            // 部分退款:不设 REFUNDED 状态,保留退款入口
             order.setPayStatus(OrderConstants.PAY_STATUS_PARTIAL_REFUND);
             log.info("订单部分退款 - orderId={}, cumulativeAmount={}, paidAmount={}",
                     order.getId(), cumulativeAmount, paidAmount);