fix(expressTemplate): 修正运费模板计费方式类型及删除报错

- 将运费模板和详情模型中的计费方式 type 从 string 改为 boolean 类型
- 修改相关页面中计费方式显示及选择控件为布尔值 true/false 表示按件/按重量
- 统一删除操作使用后端返回的主键 id 替代废弃的 shopExpressTemplateId
- 修复删除运费模板时报错“参数格式错误: id 的值 'undefined' 无法转换为 Integer”
- ele-modal 关闭按钮定位修复,兼容最大化按钮时的偏移问题
- 小程序端 checkout 运费模板接入,支持动态计算显示运费费用
- 优化编辑表单中首件/续件数量或重量的动态标签和占位提示逻辑
This commit is contained in:
2026-07-07 15:03:06 +08:00
parent 08685d5ef1
commit 6118e2be01
9 changed files with 98 additions and 30 deletions

View File

@@ -30,16 +30,16 @@
</a-form-item>
<a-form-item label="计费方式" name="type">
<a-radio-group v-model:value="form.type">
<a-radio value="0">按件</a-radio>
<a-radio value="1">按重量</a-radio>
<a-radio :value="true">按件</a-radio>
<a-radio :value="false">按重量</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="首件数量/重量" name="firstNum">
<a-form-item :label="form.type ? '首件数量' : '首重重量'" name="firstNum">
<a-input-number
:min="0"
:precision="2"
class="ele-fluid"
placeholder="请输入首件数量/重量"
:placeholder="form.type ? '请输入首件数量' : '请输入首重重量'"
v-model:value="form.firstNum"
/>
</a-form-item>
@@ -52,12 +52,12 @@
v-model:value="form.firstAmount"
/>
</a-form-item>
<a-form-item label="续件数量/重量" name="extraNum">
<a-form-item :label="form.type ? '续件数量' : '续重重量'" name="extraNum">
<a-input-number
:min="0"
:precision="2"
class="ele-fluid"
placeholder="请输入续件数量/重量"
:placeholder="form.type ? '请输入续件数量' : '请输入续重重量'"
v-model:value="form.extraNum"
/>
</a-form-item>
@@ -141,7 +141,7 @@
const form = reactive<ShopExpressTemplate>({
shopExpressTemplateId: undefined,
id: undefined,
type: '0',
type: true,
title: undefined,
firstAmount: undefined,
extraAmount: undefined,

View File

@@ -3,7 +3,7 @@
<a-card :bordered="false" :body-style="{ padding: '16px' }">
<ele-pro-table
ref="tableRef"
row-key="shopExpressTemplateId"
row-key="id"
:columns="columns"
:datasource="datasource"
:customRow="customRow"
@@ -21,8 +21,8 @@
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'type'">
<a-tag v-if="record.type === '0'" color="blue">按件</a-tag>
<a-tag v-else-if="record.type === '1'" color="cyan">按重量</a-tag>
<a-tag v-if="record.type === true" color="blue">按件</a-tag>
<a-tag v-else-if="record.type === false" color="cyan">按重量</a-tag>
<span v-else>{{ record.type }}</span>
</template>
<template v-if="column.key === 'status'">
@@ -200,7 +200,7 @@
/* 删除单个 */
const remove = (row: ShopExpressTemplate) => {
const hide = message.loading('请求中..', 0);
removeShopExpressTemplate(row.shopExpressTemplateId)
removeShopExpressTemplate(row.id)
.then((msg) => {
hide();
message.success(msg);
@@ -226,7 +226,7 @@
onOk: () => {
const hide = message.loading('请求中..', 0);
removeBatchShopExpressTemplate(
selection.value.map((d) => d.shopExpressTemplateId)
selection.value.map((d) => d.id)
)
.then((msg) => {
hide();

View File

@@ -26,13 +26,13 @@
placeholder="请选择所属运费模板"
v-model:value="form.templateId"
:options="templateOptions"
:field-names="{ label: 'title', value: 'shopExpressTemplateId' }"
:field-names="{ label: 'title', value: 'id' }"
/>
</a-form-item>
<a-form-item label="计费方式" name="type">
<a-radio-group v-model:value="form.type">
<a-radio value="0">按件</a-radio>
<a-radio value="1">按重量</a-radio>
<a-radio :value="true">按件</a-radio>
<a-radio :value="false">按重量</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="省份ID" name="provinceId">
@@ -51,12 +51,12 @@
v-model:value="form.cityId"
/>
</a-form-item>
<a-form-item label="首件数量/重量" name="firstNum">
<a-form-item :label="form.type ? '首件数量' : '首重重量'" name="firstNum">
<a-input-number
:min="0"
:precision="2"
class="ele-fluid"
placeholder="请输入首件数量/重量"
:placeholder="form.type ? '请输入首件数量' : '请输入首重重量'"
v-model:value="form.firstNum"
/>
</a-form-item>
@@ -69,12 +69,12 @@
v-model:value="form.firstAmount"
/>
</a-form-item>
<a-form-item label="续件数量/重量" name="extraNum">
<a-form-item :label="form.type ? '续件数量' : '续重重量'" name="extraNum">
<a-input-number
:min="0"
:precision="2"
class="ele-fluid"
placeholder="请输入续件数量/重量"
:placeholder="form.type ? '请输入续件数量' : '请输入续重重量'"
v-model:value="form.extraNum"
/>
</a-form-item>
@@ -156,7 +156,7 @@
shopExpressTemplateDetailId: undefined,
id: undefined,
templateId: undefined,
type: '0',
type: true,
provinceId: undefined,
cityId: undefined,
firstNum: undefined,

View File

@@ -3,7 +3,7 @@
<a-card :bordered="false" :body-style="{ padding: '16px' }">
<ele-pro-table
ref="tableRef"
row-key="shopExpressTemplateDetailId"
row-key="id"
:columns="columns"
:datasource="datasource"
:customRow="customRow"
@@ -21,8 +21,8 @@
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'type'">
<a-tag v-if="record.type === '0'" color="blue">按件</a-tag>
<a-tag v-else-if="record.type === '1'" color="cyan">按重量</a-tag>
<a-tag v-if="record.type === true" color="blue">按件</a-tag>
<a-tag v-else-if="record.type === false" color="cyan">按重量</a-tag>
<span v-else>{{ record.type }}</span>
</template>
<template v-if="column.key === 'status'">
@@ -214,7 +214,7 @@
/* 删除单个 */
const remove = (row: ShopExpressTemplateDetail) => {
const hide = message.loading('请求中..', 0);
removeShopExpressTemplateDetail(row.shopExpressTemplateDetailId)
removeShopExpressTemplateDetail(row.id)
.then((msg) => {
hide();
message.success(msg);
@@ -240,7 +240,7 @@
onOk: () => {
const hide = message.loading('请求中..', 0);
removeBatchShopExpressTemplateDetail(
selection.value.map((d) => d.shopExpressTemplateDetailId)
selection.value.map((d) => d.id)
)
.then((msg) => {
hide();