import request from '@/utils/request' export function fastWhereTree(type:any) { return request({ url: '/system', method: 'post', params: { method: 'index.fastWhereTree', v: '1.0', timestamp: new Date().getTime() }, data: {type}, isSystemApi: true } as any) } export function loadStores() { return request({ url: '/system', method: 'post', params: { method: 'index.loadStores', v: '1.0', timestamp: new Date().getTime() }, data: {}, isSystemApi: true } as any) } /** 查询仓库列表(无需鉴权,需登录) */ export function loadWarehouses(data?: Record) { return request({ url: '/system', method: 'post', params: { method: 'index.loadWarehouses', v: '1.0', timestamp: new Date().getTime() }, data: data ?? {}, isSystemApi: true } as any) } /** 当前仓库下的快递接口下拉列表,可传入 systemExpressCode 过滤 */ export function loadExpressInterfaces(data?: { systemExpressCode?: string }) { return request({ url: '/system', method: 'post', params: { method: 'index.loadExpressInterfaces', v: '1.0', timestamp: new Date().getTime() }, data: data ?? {}, isSystemApi: true } as any) } export function getCOSUploadConfig(data:any){ return request({ url: '/system', method: 'post', params: { method: 'index.getCOSUploadConfig', v: '1.0', timestamp: new Date().getTime() }, data: {data}, isSystemApi: true } as any) } export function getImages(data:any){ return request({ url: '/system', method: 'post', params: { method: 'index.getImages', v: '1.0', timestamp: new Date().getTime() }, data: data, isSystemApi: true } as any) } export function uploadSuccessNotify(data:any){ return request({ url: '/system', method: 'post', params: { method: 'index.uploadSuccessNotify', v: '1.0', timestamp: new Date().getTime() }, data: data, isSystemApi: true } as any) } export function ReferenceFile(data:any){ return request({ url: '/system', method: 'post', params: { method: 'index.ReferenceFile', v: '1.0', timestamp: new Date().getTime() }, data: data, isSystemApi: true } as any) } export function getMessageDetail(data:any){ return request({ url: '/system', method: 'post', params: { method: 'index.getMessageDetail', v: '1.0', timestamp: new Date().getTime() }, data: data, isSystemApi: true } as any) } /** 生成 IM 单点登录一次性 code(有效期 5 分钟) */ export function loginToIm(data?: Record) { return request({ url: '/system', method: 'post', params: { method: 'index.loginToIm', v: '1.0', timestamp: new Date().getTime() }, data: data ?? {}, isSystemApi: true } as any) } export function getI18nMessage(data:any){ return request({ url: '/system', method: 'post', params: { method: 'index.getI18nMessage', v: '1.0', timestamp: new Date().getTime() }, data: data, isSystemApi: true } as any) } export function putI18nCollect(data:any){ return request({ url: '/system', method: 'post', params: { method: 'index.putI18nCollect', v: '1.0', timestamp: new Date().getTime() }, data: data, isSystemApi: true } as any) } export type GetExpressListParams = { systemOnly?: boolean | number | string express_code?: string } export function getExpressList(data?: GetExpressListParams) { return request({ url: '/system', method: 'post', params: { method: 'index.getExpressList', v: '1.0', timestamp: new Date().getTime() }, data: data ?? {}, isSystemApi: true } as any) } export function tryAutoTranslateNewKeys(data?: Record) { return request({ url: '/system', method: 'post', params: { method: 'index.tryAutoTranslateNewKeys', v: '1.0', timestamp: new Date().getTime() }, data: data ?? {}, isSystemApi: true } as any) } export type GetPlatformListParams = { systemOnly?: boolean | number | string platform_code?: string } export function getPlatformList(data?: GetPlatformListParams) { return request({ url: '/system', method: 'post', params: { method: 'index.getPlatformList', v: '1.0', timestamp: new Date().getTime() }, data: data ?? {}, isSystemApi: true } as any) } export function getPrintPlatformTemplateList(data?: { platform_code?: string express_code: string shopId?: string | number shop_id?: string | number }) { return request({ url: '/system', method: 'post', params: { method: 'index.getPrintPlatformTemplateList', v: '1.0', timestamp: new Date().getTime() }, data: data ?? ({} as any), isSystemApi: true } as any) } /** 公共无参查询淘宝菜鸟标准模板列表 */ export function getCainiaoStfTemplates(data?: Record) { return request({ url: '/system', method: 'post', params: { method: 'index.getCainiaoStfTemplates', v: '1.0', timestamp: new Date().getTime() }, data: data ?? {}, isSystemApi: true } as any) } /** 生成菠萝派授权链接(无请求参数) */ export function polyapiAuthorizeUrl(data?: Record) { return request({ url: '/system', method: 'post', params: { method: 'index.polyapiAuthorizeUrl', v: '1.0', timestamp: new Date().getTime() }, data: data ?? {}, isSystemApi: true } as any) } /** 获取平台授权链接(当前仅支持 PDD) */ export function getPlatformOauthLink(data?: { code?: string platform_code?: string platformCode?: string }) { return request({ url: '/system', method: 'post', params: { method: 'index.getPlatformOauthLink', v: '1.0', timestamp: new Date().getTime() }, data: data ?? {}, isSystemApi: true } as any) } /** 获取当前登录仓库下的店铺列表(可按平台编码过滤) */ export function getShopList(data?: { platform_code?: string platformCode?: string code?: string }) { return request({ url: '/system', method: 'post', params: { method: 'index.getShopList', v: '1.0', timestamp: new Date().getTime() }, data: data ?? {}, isSystemApi: true } as any) } /** 快递产品类型(非 PDD 平台由服务端按 sys_express_code 匹配 wms_express_product_type 补充;PDD 平台不返回) */ export type ShopExpressProductType = { code?: string name?: string [key: string]: unknown } /** 店铺可用快递列表项(各平台字段有差异:前端按需取值 + 索引签名兜底) */ export type ShopExpressListItem = { /** 电子面单快递编码(淘宝系 wp_code;其次 express_code / code) */ wp_code?: string wp_name?: string express_code?: string express_name?: string code?: string name?: string label?: string /** 系统快递编码(与本系统 wms_express.express_code 对齐) */ sys_express_code?: string /** 快递公司编号(部分平台用 providerid / provider_id / providerId) */ providerid?: string | number provider_id?: string | number providerId?: string | number /** 产品类型列表:**非 PDD 平台**服务端会补充;PDD 平台不返回该字段 */ product_types?: ShopExpressProductType[] /** 签约网点/账号(含面单余量、地址、增值服务;字段随平台差异) */ accounts?: Record[] [key: string]: unknown } /** * index.getShopExpressList 响应 * * ⚠️ 该接口响应形如 `{ code, message, data }`(**无 flag / timestamp**),业务数据在 `data` 内。 */ export type ShopExpressListResponse = { /** 业务状态码,成功 200 */ code?: number /** 业务提示信息,成功 ok */ message?: string data?: { /** 当前店铺ID */ shop_id?: number /** 店铺所属平台编码(服务端已转大写) */ platform_code?: string /** 服务端按平台收敛后的可用快递列表;未接入的平台返回空数组 */ list?: ShopExpressListItem[] } } /** * 获取指定店铺可用快递列表 * * 入参 `shop_id` / `shopId` 二选一至少传一个(服务端按 shop_id、shopId 顺序读首个非空值)。 */ export function getShopExpressList(data?: { shop_id?: string | number shopId?: string | number }): Promise { return request({ url: '/system', method: 'post', params: { method: 'index.getShopExpressList', v: '1.0', timestamp: new Date().getTime() }, data: data ?? {}, isSystemApi: true } as any) } /** 快递公司产品类型列表(可选按快递公司编码筛选) */ export function getExpressProductTypeList(data?: { express_code?: string }) { return request({ url: '/system', method: 'post', params: { method: 'index.getExpressProductTypeList', v: '1.0', timestamp: new Date().getTime() }, data: data ?? {}, isSystemApi: true } as any) } /** 查询所有已启用的接口类型列表(无需权限,仅需登录) */ export function listInterfaceTypes() { return request({ url: '/system', method: 'post', params: { method: 'index.listInterfaceTypes', v: '1.0', timestamp: new Date().getTime() }, data: {}, isSystemApi: true } as any) } /** 获取奇门 ERP 应用列表(用于选择 ERP / AppKey) */ export function getQimenAppList(data?: Record) { return request({ url: '/system', method: 'post', params: { method: 'index.getQimenAppList', v: '1.0', timestamp: new Date().getTime() }, data: data ?? {}, isSystemApi: true } as any) } export function searchSpace(data:any){ return request({ url: '/system', method: 'post', params: { method: 'index.searchSpace', v: '1.0', timestamp: new Date().getTime() }, data: data, isSystemApi: true } as any) } /** 按当前仓库上下文批量搜索库位(keywords 与返回 data 分组一一对应) */ export function searchSpaces(data: any) { return request({ url: '/system', method: 'post', params: { method: 'index.searchSpaces', v: '1.0', timestamp: new Date().getTime() }, data: data, isSystemApi: true } as any) } export function recognizeLicensePlate(data:any){ return request({ url: '/system', method: 'post', params: { method: 'index.recognizeLicensePlate', v: '1.0', timestamp: new Date().getTime() }, data: data, isSystemApi: true } as any) } export function getLocationTypeList(data?: Record) { return request({ url: '/system', method: 'post', params: { method: 'index.getLocationTypeList', v: '1.0', timestamp: new Date().getTime() }, data: data ?? {}, isSystemApi: true } as any) } export type IndexToOrderWave = { wave_id: number wave_no: string order_ids: number[] } export type IndexToOrderParams = { /** 运单号 */ waybill_code: string } export type IndexToOrderResponse = { code?: number message?: string order_id?: number waves?: IndexToOrderWave[] data?: { order_id?: number waves?: IndexToOrderWave[] } } /** 根据运单号快速查询订单ID及其所属波次下所有订单ID列表 */ export function toOrder(data: IndexToOrderParams): Promise { return request({ url: '/system', method: 'post', params: { method: 'index.toOrder', v: '1.0', timestamp: new Date().getTime() }, data, isSystemApi: true } as any) } // ============ index.uploadClientErrorLog ============ /** * 客户端错误日志上报条目(字段命名兼容 snake_case 与 camelCase 别名)。 * ⚠️ `error_message` 与 `error_stack` **至少一项有值**,否则该条被判为无效(计入 rejected)。 */ export type ClientErrorLogItem = { /** 客户端类型:android/ios/web 等(表宽 32,超出截断);别名 clientType */ client_type?: string /** 客户端版本号(表宽 64,超出截断);别名 appVersion */ app_version?: string /** 设备唯一标识(表宽 128,超出截断);别名 deviceId */ device_id?: string /** 操作系统版本(表宽 64,超出截断);别名 osVersion */ os_version?: string /** 设备型号(表宽 128,超出截断);别名 deviceModel */ device_model?: string /** 错误类型/等级(表宽 64,超出截断);别名 errorType */ error_type?: string /** 错误信息(与 error_stack 至少一项有值;超出截断至 5000 字符);别名 errorMessage */ error_message?: string /** 错误堆栈(与 error_message 至少一项有值;超出截断至 65535 字符);别名 errorStack */ error_stack?: string /** 附加上下文(字符串或对象,对象序列化为 JSON 字符串;超出截断至 65535 字符) */ extra?: string | Record /** 上报幂等ID(唯一索引 uk_report_uuid;重复上报静默成功、不产生重复行;缺失时服务端生成 srv-{uuid},不保证幂等) */ report_uuid?: string /** 客户端错误发生时间(仅参考,不作为记录时间):毫秒/秒时间戳或日期字符串,非法值存 null */ client_time?: string | number } /** * index.uploadClientErrorLog 入参:支持三种形态(三选一) * - 单条对象:`{ client_type, error_message, ... }` * - 数组:`[ { ... }, { ... } ]` * - 包裹形态:`{ logs: [ { ... }, ... ] }` * 单次最多 50 条(超出报 400)。 */ export type ClientErrorLogUploadParams = | ClientErrorLogItem | ClientErrorLogItem[] | { logs: ClientErrorLogItem[] } /** index.uploadClientErrorLog 响应(方法级错误为 HTTP 200 + flag=failure,code=400/500) */ export type ClientErrorLogUploadResponse = { /** 结果标记:success */ flag?: string /** 业务码:200 成功;400 入参形状错误/空数据/超 50 条/全部条目无效;500 查询或写入失败 */ code?: number /** 提示文案(成功为「上报成功」) */ message?: string /** 服务处理结果标记(400/500 失败响应无此字段) */ success?: boolean /** 本次上报条数 */ total?: number /** 新入库条数 */ accepted?: number /** 幂等去重条数(report_uuid 已存在,静默成功、不产生重复行) */ duplicated?: number /** 校验失败条数 */ rejected?: number /** 拒绝明细(最多 10 条) */ rejected_reasons?: { index: number; reason: string }[] /** 服务端响应时间戳(秒) */ timestamp?: number } /** * 上报客户端错误日志(免登录、免权限、免鉴权,保留系统日志):批量写入服务端暂存表 wms_client_error_log。 * 入参支持单条对象 / 数组 / `{ logs: [...] }` 三种形态,单次最多 50 条。 * `report_uuid` 幂等去重(重复上报静默成功);`client_time` 仅参考。 */ export function uploadClientErrorLog( data: ClientErrorLogUploadParams ): Promise { return request({ url: '/system', method: 'post', params: { method: 'index.uploadClientErrorLog', v: '1.0', timestamp: new Date().getTime() }, data, isSystemApi: true } as any) } // ============ index.getWarehousePanelData ============ /** index.getWarehousePanelData 入参 */ export type GetWarehousePanelDataParams = { /** 最后一次更改的时间戳(Unix 秒);常规调用(force 非真)必填,小于服务端缓存时间戳时返回 is_change=true;force=true 时可选,缺省视为 0 */ last_change_at?: number /** 是否强制输出数据(true/1/'true'):前端首次拉取时传 true,is_change 强制为 true,last_change_at 可不传 */ force?: boolean | number | string } /** index.getWarehousePanelData 响应 data.fulfillment 中的一个履约环节 */ export interface WarehousePanelFulfillmentStage { /** 环节标识(如 receiving/shelf/pick/recheck/pack;items 末尾两项为今日退件 / 今日拆包) */ key?: string /** 环节名称 */ name?: string /** 未完成数量 */ undone?: number /** 已完成数量(打包环节用订单状态存量口径,保证已复核 ≥ 已打包) */ done?: number [key: string]: unknown } /** index.getWarehousePanelData 响应 data.fulfillment(订单履约链路 6 环节未/已) */ export interface WarehousePanelFulfillment { /** 今日总单量(与 data.trend.total 同口径:待处理订单池 + 配送表今日出库) */ total?: number /** 6 个履约环节;各环节未/已均含配送表今日出库按环节状态拆分补数 */ items?: WarehousePanelFulfillmentStage[] [key: string]: unknown } /** index.getWarehousePanelData 响应 data.stageOverview.stages 中的一张阶段卡 */ export interface WarehousePanelStageCard { /** 今日数量;pack 卡 = 今日真实打包订单数(散单任务数 + 团购波次真实订单数) */ today?: number /** 进行中(任务数) */ doing?: number /** 异常(任务数) */ abnormal?: number [key: string]: unknown } /** index.getWarehousePanelData 响应 data.stageOverview(阶段概览 5 卡) */ export interface WarehousePanelStageOverview { totalOrders?: number interceptOrders?: number /** 5 张卡:receiving / shelf / pick / recheck / pack */ stages?: WarehousePanelStageCard[] | Record [key: string]: unknown } /** 订单/商品/件数 统计块 */ export interface WarehousePanelVolume { /** 订单数 */ orders?: number /** 商品数 */ goods?: number /** SKU 数 */ sku?: number [key: string]: unknown } /** 拣货/打包区块(groupPicking / scatterPicking / groupPacking / scatterPacking) */ export interface WarehousePanelPickingBlock extends WarehousePanelVolume { /** 波次数 */ wave?: number /** Top5(按波次范围 wave_scope 区分:团购块按打包台、散单块按打包员) */ top5?: Array> [key: string]: unknown } /** index.getWarehousePanelData 响应 data.trend 中的一个点位 */ export interface WarehousePanelTrendPoint { /** 点位标签(从仓库自然日开始时间 day_start_time 起、按小时累计) */ label?: string /** 该点位累计下单量(业务日窗口内下单量,池内待处理 + 配送表今日出库) */ created_count?: number [key: string]: unknown } /** index.getWarehousePanelData 响应 data.trend(业务日 24 点下单趋势) */ export interface WarehousePanelTrend { max?: number /** 业务日内下单总量(与 data.fulfillment.total 同口径) */ total?: number points?: WarehousePanelTrendPoint[] [key: string]: unknown } /** index.getWarehousePanelData 响应 data.weeklyEfficiency(近 7 天拦截效率) */ export interface WarehousePanelWeeklyEfficiency { /** 近 7 天(含各天拦截数等) */ days?: Array> [key: string]: unknown } /** * index.getWarehousePanelData 响应 data(面板数据对象)。 * ⚠️ `is_change=false` 时为空对象(节约流量);`is_change=true` 时按「已填充有数据源」的字段输出, * 故所有字段均可选(无数据源的字段暂不输出)。 */ export interface WarehousePanelData { /** 仓库名 */ title?: string /** 订单履约链路(6 环节未/已 + total + items 末尾两项:今日退件/今日拆包) */ fulfillment?: WarehousePanelFulfillment /** 阶段概览 */ stageOverview?: WarehousePanelStageOverview /** B2B(orders/goods/sku) */ b2b?: WarehousePanelVolume /** 团购拣货(orders/goods/sku/wave/top5) */ groupPicking?: WarehousePanelPickingBlock /** 散单拣货(orders/goods/sku/wave/top5) */ scatterPicking?: WarehousePanelPickingBlock /** 团购打包(orders/goods/sku/wave/top5) */ groupPacking?: WarehousePanelPickingBlock /** 散单打包(orders/goods/sku/wave/top5) */ scatterPacking?: WarehousePanelPickingBlock /** 业务日 24 点下单趋势 */ trend?: WarehousePanelTrend /** 近 7 天效率 */ weeklyEfficiency?: WarehousePanelWeeklyEfficiency [key: string]: unknown } /** index.getWarehousePanelData 响应 */ export type GetWarehousePanelDataResponse = { /** 是否已改变:force 为真时恒为 true;否则传入时间戳小于缓存最后时间戳时为 true,反之为 false(缓存无最后时间时恒为 true) */ is_change?: boolean /** 服务端缓存最后更改时间戳(Unix 秒,缓存未命中为 0),前端保存后作为下次轮询的 last_change_at 入参回传 */ last_change_at?: number /** * 面板数据对象;`is_change=false` 时为空对象(节约流量),`is_change=true` 时按已填充字段输出。 * 字段说明见 `WarehousePanelData` */ data?: WarehousePanelData } /** * 仓库面板数据接口:按仓库做增量变更检测,返回 is_change / last_change_at 与面板数据 data。 * ⚠️ 常规调用(force 非真)必须传 `last_change_at`;首次拉取传 `force: true`。 * ⚠️ `is_change=false` 时 `data` 为空对象,勿据此清空面板。 */ export function getWarehousePanelData( data?: GetWarehousePanelDataParams ): Promise { return request({ url: '/system', method: 'post', params: { method: 'index.getWarehousePanelData', v: '1.0', timestamp: new Date().getTime() }, data: data ?? {}, isSystemApi: true } as any) }