Modules
Orders
The order list with views, late orders, fulfilment progress, a quick view and the order detail page.
Orders carry channel, shippingMethod, an optional card (brand and last 4), discount, estimatedDelivery, gift and note. They are built from the customers and products mocks, so every line points to a real product.
Files
File | Role |
|---|---|
pages/e-commerce/orders/index.vue | The list. |
pages/e-commerce/orders/[id].vue | The order detail; 404 when the id does not exist. |
composables/useOrders.ts | Orders, statuses and tones, totals, lines and the next status. |
types/models/orders.ts | Orders, events, totals. |
config/orders.config.ts | Views, channel icons and dispatch and delivery windows. |
utils/orders.ts | Pure rules, unit tested. |
components/pages/orders/ | OrderProductStack, OrderFulfillment, OrderTracker, OrderQuickView, OrderItemsCard, OrderPaymentMethod, OrderStatusCard, OrderActivityCard, OrderDetailsAside. |
Data
useOrders() loads its data through a OrdersProvider (types/models/orders.ts); the demo uses createOrdersMockProvider(). Write a provider that calls your API and make it the default: the pages do not change. See Connect your API.
Permissions
The list and the detail need orders.view.
Configuration
ORDER_VIEWS
The views of the list.
const ORDER_VIEWS: OrderView[]
ORDER_URGENT_VIEWS
Views whose count turns red when it is not zero.
const ORDER_URGENT_VIEWS: OrderView[]
ORDER_STEPS
The fulfilment steps of the tracker.
const ORDER_STEPS: OrderStep[]
ORDER_CHANNEL_ICONS
The icon of each sales channel.
const ORDER_CHANNEL_ICONS: Record<OrderChannel, string>
ORDER_DISPATCH_HOURS
Hours to dispatch an order before it is late.
const ORDER_DISPATCH_HOURS: Record<OrderShippingMethod, number>
ORDER_DELIVERY_HOURS
Delivery hours per shipping method.
const ORDER_DELIVERY_HOURS: Record<OrderShippingMethod, number>
Rules
Pure functions in utils/, unit tested in tests/unit/. Statuses and segments are derived from the stored data, never stored themselves.
orderStepIndex()
The fulfilment step.
orderStepIndex(order: Pick<Order, 'status'>): number
orderDispatchDue()
When it must be dispatched.
orderDispatchDue(order: Order): string
isOrderLate()
Whether it is late.
isOrderLate(order: Order, now: Date): boolean
matchesOrderView()
Whether it belongs to a view.
matchesOrderView(order: Pick<Order, 'status' | 'paymentStatus'>, view: OrderView): boolean
orderViewCounts()
The count of every view.
orderViewCounts(orders: Pick<Order, 'status' | 'paymentStatus'>[]): Record<OrderView, number>
orderAttention()
Orders that need attention.
orderAttention(orders: Order[], now: Date): { late: number; unpaid: number; }lateunpaidHow it works
- Operational screens have no KPI cards: analytics live in the dashboards. A warning
BaseAlertappears only when something needs attention, and its action filters the table. - The table toolbar starts with the views as a
BaseToggleGroup compact fit; urgent counts turn red throughcountColor. - Columns: order (id, channel and relative date), customer (country, city and segment), products (
OrderProductStack), total with payment method and status, and delivery (OrderFulfillment: aBaseStepProgressplus express, late and gift chips). - Clicking a row opens
OrderQuickView, aBaseQuickViewwithOrderTracker, tracking, lines, totals, customer and the next-status action. The id links to the detail page. It starts withOrderStatusCard: the payment chip, a headline and a sentence fromorderSummary()(waiting for payment, ready to prepare, dispatch or delivery late, delivered…) with its date, the actions (mark as paid, next status, refund) and the tracker. Below come the items andOrderActivityCard, which merges the events with the team notes added throughaddComment(); the side column is oneOrderDetailsAsidecard with the customer, shipping, the customer note and the payment. - Status tones for
BaseStatusChipareORDER_STATUS_TONESandORDER_PAYMENT_TONES.