refactor: 去掉拼多多商品内部 product_id 并按 SKU 分摊广告费

This commit is contained in:
2026-09-04 22:18:41 +08:00
parent ea9d792096
commit 558dfc4a28
19 changed files with 450 additions and 353 deletions
@@ -5,8 +5,6 @@ export namespace PddGoodsDTO {
/** 渠道店铺ID(channel_pdd_shop.id) */
shopId?: number;
mallId?: number;
/** 内部商品ID */
productId?: number;
goodsName?: string;
goodsId?: string;
/** 0否 1是 */
@@ -36,8 +34,6 @@ export namespace PddGoodsVO {
companyId?: number;
shopId?: number;
mallId?: number;
productId?: number;
productName?: string;
goodsId?: string;
goodsName?: string;
goodsQuantity?: number;
@@ -4,7 +4,6 @@ import type { PddGoodsVO } from '#/api/channel/pdd/goods';
import { ref } from 'vue';
import {
Button,
Descriptions,
DescriptionsItem,
Drawer,
@@ -19,10 +18,6 @@ import { getPddGoodsDetailApi } from '#/api/channel/pdd/goods';
defineOptions({ name: 'PddGoodsDetailDrawer' });
const emit = defineEmits<{
openInternalProduct: [row: PddGoodsVO.Info];
}>();
const openFlag = ref(false);
const loading = ref(false);
const shopName = ref('');
@@ -74,14 +69,6 @@ function close() {
openFlag.value = false;
}
function openInternalProduct() {
if (!detail.value?.productId) {
message.warning('未关联内部商品');
return;
}
emit('openInternalProduct', detail.value);
}
defineExpose({ open, close });
</script>
@@ -126,18 +113,6 @@ defineExpose({ open, close });
<DescriptionsItem label="渠道店铺" :span="2">
{{ shopName || `渠道店#${detail.shopId}` }}
</DescriptionsItem>
<DescriptionsItem label="内部商品" :span="2">
<Button
v-if="detail.productId"
type="link"
size="small"
class="!px-0"
@click="openInternalProduct"
>
{{ detail.productName || `商品#${detail.productId}` }}
</Button>
<span v-else>-</span>
</DescriptionsItem>
<DescriptionsItem label="总库存">
{{ detail.goodsQuantity ?? 0 }}
</DescriptionsItem>
@@ -147,7 +122,7 @@ defineExpose({ open, close });
<DescriptionsItem label="最近同步">
{{ detail.lastSyncTime || '-' }}
</DescriptionsItem>
<DescriptionsItem label="平台创建">
<DescriptionsItem label="拼多多创建">
{{ detail.pddCreatedAt || '-' }}
</DescriptionsItem>
</Descriptions>
@@ -155,10 +130,10 @@ defineExpose({ open, close });
<div class="mb-2 text-sm font-medium">SKU 明细</div>
<Table
size="small"
:pagination="false"
:columns="skuColumns"
:data-source="detail.skus || []"
:row-key="(r: PddGoodsVO.Sku) => String(r.id ?? r.skuId)"
:pagination="false"
row-key="skuId"
:scroll="{ x: 700 }"
>
<template #bodyCell="{ column, record }">
@@ -17,7 +17,6 @@ import { getPddShopPageApi } from '#/api/channel/pdd/shop';
import { PermissionGate } from '#/components/permission';
import PddShopColPage from '#/views/channel/pdd/components/PddShopColPage.vue';
import PddShopDetailModal from '#/views/channel/pdd/shop/components/PddShopDetailModal.vue';
import ProductDetailDrawer from '#/views/ec/product/list/components/ProductDetailDrawer.vue';
import PddGoodsDetailDrawer from './components/PddGoodsDetailDrawer.vue';
import PddGoodsPublishModal from './components/PddGoodsPublishModal.vue';
@@ -27,7 +26,6 @@ defineOptions({ name: 'PddGoodsManagement' });
const loading = ref(false);
const detailDrawerRef = ref<InstanceType<typeof PddGoodsDetailDrawer>>();
const shopDetailModalRef = ref<InstanceType<typeof PddShopDetailModal>>();
const productDetailDrawerRef = ref<InstanceType<typeof ProductDetailDrawer>>();
const publishOpen = ref(false);
const publishHasDraft = ref(false);
/** 左侧选中的拼多多渠道店铺 ID */
@@ -93,12 +91,6 @@ const gridOptions: VxeGridProps<PddGoodsVO.Info> = {
showOverflow: 'tooltip' as const,
slots: { default: 'shop' },
},
{
title: '内部商品',
minWidth: 140,
showOverflow: 'tooltip' as const,
slots: { default: 'productName' },
},
{
title: '状态',
width: 90,
@@ -296,14 +288,6 @@ function openShopDetail(row: PddGoodsVO.Info) {
shopDetailModalRef.value?.open(row.shopId);
}
async function openInternalProduct(row: PddGoodsVO.Info) {
if (!row.productId) {
message.warning('未关联内部商品');
return;
}
await productDetailDrawerRef.value?.openById(row.productId, row.productName);
}
async function handleDelete(row: PddGoodsVO.Info) {
try {
await deletePddGoodsApi(row.id);
@@ -363,19 +347,6 @@ onMounted(async () => {
</Button>
</template>
<template #productName="{ row }: { row: PddGoodsVO.Info }">
<Button
v-if="row.productId"
type="link"
size="small"
class="!px-0"
@click="openInternalProduct(row)"
>
{{ row.productName || `商品#${row.productId}` }}
</Button>
<span v-else class="text-slate-400">-</span>
</template>
<template #shop="{ row }: { row: PddGoodsVO.Info }">
<Button
v-if="row.shopId"
@@ -420,12 +391,8 @@ onMounted(async () => {
</div>
</Card>
<PddGoodsDetailDrawer
ref="detailDrawerRef"
@open-internal-product="openInternalProduct"
/>
<PddGoodsDetailDrawer ref="detailDrawerRef" />
<PddShopDetailModal ref="shopDetailModalRef" />
<ProductDetailDrawer ref="productDetailDrawerRef" />
<PddGoodsPublishModal
v-model:open="publishOpen"
v-model:has-draft="publishHasDraft"