This commit is contained in:
2025-10-31 00:30:43 +08:00
parent 136a64d8cb
commit 2c2c451c96
2 changed files with 49 additions and 1 deletions

View File

@@ -137,4 +137,14 @@ export function exportJDOrders(query) {
method: 'post',
params: query
})
}
// 删除JD订单支持批量ids为逗号分隔或数组
export function delJDOrder(ids) {
// 兼容数组或字符串
const idPath = Array.isArray(ids) ? ids.join(',') : ids
return request({
url: `/system/jdorder/${idPath}`,
method: 'delete'
})
}

View File

@@ -116,6 +116,13 @@
<el-table-column label="完成时间" prop="finishTime" width="160">
<template slot-scope="scope">{{ parseTime(scope.row.finishTime) }}</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="120">
<template slot-scope="scope">
<el-button type="text" size="mini" style="color: #f56c6c;" @click="handleDelete(scope.row)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
</template>
@@ -134,7 +141,7 @@
</template>
<script>
import { listJDOrders, updateJDOrder } from '@/api/system/jdorder'
import { listJDOrders, updateJDOrder, delJDOrder } from '@/api/system/jdorder'
import ListLayout from '@/components/ListLayout'
export default {
@@ -331,6 +338,37 @@ export default {
// 恢复原状态
row.isCountEnabled = row.isCountEnabled ? 0 : 1
})
},
/** 删除单条记录(需输入随机确认码) */
async handleDelete(row) {
const code = String(Math.floor(100000 + Math.random() * 900000))
try {
await this.$prompt(`请输入确认码以删除该订单:${code}`, '删除确认', {
confirmButtonText: '删除',
cancelButtonText: '取消',
inputPlaceholder: '请输入上方确认码',
inputValidator: (value) => {
if (value === code) return true
return '确认码不匹配,请重新输入'
},
inputErrorMessage: '确认码不匹配',
type: 'warning',
dangerouslyUseHTMLString: false
})
} catch (e) {
return
}
this.loading = true
try {
await delJDOrder(row.id)
this.$message.success('删除成功')
this.getList()
} catch (e) {
this.$message.error('删除失败,请稍后重试')
} finally {
this.loading = false
}
}
}