118 lines
4.5 KiB
Go
118 lines
4.5 KiB
Go
package model
|
||
|
||
import "time"
|
||
|
||
const (
|
||
OrderDeliveryTypePlatform = "platform" // 平台负责配送
|
||
OrderDeliveryTypeStoreSelf = "store" // 门店自送
|
||
OrderDeliveryTypeSelfTake = "self" // 用户自提
|
||
)
|
||
|
||
const (
|
||
PayTypeWX = 1 // 微信支付
|
||
PayTypeTL = 2 // 通联宝支付
|
||
|
||
PayStatusNo = 0
|
||
PayStatusYes = 1
|
||
PayStatusFailed = 2
|
||
PayStatusCanceled = 3
|
||
PayStatusRefund = 4
|
||
|
||
RefundStatusNo = 0
|
||
RefundStatusYes = 1
|
||
RefundStatusFailed = 2
|
||
|
||
EarningTypeQuote = 1 //报价模式
|
||
EarningTypePoints = 2 //扣点模式
|
||
|
||
VendorPayTypeCompanyPay = "companyPay" //企业付款
|
||
)
|
||
|
||
const (
|
||
OrderTypeAddressErr = -1 //地址异常订单
|
||
OrderTypeNormal = 0 //普通订单
|
||
OrderTypeMatter = 1 //物料订单
|
||
OrderTypeSupplyGoods = 2 //进货订单
|
||
OrderTypeDefendPrice = 3 //守价订单
|
||
|
||
OrderTypeAccount = 1 //账户余额
|
||
)
|
||
|
||
var (
|
||
PayStatusName = map[int]string{
|
||
PayStatusNo: "待支付",
|
||
PayStatusYes: "已支付",
|
||
PayStatusFailed: "支付失败",
|
||
PayStatusCanceled: "支付取消",
|
||
PayStatusRefund: "已退款",
|
||
}
|
||
|
||
RefundStatusName = map[int]string{
|
||
RefundStatusNo: "待退款",
|
||
RefundStatusYes: "已退款",
|
||
RefundStatusFailed: "退款失败",
|
||
}
|
||
)
|
||
|
||
type Order struct {
|
||
ModelIDCUL
|
||
|
||
OrderID int64 `orm:"column(order_id)" json:"orderID"` //订单号
|
||
UserID string `orm:"column(user_id);size(48)" json:"userID"` //用户ID
|
||
Type int `json:"type"` //订单类型
|
||
Status int `json:"status"` //订单状态,待支付2,已支付5,支付成功110,支付失败115
|
||
PayPrice int `json:"payPrice"` //支付金额
|
||
TransactionID string `orm:"column(transaction_id);size(48)" json:"transactionID"` // 支付成功后,支付方生成的事务ID
|
||
PayFinishedAt time.Time `orm:"type(datetime);null" json:"payFinishedAt"`
|
||
PrepayID string `orm:"column(prepay_id);size(48)" json:"prepayID"` // 下单后,支付前,支付方生成的事务ID
|
||
OriginalData string `orm:"type(text)" json:"-"`
|
||
Comment string `orm:"size(255)" json:"comment"` //备注
|
||
}
|
||
|
||
func (v *Order) TableUnique() [][]string {
|
||
return [][]string{
|
||
[]string{"OrderID"},
|
||
}
|
||
}
|
||
|
||
func (v *Order) TableIndex() [][]string {
|
||
return [][]string{
|
||
[]string{"CreatedAt"},
|
||
[]string{"UserID"},
|
||
}
|
||
}
|
||
|
||
type DeliveryOrder struct {
|
||
ModelIDCUL
|
||
|
||
VendorWaybillID string `orm:"column(vendor_waybill_id)" json:"vendorWaybillID"` //运单号
|
||
UserID string `orm:"column(user_id);size(48)" json:"userID"` //用户ID
|
||
DeliverySendID int `orm:"column(delivery_send_id)" json:"deliverySendID"` //寄件人地址ID
|
||
DeliveryReceiveID int `orm:"column(delivery_receive_id)" json:"deliveryReceiveID"` //取件人地址ID(收货人)
|
||
Status int `json:"status"` //运单状态
|
||
PayPrice int `json:"payPrice"` //支付金额
|
||
OrderFinishedAt time.Time `json:"orderFinishedAt"` //订单完成时间
|
||
Weight float64 `json:"weight"` //订单重量,单位kg
|
||
Vloumn float64 `json:"vloumn"` //订单体积,单位立方cm
|
||
Description string `json:"description"` //订单商品描述
|
||
PickUpStartTime time.Time `json:"pickUpStartTime"` //预约取件开始时间
|
||
PickUpEndTime time.Time `json:"pickUpEndTime"` //预约取件结束时间
|
||
PackageCount int `json:"packageCount"` //包裹数
|
||
ActualWeight float64 `json:"actualWeight"` //实际重量
|
||
IsWeight int `json:"isWeight"` //0代表未验重,1代表验重通过,2代表不通过
|
||
Comment string `orm:"size(255)" json:"comment"` //备注
|
||
}
|
||
|
||
func (v *DeliveryOrder) TableUnique() [][]string {
|
||
return [][]string{
|
||
[]string{"VendorWaybillID"},
|
||
}
|
||
}
|
||
|
||
func (v *DeliveryOrder) TableIndex() [][]string {
|
||
return [][]string{
|
||
[]string{"CreatedAt"},
|
||
[]string{"UserID"},
|
||
}
|
||
}
|