deploy
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
export const DELIVERY_CARRIER_CODES = ['RUSSIAN_POST', 'OZON_PVZ', 'YANDEX_PVZ', 'FIVE_POST'] as const
|
||||
|
||||
export type DeliveryCarrierCode = (typeof DELIVERY_CARRIER_CODES)[number]
|
||||
|
||||
/** Варианты для формы чекаута (код → подпись). */
|
||||
export const DELIVERY_CARRIER_OPTIONS: ReadonlyArray<{ code: DeliveryCarrierCode; label: string }> = [
|
||||
{ code: 'RUSSIAN_POST', label: 'Почта России' },
|
||||
{ code: 'OZON_PVZ', label: 'Озон доставка (пункт выдачи)' },
|
||||
{ code: 'YANDEX_PVZ', label: 'Яндекс доставка (пункт выдачи)' },
|
||||
{ code: 'FIVE_POST', label: '5Post (пункт выдачи)' },
|
||||
]
|
||||
|
||||
const carrierLabelMap: Record<DeliveryCarrierCode, string> = Object.fromEntries(
|
||||
DELIVERY_CARRIER_OPTIONS.map((o) => [o.code, o.label]),
|
||||
) as Record<DeliveryCarrierCode, string>
|
||||
|
||||
export function deliveryCarrierLabelRu(code: string | null | undefined): string | null {
|
||||
if (!code) return null
|
||||
return carrierLabelMap[code as DeliveryCarrierCode] ?? code
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
export const ORDER_STATUSES = [
|
||||
'DRAFT',
|
||||
'DELIVERY_FEE_ADJUSTMENT',
|
||||
'PENDING_PAYMENT',
|
||||
'PAYMENT_VERIFICATION',
|
||||
'PAID',
|
||||
@@ -17,6 +18,8 @@ export function getAdminNextOrderStatuses(status: string, deliveryType: 'deliver
|
||||
switch (status) {
|
||||
case 'DRAFT':
|
||||
return ['PENDING_PAYMENT', 'CANCELLED']
|
||||
case 'DELIVERY_FEE_ADJUSTMENT':
|
||||
return ['CANCELLED']
|
||||
case 'PENDING_PAYMENT':
|
||||
return ['CANCELLED']
|
||||
case 'PAYMENT_VERIFICATION':
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/** Снимок адреса из addressSnapshotJson при оформлении заказа */
|
||||
export type OrderAddressSnapshot = {
|
||||
deliveryType?: 'delivery' | 'pickup'
|
||||
label?: string | null
|
||||
recipientName?: string
|
||||
recipientPhone?: string
|
||||
addressLine?: string
|
||||
comment?: string | null
|
||||
}
|
||||
|
||||
export function parseOrderAddressSnapshot(json: string | null | undefined): OrderAddressSnapshot | null {
|
||||
if (!json) return null
|
||||
try {
|
||||
return JSON.parse(json) as OrderAddressSnapshot
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
export function orderStatusLabelRu(code: string): string {
|
||||
const map: Record<string, string> = {
|
||||
DRAFT: 'Черновик',
|
||||
DELIVERY_FEE_ADJUSTMENT: 'Корректировка стоимости доставки',
|
||||
PENDING_PAYMENT: 'Ожидает оплаты',
|
||||
PAYMENT_VERIFICATION: 'Проверка оплаты',
|
||||
PAID: 'Оплачен',
|
||||
|
||||
Reference in New Issue
Block a user