mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 16:29:20 +08:00
refactor: 发品去掉主内部商品绑定,改由订单同步兜底建品
This commit is contained in:
-4
@@ -24,10 +24,6 @@ public class PddGoodsPublishDTO {
|
|||||||
*/
|
*/
|
||||||
private Long systemDraftId;
|
private Long systemDraftId;
|
||||||
|
|
||||||
/** 渠道商品绑定的主内部商品 */
|
|
||||||
@NotNull(message = "主内部商品不能为空")
|
|
||||||
private Long primaryProductId;
|
|
||||||
|
|
||||||
@NotBlank(message = "商品标题不能为空")
|
@NotBlank(message = "商品标题不能为空")
|
||||||
private String goodsName;
|
private String goodsName;
|
||||||
|
|
||||||
|
|||||||
+4
-35
@@ -41,14 +41,11 @@ import top.xyquan.ecomdmbbackend.modules.channel.pdd.goods.publishdesk.model.po.
|
|||||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.goods.service.PddGoodsPublishService;
|
import top.xyquan.ecomdmbbackend.modules.channel.pdd.goods.service.PddGoodsPublishService;
|
||||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.goods.service.PddGoodsService;
|
import top.xyquan.ecomdmbbackend.modules.channel.pdd.goods.service.PddGoodsService;
|
||||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.goods.support.PddGoodsImageTransfer;
|
import top.xyquan.ecomdmbbackend.modules.channel.pdd.goods.support.PddGoodsImageTransfer;
|
||||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.order.convert.service.PddProductAutoCreateService;
|
|
||||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.pop.PddAuthFailureException;
|
import top.xyquan.ecomdmbbackend.modules.channel.pdd.pop.PddAuthFailureException;
|
||||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.pop.goods.PddGoodsPopApiClient;
|
import top.xyquan.ecomdmbbackend.modules.channel.pdd.pop.goods.PddGoodsPopApiClient;
|
||||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.pop.goods.PddGoodsPublishPopApiClient;
|
import top.xyquan.ecomdmbbackend.modules.channel.pdd.pop.goods.PddGoodsPublishPopApiClient;
|
||||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.mapper.PddShopMapper;
|
import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.mapper.PddShopMapper;
|
||||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.model.po.PddShopPO;
|
import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.model.po.PddShopPO;
|
||||||
import top.xyquan.ecomdmbbackend.modules.ec.product.mapper.ProductMapper;
|
|
||||||
import top.xyquan.ecomdmbbackend.modules.ec.product.model.po.ProductPO;
|
|
||||||
import top.xyquan.ecomdmbbackend.modules.ec.product.sku.model.po.ProductSkuPO;
|
import top.xyquan.ecomdmbbackend.modules.ec.product.sku.model.po.ProductSkuPO;
|
||||||
import top.xyquan.ecomdmbbackend.modules.ec.product.sku.service.ProductSkuService;
|
import top.xyquan.ecomdmbbackend.modules.ec.product.sku.service.ProductSkuService;
|
||||||
import top.xyquan.ecomdmbbackend.utils.CurrentUserContext;
|
import top.xyquan.ecomdmbbackend.utils.CurrentUserContext;
|
||||||
@@ -73,11 +70,9 @@ public class PddGoodsPublishServiceImpl implements PddGoodsPublishService {
|
|||||||
private final PddGoodsPublishPopApiClient publishPopApiClient;
|
private final PddGoodsPublishPopApiClient publishPopApiClient;
|
||||||
private final PddGoodsPopApiClient goodsPopApiClient;
|
private final PddGoodsPopApiClient goodsPopApiClient;
|
||||||
private final PddGoodsImageTransfer imageTransfer;
|
private final PddGoodsImageTransfer imageTransfer;
|
||||||
private final ProductMapper productMapper;
|
|
||||||
private final ProductSkuService productSkuService;
|
private final ProductSkuService productSkuService;
|
||||||
private final PddGoodsService pddGoodsService;
|
private final PddGoodsService pddGoodsService;
|
||||||
private final PddGoodsMapper pddGoodsMapper;
|
private final PddGoodsMapper pddGoodsMapper;
|
||||||
private final PddProductAutoCreateService productAutoCreateService;
|
|
||||||
private final PddGoodsPublishDraftMapper publishDraftMapper;
|
private final PddGoodsPublishDraftMapper publishDraftMapper;
|
||||||
|
|
||||||
public PddGoodsPublishServiceImpl(CurrentUserContext currentUserContext,
|
public PddGoodsPublishServiceImpl(CurrentUserContext currentUserContext,
|
||||||
@@ -86,11 +81,9 @@ public class PddGoodsPublishServiceImpl implements PddGoodsPublishService {
|
|||||||
PddGoodsPublishPopApiClient publishPopApiClient,
|
PddGoodsPublishPopApiClient publishPopApiClient,
|
||||||
PddGoodsPopApiClient goodsPopApiClient,
|
PddGoodsPopApiClient goodsPopApiClient,
|
||||||
PddGoodsImageTransfer imageTransfer,
|
PddGoodsImageTransfer imageTransfer,
|
||||||
ProductMapper productMapper,
|
|
||||||
ProductSkuService productSkuService,
|
ProductSkuService productSkuService,
|
||||||
PddGoodsService pddGoodsService,
|
PddGoodsService pddGoodsService,
|
||||||
PddGoodsMapper pddGoodsMapper,
|
PddGoodsMapper pddGoodsMapper,
|
||||||
PddProductAutoCreateService productAutoCreateService,
|
|
||||||
PddGoodsPublishDraftMapper publishDraftMapper) {
|
PddGoodsPublishDraftMapper publishDraftMapper) {
|
||||||
this.currentUserContext = currentUserContext;
|
this.currentUserContext = currentUserContext;
|
||||||
this.pddShopMapper = pddShopMapper;
|
this.pddShopMapper = pddShopMapper;
|
||||||
@@ -98,11 +91,9 @@ public class PddGoodsPublishServiceImpl implements PddGoodsPublishService {
|
|||||||
this.publishPopApiClient = publishPopApiClient;
|
this.publishPopApiClient = publishPopApiClient;
|
||||||
this.goodsPopApiClient = goodsPopApiClient;
|
this.goodsPopApiClient = goodsPopApiClient;
|
||||||
this.imageTransfer = imageTransfer;
|
this.imageTransfer = imageTransfer;
|
||||||
this.productMapper = productMapper;
|
|
||||||
this.productSkuService = productSkuService;
|
this.productSkuService = productSkuService;
|
||||||
this.pddGoodsService = pddGoodsService;
|
this.pddGoodsService = pddGoodsService;
|
||||||
this.pddGoodsMapper = pddGoodsMapper;
|
this.pddGoodsMapper = pddGoodsMapper;
|
||||||
this.productAutoCreateService = productAutoCreateService;
|
|
||||||
this.publishDraftMapper = publishDraftMapper;
|
this.publishDraftMapper = publishDraftMapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,13 +281,7 @@ public class PddGoodsPublishServiceImpl implements PddGoodsPublishService {
|
|||||||
throw new BusinessException("发布成功但拉取商品详情为空 goodsId=" + addResult.goodsId());
|
throw new BusinessException("发布成功但拉取商品详情为空 goodsId=" + addResult.goodsId());
|
||||||
}
|
}
|
||||||
|
|
||||||
ProductPO primary = productMapper.selectById(dto.getPrimaryProductId());
|
// 不定主内部商品;缺 SKU 由订单同步等路径兜底建品
|
||||||
if (primary == null || !Objects.equals(primary.getCompanyId(), companyId)) {
|
|
||||||
throw new BusinessException("主内部商品不存在或不属于当前公司");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 主商品下补缺失 SKU(外商品已有 sku_code 会跳过,不挪绑)
|
|
||||||
productAutoCreateService.ensureMissingSkus(companyId, primary.getId(), detailInfo);
|
|
||||||
pddGoodsService.upsertFromGoodsDetail(
|
pddGoodsService.upsertFromGoodsDetail(
|
||||||
companyId, ctx.shop().getId(), ctx.mallId(), detailInfo);
|
companyId, ctx.shop().getId(), ctx.mallId(), detailInfo);
|
||||||
|
|
||||||
@@ -317,8 +302,8 @@ public class PddGoodsPublishServiceImpl implements PddGoodsPublishService {
|
|||||||
result.setGoods(goodsVo);
|
result.setGoods(goodsVo);
|
||||||
bindSystemDraftAfterPublish(companyId, dto.getSystemDraftId(),
|
bindSystemDraftAfterPublish(companyId, dto.getSystemDraftId(),
|
||||||
addResult.goodsCommitId(), addResult.goodsId());
|
addResult.goodsCommitId(), addResult.goodsId());
|
||||||
log.info("拼多多商品发布成功 companyId={} shopId={} goodsId={} primaryProductId={}",
|
log.info("拼多多商品发布成功 companyId={} shopId={} goodsId={}",
|
||||||
companyId, ctx.shop().getId(), addResult.goodsId(), primary.getId());
|
companyId, ctx.shop().getId(), addResult.goodsId());
|
||||||
return result;
|
return result;
|
||||||
} catch (BusinessException e) {
|
} catch (BusinessException e) {
|
||||||
throw e;
|
throw e;
|
||||||
@@ -365,22 +350,6 @@ public class PddGoodsPublishServiceImpl implements PddGoodsPublishService {
|
|||||||
*/
|
*/
|
||||||
private PddGoodsPublishPopApiClient.GoodsAddCommand assembleAddCommand(
|
private PddGoodsPublishPopApiClient.GoodsAddCommand assembleAddCommand(
|
||||||
PddGoodsPublishDTO dto, Long companyId, ShopAuth ctx, boolean strict) throws Exception {
|
PddGoodsPublishDTO dto, Long companyId, ShopAuth ctx, boolean strict) throws Exception {
|
||||||
String outGoodsId = null;
|
|
||||||
if (dto.getPrimaryProductId() != null) {
|
|
||||||
ProductPO primary = productMapper.selectById(dto.getPrimaryProductId());
|
|
||||||
if (primary == null || !Objects.equals(primary.getCompanyId(), companyId)) {
|
|
||||||
if (strict) {
|
|
||||||
throw new BusinessException("主内部商品不存在或不属于当前公司");
|
|
||||||
}
|
|
||||||
} else if (StringUtils.hasText(primary.getProductCode())) {
|
|
||||||
outGoodsId = primary.getProductCode().trim();
|
|
||||||
} else if (strict) {
|
|
||||||
throw new BusinessException("主内部商品缺少商品编码,无法写入 out_goods_id");
|
|
||||||
}
|
|
||||||
} else if (strict) {
|
|
||||||
throw new BusinessException("主内部商品不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
List<PddGoodsPublishSkuDTO> skuDtos = dto.getSkus() == null ? List.of() : dto.getSkus();
|
List<PddGoodsPublishSkuDTO> skuDtos = dto.getSkus() == null ? List.of() : dto.getSkus();
|
||||||
if (strict && skuDtos.isEmpty()) {
|
if (strict && skuDtos.isEmpty()) {
|
||||||
throw new BusinessException("SKU列表不能为空");
|
throw new BusinessException("SKU列表不能为空");
|
||||||
@@ -486,7 +455,7 @@ public class PddGoodsPublishServiceImpl implements PddGoodsPublishService {
|
|||||||
dto.getTwoPiecesDiscount() == null ? 95 : dto.getTwoPiecesDiscount(),
|
dto.getTwoPiecesDiscount() == null ? 95 : dto.getTwoPiecesDiscount(),
|
||||||
carousel,
|
carousel,
|
||||||
detail,
|
detail,
|
||||||
outGoodsId,
|
null,
|
||||||
mainImage,
|
mainImage,
|
||||||
goodsProps,
|
goodsProps,
|
||||||
skuAdds);
|
skuAdds);
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ export namespace PddGoodsPublishDTO {
|
|||||||
pddShopId: number;
|
pddShopId: number;
|
||||||
/** 关联系统草稿:发布成功后回写 goods_commit_id */
|
/** 关联系统草稿:发布成功后回写 goods_commit_id */
|
||||||
systemDraftId?: number;
|
systemDraftId?: number;
|
||||||
primaryProductId: number;
|
|
||||||
goodsName: string;
|
goodsName: string;
|
||||||
goodsDesc?: string;
|
goodsDesc?: string;
|
||||||
catId: number;
|
catId: number;
|
||||||
|
|||||||
-53
@@ -2,8 +2,6 @@
|
|||||||
/**
|
/**
|
||||||
* 拼多多发布编辑器壳:编排 form + composables + 卡片,不含业务算法细节。
|
* 拼多多发布编辑器壳:编排 form + composables + 卡片,不含业务算法细节。
|
||||||
*/
|
*/
|
||||||
import type { ProductVO } from '#/api/ec/product/types';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
onBeforeUnmount,
|
onBeforeUnmount,
|
||||||
onMounted,
|
onMounted,
|
||||||
@@ -39,11 +37,8 @@ import {
|
|||||||
Tag,
|
Tag,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Upload,
|
Upload,
|
||||||
message,
|
|
||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
|
|
||||||
import { getProductPageApi } from '#/api/ec/product';
|
|
||||||
|
|
||||||
import CatPropertyField from './components/CatPropertyField.vue';
|
import CatPropertyField from './components/CatPropertyField.vue';
|
||||||
import SpecAxesCard from './components/SpecAxesCard.vue';
|
import SpecAxesCard from './components/SpecAxesCard.vue';
|
||||||
import SkuTableCard from './components/SkuTableCard.vue';
|
import SkuTableCard from './components/SkuTableCard.vue';
|
||||||
@@ -83,9 +78,6 @@ const hydratingDraft = ref(false);
|
|||||||
const skuRows = ref<SkuRow[]>([]);
|
const skuRows = ref<SkuRow[]>([]);
|
||||||
const specAxes = ref<SpecAxis[]>([]);
|
const specAxes = ref<SpecAxis[]>([]);
|
||||||
const specCatalog = ref<SpecCatalogItem[]>([]);
|
const specCatalog = ref<SpecCatalogItem[]>([]);
|
||||||
const productOptions = ref<{ label: string; value: number; name: string }[]>(
|
|
||||||
[],
|
|
||||||
);
|
|
||||||
|
|
||||||
/** 环依赖:specs ↔ sku,用可变实现在装配后回填 */
|
/** 环依赖:specs ↔ sku,用可变实现在装配后回填 */
|
||||||
let syncSkuRowsFromSpecsImpl: (opts?: {
|
let syncSkuRowsFromSpecsImpl: (opts?: {
|
||||||
@@ -139,23 +131,6 @@ rebuildPreservingImpl = specs.rebuildSpecCatalogPreservingUserData;
|
|||||||
buildSpecCatalogImpl = specs.buildSpecCatalog;
|
buildSpecCatalogImpl = specs.buildSpecCatalog;
|
||||||
clearSkuRowsImpl = sku.clearSkuRows;
|
clearSkuRowsImpl = sku.clearSkuRows;
|
||||||
|
|
||||||
async function loadProducts(keyword = '') {
|
|
||||||
try {
|
|
||||||
const data = await getProductPageApi({
|
|
||||||
page: 1,
|
|
||||||
pageSize: 50,
|
|
||||||
filters: keyword ? { keywords: keyword } : {},
|
|
||||||
});
|
|
||||||
productOptions.value = (data.records ?? []).map((p: ProductVO.Info) => ({
|
|
||||||
label: `${p.name}${p.productCode ? ` (${p.productCode})` : ''}`,
|
|
||||||
value: p.id,
|
|
||||||
name: p.name,
|
|
||||||
}));
|
|
||||||
} catch {
|
|
||||||
message.error('加载内部商品失败');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleClose() {
|
function handleClose() {
|
||||||
resetAll();
|
resetAll();
|
||||||
emit('close');
|
emit('close');
|
||||||
@@ -178,8 +153,6 @@ const draft = usePublishDraft({
|
|||||||
selectedCatPathLabel: category.selectedCatPathLabel,
|
selectedCatPathLabel: category.selectedCatPathLabel,
|
||||||
allNonSaleProps: category.allNonSaleProps,
|
allNonSaleProps: category.allNonSaleProps,
|
||||||
nonSaleProps: category.nonSaleProps,
|
nonSaleProps: category.nonSaleProps,
|
||||||
productOptions,
|
|
||||||
loadProducts,
|
|
||||||
specAxes,
|
specAxes,
|
||||||
specCatalog,
|
specCatalog,
|
||||||
normalizeSpecValueSlots: specs.normalizeSpecValueSlots,
|
normalizeSpecValueSlots: specs.normalizeSpecValueSlots,
|
||||||
@@ -216,17 +189,6 @@ const agent = usePublishAgent({
|
|||||||
revokeUploadFiles: images.revokeUploadFiles,
|
revokeUploadFiles: images.revokeUploadFiles,
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
|
||||||
() => form.primaryProductId,
|
|
||||||
(id) => {
|
|
||||||
if (!id) return;
|
|
||||||
const p = productOptions.value.find((x) => x.value === id);
|
|
||||||
if (p && !form.goodsName) {
|
|
||||||
form.goodsName = p.name;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.open ?? true,
|
() => props.open ?? true,
|
||||||
(v) => {
|
(v) => {
|
||||||
@@ -235,7 +197,6 @@ watch(
|
|||||||
form.pddShopId = props.presetPddShopId ?? undefined;
|
form.pddShopId = props.presetPddShopId ?? undefined;
|
||||||
}
|
}
|
||||||
void category.loadShops();
|
void category.loadShops();
|
||||||
void loadProducts();
|
|
||||||
void sku.loadSkuCandidates();
|
void sku.loadSkuCandidates();
|
||||||
if (props.draftId) {
|
if (props.draftId) {
|
||||||
void draft.hydrateFromDraft(props.draftId);
|
void draft.hydrateFromDraft(props.draftId);
|
||||||
@@ -250,7 +211,6 @@ onMounted(() => {
|
|||||||
form.pddShopId = props.presetPddShopId ?? undefined;
|
form.pddShopId = props.presetPddShopId ?? undefined;
|
||||||
}
|
}
|
||||||
void category.loadShops();
|
void category.loadShops();
|
||||||
void loadProducts();
|
|
||||||
void sku.loadSkuCandidates();
|
void sku.loadSkuCandidates();
|
||||||
if (props.draftId) {
|
if (props.draftId) {
|
||||||
void draft.hydrateFromDraft(props.draftId);
|
void draft.hydrateFromDraft(props.draftId);
|
||||||
@@ -492,19 +452,6 @@ function onSkuTableWrapRef(el: HTMLElement | null) {
|
|||||||
<div
|
<div
|
||||||
class="min-h-0 flex-1 space-y-4 overflow-y-auto overscroll-y-contain px-4 py-3"
|
class="min-h-0 flex-1 space-y-4 overflow-y-auto overscroll-y-contain px-4 py-3"
|
||||||
>
|
>
|
||||||
<Form.Item label="主内部商品" required>
|
|
||||||
<Select
|
|
||||||
v-model:value="form.primaryProductId"
|
|
||||||
show-search
|
|
||||||
allow-clear
|
|
||||||
class="w-full"
|
|
||||||
placeholder="搜索并选择主商品(标题默认带出)"
|
|
||||||
:filter-option="false"
|
|
||||||
:options="productOptions"
|
|
||||||
@search="(kw: string) => loadProducts(kw)"
|
|
||||||
/>
|
|
||||||
</Form.Item>
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
data-agent-field="goodsName"
|
data-agent-field="goodsName"
|
||||||
:class="{ 'agent-typing-field': agentTypingField === 'goodsName' }"
|
:class="{ 'agent-typing-field': agentTypingField === 'goodsName' }"
|
||||||
|
|||||||
-28
@@ -65,9 +65,6 @@ export function usePublishDraft(options: {
|
|||||||
selectedCatPathLabel: Ref<string>;
|
selectedCatPathLabel: Ref<string>;
|
||||||
allNonSaleProps: ComputedRef<PddGoodsPublishVO.CatProperty[]>;
|
allNonSaleProps: ComputedRef<PddGoodsPublishVO.CatProperty[]>;
|
||||||
nonSaleProps: ComputedRef<PddGoodsPublishVO.CatProperty[]>;
|
nonSaleProps: ComputedRef<PddGoodsPublishVO.CatProperty[]>;
|
||||||
// products
|
|
||||||
productOptions: Ref<{ label: string; value: number; name: string }[]>;
|
|
||||||
loadProducts: (keyword?: string) => Promise<void>;
|
|
||||||
// specs
|
// specs
|
||||||
specAxes: Ref<SpecAxis[]>;
|
specAxes: Ref<SpecAxis[]>;
|
||||||
specCatalog: Ref<SpecCatalogItem[]>;
|
specCatalog: Ref<SpecCatalogItem[]>;
|
||||||
@@ -110,8 +107,6 @@ export function usePublishDraft(options: {
|
|||||||
selectedCatPathLabel,
|
selectedCatPathLabel,
|
||||||
allNonSaleProps,
|
allNonSaleProps,
|
||||||
nonSaleProps,
|
nonSaleProps,
|
||||||
productOptions,
|
|
||||||
loadProducts,
|
|
||||||
specAxes,
|
specAxes,
|
||||||
specCatalog,
|
specCatalog,
|
||||||
normalizeSpecValueSlots,
|
normalizeSpecValueSlots,
|
||||||
@@ -164,10 +159,6 @@ export function usePublishDraft(options: {
|
|||||||
message.warning('请选择渠道店铺');
|
message.warning('请选择渠道店铺');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!form.primaryProductId) {
|
|
||||||
message.warning('请选择主内部商品');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!form.goodsName.trim()) {
|
if (!form.goodsName.trim()) {
|
||||||
message.warning('请填写商品标题');
|
message.warning('请填写商品标题');
|
||||||
return false;
|
return false;
|
||||||
@@ -361,7 +352,6 @@ export function usePublishDraft(options: {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
pddShopId: form.pddShopId!,
|
pddShopId: form.pddShopId!,
|
||||||
primaryProductId: form.primaryProductId!,
|
|
||||||
goodsName: form.goodsName.trim(),
|
goodsName: form.goodsName.trim(),
|
||||||
goodsDesc: form.goodsDesc || undefined,
|
goodsDesc: form.goodsDesc || undefined,
|
||||||
catId: form.catId!,
|
catId: form.catId!,
|
||||||
@@ -408,7 +398,6 @@ export function usePublishDraft(options: {
|
|||||||
loadShops(),
|
loadShops(),
|
||||||
shopId ? loadRootCats() : Promise.resolve(),
|
shopId ? loadRootCats() : Promise.resolve(),
|
||||||
shopId ? loadLogistics() : Promise.resolve(),
|
shopId ? loadLogistics() : Promise.resolve(),
|
||||||
loadProducts(),
|
|
||||||
loadSkuCandidates(),
|
loadSkuCandidates(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -417,22 +406,6 @@ export function usePublishDraft(options: {
|
|||||||
draft.title ||
|
draft.title ||
|
||||||
'';
|
'';
|
||||||
if (typeof es.goodsDesc === 'string') form.goodsDesc = es.goodsDesc;
|
if (typeof es.goodsDesc === 'string') form.goodsDesc = es.goodsDesc;
|
||||||
if (typeof es.primaryProductId === 'number') {
|
|
||||||
form.primaryProductId = es.primaryProductId;
|
|
||||||
if (
|
|
||||||
form.primaryProductId &&
|
|
||||||
!productOptions.value.some((p) => p.value === form.primaryProductId)
|
|
||||||
) {
|
|
||||||
productOptions.value = [
|
|
||||||
{
|
|
||||||
label: `商品#${form.primaryProductId}`,
|
|
||||||
value: form.primaryProductId,
|
|
||||||
name: form.goodsName || `商品#${form.primaryProductId}`,
|
|
||||||
},
|
|
||||||
...productOptions.value,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const catId =
|
const catId =
|
||||||
draft.catId ??
|
draft.catId ??
|
||||||
@@ -681,7 +654,6 @@ export function usePublishDraft(options: {
|
|||||||
const payloadJson = JSON.stringify({
|
const payloadJson = JSON.stringify({
|
||||||
editorState: {
|
editorState: {
|
||||||
pddShopId: form.pddShopId,
|
pddShopId: form.pddShopId,
|
||||||
primaryProductId: form.primaryProductId,
|
|
||||||
goodsName: form.goodsName,
|
goodsName: form.goodsName,
|
||||||
goodsDesc: form.goodsDesc,
|
goodsDesc: form.goodsDesc,
|
||||||
catId: form.catId,
|
catId: form.catId,
|
||||||
|
|||||||
@@ -87,7 +87,6 @@ export type DefaultOptionType = {
|
|||||||
/** 发布表单字段(店铺/类目/标题等) */
|
/** 发布表单字段(店铺/类目/标题等) */
|
||||||
export type PublishFormFields = {
|
export type PublishFormFields = {
|
||||||
pddShopId: number | undefined;
|
pddShopId: number | undefined;
|
||||||
primaryProductId: number | undefined;
|
|
||||||
goodsName: string;
|
goodsName: string;
|
||||||
goodsDesc: string;
|
goodsDesc: string;
|
||||||
catPath: number[];
|
catPath: number[];
|
||||||
@@ -123,7 +122,6 @@ export function twoPiecesDiscountFromStored(raw: number): number {
|
|||||||
export function createEmptyPublishForm(): PublishFormFields {
|
export function createEmptyPublishForm(): PublishFormFields {
|
||||||
return {
|
return {
|
||||||
pddShopId: undefined,
|
pddShopId: undefined,
|
||||||
primaryProductId: undefined,
|
|
||||||
goodsName: '',
|
goodsName: '',
|
||||||
goodsDesc: '',
|
goodsDesc: '',
|
||||||
catPath: [],
|
catPath: [],
|
||||||
|
|||||||
Reference in New Issue
Block a user