From ac3f5cac7b413b8ba8ec78cfae0455a9d46203ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E8=84=8F=E7=8B=BC?= <786316265@qq.com> Date: Mon, 11 Aug 2025 16:47:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E7=A1=AE=E8=AE=A4=E5=9B=9E?= =?UTF-8?q?=E6=AC=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Transfers.vue | 103 ++++++++++------------------------------ 1 file changed, 24 insertions(+), 79 deletions(-) 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 }