This commit is contained in:
2026-06-13 12:20:11 +03:30
parent 68be4fd5a1
commit f7ba6963ef
10 changed files with 236 additions and 267 deletions
+4 -35
View File
@@ -39,10 +39,9 @@
<div class="flex gap-4">
<!-- Product Image -->
<div class="bg-gray-100 rounded-lg flex justify-center items-center p-1 min-w-[80px] h-[80px]">
<img
:src="getProductImage(item.product)"
class="max-w-full max-h-full object-contain"
alt=""
<ProductImage
:product="item.product"
img-class="max-w-full max-h-full object-contain"
/>
</div>
@@ -151,16 +150,10 @@ import {useFundUserStore} from '@/store/fundStore'
import type {Price} from '@/models/home'
import type {Order} from '@/models/order'
// Image imports
import defaultImg from '@/assets/img/defaultAbshodeh.svg'
import goyImg from '@/assets/img/goyImg.svg'
import mokaabImg from '@/assets/img/mokaabImg.svg'
import sekkeImg from '@/assets/img/sekkeImg.svg'
import parsianImg from '@/assets/img/parsianImg.svg'
import venusImg from '@/assets/img/venousImg.svg'
import {loading, getToken} from '@/utils'
import GoldLoading from '@/components/GoldLoading.vue'
import TransactionSkeleton from '@/components/TransactionSkeleton.vue'
import ProductImage from '@/components/ProductImage.vue'
import {registerCodeDiscount} from "@/api/giftCard";
const cartStore = useCartStore()
@@ -208,30 +201,6 @@ async function submitDiscount() {
}
}
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
case 'مکعب':
return mokaabImg
case 'سکه':
return sekkeImg
case 'شمش ونوس':
return venusImg
case 'سکه پارسیان':
return parsianImg
default:
return defaultImg
}
}
function getProductAmount(amount?: number) {
if (!amount) return ''
if (amount < 1) {