207 lines
8.2 KiB
Go
207 lines
8.2 KiB
Go
package dto
|
||
|
||
import (
|
||
"time"
|
||
)
|
||
|
||
// CreateOrderReq 创建订单请求
|
||
|
||
type CreateOrderReq struct {
|
||
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
|
||
UserID string `json:"user_id" binding:"required"` // 用户ID
|
||
OrderType string `json:"order_type" binding:"required"` // 订单类型
|
||
Subject string `json:"subject" binding:"required"` // 订单标题
|
||
Description string `json:"description"` // 订单描述
|
||
OrderItems []OrderItemReq `json:"order_items" binding:"required"` // 订单商品
|
||
ShippingInfo ShippingInfoReq `json:"shipping_info"` // 收货信息
|
||
}
|
||
|
||
// OrderItemReq 创建订单商品项请求
|
||
|
||
type OrderItemReq struct {
|
||
ProductID string `json:"product_id" binding:"required"` // 商品ID
|
||
ProductName string `json:"product_name" binding:"required"` // 商品名称
|
||
Price int64 `json:"price" binding:"required,min=1"` // 单价(分)
|
||
Quantity int `json:"quantity" binding:"required,min=1"` // 数量
|
||
ImageURL string `json:"image_url"` // 商品图片
|
||
}
|
||
|
||
// ShippingInfoReq 收货信息请求
|
||
|
||
type ShippingInfoReq struct {
|
||
Consignee string `json:"consignee" binding:"required"` // 收货人
|
||
Phone string `json:"phone" binding:"required"` // 手机号
|
||
Province string `json:"province" binding:"required"` // 省份
|
||
City string `json:"city" binding:"required"` // 城市
|
||
District string `json:"district" binding:"required"` // 区县
|
||
Address string `json:"address" binding:"required"` // 详细地址
|
||
PostalCode string `json:"postal_code"` // 邮编
|
||
}
|
||
|
||
// CreateOrderResp 创建订单响应
|
||
|
||
type CreateOrderResp struct {
|
||
OrderNo string `json:"order_no"` // 订单号
|
||
TotalAmount int64 `json:"total_amount"` // 订单总金额
|
||
PayAmount int64 `json:"pay_amount"` // 实付金额
|
||
ExpiredAt string `json:"expired_at"` // 过期时间
|
||
}
|
||
|
||
// PayOrderReq 支付订单请求
|
||
|
||
type PayOrderReq struct {
|
||
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
|
||
OrderNo string `json:"order_no" binding:"required"` // 订单号
|
||
PayMethod string `json:"pay_method" binding:"required"` // 支付方式:wechat/alipay
|
||
PayType string `json:"pay_type" binding:"required"` // 支付类型:native/jsapi/app/h5
|
||
ClientIP string `json:"client_ip"` // 客户端IP
|
||
OpenID string `json:"openid"` // 用户OpenID(JSAPI支付)
|
||
AuthCode string `json:"auth_code"` // 授权码(付款码支付)
|
||
ReturnURL string `json:"return_url"` // 支付完成跳转URL
|
||
}
|
||
|
||
// PayOrderResp 支付订单响应
|
||
|
||
type PayOrderResp struct {
|
||
OrderNo string `json:"order_no"` // 订单号
|
||
QRCode string `json:"qrcode"` // 支付二维码(Native支付)
|
||
PayURL string `json:"pay_url"` // 支付链接(H5支付)
|
||
PrepayID string `json:"prepay_id"` // 预支付ID(微信)
|
||
JSAPIParams string `json:"jsapi_params"` // JSAPI参数(微信)
|
||
APPParams string `json:"app_params"` // APP参数
|
||
}
|
||
|
||
// QueryOrderReq 查询订单请求
|
||
|
||
type QueryOrderReq struct {
|
||
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
|
||
OrderNo string `json:"order_no" binding:"required"` // 订单号
|
||
}
|
||
|
||
// QueryOrderResp 查询订单响应
|
||
|
||
type QueryOrderResp struct {
|
||
Order OrderDetail `json:"order"` // 订单详情
|
||
}
|
||
|
||
// OrderDetail 订单详情
|
||
|
||
type OrderDetail struct {
|
||
ID string `json:"id"` // 订单ID
|
||
TenantID string `json:"tenant_id"` // 租户ID
|
||
OrderNo string `json:"order_no"` // 订单号
|
||
UserID string `json:"user_id"` // 用户ID
|
||
TotalAmount int64 `json:"total_amount"` // 订单总金额
|
||
PayAmount int64 `json:"pay_amount"` // 实付金额
|
||
Status string `json:"status"` // 订单状态
|
||
PayMethod string `json:"pay_method"` // 支付方式
|
||
PayStatus string `json:"pay_status"` // 支付状态
|
||
OrderType string `json:"order_type"` // 订单类型
|
||
Subject string `json:"subject"` // 订单标题
|
||
Description string `json:"description"` // 订单描述
|
||
OrderItems []OrderItem `json:"order_items"` // 订单商品
|
||
ShippingInfo ShippingInfo `json:"shipping_info"` // 收货信息
|
||
PayInfo PayInfo `json:"pay_info"` // 支付信息
|
||
CreatedAt time.Time `json:"created_at"` // 创建时间
|
||
UpdatedAt time.Time `json:"updated_at"` // 更新时间
|
||
PaidAt *time.Time `json:"paid_at"` // 支付时间
|
||
ExpiredAt *time.Time `json:"expired_at"` // 过期时间
|
||
}
|
||
|
||
// OrderItem 订单商品项(响应)
|
||
|
||
type OrderItem struct {
|
||
ProductID string `json:"product_id"` // 商品ID
|
||
ProductName string `json:"product_name"` // 商品名称
|
||
Price int64 `json:"price"` // 单价(分)
|
||
Quantity int `json:"quantity"` // 数量
|
||
TotalPrice int64 `json:"total_price"` // 小计(分)
|
||
ImageURL string `json:"image_url"` // 商品图片
|
||
}
|
||
|
||
// ShippingInfo 收货信息(响应)
|
||
|
||
type ShippingInfo struct {
|
||
Consignee string `json:"consignee"` // 收货人
|
||
Phone string `json:"phone"` // 手机号
|
||
Province string `json:"province"` // 省份
|
||
City string `json:"city"` // 城市
|
||
District string `json:"district"` // 区县
|
||
Address string `json:"address"` // 详细地址
|
||
PostalCode string `json:"postal_code"` // 邮编
|
||
}
|
||
|
||
// PayInfo 支付信息(响应)
|
||
|
||
type PayInfo struct {
|
||
TransactionID string `json:"transaction_id"` // 支付平台交易号
|
||
OutTradeNo string `json:"out_trade_no"` // 商户订单号
|
||
PrepayID string `json:"prepay_id"` // 预支付ID
|
||
QRCode string `json:"qrcode"` // 支付二维码
|
||
PayURL string `json:"pay_url"` // 支付链接
|
||
}
|
||
|
||
// CancelOrderReq 取消订单请求
|
||
|
||
type CancelOrderReq struct {
|
||
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
|
||
OrderNo string `json:"order_no" binding:"required"` // 订单号
|
||
Reason string `json:"reason"` // 取消原因
|
||
}
|
||
|
||
// CancelOrderResp 取消订单响应
|
||
|
||
type CancelOrderResp struct {
|
||
OrderNo string `json:"order_no"` // 订单号
|
||
Status string `json:"status"` // 新状态
|
||
}
|
||
|
||
// RefundOrderReq 退款请求
|
||
|
||
type RefundOrderReq struct {
|
||
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
|
||
OrderNo string `json:"order_no" binding:"required"` // 订单号
|
||
RefundAmount int64 `json:"refund_amount" binding:"required"` // 退款金额(分)
|
||
Reason string `json:"reason"` // 退款原因
|
||
}
|
||
|
||
// RefundOrderResp 退款响应
|
||
|
||
type RefundOrderResp struct {
|
||
RefundNo string `json:"refund_no"` // 退款单号
|
||
RefundID string `json:"refund_id"` // 退款ID
|
||
RefundAmount int64 `json:"refund_amount"` // 退款金额
|
||
}
|
||
|
||
// ListOrdersReq 订单列表请求
|
||
|
||
type ListOrdersReq struct {
|
||
TenantID string `json:"tenant_id" binding:"required"` // 租户ID
|
||
UserID string `json:"user_id"` // 用户ID(可选)
|
||
Status string `json:"status"` // 订单状态(可选)
|
||
Page int `json:"page"` // 页码
|
||
PageSize int `json:"page_size"` // 每页大小
|
||
}
|
||
|
||
// ListOrdersResp 订单列表响应
|
||
|
||
type ListOrdersResp struct {
|
||
Orders []OrderSummary `json:"orders"` // 订单列表
|
||
Total int64 `json:"total"` // 总记录数
|
||
Page int `json:"page"` // 当前页码
|
||
PageSize int `json:"page_size"` // 每页大小
|
||
}
|
||
|
||
// OrderSummary 订单摘要(用于列表)
|
||
|
||
type OrderSummary struct {
|
||
ID string `json:"id"` // 订单ID
|
||
OrderNo string `json:"order_no"` // 订单号
|
||
TotalAmount int64 `json:"total_amount"` // 订单总金额
|
||
PayAmount int64 `json:"pay_amount"` // 实付金额
|
||
Status string `json:"status"` // 订单状态
|
||
Subject string `json:"subject"` // 订单标题
|
||
CreatedAt time.Time `json:"created_at"` // 创建时间
|
||
PaidAt *time.Time `json:"paid_at"` // 支付时间
|
||
}
|