1
This commit is contained in:
@@ -117,6 +117,7 @@
|
||||
<el-button type="warning" size="small" icon="el-icon-sort" @click="handleReverseSyncThirdPartyOrderNo" :loading="reverseSyncLoading" title="从腾讯文档第850行开始,通过物流链接反向匹配订单,将腾讯文档的单号列值写入到订单的第三方单号字段">反向同步第三方单号</el-button>
|
||||
<el-button v-if="!isMobile" type="primary" size="small" icon="el-icon-document-copy" @click="handleBatchCopyExcelText" :disabled="selectedRows.length === 0" title="批量复制选中订单的录单格式(Excel可粘贴)">批量复制录单格式</el-button>
|
||||
<el-button v-if="!isMobile" type="success" size="small" icon="el-icon-document-copy" @click="handleBatchCopyRebateText" :disabled="selectedRows.length === 0" title="批量复制选中订单的后返录表格式(Excel可粘贴)">批量复制后返录表</el-button>
|
||||
<el-button v-if="!isMobile" type="info" size="small" icon="el-icon-document-copy" @click="handleBatchCopySichuanCommerceText" :disabled="selectedRows.length === 0" title="批量复制选中订单的四川商贸录表格式(日期 型号 数量 地址 价格 备注 是否安排 物流)">四川商贸录表</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -2309,6 +2310,49 @@ export default {
|
||||
this.$message.error('批量复制失败:' + (e.message || '未知错误'))
|
||||
console.error('批量复制后返录表格式失败', e)
|
||||
}
|
||||
},
|
||||
|
||||
/** 批量复制四川商贸录表(格式:日期 型号 数量 地址 价格 备注 是否安排 物流) */
|
||||
handleBatchCopySichuanCommerceText() {
|
||||
if (!this.selectedRows || this.selectedRows.length === 0) {
|
||||
this.$message.warning('请先选择要复制的订单')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const header = ['日期', '型号', '数量', '地址', '价格', '备注', '是否安排', '物流'].join('\t')
|
||||
const lines = [header]
|
||||
|
||||
this.selectedRows.forEach(row => {
|
||||
// 日期(格式:yyyy/MM/dd)
|
||||
let dateStr = ''
|
||||
if (row.orderTime) {
|
||||
const date = new Date(row.orderTime)
|
||||
const year = date.getFullYear()
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(date.getDate()).padStart(2, '0')
|
||||
dateStr = `${year}/${month}/${day}`
|
||||
}
|
||||
|
||||
const modelNumber = row.modelNumber || ''
|
||||
const quantity = (row.productCount != null && row.productCount !== '') ? String(row.productCount) : '1'
|
||||
const address = row.address || ''
|
||||
const priceStr = row.paymentAmount != null ? row.paymentAmount.toFixed(2) : ''
|
||||
const remark = row.remark || ''
|
||||
const arranged = '' // 是否安排,留空由用户填写
|
||||
const logistics = row.logisticsLink || ''
|
||||
|
||||
const text = [dateStr, modelNumber, quantity, address, priceStr, remark, arranged, logistics].join('\t')
|
||||
lines.push(text)
|
||||
})
|
||||
|
||||
const finalText = lines.join('\n')
|
||||
this.copyToClipboard(finalText)
|
||||
this.$message.success(`已复制 ${this.selectedRows.length} 条订单的四川商贸录表格式到剪贴板(含表头),可直接粘贴到Excel`)
|
||||
} catch (e) {
|
||||
this.$message.error('批量复制失败:' + (e.message || '未知错误'))
|
||||
console.error('批量复制四川商贸录表失败', e)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user