优化附加费计算逻辑,新增复制功能及调整费用类型选择
This commit is contained in:
@@ -78,7 +78,7 @@ public final class LblSurchargeRules
|
||||
}
|
||||
if (name.contains("签名") || name.contains("重复") || name.contains("未预报") || name.contains("重新贴"))
|
||||
{
|
||||
fee.setCalcRule("ITEM");
|
||||
fee.setCalcRule(MANUAL);
|
||||
return;
|
||||
}
|
||||
String postcodes = postcodeParam(desc);
|
||||
@@ -104,10 +104,10 @@ public final class LblSurchargeRules
|
||||
}
|
||||
if (blob.contains("固定收取") || "固定收取".equals(fee.getChargeTiming()))
|
||||
{
|
||||
fee.setCalcRule("ITEM");
|
||||
fee.setCalcRule(ALWAYS);
|
||||
return;
|
||||
}
|
||||
fee.setCalcRule("ITEM");
|
||||
fee.setCalcRule(MANUAL);
|
||||
}
|
||||
|
||||
public static boolean matchesPostcode(String param, String postcode)
|
||||
|
||||
@@ -99,6 +99,7 @@ public class LblWorkbookParser
|
||||
}
|
||||
attachImilePostcodes(workbook, preview.getProducts());
|
||||
attachCatalogRates(workbook, preview.getProducts());
|
||||
clearImportedSurcharges(preview.getProducts());
|
||||
LblZonePostcodeAttach.attach(workbook, preview.getProducts());
|
||||
LblBandNormalizer.normalize(preview);
|
||||
return preview;
|
||||
@@ -202,8 +203,9 @@ public class LblWorkbookParser
|
||||
? "没有工作表能对上产品字典"
|
||||
: "文件里没有「" + selected.trim() + "」这张工作表");
|
||||
}
|
||||
report(listener, 92, "正在整理附加费");
|
||||
attachWorkbookRates(workbook, preview.getProducts());
|
||||
// 打单导入暂不自动识别产品表附加费用表,由操作人手动添加
|
||||
report(listener, 92, "跳过附加费自动识别");
|
||||
clearImportedSurcharges(preview.getProducts());
|
||||
LblZonePostcodeAttach.attach(workbook, preview.getProducts());
|
||||
preview.setSkippedSheets(skipped);
|
||||
report(listener, 96, "工作表解析完成");
|
||||
@@ -795,6 +797,27 @@ public class LblWorkbookParser
|
||||
}
|
||||
}
|
||||
|
||||
/** 清空导入过程中自动识别出的附加费,改由操作人手动添加。 */
|
||||
private static void clearImportedSurcharges(List<LblProduct> products)
|
||||
{
|
||||
if (products == null || products.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (LblProduct product : products)
|
||||
{
|
||||
if (product == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (product.getSurcharges() != null)
|
||||
{
|
||||
product.getSurcharges().clear();
|
||||
}
|
||||
product.setSurchargeCount(0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 只导入其中一张产品表时,同一本里的高风险国家表仍挂回提到它的产品。
|
||||
* 整本目录解析走关联字段,不从这里再挂一次。
|
||||
@@ -1208,6 +1231,11 @@ public class LblWorkbookParser
|
||||
row++;
|
||||
}
|
||||
readFuelMark(grid, product);
|
||||
// 打单价卡导入:不落库产品表「附加费用/收费标准」等自动识别结果
|
||||
if (product.getSurcharges() != null)
|
||||
{
|
||||
product.getSurcharges().clear();
|
||||
}
|
||||
if (product.getWeightBands().isEmpty() && product.getSurcharges().isEmpty() && product.getExtraLines().isEmpty()
|
||||
&& postcodeHits(grid) >= 5)
|
||||
{
|
||||
@@ -3474,10 +3502,14 @@ public class LblWorkbookParser
|
||||
return;
|
||||
}
|
||||
String rule = fee.getCalcRule() == null ? "" : fee.getCalcRule().trim();
|
||||
if (rule.isEmpty() || LblSurchargeRules.MANUAL.equalsIgnoreCase(rule)
|
||||
|| LblSurchargeRules.ALWAYS.equalsIgnoreCase(rule))
|
||||
// 计费条件默认每票都收;旧 ITEM/等同义也归为 ALWAYS
|
||||
if (rule.isEmpty())
|
||||
{
|
||||
fee.setCalcRule("ITEM");
|
||||
fee.setCalcRule(LblSurchargeRules.ALWAYS);
|
||||
}
|
||||
else if ("ITEM".equalsIgnoreCase(rule) || "FLAT".equalsIgnoreCase(rule) || "FIXED".equalsIgnoreCase(rule))
|
||||
{
|
||||
fee.setCalcRule(LblSurchargeRules.ALWAYS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,6 @@ const schemas = computed(() => [
|
||||
dict: 'bms_fee_type',
|
||||
span: 12,
|
||||
width: '100%',
|
||||
disabled: true,
|
||||
rules: [{ required: true, message: '请选择费用类型', trigger: 'change' }]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
:search-columns="searchColumns"
|
||||
:default-params="defaultParams"
|
||||
:query="queryList"
|
||||
:auto-load="false"
|
||||
:search-per-row="4"
|
||||
row-key="billId"
|
||||
selection
|
||||
@@ -97,6 +98,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>
|
||||
@@ -442,29 +482,9 @@ const exportFieldRef = ref()
|
||||
const tableHeight = ref(480)
|
||||
let tableResizeObserver = null
|
||||
|
||||
function pad2(n) {
|
||||
return String(n).padStart(2, '0')
|
||||
}
|
||||
|
||||
function formatDateTime(d, endOfDay) {
|
||||
const y = d.getFullYear()
|
||||
const m = pad2(d.getMonth() + 1)
|
||||
const day = pad2(d.getDate())
|
||||
return endOfDay ? `${y}-${m}-${day} 23:59:59` : `${y}-${m}-${day} 00:00:00`
|
||||
}
|
||||
|
||||
/** 默认收货时间:最近两个星期(含今天共 14 天) */
|
||||
function defaultPickupDateRange() {
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
start.setDate(start.getDate() - 13)
|
||||
return [formatDateTime(start, false), formatDateTime(end, true)]
|
||||
}
|
||||
|
||||
const defaultParams = {
|
||||
orderStatuses: [3, 4, 5, 6, 7, 8, 11],
|
||||
billingFailStatuses: [],
|
||||
pickupDateRange: defaultPickupDateRange()
|
||||
billingFailStatuses: []
|
||||
}
|
||||
|
||||
const orderStatusMap = {
|
||||
@@ -574,10 +594,34 @@ const cwImportProgressTitle = ref('正在导入修改计费重')
|
||||
const recalcDialogOpen = ref(false)
|
||||
const recalcMode = ref('PRODUCT')
|
||||
|
||||
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 columns = [
|
||||
{ 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' },
|
||||
@@ -1167,6 +1211,24 @@ function refundTagType(status) {
|
||||
</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;
|
||||
}
|
||||
.billing-bill .payable {
|
||||
color: #f56c6c;
|
||||
font-weight: 600;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="lblFeeType" prop="feeType">
|
||||
<el-select v-model="form.feeType" :placeholder="phFeeType" style="width: 100%;">
|
||||
<el-select v-model="form.feeType" :placeholder="phFeeType" disabled style="width: 100%;">
|
||||
<el-option
|
||||
v-for="d in (bms_fee_type || [])"
|
||||
:key="d.value"
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="lblFeeType" prop="feeType">
|
||||
<el-select v-model="form.feeType" :placeholder="phFeeType" style="width: 100%;">
|
||||
<el-select v-model="form.feeType" :placeholder="phFeeType" disabled style="width: 100%;">
|
||||
<el-option
|
||||
v-for="d in (bms_fee_type || [])"
|
||||
:key="d.value"
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
@click="historyOpen = true"
|
||||
>历史计费</el-button>
|
||||
</div>
|
||||
<div class="amount-summary">
|
||||
<div class="amount-summary" :class="{ 'is-income-only': showIncome }">
|
||||
<div class="amount-card">
|
||||
<div class="amount-label">运费金额</div>
|
||||
<div class="amount-value">{{ formatMoney(detail.freightAmount) }}</div>
|
||||
@@ -69,7 +69,7 @@
|
||||
<div class="amount-label">应收总额</div>
|
||||
<div class="amount-value">{{ formatMoney(detail.incomeTotal ?? detail.payableTotal) }}</div>
|
||||
</div>
|
||||
<div class="amount-card is-total">
|
||||
<div v-if="!showIncome" class="amount-card is-total">
|
||||
<div class="amount-label">应付总额</div>
|
||||
<div class="amount-value">{{ formatMoney(detail.payTotal) }}</div>
|
||||
</div>
|
||||
@@ -99,80 +99,77 @@
|
||||
|
||||
<section class="detail-block">
|
||||
<div class="sec-title">费用明细</div>
|
||||
<el-tabs v-model="feeTab" class="fee-tabs">
|
||||
<el-tab-pane v-if="showIncome" label="应收" name="income">
|
||||
<div v-if="!readonly" class="fee-toolbar">
|
||||
<el-button type="primary" plain size="small" icon="Plus" v-hasPermi="['price:billing:feeAdd']" @click="openAddFee">增加费用</el-button>
|
||||
<!-- <el-button type="primary" plain size="small" icon="Edit" v-hasPermi="['price:billing:chargeWeightEdit']" :disabled="detail.refundStatus === 'REFUNDED'" @click="openEditCw">修改计费重</el-button> -->
|
||||
</div>
|
||||
<el-table v-if="incomeFees.length" :data="incomeFees" border size="small" class="fee-table">
|
||||
<el-table-column label="费用名称" min-width="140" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ displayFeeName(row) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="费用类型" width="110" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag size="small" :type="feeTypeTag(row.feeType)" effect="plain">
|
||||
{{ feeTypeLabel(row.feeType) || row.feeType }}
|
||||
</el-tag>
|
||||
<template v-if="showIncome">
|
||||
<div v-if="!readonly" class="fee-toolbar">
|
||||
<el-button type="primary" plain size="small" icon="Plus" v-hasPermi="['price:billing:feeAdd']" @click="openAddFee">增加费用</el-button>
|
||||
</div>
|
||||
<el-table v-if="incomeFees.length" :data="incomeFees" border size="small" class="fee-table">
|
||||
<el-table-column label="费用名称" min-width="140" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ displayFeeName(row) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="费用类型" width="110" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag size="small" :type="feeTypeTag(row.feeType)" effect="plain">
|
||||
{{ feeTypeLabel(row.feeType) || row.feeType }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="金额" min-width="120" align="right">
|
||||
<template #default="{ row }">
|
||||
<span class="fee-amount">{{ formatMoney(row.amount) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="币种" width="90" align="center">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="bms_currency" :value="displayCurrency(row.currency)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="说明" min-width="160" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ row.remark || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="!readonly" label="操作" width="120" align="center" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<template v-if="canEditManualFee(row)">
|
||||
<el-button link type="primary" v-hasPermi="['price:billing:feeEdit']" @click="openEditFee(row)">编辑</el-button>
|
||||
<el-button link type="danger" v-hasPermi="['price:billing:feeRemove']" @click="handleDeleteFee(row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="金额" min-width="120" align="right">
|
||||
<template #default="{ row }">
|
||||
<span class="fee-amount">{{ formatMoney(row.amount) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="币种" width="90" align="center">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="bms_currency" :value="displayCurrency(row.currency)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="说明" min-width="160" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ row.remark || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="!readonly" label="操作" width="120" align="center" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<template v-if="canEditManualFee(row)">
|
||||
<el-button link type="primary" v-hasPermi="['price:billing:feeEdit']" @click="openEditFee(row)">编辑</el-button>
|
||||
<el-button link type="danger" v-hasPermi="['price:billing:feeRemove']" @click="handleDeleteFee(row)">删除</el-button>
|
||||
</template>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-empty v-else description="暂无应收明细" :image-size="64" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="应付" name="pay">
|
||||
<div v-if="!readonly" class="pay-generate">
|
||||
<el-button type="primary" plain size="small" v-hasPermi="['price:billing:bill']" @click="handlePayBill">生成应付</el-button>
|
||||
</div>
|
||||
<el-table v-if="payFees.length" :data="payFees" border size="small" class="fee-table">
|
||||
<el-table-column label="费用名称" min-width="140" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ displayFeeName(row) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="费用类型" min-width="140" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-tag size="small" :type="feeTypeTag(row.feeType)" effect="plain">
|
||||
{{ payFeeTypeLabel(row) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="金额" min-width="120" align="right">
|
||||
<template #default="{ row }">
|
||||
<span class="fee-amount">{{ formatFeeAmount(row.amount) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="币种" width="90" align="center">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="bms_currency" :value="displayCurrency(row.currency)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="说明" min-width="160" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ row.remark || '-' }}</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-empty v-else description="暂无应付明细" :image-size="64" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-empty v-else description="暂无应收明细" :image-size="64" />
|
||||
</template>
|
||||
<template v-else>
|
||||
<div v-if="!readonly" class="pay-generate">
|
||||
<el-button type="primary" plain size="small" v-hasPermi="['price:billing:bill']" @click="handlePayBill">生成应付</el-button>
|
||||
</div>
|
||||
<el-table v-if="payFees.length" :data="payFees" border size="small" class="fee-table">
|
||||
<el-table-column label="费用名称" min-width="140" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ displayFeeName(row) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="费用类型" min-width="140" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-tag size="small" :type="feeTypeTag(row.feeType)" effect="plain">
|
||||
{{ payFeeTypeLabel(row) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="金额" min-width="120" align="right">
|
||||
<template #default="{ row }">
|
||||
<span class="fee-amount">{{ formatFeeAmount(row.amount) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="币种" width="90" align="center">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="bms_currency" :value="displayCurrency(row.currency)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="说明" min-width="160" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ row.remark || '-' }}</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-empty v-else description="暂无应付明细" :image-size="64" />
|
||||
</template>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
@@ -221,7 +218,6 @@ const props = defineProps({
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'updated'])
|
||||
|
||||
const feeTab = ref('income')
|
||||
const historyOpen = ref(false)
|
||||
const addFeeOpen = ref(false)
|
||||
const editFeeRow = ref(null)
|
||||
@@ -241,7 +237,6 @@ const payFees = computed(() => {
|
||||
})
|
||||
|
||||
watch(() => props.detail, () => {
|
||||
feeTab.value = props.showIncome ? 'income' : 'pay'
|
||||
historyOpen.value = false
|
||||
})
|
||||
|
||||
@@ -508,6 +503,9 @@ function refundLabel(status) {
|
||||
gap: 10px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.amount-summary.is-income-only {
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
}
|
||||
.amount-card {
|
||||
padding: 12px 14px;
|
||||
background: #f7f8fa;
|
||||
|
||||
@@ -191,7 +191,7 @@
|
||||
>
|
||||
<el-option v-for="d in feeChargeModeOptions(row)" :key="d.value" :label="d.label" :value="d.value" />
|
||||
</el-select>
|
||||
<span v-else>{{ dictLabel(lbl_charge_mode, feeChargeModeOf(row)) || '-' }}</span>
|
||||
<span v-else>{{ feeChargeModeLabel(feeChargeModeOf(row)) || '-' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="feeDesc" label="费用解释" min-width="240" show-overflow-tooltip>
|
||||
@@ -337,6 +337,7 @@ function saveBandRow(pane, row) {
|
||||
}
|
||||
|
||||
function saveFeeRow(pane, row) {
|
||||
if (row) row.calcRule = normalizeFeeChargeMode(row.calcRule)
|
||||
runSave('fee', pane, row)
|
||||
}
|
||||
|
||||
@@ -458,10 +459,23 @@ const CellText = {
|
||||
}
|
||||
}
|
||||
|
||||
/** 与附加费配置计费方式一致(仅附加费 tab,不影响重量段) */
|
||||
const feeCalcModeOptions = [
|
||||
{ value: 'MANUAL', label: '暂不计费' },
|
||||
{ value: 'ALWAYS', label: '每票都收' },
|
||||
{ value: 'POSTCODE', label: '命中邮编' },
|
||||
{ value: 'ZONE', label: '命中分区' },
|
||||
{ value: 'EXTRA_KG', label: '超重续收' },
|
||||
{ value: 'WEIGHT', label: '超重' },
|
||||
{ value: 'SIZE', label: '超尺寸' },
|
||||
{ value: 'RETURN', label: '退件' }
|
||||
]
|
||||
|
||||
function normalizeFeeChargeMode(rule) {
|
||||
const v = String(rule || '').trim().toUpperCase()
|
||||
if (!v || v === 'MANUAL') return ''
|
||||
if (v === 'ALWAYS' || v === 'FLAT' || v === 'ZONE' || v === 'WEIGHT' || v === 'SIZE' || v === 'RETURN') return 'ITEM'
|
||||
if (!v) return 'ALWAYS'
|
||||
if (v === 'MANUAL') return 'MANUAL'
|
||||
if (v === 'ITEM' || v === 'FLAT' || v === 'FIXED') return 'ALWAYS'
|
||||
if (v === 'FIRST_EXTRA') return 'EXTRA_KG'
|
||||
return v
|
||||
}
|
||||
@@ -470,18 +484,24 @@ function feeChargeModeOf(row) {
|
||||
return normalizeFeeChargeMode(row?.calcRule)
|
||||
}
|
||||
|
||||
function feeChargeModeLabel(rule) {
|
||||
const v = normalizeFeeChargeMode(rule)
|
||||
const hit = feeCalcModeOptions.find(d => d.value === v)
|
||||
return hit ? hit.label : (v || '-')
|
||||
}
|
||||
|
||||
function feeChargeModeOptions(row) {
|
||||
const list = (lbl_charge_mode.value || []).map(d => ({ label: d.label || d.value, value: d.value }))
|
||||
const list = feeCalcModeOptions.map(d => ({ label: d.label, value: d.value }))
|
||||
const cur = feeChargeModeOf(row)
|
||||
if (cur && !list.some(d => String(d.value) === String(cur))) {
|
||||
list.unshift({ label: cur, value: cur })
|
||||
list.unshift({ label: feeChargeModeLabel(cur), value: cur })
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
function setFeeChargeMode(row, value) {
|
||||
const mode = String(value || '').trim().toUpperCase()
|
||||
row.calcRule = mode || 'MANUAL'
|
||||
row.calcRule = mode || 'ALWAYS'
|
||||
}
|
||||
|
||||
const pageSize = 20
|
||||
@@ -692,17 +712,38 @@ function openFeePicker(pane) {
|
||||
|
||||
function toCalcRule(chargeType) {
|
||||
const t = String(chargeType || '').trim().toUpperCase()
|
||||
if (!t || t === 'RATE') return 'MANUAL'
|
||||
if (t === 'FIXED') return 'ITEM'
|
||||
const allowed = ['ITEM', 'PER_KG', 'ALWAYS', 'POSTCODE', 'ZONE', 'EXTRA_KG', 'WEIGHT', 'SIZE', 'RETURN', 'MANUAL']
|
||||
if (t === 'ALWAYS') return 'ITEM'
|
||||
return allowed.includes(t) ? t : 'MANUAL'
|
||||
if (!t) return 'ALWAYS'
|
||||
if (t === 'RATE') return 'MANUAL'
|
||||
if (t === 'FIXED' || t === 'ITEM' || t === 'FLAT') return 'ALWAYS'
|
||||
const allowed = ['ALWAYS', 'POSTCODE', 'ZONE', 'EXTRA_KG', 'WEIGHT', 'SIZE', 'RETURN', 'MANUAL']
|
||||
return allowed.includes(t) ? t : 'ALWAYS'
|
||||
}
|
||||
|
||||
function sizeCalcParam(cfg) {
|
||||
const l = cfg?.lengthCm
|
||||
const w = cfg?.widthCm
|
||||
const h = cfg?.heightCm
|
||||
if (l == null || w == null || h == null) return ''
|
||||
return `${l}*${w}*${h}`
|
||||
}
|
||||
|
||||
function configToFeeRow(cfg, product) {
|
||||
const currency = String(cfg?.currency || product?.currency || 'EUR').trim().toUpperCase() || 'EUR'
|
||||
const amount = cfg?.chargeValue
|
||||
const isPercent = String(cfg?.chargeType || '').toUpperCase() === 'RATE'
|
||||
const calcRule = toCalcRule(cfg?.chargeType)
|
||||
let calcParam = ''
|
||||
let postcodeParam = ''
|
||||
if (calcRule === 'POSTCODE') {
|
||||
postcodeParam = String(cfg?.postcodeText || '').trim()
|
||||
calcParam = postcodeParam
|
||||
} else if (calcRule === 'WEIGHT') {
|
||||
calcParam = cfg?.overWeightKg == null ? '' : String(cfg.overWeightKg)
|
||||
} else if (calcRule === 'EXTRA_KG') {
|
||||
calcParam = cfg?.extraWeightKg == null ? '' : String(cfg.extraWeightKg)
|
||||
} else if (calcRule === 'SIZE') {
|
||||
calcParam = sizeCalcParam(cfg)
|
||||
}
|
||||
return {
|
||||
feeName: String(cfg?.scName || '').trim(),
|
||||
scId: cfg?.scId,
|
||||
@@ -711,9 +752,10 @@ function configToFeeRow(cfg, product) {
|
||||
amount: amount == null ? '' : amount,
|
||||
currency,
|
||||
priceUnit: isPercent ? '%' : (currency + '/ITEM'),
|
||||
feeDesc: String(cfg?.scNote || '').trim(),
|
||||
calcRule: toCalcRule(cfg?.chargeType),
|
||||
calcParam: ''
|
||||
feeDesc: String(cfg?.scNote || '').trim() || '从附加费类型字典迁移',
|
||||
calcRule,
|
||||
calcParam,
|
||||
postcodeParam
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user