Merge branch 'test' of https://git.lionquexpress.com/wuweihua/BMS into test
This commit is contained in:
@@ -77,6 +77,7 @@ function loadList() {
|
||||
listPayPostcodeLine({
|
||||
countryCode: country.value?.countryCode,
|
||||
countryName: country.value?.countryName,
|
||||
channelName: country.value?.channelName || '',
|
||||
zoneName: zone.value.zoneName,
|
||||
postcode: query.value.postcode || undefined,
|
||||
pageNum: query.value.pageNum,
|
||||
|
||||
@@ -43,6 +43,7 @@ function open(country, zoneRow, row) {
|
||||
lineId: row.lineId,
|
||||
countryCode: country?.countryCode,
|
||||
countryName: country?.countryName,
|
||||
channelName: country?.channelName || '',
|
||||
zoneName: zoneRow?.zoneName,
|
||||
cityName: row.cityName || row.regionName || '',
|
||||
postcode: row.postcode,
|
||||
@@ -51,6 +52,7 @@ function open(country, zoneRow, row) {
|
||||
: {
|
||||
countryCode: country?.countryCode,
|
||||
countryName: country?.countryName,
|
||||
channelName: country?.channelName || '',
|
||||
zoneName: zoneRow?.zoneName,
|
||||
cityName: '',
|
||||
postcode: '',
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<div class="zone-toolbar">
|
||||
<el-button type="primary" plain icon="Plus" size="small" :disabled="!country" @click="handleAdd" v-hasPermi="['data:payPostcode:edit']">新增分区</el-button>
|
||||
</div>
|
||||
<el-table :data="zoneList" border row-key="zoneName" :empty-text="country ? '这个国家还没有分区' : '请选择国家'">
|
||||
<el-table :data="zoneList" border :row-key="rowKey" :empty-text="country ? '这个国家还没有分区' : '请选择国家'">
|
||||
<el-table-column label="分区" min-width="180" align="center">
|
||||
<template #default="{ row }">
|
||||
<div class="zone-country-cell">
|
||||
@@ -24,6 +24,9 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="渠道" min-width="140" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ row.channelName || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="邮编属性" width="120" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.coverage" size="small" :type="coverageType(firstPart(row.coverage))">{{ coverageLabel(firstPart(row.coverage)) }}</el-tag>
|
||||
@@ -64,7 +67,8 @@ const lineRef = ref()
|
||||
const coverageOptions = [
|
||||
{ label: '可达', value: 'REACH' },
|
||||
{ label: '不可达', value: 'UNREACH' },
|
||||
{ label: '偏远', value: 'REMOTE' }
|
||||
{ label: '偏远', value: 'REMOTE' },
|
||||
{ label: '附加费', value: 'SURCHARGE' }
|
||||
]
|
||||
|
||||
function firstPart(value) {
|
||||
@@ -78,9 +82,14 @@ function coverageLabel(value) {
|
||||
function coverageType(value) {
|
||||
if (value === 'UNREACH') return 'danger'
|
||||
if (value === 'REMOTE') return 'warning'
|
||||
if (value === 'SURCHARGE') return 'primary'
|
||||
return 'success'
|
||||
}
|
||||
|
||||
function rowKey(row) {
|
||||
return (row.zoneName || '') + '||' + (row.channelName || '')
|
||||
}
|
||||
|
||||
function open(row) {
|
||||
country.value = row
|
||||
visible.value = true
|
||||
@@ -93,7 +102,11 @@ function loadList() {
|
||||
return
|
||||
}
|
||||
loading.value = true
|
||||
listPayPostcodeZone({ countryCode: country.value.countryCode, countryName: country.value.countryName }).then(res => {
|
||||
listPayPostcodeZone({
|
||||
countryCode: country.value.countryCode,
|
||||
countryName: country.value.countryName,
|
||||
allChannels: true
|
||||
}).then(res => {
|
||||
zoneList.value = res.data || []
|
||||
}).catch(() => {
|
||||
zoneList.value = []
|
||||
@@ -116,10 +129,12 @@ function handleEdit(row) {
|
||||
}
|
||||
|
||||
function handleDelete(row) {
|
||||
proxy.$modal.confirm('删除分区「' + row.zoneName + '」及其邮编?').then(() => {
|
||||
const channel = row.channelName ? '(' + row.channelName + ')' : ''
|
||||
proxy.$modal.confirm('删除分区「' + row.zoneName + '」' + channel + '及其邮编?').then(() => {
|
||||
return delPayPostcodeZone({
|
||||
countryCode: country.value.countryCode,
|
||||
countryName: country.value.countryName,
|
||||
channelName: row.channelName || '',
|
||||
zoneName: row.zoneName
|
||||
})
|
||||
}).then(() => {
|
||||
@@ -129,7 +144,7 @@ function handleDelete(row) {
|
||||
}
|
||||
|
||||
function openLines(row) {
|
||||
lineRef.value.open(country.value, row)
|
||||
lineRef.value.open({ ...country.value, channelName: row.channelName || '' }, row)
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
<el-form-item label="国家">
|
||||
<span>{{ country?.countryName || '-' }}<template v-if="country?.countryCode">({{ country.countryCode }})</template></span>
|
||||
</el-form-item>
|
||||
<el-form-item label="渠道" prop="channelName">
|
||||
<el-input v-if="!form.oldZoneName" v-model="form.channelName" maxlength="100" placeholder="这个分区所属渠道" />
|
||||
<span v-else>{{ form.channelName || '未填写渠道' }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="分区" prop="zoneName">
|
||||
<el-input v-model="form.zoneName" maxlength="200" placeholder="例如 mainland" />
|
||||
</el-form-item>
|
||||
@@ -39,7 +43,8 @@ const rules = {
|
||||
const coverageOptions = [
|
||||
{ label: '可达', value: 'REACH' },
|
||||
{ label: '不可达', value: 'UNREACH' },
|
||||
{ label: '偏远', value: 'REMOTE' }
|
||||
{ label: '偏远', value: 'REMOTE' },
|
||||
{ label: '附加费', value: 'SURCHARGE' }
|
||||
]
|
||||
|
||||
function open(row) {
|
||||
@@ -47,6 +52,7 @@ function open(row) {
|
||||
? {
|
||||
countryCode: props.country?.countryCode,
|
||||
countryName: props.country?.countryName,
|
||||
channelName: row.channelName || '',
|
||||
oldZoneName: row.zoneName,
|
||||
zoneName: row.zoneName,
|
||||
coverage: String(row.coverage || '').split('、')[0] || ''
|
||||
@@ -54,6 +60,7 @@ function open(row) {
|
||||
: {
|
||||
countryCode: props.country?.countryCode,
|
||||
countryName: props.country?.countryName,
|
||||
channelName: '',
|
||||
zoneName: '',
|
||||
coverage: ''
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
:closable="false"
|
||||
show-icon
|
||||
class="mb16"
|
||||
title="每个国家一行。点「分区」维护分区和邮编。偏远分区按目的国家参与应付偏远附加费;某个产品的报价表自己已经挂了偏远名单时,仍只用那一份。"
|
||||
title="每个国家一行,多个渠道用顿号分隔。点「分区」后,各渠道的分区分开显示。订单计费只拿本渠道的邮编对分区。"
|
||||
/>
|
||||
|
||||
<basic-table
|
||||
@@ -35,7 +35,7 @@
|
||||
</basic-table>
|
||||
|
||||
<el-dialog v-model="open" title="导入应付邮编" width="480px" append-to-body destroy-on-close>
|
||||
<p class="import-tip">导入后按国家归成一行。表头里带邮编或附加费的工作表会被导入。可达、可派记为可达,不可达记为不可达,偏远和岛屿记为偏远。</p>
|
||||
<!-- <p class="import-tip">导入后按国家归成一行。表头里带邮编或附加费的工作表会被导入。可达、可派记为可达,不可达记为不可达,偏远和岛屿记为偏远。英国附加费里的空气减排地区和空气减排地区邮编记为附加费,渠道为 Evri 48H。</p>-->
|
||||
<el-upload :auto-upload="false" :limit="1" accept=".xlsx" :on-change="onFile" :on-remove="() => file = null">
|
||||
<el-button type="primary" plain>选择 xlsx</el-button>
|
||||
</el-upload>
|
||||
@@ -56,11 +56,11 @@
|
||||
<el-form-item label="销售产品">
|
||||
<el-input v-model="form.productName" maxlength="200" />
|
||||
</el-form-item>
|
||||
<el-form-item label="渠道名称">
|
||||
<el-input v-model="form.channelName" maxlength="100" placeholder="如 Royal Mail、EVRI" />
|
||||
<el-form-item label="渠道">
|
||||
<span>{{ form.channelName || '-' }}</span>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<p class="import-tip">保存后,这个国家下的分区都使用这里的服务类型、销售产品和渠道。报价表保持不变。偏远附加费按目的国家的偏远邮编匹配,再用价卡上的分区或邮编前缀选定费用档。</p>
|
||||
<p class="import-tip">保存后,这个国家下各渠道的服务类型和销售产品一起更新。渠道仍留在各自的分区上,不在这里改。</p>
|
||||
<template #footer>
|
||||
<el-button type="primary" @click="submitEdit">确定</el-button>
|
||||
<el-button @click="editOpen = false">取消</el-button>
|
||||
@@ -87,7 +87,8 @@ const form = ref({})
|
||||
const coverageOptions = [
|
||||
{ label: '可达', value: 'REACH' },
|
||||
{ label: '不可达', value: 'UNREACH' },
|
||||
{ label: '偏远', value: 'REMOTE' }
|
||||
{ label: '偏远', value: 'REMOTE' },
|
||||
{ label: '附加费', value: 'SURCHARGE' }
|
||||
]
|
||||
|
||||
function coverageParts(value) {
|
||||
@@ -101,6 +102,7 @@ function coverageLabel(value) {
|
||||
function coverageType(value) {
|
||||
if (value === 'UNREACH') return 'danger'
|
||||
if (value === 'REMOTE') return 'warning'
|
||||
if (value === 'SURCHARGE') return 'primary'
|
||||
return 'success'
|
||||
}
|
||||
|
||||
@@ -167,7 +169,7 @@ function handleUpdate(row) {
|
||||
countryName: row.countryName,
|
||||
serviceType: firstPart(row.serviceType),
|
||||
productName: firstPart(row.productName),
|
||||
channelName: firstPart(row.channelName)
|
||||
channelName: row.channelName || ''
|
||||
}
|
||||
editOpen.value = true
|
||||
}
|
||||
@@ -183,7 +185,7 @@ function submitEdit() {
|
||||
function handleClear(row) {
|
||||
const name = row.countryName || row.countryCode
|
||||
proxy.$modal.confirm('清空「' + name + '」下的全部分区和邮编?计费将不再使用这些邮编。').then(() => {
|
||||
return delPayPostcodeCountry({ countryCode: row.countryCode, countryName: row.countryName })
|
||||
return delPayPostcodeCountry({ countryCode: row.countryCode, countryName: row.countryName, allChannels: true })
|
||||
}).then(() => {
|
||||
proxy.$modal.msgSuccess('已清空')
|
||||
reload()
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<el-option v-for="item in available" :key="item.scId" :label="optionLabel(item)" :value="item.scId" />
|
||||
</el-select>
|
||||
<el-button type="primary" plain class="add" @click="addPicked">添加</el-button>
|
||||
<p class="hint">从附加费配置里选择。长宽高、重量和邮编在配置里维护,这里只选用。</p>
|
||||
<p class="hint">从附加费配置里选择。长宽高、体积、重量和邮编在配置里维护,这里只选用。</p>
|
||||
</section>
|
||||
<section class="chosen">
|
||||
<div class="pane-title">已选附加费</div>
|
||||
@@ -84,6 +84,19 @@ function valueText(row) {
|
||||
return `${row.amount} ${row.currency || ''}`.trim()
|
||||
}
|
||||
|
||||
function configMeasure(item) {
|
||||
return {
|
||||
lengthCm: item.lengthCm,
|
||||
widthCm: item.widthCm,
|
||||
heightCm: item.heightCm,
|
||||
sizeType: item.sizeType,
|
||||
volumeM3: item.volumeM3,
|
||||
overWeightKg: item.overWeightKg,
|
||||
extraWeightKg: item.extraWeightKg,
|
||||
postcodeText: item.postcodeText || ''
|
||||
}
|
||||
}
|
||||
|
||||
function rowFromConfig(item) {
|
||||
return {
|
||||
scId: item.scId,
|
||||
@@ -92,12 +105,7 @@ function rowFromConfig(item) {
|
||||
amount: item.chargeValue,
|
||||
currency: item.currency,
|
||||
zoneName: item.blockTitle || '',
|
||||
lengthCm: item.lengthCm,
|
||||
widthCm: item.widthCm,
|
||||
heightCm: item.heightCm,
|
||||
overWeightKg: item.overWeightKg,
|
||||
extraWeightKg: item.extraWeightKg,
|
||||
postcodeText: item.postcodeText || ''
|
||||
...configMeasure(item)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,6 +125,12 @@ function removeRow(row) {
|
||||
|
||||
function conditionText(row) {
|
||||
if (row.calcRule === 'SIZE') {
|
||||
if (String(row.sizeType || '').trim().toUpperCase() === 'VOLUME') {
|
||||
if (Number(row.volumeM3) > 0) {
|
||||
return `体积超过 ${row.volumeM3} m³`
|
||||
}
|
||||
return '体积还没在附加费配置里填写'
|
||||
}
|
||||
if (Number(row.lengthCm) > 0 && Number(row.widthCm) > 0 && Number(row.heightCm) > 0) {
|
||||
return `长 ${row.lengthCm} cm,宽 ${row.widthCm} cm,高 ${row.heightCm} cm`
|
||||
}
|
||||
@@ -164,12 +178,7 @@ async function open(row) {
|
||||
amount: item.amount,
|
||||
currency: item.currency,
|
||||
zoneName: item.zoneName || '',
|
||||
lengthCm: item.lengthCm,
|
||||
widthCm: item.widthCm,
|
||||
heightCm: item.heightCm,
|
||||
overWeightKg: item.overWeightKg,
|
||||
extraWeightKg: item.extraWeightKg,
|
||||
postcodeText: item.postcodeText || ''
|
||||
...configMeasure(item)
|
||||
}))
|
||||
} finally {
|
||||
loading.value = false
|
||||
|
||||
@@ -36,6 +36,19 @@
|
||||
<el-table-column prop="zoneName" label="分区" min-width="140" show-overflow-tooltip>
|
||||
<template #default="{ row }"><cell-text v-model="row.zoneName" :edit="isRowEditing(row)" /></template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="calcRule" label="计费条件" width="110" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-select v-if="isRowEditing(row)" v-model="row.calcRule" clearable size="small" placeholder="不限">
|
||||
<el-option label="邮编" value="POSTCODE" />
|
||||
<el-option label="尺寸" value="SIZE" />
|
||||
<el-option label="重量" value="WEIGHT" />
|
||||
</el-select>
|
||||
<span v-else>{{ bandRuleLabel(row.calcRule) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="calcParam" label="条件参数" min-width="150" show-overflow-tooltip>
|
||||
<template #default="{ row }"><cell-text v-model="row.calcParam" :edit="isRowEditing(row)" /></template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="weightLabel" label="重量段" min-width="120" show-overflow-tooltip>
|
||||
<template #default="{ row }"><cell-text v-model="row.weightLabel" :edit="isRowEditing(row)" /></template>
|
||||
</el-table-column>
|
||||
@@ -54,12 +67,18 @@
|
||||
<span v-else>{{ money(row.price) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="续重价" width="110" align="right">
|
||||
<template #default="{ row }">
|
||||
<el-input v-if="isRowEditing(row)" v-model="row._extraPrice" size="small" />
|
||||
<span v-else>{{ money(extraPrice(pane, row)) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="priceUnit" label="单位" width="110" show-overflow-tooltip>
|
||||
<template #default="{ row }"><cell-text v-model="row.priceUnit" :edit="isRowEditing(row)" /></template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="editable" label="操作" width="120" align="center" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button v-if="!isRowEditing(row)" link type="primary" :disabled="rowBusy" @click="startEdit(row)">修改</el-button>
|
||||
<el-button v-if="!isRowEditing(row)" link type="primary" :disabled="rowBusy" @click="startBandEdit(pane, row)">修改</el-button>
|
||||
<el-button v-else link type="primary" :disabled="rowBusy" @click="saveBandRow(pane, row)">保存</el-button>
|
||||
<el-button link type="danger" :disabled="rowBusy" @click="removeRow(pane.item.weightBands, row)">删除</el-button>
|
||||
</template>
|
||||
@@ -367,7 +386,14 @@ function runSave(kind, pane, row) {
|
||||
}, 8000)
|
||||
}
|
||||
|
||||
function startBandEdit(pane, row) {
|
||||
const current = extraPrice(pane, row)
|
||||
row._extraPrice = current == null ? '' : String(current)
|
||||
startEdit(row)
|
||||
}
|
||||
|
||||
function saveBandRow(pane, row) {
|
||||
if (!applyExtraPrice(pane, row)) return
|
||||
runSave('band', pane, row)
|
||||
}
|
||||
|
||||
@@ -526,7 +552,7 @@ watch(source, (list) => {
|
||||
}, { immediate: true })
|
||||
|
||||
function filteredBands(pane) {
|
||||
return filterRows(pane.item.weightBands || [], pane.bandKeyword, ['sectionName', 'countryName', 'countryCode', 'zoneName', 'weightLabel', 'chargeName', 'priceUnit'])
|
||||
return filterRows(pane.item.weightBands || [], pane.bandKeyword, ['sectionName', 'countryName', 'countryCode', 'zoneName', 'calcRule', 'calcParam', 'weightLabel', 'chargeName', 'priceUnit'])
|
||||
}
|
||||
|
||||
function filteredFees(pane) {
|
||||
@@ -705,11 +731,82 @@ function filterRows(rows, keyword, fields) {
|
||||
return rows.filter(row => fields.some(field => String(row?.[field] ?? '').toLowerCase().includes(text)))
|
||||
}
|
||||
|
||||
function bandRuleLabel(rule) {
|
||||
const value = String(rule || '').toUpperCase()
|
||||
if (value === 'POSTCODE') return '邮编'
|
||||
if (value === 'SIZE') return '尺寸'
|
||||
if (value === 'WEIGHT') return '重量'
|
||||
return ''
|
||||
}
|
||||
|
||||
function pageOf(rows, pageNo) {
|
||||
const start = (pageNo - 1) * pageSize
|
||||
return rows.slice(start, start + pageSize)
|
||||
}
|
||||
|
||||
function zoneKey(value) {
|
||||
return String(value || '').toLowerCase().replace(/[^a-z0-9\u4e00-\u9fa5]/g, '')
|
||||
}
|
||||
|
||||
function sameZone(left, right) {
|
||||
const a = zoneKey(left)
|
||||
const b = zoneKey(right)
|
||||
return !!a && (a === b || a.includes(b) || b.includes(a))
|
||||
}
|
||||
|
||||
function findExtraFee(pane, row) {
|
||||
const section = String(row?.sectionName || '').trim()
|
||||
const rowZone = String(row?.zoneName || '').trim()
|
||||
const matched = (pane?.item?.surcharges || []).filter(fee => {
|
||||
if (!fee || String(fee.calcRule || '').toUpperCase() !== 'EXTRA_KG') return false
|
||||
if (fee.sectionName === '附加费配置') return false
|
||||
if (String(fee.postcodeParam || '').trim() || String(fee.postcodeText || '').trim()) return false
|
||||
const feeSection = String(fee.sectionName || '').trim()
|
||||
if (section && feeSection && section !== feeSection) return false
|
||||
const feeZone = String(fee.zoneName || '').trim()
|
||||
if (!feeZone && !rowZone) return true
|
||||
return sameZone(feeZone, rowZone)
|
||||
})
|
||||
return matched.find(fee => fee.amount != null && fee.amount !== '') || matched[0] || null
|
||||
}
|
||||
|
||||
function extraPrice(pane, row) {
|
||||
const matched = findExtraFee(pane, row)
|
||||
if (!matched || matched.amount == null || matched.amount === '') return null
|
||||
return matched.amount
|
||||
}
|
||||
|
||||
function applyExtraPrice(pane, row) {
|
||||
const text = String(row?._extraPrice ?? '').trim()
|
||||
if (text && !Number.isFinite(Number(text))) {
|
||||
proxy.$modal.msgWarning('续重价要填数字')
|
||||
return false
|
||||
}
|
||||
const fee = findExtraFee(pane, row)
|
||||
if (!text) {
|
||||
if (fee) fee.amount = null
|
||||
return true
|
||||
}
|
||||
if (fee) {
|
||||
fee.amount = text
|
||||
return true
|
||||
}
|
||||
if (!pane.item.surcharges) pane.item.surcharges = []
|
||||
const currency = String(pane.item.currency || 'CNY').trim().toUpperCase() || 'CNY'
|
||||
pane.item.surcharges.push({
|
||||
feeName: '每公斤续重',
|
||||
sectionName: row.sectionName || '派送费',
|
||||
zoneName: row.zoneName || '',
|
||||
calcRule: 'EXTRA_KG',
|
||||
amount: text,
|
||||
currency,
|
||||
priceUnit: currency + '/KG',
|
||||
calcParam: row.weightMax == null || row.weightMax === '' ? '' : String(row.weightMax),
|
||||
chargeTiming: '产生时收取'
|
||||
})
|
||||
return true
|
||||
}
|
||||
|
||||
function money(value) {
|
||||
if (value === null || value === undefined || value === '') return '-'
|
||||
const num = Number(value)
|
||||
|
||||
@@ -66,6 +66,18 @@
|
||||
<el-table-column label="分区" min-width="120">
|
||||
<template #default="{ row }"><el-input v-model="row.zoneName" size="small" placeholder="不分区可空" /></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="计费条件" width="110">
|
||||
<template #default="{ row }">
|
||||
<el-select v-model="row.calcRule" clearable size="small" placeholder="不限">
|
||||
<el-option label="邮编" value="POSTCODE" />
|
||||
<el-option label="尺寸" value="SIZE" />
|
||||
<el-option label="重量" value="WEIGHT" />
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="条件参数" min-width="160">
|
||||
<template #default="{ row }"><el-input v-model="row.calcParam" size="small" placeholder="07 / side:80 / 30" /></template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="form.chargeType !== 'EXTRA'" label="重量下限KG" width="120">
|
||||
<template #default="{ row }"><el-input v-model="row.weightMin" size="small" /></template>
|
||||
</el-table-column>
|
||||
@@ -186,7 +198,7 @@ function onMode() {
|
||||
}
|
||||
|
||||
function blankRow() {
|
||||
return { countryName: '', countryCode: '', zoneName: '', weightMin: '0', weightMax: '', price: '', extraPrice: '' }
|
||||
return { countryName: '', countryCode: '', zoneName: '', calcRule: '', calcParam: '', weightMin: '0', weightMax: '', price: '', extraPrice: '' }
|
||||
}
|
||||
|
||||
function addRow() {
|
||||
@@ -235,6 +247,8 @@ async function submit() {
|
||||
countryName: row.countryName,
|
||||
countryCode: row.countryCode,
|
||||
zoneName: row.zoneName,
|
||||
calcRule: row.calcRule,
|
||||
calcParam: row.calcParam,
|
||||
weightMin: 0,
|
||||
weightMax: firstKg,
|
||||
price
|
||||
@@ -253,6 +267,8 @@ async function submit() {
|
||||
countryName: row.countryName,
|
||||
countryCode: row.countryCode,
|
||||
zoneName: row.zoneName,
|
||||
calcRule: row.calcRule,
|
||||
calcParam: row.calcParam,
|
||||
weightMin: min,
|
||||
weightMax: max,
|
||||
price
|
||||
|
||||
@@ -29,6 +29,7 @@ const calcModeOptions = [
|
||||
{ value: 'MANUAL', label: '暂不计费' },
|
||||
{ value: 'ALWAYS', label: '每票都收' },
|
||||
{ value: 'POSTCODE', label: '命中邮编' },
|
||||
{ value: 'FEE_POSTCODE', label: '附加费邮编' },
|
||||
{ value: 'ZONE', label: '命中分区' },
|
||||
{ value: 'EXTRA_KG', label: '超重续收' },
|
||||
{ value: 'WEIGHT', label: '超重' },
|
||||
@@ -50,6 +51,8 @@ const blockSelectOptions = computed(() =>
|
||||
|
||||
const chargeType = computed(() => String(form.value.chargeType || '').toUpperCase())
|
||||
|
||||
const sizeKind = computed(() => String(form.value.sizeType || '').toUpperCase())
|
||||
|
||||
const schemas = computed(() => [
|
||||
{
|
||||
label: '附加费名称',
|
||||
@@ -81,15 +84,26 @@ const schemas = computed(() => [
|
||||
width: '100%',
|
||||
rules: [{ required: true, message: '请选择计费方式', trigger: 'change' }]
|
||||
},
|
||||
{
|
||||
label: '超尺寸类型',
|
||||
prop: 'sizeType',
|
||||
component: 'select',
|
||||
placeholder: '请选择',
|
||||
dict: 'bms_size_type',
|
||||
span: 12,
|
||||
width: '100%',
|
||||
show: chargeType.value === 'SIZE',
|
||||
rules: chargeType.value === 'SIZE' ? [{ required: true, message: '请选择超尺寸类型', trigger: 'change' }] : undefined
|
||||
},
|
||||
{
|
||||
label: '长(cm)',
|
||||
prop: 'lengthCm',
|
||||
component: 'inputNumber',
|
||||
span: 12,
|
||||
width: '100%',
|
||||
show: chargeType.value === 'SIZE',
|
||||
show: chargeType.value === 'SIZE' && sizeKind.value === 'SIDE',
|
||||
props: { min: 0, precision: 2, controls: false, align: 'left' },
|
||||
rules: chargeType.value === 'SIZE' ? [{ required: true, message: '请填写长', trigger: 'blur' }] : undefined
|
||||
rules: chargeType.value === 'SIZE' && sizeKind.value === 'SIDE' ? [{ required: true, message: '请填写长', trigger: 'blur' }] : undefined
|
||||
},
|
||||
{
|
||||
label: '宽(cm)',
|
||||
@@ -97,9 +111,9 @@ const schemas = computed(() => [
|
||||
component: 'inputNumber',
|
||||
span: 12,
|
||||
width: '100%',
|
||||
show: chargeType.value === 'SIZE',
|
||||
show: chargeType.value === 'SIZE' && sizeKind.value === 'SIDE',
|
||||
props: { min: 0, precision: 2, controls: false, align: 'left' },
|
||||
rules: chargeType.value === 'SIZE' ? [{ required: true, message: '请填写宽', trigger: 'blur' }] : undefined
|
||||
rules: chargeType.value === 'SIZE' && sizeKind.value === 'SIDE' ? [{ required: true, message: '请填写宽', trigger: 'blur' }] : undefined
|
||||
},
|
||||
{
|
||||
label: '高(cm)',
|
||||
@@ -107,9 +121,20 @@ const schemas = computed(() => [
|
||||
component: 'inputNumber',
|
||||
span: 12,
|
||||
width: '100%',
|
||||
show: chargeType.value === 'SIZE',
|
||||
show: chargeType.value === 'SIZE' && sizeKind.value === 'SIDE',
|
||||
props: { min: 0, precision: 2, controls: false, align: 'left' },
|
||||
rules: chargeType.value === 'SIZE' ? [{ required: true, message: '请填写高', trigger: 'blur' }] : undefined
|
||||
rules: chargeType.value === 'SIZE' && sizeKind.value === 'SIDE' ? [{ required: true, message: '请填写高', trigger: 'blur' }] : undefined
|
||||
},
|
||||
{
|
||||
label: '体积值/m³',
|
||||
prop: 'volumeM3',
|
||||
component: 'inputNumber',
|
||||
placeholder: '超过这个体积才收取',
|
||||
span: 12,
|
||||
width: '100%',
|
||||
show: chargeType.value === 'SIZE' && sizeKind.value === 'VOLUME',
|
||||
props: { min: 0, precision: 6, controls: false, align: 'left' },
|
||||
rules: chargeType.value === 'SIZE' && sizeKind.value === 'VOLUME' ? [{ required: true, message: '请填写体积', trigger: 'blur' }] : undefined
|
||||
},
|
||||
{
|
||||
label: '超过重量(kg)',
|
||||
@@ -217,6 +242,8 @@ function emptyForm() {
|
||||
countryCode: undefined,
|
||||
blockTitle: undefined,
|
||||
scNote: undefined,
|
||||
sizeType: undefined,
|
||||
volumeM3: undefined,
|
||||
lengthCm: undefined,
|
||||
widthCm: undefined,
|
||||
heightCm: undefined,
|
||||
@@ -327,6 +354,8 @@ watch(() => form.value.countryCode, (code, prev) => {
|
||||
|
||||
watch(() => form.value.chargeType, (type, prev) => {
|
||||
if (suppressCountryWatch.value || !prev || type === prev) return
|
||||
form.value.sizeType = undefined
|
||||
form.value.volumeM3 = undefined
|
||||
form.value.lengthCm = undefined
|
||||
form.value.widthCm = undefined
|
||||
form.value.heightCm = undefined
|
||||
@@ -337,6 +366,19 @@ watch(() => form.value.chargeType, (type, prev) => {
|
||||
nextTick(() => formRef.value?.clearValidate())
|
||||
})
|
||||
|
||||
watch(() => form.value.sizeType, (type, prev) => {
|
||||
if (suppressCountryWatch.value || !prev || type === prev) return
|
||||
const code = String(type || '').toUpperCase()
|
||||
if (code === 'VOLUME') {
|
||||
form.value.lengthCm = undefined
|
||||
form.value.widthCm = undefined
|
||||
form.value.heightCm = undefined
|
||||
} else if (code === 'SIDE') {
|
||||
form.value.volumeM3 = undefined
|
||||
}
|
||||
nextTick(() => formRef.value?.clearValidate())
|
||||
})
|
||||
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
|
||||
|
||||
@@ -109,6 +109,7 @@ const chargeTypeLabelMap = {
|
||||
MANUAL: '暂不计费',
|
||||
ALWAYS: '每票都收',
|
||||
POSTCODE: '命中邮编',
|
||||
FEE_POSTCODE: '附加费邮编',
|
||||
ZONE: '命中分区',
|
||||
EXTRA_KG: '超重续收',
|
||||
WEIGHT: '超重',
|
||||
|
||||
@@ -87,6 +87,7 @@ const calcModeLabelMap = {
|
||||
MANUAL: '暂不计费',
|
||||
ALWAYS: '每票都收',
|
||||
POSTCODE: '命中邮编',
|
||||
FEE_POSTCODE: '附加费邮编',
|
||||
ZONE: '命中分区',
|
||||
EXTRA_KG: '超重续收',
|
||||
WEIGHT: '超重',
|
||||
@@ -98,6 +99,8 @@ const columns = [
|
||||
{ label: '附加费名称', prop: 'scName', align: 'center', minWidth: 140, showOverflowTooltip: true },
|
||||
{ label: '费用类型', prop: 'feeType', align: 'center', width: 110, dict: 'bms_fee_type' },
|
||||
{ label: '计费方式', prop: 'chargeType', align: 'center', width: 110 },
|
||||
{ label: '超尺寸类型', prop: 'sizeType', align: 'center', width: 120, dict: 'bms_size_type' },
|
||||
{ label: '体积(m³)', prop: 'volumeM3', align: 'center', width: 110 },
|
||||
{ label: '计费数值', prop: 'chargeValue', align: 'center', width: 140 },
|
||||
{ label: '取值方式', prop: 'roundMode', align: 'center', width: 110, dict: 'bms_round_mode' },
|
||||
{ label: '适用国家', prop: 'countryCode', align: 'center', minWidth: 120, showOverflowTooltip: true },
|
||||
|
||||
Reference in New Issue
Block a user