备货:行内「备货」打开作业窗口(startB2bPrep 激活),窗口内完成分箱登记(getB2bPackingSnapshot/updateB2bPackingItems,含取货储位)与备货完成(备货照片 updateB2bOrderImages + finishB2bPrep);齐套校验失败展示 item_mismatches;关闭窗口(含遮罩/ESC)统一提示取消备货(cancelB2bPrep)。 提货:确认提货进入操作列,车牌 + 提货照片随 pickupB2b 一次提交,提货即出库完成;已提货订单车牌锁定仅可追加照片。 列表:操作列按状态动态生成(备货/确认提货/设置车牌),移除独立分箱入口;B2B 列表补充作业创建时间、备货/提货照片;B2B 详情补充 b2b 作业明细、备货与提货照片分组展示。 其它:COS 图片上传兼容多层 data 包裹并回传 fileId;UpperTable 操作列宽度不受历史列配置覆盖。 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
384 lines
12 KiB
TypeScript
384 lines
12 KiB
TypeScript
import request from '@/utils/request'
|
||
import type { OrderDetailB2bInfo, OrderDetailImage } from '@/api/order/order'
|
||
|
||
const v = '1.0'
|
||
|
||
export type { OrderWorkbenchListResponse, OrderListPagination } from '@/api/order.index/orderindex'
|
||
|
||
export type OrderWhere = Record<string, any>
|
||
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 DeliveryOrderListParams = {
|
||
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 DeliveryOrderDetailParams = {
|
||
ids?: Array<number | string> | string | number
|
||
id?: number | string
|
||
order_id?: number | string
|
||
orderId?: number | string
|
||
tableType?: string
|
||
tablePosition?: string
|
||
type?: string
|
||
moduleName?: string
|
||
}
|
||
|
||
/** order.deliveryOrder.list 单条 raw 行(dispatch 模型) */
|
||
export type DeliveryOrderListItem = {
|
||
id: number
|
||
delivery_order_code: string
|
||
pre_delivery_order_code?: string
|
||
pre_delivery_order_id?: string
|
||
order_type?: string
|
||
order_flag?: string
|
||
source_order_codes?: string
|
||
sys_platform_code?: string
|
||
sys_platform_name?: string
|
||
create_at?: string | null
|
||
place_order_time?: string | null
|
||
pay_time?: string | null
|
||
pay_no?: string
|
||
service_code?: string | null
|
||
operator_name?: string | null
|
||
operate_time?: string | null
|
||
delivery_time?: string | null
|
||
shop_nick?: string
|
||
seller_nick?: string | null
|
||
buyer_nick?: string | null
|
||
buyer_message?: string
|
||
seller_message?: string
|
||
remark?: string
|
||
/** 货主备注 */
|
||
store_remark?: string
|
||
total_amount?: string
|
||
item_amount?: string
|
||
discount_amount?: string
|
||
freight?: string
|
||
ar_amount?: string
|
||
got_amount?: string
|
||
service_fee?: string | null
|
||
logistics_name?: string
|
||
delivery_type?: string | null
|
||
/** 重量类型 */
|
||
weight_type?: string | number | null
|
||
is_urgency?: string
|
||
/** 是否含 SN(序列号) 商品原始列(后端订单分表 has_sn_item,enum Y/N;旧版基表存量恒为 N) */
|
||
has_sn_item?: 'Y' | 'N'
|
||
/** 是否含 SN(序列号) 商品归一化字段(与 has_sn_item 同义,筛选与展示统一用它) */
|
||
is_sn_order?: 'Y' | 'N'
|
||
invoice_flag?: string
|
||
status?: string
|
||
name?: string
|
||
zip_code?: string
|
||
tel?: string
|
||
mobile?: string
|
||
email?: string
|
||
province?: string
|
||
city?: string
|
||
area?: string
|
||
town?: string
|
||
detail_address?: string
|
||
id_type?: string | null
|
||
id_number?: string | null
|
||
sync_status?: string
|
||
items?: string
|
||
items_count?: number
|
||
items_total?: number
|
||
/** 订单商品总重量(g) */
|
||
items_weight?: string
|
||
wave_id?: number
|
||
wave_no?: string
|
||
/** 波次内序号 */
|
||
wave_index?: number | string
|
||
wave_strategy_version?: number
|
||
wave_scan_result?: number
|
||
post_status?: string
|
||
storage_status?: string
|
||
pick_status?: string
|
||
pack_status?: string
|
||
inspection_status?: string
|
||
print_status?: string
|
||
claim_status?: string
|
||
outbound_status?: string
|
||
lock_status?: string
|
||
intercept_status?: string
|
||
basket_number?: string | null
|
||
recheck_status?: string
|
||
sys_logistics_name?: string | null
|
||
express_numbers?: string[]
|
||
waybill_codes?: string[]
|
||
}
|
||
|
||
/** order.deliveryOrder.detail 订单头(detail / order) */
|
||
export type DeliveryOrderDetailHeader = DeliveryOrderListItem & {
|
||
warehouse_code?: string | null
|
||
extend_props?: Record<string, unknown> | null
|
||
source_platform_code?: string
|
||
source_platform_name?: string
|
||
create_channel?: string
|
||
delete_at?: string | null
|
||
updated_at?: string
|
||
logistics_code?: string
|
||
sys_logistics_code?: string
|
||
express_code?: string
|
||
logistics_area_code?: string
|
||
country_code?: string
|
||
oaid?: string | null
|
||
store_id?: number
|
||
warehouse_id?: number
|
||
from_key?: string | null
|
||
items_hash?: string
|
||
items_crc?: number
|
||
sended_status?: string
|
||
recheck_time?: string | null
|
||
step?: number
|
||
print_lock_status?: string
|
||
dispatch_lane?: string
|
||
}
|
||
|
||
/** order.deliveryOrder.detail 商品明细项 */
|
||
export type DeliveryOrderDetailItem = {
|
||
id: number
|
||
order_id: number
|
||
actual_price?: string
|
||
retail_price?: string
|
||
ext_code?: string
|
||
inventory_type?: string
|
||
item_code?: string
|
||
item_id?: number
|
||
item_name?: string
|
||
order_line_no?: string
|
||
owner_code?: string
|
||
plan_qty?: number
|
||
source_order_code?: string
|
||
sub_source_order_code?: string
|
||
extend_props?: Record<string, unknown> | null
|
||
stock_id?: number
|
||
item_snapshot?: Record<string, unknown>
|
||
created_at?: string
|
||
updated_at?: string
|
||
createdAt?: string
|
||
updatedAt?: string
|
||
images?: string[]
|
||
}
|
||
|
||
/** order.deliveryOrder.detail 运单信息项 */
|
||
export type DeliveryOrderDetailExpressItem = {
|
||
waybill_code?: string
|
||
/** 称重重量(g) */
|
||
weighing_weight?: number | null
|
||
sys_logistics_code?: string
|
||
sys_logistics_name?: string
|
||
logistics_code?: string
|
||
logistics_name?: string
|
||
logistics_interface_id?: number | null
|
||
business_key?: string
|
||
created_at?: number | null
|
||
package_material_id?: number | null
|
||
package_material_name_snapshot?: string | null
|
||
}
|
||
|
||
/** order.deliveryOrder.detail 日志项 */
|
||
export type DeliveryOrderDetailLogItem = {
|
||
id: number
|
||
operation_code: string
|
||
operator_name?: string
|
||
created_at: string
|
||
external_log_type?: string | null
|
||
external_log_id?: number | string | null
|
||
platform_code?: string
|
||
message?: string
|
||
operation_name?: string
|
||
platform_name?: string
|
||
}
|
||
|
||
/** order.deliveryOrder.detail 响应 data */
|
||
export type DeliveryOrderDetailPayload = {
|
||
detail?: DeliveryOrderDetailHeader
|
||
order?: DeliveryOrderDetailHeader
|
||
items?: DeliveryOrderDetailItem[]
|
||
orderItems?: DeliveryOrderDetailItem[]
|
||
expresses?: DeliveryOrderDetailExpressItem[]
|
||
logs?: DeliveryOrderDetailLogItem[]
|
||
waybill_codes?: string[]
|
||
/** B2B 作业明细:仅 is_b2b=Y 的订单输出,非 B2B 为 null */
|
||
b2b?: OrderDetailB2bInfo | null
|
||
/** B2B 备货留证照片(business_type=b2b_order);无图片为空数组 */
|
||
images?: OrderDetailImage[]
|
||
/** B2B 提货留证照片(business_type=b2b_pickup);无图片为空数组,与 images 分开输出 */
|
||
pickup_images?: OrderDetailImage[]
|
||
}
|
||
|
||
export function orderDeliveryOrderList(data: DeliveryOrderListParams = {}): Promise<any> {
|
||
return request({
|
||
url: '/system',
|
||
method: 'post',
|
||
params: {
|
||
method: 'order.deliveryOrder.list',
|
||
v,
|
||
timestamp: Date.now()
|
||
},
|
||
data,
|
||
isSystemApi: true
|
||
} as any)
|
||
}
|
||
|
||
/**
|
||
* order.deliveryOrder2b.list:B2B 配送订单列表
|
||
* - 查询条件与 order.deliveryOrder.list 完全一致(dispatch 分表 + 默认 dispatch_lane=m4)
|
||
* - 额外强制 is_b2b='Y'(与请求 where 取 AND,传 is_b2b='N' 只会得到空列表)
|
||
* - 行内额外带出 wms_order_b2b 作业字段(无作业明细行时占位:数值 0 / is_picked_up=N / 时间为 null):
|
||
* total_box_count、pickup_plate_number、prep_remark、prep_duration_seconds、is_urgent(Y/N)、prep_at、
|
||
* is_picked_up(Y/N)、picked_up_at、created_at(作业明细创建时间,与订单 create_at 不同)、
|
||
* prep_status(none/padding/fin)、prep_operator_id、prep_operator_name、prep_start_at
|
||
* - where 额外支持(仅 B2B 列表开放,普通列表不识别):total_box_count / pickup_plate_number / prep_remark /
|
||
* prep_duration_seconds / is_picked_up / picked_up_at / created_at / prep_at / is_urgent /
|
||
* prep_status / prep_operator_id / prep_start_at(支持简写与 {operator,value} 标准结构,prep_at 支持 between)
|
||
* - 排序固定「加急优先」(is_urgent='Y' 在前、无作业明细行排最后),sort 只决定加急/非加急各自内部次序
|
||
* (缺省 delivery_time DESC, id DESC)
|
||
*/
|
||
export function orderDeliveryOrder2bList(data: DeliveryOrderListParams = {}): Promise<any> {
|
||
return request({
|
||
url: '/system',
|
||
method: 'post',
|
||
params: {
|
||
method: 'order.deliveryOrder2b.list',
|
||
v,
|
||
timestamp: Date.now()
|
||
},
|
||
data,
|
||
isSystemApi: true
|
||
} as any)
|
||
}
|
||
|
||
export function orderDeliveryOrderDetail(data: DeliveryOrderDetailParams): Promise<any> {
|
||
return request({
|
||
url: '/system',
|
||
method: 'post',
|
||
params: {
|
||
method: 'order.deliveryOrder.detail',
|
||
v,
|
||
timestamp: Date.now()
|
||
},
|
||
data,
|
||
isSystemApi: true
|
||
} as any)
|
||
}
|
||
|
||
/**
|
||
* order.deliveryOrder.quickSearch:按关键词跨表联合搜索(运单号/发货单号/外部订单号/平台交易单号)
|
||
* 工单页「发起售后单-关联订单-选择订单」使用;联合查询较慢,超时时间延长至 20 秒(axios 默认 10 秒)
|
||
*/
|
||
/**
|
||
* order.deliveryOrder.summary:配送订单每日汇总
|
||
*
|
||
* - 以自然日为维度统计订单量 / 迁入配送表订单量 / 发货量 / 拦截 / 取消
|
||
* - 仓库取自登录上下文;可选 store_id 按货主过滤
|
||
* - 默认最近 7 个自然日(含今天),单次最多 90 天,区间内无数据的日期补 0
|
||
*/
|
||
export type DeliveryOrderSummaryParams = {
|
||
/** 开始日期 yyyy-MM-dd,缺省为结束日往前 6 天 */
|
||
start_date?: string
|
||
/** 结束日期 yyyy-MM-dd,缺省为今天 */
|
||
end_date?: string
|
||
/** 货主ID过滤,不传或 <=0 表示不按货主过滤 */
|
||
store_id?: number
|
||
}
|
||
|
||
/** 每日汇总中的一天统计行 */
|
||
export type DeliveryOrderSummaryItem = {
|
||
/** 统计日期 yyyy-MM-dd */
|
||
date: string
|
||
/** 当日订单量 */
|
||
order_count: number
|
||
/** 当日迁入配送表订单量 */
|
||
dispatch_count: number
|
||
/** 当日发货订单数 */
|
||
shipped_count: number
|
||
/** 当日发货商品件数 */
|
||
shipped_items_total: number
|
||
/** 当日发货金额 */
|
||
shipped_amount: number
|
||
/** 当日拦截数量 */
|
||
intercepted_count: number
|
||
/** 当日库内确定拦截数量 */
|
||
intercepted_at_warehouse_count: number
|
||
/** 当日取消数量 */
|
||
cancelled_count: number
|
||
}
|
||
|
||
/** 区间合计(字段口径与 list 中对应字段相同) */
|
||
export type DeliveryOrderSummaryTotals = Omit<DeliveryOrderSummaryItem, 'date'>
|
||
|
||
/** order.deliveryOrder.summary 响应(data 位于顶层) */
|
||
export type DeliveryOrderSummaryPayload = {
|
||
warehouse_id: number
|
||
store_id: number | null
|
||
start_date: string
|
||
end_date: string
|
||
day_count: number
|
||
list: DeliveryOrderSummaryItem[]
|
||
summary: DeliveryOrderSummaryTotals
|
||
}
|
||
|
||
export function orderDeliveryOrderSummary(data: DeliveryOrderSummaryParams = {}): Promise<any> {
|
||
return request({
|
||
url: '/system',
|
||
method: 'post',
|
||
params: {
|
||
method: 'order.deliveryOrder.summary',
|
||
v,
|
||
timestamp: Date.now()
|
||
},
|
||
data,
|
||
isSystemApi: true
|
||
} as any)
|
||
}
|
||
|
||
export function orderDeliveryOrderQuickSearch(keyword: string): Promise<any> {
|
||
return request({
|
||
url: '/system',
|
||
method: 'post',
|
||
params: {
|
||
method: 'order.deliveryOrder.quickSearch',
|
||
v,
|
||
timestamp: Date.now()
|
||
},
|
||
data: { keyword },
|
||
isSystemApi: true,
|
||
// 联合搜索耗时较长,单独放宽超时时间至 20 秒
|
||
timeout: 60000
|
||
} as any)
|
||
}
|
||
|
||
export const orderDeliveryOrder = {
|
||
list: orderDeliveryOrderList,
|
||
detail: orderDeliveryOrderDetail,
|
||
quickSearch: orderDeliveryOrderQuickSearch,
|
||
summary: orderDeliveryOrderSummary,
|
||
}
|
||
|
||
export const orderDeliveryOrder2b = {
|
||
list: orderDeliveryOrder2bList
|
||
}
|