应付邮编调整和订单应付计费的附加费调整
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>
|
||||
@@ -81,6 +84,10 @@ function coverageType(value) {
|
||||
return 'success'
|
||||
}
|
||||
|
||||
function rowKey(row) {
|
||||
return (row.zoneName || '') + '||' + (row.channelName || '')
|
||||
}
|
||||
|
||||
function open(row) {
|
||||
country.value = row
|
||||
visible.value = true
|
||||
@@ -93,7 +100,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 +127,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 +142,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>
|
||||
@@ -47,6 +51,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 +59,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
|
||||
@@ -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>
|
||||
@@ -167,7 +167,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 +183,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()
|
||||
|
||||
@@ -54,12 +54,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 +373,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)
|
||||
}
|
||||
|
||||
@@ -710,6 +723,69 @@ function pageOf(rows, pageNo) {
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user