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