2026-03-18 13:07:06 +08:00
|
|
|
|
package models
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
|
"platform/web/core"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/shopspring/decimal"
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// ProductSku 产品SKU表
|
|
|
|
|
|
type ProductSku struct {
|
|
|
|
|
|
core.Model
|
2026-03-24 16:25:21 +08:00
|
|
|
|
ProductID int32 `json:"product_id" gorm:"column:product_id"` // 产品ID
|
|
|
|
|
|
DiscountId int32 `json:"discount_id" gorm:"column:discount_id"` // 折扣,0 - 1 的小数,表示 xx 折
|
|
|
|
|
|
Code string `json:"code" gorm:"column:code"` // SSKU 代码:格式为 key=value,key=value,...,其中,key:value 是 SKU 的属性,多个属性用逗号分隔
|
|
|
|
|
|
Name string `json:"name" gorm:"column:name"` // SKU 可读名称
|
|
|
|
|
|
Price decimal.Decimal `json:"price" gorm:"column:price"` // 定价
|
2026-04-07 13:51:19 +08:00
|
|
|
|
PriceMin decimal.Decimal `json:"price_min" gorm:"column:price_min"` // 最低价格
|
2026-04-07 13:22:37 +08:00
|
|
|
|
Status SkuStatus `json:"status" gorm:"column:status"` // SKU 状态:0-禁用,1-正常
|
2026-04-15 16:56:24 +08:00
|
|
|
|
Sort int32 `json:"sort" gorm:"column:sort"` // 排序
|
2026-04-20 11:20:44 +08:00
|
|
|
|
CountMin int32 `json:"count_min" gorm:"column:count_min"` // 最小购买数量
|
2026-03-18 13:07:06 +08:00
|
|
|
|
|
2026-03-24 16:25:21 +08:00
|
|
|
|
Product *Product `json:"product,omitempty" gorm:"foreignKey:ProductID"`
|
|
|
|
|
|
Discount *ProductDiscount `json:"discount,omitempty" gorm:"foreignKey:DiscountId"`
|
2026-03-18 13:07:06 +08:00
|
|
|
|
}
|
2026-04-07 13:22:37 +08:00
|
|
|
|
|
|
|
|
|
|
// SkuStatus SKU 状态
|
|
|
|
|
|
type SkuStatus int32
|
|
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
|
SkuStatusDisabled SkuStatus = 0 // 禁用
|
|
|
|
|
|
SkuStatusEnabled SkuStatus = 1 // 正常
|
|
|
|
|
|
)
|