Quellcode durchsuchen

fix: 退款清单页修复处理按钮判断逻辑,退款详情页增加处理按钮

- 退款清单页 isRefundableStatus 改为直接判断 status === 'NEW',
  不依赖字典中的"待退款"键值
- 退款详情页新增"退款处理"按钮,状态为 NEW 时显示,
  调用 /finance/customWxRefund/{id} 发起微信退款

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
skyline vor 1 Woche
Ursprung
Commit
21f827bfb4

+ 48 - 1
admin-h5/src/pages/finance/refund-detail.vue

@@ -5,6 +5,7 @@
       <text class="status-text" :style="{ color: statusColor }">{{ fmtDictName('RefundLog.status', detail.status) }}</text>
       <text class="status-amount">¥{{ formatAmount(detail.refund) }}</text>
       <text class="status-label">退款金额</text>
+      <button v-if="detail.status === 'NEW'" class="process-btn" :loading="processing" @click="handleProcessRefund">退款处理</button>
     </view>
 
     <!-- 退款信息 -->
@@ -103,12 +104,13 @@
 <script setup>
 import { ref, onMounted, computed } from 'vue'
 import { onLoad } from '@dcloudio/uni-app'
-import { getRefundDetail } from '../../api/finance.js'
+import { getRefundDetail, processRefund } from '../../api/finance.js'
 import { formatTime, showToast, formatAmount, fmtDictName, getDictColor } from '../../utils/index.js'
 import { loadDicts } from '../../utils/dict.js'
 
 const detail = ref({})
 const loading = ref(true)
+const processing = ref(false)
 
 const statusColor = computed(() => {
   return getDictColor('RefundLog.status', detail.value.status) || '#666666'
@@ -124,6 +126,36 @@ const showFullText = (label, value) => {
   })
 }
 
+const handleProcessRefund = () => {
+  const refundLogId = detail.value.id
+  if (!refundLogId) {
+    showToast('退款记录ID不存在')
+    return
+  }
+  uni.showModal({
+    title: '确认退款',
+    content: `确定对该笔退款进行处理吗?`,
+    success: async (res) => {
+      if (res.confirm) {
+        processing.value = true
+        try {
+          const result = await processRefund(refundLogId)
+          if (result && result.code === 200) {
+            showToast('退款处理成功', 'success')
+            loadDetail(detail.value.outRefundNo)
+          } else {
+            showToast(result?.msg || '退款处理失败')
+          }
+        } catch (error) {
+          showToast('退款处理失败')
+        } finally {
+          processing.value = false
+        }
+      }
+    }
+  })
+}
+
 const loadDetail = async (outRefundNo) => {
   loading.value = true
   try {
@@ -183,6 +215,21 @@ onMounted(async () => {
 .status-label {
   font-size: 24rpx;
   color: #999999;
+  margin-bottom: 24rpx;
+}
+
+.process-btn {
+  padding: 16rpx 60rpx;
+  background: #C6171E;
+  color: #FFFFFF;
+  border-radius: 44rpx;
+  font-size: 28rpx;
+  border: none;
+  font-weight: 500;
+}
+.process-btn:active {
+  background: #A81212;
+  transform: scale(0.97);
 }
 
 .section {

+ 1 - 1
admin-h5/src/pages/finance/refund.vue

@@ -147,7 +147,7 @@ const getStatusStyle = (status) => {
 }
 
 const isRefundableStatus = (status) => {
-  return status == dictUtil.getDictValue('RefundLog.status', '待退款')
+  return status === 'NEW'
 }
 
 // 当前页所有可退款的ID列表