diff --git a/components/DeliveryInfo.vue b/components/DeliveryInfo.vue new file mode 100644 index 0000000..454843d --- /dev/null +++ b/components/DeliveryInfo.vue @@ -0,0 +1,146 @@ + + + + + diff --git a/components/PvzMap.vue b/components/PvzMap.vue index 78a6056..172d4a4 100644 --- a/components/PvzMap.vue +++ b/components/PvzMap.vue @@ -20,11 +20,11 @@ @true-bounds="trueBounds = $event" >
@@ -41,9 +41,10 @@ @@ -56,10 +54,13 @@ const { t } = useI18n() display: flex; flex-direction: row; align-items: center; - justify-content: space-between; text-align: center; padding: 0 16px; } + + h3 { + flex: auto; + } } .main { diff --git a/pages/cart.vue b/pages/cart.vue index c36908b..0fe4f37 100644 --- a/pages/cart.vue +++ b/pages/cart.vue @@ -19,7 +19,7 @@ import PayBlock from '../components/PayBlock.vue' const route = useRoute() const { cart } = useCart() -const { contacts } = useCheckout() +const { checkoutContacts, checkoutPickupPoint } = useCheckout() onMounted(async () => { if (!route?.query?.ID) @@ -32,12 +32,13 @@ onMounted(async () => { payment_method_title: 'Оплата по реквизитам', set_paid: true, billing: { - first_name: contacts?.value?.name, - last_name: contacts?.value?.surname, - phone: contacts?.value?.phone, - email: contacts?.value?.email, - address_1: 'ул. Ленина, 1', - city: 'Москва', + first_name: checkoutContacts?.value?.name, + last_name: checkoutContacts?.value?.surname, + phone: checkoutContacts?.value?.phone, + email: checkoutContacts?.value?.email, + address_1: checkoutPickupPoint.value?.address?.full_address, + postcode: checkoutPickupPoint.value?.address?.postal_code, + city: checkoutPickupPoint?.value?.address?.locality, country: 'RU', }, transaction_id: route?.query?.ID, diff --git a/pages/checkout/contacts.vue b/pages/checkout/contacts.vue index 359ee0f..d224fe9 100644 --- a/pages/checkout/contacts.vue +++ b/pages/checkout/contacts.vue @@ -140,14 +140,14 @@ diff --git a/pages/checkout/summary.vue b/pages/checkout/summary.vue index 76b2960..d5edb58 100644 --- a/pages/checkout/summary.vue +++ b/pages/checkout/summary.vue @@ -25,30 +25,7 @@ /> -
- - {{ contacts?.name }} {{ contacts?.surname }} -
- -
- - {{ contacts?.name }} {{ contacts?.surname }} -
- -
- - {{ contacts?.name }} {{ contacts?.surname }} -
- -
- - {{ contacts?.name }} {{ contacts?.surname }} -
- -
- - {{ contacts?.name }} {{ contacts?.surname }} -
+
@@ -66,17 +43,17 @@
- {{ contacts?.name }} {{ contacts?.surname }} + {{ checkoutContacts?.name }} {{ checkoutContacts?.surname }}
- {{ contacts?.email }} + {{ checkoutContacts?.email }}
- {{ contacts?.phone }} + {{ checkoutContacts?.phone }}
@@ -90,7 +67,7 @@ import SummaryCartItem from '../../components/cart/SummaryCartItem.vue' import PayBlock from '../../components/PayBlock.vue' const { cart } = useCart() -const { contacts, setStep } = useCheckout() +const { checkoutContacts, setStep } = useCheckout() definePageMeta({ layout: 'checkout', diff --git a/server/api/yandex_pvz.ts b/server/api/yandex_pvz.ts index cfc5df4..bd6ca1e 100644 --- a/server/api/yandex_pvz.ts +++ b/server/api/yandex_pvz.ts @@ -1,13 +1,14 @@ +import type { YandexPvzResponse } from '~/server/shared/types/yandex_pvz' import axios from 'axios' import { defineEventHandler, readBody } from 'h3' -export default defineEventHandler(async (event) => { +export default defineEventHandler(async (event): Promise => { try { const data = await readBody(event) const apiUrl = process.env.VITE_YANDEX_B2B_BASE_URL! const token = process.env.VITE_YANDEX_B2B_TOKEN! - const response = await axios.post( + const response = await axios.post( `${apiUrl}/pickup-points/list`, { geo_id: data?.geo_id, diff --git a/server/shared/types/yandex_pvz.ts b/server/shared/types/yandex_pvz.ts new file mode 100644 index 0000000..0324fb8 --- /dev/null +++ b/server/shared/types/yandex_pvz.ts @@ -0,0 +1,75 @@ +export interface GeoPosition { + latitude: number + longitude: number +} + +export interface PvzAddress { + apartment: string + building: string + comment: string + country: string + full_address: string + geoId: number + house: string + housing: string + locality: string + postal_code: string + region: string + street: string + subRegion: string +} + +export interface Contact { + phone: string +} + +export interface TimeObject { + hours: number + minutes: number +} + +export interface ScheduleRestriction { + days: number[] + time_from: TimeObject + time_to: TimeObject +} + +export interface Schedule { + time_zone: number + restrictions: ScheduleRestriction[] +} + +export interface PickupServices { + is_fitting_allowed: boolean + is_partial_refuse_allowed: boolean + is_paperless_pickup_allowed: boolean + is_unboxing_allowed: boolean +} + +export interface PickupPoint { + id: string + operator_station_id: string + operator_id: string + name: string + type: 'pickup_point' + address: PvzAddress + position: GeoPosition + instruction: string + available_for_dropoff: boolean + available_for_c2c_dropoff: boolean + contact: Contact + schedule: Schedule + pickup_services: PickupServices + payment_methods: string[] + is_dark_store: boolean + is_market_partner: boolean + is_post_office: boolean + is_yandex_branded: boolean + dayoffs: any[] + deactivation_date: string | null + deactivation_date_predicted_debt: string | null +} + +export interface YandexPvzResponse extends PickupPoint { + points: PickupPoint[] +}