package model import ( "time" ) // AfterSale 售后服务 type AfterSale struct { ID uint `json:"id" gorm:"primaryKey;autoIncrement"` OrderID uint `json:"order_id" gorm:"not null"` OrderItemID uint `json:"order_item_id" gorm:"not null"` UserID uint `json:"user_id" gorm:"not null"` Type int `json:"type" gorm:"not null"` // 1退货,2换货,3维修 Reason string `json:"reason" gorm:"size:255;not null"` Description string `json:"description" gorm:"type:text"` Images JSONSlice `json:"images" gorm:"type:json"` Status int `json:"status" gorm:"default:1"` // 1待审核,2已同意,3已拒绝,4处理中,5已完成 AdminRemark string `json:"admin_remark" gorm:"type:text"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` // 关联数据 Order Order `json:"order,omitempty" gorm:"foreignKey:OrderID"` OrderItem OrderItem `json:"order_item,omitempty" gorm:"foreignKey:OrderItemID"` User User `json:"user,omitempty" gorm:"foreignKey:UserID"` } // Invoice 发票 type Invoice struct { ID uint `json:"id" gorm:"primaryKey;autoIncrement"` OrderID uint `json:"order_id" gorm:"not null"` UserID uint `json:"user_id" gorm:"not null"` Type int `json:"type" gorm:"not null"` // 1个人,2企业 Title string `json:"title" gorm:"size:255;not null"` TaxNumber string `json:"tax_number" gorm:"size:50"` Amount float64 `json:"amount" gorm:"type:decimal(10,2);not null"` Status int `json:"status" gorm:"default:1"` // 1待开具,2已开具,3已邮寄 InvoiceNo string `json:"invoice_no" gorm:"size:50"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` // 关联数据 Order Order `json:"order,omitempty" gorm:"foreignKey:OrderID"` User User `json:"user,omitempty" gorm:"foreignKey:UserID"` }