修改附加费操作
This commit is contained in:
@@ -71,10 +71,18 @@ export function updateSurcharge(data) {
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除附加费配置 */
|
||||
export function delSurcharge(scIds) {
|
||||
/** 停用附加费配置(原地修改 ss_code=of,不新增数据、不物理删除) */
|
||||
export function disableSurcharge(scIds) {
|
||||
return request({
|
||||
url: '/price/surcharge/' + scIds,
|
||||
method: 'delete'
|
||||
url: '/price/surcharge/disable/' + scIds,
|
||||
method: 'put'
|
||||
})
|
||||
}
|
||||
|
||||
/** 启用附加费配置(原地修改 ss_code=on,不新增数据) */
|
||||
export function enableSurcharge(scIds) {
|
||||
return request({
|
||||
url: '/price/surcharge/enable/' + scIds,
|
||||
method: 'put'
|
||||
})
|
||||
}
|
||||
|
||||
@@ -19,9 +19,6 @@
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['price:product:add']">新建产品</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="selection.length !== 1 || (selection[0] && isProductActive(selection[0]))" @click="handleUpdate(selection[0])" v-hasPermi="['price:product:edit']">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="info" plain icon="Upload" @click="handleImport" v-hasPermi="['price:product:import']">导入 Excel</el-button>
|
||||
</el-col>
|
||||
|
||||
@@ -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>
|
||||
@@ -7,7 +7,7 @@
|
||||
:query="queryList"
|
||||
row-key="scId"
|
||||
>
|
||||
<template #toolbar="{ selection, ids }">
|
||||
<template #toolbar>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
@@ -19,30 +19,16 @@
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="selection.length !== 1"
|
||||
@click="handleUpdate(selection[0])"
|
||||
v-hasPermi="['price:surcharge:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="!selection.length"
|
||||
@click="handleDelete(ids)"
|
||||
v-hasPermi="['price:surcharge:remove']"
|
||||
>删除</el-button>
|
||||
icon="View"
|
||||
@click="voidDrawerRef.open()"
|
||||
v-hasPermi="['price:surcharge:list']"
|
||||
>作废记录</el-button>
|
||||
</el-col>
|
||||
</template>
|
||||
|
||||
<template #col-ssCode="{ row }">
|
||||
<el-tag :type="(row.ssCode || '').toLowerCase() === 'on' ? 'success' : 'warning'" size="small">
|
||||
{{ (row.ssCode || '').toLowerCase() === 'on' ? '有效' : '停用' }}
|
||||
</el-tag>
|
||||
<el-tag :type="ssInfo(row.ssCode).type" size="small">{{ ssInfo(row.ssCode).label }}</el-tag>
|
||||
</template>
|
||||
|
||||
<template #col-chargeType="{ row }">
|
||||
@@ -59,17 +45,34 @@
|
||||
|
||||
<template #col-action="{ row }">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(row)" v-hasPermi="['price:surcharge:edit']">编辑</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(row.scId)" v-hasPermi="['price:surcharge:remove']">删除</el-button>
|
||||
<el-button
|
||||
v-if="String(row.ssCode || '').toLowerCase() === 'on'"
|
||||
link
|
||||
type="danger"
|
||||
icon="CircleClose"
|
||||
@click="handleDisable(row.scId)"
|
||||
v-hasPermi="['price:surcharge:remove']"
|
||||
>停用</el-button>
|
||||
<el-button
|
||||
v-if="String(row.ssCode || '').toLowerCase() === 'of'"
|
||||
link
|
||||
type="success"
|
||||
icon="CircleCheck"
|
||||
@click="handleEnable(row.scId)"
|
||||
v-hasPermi="['price:surcharge:remove']"
|
||||
>启用</el-button>
|
||||
</template>
|
||||
</basic-table>
|
||||
|
||||
<surcharge-form-dialog ref="formDialogRef" @success="() => tableRef.refresh()" />
|
||||
<surcharge-void-drawer ref="voidDrawerRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="PriceSurcharge">
|
||||
import { listSurcharge, delSurcharge } from '@/api/price/surcharge'
|
||||
import { listSurcharge, disableSurcharge, enableSurcharge } from '@/api/price/surcharge'
|
||||
import SurchargeFormDialog from './components/SurchargeFormDialog.vue'
|
||||
import SurchargeVoidDrawer from './components/SurchargeVoidDrawer.vue'
|
||||
import { listRegionOptions } from '@/api/data/region'
|
||||
import { onMounted } from 'vue'
|
||||
|
||||
@@ -78,6 +81,7 @@ const { bms_charge_type } = useDict('bms_charge_type')
|
||||
|
||||
const tableRef = ref()
|
||||
const formDialogRef = ref()
|
||||
const voidDrawerRef = ref()
|
||||
const regionOptions = ref([])
|
||||
|
||||
const columns = [
|
||||
@@ -110,7 +114,8 @@ const searchColumns = [
|
||||
component: 'select',
|
||||
options: [
|
||||
{ label: '有效', value: 'on' },
|
||||
{ label: '停用', value: 'of' }
|
||||
{ label: '停用', value: 'of' },
|
||||
{ label: '作废', value: 'vd' }
|
||||
],
|
||||
placeholder: '状态',
|
||||
width: '120px'
|
||||
@@ -159,15 +164,35 @@ function handleUpdate(row) {
|
||||
formDialogRef.value.open(row)
|
||||
}
|
||||
|
||||
function handleDelete(ids) {
|
||||
function handleDisable(ids) {
|
||||
const idText = Array.isArray(ids) ? ids.join(',') : ids
|
||||
proxy.$modal.confirm('是否确认删除所选附加费配置?').then(() => {
|
||||
return delSurcharge(idText)
|
||||
proxy.$modal.confirm('是否确认停用所选附加费?停用后不再参与计费,可再启用恢复').then(() => {
|
||||
return disableSurcharge(idText)
|
||||
}).then(() => {
|
||||
proxy.$modal.msgSuccess('删除成功')
|
||||
proxy.$modal.msgSuccess('停用成功')
|
||||
tableRef.value.refresh()
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
function handleEnable(ids) {
|
||||
const idText = Array.isArray(ids) ? ids.join(',') : ids
|
||||
proxy.$modal.confirm('是否确认启用所选附加费?启用后重新参与计费').then(() => {
|
||||
return enableSurcharge(idText)
|
||||
}).then(() => {
|
||||
proxy.$modal.msgSuccess('启用成功')
|
||||
tableRef.value.refresh()
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
// 状态三态:on 有效 / of 停用 / vd 作废
|
||||
function ssInfo(code) {
|
||||
const map = {
|
||||
on: { label: '有效', type: 'success' },
|
||||
of: { label: '停用', type: 'warning' },
|
||||
vd: { label: '作废', type: 'danger' }
|
||||
}
|
||||
return map[String(code || '').toLowerCase()] || { label: code || '-', type: 'info' }
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -30,11 +30,11 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="colRegion" prop="destRegion" width="90" align="center" />
|
||||
<el-table-column :label="colTax" width="90" align="center">
|
||||
<!-- <el-table-column :label="colTax" width="90" align="center">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="bms_tax_mode" :value="row.taxMode" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
<el-table-column :label="colSurcharge" width="110" align="center">
|
||||
<template #default="{ row }">
|
||||
<surcharge-count-cell :list="productSurcharges(row)" @click="openSurcharge(row)" />
|
||||
@@ -119,7 +119,7 @@ const colName = '产品名称'
|
||||
const colLevel = '时效等级'
|
||||
const colCargo = '走货属性'
|
||||
const colRegion = '目的区域'
|
||||
const colTax = '税模式'
|
||||
// const colTax = '税模式'
|
||||
const colSurcharge = '附加费'
|
||||
const colAction = '操作'
|
||||
const colDiscount = '产品折扣'
|
||||
|
||||
Reference in New Issue
Block a user