import request from '@/router/axios'; /** * 获取订单列表 * @param {number} current - 当前页码 * @param {number} size - 每页大小 * @param {OrderQueryParams} params - 查询参数 * @returns {Promise>>} 订单列表响应 */ export const getList = (current, size, params) => { return request({ url: '/api/blade-factory/api/factory/order', method: 'get', params: { ...params, current: current, size } }) } /** * 新增订单 * @param {OrderForm} row - 订单表单数据 * @returns {Promise>} 新增订单响应 */ export const add = (row) => { return request({ url: '/api/blade-factory/api/factory/order', method: 'post', data: row }) } /** * 更新订单 * @param {OrderForm} row - 订单表单数据 * @returns {Promise>} 更新订单响应 */ export const update = (row) => { return request({ url: '/api/blade-factory/api/factory/order', method: 'put', data: row }) } /** * 删除订单 * @param {string} ids - 订单ID列表,多个ID用逗号分隔 * @returns {Promise>} 删除订单响应 */ export const remove = (ids) => { return request({ url: '/api/blade-factory/api/factory/order/remove', method: 'post', params: { ids } }) } /** * 获取订单详情 * @param {string|number} id - 订单ID * @returns {Promise>} 订单详情响应 */ export const getDetail = (id) => { return request({ url: `/api/blade-factory/api/factory/order/${id}`, method: 'get' }) } /** * 获取客户地址列表 * @param {string} customerCode - 客户编码 * @returns {Promise>>} 客户地址列表响应 */ export const getCustomerAddressList = (customerCode) => { return request({ url: '/api/blade-factory/api/factory/address', method: 'get', params: { customerCode, size: 100 } }) } /** * 订单查询参数类型定义 * @typedef {Object} OrderQueryParams * @property {string} [orderCode] - 订单编码 * @property {string} [orgCode] - 组织编码 * @property {string} [orgName] - 组织名称 * @property {string} [customerCode] - 客户编码 * @property {string} [customerName] - 客户名称 * @property {number} [orderType] - 订单类型 0-采购订单 1-销售订单 * @property {number} [status] - 订单状态 0-草稿 1-已提交 2-已确认 3-已完成 4-已取消 * @property {string} [receiverName] - 收货人姓名 * @property {string} [receiverPhone] - 收货人电话 * @property {string} [createTimeStart] - 创建时间开始 * @property {string} [createTimeEnd] - 创建时间结束 */ /** * 订单表单数据类型定义 * @typedef {Object} OrderForm * @property {string|number} [id] - 订单ID(修改时必填) * @property {string} [orderCode] - 订单编码(系统自动生成) * @property {string|number} orgId - 组织ID * @property {string} orgCode - 组织编码 * @property {string} orgName - 组织名称 * @property {string|number} customerId - 客户ID * @property {string} customerCode - 客户编码 * @property {string} customerName - 客户名称 * @property {number} orderType - 订单类型 0-采购订单 1-销售订单 * @property {number|string} totalAmount - 订单总金额 * @property {number|string} totalQuantity - 订单总数量 * @property {string|number} addressId - 收货地址ID * @property {string} receiverName - 收货人姓名 * @property {string} receiverPhone - 收货人电话 * @property {string} receiverAddress - 收货详细地址 * @property {string} receiverRegion - 收货地区 * @property {number} status - 订单状态 0-草稿 1-已提交 2-已确认 3-已完成 4-已取消 */ /** * 订单列表项类型定义 * @typedef {Object} OrderItem * @property {string} id - 订单ID * @property {string} createUser - 创建用户ID * @property {string} createDept - 创建部门ID * @property {string} createTime - 创建时间 * @property {string} updateUser - 更新用户ID * @property {string} updateTime - 更新时间 * @property {number} status - 订单状态 0-草稿 1-已提交 2-已确认 3-已完成 4-已取消 * @property {number} isDeleted - 是否删除 0-未删除 1-已删除 * @property {string} orderCode - 订单编码 * @property {number} orgId - 组织ID * @property {string} orgCode - 组织编码 * @property {string} orgName - 组织名称 * @property {number} customerId - 客户ID * @property {string} customerCode - 客户编码 * @property {string} customerName - 客户名称 * @property {number} orderType - 订单类型 0-采购订单 1-销售订单 * @property {string} totalAmount - 订单总金额 * @property {string} totalQuantity - 订单总数量 * @property {number} addressId - 收货地址ID * @property {string} receiverName - 收货人姓名 * @property {string} receiverPhone - 收货人电话 * @property {string} receiverAddress - 收货详细地址 * @property {string} receiverRegion - 收货地区 * @property {string|null} submitTime - 提交时间 * @property {string|null} confirmTime - 确认时间 */ /** * 客户地址选项类型定义 * @typedef {Object} CustomerAddressOption * @property {number} id - 地址ID * @property {string} receiverName - 收货人姓名 * @property {string} receiverPhone - 收货人电话 * @property {string} receiverAddress - 收货详细地址 * @property {string} regionName - 收货地区 * @property {number} isDefault - 是否默认地址 0-否 1-是 */ /** * API响应类型定义 * @template T * @typedef {Object} ApiResponse * @property {number} code - 响应码 * @property {boolean} success - 是否成功 * @property {T} data - 响应数据 * @property {string} msg - 响应消息 */ /** * 分页结果类型定义 * @template T * @typedef {Object} PageResult * @property {T[]} records - 数据列表 * @property {number} total - 总记录数 * @property {number} size - 每页大小 * @property {number} current - 当前页码 * @property {number} pages - 总页数 * @property {Array} orders - 排序信息 * @property {boolean} optimizeCountSql - 是否优化count查询 * @property {boolean} hitCount - 是否命中count缓存 * @property {string|null} countId - count查询ID * @property {number|null} maxLimit - 最大限制 * @property {boolean} searchCount - 是否查询count */