This commit is contained in:
2025-10-27 22:54:20 +08:00
parent 2c46da50e3
commit 8b6dd7d8a8

View File

@@ -55,10 +55,10 @@
<template slot-scope="scope"> <template slot-scope="scope">
<div> <div>
<span style="margin-right: 8px;">{{ scope.row.orderId }}</span> <span style="margin-right: 8px;">{{ scope.row.orderId }}</span>
<el-button <el-button
type="text" type="text"
size="mini" size="mini"
icon="el-icon-copy-document" icon="el-icon-copy-document"
@click="copyToClipboard(scope.row.orderId)" @click="copyToClipboard(scope.row.orderId)"
title="复制订单号" title="复制订单号"
> >
@@ -78,7 +78,7 @@
</el-table-column> </el-table-column>
<el-table-column label="下单人" prop="buyer" width="140"/> <el-table-column label="下单人" prop="buyer" width="140"/>
<el-table-column label="备注/状态" prop="status" min-width="160"/> <el-table-column label="备注/状态" prop="status" min-width="160"/>
<el-table-column label="参与统计" prop="isCountEnabled" width="100"> <el-table-column label="参与统计" prop="isCountEnabled" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch
@@ -86,6 +86,8 @@
:active-value="1" :active-value="1"
:inactive-value="0" :inactive-value="0"
@change="handleCountEnabledChange(scope.row)" @change="handleCountEnabledChange(scope.row)"
active-text=""
inactive-text="">
</el-switch> </el-switch>
</template> </template>
</el-table-column> </el-table-column>
@@ -94,10 +96,10 @@
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="scope.row.logisticsLink"> <div v-if="scope.row.logisticsLink">
<a :href="scope.row.logisticsLink" target="_blank" style="margin-right: 8px;">查看物流</a> <a :href="scope.row.logisticsLink" target="_blank" style="margin-right: 8px;">查看物流</a>
<el-button <el-button
type="text" type="text"
size="mini" size="mini"
icon="el-icon-copy-document" icon="el-icon-copy-document"
@click="copyToClipboard(scope.row.logisticsLink)" @click="copyToClipboard(scope.row.logisticsLink)"
title="复制链接" title="复制链接"
> >
@@ -194,38 +196,38 @@ export default {
/** 智能查询列表,如果今天数据为空则查询昨天 */ /** 智能查询列表,如果今天数据为空则查询昨天 */
async getListWithFallback() { async getListWithFallback() {
this.loading = true this.loading = true
try { try {
const res = await listJDOrders(this.queryParams) const res = await listJDOrders(this.queryParams)
this.list = (res.rows || res.data || []) this.list = (res.rows || res.data || [])
this.total = res.total || 0 this.total = res.total || 0
// 如果今天的数据为空,且是默认查询(没有手动选择日期),则尝试查询昨天 // 如果今天的数据为空,且是默认查询(没有手动选择日期),则尝试查询昨天
if (this.list.length === 0 && this.isDefaultQuery()) { if (this.list.length === 0 && this.isDefaultQuery()) {
this.$message.info('今天暂无慢单数据,正在查询昨天的数据...') this.$message.info('今天暂无慢单数据,正在查询昨天的数据...')
// 获取昨天的日期 // 获取昨天的日期
const yesterday = new Date() const yesterday = new Date()
yesterday.setDate(yesterday.getDate() - 1) yesterday.setDate(yesterday.getDate() - 1)
const yesterdayStr = this.formatDate(yesterday) const yesterdayStr = this.formatDate(yesterday)
// 更新查询参数为昨天 // 更新查询参数为昨天
this.queryParams.beginTime = yesterdayStr this.queryParams.beginTime = yesterdayStr
this.queryParams.endTime = yesterdayStr this.queryParams.endTime = yesterdayStr
this.dateRange = [yesterdayStr, yesterdayStr] this.dateRange = [yesterdayStr, yesterdayStr]
// 查询昨天的数据 // 查询昨天的数据
const yesterdayRes = await listJDOrders(this.queryParams) const yesterdayRes = await listJDOrders(this.queryParams)
this.list = (yesterdayRes.rows || yesterdayRes.data || []) this.list = (yesterdayRes.rows || yesterdayRes.data || [])
this.total = yesterdayRes.total || 0 this.total = yesterdayRes.total || 0
if (this.list.length > 0) { if (this.list.length > 0) {
this.$message.success(`已查询到昨天(${yesterdayStr})的慢单数据`) this.$message.success(`已查询到昨天(${yesterdayStr})的慢单数据`)
} else { } else {
this.$message.warning('昨天也没有慢单数据') this.$message.warning('昨天也没有慢单数据')
} }
} }
this.loading = false this.loading = false
} catch (error) { } catch (error) {
this.loading = false this.loading = false
@@ -243,8 +245,8 @@ export default {
this.getList() this.getList()
}, },
resetQuery() { resetQuery() {
this.queryParams = { this.queryParams = {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
remark: undefined, remark: undefined,
distributionMark: undefined, distributionMark: undefined,
@@ -305,7 +307,7 @@ export default {
document.body.appendChild(textArea) document.body.appendChild(textArea)
textArea.focus() textArea.focus()
textArea.select() textArea.select()
try { try {
const successful = document.execCommand('copy') const successful = document.execCommand('copy')
if (successful) { if (successful) {
@@ -316,7 +318,7 @@ export default {
} catch (err) { } catch (err) {
this.$message.error('复制失败,请手动复制') this.$message.error('复制失败,请手动复制')
} }
document.body.removeChild(textArea) document.body.removeChild(textArea)
}, },
/** 处理统计开关变化 */ /** 处理统计开关变化 */
@@ -330,7 +332,7 @@ export default {
row.isCountEnabled = row.isCountEnabled ? 0 : 1 row.isCountEnabled = row.isCountEnabled ? 0 : 1
}) })
} }
} }
} }
</script> </script>