feat: 完善拼多多商品发布

This commit is contained in:
2026-09-09 14:53:09 +08:00
parent f94d9b2db4
commit bd40064755
7 changed files with 77 additions and 10 deletions
@@ -13,6 +13,8 @@ export namespace PddGoodsPublishDTO {
isPreSale: boolean;
isRefundable: boolean;
secondHand: boolean;
/** 满2件折扣 0-100,默认 95 */
twoPiecesDiscount: number;
/** fileId 字符串或已转传的 URL */
carouselImages: string[];
detailImages: string[];
@@ -208,6 +208,7 @@ const form = reactive({
isPreSale: false,
isRefundable: true,
secondHand: false,
twoPiecesDiscount: 95,
goodsPropValues: {} as Record<string, string>,
});
@@ -284,7 +285,7 @@ const skuTableColumns = computed(() => [
})),
{ title: '商家编码', key: 'code', width: 300 },
{ title: '单买价', key: 'price', width: 120 },
{ title: '团购价', key: 'multi', width: 120 },
{ title: '拼单价', key: 'multi', width: 120 },
{ title: '库存', key: 'qty', width: 100 },
{ title: '重量g', key: 'weight', width: 100 },
{ title: '缩略图', key: 'thumb', width: 100 },
@@ -1314,7 +1315,15 @@ function validateForm(): boolean {
return false;
}
if (form.marketPriceYuan == null) {
message.warning('请填写市场价');
message.warning('请填写参考价');
return false;
}
if (
form.twoPiecesDiscount == null ||
form.twoPiecesDiscount < 0 ||
form.twoPiecesDiscount > 100
) {
message.warning('请填写满两件折扣(0-100,95表示95折)');
return false;
}
for (const p of nonSaleProps.value) {
@@ -1489,6 +1498,7 @@ async function buildPublishPayload(
isPreSale: form.isPreSale,
isRefundable: form.isRefundable,
secondHand: form.secondHand,
twoPiecesDiscount: form.twoPiecesDiscount,
carouselImages: carouselFileIds.map(String),
detailImages: detailFileIds.map(String),
goodsProperties,
@@ -1550,6 +1560,7 @@ function resetAll() {
form.isPreSale = false;
form.isRefundable = true;
form.secondHand = false;
form.twoPiecesDiscount = 95;
clearLocalImages();
form.goodsPropValues = {};
clearSkuRows();
@@ -1785,7 +1796,7 @@ onBeforeUnmount(() => {
</Card>
<div class="grid grid-cols-2 gap-3">
<Form.Item label="市场价(元)" required>
<Form.Item label="参考价(元)" required>
<InputNumber
v-model:value="form.marketPriceYuan"
class="w-full"
@@ -1803,6 +1814,16 @@ onBeforeUnmount(() => {
]"
/>
</Form.Item>
<Form.Item label="满两件折扣" required>
<InputNumber
v-model:value="form.twoPiecesDiscount"
class="w-full"
:min="0"
:max="100"
:precision="0"
placeholder="95 表示 95 折,0 取消"
/>
</Form.Item>
</div>
<div class="flex flex-wrap gap-6">