This commit is contained in:
van
2026-05-16 16:30:21 +08:00
parent f55b5f46a4
commit f443ff9047

View File

@@ -857,7 +857,7 @@
</el-table-column>
<!-- 操作列统一放在最右侧 -->
<el-table-column label="操作" fixed="right" :width="isMobile ? 60 : 288" align="center" class-name="action-column">
<el-table-column label="操作" fixed="right" :width="isMobile ? 60 : 330" align="center" class-name="action-column">
<template slot-scope="scope">
<!-- 移动端悬浮操作按钮 -->
<div v-if="isMobile" class="mobile-action-wrapper">
@@ -896,6 +896,11 @@
icon="el-icon-copy-document">
复制物流链接
</el-dropdown-item>
<el-dropdown-item
:command="{action: 'copyBasketShip', row: scope.row}"
icon="el-icon-document-copy">
篮子发货摘要
</el-dropdown-item>
<el-dropdown-item
:command="{action: 'copyReturn', row: scope.row}"
icon="el-icon-document-copy">
@@ -949,6 +954,7 @@
<el-button v-if="scope.row.thirdPartyOrderNo" type="text" size="mini" class="jd-act-link" icon="el-icon-copy-document" @click="copyToClipboard(scope.row.thirdPartyOrderNo)" title="复制第三方单号">三方</el-button>
<el-button type="text" size="mini" class="jd-act-link" icon="el-icon-copy-document" @click="copyToClipboard(scope.row.address)" title="复制地址">地址</el-button>
<el-button v-if="scope.row.logisticsLink" type="text" size="mini" class="jd-act-link" icon="el-icon-copy-document" @click="copyToClipboard(scope.row.logisticsLink)" title="复制物流链接">物流</el-button>
<el-button type="text" size="mini" class="jd-act-link" icon="el-icon-document-copy" @click="copyBasketShipSummary(scope.row)" title="复制篮子发货摘要(型号、地址、物流)">篮子</el-button>
<el-button type="text" size="mini" class="jd-act-link" @click="copyReturnInfo(scope.row)" title="复制退货信息">退货</el-button>
</div>
<div class="jd-action-row jd-action-row--doc">
@@ -1615,6 +1621,9 @@ export default {
case 'copyLogistics':
this.copyToClipboard(row.logisticsLink)
break
case 'copyBasketShip':
this.copyBasketShipSummary(row)
break
case 'copyReturn':
this.copyReturnInfo(row)
break
@@ -2113,27 +2122,50 @@ export default {
this.loading = false
})
},
/** 复制篮子群「发货摘要」:型号 + 整段地址(去空白) + 物流短链 */
buildBasketShipSummaryText(row) {
if (!row) return ''
const model = (row.modelNumber != null ? String(row.modelNumber).trim() : '') || '—'
const addrRaw = row.address != null ? String(row.address).trim() : ''
const addr = (addrRaw.replace(/\s+/g, '')) || '—'
const url = this.normalizeBasketLogisticsUrl(row.logisticsLink)
const sep = '————————————'
return `「发货摘要」\n${sep}\n型号 ${model}\n地址${addr}\n物流${url}\n`
},
normalizeBasketLogisticsUrl(link) {
if (link == null || !String(link).trim()) return '—'
let u = String(link).trim()
if (!/^https?:\/\//i.test(u)) {
u = 'https://' + u.replace(/^\/+/, '')
}
return u
},
copyBasketShipSummary(row) {
this.copyToClipboard(this.buildBasketShipSummaryText(row), '已复制篮子发货摘要')
},
/** 导出按钮操作 */
handleExport() {
this.prepareQueryParams()
this.download('/system/jdorder/export', this.queryParams, `京东订单数据_${new Date().getTime()}.xlsx`)
},
/** 复制到剪贴板 */
copyToClipboard(text) {
/** 复制到剪贴板successMsg 不传时用默认提示 */
copyToClipboard(text, successMsg) {
const tip = successMsg || '已复制到剪贴板'
if (navigator.clipboard && window.isSecureContext) {
// 使用现代 Clipboard API
navigator.clipboard.writeText(text).then(() => {
this.$message.success('已复制到剪贴板')
this.$message.success(tip)
}).catch(() => {
this.fallbackCopyTextToClipboard(text)
this.fallbackCopyTextToClipboard(text, tip)
})
} else {
// 降级方案
this.fallbackCopyTextToClipboard(text)
this.fallbackCopyTextToClipboard(text, tip)
}
},
/** 降级复制方案 */
fallbackCopyTextToClipboard(text) {
fallbackCopyTextToClipboard(text, successMsg) {
const tip = successMsg || '已复制到剪贴板'
const textArea = document.createElement('textarea')
textArea.value = text
textArea.style.position = 'fixed'
@@ -2146,7 +2178,7 @@ export default {
try {
const successful = document.execCommand('copy')
if (successful) {
this.$message.success('已复制到剪贴板')
this.$message.success(tip)
} else {
this.$message.error('复制失败,请手动复制')
}