fix: cart
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
<template>
|
<template>
|
||||||
<<<<<<< HEAD
|
|
||||||
<div class="flex flex-col gap-5 md:gap-10">
|
<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>
|
<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 flex-col lg:flex-row gap-5 md:gap-10">
|
||||||
@@ -21,12 +20,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="w-full">
|
<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
|
<div
|
||||||
class="bg-(--second-light) dark:bg-(--main-dark) rounded-lg border border-(--border-light) dark:border-(--border-dark) overflow-hidden">
|
class="bg-(--second-light) dark:bg-(--main-dark) rounded-lg border border-(--border-light) dark:border-(--border-dark) overflow-hidden">
|
||||||
<h2
|
<h2
|
||||||
@@ -102,7 +95,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</UModal>
|
</UModal>
|
||||||
</div>
|
</div>
|
||||||
<<<<<<< HEAD
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="flex justify-end gap-2">
|
<div class="flex justify-end gap-2">
|
||||||
@@ -114,17 +107,7 @@
|
|||||||
{{ t('Create') }}
|
{{ t('Create') }}
|
||||||
</UButton>
|
</UButton>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
|
||||||
=======
|
|
||||||
>>>>>>> bfcfbb36c83a49ea2e6f8844beb674b845c6acdb
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<<<<<<< HEAD
|
|
||||||
</template>
|
</template>
|
||||||
=======
|
|
||||||
</template>
|
|
||||||
>>>>>>> bfcfbb36c83a49ea2e6f8844beb674b845c6acdb
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import { ref, computed } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import { useFetchJson } from '@/composable/useFetchJson'
|
import { useFetchJson } from '@/composable/useFetchJson'
|
||||||
|
import type { ApiResponse } from '@/types'
|
||||||
|
import { useRoute } from 'vue-router'
|
||||||
|
|
||||||
export interface Cart {
|
export interface Cart {
|
||||||
id: number
|
id: number
|
||||||
@@ -137,15 +139,6 @@ export const useCartStore = defineStore('cart', () => {
|
|||||||
return fetchAddresses()
|
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) {
|
async function addNewCart(name: string) {
|
||||||
try {
|
try {
|
||||||
error.value = null
|
error.value = null
|
||||||
@@ -212,22 +205,6 @@ export const useCartStore = defineStore('cart', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
items,
|
|
||||||
selectedAddressId,
|
|
||||||
selectedDeliveryMethodId,
|
|
||||||
shippingCost,
|
|
||||||
vatRate,
|
|
||||||
deliveryMethods,
|
|
||||||
productsTotal,
|
|
||||||
vatAmount,
|
|
||||||
orderTotal,
|
|
||||||
itemCount,
|
|
||||||
deleteProduct,
|
|
||||||
updateQuantity,
|
|
||||||
removeItem,
|
|
||||||
clearCart,
|
|
||||||
setSelectedAddress,
|
|
||||||
setDeliveryMethod,
|
|
||||||
addresses,
|
addresses,
|
||||||
addressLoading,
|
addressLoading,
|
||||||
addressError,
|
addressError,
|
||||||
@@ -243,6 +220,7 @@ export const useCartStore = defineStore('cart', () => {
|
|||||||
deleteAddress,
|
deleteAddress,
|
||||||
setAddressPage,
|
setAddressPage,
|
||||||
setAddressSearchQuery,
|
setAddressSearchQuery,
|
||||||
getAddressTemplate
|
getAddressTemplate,
|
||||||
|
initCart
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
Reference in New Issue
Block a user