|
|
@@ -0,0 +1,497 @@
|
|
|
+import { z } from '@hono/zod-openapi';
|
|
|
+
|
|
|
+// 订单状态枚举
|
|
|
+export const OrderStatus = {
|
|
|
+ PENDING: 0, // 未发货
|
|
|
+ SHIPPED: 1, // 已发货
|
|
|
+ RECEIVED: 2, // 收货成功
|
|
|
+ RETURNED: 3, // 已退货
|
|
|
+} as const;
|
|
|
+
|
|
|
+// 支付状态枚举
|
|
|
+export const PayStatus = {
|
|
|
+ UNPAID: 0, // 未支付
|
|
|
+ PAYING: 1, // 支付中
|
|
|
+ SUCCESS: 2, // 支付成功
|
|
|
+ REFUNDED: 3, // 已退款
|
|
|
+ FAILED: 4, // 支付失败
|
|
|
+ CLOSED: 5, // 订单关闭
|
|
|
+} as const;
|
|
|
+
|
|
|
+// 订单类型枚举
|
|
|
+export const OrderType = {
|
|
|
+ PHYSICAL: 1, // 实物订单
|
|
|
+ VIRTUAL: 2, // 虚拟订单
|
|
|
+} as const;
|
|
|
+
|
|
|
+// 支付类型枚举
|
|
|
+export const PayType = {
|
|
|
+ POINTS: 1, // 积分
|
|
|
+ COUPON: 2, // 礼券
|
|
|
+} as const;
|
|
|
+
|
|
|
+// 订单基础Schema
|
|
|
+export const OrderSchema = z.object({
|
|
|
+ id: z.number().int().positive().openapi({
|
|
|
+ description: '订单ID',
|
|
|
+ example: 1
|
|
|
+ }),
|
|
|
+ orderNo: z.string().min(1, '订单号不能为空').max(50, '订单号最多50个字符').openapi({
|
|
|
+ description: '订单号',
|
|
|
+ example: 'ORD20240101123456'
|
|
|
+ }),
|
|
|
+ userId: z.number().int().positive().openapi({
|
|
|
+ description: '用户ID',
|
|
|
+ example: 1
|
|
|
+ }),
|
|
|
+ authCode: z.string().max(32, '付款码最多32个字符').nullable().optional().openapi({
|
|
|
+ description: '付款码',
|
|
|
+ example: '12345678901234567890123456789012'
|
|
|
+ }),
|
|
|
+ cardNo: z.string().max(32, '卡号最多32个字符').nullable().optional().openapi({
|
|
|
+ description: '卡号',
|
|
|
+ example: '6222********1234'
|
|
|
+ }),
|
|
|
+ sjtCardNo: z.string().max(32, '盛京通卡号最多32个字符').nullable().optional().openapi({
|
|
|
+ description: '盛京通卡号',
|
|
|
+ example: 'SJT1234567890'
|
|
|
+ }),
|
|
|
+ amount: z.coerce.number().min(0, '订单金额不能小于0').max(999999.99, '订单金额不能超过999999.99').openapi({
|
|
|
+ description: '订单金额',
|
|
|
+ example: 99.99
|
|
|
+ }),
|
|
|
+ costAmount: z.coerce.number().min(0, '成本金额不能小于0').max(999999.99, '成本金额不能超过999999.99').default(0).openapi({
|
|
|
+ description: '成本金额',
|
|
|
+ example: 50.00
|
|
|
+ }),
|
|
|
+ freightAmount: z.coerce.number().min(0, '运费不能小于0').max(999999.99, '运费不能超过999999.99').default(0).openapi({
|
|
|
+ description: '运费',
|
|
|
+ example: 10.00
|
|
|
+ }),
|
|
|
+ discountAmount: z.coerce.number().min(0, '优惠金额不能小于0').max(999999.99, '优惠金额不能超过999999.99').default(0).openapi({
|
|
|
+ description: '优惠金额',
|
|
|
+ example: 5.00
|
|
|
+ }),
|
|
|
+ payAmount: z.coerce.number().min(0, '实际支付金额不能小于0').max(999999.99, '实际支付金额不能超过999999.99').default(0).openapi({
|
|
|
+ description: '实际支付金额',
|
|
|
+ example: 94.99
|
|
|
+ }),
|
|
|
+ deviceNo: z.string().max(255, '设备编号最多255个字符').nullable().optional().openapi({
|
|
|
+ description: '设备编号',
|
|
|
+ example: 'DEV001234'
|
|
|
+ }),
|
|
|
+ description: z.string().max(255, '订单描述最多255个字符').nullable().optional().openapi({
|
|
|
+ description: '订单描述',
|
|
|
+ example: '购买商品'
|
|
|
+ }),
|
|
|
+ goodsDetail: z.string().max(2000, '订单详情最多2000个字符').nullable().optional().openapi({
|
|
|
+ description: '订单详情(json格式)',
|
|
|
+ example: '[{"goodsId":1,"name":"商品1","price":99.99,"num":1}]'
|
|
|
+ }),
|
|
|
+ goodsTag: z.string().max(255, '订单优惠标记最多255个字符').nullable().optional().openapi({
|
|
|
+ description: '订单优惠标记',
|
|
|
+ example: '满100减5'
|
|
|
+ }),
|
|
|
+ address: z.string().max(255, '地址最多255个字符').nullable().optional().openapi({
|
|
|
+ description: '地址',
|
|
|
+ example: '北京市朝阳区xxx路xxx号'
|
|
|
+ }),
|
|
|
+ orderType: z.coerce.number().int().min(1, '订单类型最小为1').max(2, '订单类型最大为2').default(1).openapi({
|
|
|
+ description: '订单类型 1实物订单 2虚拟订单',
|
|
|
+ example: 1
|
|
|
+ }),
|
|
|
+ payType: z.coerce.number().int().min(0, '支付类型最小为0').max(2, '支付类型最大为2').default(0).openapi({
|
|
|
+ description: '支付类型1积分2礼券',
|
|
|
+ example: 1
|
|
|
+ }),
|
|
|
+ payState: z.coerce.number().int().min(0, '支付状态最小为0').max(5, '支付状态最大为5').default(0).openapi({
|
|
|
+ description: '支付状态 0未支付1支付中2支付成功3已退款4支付失败5订单关闭',
|
|
|
+ example: 2
|
|
|
+ }),
|
|
|
+ state: z.coerce.number().int().min(0, '订单状态最小为0').max(3, '订单状态最大为3').default(0).openapi({
|
|
|
+ description: '订单状态 0未发货1已发货2收货成功3已退货',
|
|
|
+ example: 0
|
|
|
+ }),
|
|
|
+ userPhone: z.string().max(50, '用户手机号最多50个字符').nullable().optional().openapi({
|
|
|
+ description: '用户手机号',
|
|
|
+ example: '13800138000'
|
|
|
+ }),
|
|
|
+ merchantId: z.coerce.number().int().positive().default(0).openapi({
|
|
|
+ description: '商户id',
|
|
|
+ example: 1
|
|
|
+ }),
|
|
|
+ merchantNo: z.coerce.number().int().positive().nullable().optional().openapi({
|
|
|
+ description: '商户号',
|
|
|
+ example: 1001
|
|
|
+ }),
|
|
|
+ supplierId: z.coerce.number().int().positive().default(0).openapi({
|
|
|
+ description: '供货商id',
|
|
|
+ example: 1
|
|
|
+ }),
|
|
|
+ addressId: z.coerce.number().int().positive().default(0).openapi({
|
|
|
+ description: '地址id',
|
|
|
+ example: 1
|
|
|
+ }),
|
|
|
+ receiverMobile: z.string().max(255, '收货人手机号最多255个字符').nullable().optional().openapi({
|
|
|
+ description: '收货人手机号',
|
|
|
+ example: '13800138000'
|
|
|
+ }),
|
|
|
+ recevierName: z.string().max(255, '收货人姓名最多255个字符').nullable().optional().openapi({
|
|
|
+ description: '收货人姓名',
|
|
|
+ example: '张三'
|
|
|
+ }),
|
|
|
+ recevierProvince: z.coerce.number().int().positive().default(0).openapi({
|
|
|
+ description: '收货人所在省',
|
|
|
+ example: 110000
|
|
|
+ }),
|
|
|
+ recevierCity: z.coerce.number().int().positive().default(0).openapi({
|
|
|
+ description: '收货人所在市',
|
|
|
+ example: 110100
|
|
|
+ }),
|
|
|
+ recevierDistrict: z.coerce.number().int().positive().default(0).openapi({
|
|
|
+ description: '收货人所在区',
|
|
|
+ example: 110105
|
|
|
+ }),
|
|
|
+ recevierTown: z.coerce.number().int().positive().default(0).openapi({
|
|
|
+ description: '收货人所在街道',
|
|
|
+ example: 110105001
|
|
|
+ }),
|
|
|
+ refundTime: z.coerce.date().nullable().optional().openapi({
|
|
|
+ description: '退款时间',
|
|
|
+ example: '2024-01-01T12:00:00Z'
|
|
|
+ }),
|
|
|
+ closeTime: z.coerce.date().nullable().optional().openapi({
|
|
|
+ description: '订单关闭时间',
|
|
|
+ example: '2024-01-01T12:00:00Z'
|
|
|
+ }),
|
|
|
+ remark: z.string().max(255, '管理员备注信息最多255个字符').nullable().optional().openapi({
|
|
|
+ description: '管理员备注信息',
|
|
|
+ example: '请尽快发货'
|
|
|
+ }),
|
|
|
+ createdBy: z.number().int().positive().nullable().optional().openapi({
|
|
|
+ description: '创建人ID',
|
|
|
+ example: 1
|
|
|
+ }),
|
|
|
+ updatedBy: z.number().int().positive().nullable().optional().openapi({
|
|
|
+ description: '更新人ID',
|
|
|
+ example: 1
|
|
|
+ }),
|
|
|
+ createdAt: z.coerce.date().openapi({
|
|
|
+ description: '创建时间',
|
|
|
+ example: '2024-01-01T12:00:00Z'
|
|
|
+ }),
|
|
|
+ updatedAt: z.coerce.date().openapi({
|
|
|
+ description: '更新时间',
|
|
|
+ example: '2024-01-01T12:00:00Z'
|
|
|
+ }),
|
|
|
+ // 关联实体
|
|
|
+ user: z.object({
|
|
|
+ id: z.number().int().positive().openapi({ description: '用户ID' }),
|
|
|
+ username: z.string().openapi({ description: '用户名', example: 'user123' }),
|
|
|
+ phone: z.string().nullable().openapi({ description: '手机号', example: '13800138000' })
|
|
|
+ }).nullable().optional().openapi({
|
|
|
+ description: '用户信息'
|
|
|
+ }),
|
|
|
+ merchant: z.object({
|
|
|
+ id: z.number().int().positive().openapi({ description: '商户ID' }),
|
|
|
+ name: z.string().openapi({ description: '商户名称', example: '商户A' })
|
|
|
+ }).nullable().optional().openapi({
|
|
|
+ description: '商户信息'
|
|
|
+ }),
|
|
|
+ supplier: z.object({
|
|
|
+ id: z.number().int().positive().openapi({ description: '供货商ID' }),
|
|
|
+ name: z.string().openapi({ description: '供货商名称', example: '供货商A' })
|
|
|
+ }).nullable().optional().openapi({
|
|
|
+ description: '供货商信息'
|
|
|
+ }),
|
|
|
+ deliveryAddress: z.object({
|
|
|
+ id: z.number().int().positive().openapi({ description: '地址ID' }),
|
|
|
+ name: z.string().openapi({ description: '收货人姓名', example: '张三' }),
|
|
|
+ phone: z.string().openapi({ description: '收货人电话', example: '13800138000' }),
|
|
|
+ address: z.string().openapi({ description: '详细地址', example: '北京市朝阳区xxx路xxx号' })
|
|
|
+ }).nullable().optional().openapi({
|
|
|
+ description: '收货地址信息'
|
|
|
+ })
|
|
|
+});
|
|
|
+
|
|
|
+// 创建订单DTO
|
|
|
+export const CreateOrderDto = z.object({
|
|
|
+ orderNo: z.string().min(1, '订单号不能为空').max(50, '订单号最多50个字符').openapi({
|
|
|
+ description: '订单号',
|
|
|
+ example: 'ORD20240101123456'
|
|
|
+ }),
|
|
|
+ userId: z.number().int().positive('用户ID必须是正整数').openapi({
|
|
|
+ description: '用户ID',
|
|
|
+ example: 1
|
|
|
+ }),
|
|
|
+ authCode: z.string().max(32, '付款码最多32个字符').nullable().optional().openapi({
|
|
|
+ description: '付款码',
|
|
|
+ example: '12345678901234567890123456789012'
|
|
|
+ }),
|
|
|
+ cardNo: z.string().max(32, '卡号最多32个字符').nullable().optional().openapi({
|
|
|
+ description: '卡号',
|
|
|
+ example: '6222********1234'
|
|
|
+ }),
|
|
|
+ sjtCardNo: z.string().max(32, '盛京通卡号最多32个字符').nullable().optional().openapi({
|
|
|
+ description: '盛京通卡号',
|
|
|
+ example: 'SJT1234567890'
|
|
|
+ }),
|
|
|
+ amount: z.coerce.number().min(0, '订单金额不能小于0').max(999999.99, '订单金额不能超过999999.99').openapi({
|
|
|
+ description: '订单金额',
|
|
|
+ example: 99.99
|
|
|
+ }),
|
|
|
+ costAmount: z.coerce.number().min(0, '成本金额不能小于0').max(999999.99, '成本金额不能超过999999.99').default(0).optional().openapi({
|
|
|
+ description: '成本金额',
|
|
|
+ example: 50.00
|
|
|
+ }),
|
|
|
+ freightAmount: z.coerce.number().min(0, '运费不能小于0').max(999999.99, '运费不能超过999999.99').default(0).optional().openapi({
|
|
|
+ description: '运费',
|
|
|
+ example: 10.00
|
|
|
+ }),
|
|
|
+ discountAmount: z.coerce.number().min(0, '优惠金额不能小于0').max(999999.99, '优惠金额不能超过999999.99').default(0).optional().openapi({
|
|
|
+ description: '优惠金额',
|
|
|
+ example: 5.00
|
|
|
+ }),
|
|
|
+ payAmount: z.coerce.number().min(0, '实际支付金额不能小于0').max(999999.99, '实际支付金额不能超过999999.99').default(0).optional().openapi({
|
|
|
+ description: '实际支付金额',
|
|
|
+ example: 94.99
|
|
|
+ }),
|
|
|
+ deviceNo: z.string().max(255, '设备编号最多255个字符').nullable().optional().openapi({
|
|
|
+ description: '设备编号',
|
|
|
+ example: 'DEV001234'
|
|
|
+ }),
|
|
|
+ description: z.string().max(255, '订单描述最多255个字符').nullable().optional().openapi({
|
|
|
+ description: '订单描述',
|
|
|
+ example: '购买商品'
|
|
|
+ }),
|
|
|
+ goodsDetail: z.string().max(2000, '订单详情最多2000个字符').nullable().optional().openapi({
|
|
|
+ description: '订单详情(json格式)',
|
|
|
+ example: '[{"goodsId":1,"name":"商品1","price":99.99,"num":1}]'
|
|
|
+ }),
|
|
|
+ goodsTag: z.string().max(255, '订单优惠标记最多255个字符').nullable().optional().openapi({
|
|
|
+ description: '订单优惠标记',
|
|
|
+ example: '满100减5'
|
|
|
+ }),
|
|
|
+ address: z.string().max(255, '地址最多255个字符').nullable().optional().openapi({
|
|
|
+ description: '地址',
|
|
|
+ example: '北京市朝阳区xxx路xxx号'
|
|
|
+ }),
|
|
|
+ orderType: z.coerce.number().int().min(1, '订单类型最小为1').max(2, '订单类型最大为2').default(1).openapi({
|
|
|
+ description: '订单类型 1实物订单 2虚拟订单',
|
|
|
+ example: 1
|
|
|
+ }),
|
|
|
+ payType: z.coerce.number().int().min(0, '支付类型最小为0').max(2, '支付类型最大为2').default(0).openapi({
|
|
|
+ description: '支付类型1积分2礼券',
|
|
|
+ example: 1
|
|
|
+ }),
|
|
|
+ payState: z.coerce.number().int().min(0, '支付状态最小为0').max(5, '支付状态最大为5').default(0).openapi({
|
|
|
+ description: '支付状态 0未支付1支付中2支付成功3已退款4支付失败5订单关闭',
|
|
|
+ example: 2
|
|
|
+ }),
|
|
|
+ state: z.coerce.number().int().min(0, '订单状态最小为0').max(3, '订单状态最大为3').default(0).openapi({
|
|
|
+ description: '订单状态 0未发货1已发货2收货成功3已退货',
|
|
|
+ example: 0
|
|
|
+ }),
|
|
|
+ userPhone: z.string().max(50, '用户手机号最多50个字符').nullable().optional().openapi({
|
|
|
+ description: '用户手机号',
|
|
|
+ example: '13800138000'
|
|
|
+ }),
|
|
|
+ merchantId: z.coerce.number().int().positive().default(0).openapi({
|
|
|
+ description: '商户id',
|
|
|
+ example: 1
|
|
|
+ }),
|
|
|
+ merchantNo: z.coerce.number().int().positive().nullable().optional().openapi({
|
|
|
+ description: '商户号',
|
|
|
+ example: 1001
|
|
|
+ }),
|
|
|
+ supplierId: z.coerce.number().int().positive().default(0).openapi({
|
|
|
+ description: '供货商id',
|
|
|
+ example: 1
|
|
|
+ }),
|
|
|
+ addressId: z.coerce.number().int().positive().default(0).openapi({
|
|
|
+ description: '地址id',
|
|
|
+ example: 1
|
|
|
+ }),
|
|
|
+ receiverMobile: z.string().max(255, '收货人手机号最多255个字符').nullable().optional().openapi({
|
|
|
+ description: '收货人手机号',
|
|
|
+ example: '13800138000'
|
|
|
+ }),
|
|
|
+ recevierName: z.string().max(255, '收货人姓名最多255个字符').nullable().optional().openapi({
|
|
|
+ description: '收货人姓名',
|
|
|
+ example: '张三'
|
|
|
+ }),
|
|
|
+ recevierProvince: z.coerce.number().int().positive().default(0).openapi({
|
|
|
+ description: '收货人所在省',
|
|
|
+ example: 110000
|
|
|
+ }),
|
|
|
+ recevierCity: z.coerce.number().int().positive().default(0).openapi({
|
|
|
+ description: '收货人所在市',
|
|
|
+ example: 110100
|
|
|
+ }),
|
|
|
+ recevierDistrict: z.coerce.number().int().positive().default(0).openapi({
|
|
|
+ description: '收货人所在区',
|
|
|
+ example: 110105
|
|
|
+ }),
|
|
|
+ recevierTown: z.coerce.number().int().positive().default(0).openapi({
|
|
|
+ description: '收货人所在街道',
|
|
|
+ example: 110105001
|
|
|
+ }),
|
|
|
+ refundTime: z.coerce.date().nullable().optional().openapi({
|
|
|
+ description: '退款时间',
|
|
|
+ example: '2024-01-01T12:00:00Z'
|
|
|
+ }),
|
|
|
+ closeTime: z.coerce.date().nullable().optional().openapi({
|
|
|
+ description: '订单关闭时间',
|
|
|
+ example: '2024-01-01T12:00:00Z'
|
|
|
+ }),
|
|
|
+ remark: z.string().max(255, '管理员备注信息最多255个字符').nullable().optional().openapi({
|
|
|
+ description: '管理员备注信息',
|
|
|
+ example: '请尽快发货'
|
|
|
+ })
|
|
|
+});
|
|
|
+
|
|
|
+// 更新订单DTO
|
|
|
+export const UpdateOrderDto = z.object({
|
|
|
+ orderNo: z.string().min(1, '订单号不能为空').max(50, '订单号最多50个字符').optional().openapi({
|
|
|
+ description: '订单号',
|
|
|
+ example: 'ORD20240101123456'
|
|
|
+ }),
|
|
|
+ userId: z.number().int().positive('用户ID必须是正整数').optional().openapi({
|
|
|
+ description: '用户ID',
|
|
|
+ example: 1
|
|
|
+ }),
|
|
|
+ authCode: z.string().max(32, '付款码最多32个字符').nullable().optional().openapi({
|
|
|
+ description: '付款码',
|
|
|
+ example: '12345678901234567890123456789012'
|
|
|
+ }),
|
|
|
+ cardNo: z.string().max(32, '卡号最多32个字符').nullable().optional().openapi({
|
|
|
+ description: '卡号',
|
|
|
+ example: '6222********1234'
|
|
|
+ }),
|
|
|
+ sjtCardNo: z.string().max(32, '盛京通卡号最多32个字符').nullable().optional().openapi({
|
|
|
+ description: '盛京通卡号',
|
|
|
+ example: 'SJT1234567890'
|
|
|
+ }),
|
|
|
+ amount: z.coerce.number().min(0, '订单金额不能小于0').max(999999.99, '订单金额不能超过999999.99').optional().openapi({
|
|
|
+ description: '订单金额',
|
|
|
+ example: 99.99
|
|
|
+ }),
|
|
|
+ costAmount: z.coerce.number().min(0, '成本金额不能小于0').max(999999.99, '成本金额不能超过999999.99').optional().openapi({
|
|
|
+ description: '成本金额',
|
|
|
+ example: 50.00
|
|
|
+ }),
|
|
|
+ freightAmount: z.coerce.number().min(0, '运费不能小于0').max(999999.99, '运费不能超过999999.99').optional().openapi({
|
|
|
+ description: '运费',
|
|
|
+ example: 10.00
|
|
|
+ }),
|
|
|
+ discountAmount: z.coerce.number().min(0, '优惠金额不能小于0').max(999999.99, '优惠金额不能超过999999.99').optional().openapi({
|
|
|
+ description: '优惠金额',
|
|
|
+ example: 5.00
|
|
|
+ }),
|
|
|
+ payAmount: z.coerce.number().min(0, '实际支付金额不能小于0').max(999999.99, '实际支付金额不能超过999999.99').optional().openapi({
|
|
|
+ description: '实际支付金额',
|
|
|
+ example: 94.99
|
|
|
+ }),
|
|
|
+ deviceNo: z.string().max(255, '设备编号最多255个字符').nullable().optional().openapi({
|
|
|
+ description: '设备编号',
|
|
|
+ example: 'DEV001234'
|
|
|
+ }),
|
|
|
+ description: z.string().max(255, '订单描述最多255个字符').nullable().optional().openapi({
|
|
|
+ description: '订单描述',
|
|
|
+ example: '购买商品'
|
|
|
+ }),
|
|
|
+ goodsDetail: z.string().max(2000, '订单详情最多2000个字符').nullable().optional().openapi({
|
|
|
+ description: '订单详情(json格式)',
|
|
|
+ example: '[{"goodsId":1,"name":"商品1","price":99.99,"num":1}]'
|
|
|
+ }),
|
|
|
+ goodsTag: z.string().max(255, '订单优惠标记最多255个字符').nullable().optional().openapi({
|
|
|
+ description: '订单优惠标记',
|
|
|
+ example: '满100减5'
|
|
|
+ }),
|
|
|
+ address: z.string().max(255, '地址最多255个字符').nullable().optional().openapi({
|
|
|
+ description: '地址',
|
|
|
+ example: '北京市朝阳区xxx路xxx号'
|
|
|
+ }),
|
|
|
+ orderType: z.coerce.number().int().min(1, '订单类型最小为1').max(2, '订单类型最大为2').optional().openapi({
|
|
|
+ description: '订单类型 1实物订单 2虚拟订单',
|
|
|
+ example: 1
|
|
|
+ }),
|
|
|
+ payType: z.coerce.number().int().min(0, '支付类型最小为0').max(2, '支付类型最大为2').optional().openapi({
|
|
|
+ description: '支付类型1积分2礼券',
|
|
|
+ example: 1
|
|
|
+ }),
|
|
|
+ payState: z.coerce.number().int().min(0, '支付状态最小为0').max(5, '支付状态最大为5').optional().openapi({
|
|
|
+ description: '支付状态 0未支付1支付中2支付成功3已退款4支付失败5订单关闭',
|
|
|
+ example: 2
|
|
|
+ }),
|
|
|
+ state: z.coerce.number().int().min(0, '订单状态最小为0').max(3, '订单状态最大为3').optional().openapi({
|
|
|
+ description: '订单状态 0未发货1已发货2收货成功3已退货',
|
|
|
+ example: 0
|
|
|
+ }),
|
|
|
+ userPhone: z.string().max(50, '用户手机号最多50个字符').nullable().optional().openapi({
|
|
|
+ description: '用户手机号',
|
|
|
+ example: '13800138000'
|
|
|
+ }),
|
|
|
+ merchantId: z.coerce.number().int().positive().optional().openapi({
|
|
|
+ description: '商户id',
|
|
|
+ example: 1
|
|
|
+ }),
|
|
|
+ merchantNo: z.coerce.number().int().positive().nullable().optional().openapi({
|
|
|
+ description: '商户号',
|
|
|
+ example: 1001
|
|
|
+ }),
|
|
|
+ supplierId: z.coerce.number().int().positive().optional().openapi({
|
|
|
+ description: '供货商id',
|
|
|
+ example: 1
|
|
|
+ }),
|
|
|
+ addressId: z.coerce.number().int().positive().optional().openapi({
|
|
|
+ description: '地址id',
|
|
|
+ example: 1
|
|
|
+ }),
|
|
|
+ receiverMobile: z.string().max(255, '收货人手机号最多255个字符').nullable().optional().openapi({
|
|
|
+ description: '收货人手机号',
|
|
|
+ example: '13800138000'
|
|
|
+ }),
|
|
|
+ recevierName: z.string().max(255, '收货人姓名最多255个字符').nullable().optional().openapi({
|
|
|
+ description: '收货人姓名',
|
|
|
+ example: '张三'
|
|
|
+ }),
|
|
|
+ recevierProvince: z.coerce.number().int().positive().optional().openapi({
|
|
|
+ description: '收货人所在省',
|
|
|
+ example: 110000
|
|
|
+ }),
|
|
|
+ recevierCity: z.coerce.number().int().positive().optional().openapi({
|
|
|
+ description: '收货人所在市',
|
|
|
+ example: 110100
|
|
|
+ }),
|
|
|
+ recevierDistrict: z.coerce.number().int().positive().optional().openapi({
|
|
|
+ description: '收货人所在区',
|
|
|
+ example: 110105
|
|
|
+ }),
|
|
|
+ recevierTown: z.coerce.number().int().positive().optional().openapi({
|
|
|
+ description: '收货人所在街道',
|
|
|
+ example: 110105001
|
|
|
+ }),
|
|
|
+ refundTime: z.coerce.date().nullable().optional().openapi({
|
|
|
+ description: '退款时间',
|
|
|
+ example: '2024-01-01T12:00:00Z'
|
|
|
+ }),
|
|
|
+ closeTime: z.coerce.date().nullable().optional().openapi({
|
|
|
+ description: '订单关闭时间',
|
|
|
+ example: '2024-01-01T12:00:00Z'
|
|
|
+ }),
|
|
|
+ remark: z.string().max(255, '管理员备注信息最多255个字符').nullable().optional().openapi({
|
|
|
+ description: '管理员备注信息',
|
|
|
+ example: '请尽快发货'
|
|
|
+ })
|
|
|
+});
|
|
|
+
|
|
|
+// 订单列表响应Schema
|
|
|
+export const OrderListResponse = z.object({
|
|
|
+ data: z.array(OrderSchema),
|
|
|
+ pagination: z.object({
|
|
|
+ total: z.number().openapi({ example: 100, description: '总记录数' }),
|
|
|
+ current: z.number().openapi({ example: 1, description: '当前页码' }),
|
|
|
+ pageSize: z.number().openapi({ example: 10, description: '每页数量' })
|
|
|
+ })
|
|
|
+});
|