Преглед на файлове

fix: 小程序退款统一走 POST /payment/refund,不再绕过退款申请流程

支付分订单的退款之前直接调用 refundPayscoreOrder(),跳过了
退款申请记录创建和审核流程。现统一走 POST /payment/refund,
所有退款(含支付分)都先创建 Refund 记录再执行。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
skyline преди 2 седмици
родител
ревизия
b8a421f703
променени са 1 файла, в които са добавени 4 реда и са изтрити 14 реда
  1. 4 14
      haha-mp/src/pages/refund/refund.vue

+ 4 - 14
haha-mp/src/pages/refund/refund.vue

@@ -167,7 +167,7 @@ import { getOrderDetail } from '../../api/order';
 import type { OrderInfo } from '../../api/order';
 import { post } from '../../utils/request';
 import { logger } from '../../utils/logger';
-import { refundPayscoreOrder } from '../../api/payscore';
+
 
 const orderId = ref<string>('');
 
@@ -396,20 +396,10 @@ const submitRefund = async () => {
   }
 
   try {
-    // 支付分订单走支付分退款接口
-    if (orderInfo.value.payChannel === 'wechat_payscore') {
-      const refundAmt = selectedProducts.value.length > 0
-        ? refundAmount.value
-        : parseFloat(customRefundAmount.value);
-      await refundPayscoreOrder(Number(orderId.value), {
-        refundAmount: refundAmt,
-        reason: reasonText,
-      });
-    } else {
-      await post('/payment/refund', body);
-    }
+    // 统一走退款申请接口,支付分订单同样创建退款记录由后端处理
+    await post('/payment/refund', body);
 
-    uni.showToast({ title: '退款申请成功', icon: 'success' });
+    uni.showToast({ title: '退款申请已提交', icon: 'success' });
     setTimeout(() => { uni.navigateBack(); }, 1500);
   } catch (error: any) {
     logger.error('退款申请失败:', error);