fix add fail for not found sku
This commit is contained in:
@@ -756,7 +756,7 @@ function generateSkuList(fallbackSkuList: ProductSku[] = [], preserveRemoved = f
|
||||
|| (!index && !hasExistingCombination ? fallback && !usedIdSet.has(fallback.id || "") ? createSku(fallback) : undefined : undefined)
|
||||
|| createSku({
|
||||
code: getGeneratedSkuCode(index, reservedCodeSet),
|
||||
name: form.name ? `${form.name} ${getCombinationSummary(valueList)}` : "",
|
||||
name: getCombinationSummary(valueList),
|
||||
specSummary: getCombinationSummary(valueList),
|
||||
stockEnabled: form.stockEnabled,
|
||||
allowDecimalQuantity: false,
|
||||
@@ -776,8 +776,8 @@ function generateSkuList(fallbackSkuList: ProductSku[] = [], preserveRemoved = f
|
||||
if (!current!.code.trim()) {
|
||||
current!.code = getGeneratedSkuCode(index, reservedCodeSet);
|
||||
}
|
||||
if (!current!.name.trim()) {
|
||||
current!.name = form.name ? `${form.name} ${summary}` : "";
|
||||
if (!current!.name.trim() || (!current!.specValueIdList?.length && current!.name === form.name)) {
|
||||
current!.name = summary;
|
||||
}
|
||||
if (current?.specSummary !== summary) {
|
||||
current!.specSummary = summary;
|
||||
@@ -1004,6 +1004,7 @@ function buildProductPayload(skuList?: ProductSku[], includeSpecList = false): P
|
||||
valueList: spec.valueList.map((value, valueIndex) => ({
|
||||
id: value.id,
|
||||
specId: spec.id,
|
||||
clientKey: value.clientKey,
|
||||
name: value.name.trim(),
|
||||
enabled: value.enabled !== false,
|
||||
sort: valueIndex
|
||||
|
||||
@@ -31,6 +31,7 @@ export type ProductCategory = {
|
||||
|
||||
export type ProductSpecValue = {
|
||||
specId?: string;
|
||||
clientKey?: string;
|
||||
name: string;
|
||||
enabled?: boolean;
|
||||
sort?: number;
|
||||
|
||||
Reference in New Issue
Block a user