Fixes: 1) Replace `ElNotification` calls with `useNotification` utility across all authentication and user-related composables; 2) Add missing semicolons in multiple index exports and styled components; 3) Resolve issues with reactivity in `useStore` composable by renaming and restructuring product variables; Extra: 1) Refactor localized strings and translations for better readability and maintenance; 2) Tweak styles including scoped styles, z-index adjustments, and SCSS mixins; 3) Remove unused components and imports to streamline storefront layout.
87 lines
No EOL
1.9 KiB
Vue
87 lines
No EOL
1.9 KiB
Vue
<template>
|
|
<div class="cart">
|
|
<div class="cart__top">
|
|
<div class="cart__top-left">
|
|
<p><span>{{ t('profile.cart.quantity') }}</span> {{ productsInCartQuantity }}</p>
|
|
<p><span>{{ t('profile.cart.total') }}</span> {{ totalPrice }}</p>
|
|
</div>
|
|
<ui-button class="cart__top-button">{{ t('buttons.checkout') }}</ui-button>
|
|
</div>
|
|
<div class="cart__list">
|
|
<cards-product
|
|
v-for="product in productsInCart"
|
|
:key="product.node.uuid"
|
|
:product="product.node.product"
|
|
:isList="true"
|
|
/>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import {usePageTitle} from "~/composables/utils/index.js";
|
|
|
|
const {t} = useI18n();
|
|
const cartStore = useCartStore();
|
|
|
|
const productsInCart = computed(() => {
|
|
return cartStore.currentOrder.orderProducts ? cartStore.currentOrder.orderProducts.edges : [];
|
|
});
|
|
const totalPrice = computed(() => {
|
|
return cartStore.currentOrder.totalPrice ? cartStore.currentOrder.totalPrice : [];
|
|
});
|
|
const productsInCartQuantity = computed(() => {
|
|
let count = 0;
|
|
cartStore.currentOrder.orderProducts?.edges.forEach((el) => {
|
|
count = count + el.node.quantity;
|
|
});
|
|
|
|
return count;
|
|
});
|
|
|
|
const { setPageTitle } = usePageTitle();
|
|
|
|
setPageTitle(t('breadcrumbs.cart'));
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.cart {
|
|
width: 100%;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 50px;
|
|
flex: 1;
|
|
min-height: 0;
|
|
|
|
&__top {
|
|
width: 100%;
|
|
background-color: $white;
|
|
padding: 20px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
box-shadow: 0 0 20px 2px rgba(0, 0, 0, 0.2);
|
|
|
|
& p {
|
|
font-weight: 600;
|
|
}
|
|
|
|
&-button {
|
|
width: fit-content;
|
|
padding-inline: 20px;
|
|
}
|
|
}
|
|
|
|
&__list {
|
|
width: 100%;
|
|
padding: 20px;
|
|
background-color: $white;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 20px;
|
|
box-shadow: 0 0 20px 2px rgba(0, 0, 0, 0.2);
|
|
flex: 1;
|
|
overflow-y: auto;
|
|
}
|
|
}
|
|
</style> |