mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 03:49:19 +08:00
feat: 拼多多商品发布(goods.add)及发布后详情入库绑定主商品
This commit is contained in:
@@ -2,7 +2,12 @@ import type { PageQueryDTO, PageResultVO } from '#/types/common';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
import type { PddGoodsDTO, PddGoodsVO } from './types';
|
||||
import type {
|
||||
PddGoodsDTO,
|
||||
PddGoodsPublishDTO,
|
||||
PddGoodsPublishVO,
|
||||
PddGoodsVO,
|
||||
} from './types';
|
||||
|
||||
/** 分页查询拼多多渠道商品 */
|
||||
export async function getPddGoodsPageApi(
|
||||
@@ -30,3 +35,81 @@ export async function syncPddGoodsByShopApi(pddShopId: number) {
|
||||
`/channel/pdd/goods/sync/${pddShopId}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 可发布类目 */
|
||||
export async function listPddPublishCatsApi(
|
||||
data: PddGoodsPublishDTO.ShopCatQuery,
|
||||
) {
|
||||
return requestClient.post<PddGoodsPublishVO.Cat[]>(
|
||||
'/channel/pdd/goods/publish/meta/cats',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 运费模板列表 */
|
||||
export async function listPddPublishLogisticsApi(
|
||||
data: PddGoodsPublishDTO.LogisticsQuery,
|
||||
) {
|
||||
return requestClient.post<PddGoodsPublishVO.LogisticsPage>(
|
||||
'/channel/pdd/goods/publish/meta/logistics-templates',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 运费模板详情 */
|
||||
export async function getPddPublishLogisticsTemplateDetailApi(
|
||||
data: PddGoodsPublishDTO.CostTemplateDetailQuery,
|
||||
) {
|
||||
return requestClient.post<PddGoodsPublishVO.CostTemplateDetail>(
|
||||
'/channel/pdd/goods/publish/meta/logistics-template-detail',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 类目属性模板 */
|
||||
export async function getPddPublishCatTemplateApi(
|
||||
data: PddGoodsPublishDTO.CatTemplateQuery,
|
||||
) {
|
||||
return requestClient.post<PddGoodsPublishVO.CatTemplate>(
|
||||
'/channel/pdd/goods/publish/meta/cat-template',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 父规格列表 */
|
||||
export async function listPddPublishParentSpecsApi(
|
||||
data: PddGoodsPublishDTO.SpecQuery,
|
||||
) {
|
||||
return requestClient.post<PddGoodsPublishVO.ParentSpec[]>(
|
||||
'/channel/pdd/goods/publish/meta/specs',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 生成规格 ID */
|
||||
export async function createPddPublishSpecIdApi(
|
||||
data: PddGoodsPublishDTO.SpecIdCreate,
|
||||
) {
|
||||
return requestClient.post<PddGoodsPublishVO.SpecId>(
|
||||
'/channel/pdd/goods/publish/meta/spec-id',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 本系统文件转传拼多多图 */
|
||||
export async function transferPddPublishImageApi(
|
||||
data: PddGoodsPublishDTO.TransferImage,
|
||||
) {
|
||||
return requestClient.post<PddGoodsPublishVO.TransferImageResult>(
|
||||
'/channel/pdd/goods/publish/transfer-image',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 发布商品并入库 */
|
||||
export async function publishPddGoodsApi(data: PddGoodsPublishDTO.Publish) {
|
||||
return requestClient.post<PddGoodsPublishVO.PublishResult>(
|
||||
'/channel/pdd/goods/publish',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
export * from './publish';
|
||||
|
||||
export namespace PddGoodsDTO {
|
||||
export interface Filters {
|
||||
/** 渠道店铺ID(channel_pdd_shop.id) */
|
||||
|
||||
@@ -0,0 +1,224 @@
|
||||
/** 拼多多商品发布相关类型 */
|
||||
export namespace PddGoodsPublishDTO {
|
||||
export interface Publish {
|
||||
pddShopId: number;
|
||||
primaryProductId: number;
|
||||
goodsName: string;
|
||||
goodsDesc?: string;
|
||||
catId: number;
|
||||
costTemplateId: number;
|
||||
marketPriceFen: number;
|
||||
shipmentLimitSecond: number;
|
||||
isFolt: boolean;
|
||||
isPreSale: boolean;
|
||||
isRefundable: boolean;
|
||||
secondHand: boolean;
|
||||
/** fileId 字符串或已转传的 URL */
|
||||
carouselImages: string[];
|
||||
detailImages: string[];
|
||||
imageUrl?: string;
|
||||
goodsProperties?: GoodsProperty[];
|
||||
skus: PublishSku[];
|
||||
}
|
||||
|
||||
export interface GoodsProperty {
|
||||
refPid?: number;
|
||||
vid?: number;
|
||||
value?: string;
|
||||
valueUnit?: string;
|
||||
templatePid?: number;
|
||||
parentSpecId?: number;
|
||||
specId?: number;
|
||||
imgUrl?: string;
|
||||
note?: string;
|
||||
groupId?: number;
|
||||
}
|
||||
|
||||
export interface PublishSku {
|
||||
/** 可选:选内部 SKU;手填时可不传 */
|
||||
internalSkuId?: number;
|
||||
/** 商家编码;未选内部 SKU 时必填 */
|
||||
outSkuSn?: string;
|
||||
priceFen: number;
|
||||
multiPriceFen: number;
|
||||
quantity: number;
|
||||
weight: number;
|
||||
thumbImage: string;
|
||||
specIdList: string;
|
||||
isOnsale?: number;
|
||||
skuProperties?: SkuProperty[];
|
||||
}
|
||||
|
||||
export interface SkuProperty {
|
||||
refPid: number;
|
||||
vid: number;
|
||||
value?: string;
|
||||
punit?: string;
|
||||
}
|
||||
|
||||
export interface ShopCatQuery {
|
||||
pddShopId: number;
|
||||
parentCatId?: number;
|
||||
}
|
||||
|
||||
export interface LogisticsQuery {
|
||||
pddShopId: number;
|
||||
page?: number;
|
||||
pageSize?: number;
|
||||
goodsStatus?: number;
|
||||
}
|
||||
|
||||
export interface CostTemplateDetailQuery {
|
||||
pddShopId: number;
|
||||
costTemplateId: number;
|
||||
}
|
||||
|
||||
export interface CatTemplateQuery {
|
||||
pddShopId: number;
|
||||
catId: number;
|
||||
}
|
||||
|
||||
export interface SpecQuery {
|
||||
pddShopId: number;
|
||||
catId: number;
|
||||
}
|
||||
|
||||
export interface SpecIdCreate {
|
||||
pddShopId: number;
|
||||
parentSpecId: number;
|
||||
specName: string;
|
||||
}
|
||||
|
||||
export interface TransferImage {
|
||||
pddShopId: number;
|
||||
fileId: number;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace PddGoodsPublishVO {
|
||||
export interface Cat {
|
||||
catId: number;
|
||||
catName?: string;
|
||||
leaf?: boolean;
|
||||
}
|
||||
|
||||
export interface LogisticsPage {
|
||||
totalCount?: number;
|
||||
templates?: LogisticsTemplate[];
|
||||
}
|
||||
|
||||
export interface LogisticsTemplate {
|
||||
templateId: number;
|
||||
templateName?: string;
|
||||
costType?: number;
|
||||
lastUpdatedTime?: number;
|
||||
}
|
||||
|
||||
export interface CostTemplateDetail {
|
||||
templateId?: number;
|
||||
templateName?: string;
|
||||
costType?: number;
|
||||
costTypeLabel?: string;
|
||||
additionalServiceType?: number;
|
||||
additionalServiceLabel?: string;
|
||||
sfFreeType?: number;
|
||||
sfFree?: boolean;
|
||||
freeDeliverHouse?: boolean;
|
||||
freeProvinces?: CostProvince[];
|
||||
paidRegions?: CostPaidRegion[];
|
||||
freeDeliverHouseAreas?: CostDeliverHouseArea[];
|
||||
}
|
||||
|
||||
export interface CostProvince {
|
||||
provinceId?: number;
|
||||
province?: string;
|
||||
}
|
||||
|
||||
export interface CostPaidRegion {
|
||||
provinces?: CostProvince[];
|
||||
provincesText?: string;
|
||||
firstStandard?: number;
|
||||
firstCostFen?: number;
|
||||
firstCostYuan?: string;
|
||||
addStandard?: number;
|
||||
addCostFen?: number;
|
||||
addCostYuan?: string;
|
||||
freeByCountEnabled?: boolean;
|
||||
freeMinCount?: number;
|
||||
freeByAmountEnabled?: boolean;
|
||||
freeMinAmountFen?: number;
|
||||
freeMinAmountYuan?: string;
|
||||
freeRuleText?: string;
|
||||
}
|
||||
|
||||
export interface CostDeliverHouseArea {
|
||||
province?: string;
|
||||
city?: string;
|
||||
town?: string;
|
||||
areaText?: string;
|
||||
}
|
||||
|
||||
export interface CatTemplate {
|
||||
id?: number;
|
||||
maxSkuNum?: number;
|
||||
inputMaxSpecNum?: number;
|
||||
singleSpecValueNum?: number;
|
||||
singleItem?: boolean;
|
||||
properties?: CatProperty[];
|
||||
}
|
||||
|
||||
export interface CatProperty {
|
||||
templatePid?: number;
|
||||
name?: string;
|
||||
nameAlias?: string;
|
||||
refPid?: number;
|
||||
specId?: number;
|
||||
parentId?: number;
|
||||
required?: boolean;
|
||||
sale?: boolean;
|
||||
controlType?: number;
|
||||
feature?: number;
|
||||
valueType?: number;
|
||||
valueUnit?: string;
|
||||
inputMaxNum?: number;
|
||||
chooseMaxNum?: number;
|
||||
values?: CatPropertyValue[];
|
||||
}
|
||||
|
||||
export interface CatPropertyValue {
|
||||
vid?: number;
|
||||
value?: string;
|
||||
specId?: number;
|
||||
extendInfo?: string;
|
||||
parent?: boolean;
|
||||
parentVids?: number[];
|
||||
}
|
||||
|
||||
export interface ParentSpec {
|
||||
catId?: number;
|
||||
parentSpecId: number;
|
||||
parentSpecName?: string;
|
||||
}
|
||||
|
||||
export interface SpecId {
|
||||
parentSpecId?: number;
|
||||
specName?: string;
|
||||
specId: number;
|
||||
}
|
||||
|
||||
export interface TransferImageResult {
|
||||
imageUrl: string;
|
||||
}
|
||||
|
||||
export interface PublishResult {
|
||||
goodsId: number;
|
||||
goodsCommitId?: number;
|
||||
matchedSpuId?: number;
|
||||
goods?: {
|
||||
id: number;
|
||||
productId?: number;
|
||||
goodsId?: string;
|
||||
goodsName?: string;
|
||||
};
|
||||
}
|
||||
}
|
||||
+1310
File diff suppressed because it is too large
Load Diff
@@ -20,6 +20,7 @@ import PddShopDetailModal from '#/views/channel/pdd/shop/components/PddShopDetai
|
||||
import ProductDetailDrawer from '#/views/ec/product/list/components/ProductDetailDrawer.vue';
|
||||
|
||||
import PddGoodsDetailDrawer from './components/PddGoodsDetailDrawer.vue';
|
||||
import PddGoodsPublishModal from './components/PddGoodsPublishModal.vue';
|
||||
|
||||
defineOptions({ name: 'PddGoodsManagement' });
|
||||
|
||||
@@ -27,6 +28,7 @@ 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);
|
||||
/** 左侧选中的拼多多渠道店铺 ID */
|
||||
const selectedShopId = ref<number | undefined>(undefined);
|
||||
const shopNameById = ref<Record<number, string>>({});
|
||||
@@ -329,7 +331,14 @@ onMounted(async () => {
|
||||
}"
|
||||
>
|
||||
<template #title>
|
||||
<span class="text-base font-semibold">拼多多商品</span>
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<span class="text-base font-semibold">拼多多商品</span>
|
||||
<PermissionGate code="channel:pdd:goods:create">
|
||||
<Button type="primary" size="small" @click="publishOpen = true">
|
||||
发布商品
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div
|
||||
@@ -416,6 +425,11 @@ onMounted(async () => {
|
||||
/>
|
||||
<PddShopDetailModal ref="shopDetailModalRef" />
|
||||
<ProductDetailDrawer ref="productDetailDrawerRef" />
|
||||
<PddGoodsPublishModal
|
||||
v-model:open="publishOpen"
|
||||
:preset-pdd-shop-id="selectedShopId"
|
||||
@success="() => gridApi.reload()"
|
||||
/>
|
||||
</PddShopColPage>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user