From 6c488a473190b9881469861bc3fe655382fdeece Mon Sep 17 00:00:00 2001 From: Timi Date: Sat, 19 Sep 2026 16:29:38 +0800 Subject: [PATCH] fix save fail for product photo and sku photo --- src/pages/product/ProductEdit.vue | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/pages/product/ProductEdit.vue b/src/pages/product/ProductEdit.vue index b105ca0..bfa1685 100644 --- a/src/pages/product/ProductEdit.vue +++ b/src/pages/product/ProductEdit.vue @@ -662,24 +662,33 @@ async function handleAttachmentSelected(event: Event): Promise { function buildAttachmentList(): Attachment[] { return attachmentItemList.value.flatMap(item => { + if (item.tempFileId) { + return [{ + ...item.attachment, + attachType: item.attachType || item.attachment?.attachType || "PHOTO", + tempFileId: item.tempFileId, + metadata: item.isSolidColorCover && item.solidColor ? { purpose: SOLID_COLOR_COVER_PURPOSE, color: item.solidColor } : undefined + } as Attachment]; + } if (item.attachment) { return [{ ...item.attachment, attachType: item.attachType || item.attachment.attachType || "PHOTO" }]; } - if (item.tempFileId) { - return [{ attachType: item.attachType, tempFileId: item.tempFileId, metadata: item.isSolidColorCover && item.solidColor ? { purpose: SOLID_COLOR_COVER_PURPOSE, color: item.solidColor } : undefined }]; - } return []; }); } function buildSkuAttachmentList(photoItemList: PhotoItem[]): Attachment[] { return photoItemList.flatMap(item => { + if (item.tempFileId) { + return [{ + ...item.attachment, + attachType: item.attachType || item.attachment?.attachType || "PHOTO", + tempFileId: item.tempFileId + } as Attachment]; + } if (item.attachment) { return [{ ...item.attachment, attachType: item.attachType || item.attachment.attachType || "PHOTO" } as Attachment]; } - if (item.tempFileId) { - return [{ attachType: item.attachType || "PHOTO", tempFileId: item.tempFileId } as Attachment]; - } return []; }); }