oms/frontend/src/api/order.ts
liufumingren a51cb4df15 feat(frontend): 初始化 Vue3 + Vite 前端工程与业务页面
- 工程脚手架:Vite、TypeScript 配置、路由、Pinia store(auth/principal/menu)、请求封装
- 布局与通用组件:BasicLayout、SideMenu、DataTable/VirtualTable、VirtualSelect、ProductSelect、ImageUploader 等
- 业务页面:登录、首页、商品、店铺、店铺商品、组合商品、仓库/接口配置、库存、入库单、出库单、发货单(列表 + 创建)、外部接口、主体/主体用户、个人资料
- API 层:api/*.ts 与后端接口一一对应
2026-09-13 02:23:51 +08:00

79 lines
1.9 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { get, post, put, del } from '@/utils/request'
import type { OrderItemLine } from '@/api/orderItem'
export interface Receiver {
name?: string
phone?: string
address?: string
}
export interface OrderItem {
id: number
order_no: string
principal_id: number
shop_id: number | null
order_type: number
status: number
wms_status: string | null
wms_order_no: string | null
wms_synced_at: string | null
submit_status: number
submit_order_no: string | null
submit_at: string | null
submit_msg: string | null
total_amount: number | string
pay_amount: number | string | null
receiver: Receiver | null
remark: string | null
shop?: { id: number; name: string } | null
items?: OrderItemLine[]
created_at?: string
updated_at?: string
}
export interface OrderPayload {
order_no: string
shop_id?: number | null
items?: OrderItemLine[]
order_type?: number
total_amount?: number
pay_amount?: number | null
receiver?: Receiver | null
remark?: string
}
export interface OrderStatusPayload {
status?: number
submit_status?: number
submit_order_no?: string
submit_msg?: string
}
/** 当前主体下的订单列表(principal_id 由请求拦截器自动注入) */
export function getOrders(params?: object) {
return get<{ list: OrderItem[]; total: number; page: number; pageSize: number }>(
'/orders',
params,
)
}
/** 新增订单(order_no 全局唯一) */
export function createOrder(data: OrderPayload) {
return post<{ id: number }>('/orders', data)
}
/** 更新订单 */
export function updateOrder(id: number, data: Partial<OrderPayload>) {
return put<{ id: number }>(`/orders/${id}`, data)
}
/** 订单状态流转:主状态 / 上交状态 */
export function updateOrderStatus(id: number, data: OrderStatusPayload) {
return put<{ id: number }>(`/orders/${id}/status`, data)
}
/** 删除订单 */
export function deleteOrder(id: number) {
return del<{ id: number }>(`/orders/${id}`)
}