/transfers删除多余代码
This commit is contained in:
@@ -59,23 +59,6 @@
|
||||
<span class="return-time" :class="getReturnTimeStatus(allocation)">
|
||||
{{ formatTime(allocation.can_return_after) }}
|
||||
</span>
|
||||
<span v-if="!allocation.return_date" class="return-status" :class="getReturnTimeStatus(allocation)">
|
||||
({{ getReturnTimeText(allocation) }})
|
||||
</span>
|
||||
<el-tag v-if="allocation.return_date" type="success" size="small">
|
||||
已回款
|
||||
</el-tag>
|
||||
</div>
|
||||
|
||||
<!-- 回款确认按钮 -->
|
||||
<div v-if="!allocation.return_date && canConfirmReturn(allocation)" class="return-action">
|
||||
<el-button
|
||||
type="success"
|
||||
size="small"
|
||||
@click="showReturnConfirmDialog(allocation)"
|
||||
>
|
||||
确认收到回款
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -314,45 +297,6 @@
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 回款确认对话框 -->
|
||||
<el-dialog
|
||||
v-model="showReturnDialog"
|
||||
title="确认回款"
|
||||
width="90%"
|
||||
:style="{ maxWidth: '500px' }"
|
||||
>
|
||||
<el-form :model="returnForm" label-width="100px">
|
||||
<el-form-item label="回款金额">
|
||||
<el-input-number
|
||||
v-model="returnForm.returnAmount"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注说明">
|
||||
<el-input
|
||||
v-model="returnForm.description"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="showReturnDialog = false">取消</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
@click="confirmReturn"
|
||||
:loading="confirmLoading"
|
||||
>
|
||||
确认回款
|
||||
</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -601,66 +545,6 @@ const getReturnTimeStatus = (allocation) => {
|
||||
}
|
||||
}
|
||||
|
||||
const getReturnTimeText = (allocation) => {
|
||||
if (!allocation.can_return_after) return ''
|
||||
|
||||
const now = new Date()
|
||||
const canReturnTime = new Date(allocation.can_return_after)
|
||||
|
||||
if (now >= canReturnTime) {
|
||||
return '可以回款'
|
||||
} else {
|
||||
const timeDiff = canReturnTime - now
|
||||
const hours = Math.floor(timeDiff / (60 * 60 * 1000))
|
||||
const minutes = Math.floor((timeDiff % (60 * 60 * 1000)) / (60 * 1000))
|
||||
|
||||
if (hours > 0) {
|
||||
return `${hours}小时${minutes}分钟后可回款`
|
||||
} else {
|
||||
return `${minutes}分钟后可回款`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const canConfirmReturn = (allocation) => {
|
||||
if (!allocation.can_return_after) return false
|
||||
|
||||
const now = new Date()
|
||||
const canReturnTime = new Date(allocation.can_return_after)
|
||||
|
||||
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 () => {
|
||||
try {
|
||||
confirmLoading.value = true
|
||||
|
||||
const response = await api.post(`/matching/confirm-return/${currentAllocation.value.id}`, {
|
||||
returnAmount: returnForm.returnAmount,
|
||||
description: returnForm.description
|
||||
})
|
||||
|
||||
if (response.data.success) {
|
||||
ElMessage.success('回款确认成功')
|
||||
showReturnDialog.value = false
|
||||
await loadPendingAllocations()
|
||||
await loadTransferHistory()
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('确认回款失败:', error)
|
||||
ElMessage.error(error.response?.data?.message || '确认回款失败')
|
||||
} finally {
|
||||
confirmLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const showVoucherConfirmDialog = (transfer) => {
|
||||
currentTransfer.value = transfer
|
||||
showVoucherDialog.value = true
|
||||
|
||||
Reference in New Issue
Block a user