|
|
|
@ -12,53 +12,54 @@ import (
|
|
|
|
|
|
|
|
|
|
type RecookGoodsSkuModel struct {
|
|
|
|
|
db.BaseModel
|
|
|
|
|
Id uint `gorm:"column:id;primary_key" json:"id"`
|
|
|
|
|
GoodsId uint `gorm:"column:goods_id" json:"goodsId"`
|
|
|
|
|
Name string `gorm:"column:name" json:"name"`
|
|
|
|
|
CombineId string `gorm:"column:combine_id" json:"combineId"`
|
|
|
|
|
PicURL string `gorm:"column:pic_url" json:"picUrl"`
|
|
|
|
|
Code string `gorm:"column:code" json:"code"`
|
|
|
|
|
PurchasePrice decimal.Decimal `gorm:"column:purchase_price" json:"purchasePrice"`
|
|
|
|
|
OriginalPrice decimal.Decimal `gorm:"column:original_price" json:"originalPrice"` // 原价
|
|
|
|
|
DiscountPrice decimal.Decimal `gorm:"column:discount_price" json:"discountPrice"` // 折扣价
|
|
|
|
|
CommissionRate decimal.Decimal `gorm:"column:commission_rate" json:"commissionRate"` // 佣金比
|
|
|
|
|
Commission decimal.Decimal `gorm:"column:commission" json:"commission"` // 佣金
|
|
|
|
|
ControlPrice decimal.Decimal `gorm:"column:control_price" json:"controlPrice"` // 供应商最低控价
|
|
|
|
|
SalesVolume uint `gorm:"column:sales_volume" json:"salesVolume"` // 销售量 销售量只简单累加
|
|
|
|
|
Inventory uint `gorm:"column:inventory" json:"inventory"` // 库存量 可以直接补货
|
|
|
|
|
SalesVolumeInc uint `gorm:"column:sales_volume_inc" json:"salesVolumeInc"` // 销售量的增量
|
|
|
|
|
Coupon decimal.Decimal `gorm:"column:coupon" json:"coupon"`
|
|
|
|
|
GoodsNum string `gorm:"column:goods_num" json:"goodsNum"` //商品货号
|
|
|
|
|
BmSkuId string `gorm:"column:bm_sku_id" json:"bm_sku_id"` //舶茂的skuid
|
|
|
|
|
BmShopId string `gorm:"column:bm_shop_id" json:"bm_shop_id"` //舶茂的商家id
|
|
|
|
|
ThirdPartySkuId string `gorm:"column:third_party_sku_id" json:"thirdPartySkuId"` //第三方skuid
|
|
|
|
|
ThirdPartyType int `gorm:"column:third_party_type" json:"thirdPartySkuType"` //第三方类型
|
|
|
|
|
TMallPrice string `gorm:"column:tmall_price" json:"tmallPrice"`
|
|
|
|
|
TMallUrl string `gorm:"column:tmall_url" json:"tmallUrl"`
|
|
|
|
|
JdPrice string `gorm:"column:jd_price" json:"jdPrice"`
|
|
|
|
|
JdUrl string `gorm:"column:jd_url" json:"jdUrl"`
|
|
|
|
|
GysSkuID uint `gorm:"gys_sku_id" json:"gys_sku_id"`
|
|
|
|
|
Invoice RecookSkuInvoiceModel `gorm:"foreignKey:SkuId" json:"invoice"`
|
|
|
|
|
DetailPhoto []RecookGoodsDetailPhotoModel `gorm:"foreignKey:GoodsID;references:GoodsId"`
|
|
|
|
|
Goods RecookGoodsInfoModel `gorm:"foreignKey:GoodsId"`
|
|
|
|
|
SecKill flashsale.RecookSecKillGoodsModel `gorm:"foreignKey:Id;references:GoodsSkuId"`
|
|
|
|
|
SecKillTemp flashsale.RecookSecKillGoodsModelTemp `gorm:"foreignKey:Id;references:GoodsSkuId"`
|
|
|
|
|
Length float64 `json:"length"`
|
|
|
|
|
Width float64 `json:"width"`
|
|
|
|
|
Height float64 `json:"height"`
|
|
|
|
|
Weight float64 `json:"weight"`
|
|
|
|
|
Limit int `json:"limit" gorm:"column:limit_num"`
|
|
|
|
|
Min int `json:"min" gorm:"column:min_num"`
|
|
|
|
|
SaleInventory uint `json:"sale_inventory"`
|
|
|
|
|
GoodsInfo *RecookGoodsInfoModel `json:"-" gorm:"foreignKey:goods_id"`
|
|
|
|
|
Id uint `gorm:"column:id;primary_key" json:"id"`
|
|
|
|
|
GoodsId uint `gorm:"column:goods_id" json:"goodsId"`
|
|
|
|
|
Name string `gorm:"column:name" json:"name"`
|
|
|
|
|
CombineId string `gorm:"column:combine_id" json:"combineId"`
|
|
|
|
|
PicURL string `gorm:"column:pic_url" json:"picUrl"`
|
|
|
|
|
Code string `gorm:"column:code" json:"code"`
|
|
|
|
|
PurchasePrice decimal.Decimal `gorm:"column:purchase_price" json:"purchasePrice"`
|
|
|
|
|
OriginalPrice decimal.Decimal `gorm:"column:original_price" json:"originalPrice"` // 原价
|
|
|
|
|
DiscountPrice decimal.Decimal `gorm:"column:discount_price" json:"discountPrice"` // 折扣价
|
|
|
|
|
CommissionRate decimal.Decimal `gorm:"column:commission_rate" json:"commissionRate"` // 佣金比
|
|
|
|
|
Commission decimal.Decimal `gorm:"column:commission" json:"commission"` // 佣金
|
|
|
|
|
ControlPrice decimal.Decimal `gorm:"column:control_price" json:"controlPrice"` // 供应商最低控价
|
|
|
|
|
SalesVolume uint `gorm:"column:sales_volume" json:"salesVolume"` // 销售量 销售量只简单累加
|
|
|
|
|
Inventory uint `gorm:"column:inventory" json:"inventory"` // 库存量 可以直接补货
|
|
|
|
|
SalesVolumeInc uint `gorm:"column:sales_volume_inc" json:"salesVolumeInc"` // 销售量的增量
|
|
|
|
|
Coupon decimal.Decimal `gorm:"column:coupon" json:"coupon"`
|
|
|
|
|
GoodsNum string `gorm:"column:goods_num" json:"goodsNum"` //商品货号
|
|
|
|
|
BmSkuId string `gorm:"column:bm_sku_id" json:"bm_sku_id"` //舶茂的skuid
|
|
|
|
|
BmShopId string `gorm:"column:bm_shop_id" json:"bm_shop_id"` //舶茂的商家id
|
|
|
|
|
ThirdPartySkuId string `gorm:"column:third_party_sku_id" json:"thirdPartySkuId"` //第三方skuid
|
|
|
|
|
ThirdPartyType int `gorm:"column:third_party_type" json:"thirdPartySkuType"` //第三方类型
|
|
|
|
|
TMallPrice string `gorm:"column:tmall_price" json:"tmallPrice"`
|
|
|
|
|
TMallUrl string `gorm:"column:tmall_url" json:"tmallUrl"`
|
|
|
|
|
JdPrice string `gorm:"column:jd_price" json:"jdPrice"`
|
|
|
|
|
JdUrl string `gorm:"column:jd_url" json:"jdUrl"`
|
|
|
|
|
GysSkuID uint `gorm:"gys_sku_id" json:"gys_sku_id"`
|
|
|
|
|
Invoice RecookSkuInvoiceModel `gorm:"foreignKey:SkuId" json:"invoice"`
|
|
|
|
|
DetailPhoto []RecookGoodsDetailPhotoModel `gorm:"foreignKey:GoodsID;references:GoodsId"`
|
|
|
|
|
Goods RecookGoodsInfoModel `gorm:"foreignKey:GoodsId"`
|
|
|
|
|
SecKill flashsale.RecookSecKillGoodsModel `gorm:"foreignKey:Id;references:GoodsSkuId"`
|
|
|
|
|
SecKillTemp flashsale.RecookSecKillGoodsModelTemp `gorm:"foreignKey:Id;references:GoodsSkuId"`
|
|
|
|
|
Length float64 `json:"length"`
|
|
|
|
|
Width float64 `json:"width"`
|
|
|
|
|
Height float64 `json:"height"`
|
|
|
|
|
Weight float64 `json:"weight"`
|
|
|
|
|
Limit int `json:"limit" gorm:"column:limit_num"`
|
|
|
|
|
Min int `json:"min" gorm:"column:min_num"`
|
|
|
|
|
SaleInventory uint `json:"sale_inventory"`
|
|
|
|
|
GoodsInfo *RecookGoodsInfoModel `json:"-" gorm:"foreignKey:goods_id"`
|
|
|
|
|
SalePurchasePrice decimal.Decimal `json:"sale_purchase_price" gorm:"column:sale_purchase_price"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (r *RecookGoodsSkuModel) GetSalePrice(level int) decimal.Decimal {
|
|
|
|
|
if level == 10 {
|
|
|
|
|
return r.PurchasePrice.Mul(decimal.NewFromFloat(1.03)).Round(2)
|
|
|
|
|
return r.SalePurchasePrice.Mul(decimal.NewFromFloat(1.03)).Round(2)
|
|
|
|
|
}
|
|
|
|
|
s1 := r.PurchasePrice.Mul(decimal.NewFromFloat(1.03)).Round(2)
|
|
|
|
|
s1 = s1.Add(r.DiscountPrice.Sub(r.PurchasePrice).Mul(decimal.NewFromFloat(0.2)).Round(2))
|
|
|
|
|
s1 := r.SalePurchasePrice.Mul(decimal.NewFromFloat(1.03)).Round(2)
|
|
|
|
|
s1 = s1.Add(r.DiscountPrice.Sub(r.SalePurchasePrice).Mul(decimal.NewFromFloat(0.2)).Round(2))
|
|
|
|
|
return s1.Round(2)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|