diff --git a/business/jxstore/act/act.go b/business/jxstore/act/act.go index 1e2253b9b..4aec86064 100644 --- a/business/jxstore/act/act.go +++ b/business/jxstore/act/act.go @@ -1587,6 +1587,27 @@ func ChangeJxPriceByDiscountAct(ctx *jxcontext.Context) { } } else { //第二档时间内 pricePercentage = 0.1 + actualPricePercentage = float64(actStoreSku.OriginalPrice) * (float64(1) - pricePercentage) + //判断活动的折扣类型是最低价还是最低折扣 + if act.DiscountType == model.ActDiscountTypePrice { + minJxPrice = int64(act.DiscountValue2) + } else if act.DiscountType == model.ActDiscountTypePercentage { + minJxPrice = actStoreSku.OriginalPrice * int64(act.DiscountValue2) / 100 + } + if storeSku.JxPrice == int(minJxPrice) { + actStoreSku.TrendType = model.TrendTypeNothing + } else { + actStoreSku.TrendType = model.TrendTypeDown + } + if _, err = dao.UpdateEntity(db, actStoreSku, "TrendType"); err != nil { + dao.Rollback(db) + } + if utils.Float64TwoInt64(float64(storeSku.JxPrice)*actualPricePercentage) <= minJxPrice { + storeSku.JxPrice = int(minJxPrice) + } + if _, err = dao.UpdateEntity(db, storeSku, "JxPrice"); err != nil { + dao.Rollback(db) + } } dao.Commit(db) }