fix kashkool
This commit is contained in:
@@ -0,0 +1,184 @@
|
||||
<template>
|
||||
<div class="dinner cart-page">
|
||||
<div class="dinner__container">
|
||||
<DesktopPageTopbar title="سبد خرید" show-back>
|
||||
<template #trailing>
|
||||
<div v-if="price" class="dcart-header-price number-ltr">
|
||||
<span class="dcart-header-price__label">قیمت خرید از کشکول گلد:</span>
|
||||
<strong>{{ usePriceWithoutType(price?.price_last ?? 0) }}</strong>
|
||||
<span>ریال</span>
|
||||
</div>
|
||||
</template>
|
||||
</DesktopPageTopbar>
|
||||
|
||||
<GoldLoading v-model:show="infoVisible" title="" />
|
||||
|
||||
<template v-if="loading">
|
||||
<TransactionSkeleton v-for="i in 3" :key="i" class="mt-4" />
|
||||
</template>
|
||||
|
||||
<div v-else-if="cartStore.itemCount === 0" class="dinner-surface dcart-empty">
|
||||
<p>سبد خرید شما خالی است</p>
|
||||
<BasicButton type="primary" @click="router.push({ name: 'buyProduct' })">مشاهده محصولات</BasicButton>
|
||||
</div>
|
||||
|
||||
<div v-else class="dcart-grid">
|
||||
<div class="dcart-items">
|
||||
<article v-for="item in cartStore.cartItems" :key="item.id" class="dcart-item">
|
||||
<div class="dcart-item__image">
|
||||
<ProductImage :product="item.product" img-class="max-w-full max-h-full object-contain" />
|
||||
</div>
|
||||
<div class="dcart-item__main">
|
||||
<h3 class="dcart-item__title">{{ item.product.title }}</h3>
|
||||
<p class="dcart-item__meta">
|
||||
روش پرداخت: {{ item.method === 'cash' ? 'نقدی' : 'طلایی' }}
|
||||
<span v-if="item.method === 'cash' && item.gateway"> (با درگاه)</span>
|
||||
</p>
|
||||
<p class="dcart-item__meta">
|
||||
تعداد: {{ item.quantity }} عدد
|
||||
<span v-if="item.goldVazn"> | وزن: {{ formatWeight(item.goldVazn) }}</span>
|
||||
</p>
|
||||
<div class="dcart-item__footer">
|
||||
<span class="dcart-item__price">{{ usePrice(item.totalPrice) }}</span>
|
||||
<BasicIcon
|
||||
icon="vuesax-linear:trash"
|
||||
class="text-red-500 cursor-pointer"
|
||||
@click.stop="handleRemoveItem(item.id)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
<aside class="dinner-surface dcart-summary">
|
||||
<h2 class="dcart-summary__title">خلاصه سفارش</h2>
|
||||
|
||||
<div
|
||||
v-if="discountInfo?.amount > 0"
|
||||
class="dcart-summary__discount"
|
||||
>
|
||||
<div>
|
||||
<span>کد تخفیف: </span>
|
||||
<strong>{{ discountInfo.code }}</strong>
|
||||
<div class="text-xs text-green-600">{{ discountPercentLabel }} تخفیف اعمال شد</div>
|
||||
</div>
|
||||
<button type="button" class="dcart-summary__remove-discount" @click="removeDiscount">
|
||||
<BasicIcon icon="vuesax-linear:close-circle" size="18" />
|
||||
حذف
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="dcart-summary__row">
|
||||
<span>مجموع:</span>
|
||||
<div class="text-left">
|
||||
<div class="dcart-summary__total">{{ usePrice(displaytotalPrice) }}</div>
|
||||
<div v-if="discountInfo?.amount > 0" class="text-xs text-gray-400 line-through">
|
||||
{{ usePrice(totalPrice) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button
|
||||
v-if="!discountInfo?.amount"
|
||||
type="button"
|
||||
class="dcart-summary__discount-link"
|
||||
@click="showDiscountModal = true"
|
||||
>
|
||||
کد تخفیف دارم
|
||||
</button>
|
||||
|
||||
<BasicButton class="w-full" type="primary" size="large" @click="handleCheckout">
|
||||
تسویه حساب
|
||||
</BasicButton>
|
||||
</aside>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import router from '@/router'
|
||||
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 DesktopPageTopbar from '@/layouts/components/DesktopPageTopbar.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>
|
||||
.dcart-header-price {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 6px;
|
||||
font-size: 13px;
|
||||
color: #6b7280;
|
||||
|
||||
strong {
|
||||
font-size: 16px;
|
||||
color: #111827;
|
||||
}
|
||||
}
|
||||
|
||||
.dcart-empty {
|
||||
padding: 48px 24px;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
color: #6b7280;
|
||||
}
|
||||
|
||||
.dcart-summary__discount {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
padding: 12px;
|
||||
border-radius: 10px;
|
||||
background: rgba(167, 43, 119, 0.06);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.dcart-summary__remove-discount {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: #ef4444;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
.dcart-summary__discount-link {
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: @App-primary-color;
|
||||
font-size: 13px;
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
font-family: inherit;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user