diff --git a/src/views/Transfers.vue b/src/views/Transfers.vue index 5e7f1dd..6463e84 100644 --- a/src/views/Transfers.vue +++ b/src/views/Transfers.vue @@ -69,17 +69,6 @@ 已回款 - - -
- - 确认收到回款 - -
@@ -303,49 +292,6 @@ - - - - - - - - - - - - - - - - - @@ -367,7 +313,6 @@ const submitLoading = ref(false) const confirmLoading = ref(false) const showCreateTransfer = ref(false) const showVoucherDialog = ref(false) -const showReturnDialog = ref(false) const statusFilter = ref('') const currentTransfer = ref({}) const currentAllocation = ref({}) @@ -385,11 +330,6 @@ const confirmRules = { ] } -const returnForm = reactive({ - returnAmount: '', - description: '' -}) - const pendingTransfers = ref([]) const pendingAllocations = ref([]) const allTransferHistory = ref([]) @@ -620,31 +560,36 @@ const canConfirmReturn = (allocation) => { return now >= canReturnTime } -const showReturnConfirmDialog = (allocation) => { - currentAllocation.value = allocation - returnForm.returnAmount = allocation.amount - returnForm.description = `匹配订单 ${allocation.matching_order_id} 回款确认` - showReturnDialog.value = true -} - -const confirmReturn = async () => { +const confirmReturn = async (allocation) => { try { + await ElMessageBox.confirm( + `确定已收到¥${allocation.amount}回款吗?`, + '确认回款', + { + confirmButtonText: '确认', + cancelButtonText: '取消', + type: 'warning' + } + ) + confirmLoading.value = true - await api.post(`/matching/confirm-return/${currentAllocation.value.id}`, { - returnAmount: returnForm.returnAmount, - description: returnForm.description + const response = await api.post(`/matching/confirm-return/${allocation.id}`, { + returnAmount: allocation.amount, + description: `匹配订单 ${allocation.matching_order_id} 回款确认` }) - ElMessage.success('回款确认成功') - showReturnDialog.value = false - - await loadPendingAllocations() - await loadTransferHistory() - + if (response.data.success) { + ElMessage.success('回款确认成功') + await loadPendingAllocations() + await loadTransferHistory() + } } catch (error) { - console.error('确认回款失败:', error) - ElMessage.error(error.response?.data?.message || '确认回款失败') + if (error !== 'cancel') { + console.error('确认回款失败:', error) + const errorMsg = error.response?.data?.message || '确认回款失败' + ElMessage.error(errorMsg) + } } finally { confirmLoading.value = false }