Merge remote-tracking branch 'origin/master'

This commit is contained in:
M_Kececi
2026-03-13 14:06:18 +03:00
parent fd034c9ae6
commit 7091da5b10
2 changed files with 50 additions and 10 deletions

View File

@@ -923,22 +923,42 @@ async function openProductCard(grp1, grp2) {
const colorCode = String(grp2?.colorCode || '').trim()
const secondColor = String(grp2?.secondColor || '').trim()
const listKey = buildImageKey(productCode, colorCode, secondColor)
const codeTrim = String(productCode || '').trim().toUpperCase()
const colorTrim = String(colorCode || '').trim().toUpperCase()
const secondTrim = String(secondColor || '').trim().toUpperCase()
await ensureProductImage(productCode, colorCode, secondColor)
const list = Array.isArray(productImageListByCode.value[listKey]) ? productImageListByCode.value[listKey] : []
let list = Array.isArray(productImageListByCode.value[listKey]) ? productImageListByCode.value[listKey] : []
if (!list.length && codeTrim) {
try {
const params = { code: codeTrim, dim1: colorTrim, dim3: secondTrim }
const res = await api.get('/product-images', { params })
list = Array.isArray(res?.data) ? res.data : []
productImageListByCode.value[listKey] = list
} catch (err) {
console.warn('[ProductStockQuery] product card image list refetch failed', {
code: codeTrim,
color: colorTrim,
secondColor: secondTrim,
err
})
}
}
const images = list
.map((item) => {
const resolved = resolveProductImageUrl(item)
return resolved.contentUrl || resolved.publicUrl || ''
return resolved.publicUrl || resolved.contentUrl || ''
})
.filter((x) => String(x || '').trim() !== '')
const uniqueImages = Array.from(new Set(images))
if (!images.length) {
if (!uniqueImages.length) {
const single = getProductImageUrl(productCode, colorCode, secondColor)
if (single) images.push(single)
if (single) uniqueImages.push(single)
}
productCardImages.value = images
productCardImages.value = uniqueImages
productCardSlide.value = 0
productCardData.value = {
productCode,