fix: extra_price

master
howell 3 years ago
parent 6c2f865ea7
commit 1fc1a8ec52

@ -233,8 +233,10 @@ func GetGoodsRespByInfoList(goodsList []goods.Information, userID uint, isSale b
"MIN(original_price) AS original_price, "+
"MIN(discount_price) AS discount_price, "+
"MIN(commission) AS commission,"+
"MIN(coupon) AS coupon,"+
"MIN(sale_purchase_price) AS sale_purchase_price").
"MIN(coupon) AS coupon, "+
"MIN(sale_purchase_price) AS sale_purchase_price, "+
"MIN(extra_price) AS extra_price, "+
"MIN(sale_extra_price) AS sale_extra_price").
Group("goods_id").
Where("goods_id in (?)", ids).
Find(&sku)

@ -1322,10 +1322,22 @@ func (g *goodsLogic) SkuUpdate(args *strict.ArgsSkuUpdate) error {
skuObj.Commission = item.DiscountPrice.Mul(item.CommissionRate).Truncate(2)
skuObj.SalesVolumeInc = item.SaleVolInc
skuObj.Inventory = item.Inventory
patch := make(map[string]interface{})
if item.ExtraPrice != nil {
patch["extra_price"] = item.ExtraPrice
}
if item.SaleExtraPrice != nil {
patch["sale_extra_price"] = item.SaleExtraPrice
}
if err := tx.Save(&skuObj).Error; err != nil {
return err
}
if len(patch) != 0 {
if err := tx.Model(&skuObj).Updates(patch).Error; err != nil {
return err
}
}
total += item.SaleVolInc
if skuObj.GysSkuID != 0 {

@ -10,12 +10,14 @@ type ArgsSkuUpdate struct {
}
type SkuPrice struct {
DiscountPrice decimal.Decimal `json:"discount_price"`
Coupon decimal.Decimal `json:"coupon"`
CommissionRate decimal.Decimal `json:"commission_rate"`
SkuID uint `json:"sku_id"`
SaleVolInc uint `json:"sale_vol_inc"`
Inventory uint `json:"inventory"`
PlatformRate decimal.Decimal `json:"platform_rate"`
DeductionRate decimal.Decimal `json:"deduction_rate"`
DiscountPrice decimal.Decimal `json:"discount_price"`
Coupon decimal.Decimal `json:"coupon"`
CommissionRate decimal.Decimal `json:"commission_rate"`
SkuID uint `json:"sku_id"`
SaleVolInc uint `json:"sale_vol_inc"`
Inventory uint `json:"inventory"`
PlatformRate decimal.Decimal `json:"platform_rate"`
DeductionRate decimal.Decimal `json:"deduction_rate"`
ExtraPrice *decimal.Decimal `json:"extra_price"`
SaleExtraPrice *decimal.Decimal `json:"extra_extra_price"`
}

@ -56,6 +56,8 @@ type RecookGoodsSkuModel struct {
SaleVolumeInc2 uint `json:"sale_volume_inc2" gorm:"column:sale_volume_inc2"`
EffectTime int `json:"effect_time"`
EffectDayType int `json:"effect_day_type"`
ExtraPrice decimal.Decimal `json:"extra_price"`
SaleExtraPrice decimal.Decimal `json:"sale_extra_price"`
}
func (r *RecookGoodsSkuModel) GetSalePrice(level int) decimal.Decimal {

Loading…
Cancel
Save