fix(intake): match sku images by displayed spu
This commit is contained in:
parent
0c2b05ce74
commit
d650e2f562
@ -1791,6 +1791,59 @@ describe("NonIntegratedDetailClient", () => {
|
||||
expect(screen.getByDisplayValue("DNZ038501")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("matches batch SKU images against the displayed finished series SPU", async () => {
|
||||
const actor = userEvent.setup();
|
||||
saveNonIntegratedProduct(
|
||||
createProductRecord({
|
||||
id: "DNZ0385-series-image-match",
|
||||
productDevelopmentKind: "series",
|
||||
spu: "DNZ0405",
|
||||
productCode: "DNZ0405",
|
||||
formalSpuAssigned: true,
|
||||
metadata: {
|
||||
sourceSeriesCode: "DBZ",
|
||||
sourceSeriesName: "单板桌 DBZ",
|
||||
componentSpu: "DNZ0384",
|
||||
finishedProductSpu: "DNZ0385",
|
||||
},
|
||||
openingReference: {
|
||||
...createEmptyNonIntegratedOpeningReference(),
|
||||
productName: "单板桌 DBZ",
|
||||
temporaryCode: "DNZ0385",
|
||||
productCategory: "电脑桌",
|
||||
salesCategory: "桌类",
|
||||
},
|
||||
skuItems: [
|
||||
createSkuItem({
|
||||
id: "sku-series-image-match-1",
|
||||
skuCode: "DNZ040501",
|
||||
barcode: "DNZ040501V01",
|
||||
}),
|
||||
],
|
||||
}),
|
||||
);
|
||||
|
||||
const { container } = render(
|
||||
<NonIntegratedDetailClient
|
||||
mode="edit"
|
||||
productId="DNZ0385-series-image-match"
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(screen.getByDisplayValue("DNZ038501")).toBeInTheDocument();
|
||||
const batchSkuImageInput = container.querySelector<HTMLInputElement>(
|
||||
'input[type="file"][accept="image/*"][multiple]',
|
||||
);
|
||||
expect(batchSkuImageInput).toBeInTheDocument();
|
||||
|
||||
await actor.upload(
|
||||
batchSkuImageInput!,
|
||||
new File(["image"], "DNZ038501.jpg", { type: "image/jpeg" }),
|
||||
);
|
||||
|
||||
expect(await screen.findByText("已匹配 1 张SKU图片")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("does not treat a temporary code as formal when only basic info is approved", () => {
|
||||
saveNonIntegratedProduct(
|
||||
createProductRecord({
|
||||
|
||||
@ -20779,7 +20779,7 @@ export default function NonIntegratedDetailClient({
|
||||
const derivedItem = deriveSkuItem(
|
||||
item,
|
||||
index,
|
||||
formValues.spu,
|
||||
skuCodePreviewSpu,
|
||||
formValues,
|
||||
);
|
||||
const matchedImage = imageMap.get(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user