fix(shopGoods): 修复SKU表格库存列和运费模板校验缺失

- 补充多规格SKU表格中缺失的划线价和库存列定义
- 添加快递配送开启时运费模板前端必填校验
- 在保存逻辑中增加运费模板缺失时的错误提示
- 运费模板表单项动态显示必填标记及占位提示
- 保持与后端校验逻辑一致,提升用户体验
This commit is contained in:
2026-08-11 10:52:29 +08:00
parent 40bcc77c50
commit 706db16337
2 changed files with 30 additions and 1 deletions
@@ -106,10 +106,11 @@
v-model:value="form.buyingPrice"
/>
</a-form-item>
<a-form-item label="运费模板" v-if="!merchantId">
<a-form-item :label="form.canExpress === 1 ? '运费模板' : '运费模板'" v-if="!merchantId" :required="form.canExpress === 1">
<a-select
v-model:value="form.expressTemplateId"
style="width: 240px"
:placeholder="form.canExpress === 1 ? '请选择运费模板(必选)' : '请选择运费模板'"
>
<a-select-option
v-for="(item, index) in expressTemplateList"
@@ -900,12 +901,24 @@ const columns = [
key: 'price',
align: 'center'
},
{
title: '划线价',
dataIndex: 'salePrice',
key: 'salePrice',
align: 'center'
},
{
title: '会员价',
dataIndex: 'buyingPrice',
key: 'buyingPrice',
align: 'center'
},
{
title: '库存',
dataIndex: 'stock',
key: 'stock',
align: 'center'
},
{
title: '商品编号',
dataIndex: 'skuNo',
@@ -1846,6 +1859,11 @@ const save = () => {
.validate()
.then(() => {
loading.value = true;
// 快递配送时运费模板必选(后端也有此校验,前端提前拦截给出友好提示)
if (form.canExpress === 1 && !form.expressTemplateId && !merchantId) {
loading.value = false;
return message.error('请选择运费模板');
}
if (form.priceGift && !form.priceGiftNum)
return message.error('请输入会员赠品数量');
if (ensureTag.value.length) form.ensureTag = ensureTag.value.join();