fix: cart

This commit is contained in:
2026-04-15 13:37:46 +02:00
parent be0687f4a9
commit b13293572c
2 changed files with 21 additions and 60 deletions

View File

@@ -1,5 +1,4 @@
<template>
<<<<<<< HEAD
<div class="flex flex-col gap-5 md:gap-10">
<h1 class="text-2xl font-bold text-black dark:text-white">{{ t('Shopping Cart') }}</h1>
<div class="flex flex-col lg:flex-row gap-5 md:gap-10">
@@ -21,12 +20,6 @@
</div>
<div class="w-full">
=======
<div class="flex flex-col gap-5 md:gap-10">
<h1 class="text-2xl font-bold text-black dark:text-white">{{ t('Shopping Cart') }}</h1>
<div class="flex flex-col lg:flex-row gap-5 md:gap-10">
<div class="flex-1">
>>>>>>> bfcfbb36c83a49ea2e6f8844beb674b845c6acdb
<div
class="bg-(--second-light) dark:bg-(--main-dark) rounded-lg border border-(--border-light) dark:border-(--border-dark) overflow-hidden">
<h2
@@ -102,7 +95,7 @@
</template>
</UModal>
</div>
<<<<<<< HEAD
</div>
</template>
<template #footer>
<div class="flex justify-end gap-2">
@@ -114,17 +107,7 @@
{{ t('Create') }}
</UButton>
</div>
</label>
=======
>>>>>>> bfcfbb36c83a49ea2e6f8844beb674b845c6acdb
</div>
</div>
</div>
<<<<<<< HEAD
</template>
=======
</template>
>>>>>>> bfcfbb36c83a49ea2e6f8844beb674b845c6acdb
<script setup lang="ts">
import { ref, onMounted } from 'vue'

View File

@@ -1,6 +1,8 @@
import { defineStore } from 'pinia'
import { ref, computed } from 'vue'
import { computed, ref } from 'vue'
import { useFetchJson } from '@/composable/useFetchJson'
import type { ApiResponse } from '@/types'
import { useRoute } from 'vue-router'
export interface Cart {
id: number
@@ -137,15 +139,6 @@ export const useCartStore = defineStore('cart', () => {
return fetchAddresses()
}
function initMockData() {
items.value = [
{ id: 1, productId: 101, name: 'Premium Widget Pro', product_number: 'NC209/7000', image: '/img/product-1.jpg', price: 129.99, quantity: 2 },
{ id: 2, productId: 102, name: 'Ultra Gadget X', product_number: 'NC234/6453', image: '/img/product-2.jpg', price: 89.50, quantity: 1 },
{ id: 3, productId: 103, name: 'Mega Tool Set', product_number: 'NC324/9030', image: '/img/product-3.jpg', price: 249.00, quantity: 3 }
]
}
async function addNewCart(name: string) {
try {
error.value = null
@@ -212,22 +205,6 @@ export const useCartStore = defineStore('cart', () => {
})
return {
items,
selectedAddressId,
selectedDeliveryMethodId,
shippingCost,
vatRate,
deliveryMethods,
productsTotal,
vatAmount,
orderTotal,
itemCount,
deleteProduct,
updateQuantity,
removeItem,
clearCart,
setSelectedAddress,
setDeliveryMethod,
addresses,
addressLoading,
addressError,
@@ -243,6 +220,7 @@ export const useCartStore = defineStore('cart', () => {
deleteAddress,
setAddressPage,
setAddressSearchQuery,
getAddressTemplate
getAddressTemplate,
initCart
}
})