This commit is contained in:
2025-10-23 23:28:19 +08:00
parent 399b31e8e0
commit 8c86983ace
2 changed files with 34 additions and 1 deletions

View File

@@ -17,6 +17,15 @@ export function getJDOrder(id) {
})
}
// 更新JD订单
export function updateJDOrder(data) {
return request({
url: '/system/jdorder',
method: 'put',
data: data
})
}
// 一键转链
export function generatePromotionContent(data) {
return request({

View File

@@ -79,6 +79,19 @@
<el-table-column label="下单人" prop="buyer" width="140"/>
<el-table-column label="备注/状态" prop="status" min-width="160"/>
<el-table-column label="参与统计" prop="isCountEnabled" width="100">
<template slot-scope="scope">
<el-switch
v-model="scope.row.isCountEnabled"
:active-value="1"
:inactive-value="0"
@change="handleCountEnabledChange(scope.row)"
active-text=""
inactive-text="">
</el-switch>
</template>
</el-table-column>
<el-table-column label="物流链接" prop="logisticsLink" width="200">
<template slot-scope="scope">
<div v-if="scope.row.logisticsLink">
@@ -121,7 +134,7 @@
</template>
<script>
import { listJDOrders } from '@/api/system/jdorder'
import { listJDOrders, updateJDOrder } from '@/api/system/jdorder'
import ListLayout from '@/components/ListLayout'
export default {
@@ -307,6 +320,17 @@ export default {
}
document.body.removeChild(textArea)
},
/** 处理统计开关变化 */
handleCountEnabledChange(row) {
// 调用后端API更新数据库
updateJDOrder(row).then(() => {
this.$message.success(`订单 ${row.remark} 的统计状态已更新为:${row.isCountEnabled ? '参与统计' : '不参与统计'}`)
}).catch(() => {
this.$message.error('更新失败,请稍后重试')
// 恢复原状态
row.isCountEnabled = row.isCountEnabled ? 0 : 1
})
}
}