Documentation
¶
Index ¶
- Variables
- type Condition
- type DeliveryMethod
- type Execution
- type Order
- func (order *Order) AfterCreate(scope *gorm.Scope) error
- func (order Order) Amount() (amount float32)
- func (order Order) DeliveryFee() (amount float32)
- func (order Order) ExternalID() string
- func (order Order) IsCart() bool
- func (order Order) Total() (total float32)
- func (order Order) UniqueExternalID() string
- type OrderFollowUp
- type OrderItem
- func (item *OrderItem) AfterCreate(scope *gorm.Scope) error
- func (item OrderItem) Amount() float32
- func (item *OrderItem) Color() products.Color
- func (item *OrderItem) GetLengthUnit() int64
- func (item *OrderItem) GetPowerUnit() int64
- func (item *OrderItem) GetUnit() int64
- func (item *OrderItem) GetVolumeUnit() int64
- func (item *OrderItem) GetWeightUnit() int64
- func (item OrderItem) IsCart() bool
- func (item *OrderItem) IsService() bool
- func (item *OrderItem) ProductName() string
- func (item *OrderItem) ProductPath() string
- func (item *OrderItem) SellingPrice() float32
- func (item *OrderItem) SetCategory(c string)
- func (item *OrderItem) SetDeliveryFee(f float64)
- func (item *OrderItem) SetDimension(d string)
- func (item *OrderItem) SetRange(i int64)
- func (item *OrderItem) Size() products.Size
- type OrderType
- type PaymentMethod
- type Pricing
- type Rating
- type Rule
- type Source
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // OrderState order's state machine OrderState = transition.New(&Order{}) // ItemState order item's state machine ItemState = transition.New(&OrderItem{}) )
View Source
var (
DraftState = "draft"
)
View Source
var (
ORDER_TYPES = []string{"配送", "安装", "送装一体", "维修", "清洗", "销售", "物流"}
)
View Source
var (
SOURCES = []string{
"京东物流", "苏宁帮客", "美的安得",
}
)
Functions ¶
This section is empty.
Types ¶
type Order ¶
type Order struct {
gorm.Model
audited.AuditedModel
UserID *uint
User users.User
PaymentAmount float32
PaymentTotal float32
AbandonedReason string
DiscountValue uint
DeliveryMethodID uint `form:"delivery-method"`
DeliveryMethod DeliveryMethod
PaymentMethod string
TrackingNumber *string
ShippedAt *time.Time
ReturnedAt *time.Time
CancelledAt *time.Time
ShippingAddressID uint `form:"shippingaddress"`
ShippingAddress users.Address
BillingAddressID uint `form:"billingaddress"`
BillingAddress users.Address
OrderItems []OrderItem `json:"order_items"`
// AmazonAddressAccessToken string
// AmazonOrderReferenceID string
// AmazonAuthorizationID string
// AmazonCaptureID string
// AmazonRefundID string
PaymentLog string `gorm:"size:655250"`
// 订单来源 0 自家商城, 1 京东
Source string
// 订单号 面单号
OrderNo string `gorm:"unique;not null" json:"order_no"`
// -- ORDER_TYPE starts with Q 退货的取件单
OrderType string
// 客户信息, 从京东后台导入或者扫描枪扫入的
CustomerAddress string `json:"customer_address"`
CustomerName string `json:"customer_name"`
CustomerPhone string `json:"customer_phone"`
// 预约配送时间
ReservedDeliveryTime string `gorm:"reserved_delivery_time" json:"reserved_delivery_time"`
// 预约安装时间
ReservedSetupTime string `gorm:"reserved_setup_time" json:"reserved_setup_time"`
// 预约取件时间
ReservedPickupTime string `gorm:"reserved_pickup_time" json:"reserved_pickup_time"`
// 是否送装一体(这个jd页面抓下来的是什么就存什么, 但是实际上有的订单是非送装一体,如果客户要求,也需要派人安装的,有些订单是取件单)
// 所以这个字段保持和京东抓下来的一致,另外还要个OrderType, 根据规则或者人工去改OrderType
IsDeliveryAndSetup string
// 应收款项
Receivables float32 `json:"receivables"`
// 配送员
ManToDeliverID string `l10n:"sync"`
ManToDeliver users.User `l10n:"sync"`
// 配送员
ManToSetupID string
ManToSetup users.User `l10n:"sync"`
// 取件员
ManToPickupID string `l10n:"sync"`
ManToPickup users.User `l10n:"sync"`
// 取件费
PickupFee float32
// 配送费
ShippingFee float32
// 安装费
SetupFee float32
transition.Transition
}
func (*Order) AfterCreate ¶
AfterCreate 初始状态
func (Order) DeliveryFee ¶
DeliveryFee delivery fee
func (Order) ExternalID ¶
func (Order) UniqueExternalID ¶
type OrderFollowUp ¶
type OrderFollowUp struct {
gorm.Model
audited.AuditedModel
transition.Transition
OrderID uint
OrderNo string `gorm:"unique;not null" json:"order_no"`
// 对配送时效是否满意
SatisfactionOfTimeliness string `json:"satisfaction_of_timeliness"`
// 对服务态度是否满意
SatisfactionOfServices string `json:"satisfaction_of_services"`
// 是否有开箱验货
InspectTheGoods string `json:"inspect_the_goods"`
// 师傅是否邀评
RequestFeedback string `json:"request_feedback"`
// 是否有留下联系方式 方便后期有问题联系
LeaveContactInfomation string `json:"leave_contact_information"`
// 师傅是否有介绍延保
IntroduceWarrantyExtension string `json:"introduce_warranty_extension"`
// 是否有把商品放到指定位置
PositionProperly string `json:"position_properly"`
// 有无问题要反馈
Feedback string `json:"feedback"`
// 异常处理结果
ExceptionHandling string `json:"exception_handling"`
}
OrderFollowUp 订单回访
func (*OrderFollowUp) AfterCreate ¶
func (o *OrderFollowUp) AfterCreate(scope *gorm.DB) error
AfterCreate callback
type OrderItem ¶
type OrderItem struct {
gorm.Model
OrderID uint `json: "order_id`
Order Order
SizeVariationID uint `cartitem:"SizeVariationID"`
SizeVariation *products.SizeVariation
ColorVariationID uint `cartitem:"ColorVariationID"`
ColorVariation *products.ColorVariation
Quantity uint `cartitem:"Quantity"`
Price float32 `json:"price"`
DiscountRate uint
ProductNo string `json:"product_no"`
OrderNo string `json:"order_no"`
ItemName string `json:"product_name"`
Install string `json:"install"`
Range int `json:"range"`
Category string `json:"category"`
Dimension string `json:"dimension"`
// 单件商品的配送费 根据规则推断出来的
DeliveryFee float64 `json:"delivery_fee"`
transition.Transition
}
func (*OrderItem) AfterCreate ¶
AfterCreate 初始状态
func (*OrderItem) GetLengthUnit ¶
GetLengthUnit 获取长度单位(x英寸)中的数字 电视机
func (*OrderItem) GetPowerUnit ¶
GetPowerUnit 获取功率单位(x匹)中的数字 空调
func (*OrderItem) GetVolumeUnit ¶
GetVolumeUnit 获取重量单位(x升/L)中的数字 冰箱 冰柜 热水器
func (*OrderItem) GetWeightUnit ¶
GetWeightUnit 获取重量单位(x公斤/kg)中的数字 洗衣机
func (*OrderItem) ProductName ¶
ProductName order item's color name
func (*OrderItem) ProductPath ¶
ProductPath order item's product name
func (*OrderItem) SellingPrice ¶
SellingPrice order item's selling price
func (*OrderItem) SetCategory ¶
func (*OrderItem) SetDeliveryFee ¶
func (*OrderItem) SetDimension ¶
type PaymentMethod ¶
type PaymentMethod = string
const ( COD PaymentMethod = "COD" AmazonPay PaymentMethod = "AmazonPay" CreditCard PaymentMethod = "CreditCard" )
type Pricing ¶
type Pricing struct {
gorm.Model
// 针对哪个分类的 (冰洗空)
Category string
// 件型大小
VolumeType string
// 配送范围
DeliveryArea string
// 费用
Fee float64
}
Pricing 运费定价 https://cl.ly/c1c76e6a4776 eg. 超小件的电脑配送到县城10元,配送到乡下15元 运费根据规则引擎计算 grool.go
type Rating ¶
type Rating struct {
gorm.Model
OrderID uint
Order Order
// 好评还是差评
Type string
// 具体原因
Reason string
// 奖励或罚款金额
Amount int
Remark string
audited.AuditedModel
}
Rating 记录好评差评模块
Click to show internal directories.
Click to hide internal directories.