карты пвз
Some checks failed
Deploy / build (push) Failing after 7s

This commit is contained in:
alsaze
2025-11-13 16:24:10 +03:00
parent bd4edfdade
commit f857c40ca2
8 changed files with 141 additions and 20 deletions

View File

@@ -23,6 +23,10 @@ export const useCart = () => {
cartItem?.variation_id === item?.variation_id), 1)
}
const cartRemoveAllItems = () => {
cart.value = { line_items: [] }
}
const cartProducts = computed(() => cart?.value?.line_items?.map((line_item) => {
const { productsData } = useProduct(line_item?.variation_id.toString())
return productsData
@@ -37,6 +41,7 @@ export const useCart = () => {
cart,
cartAddItem,
cartRemoveItem,
cartRemoveAllItems,
cartProducts,
cartSum,

View File

@@ -34,14 +34,17 @@ export const useCheckout = createSharedComposable(() => {
{
step: 1,
title: isMobile.value ? 'mobileDelivery' : 'delivery',
route: 'delivery',
},
{
step: 2,
title: isMobile.value ? 'mobileContacts' : 'contacts',
route: 'contacts',
},
{
step: 3,
title: isMobile.value ? 'mobileSummary' : 'summary',
route: 'summary',
},
]
@@ -57,7 +60,7 @@ export const useCheckout = createSharedComposable(() => {
const findIndex = checkoutSteps.findIndex(value => value.step === currentCheckoutStep.value.step)
if (findIndex !== 0) {
currentCheckoutStep.value = checkoutSteps[findIndex - 1]
router.push(`/checkout/${currentCheckoutStep?.value.title}`)
router.push(`/checkout/${currentCheckoutStep?.value.route}`)
}
else {
router.push(`/cart`)
@@ -68,12 +71,12 @@ export const useCheckout = createSharedComposable(() => {
const findIndex = checkoutSteps.findIndex(value => value.step === currentCheckoutStep.value.step)
if (findIndex + 1 !== checkoutSteps.length) {
currentCheckoutStep.value = checkoutSteps[findIndex + 1]
router.push(`/checkout/${currentCheckoutStep?.value.title}`)
router.push(`/checkout/${currentCheckoutStep?.value.route}`)
}
}
function setStep(pathName: string) {
currentCheckoutStep.value = checkoutSteps.find(value => value.title === pathName) || checkoutSteps[0]
currentCheckoutStep.value = checkoutSteps.find(value => value.route === pathName) || checkoutSteps[0]
router.push(`/checkout/${pathName}`)
}