|
@@ -276,19 +276,19 @@ export const CreateOrderDto = z.object({
|
|
|
description: '地址',
|
|
description: '地址',
|
|
|
example: '北京市朝阳区xxx路xxx号'
|
|
example: '北京市朝阳区xxx路xxx号'
|
|
|
}),
|
|
}),
|
|
|
- orderType: z.coerce.number().int().min(1, '订单类型最小为1').max(2, '订单类型最大为2').default(1).optional().openapi({
|
|
|
|
|
|
|
+ orderType: z.coerce.number().int().min(1, '订单类型最小为1').max(2, '订单类型最大为2').default(1).openapi({
|
|
|
description: '订单类型 1实物订单 2虚拟订单',
|
|
description: '订单类型 1实物订单 2虚拟订单',
|
|
|
example: 1
|
|
example: 1
|
|
|
}),
|
|
}),
|
|
|
- payType: z.coerce.number().int().min(0, '支付类型最小为0').max(2, '支付类型最大为2').default(0).optional().openapi({
|
|
|
|
|
|
|
+ payType: z.coerce.number().int().min(0, '支付类型最小为0').max(2, '支付类型最大为2').default(0).openapi({
|
|
|
description: '支付类型1积分2礼券',
|
|
description: '支付类型1积分2礼券',
|
|
|
example: 1
|
|
example: 1
|
|
|
}),
|
|
}),
|
|
|
- payState: z.coerce.number().int().min(0, '支付状态最小为0').max(5, '支付状态最大为5').default(0).optional().openapi({
|
|
|
|
|
|
|
+ payState: z.coerce.number().int().min(0, '支付状态最小为0').max(5, '支付状态最大为5').default(0).openapi({
|
|
|
description: '支付状态 0未支付1支付中2支付成功3已退款4支付失败5订单关闭',
|
|
description: '支付状态 0未支付1支付中2支付成功3已退款4支付失败5订单关闭',
|
|
|
- example: 0
|
|
|
|
|
|
|
+ example: 2
|
|
|
}),
|
|
}),
|
|
|
- state: z.coerce.number().int().min(0, '订单状态最小为0').max(3, '订单状态最大为3').default(0).optional().openapi({
|
|
|
|
|
|
|
+ state: z.coerce.number().int().min(0, '订单状态最小为0').max(3, '订单状态最大为3').default(0).openapi({
|
|
|
description: '订单状态 0未发货1已发货2收货成功3已退货',
|
|
description: '订单状态 0未发货1已发货2收货成功3已退货',
|
|
|
example: 0
|
|
example: 0
|
|
|
}),
|
|
}),
|
|
@@ -296,7 +296,7 @@ export const CreateOrderDto = z.object({
|
|
|
description: '用户手机号',
|
|
description: '用户手机号',
|
|
|
example: '13800138000'
|
|
example: '13800138000'
|
|
|
}),
|
|
}),
|
|
|
- merchantId: z.coerce.number().int().positive().default(0).optional().openapi({
|
|
|
|
|
|
|
+ merchantId: z.coerce.number().int().positive().default(0).openapi({
|
|
|
description: '商户id',
|
|
description: '商户id',
|
|
|
example: 1
|
|
example: 1
|
|
|
}),
|
|
}),
|
|
@@ -304,11 +304,11 @@ export const CreateOrderDto = z.object({
|
|
|
description: '商户号',
|
|
description: '商户号',
|
|
|
example: 1001
|
|
example: 1001
|
|
|
}),
|
|
}),
|
|
|
- supplierId: z.coerce.number().int().positive().default(0).optional().openapi({
|
|
|
|
|
|
|
+ supplierId: z.coerce.number().int().positive().default(0).openapi({
|
|
|
description: '供货商id',
|
|
description: '供货商id',
|
|
|
example: 1
|
|
example: 1
|
|
|
}),
|
|
}),
|
|
|
- addressId: z.coerce.number().int().positive().default(0).optional().openapi({
|
|
|
|
|
|
|
+ addressId: z.coerce.number().int().positive().default(0).openapi({
|
|
|
description: '地址id',
|
|
description: '地址id',
|
|
|
example: 1
|
|
example: 1
|
|
|
}),
|
|
}),
|
|
@@ -320,19 +320,19 @@ export const CreateOrderDto = z.object({
|
|
|
description: '收货人姓名',
|
|
description: '收货人姓名',
|
|
|
example: '张三'
|
|
example: '张三'
|
|
|
}),
|
|
}),
|
|
|
- recevierProvince: z.coerce.number().int().positive().default(0).optional().openapi({
|
|
|
|
|
|
|
+ recevierProvince: z.coerce.number().int().positive().default(0).openapi({
|
|
|
description: '收货人所在省',
|
|
description: '收货人所在省',
|
|
|
example: 110000
|
|
example: 110000
|
|
|
}),
|
|
}),
|
|
|
- recevierCity: z.coerce.number().int().positive().default(0).optional().openapi({
|
|
|
|
|
|
|
+ recevierCity: z.coerce.number().int().positive().default(0).openapi({
|
|
|
description: '收货人所在市',
|
|
description: '收货人所在市',
|
|
|
example: 110100
|
|
example: 110100
|
|
|
}),
|
|
}),
|
|
|
- recevierDistrict: z.coerce.number().int().positive().default(0).optional().openapi({
|
|
|
|
|
|
|
+ recevierDistrict: z.coerce.number().int().positive().default(0).openapi({
|
|
|
description: '收货人所在区',
|
|
description: '收货人所在区',
|
|
|
example: 110105
|
|
example: 110105
|
|
|
}),
|
|
}),
|
|
|
- recevierTown: z.coerce.number().int().positive().default(0).optional().openapi({
|
|
|
|
|
|
|
+ recevierTown: z.coerce.number().int().positive().default(0).openapi({
|
|
|
description: '收货人所在街道',
|
|
description: '收货人所在街道',
|
|
|
example: 110105001
|
|
example: 110105001
|
|
|
}),
|
|
}),
|
|
@@ -347,15 +347,19 @@ export const CreateOrderDto = z.object({
|
|
|
remark: z.string().max(255, '管理员备注信息最多255个字符').nullable().optional().openapi({
|
|
remark: z.string().max(255, '管理员备注信息最多255个字符').nullable().optional().openapi({
|
|
|
description: '管理员备注信息',
|
|
description: '管理员备注信息',
|
|
|
example: '请尽快发货'
|
|
example: '请尽快发货'
|
|
|
- }),
|
|
|
|
|
- createdBy: z.number().int().positive().nullable().optional().openapi({
|
|
|
|
|
- description: '创建人ID',
|
|
|
|
|
- example: 1
|
|
|
|
|
})
|
|
})
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
-// 更新订单DTO(通常仅包含可更新字段,这里示例保留大部分字段,实际可根据业务调整)
|
|
|
|
|
|
|
+// 更新订单DTO
|
|
|
export const UpdateOrderDto = z.object({
|
|
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({
|
|
authCode: z.string().max(32, '付款码最多32个字符').nullable().optional().openapi({
|
|
|
description: '付款码',
|
|
description: '付款码',
|
|
|
example: '12345678901234567890123456789012'
|
|
example: '12345678901234567890123456789012'
|
|
@@ -422,7 +426,7 @@ export const UpdateOrderDto = z.object({
|
|
|
}),
|
|
}),
|
|
|
state: z.coerce.number().int().min(0, '订单状态最小为0').max(3, '订单状态最大为3').optional().openapi({
|
|
state: z.coerce.number().int().min(0, '订单状态最小为0').max(3, '订单状态最大为3').optional().openapi({
|
|
|
description: '订单状态 0未发货1已发货2收货成功3已退货',
|
|
description: '订单状态 0未发货1已发货2收货成功3已退货',
|
|
|
- example: 1
|
|
|
|
|
|
|
+ example: 0
|
|
|
}),
|
|
}),
|
|
|
userPhone: z.string().max(50, '用户手机号最多50个字符').nullable().optional().openapi({
|
|
userPhone: z.string().max(50, '用户手机号最多50个字符').nullable().optional().openapi({
|
|
|
description: '用户手机号',
|
|
description: '用户手机号',
|
|
@@ -479,28 +483,15 @@ export const UpdateOrderDto = z.object({
|
|
|
remark: z.string().max(255, '管理员备注信息最多255个字符').nullable().optional().openapi({
|
|
remark: z.string().max(255, '管理员备注信息最多255个字符').nullable().optional().openapi({
|
|
|
description: '管理员备注信息',
|
|
description: '管理员备注信息',
|
|
|
example: '请尽快发货'
|
|
example: '请尽快发货'
|
|
|
- }),
|
|
|
|
|
- updatedBy: z.number().int().positive().nullable().optional().openapi({
|
|
|
|
|
- description: '更新人ID',
|
|
|
|
|
- example: 1
|
|
|
|
|
})
|
|
})
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
-// 订单列表响应
|
|
|
|
|
|
|
+// 订单列表响应Schema
|
|
|
export const OrderListResponse = z.object({
|
|
export const OrderListResponse = z.object({
|
|
|
data: z.array(OrderSchema),
|
|
data: z.array(OrderSchema),
|
|
|
pagination: z.object({
|
|
pagination: z.object({
|
|
|
- total: z.number().openapi({
|
|
|
|
|
- example: 100,
|
|
|
|
|
- description: '总记录数'
|
|
|
|
|
- }),
|
|
|
|
|
- current: z.number().openapi({
|
|
|
|
|
- example: 1,
|
|
|
|
|
- description: '当前页码'
|
|
|
|
|
- }),
|
|
|
|
|
- pageSize: z.number().openapi({
|
|
|
|
|
- example: 10,
|
|
|
|
|
- description: '每页数量'
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ total: z.number().openapi({ example: 100, description: '总记录数' }),
|
|
|
|
|
+ current: z.number().openapi({ example: 1, description: '当前页码' }),
|
|
|
|
|
+ pageSize: z.number().openapi({ example: 10, description: '每页数量' })
|
|
|
})
|
|
})
|
|
|
});
|
|
});
|