1404/11/11-add description in product

This commit is contained in:
2026-01-31 10:19:21 +03:30
parent 00c2e38ab9
commit 19a8584fa0
4 changed files with 34 additions and 13 deletions
+9 -2
View File
@@ -36,7 +36,7 @@
<!-- Product Image -->
<div class="bg-gray-100 rounded-lg flex justify-center items-center p-3 min-w-[80px] h-[80px]">
<img
:src="getProductImage(item.product.group_type)"
:src="getProductImage(item.product)"
class="max-w-full max-h-full object-contain"
alt=""
/>
@@ -165,7 +165,14 @@ const totalPrice = computed(() => {
return cartStore.cartItems.reduce((sum, item) => sum + item.totalPrice, 0)
})
function getProductImage(type?: string) {
function getProductImage(product: any) {
// Check if product has file field from server with src property
if (product?.file?.src) {
return product.file.src
}
// Fallback to local images based on group_type if file is empty or doesn't exist
const type = product?.group_type
switch (type) {
case 'گوی':
return goyImg