orders

package
v0.0.0-...-f5147e6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

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 DeliveryMethod

type DeliveryMethod struct {
	gorm.Model

	Name  string
	Price float32
}

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
	// 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"`

	// -- ORDER_TYPE starts with Q 退货的取件单
	OrderType string

	// 客户信息, 从京东后台导入或者扫描枪扫入的
	CustomerAddress string
	CustomerName    string
	CustomerPhone   string

	// 预约配送时间
	ReserverdDeliveryTime string

	// 预约安装时间
	ReserverdSetupTime string

	// 预约取件时间
	ReserverdPickupTime string

	// 是否送装一体(这个jd页面抓下来的是什么就存什么, 但是实际上有的订单是非送装一体,如果客户要求,也需要派人安装的,有些订单是取件单)
	// 所以这个字段保持和京东抓下来的一致,另外还要个OrderType, 根据规则或者人工去改OrderType
	IsDeliveryAndSetup string

	// 应收款项
	Receivables float32

	// 配送员
	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) Amount

func (order Order) Amount() (amount float32)

func (Order) DeliveryFee

func (order Order) DeliveryFee() (amount float32)

DeliveryFee delivery fee

func (Order) ExternalID

func (order Order) ExternalID() string

func (Order) IsCart

func (order Order) IsCart() bool

func (Order) Total

func (order Order) Total() (total float32)

func (Order) UniqueExternalID

func (order Order) UniqueExternalID() string

type OrderFollowUp

type OrderFollowUp struct {
	gorm.Model
	audited.AuditedModel
	transition.Transition

	// OrderID uint
	OrderNo string `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 订单回访

type OrderItem

type OrderItem struct {
	gorm.Model
	OrderID          uint
	SizeVariationID  uint `cartitem:"SizeVariationID"`
	SizeVariation    *products.SizeVariation
	ColorVariationID uint `cartitem:"ColorVariationID"`
	ColorVariation   *products.ColorVariation
	Quantity         uint `cartitem:"Quantity"`
	Price            float32
	DiscountRate     uint
	transition.Transition

	ProductNo string `json:"product_no"`
	OrderNo   string `json:"order_no"`
	ItemName  string `json:"product_name"`
	Install   string `json:"install"`
}

func (OrderItem) Amount

func (item OrderItem) Amount() float32

Amount order item's amount

func (*OrderItem) Color

func (item *OrderItem) Color() products.Color

func (OrderItem) IsCart

func (item OrderItem) IsCart() bool

IsCart order item's state is cart

func (*OrderItem) ProductName

func (item *OrderItem) ProductName() string

ProductName order item's color name

func (*OrderItem) ProductPath

func (item *OrderItem) ProductPath() string

ProductPath order item's product name

func (*OrderItem) SellingPrice

func (item *OrderItem) SellingPrice() float32

SellingPrice order item's selling price

func (*OrderItem) Size

func (item *OrderItem) Size() products.Size

type OrderType

type OrderType string
const (
	Delivery         OrderType = "配送"
	Logistics        OrderType = "物流"
	Setup            OrderType = "安装"
	Repair           OrderType = "维修"
	Clean            OrderType = "清洗"
	Sale             OrderType = "销售"
	DeliveryAndSetup OrderType = "送装一体"
)

type PaymentMethod

type PaymentMethod = string
const (
	COD        PaymentMethod = "COD"
	AmazonPay  PaymentMethod = "AmazonPay"
	CreditCard PaymentMethod = "CreditCard"
)

type Source

type Source string
const (
	JD     Source = "京东物流"
	Suning Source = "苏宁帮客"
	Midea  Source = "美的安得"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL