fix kashkool
This commit is contained in:
@@ -0,0 +1,142 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="absolute inset-0 bg-cover bg-center opacity-60 z--1" :style="{ backgroundImage: `url(${img})` }" />
|
||||
<div class="bg-white drop-shadow z-[1999] wrap-fix">
|
||||
<div class="py-3 px-3 font-bold flex items-center justify-between">
|
||||
<div>سبد خرید</div>
|
||||
<div v-if="price" class="flex gap-1 items-center text-xs flex-1 justify-end">
|
||||
<span class="text-gray-600 text-xs">قیمت خرید از کشکول گلد:</span>
|
||||
<div class="font-bold text-base" style="font-family: iran-sans; direction: ltr">
|
||||
{{ usePriceWithoutType(price?.price_last ?? 0) }}
|
||||
</div>
|
||||
<span class="text-xs">ریال</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<GoldLoading v-model:show="infoVisible" title="" />
|
||||
<div class="px-5 pt-26 pb-30" :class="loading ? 'h-[60vh]' : ''">
|
||||
<template v-if="loading">
|
||||
<TransactionSkeleton v-for="i in 3" :key="i" class="mt-4" />
|
||||
</template>
|
||||
<template v-else>
|
||||
<div v-if="cartStore.itemCount === 0" class="flex flex-col items-center justify-center h-[60vh]">
|
||||
<div class="text-gray-500 text-lg font-semibold mb-4">سبد خرید شما خالی است</div>
|
||||
<BasicButton type="primary" @click="router.push({ name: 'buyProduct' })">مشاهده محصولات</BasicButton>
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
<div class="space-y-4 mb-20">
|
||||
<div
|
||||
v-for="item in cartStore.cartItems"
|
||||
:key="item.id"
|
||||
class="bg-white rounded-lg border border-gray-200 p-4 shadow-sm"
|
||||
>
|
||||
<div class="flex gap-4">
|
||||
<div class="bg-gray-100 rounded-lg flex justify-center items-center p-1 min-w-[80px] h-[80px]">
|
||||
<ProductImage :product="item.product" img-class="max-w-full max-h-full object-contain" />
|
||||
</div>
|
||||
<div class="flex-1 flex flex-col justify-between">
|
||||
<div>
|
||||
<div class="text-base font-semibold mb-1">{{ item.product.title }}</div>
|
||||
<div class="text-xs text-gray-500 mb-2">
|
||||
روش پرداخت: {{ item.method === 'cash' ? 'نقدی' : 'طلایی' }}
|
||||
<span v-if="item.method === 'cash' && item.gateway" class="mr-2">(با درگاه)</span>
|
||||
</div>
|
||||
<div class="text-xs text-gray-500">
|
||||
تعداد: {{ item.quantity }} عدد
|
||||
<span v-if="item.goldVazn" class="mr-2">| وزن: {{ formatWeight(item.goldVazn) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center justify-between mt-2">
|
||||
<div class="text-primary font-bold">{{ usePrice(item.totalPrice) }}</div>
|
||||
<BasicIcon
|
||||
icon="vuesax-linear:trash"
|
||||
class="text-red-500 cursor-pointer"
|
||||
@click.stop="handleRemoveItem(item.id)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-center fixed bottom-20 left-0 right-0 z-1">
|
||||
<div class="md:w-[426px] w-full bg-white border-t border-gray-200 p-4 shadow-lg">
|
||||
<div
|
||||
v-if="discountInfo?.amount > 0"
|
||||
class="mb-3 flex items-center justify-between rounded-lg bg-purple-50 px-3 py-2"
|
||||
>
|
||||
<div class="flex flex-col gap-0.5 text-sm">
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="text-gray-600">کد تخفیف:</span>
|
||||
<span class="font-semibold">{{ discountInfo.code }}</span>
|
||||
</div>
|
||||
<div class="text-xs text-green-600">{{ discountPercentLabel }} تخفیف اعمال شد</div>
|
||||
</div>
|
||||
<button type="button" class="flex items-center gap-1 text-xs text-red-500" @click="removeDiscount">
|
||||
<BasicIcon icon="vuesax-linear:close-circle" size="18" />
|
||||
<span>حذف</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-between items-center mb-4">
|
||||
<div class="text-lg font-semibold">مجموع:</div>
|
||||
<div class="flex flex-col items-end gap-1">
|
||||
<div class="text-primary font-bold text-xl">{{ usePrice(displaytotalPrice) }}</div>
|
||||
<div v-if="discountInfo?.amount > 0" class="text-xs text-gray-400 line-through">
|
||||
{{ usePrice(totalPrice) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="!discountInfo?.amount" class="mb-3 text-center">
|
||||
<span class="text-xs text-primary underline cursor-pointer" @click="showDiscountModal = true">
|
||||
کد تخفیف دارم
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<BasicButton class="w-full py-3" type="primary" size="large" @click="handleCheckout">
|
||||
تسویه حساب
|
||||
</BasicButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import router from '@/router'
|
||||
import img from '@/assets/img/user_ly1.svg'
|
||||
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||
import GoldLoading from '@/components/GoldLoading.vue'
|
||||
import ProductImage from '@/components/ProductImage.vue'
|
||||
import TransactionSkeleton from '@/components/TransactionSkeleton.vue'
|
||||
import { usePrice, usePriceWithoutType } from '@/utils/usePrice'
|
||||
import { useCartPageContext } from '../composables/useCartPage'
|
||||
|
||||
const {
|
||||
cartStore,
|
||||
loading,
|
||||
infoVisible,
|
||||
showDiscountModal,
|
||||
discountInfo,
|
||||
price,
|
||||
totalPrice,
|
||||
displaytotalPrice,
|
||||
discountPercentLabel,
|
||||
formatWeight,
|
||||
handleRemoveItem,
|
||||
handleCheckout,
|
||||
removeDiscount,
|
||||
} = useCartPageContext()
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.text-primary {
|
||||
color: #d3a233;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user