diff --git a/app/components/orders/OrderItemsTable.vue b/app/components/orders/OrderItemsTable.vue new file mode 100644 index 0000000..13ad39b --- /dev/null +++ b/app/components/orders/OrderItemsTable.vue @@ -0,0 +1,263 @@ + + + diff --git a/app/components/orders/OrderStatusTimelineCard.vue b/app/components/orders/OrderStatusTimelineCard.vue index 2244d9c..a487c22 100644 --- a/app/components/orders/OrderStatusTimelineCard.vue +++ b/app/components/orders/OrderStatusTimelineCard.vue @@ -41,7 +41,6 @@ function markerClass(state: 'done' | 'current' | 'upcoming') { @click="isExpanded = !isExpanded" >
-

Текущий статус

{{ presentation.title }}

diff --git a/app/composables/graphql/generated.ts b/app/composables/graphql/generated.ts index 4664448..49e6d3a 100644 --- a/app/composables/graphql/generated.ts +++ b/app/composables/graphql/generated.ts @@ -965,7 +965,7 @@ export type OrderDetailQueryVariables = Exact<{ }>; -export type OrderDetailQuery = { __typename?: 'Query', order?: { __typename?: 'Order', id: string, code: string, kind: OrderKind, status: OrderStatus, customerId: string, deliveryAddress?: string | null, deliveryTerms?: string | null, deliveryFee?: number | null, totalPrice?: number | null, createdAt: any, items: Array<{ __typename?: 'OrderItem', id: string, productName: string, quantity: number, unitPrice?: number | null, lineTotal?: number | null }> } | null }; +export type OrderDetailQuery = { __typename?: 'Query', order?: { __typename?: 'Order', id: string, code: string, kind: OrderKind, status: OrderStatus, customerId: string, deliveryAddress?: string | null, deliveryTerms?: string | null, deliveryFee?: number | null, totalPrice?: number | null, calculationPayload?: any | null, createdAt: any, items: Array<{ __typename?: 'OrderItem', id: string, productName: string, quantity: number, unitPrice?: number | null, lineTotal?: number | null }> } | null }; export type SubmitCalculationOrderMutationVariables = Exact<{ input: SubmitCalculationOrderInput; @@ -2326,6 +2326,7 @@ export const OrderDetailDocument = gql` deliveryTerms deliveryFee totalPrice + calculationPayload createdAt items { id diff --git a/app/pages/cart.vue b/app/pages/cart.vue index 8dffa46..a64fe2f 100644 --- a/app/pages/cart.vue +++ b/app/pages/cart.vue @@ -60,15 +60,6 @@ onMounted(() => { void fetchCart(true); }); -function lineVolume(productId: string) { - const item = cartItems.value.find((entry) => entry.productId === productId); - if (!item) { - return 0; - } - - return Number(item.quantity) * Number(item.parameters.width) * Number(item.parameters.thickness); -} - function increment(productId: string) { success.value = ''; errorMessage.value = ''; @@ -197,30 +188,22 @@ async function submitCart() { Корзина пока пустая. Добавьте товар из каталога.
- +
diff --git a/app/pages/client-orders/[id].vue b/app/pages/client-orders/[id].vue index 40dcb8f..83eb4c4 100644 --- a/app/pages/client-orders/[id].vue +++ b/app/pages/client-orders/[id].vue @@ -10,7 +10,6 @@ import { formatPrice, orderLogisticsStateText, orderDeliveryStateText, - orderLineStateText, } from '~/composables/useOrderDetailPresentation'; definePageMeta({ @@ -76,19 +75,6 @@ function parseMoneyDraft(value: string) { return Math.round((normalized + Number.EPSILON) * 100) / 100; } -function draftUnitPrice(itemId: string, fallback?: number | null) { - return parseMoneyDraft(itemPriceDrafts[itemId] ?? '') ?? fallback ?? null; -} - -function draftLineTotal(item: ManagerOrderItem['items'][number]) { - const unitPrice = draftUnitPrice(item.id, item.unitPrice); - if (unitPrice == null) { - return null; - } - - return Math.round((unitPrice * item.quantity + Number.EPSILON) * 100) / 100; -} - const draftDeliveryTerms = computed(() => deliveryTermsDraft.value.trim() || currentOrder.value?.deliveryTerms || null); const draftDeliveryFee = computed(() => parseMoneyDraft(deliveryFeeDraft.value) ?? currentOrder.value?.deliveryFee ?? null); const canEditOffer = computed(() => ( @@ -233,29 +219,17 @@ watch( audience="manager" /> -
+

Состав заказа

-
    -
  • -
    -

    {{ item.productName }} × {{ item.quantity }}

    -

    {{ orderLineStateText(draftUnitPrice(item.id, item.unitPrice), draftLineTotal(item)) }}

    -
    - - -
  • -
+
diff --git a/app/pages/orders/[id].vue b/app/pages/orders/[id].vue index 91dde59..214ef22 100644 --- a/app/pages/orders/[id].vue +++ b/app/pages/orders/[id].vue @@ -5,9 +5,8 @@ import { type OrderDetailQuery, } from '~/composables/graphql/generated'; import { - orderLogisticsStateText, orderDeliveryStateText, - orderLineStateText, + orderLogisticsStateText, } from '~/composables/useOrderDetailPresentation'; type OrderItem = NonNullable; @@ -48,18 +47,13 @@ const currentOrder = computed(() => audience="client" /> -
+

Состав заказа

-
    -
  • -

    {{ item.productName }} × {{ item.quantity }}

    -

    {{ orderLineStateText(item.unitPrice, item.lineTotal) }}

    -
  • -
+
diff --git a/graphql/operations/orders/order-detail.graphql b/graphql/operations/orders/order-detail.graphql index dd302e1..77b1045 100644 --- a/graphql/operations/orders/order-detail.graphql +++ b/graphql/operations/orders/order-detail.graphql @@ -9,6 +9,7 @@ query OrderDetail($id: ID!) { deliveryTerms deliveryFee totalPrice + calculationPayload createdAt items { id