fix: cart
This commit is contained in:
@@ -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
|
||||
@@ -83,13 +76,13 @@
|
||||
<template #header>
|
||||
<h3 class="text-lg font-semibold text-black dark:text-white">{{ t('Create New Cart') }}</h3>
|
||||
</template>
|
||||
<template #body>
|
||||
<template #body>
|
||||
<div class="flex flex-col gap-4">
|
||||
<UInput v-model="newCartName" :placeholder="t('Cart name')"
|
||||
class="w-full bg-white dark:bg-gray-800 text-black dark:text-white" />
|
||||
</div>
|
||||
</template>
|
||||
<template #footer>
|
||||
<template #footer>
|
||||
<div class="flex justify-end gap-2">
|
||||
<UButton variant="outline" color="neutral" @click="showCreateModal = false">
|
||||
{{ t('Cancel') }}
|
||||
@@ -100,31 +93,21 @@
|
||||
</UButton>
|
||||
</div>
|
||||
</template>
|
||||
</UModal>
|
||||
</div>
|
||||
<<<<<<< HEAD
|
||||
</template>
|
||||
<template #footer>
|
||||
<div class="flex justify-end gap-2">
|
||||
<UButton variant="outline" color="neutral" @click="showCreateModal = false">
|
||||
{{ t('Cancel') }}
|
||||
</UButton>
|
||||
<UButton color="primary" @click="createCart" :disabled="!newCartName.trim()"
|
||||
class="bg-(--accent-blue-light) dark:bg-(--accent-blue-dark) text-white">
|
||||
{{ t('Create') }}
|
||||
</UButton>
|
||||
</div>
|
||||
</label>
|
||||
=======
|
||||
>>>>>>> bfcfbb36c83a49ea2e6f8844beb674b845c6acdb
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<<<<<<< HEAD
|
||||
</template>
|
||||
=======
|
||||
</UModal>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #footer>
|
||||
<div class="flex justify-end gap-2">
|
||||
<UButton variant="outline" color="neutral" @click="showCreateModal = false">
|
||||
{{ t('Cancel') }}
|
||||
</UButton>
|
||||
<UButton color="primary" @click="createCart" :disabled="!newCartName.trim()"
|
||||
class="bg-(--accent-blue-light) dark:bg-(--accent-blue-dark) text-white">
|
||||
{{ t('Create') }}
|
||||
</UButton>
|
||||
</div>
|
||||
</template>
|
||||
>>>>>>> bfcfbb36c83a49ea2e6f8844beb674b845c6acdb
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
|
||||
@@ -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
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user