fix: create Account Page
This commit is contained in:
@@ -8,7 +8,7 @@ export interface CartItem {
|
||||
image: string
|
||||
price: number
|
||||
quantity: number
|
||||
product_number:string
|
||||
product_number: string
|
||||
}
|
||||
|
||||
export interface DeliveryMethod {
|
||||
@@ -24,7 +24,7 @@ export const useCartStore = defineStore('cart', () => {
|
||||
const selectedDeliveryMethodId = ref<number | null>(null)
|
||||
const shippingCost = ref(0)
|
||||
const vatRate = ref(0.23) // 23% VAT
|
||||
|
||||
const currentPage = ref(1)
|
||||
const deliveryMethods = ref<DeliveryMethod[]>([
|
||||
{ id: 1, name: 'Standard Delivery', price: 0, description: '5-7 business days' },
|
||||
{ id: 2, name: 'Express Delivery', price: 15, description: '2-3 business days' },
|
||||
@@ -66,7 +66,20 @@ export const useCartStore = defineStore('cart', () => {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function deleteProduct(id: number): boolean {
|
||||
const index = items.value.findIndex(a => a.id === id)
|
||||
if (index === -1) return false
|
||||
|
||||
items.value.splice(index, 1)
|
||||
resetProductPagination()
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
function resetProductPagination() {
|
||||
currentPage.value = 1
|
||||
}
|
||||
|
||||
function removeItem(itemId: number) {
|
||||
const index = items.value.findIndex(i => i.id === itemId)
|
||||
if (index !== -1) {
|
||||
@@ -106,6 +119,7 @@ export const useCartStore = defineStore('cart', () => {
|
||||
vatAmount,
|
||||
orderTotal,
|
||||
itemCount,
|
||||
deleteProduct,
|
||||
updateQuantity,
|
||||
removeItem,
|
||||
clearCart,
|
||||
|
||||
Reference in New Issue
Block a user