карта ПВЗ
Some checks failed
Deploy / build (push) Failing after 24s

This commit is contained in:
alsaze
2025-10-17 03:32:57 +03:00
parent c38b6ba6a9
commit 887ea75e8b
10 changed files with 64 additions and 36 deletions

View File

@@ -1,5 +1,6 @@
<template>
<div class="cart">
</pre>
<div class="cart__items">
<div
v-for="cartItem in cart?.line_items"
@@ -26,7 +27,34 @@
import { useCart } from '~/composables'
const router = useRouter()
const route = useRoute()
const { cart } = useCart()
onMounted(async () => {
if (!route?.query?.ID)
return
await $fetch('/api/create', {
method: 'POST',
body: {
payment_method: 'bacs',
payment_method_title: 'Оплата по реквизитам',
set_paid: false,
billing: {
first_name: 'Иван',
last_name: 'Иванов',
address_1: 'ул. Ленина, 1',
city: 'Москва',
country: 'RU',
email: 'ivan@example.com',
phone: '+79990000000',
},
transaction_id: route?.query?.ID,
line_items: cart.value.line_items,
status: 'processing',
},
})
})
</script>
<style lang="scss">

View File

@@ -4,16 +4,8 @@
<script setup lang="ts">
import type { IBspb } from '~/server/shared/types/bspb'
import { usePostOrdersCreate } from '~/api/mutations/wp/usePostOrdersCreate'
import { useCart } from '~/composables'
const router = useRouter()
const { cart } = useCart()
const { mutateAsync } = usePostOrdersCreate()
const createOrder = async () => {
await mutateAsync({ line_items: cart.value.line_items })
const { data } = await useFetch<IBspb>('/api/bspb')
const redirectUrl = `${data?.value?.order?.hppUrl}?orderId=${data?.value?.order?.id}&password=${data.value?.order?.password}`