import request from '@/utils/request' const v = '1.0' export type { OrderWorkbenchListResponse, OrderListPagination } from '@/api/order.index/orderindex' export type OrderWhere = Record export type OrderSort = { sortField?: string sortOrder?: 'asc' | 'desc' | 'ASC' | 'DESC' field?: string order?: 'asc' | 'desc' | 'ASC' | 'DESC' } export type OrderPagination = { page?: number pageSize?: number } export type EntrustOrderListParams = { pagination?: OrderPagination /** * 统一 where 条件对象;禁止传入 warehouse_id / warehouseId(后端按登录仓库上下文注入)。 * create_channel 订单来源渠道筛选(按订单表 create_channel 列过滤;枚举:MANUAL=手工单、API=接口、QM=奇门、STOCKOUT=出库转单): * {"create_channel":"MANUAL"} 单值精确;{"create_channel":["QM","API"]} 裸数组按 in 多选; * {"create_channel":{"operator":"in","value":["QM","API"]}} 标准结构多选;{"create_channel":{"operator":"ne","value":"MANUAL"}} 排除指定渠道。 * 注意:列表响应中的 create_channel 已格式化为中文标签,查询条件须传英文枚举值。 * 默认排除 B2B 订单(is_b2b='Y',NULL 存量行视为非 B2B)——服务端固定条件,前端无法通过 where 覆盖; * 需要查询 B2B 订单请使用 order.pendingOrder2b.list / order.deliveryOrder2b.list。 */ where?: OrderWhere sort?: OrderSort } export type EntrustOrderDetailParams = { ids?: Array | string | number id?: number | string order_id?: number | string orderId?: number | string tableType?: string tablePosition?: string type?: string moduleName?: string } export function orderEntrustOrderList(data: EntrustOrderListParams = {}): Promise { return request({ url: '/system', method: 'post', params: { method: 'order.entrustOrder.list', v, timestamp: Date.now() }, data, isSystemApi: true } as any) } export function orderEntrustOrderDetail(data: EntrustOrderDetailParams): Promise { return request({ url: '/system', method: 'post', params: { method: 'order.entrustOrder.detail', v, timestamp: Date.now() }, data, isSystemApi: true } as any) } export const orderEntrustOrder = { list: orderEntrustOrderList, detail: orderEntrustOrderDetail }