优化附加费计算逻辑,新增复制功能及调整费用类型选择

This commit is contained in:
wuweihua
2026-11-18 18:31:08 +08:00
parent b3ef85b0bb
commit 5442967cb6
9 changed files with 343 additions and 129 deletions
+84 -3
View File
@@ -167,6 +167,45 @@
/>
</el-select>
</template>
<template #col-orderNo="{ row }">
<div class="copy-cell">
<el-button
v-if="row.orderNo"
link
type="primary"
icon="CopyDocument"
class="copy-cell__btn"
@click.stop="copyCellText(row.orderNo)"
/>
<span class="copy-cell__text" :title="row.orderNo || ''">{{ row.orderNo || '-' }}</span>
</div>
</template>
<template #col-trackingNo="{ row }">
<div class="copy-cell">
<el-button
v-if="row.trackingNo"
link
type="primary"
icon="CopyDocument"
class="copy-cell__btn"
@click.stop="copyCellText(row.trackingNo)"
/>
<span class="copy-cell__text" :title="row.trackingNo || ''">{{ row.trackingNo || '-' }}</span>
</div>
</template>
<template #col-transferNo="{ row }">
<div class="copy-cell">
<el-button
v-if="row.transferNo"
link
type="primary"
icon="CopyDocument"
class="copy-cell__btn"
@click.stop="copyCellText(row.transferNo)"
/>
<span class="copy-cell__text" :title="row.transferNo || ''">{{ row.transferNo || '-' }}</span>
</div>
</template>
<template #col-product="{ row }">
{{ row.productName || '-' }} ({{ row.productCode || '-' }})
</template>
@@ -586,6 +625,30 @@ const tableHeight = ref(480)
let tableResizeObserver = null
const MAX_ORDER_IDENTIFIERS = 1000
function copyCellText(text) {
const value = String(text || '').trim()
if (!value) return
const done = () => ElMessage.success('已复制')
const fail = () => ElMessage.error('复制失败')
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(value).then(done).catch(fail)
return
}
const input = document.createElement('textarea')
input.value = value
input.setAttribute('readonly', 'readonly')
input.style.position = 'fixed'
input.style.left = '-9999px'
document.body.appendChild(input)
input.select()
try {
document.execCommand('copy') ? done() : fail()
} catch (e) {
fail()
}
document.body.removeChild(input)
}
const defaultParams = {
orderStatuses: [3, 4, 5, 6, 7, 8, 11],
billingFailStatuses: []
@@ -593,9 +656,9 @@ const defaultParams = {
const columns = [
{ label: '计费状态', prop: 'billingFailStatus', align: 'center', width: 160, fixed: 'left', slot: 'billingFailStatus' },
{ label: '订单号', prop: 'orderNo', width: 160, fixed: 'left', showOverflowTooltip: true },
{ label: '运单号', prop: 'trackingNo', minWidth: 140, showOverflowTooltip: true },
{ label: '转单号', prop: 'transferNo', minWidth: 140, showOverflowTooltip: true },
{ label: '订单号', prop: 'orderNo', width: 190, fixed: 'left', slot: 'orderNo', showOverflowTooltip: true },
{ label: '运单号', prop: 'trackingNo', minWidth: 160, slot: 'trackingNo', showOverflowTooltip: true },
{ label: '转单号', prop: 'transferNo', minWidth: 160, slot: 'transferNo', showOverflowTooltip: true },
{ label: '客户', prop: 'customerName', minWidth: 140, showOverflowTooltip: true },
{ label: '客户代码', prop: 'customerCode', width: 120 },
{ label: '产品', prop: 'product', minWidth: 160, slot: 'product' },
@@ -1409,6 +1472,24 @@ onBeforeUnmount(() => {
</script>
<style scoped>
.copy-cell {
display: flex;
align-items: center;
gap: 2px;
min-width: 0;
}
.copy-cell__text {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.copy-cell__btn {
flex-shrink: 0;
padding: 0 2px;
height: 20px;
}
.order-bill-query :deep(.basic-form .el-form-item .el-select),
.order-bill-query :deep(.basic-form .el-form-item .el-input),
.order-bill-query :deep(.basic-form .el-form-item .el-date-editor) {