修改附加费操作

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
@@ -108,20 +108,42 @@ public class SurchargeController extends BaseController
return toAjax(surchargeService.insertPrcSurcharge(surcharge));
}
/**
* 修改(版本化):内容无变化时返回 warn 提示,否则原记录作废 + 插入新记录,产品关联自动重指向新记录。
*/
@PreAuthorize("@ss.hasPermi('price:surcharge:edit')")
@Log(title = "附加费配置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody PrcSurcharge surcharge)
{
surcharge.setUpdateBy(getUsername());
return toAjax(surchargeService.updatePrcSurcharge(surcharge));
int rows = surchargeService.updatePrcSurcharge(surcharge);
if (rows == -1)
{
return AjaxResult.warn("未做任何修改");
}
return toAjax(rows);
}
/**
* 停用(原地修改 ss_code=of,不新增数据,不物理删除)。
*/
@PreAuthorize("@ss.hasPermi('price:surcharge:remove')")
@Log(title = "附加费配置", businessType = BusinessType.DELETE)
@DeleteMapping("/{scIds}")
public AjaxResult remove(@PathVariable Long[] scIds)
@Log(title = "附加费停用", businessType = BusinessType.UPDATE)
@PutMapping("/disable/{scIds}")
public AjaxResult disable(@PathVariable Long[] scIds)
{
return toAjax(surchargeService.deletePrcSurchargeByIds(scIds));
return toAjax(surchargeService.disablePrcSurchargeByIds(scIds, getUsername()));
}
/**
* 启用(原地修改 ss_code=on,不新增数据)。
*/
@PreAuthorize("@ss.hasPermi('price:surcharge:remove')")
@Log(title = "附加费启用", businessType = BusinessType.UPDATE)
@PutMapping("/enable/{scIds}")
public AjaxResult enable(@PathVariable Long[] scIds)
{
return toAjax(surchargeService.enablePrcSurchargeByIds(scIds, getUsername()));
}
}
@@ -1,11 +1,14 @@
package com.ruoyi.price.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.price.domain.PrcSurcharge;
/**
* 附加费配置 数据层
*
* 附加费为计费主数据:不做物理修改/删除,编辑=作废旧记录插入新记录,删除=仅作废。
*
* @author ruoyi
*/
public interface PrcSurchargeMapper
@@ -16,7 +19,6 @@ public interface PrcSurchargeMapper
public int insertPrcSurcharge(PrcSurcharge surcharge);
public int updatePrcSurcharge(PrcSurcharge surcharge);
public int deletePrcSurchargeByIds(Long[] scIds);
/** 状态原地更新(不新增数据):停用置 of,版本化作废旧记录置 vd */
public int updateSsCodeByIds(@Param("scIds") Long[] scIds, @Param("ssCode") String ssCode, @Param("operator") String operator);
}
@@ -1,6 +1,7 @@
package com.ruoyi.price.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.price.domain.PrcSurchargeRel;
/**
@@ -21,4 +22,7 @@ public interface PrcSurchargeRelMapper
/** 删除产品时清理其关联 */
public int deleteRelByProductCodes(String[] productCodes);
/** 附加费版本化编辑后,把产品关联从旧记录重指向新记录 */
public int rebindRelScId(@Param("oldScId") Long oldScId, @Param("newScId") Long newScId, @Param("operator") String operator);
}
@@ -6,6 +6,8 @@ import com.ruoyi.price.domain.PrcSurcharge;
/**
* 附加费配置 服务层
*
* 附加费为计费主数据:编辑=原记录作废+插入新记录(版本化),删除=仅作废不物理删除。
*
* @author ruoyi
*/
public interface IPrcSurchargeService
@@ -16,7 +18,12 @@ public interface IPrcSurchargeService
public int insertPrcSurcharge(PrcSurcharge surcharge);
/** 版本化更新:原记录作废(ss_code=vd),插入新记录,产品关联重指向新记录;状态继承原记录 */
public int updatePrcSurcharge(PrcSurcharge surcharge);
public int deletePrcSurchargeByIds(Long[] scIds);
/** 停用(原地修改 ss_code=of,不新增数据) */
public int disablePrcSurchargeByIds(Long[] scIds, String operator);
/** 启用(原地修改 ss_code=on,不新增数据) */
public int enablePrcSurchargeByIds(Long[] scIds, String operator);
}
@@ -3,24 +3,36 @@ package com.ruoyi.price.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.MessageUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.price.domain.PrcSurcharge;
import com.ruoyi.price.mapper.PrcSurchargeMapper;
import com.ruoyi.price.mapper.PrcSurchargeRelMapper;
import com.ruoyi.price.service.IPrcSurchargeService;
/**
* 附加费配置 服务层实现
*
* 附加费为计费主数据,不做物理修改/删除:
* - 编辑 = 原记录作废(ss_code=vd)+ 插入新记录(状态继承),产品关联重指向新记录(保留变更历史)
* - 停用 = 原地修改 ss_code=of,不新增数据
*
* @author ruoyi
*/
@Service
public class PrcSurchargeServiceImpl implements IPrcSurchargeService
{
/** 作废状态:区别于启用(on)/停用(of),列表默认不显示 */
public static final String SS_CODE_VOID = "vd";
@Autowired
private PrcSurchargeMapper surchargeMapper;
@Autowired
private PrcSurchargeRelMapper surchargeRelMapper;
@Override
public PrcSurcharge selectPrcSurchargeById(Long scId)
{
@@ -37,6 +49,106 @@ public class PrcSurchargeServiceImpl implements IPrcSurchargeService
public int insertPrcSurcharge(PrcSurcharge surcharge)
{
validate(surcharge);
applyInsertDefaults(surcharge);
return surchargeMapper.insertPrcSurcharge(surcharge);
}
/**
* 版本化更新:内容无变化时返回 -1(不产生新版本),否则原记录作废 + 插入新记录 + 产品关联重指向。
*/
@Override
@Transactional
public int updatePrcSurcharge(PrcSurcharge surcharge)
{
validate(surcharge);
PrcSurcharge old = surchargeMapper.selectPrcSurchargeById(surcharge.getScId());
if (old == null)
{
throw new ServiceException("附加费不存在或已被作废,无法修改");
}
// 无实际变化:不置作废、不插新记录,返回 -1 由 Controller 提示"未修改"
if (isUnchanged(old, surcharge))
{
return -1;
}
String operator = StringUtils.isNotEmpty(surcharge.getUpdateBy()) ? surcharge.getUpdateBy() : surcharge.getCreateBy();
// 1. 原记录作废(保留历史)
surchargeMapper.updateSsCodeByIds(new Long[] { surcharge.getScId() }, SS_CODE_VOID, operator);
// 2. 按表单内容插入新记录(状态继承原记录,状态变更只能走列表停用操作)
PrcSurcharge fresh = new PrcSurcharge();
fresh.setScName(surcharge.getScName());
fresh.setFeeType(StringUtils.isNotEmpty(surcharge.getFeeType()) ? surcharge.getFeeType() : old.getFeeType());
fresh.setChargeType(surcharge.getChargeType());
fresh.setChargeValue(surcharge.getChargeValue());
fresh.setCurrency(surcharge.getCurrency());
fresh.setRoundMode(surcharge.getRoundMode());
fresh.setSsCode(old.getSsCode());
fresh.setCountryCode(surcharge.getCountryCode());
fresh.setScNote(surcharge.getScNote());
applyInsertDefaults(fresh);
fresh.setCreateBy(operator);
int rows = surchargeMapper.insertPrcSurcharge(fresh);
// 3. 产品关联重指向新记录,保持产品附加费配置不失效
surchargeRelMapper.rebindRelScId(surcharge.getScId(), fresh.getScId(), operator);
return rows;
}
/** 逐字段比对编辑内容与原记录是否一致(字符串 trim 后比较,数值统一 BigDecimal 比较) */
private boolean isUnchanged(PrcSurcharge old, PrcSurcharge updated)
{
return eq(old.getScName(), updated.getScName())
&& eq(old.getFeeType(), updated.getFeeType())
&& eq(old.getChargeType(), updated.getChargeType())
&& eqDecimal(old.getChargeValue(), updated.getChargeValue())
&& eq(old.getCurrency(), updated.getCurrency())
&& eq(old.getRoundMode(), updated.getRoundMode())
&& eq(old.getCountryCode(), updated.getCountryCode())
&& eq(old.getScNote(), updated.getScNote());
}
private boolean eq(String a, String b)
{
String sa = a == null ? "" : a.trim();
String sb = b == null ? "" : b.trim();
return sa.equals(sb);
}
private boolean eqDecimal(java.math.BigDecimal a, java.math.BigDecimal b)
{
if (a == null && b == null) return true;
if (a == null || b == null) return false;
return a.compareTo(b) == 0;
}
/**
* 停用(原地修改 ss_code=of,不新增数据、不动产品关联)。
*/
@Override
public int disablePrcSurchargeByIds(Long[] scIds, String operator)
{
return updateStatusByIds(scIds, "of", operator);
}
/**
* 启用(原地修改 ss_code=on,不新增数据)。
*/
@Override
public int enablePrcSurchargeByIds(Long[] scIds, String operator)
{
return updateStatusByIds(scIds, "on", operator);
}
private int updateStatusByIds(Long[] scIds, String ssCode, String operator)
{
if (scIds == null || scIds.length == 0)
{
return 0;
}
return surchargeMapper.updateSsCodeByIds(scIds, ssCode, operator);
}
private void applyInsertDefaults(PrcSurcharge surcharge)
{
if (StringUtils.isEmpty(surcharge.getSsCode()))
{
surcharge.setSsCode("on");
@@ -49,20 +161,6 @@ public class PrcSurchargeServiceImpl implements IPrcSurchargeService
{
surcharge.setRoundMode("HALF_UP");
}
return surchargeMapper.insertPrcSurcharge(surcharge);
}
@Override
public int updatePrcSurcharge(PrcSurcharge surcharge)
{
validate(surcharge);
return surchargeMapper.updatePrcSurcharge(surcharge);
}
@Override
public int deletePrcSurchargeByIds(Long[] scIds)
{
return surchargeMapper.deletePrcSurchargeByIds(scIds);
}
private void validate(PrcSurcharge surcharge)
@@ -161,7 +161,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where d.psv_id = #{psvId}
and ifnull(s.sc_name, '') <> ''
and s.charge_value is not null
and lower(ifnull(s.ss_code, '')) <> 'of'
and lower(ifnull(s.ss_code, '')) not in ('of', 'vd')
and (r.detail_id is null or r.detail_id = d.product_country_id)
and (
s.country_code is null or s.country_code = ''
@@ -48,9 +48,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="roundMode != null and roundMode != ''">
AND round_mode = #{roundMode}
</if>
<if test="ssCode != null and ssCode != ''">
AND ss_code = #{ssCode}
</if>
<choose>
<when test="ssCode != null and ssCode != ''">
AND lower(ss_code) = lower(#{ssCode})
</when>
<otherwise>
<!-- 默认排除已作废记录,可在状态筛选中选择作废查看历史 -->
AND lower(ifnull(ss_code, '')) &lt;&gt; 'vd'
</otherwise>
</choose>
<if test="countryCode != null and countryCode != ''">
AND country_code = #{countryCode}
</if>
@@ -91,30 +97,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)
</insert>
<update id="updatePrcSurcharge" parameterType="PrcSurcharge">
<!-- 状态原地更新(不新增数据):停用置 of,版本化作废旧记录置 vd -->
<update id="updateSsCodeByIds">
update prc_surcharge
<set>
<if test="scName != null and scName != ''">sc_name = #{scName},</if>
<if test="feeType != null and feeType != ''">fee_type = #{feeType},</if>
<if test="chargeType != null and chargeType != ''">charge_type = #{chargeType},</if>
<if test="chargeValue != null">charge_value = #{chargeValue},</if>
<if test="currency != null and currency != ''">currency = #{currency},</if>
<if test="roundMode != null and roundMode != ''">round_mode = #{roundMode},</if>
<if test="ssCode != null and ssCode != ''">ss_code = #{ssCode},</if>
country_code = #{countryCode},
<if test="scNote != null">sc_note = #{scNote},</if>
<if test="tmsId != null">tms_id = #{tmsId},</if>
<if test="updateBy != null and updateBy != ''">updated_by = #{updateBy},</if>
update_time = sysdate()
</set>
where sc_id = #{scId}
</update>
<delete id="deletePrcSurchargeByIds" parameterType="Long">
delete from prc_surcharge where sc_id in
<foreach item="scId" collection="array" open="(" separator="," close=")">
set ss_code = #{ssCode}, updated_by = #{operator}, update_time = sysdate()
where sc_id in
<foreach item="scId" collection="scIds" open="(" separator="," close=")">
#{scId}
</foreach>
</delete>
</update>
</mapper>
@@ -81,4 +81,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<!-- 附加费版本化编辑后,产品关联重指向新记录 -->
<update id="rebindRelScId">
update prc_surcharge_rel
set sc_id = #{newScId}, updated_by = #{operator}, update_time = sysdate()
where sc_id = #{oldScId}
</update>
</mapper>
+12 -4
View File
@@ -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 = '产品折扣'