Files
hossein-por-shop/frontend/components/product/ProductHero.vue
T
marzban-dev 85e4296e60 Updated
2025-01-28 22:09:53 +03:30

77 lines
2.2 KiB
Vue

<script lang="ts" setup>
// import
import useGetProduct from "~/composables/api/product/useGetProduct";
// state
const route = useRoute();
const id = route.params.id as string | undefined;
const { data: product } = useGetProduct(id);
const quantity = ref(1);
const selectedSlide = ref(0);
const slides = computed(() => {
return [
{
id: 0,
picture: product.value!.image1
},
{
id: 1,
picture: product.value!.image2
},
{
id: 2,
picture: product.value!.image3
}
];
});
</script>
<template>
<div class="flex gap-12 container pt-[5rem]">
<Slider
class="flex-1"
v-model:selectedSlide="selectedSlide"
:slides="slides"
/>
<div class="flex-1 flex flex-col gap-3 mt-12">
<span class="typo-label-sm"> سامسونگ </span>
<h1 class="typo-h-2"> {{ product!.name }} </h1>
<div class="flex w-full items-center justify-between">
<span class="typo-p-2xl"> {{ product!.price }} </span>
<Rating />
</div>
<p class="typo-p-md text-slate-500 text-justify">
{{ product!.description }}
</p>
<div class="w-full flex flex-col gap-6 mt-4">
<RemainQuantity
:maxQuantity="product!.in_stock"
:quantity="quantity"
/>
<div class="w-full flex gap-3 flex-col">
<div class="w-full flex gap-3">
<Button class="w-full rounded-full" end-icon="ci:plus">
افزودن به سبد خرید
</Button>
<QuantityCounter
v-model="quantity"
:max="product!.in_stock"
/>
</div>
<Button class="w-full rounded-full" variant="outlined">
همین الان بخر
</Button>
</div>
<InfoCard />
<Share />
</div>
</div>
</div>
</template>