优化附加费计算逻辑,新增复制功能及调整费用类型选择
This commit is contained in:
@@ -78,7 +78,7 @@ public final class LblSurchargeRules
|
|||||||
}
|
}
|
||||||
if (name.contains("签名") || name.contains("重复") || name.contains("未预报") || name.contains("重新贴"))
|
if (name.contains("签名") || name.contains("重复") || name.contains("未预报") || name.contains("重新贴"))
|
||||||
{
|
{
|
||||||
fee.setCalcRule("ITEM");
|
fee.setCalcRule(MANUAL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String postcodes = postcodeParam(desc);
|
String postcodes = postcodeParam(desc);
|
||||||
@@ -104,10 +104,10 @@ public final class LblSurchargeRules
|
|||||||
}
|
}
|
||||||
if (blob.contains("固定收取") || "固定收取".equals(fee.getChargeTiming()))
|
if (blob.contains("固定收取") || "固定收取".equals(fee.getChargeTiming()))
|
||||||
{
|
{
|
||||||
fee.setCalcRule("ITEM");
|
fee.setCalcRule(ALWAYS);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fee.setCalcRule("ITEM");
|
fee.setCalcRule(MANUAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean matchesPostcode(String param, String postcode)
|
public static boolean matchesPostcode(String param, String postcode)
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ public class LblWorkbookParser
|
|||||||
}
|
}
|
||||||
attachImilePostcodes(workbook, preview.getProducts());
|
attachImilePostcodes(workbook, preview.getProducts());
|
||||||
attachCatalogRates(workbook, preview.getProducts());
|
attachCatalogRates(workbook, preview.getProducts());
|
||||||
|
clearImportedSurcharges(preview.getProducts());
|
||||||
LblZonePostcodeAttach.attach(workbook, preview.getProducts());
|
LblZonePostcodeAttach.attach(workbook, preview.getProducts());
|
||||||
LblBandNormalizer.normalize(preview);
|
LblBandNormalizer.normalize(preview);
|
||||||
return preview;
|
return preview;
|
||||||
@@ -202,8 +203,9 @@ public class LblWorkbookParser
|
|||||||
? "没有工作表能对上产品字典"
|
? "没有工作表能对上产品字典"
|
||||||
: "文件里没有「" + selected.trim() + "」这张工作表");
|
: "文件里没有「" + selected.trim() + "」这张工作表");
|
||||||
}
|
}
|
||||||
report(listener, 92, "正在整理附加费");
|
// 打单导入暂不自动识别产品表附加费用表,由操作人手动添加
|
||||||
attachWorkbookRates(workbook, preview.getProducts());
|
report(listener, 92, "跳过附加费自动识别");
|
||||||
|
clearImportedSurcharges(preview.getProducts());
|
||||||
LblZonePostcodeAttach.attach(workbook, preview.getProducts());
|
LblZonePostcodeAttach.attach(workbook, preview.getProducts());
|
||||||
preview.setSkippedSheets(skipped);
|
preview.setSkippedSheets(skipped);
|
||||||
report(listener, 96, "工作表解析完成");
|
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++;
|
row++;
|
||||||
}
|
}
|
||||||
readFuelMark(grid, product);
|
readFuelMark(grid, product);
|
||||||
|
// 打单价卡导入:不落库产品表「附加费用/收费标准」等自动识别结果
|
||||||
|
if (product.getSurcharges() != null)
|
||||||
|
{
|
||||||
|
product.getSurcharges().clear();
|
||||||
|
}
|
||||||
if (product.getWeightBands().isEmpty() && product.getSurcharges().isEmpty() && product.getExtraLines().isEmpty()
|
if (product.getWeightBands().isEmpty() && product.getSurcharges().isEmpty() && product.getExtraLines().isEmpty()
|
||||||
&& postcodeHits(grid) >= 5)
|
&& postcodeHits(grid) >= 5)
|
||||||
{
|
{
|
||||||
@@ -3474,10 +3502,14 @@ public class LblWorkbookParser
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String rule = fee.getCalcRule() == null ? "" : fee.getCalcRule().trim();
|
String rule = fee.getCalcRule() == null ? "" : fee.getCalcRule().trim();
|
||||||
if (rule.isEmpty() || LblSurchargeRules.MANUAL.equalsIgnoreCase(rule)
|
// 计费条件默认每票都收;旧 ITEM/等同义也归为 ALWAYS
|
||||||
|| LblSurchargeRules.ALWAYS.equalsIgnoreCase(rule))
|
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',
|
dict: 'bms_fee_type',
|
||||||
span: 12,
|
span: 12,
|
||||||
width: '100%',
|
width: '100%',
|
||||||
disabled: true,
|
|
||||||
rules: [{ required: true, message: '请选择费用类型', trigger: 'change' }]
|
rules: [{ required: true, message: '请选择费用类型', trigger: 'change' }]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
:search-columns="searchColumns"
|
:search-columns="searchColumns"
|
||||||
:default-params="defaultParams"
|
:default-params="defaultParams"
|
||||||
:query="queryList"
|
:query="queryList"
|
||||||
|
:auto-load="false"
|
||||||
:search-per-row="4"
|
:search-per-row="4"
|
||||||
row-key="billId"
|
row-key="billId"
|
||||||
selection
|
selection
|
||||||
@@ -97,6 +98,45 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</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 }">
|
<template #col-product="{ row }">
|
||||||
{{ row.productName || '-' }} ({{ row.productCode }})
|
{{ row.productName || '-' }} ({{ row.productCode }})
|
||||||
</template>
|
</template>
|
||||||
@@ -442,29 +482,9 @@ const exportFieldRef = ref()
|
|||||||
const tableHeight = ref(480)
|
const tableHeight = ref(480)
|
||||||
let tableResizeObserver = null
|
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 = {
|
const defaultParams = {
|
||||||
orderStatuses: [3, 4, 5, 6, 7, 8, 11],
|
orderStatuses: [3, 4, 5, 6, 7, 8, 11],
|
||||||
billingFailStatuses: [],
|
billingFailStatuses: []
|
||||||
pickupDateRange: defaultPickupDateRange()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const orderStatusMap = {
|
const orderStatusMap = {
|
||||||
@@ -574,10 +594,34 @@ const cwImportProgressTitle = ref('正在导入修改计费重')
|
|||||||
const recalcDialogOpen = ref(false)
|
const recalcDialogOpen = ref(false)
|
||||||
const recalcMode = ref('PRODUCT')
|
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 = [
|
const columns = [
|
||||||
{ label: '订单号', prop: 'orderNo', width: 160, fixed: 'left', showOverflowTooltip: true },
|
{ label: '订单号', prop: 'orderNo', width: 190, fixed: 'left', slot: 'orderNo', showOverflowTooltip: true },
|
||||||
{ label: '运单号', prop: 'trackingNo', minWidth: 140, showOverflowTooltip: true },
|
{ label: '运单号', prop: 'trackingNo', minWidth: 160, slot: 'trackingNo', showOverflowTooltip: true },
|
||||||
{ label: '转单号', prop: 'transferNo', minWidth: 140, showOverflowTooltip: true },
|
{ label: '转单号', prop: 'transferNo', minWidth: 160, slot: 'transferNo', showOverflowTooltip: true },
|
||||||
{ label: '客户', prop: 'customerName', minWidth: 140, showOverflowTooltip: true },
|
{ label: '客户', prop: 'customerName', minWidth: 140, showOverflowTooltip: true },
|
||||||
{ label: '客户代码', prop: 'customerCode', width: 120 },
|
{ label: '客户代码', prop: 'customerCode', width: 120 },
|
||||||
{ label: '产品', prop: 'product', minWidth: 160, slot: 'product' },
|
{ label: '产品', prop: 'product', minWidth: 160, slot: 'product' },
|
||||||
@@ -1167,6 +1211,24 @@ function refundTagType(status) {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<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 {
|
.billing-bill .payable {
|
||||||
color: #f56c6c;
|
color: #f56c6c;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="lblFeeType" prop="feeType">
|
<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
|
<el-option
|
||||||
v-for="d in (bms_fee_type || [])"
|
v-for="d in (bms_fee_type || [])"
|
||||||
:key="d.value"
|
:key="d.value"
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="lblFeeType" prop="feeType">
|
<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
|
<el-option
|
||||||
v-for="d in (bms_fee_type || [])"
|
v-for="d in (bms_fee_type || [])"
|
||||||
:key="d.value"
|
:key="d.value"
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
@click="historyOpen = true"
|
@click="historyOpen = true"
|
||||||
>历史计费</el-button>
|
>历史计费</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="amount-summary">
|
<div class="amount-summary" :class="{ 'is-income-only': showIncome }">
|
||||||
<div class="amount-card">
|
<div class="amount-card">
|
||||||
<div class="amount-label">运费金额</div>
|
<div class="amount-label">运费金额</div>
|
||||||
<div class="amount-value">{{ formatMoney(detail.freightAmount) }}</div>
|
<div class="amount-value">{{ formatMoney(detail.freightAmount) }}</div>
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
<div class="amount-label">应收总额</div>
|
<div class="amount-label">应收总额</div>
|
||||||
<div class="amount-value">{{ formatMoney(detail.incomeTotal ?? detail.payableTotal) }}</div>
|
<div class="amount-value">{{ formatMoney(detail.incomeTotal ?? detail.payableTotal) }}</div>
|
||||||
</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-label">应付总额</div>
|
||||||
<div class="amount-value">{{ formatMoney(detail.payTotal) }}</div>
|
<div class="amount-value">{{ formatMoney(detail.payTotal) }}</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -99,80 +99,77 @@
|
|||||||
|
|
||||||
<section class="detail-block">
|
<section class="detail-block">
|
||||||
<div class="sec-title">费用明细</div>
|
<div class="sec-title">费用明细</div>
|
||||||
<el-tabs v-model="feeTab" class="fee-tabs">
|
<template v-if="showIncome">
|
||||||
<el-tab-pane v-if="showIncome" label="应收" name="income">
|
<div v-if="!readonly" class="fee-toolbar">
|
||||||
<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="Plus" v-hasPermi="['price:billing:feeAdd']" @click="openAddFee">增加费用</el-button>
|
</div>
|
||||||
<!-- <el-button type="primary" plain size="small" icon="Edit" v-hasPermi="['price:billing:chargeWeightEdit']" :disabled="detail.refundStatus === 'REFUNDED'" @click="openEditCw">修改计费重</el-button> -->
|
<el-table v-if="incomeFees.length" :data="incomeFees" border size="small" class="fee-table">
|
||||||
</div>
|
<el-table-column label="费用名称" min-width="140" show-overflow-tooltip>
|
||||||
<el-table v-if="incomeFees.length" :data="incomeFees" border size="small" class="fee-table">
|
<template #default="{ row }">{{ displayFeeName(row) }}</template>
|
||||||
<el-table-column label="费用名称" min-width="140" show-overflow-tooltip>
|
</el-table-column>
|
||||||
<template #default="{ row }">{{ displayFeeName(row) }}</template>
|
<el-table-column label="费用类型" width="110" align="center">
|
||||||
</el-table-column>
|
<template #default="{ row }">
|
||||||
<el-table-column label="费用类型" width="110" align="center">
|
<el-tag size="small" :type="feeTypeTag(row.feeType)" effect="plain">
|
||||||
<template #default="{ row }">
|
{{ feeTypeLabel(row.feeType) || row.feeType }}
|
||||||
<el-tag size="small" :type="feeTypeTag(row.feeType)" effect="plain">
|
</el-tag>
|
||||||
{{ feeTypeLabel(row.feeType) || row.feeType }}
|
</template>
|
||||||
</el-tag>
|
</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>
|
</template>
|
||||||
</el-table-column>
|
<span v-else>-</span>
|
||||||
<el-table-column label="金额" min-width="120" align="right">
|
</template>
|
||||||
<template #default="{ row }">
|
</el-table-column>
|
||||||
<span class="fee-amount">{{ formatMoney(row.amount) }}</span>
|
</el-table>
|
||||||
</template>
|
<el-empty v-else description="暂无应收明细" :image-size="64" />
|
||||||
</el-table-column>
|
</template>
|
||||||
<el-table-column label="币种" width="90" align="center">
|
<template v-else>
|
||||||
<template #default="{ row }">
|
<div v-if="!readonly" class="pay-generate">
|
||||||
<dict-tag :options="bms_currency" :value="displayCurrency(row.currency)" />
|
<el-button type="primary" plain size="small" v-hasPermi="['price:billing:bill']" @click="handlePayBill">生成应付</el-button>
|
||||||
</template>
|
</div>
|
||||||
</el-table-column>
|
<el-table v-if="payFees.length" :data="payFees" border size="small" class="fee-table">
|
||||||
<el-table-column label="说明" min-width="160" show-overflow-tooltip>
|
<el-table-column label="费用名称" min-width="140" show-overflow-tooltip>
|
||||||
<template #default="{ row }">{{ row.remark || '-' }}</template>
|
<template #default="{ row }">{{ displayFeeName(row) }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column v-if="!readonly" label="操作" width="120" align="center" fixed="right">
|
<el-table-column label="费用类型" min-width="140" align="center" show-overflow-tooltip>
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<template v-if="canEditManualFee(row)">
|
<el-tag size="small" :type="feeTypeTag(row.feeType)" effect="plain">
|
||||||
<el-button link type="primary" v-hasPermi="['price:billing:feeEdit']" @click="openEditFee(row)">编辑</el-button>
|
{{ payFeeTypeLabel(row) }}
|
||||||
<el-button link type="danger" v-hasPermi="['price:billing:feeRemove']" @click="handleDeleteFee(row)">删除</el-button>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
<span v-else>-</span>
|
</el-table-column>
|
||||||
</template>
|
<el-table-column label="金额" min-width="120" align="right">
|
||||||
</el-table-column>
|
<template #default="{ row }">
|
||||||
</el-table>
|
<span class="fee-amount">{{ formatFeeAmount(row.amount) }}</span>
|
||||||
<el-empty v-else description="暂无应收明细" :image-size="64" />
|
</template>
|
||||||
</el-tab-pane>
|
</el-table-column>
|
||||||
<el-tab-pane label="应付" name="pay">
|
<el-table-column label="币种" width="90" align="center">
|
||||||
<div v-if="!readonly" class="pay-generate">
|
<template #default="{ row }">
|
||||||
<el-button type="primary" plain size="small" v-hasPermi="['price:billing:bill']" @click="handlePayBill">生成应付</el-button>
|
<dict-tag :options="bms_currency" :value="displayCurrency(row.currency)" />
|
||||||
</div>
|
</template>
|
||||||
<el-table v-if="payFees.length" :data="payFees" border size="small" class="fee-table">
|
</el-table-column>
|
||||||
<el-table-column label="费用名称" min-width="140" show-overflow-tooltip>
|
<el-table-column label="说明" min-width="160" show-overflow-tooltip>
|
||||||
<template #default="{ row }">{{ displayFeeName(row) }}</template>
|
<template #default="{ row }">{{ row.remark || '-' }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="费用类型" min-width="140" align="center" show-overflow-tooltip>
|
</el-table>
|
||||||
<template #default="{ row }">
|
<el-empty v-else description="暂无应付明细" :image-size="64" />
|
||||||
<el-tag size="small" :type="feeTypeTag(row.feeType)" effect="plain">
|
</template>
|
||||||
{{ 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>
|
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -221,7 +218,6 @@ const props = defineProps({
|
|||||||
|
|
||||||
const emit = defineEmits(['update:modelValue', 'updated'])
|
const emit = defineEmits(['update:modelValue', 'updated'])
|
||||||
|
|
||||||
const feeTab = ref('income')
|
|
||||||
const historyOpen = ref(false)
|
const historyOpen = ref(false)
|
||||||
const addFeeOpen = ref(false)
|
const addFeeOpen = ref(false)
|
||||||
const editFeeRow = ref(null)
|
const editFeeRow = ref(null)
|
||||||
@@ -241,7 +237,6 @@ const payFees = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
watch(() => props.detail, () => {
|
watch(() => props.detail, () => {
|
||||||
feeTab.value = props.showIncome ? 'income' : 'pay'
|
|
||||||
historyOpen.value = false
|
historyOpen.value = false
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -508,6 +503,9 @@ function refundLabel(status) {
|
|||||||
gap: 10px;
|
gap: 10px;
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
}
|
}
|
||||||
|
.amount-summary.is-income-only {
|
||||||
|
grid-template-columns: repeat(4, 1fr);
|
||||||
|
}
|
||||||
.amount-card {
|
.amount-card {
|
||||||
padding: 12px 14px;
|
padding: 12px 14px;
|
||||||
background: #f7f8fa;
|
background: #f7f8fa;
|
||||||
|
|||||||
@@ -191,7 +191,7 @@
|
|||||||
>
|
>
|
||||||
<el-option v-for="d in feeChargeModeOptions(row)" :key="d.value" :label="d.label" :value="d.value" />
|
<el-option v-for="d in feeChargeModeOptions(row)" :key="d.value" :label="d.label" :value="d.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
<span v-else>{{ dictLabel(lbl_charge_mode, feeChargeModeOf(row)) || '-' }}</span>
|
<span v-else>{{ feeChargeModeLabel(feeChargeModeOf(row)) || '-' }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="feeDesc" label="费用解释" min-width="240" show-overflow-tooltip>
|
<el-table-column prop="feeDesc" label="费用解释" min-width="240" show-overflow-tooltip>
|
||||||
@@ -337,6 +337,7 @@ function saveBandRow(pane, row) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function saveFeeRow(pane, row) {
|
function saveFeeRow(pane, row) {
|
||||||
|
if (row) row.calcRule = normalizeFeeChargeMode(row.calcRule)
|
||||||
runSave('fee', pane, row)
|
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) {
|
function normalizeFeeChargeMode(rule) {
|
||||||
const v = String(rule || '').trim().toUpperCase()
|
const v = String(rule || '').trim().toUpperCase()
|
||||||
if (!v || v === 'MANUAL') return ''
|
if (!v) return 'ALWAYS'
|
||||||
if (v === 'ALWAYS' || v === 'FLAT' || v === 'ZONE' || v === 'WEIGHT' || v === 'SIZE' || v === 'RETURN') return 'ITEM'
|
if (v === 'MANUAL') return 'MANUAL'
|
||||||
|
if (v === 'ITEM' || v === 'FLAT' || v === 'FIXED') return 'ALWAYS'
|
||||||
if (v === 'FIRST_EXTRA') return 'EXTRA_KG'
|
if (v === 'FIRST_EXTRA') return 'EXTRA_KG'
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
@@ -470,18 +484,24 @@ function feeChargeModeOf(row) {
|
|||||||
return normalizeFeeChargeMode(row?.calcRule)
|
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) {
|
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)
|
const cur = feeChargeModeOf(row)
|
||||||
if (cur && !list.some(d => String(d.value) === String(cur))) {
|
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
|
return list
|
||||||
}
|
}
|
||||||
|
|
||||||
function setFeeChargeMode(row, value) {
|
function setFeeChargeMode(row, value) {
|
||||||
const mode = String(value || '').trim().toUpperCase()
|
const mode = String(value || '').trim().toUpperCase()
|
||||||
row.calcRule = mode || 'MANUAL'
|
row.calcRule = mode || 'ALWAYS'
|
||||||
}
|
}
|
||||||
|
|
||||||
const pageSize = 20
|
const pageSize = 20
|
||||||
@@ -692,17 +712,38 @@ function openFeePicker(pane) {
|
|||||||
|
|
||||||
function toCalcRule(chargeType) {
|
function toCalcRule(chargeType) {
|
||||||
const t = String(chargeType || '').trim().toUpperCase()
|
const t = String(chargeType || '').trim().toUpperCase()
|
||||||
if (!t || t === 'RATE') return 'MANUAL'
|
if (!t) return 'ALWAYS'
|
||||||
if (t === 'FIXED') return 'ITEM'
|
if (t === 'RATE') return 'MANUAL'
|
||||||
const allowed = ['ITEM', 'PER_KG', 'ALWAYS', 'POSTCODE', 'ZONE', 'EXTRA_KG', 'WEIGHT', 'SIZE', 'RETURN', 'MANUAL']
|
if (t === 'FIXED' || t === 'ITEM' || t === 'FLAT') return 'ALWAYS'
|
||||||
if (t === 'ALWAYS') return 'ITEM'
|
const allowed = ['ALWAYS', 'POSTCODE', 'ZONE', 'EXTRA_KG', 'WEIGHT', 'SIZE', 'RETURN', 'MANUAL']
|
||||||
return allowed.includes(t) ? t : '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) {
|
function configToFeeRow(cfg, product) {
|
||||||
const currency = String(cfg?.currency || product?.currency || 'EUR').trim().toUpperCase() || 'EUR'
|
const currency = String(cfg?.currency || product?.currency || 'EUR').trim().toUpperCase() || 'EUR'
|
||||||
const amount = cfg?.chargeValue
|
const amount = cfg?.chargeValue
|
||||||
const isPercent = String(cfg?.chargeType || '').toUpperCase() === 'RATE'
|
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 {
|
return {
|
||||||
feeName: String(cfg?.scName || '').trim(),
|
feeName: String(cfg?.scName || '').trim(),
|
||||||
scId: cfg?.scId,
|
scId: cfg?.scId,
|
||||||
@@ -711,9 +752,10 @@ function configToFeeRow(cfg, product) {
|
|||||||
amount: amount == null ? '' : amount,
|
amount: amount == null ? '' : amount,
|
||||||
currency,
|
currency,
|
||||||
priceUnit: isPercent ? '%' : (currency + '/ITEM'),
|
priceUnit: isPercent ? '%' : (currency + '/ITEM'),
|
||||||
feeDesc: String(cfg?.scNote || '').trim(),
|
feeDesc: String(cfg?.scNote || '').trim() || '从附加费类型字典迁移',
|
||||||
calcRule: toCalcRule(cfg?.chargeType),
|
calcRule,
|
||||||
calcParam: ''
|
calcParam,
|
||||||
|
postcodeParam
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -167,6 +167,45 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</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 }">
|
<template #col-product="{ row }">
|
||||||
{{ row.productName || '-' }} ({{ row.productCode || '-' }})
|
{{ row.productName || '-' }} ({{ row.productCode || '-' }})
|
||||||
</template>
|
</template>
|
||||||
@@ -586,6 +625,30 @@ const tableHeight = ref(480)
|
|||||||
let tableResizeObserver = null
|
let tableResizeObserver = null
|
||||||
const MAX_ORDER_IDENTIFIERS = 1000
|
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 = {
|
const defaultParams = {
|
||||||
orderStatuses: [3, 4, 5, 6, 7, 8, 11],
|
orderStatuses: [3, 4, 5, 6, 7, 8, 11],
|
||||||
billingFailStatuses: []
|
billingFailStatuses: []
|
||||||
@@ -593,9 +656,9 @@ const defaultParams = {
|
|||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{ label: '计费状态', prop: 'billingFailStatus', align: 'center', width: 160, fixed: 'left', slot: 'billingFailStatus' },
|
{ label: '计费状态', prop: 'billingFailStatus', align: 'center', width: 160, fixed: 'left', slot: 'billingFailStatus' },
|
||||||
{ label: '订单号', prop: 'orderNo', width: 160, fixed: 'left', showOverflowTooltip: true },
|
{ label: '订单号', prop: 'orderNo', width: 190, fixed: 'left', slot: 'orderNo', showOverflowTooltip: true },
|
||||||
{ label: '运单号', prop: 'trackingNo', minWidth: 140, showOverflowTooltip: true },
|
{ label: '运单号', prop: 'trackingNo', minWidth: 160, slot: 'trackingNo', showOverflowTooltip: true },
|
||||||
{ label: '转单号', prop: 'transferNo', minWidth: 140, showOverflowTooltip: true },
|
{ label: '转单号', prop: 'transferNo', minWidth: 160, slot: 'transferNo', showOverflowTooltip: true },
|
||||||
{ label: '客户', prop: 'customerName', minWidth: 140, showOverflowTooltip: true },
|
{ label: '客户', prop: 'customerName', minWidth: 140, showOverflowTooltip: true },
|
||||||
{ label: '客户代码', prop: 'customerCode', width: 120 },
|
{ label: '客户代码', prop: 'customerCode', width: 120 },
|
||||||
{ label: '产品', prop: 'product', minWidth: 160, slot: 'product' },
|
{ label: '产品', prop: 'product', minWidth: 160, slot: 'product' },
|
||||||
@@ -1409,6 +1472,24 @@ onBeforeUnmount(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<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-select),
|
||||||
.order-bill-query :deep(.basic-form .el-form-item .el-input),
|
.order-bill-query :deep(.basic-form .el-form-item .el-input),
|
||||||
.order-bill-query :deep(.basic-form .el-form-item .el-date-editor) {
|
.order-bill-query :deep(.basic-form .el-form-item .el-date-editor) {
|
||||||
|
|||||||
Reference in New Issue
Block a user