修改附加费操作

This commit is contained in:
wuweihua
2026-09-22 10:15:17 +08:00
parent 33a29e32c1
commit ba81700463
14 changed files with 397 additions and 98 deletions
@@ -100,16 +100,6 @@ const schemas = computed(() => [
width: '100%',
props: { filterable: true, clearable: true }
},
{
label: "状态",
prop: 'ssCode',
component: 'radio',
span: 12,
options: [
{ label: "有效", value: 'on' },
{ label: "停用", value: 'of' }
]
},
{
label: "备注",
prop: 'scNote',
@@ -130,7 +120,6 @@ function emptyForm() {
chargeValue: undefined,
currency: 'CNY',
roundMode: 'HALF_UP',
ssCode: 'on',
countryCode: undefined,
scNote: undefined
}
@@ -163,7 +152,6 @@ function open(row) {
}
getSurcharge(row.scId).then(res => {
const data = res.data || {}
if (data.ssCode) data.ssCode = String(data.ssCode).toLowerCase()
form.value = { ...emptyForm(), ...data }
title.value = "修改附加费"
visible.value = true
@@ -182,6 +170,8 @@ function submitForm() {
proxy.$modal.msgSuccess(payload.scId != null ? "修改成功" : "新增成功")
visible.value = false
emit('success')
}).catch(() => {
// 后端返回 warn(601「未做任何修改」) 时由全局拦截器弹提示,此处吞掉 reject
})
})
}
@@ -0,0 +1,149 @@
<template>
<el-drawer v-model="visible" size="960px" title="作废附加费记录" append-to-body>
<el-form :inline="true" @submit.prevent>
<el-form-item label="附加费名称">
<el-input
v-model="queryParams.scName"
placeholder="请输入名称"
clearable
style="width: 200px"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="list" border max-height="calc(100vh - 300px)" empty-text="暂无作废记录">
<el-table-column label="附加费名称" prop="scName" min-width="140" show-overflow-tooltip />
<el-table-column label="费用类型" width="90" align="center">
<template #default="{ row }">{{ feeTypeLabel(row.feeType) }}</template>
</el-table-column>
<el-table-column label="计费方式" width="110" align="center">
<template #default="{ row }">{{ chargeTypeLabel(row.chargeType) }}</template>
</el-table-column>
<el-table-column label="计费数值" width="130" align="right">
<template #default="{ row }">
<span class="charge-value">{{ formatChargeValue(row) }}</span>
</template>
</el-table-column>
<el-table-column label="取值方式" width="100" align="center">
<template #default="{ row }">{{ roundModeLabel(row.roundMode) }}</template>
</el-table-column>
<el-table-column label="适用国家" width="110" align="center">
<template #default="{ row }">{{ countryLabel(row.countryCode) }}</template>
</el-table-column>
<el-table-column label="状态" width="80" align="center">
<template #default>
<el-tag type="danger" size="small">作废</el-tag>
</template>
</el-table-column>
<el-table-column label="备注" prop="scNote" min-width="120" show-overflow-tooltip />
<el-table-column label="创建时间" width="160" align="center">
<template #default="{ row }">{{ timeStr(row.createTime) }}</template>
</el-table-column>
<el-table-column label="作废时间" width="160" align="center">
<template #default="{ row }">{{ timeStr(row.updateTime) }}</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="loadList"
/>
</el-drawer>
</template>
<script setup>
import { onMounted } from 'vue'
import { listSurcharge } from '@/api/price/surcharge'
import { listRegionOptions } from '@/api/data/region'
// 只读抽屉:查看已被版本化编辑淘汰的作废记录(ss_code = vd)
const { proxy } = getCurrentInstance()
const { bms_charge_type, bms_round_mode, bms_fee_type } = useDict('bms_charge_type', 'bms_round_mode', 'bms_fee_type')
const visible = ref(false)
const loading = ref(false)
const list = ref([])
const total = ref(0)
const regionOptions = ref([])
const queryParams = ref({ pageNum: 1, pageSize: 10, scName: undefined })
function open() {
visible.value = true
resetQuery()
}
function loadList() {
loading.value = true
listSurcharge({ ...queryParams.value, ssCode: 'vd' }).then(res => {
list.value = res.rows || []
total.value = res.total || 0
}).finally(() => {
loading.value = false
})
}
function handleQuery() {
queryParams.value.pageNum = 1
loadList()
}
function resetQuery() {
queryParams.value = { pageNum: 1, pageSize: 10, scName: undefined }
loadList()
}
function feeTypeLabel(val) {
const found = bms_fee_type.value.find(d => d.value === val)
return found ? found.label : (val || '-')
}
function chargeTypeLabel(val) {
const found = bms_charge_type.value.find(d => d.value === val)
return found ? found.label : (val || '-')
}
function roundModeLabel(val) {
const found = bms_round_mode.value.find(d => d.value === val)
return found ? found.label : (val || '-')
}
function formatChargeValue(row) {
if (row.chargeValue == null) return '-'
const v = Number(row.chargeValue)
if (row.chargeType === 'RATE') return (v * 100).toFixed(2) + '%'
return v + ' ' + (row.currency || 'CNY')
}
function countryLabel(code) {
if (!code) return '全部'
const found = regionOptions.value.find(r => r.countryCode2 === code)
return found ? (found.countryNameCn || found.countryNameEn || code) : code
}
function timeStr(val) {
return val ? proxy.parseTime(val, '{y}-{m}-{d} {h}:{i}:{s}') : '-'
}
onMounted(() => {
listRegionOptions().then(res => {
regionOptions.value = res.data || []
})
})
defineExpose({ open })
</script>
<style scoped>
.charge-value {
font-weight: 600;
color: #d63031;
}
</style>