feat(shopGoods): 支持多规格价格区间及修复快递配送设置保存问题
- 商品列表价格列新增多规格价格区间显示,单规格依旧显示单值 - 后端新增非持久化最大价字段 priceMax/salePriceMax/dealerPriceMax,批量读取SKU价格区间 - 前端 API 和列表价格列渲染及导出支持价格区间显示 - 添加快递配送相关字段 canExpress 和 expressTemplateId 至后端实体并新增对应数据库字段 - 调整前端运费模板表单项位置及必填校验逻辑,修复保存不生效问题 - 修改 SKU 图片删除方法,避免误删主商品图片数组
This commit is contained in:
@@ -62,6 +62,10 @@ export interface ShopGoods {
|
||||
memberMarketPrice?: string;
|
||||
// 经销商价格
|
||||
dealerPrice?: string;
|
||||
// 价格区间最大值(多规格列表展示用,由后端按 SKU 计算;单规格/区间相等时为 undefined)
|
||||
priceMax?: string;
|
||||
salePriceMax?: string;
|
||||
dealerPriceMax?: string;
|
||||
// 有赠品
|
||||
buyingGift?: boolean;
|
||||
// 有赠品
|
||||
|
||||
@@ -106,20 +106,6 @@
|
||||
v-model:value="form.buyingPrice"
|
||||
/>
|
||||
</a-form-item>
|
||||
<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"
|
||||
:key="index"
|
||||
:value="item.id"
|
||||
>{{ item.title }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item label="商品图片(400x400)" name="image">
|
||||
<!-- <SelectFile-->
|
||||
<!-- :placeholder="`请选择视频文件`"-->
|
||||
@@ -356,7 +342,7 @@
|
||||
:data="record.images || []"
|
||||
:index="index"
|
||||
@done="chooseSkuImage"
|
||||
@del="onDeleteSkuItem"
|
||||
@del="() => onDeleteSkuItem(index)"
|
||||
/>
|
||||
</template>
|
||||
<template v-if="column.key === 'price'">
|
||||
@@ -458,6 +444,20 @@
|
||||
:un-checked-value="0"
|
||||
/>
|
||||
</a-form-item>
|
||||
<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"
|
||||
:key="index"
|
||||
:value="item.id"
|
||||
>{{ item.title }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item label="是否新品">
|
||||
<a-switch
|
||||
size="small"
|
||||
|
||||
@@ -58,16 +58,36 @@
|
||||
</template>
|
||||
<template v-if="column.key === 'priceGroup'">
|
||||
<div class="flex flex-col leading-tight">
|
||||
<span class="text-gray-800 font-bold">¥{{ record.price }}</span>
|
||||
<span class="text-gray-400 text-xs"
|
||||
>市场价:{{
|
||||
record.salePrice ? `¥${record.salePrice}` : '-'
|
||||
}}</span
|
||||
<span class="text-gray-800 font-bold"
|
||||
>¥{{ record.price
|
||||
}}<span
|
||||
v-if="record.priceMax != null && record.priceMax !== record.price"
|
||||
> ~ ¥{{ record.priceMax }}</span
|
||||
></span
|
||||
>
|
||||
<span class="text-gray-400 text-xs"
|
||||
>会员价:{{
|
||||
record.dealerPrice ? `¥${record.dealerPrice}` : '-'
|
||||
}}</span
|
||||
>市场价:<template v-if="record.salePrice"
|
||||
>¥{{ record.salePrice
|
||||
}}<span
|
||||
v-if="
|
||||
record.salePriceMax != null &&
|
||||
record.salePriceMax !== record.salePrice
|
||||
"
|
||||
> ~ ¥{{ record.salePriceMax }}</span
|
||||
></template
|
||||
><template v-else>-</template></span
|
||||
>
|
||||
<span class="text-gray-400 text-xs"
|
||||
>会员价:<template v-if="record.dealerPrice"
|
||||
>¥{{ record.dealerPrice
|
||||
}}<span
|
||||
v-if="
|
||||
record.dealerPriceMax != null &&
|
||||
record.dealerPriceMax !== record.dealerPrice
|
||||
"
|
||||
> ~ ¥{{ record.dealerPriceMax }}</span
|
||||
></template
|
||||
><template v-else>-</template></span
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
@@ -389,6 +409,17 @@
|
||||
});
|
||||
};
|
||||
|
||||
/* 价格区间文本:多规格且区间不相等时显示 ¥min ~ ¥max,否则显示单值 */
|
||||
const fmtPrice = (min?: string | number, max?: string | number) => {
|
||||
if (min == null || min === '') {
|
||||
return max != null && max !== '' ? `¥${max}` : '';
|
||||
}
|
||||
const base = `¥${min}`;
|
||||
return max != null && max !== '' && `${max}` !== `${min}`
|
||||
? `${base} ~ ¥${max}`
|
||||
: base;
|
||||
};
|
||||
|
||||
/* 导出商品列表 */
|
||||
const handleExport = async () => {
|
||||
if (loading.value) {
|
||||
@@ -424,9 +455,9 @@
|
||||
array.push([
|
||||
`${goods.goodsId || ''}`,
|
||||
`${goods.name || ''}`,
|
||||
`¥${goods.price || 0}`,
|
||||
`${goods.salePrice ? `¥${goods.salePrice}` : ''}`,
|
||||
`${goods.dealerPrice ? `¥${goods.dealerPrice}` : ''}`,
|
||||
fmtPrice(goods.price, goods.priceMax),
|
||||
fmtPrice(goods.salePrice, goods.salePriceMax),
|
||||
fmtPrice(goods.dealerPrice, goods.dealerPriceMax),
|
||||
`${goods.sales || 0}`,
|
||||
`${goods.stock || 0}`,
|
||||
statusMap[goods.status || 0] || '',
|
||||
|
||||
Reference in New Issue
Block a user