This commit is contained in:
Leo
2025-12-08 13:04:09 +08:00
parent 75329ffb84
commit 4417085d75

View File

@@ -232,6 +232,14 @@
title="复制录单格式Excel可粘贴">
录单格式
</el-button>
<el-button
type="text"
size="mini"
icon="el-icon-document-copy"
@click="copyRebateRecordText(scope.row)"
title="复制后返录表格式Excel可粘贴">
后返录表
</el-button>
<el-button
type="text"
size="mini"
@@ -1403,6 +1411,72 @@ export default {
}
},
/** 复制后返录表格式文本到剪贴板 */
copyRebateRecordText(row) {
try {
// 前5列发过运营、需要重发运营、已经重发、需要二次重发运营、二次重发
const emptyCols = ['', '', '', '', '']
// 单号orderId
const orderId = row.orderId || ''
// 型号modelNumber
const modelNumber = row.modelNumber || ''
// 返现金额(团长):空
const leaderRebateAmount = ''
// 晒单金额(主图没标):空
const reviewRebateAmount = ''
// 总共返现rebateAmount整数格式
const totalRebateAmount = row.rebateAmount
? Math.round(row.rebateAmount).toString() : ''
// 确认收货日期finishTime格式yyyy/MM/dd
let finishDateStr = ''
if (row.finishTime) {
const finishDate = new Date(row.finishTime)
const year = finishDate.getFullYear()
const month = String(finishDate.getMonth() + 1).padStart(2, '0')
const day = String(finishDate.getDate()).padStart(2, '0')
finishDateStr = `${year}/${month}/${day}`
}
// 认领人buyer
const buyer = row.buyer || ''
// 下单日期orderTime格式yyyyMMdd
let orderDateStr = ''
if (row.orderTime) {
const orderDate = new Date(row.orderTime)
const year = orderDate.getFullYear()
const month = String(orderDate.getMonth() + 1).padStart(2, '0')
const day = String(orderDate.getDate()).padStart(2, '0')
orderDateStr = `${year}${month}${day}`
}
// 按顺序拼接:发过运营、需要重发运营、已经重发、需要二次重发运营、二次重发、单号、型号、返现金额(团长)、晒单金额(主图没标)、总共返现、确认收货日期、认领人、下单日期
const text = [
...emptyCols,
orderId,
modelNumber,
leaderRebateAmount,
reviewRebateAmount,
totalRebateAmount,
finishDateStr,
buyer,
orderDateStr
].join('\t')
this.copyToClipboard(text)
this.$message.success('已复制后返录表格式到剪贴板可以直接粘贴到Excel')
} catch (e) {
this.$message.error('复制失败:' + (e.message || '未知错误'))
console.error('复制后返录表格式失败', e)
}
},
/** 复制录单格式文本到剪贴板(批量) */
async handleCopyExcelText() {
try {