This commit is contained in:
Leo
2025-11-15 00:46:02 +08:00
parent b71e946bd0
commit cc215aec29

View File

@@ -162,6 +162,51 @@
<el-table-column label="完成时间" prop="finishTime" width="160">
<template slot-scope="scope">{{ parseTime(scope.row.finishTime) }}</template>
</el-table-column>
<el-table-column label="是否退款" prop="isRefunded" width="100">
<template slot-scope="scope">
<el-switch
v-model="scope.row.isRefunded"
:active-value="1"
:inactive-value="0"
@change="handleRefundedChange(scope.row)"
active-text=""
inactive-text="">
</el-switch>
</template>
</el-table-column>
<el-table-column label="退款日期" prop="refundDate" width="160">
<template slot-scope="scope">{{ parseTime(scope.row.refundDate) }}</template>
</el-table-column>
<el-table-column label="是否退款到账" prop="isRefundReceived" width="120">
<template slot-scope="scope">
<el-switch
v-model="scope.row.isRefundReceived"
:active-value="1"
:inactive-value="0"
@change="handleRefundReceivedChange(scope.row)"
active-text=""
inactive-text="">
</el-switch>
</template>
</el-table-column>
<el-table-column label="退款到账日期" prop="refundReceivedDate" width="160">
<template slot-scope="scope">{{ parseTime(scope.row.refundReceivedDate) }}</template>
</el-table-column>
<el-table-column label="后返到账" prop="isRebateReceived" width="100">
<template slot-scope="scope">
<el-switch
v-model="scope.row.isRebateReceived"
:active-value="1"
:inactive-value="0"
@change="handleRebateReceivedChange(scope.row)"
active-text=""
inactive-text="">
</el-switch>
</template>
</el-table-column>
<el-table-column label="后返到账日期" prop="rebateReceivedDate" width="160">
<template slot-scope="scope">{{ parseTime(scope.row.rebateReceivedDate) }}</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="220">
<template slot-scope="scope">
<el-button
@@ -645,6 +690,72 @@ export default {
row.isCountEnabled = row.isCountEnabled ? 0 : 1
})
},
/** 处理是否退款开关变化 */
handleRefundedChange(row) {
// 如果设置为"是",自动设置当前日期
if (row.isRefunded === 1 && !row.refundDate) {
row.refundDate = new Date()
}
// 如果设置为"否",清空日期
if (row.isRefunded === 0) {
row.refundDate = null
}
// 调用后端API更新数据库
updateJDOrder(row).then(() => {
this.$message.success(`订单 ${row.remark} 的退款状态已更新`)
}).catch(() => {
this.$message.error('更新失败,请稍后重试')
// 恢复原状态
row.isRefunded = row.isRefunded ? 0 : 1
if (row.isRefunded === 0) {
row.refundDate = null
}
})
},
/** 处理是否退款到账开关变化 */
handleRefundReceivedChange(row) {
// 如果设置为"是",自动设置当前日期
if (row.isRefundReceived === 1 && !row.refundReceivedDate) {
row.refundReceivedDate = new Date()
}
// 如果设置为"否",清空日期
if (row.isRefundReceived === 0) {
row.refundReceivedDate = null
}
// 调用后端API更新数据库
updateJDOrder(row).then(() => {
this.$message.success(`订单 ${row.remark} 的退款到账状态已更新`)
}).catch(() => {
this.$message.error('更新失败,请稍后重试')
// 恢复原状态
row.isRefundReceived = row.isRefundReceived ? 0 : 1
if (row.isRefundReceived === 0) {
row.refundReceivedDate = null
}
})
},
/** 处理后返到账开关变化 */
handleRebateReceivedChange(row) {
// 如果设置为"是",自动设置当前日期
if (row.isRebateReceived === 1 && !row.rebateReceivedDate) {
row.rebateReceivedDate = new Date()
}
// 如果设置为"否",清空日期
if (row.isRebateReceived === 0) {
row.rebateReceivedDate = null
}
// 调用后端API更新数据库
updateJDOrder(row).then(() => {
this.$message.success(`订单 ${row.remark} 的后返到账状态已更新`)
}).catch(() => {
this.$message.error('更新失败,请稍后重试')
// 恢复原状态
row.isRebateReceived = row.isRebateReceived ? 0 : 1
if (row.isRebateReceived === 0) {
row.rebateReceivedDate = null
}
})
},
/** 删除单条记录(需输入随机确认码) */
async handleDelete(row) {
const code = String(Math.floor(100000 + Math.random() * 900000))