平台价保留到毛,活动价不变

This commit is contained in:
苏尹岚
2020-02-19 16:46:01 +08:00
parent 798fdae0b3
commit 34903a3cd1
2 changed files with 12 additions and 2 deletions

View File

@@ -253,7 +253,7 @@ func ActStoreSkuParam2Model(ctx *jxcontext.Context, db *dao.DaoDB, act *model.Ac
if v.PricePercentage != 0 {
percentage = v.PricePercentage
}
actSkuMap.ActualActPrice = int64(jxutils.CaculateSkuVendorPrice(int(actSkuMap.VendorPrice), percentage, 0))
actSkuMap.ActualActPrice = int64(jxutils.CaculateSkuActVendorPrice(int(actSkuMap.VendorPrice), percentage, 0))
if actSkuMap.ActualActPrice > 10 {
actSkuMap.ActualActPrice = int64(math.Floor(float64(actSkuMap.ActualActPrice)/10) * 10)
}
@@ -596,7 +596,7 @@ func CreateAct(ctx *jxcontext.Context, act *model.Act, vendorIDs []int, vendorOr
_, err = SyncAct(ctx, task, actID, nil, false)
return retVal, err
}, neeSyncActIDs)
tasksch.HandleTask(task, nil, true).Run()
if !isAsync {
hint = utils.Int2Str(act.ID)

View File

@@ -259,9 +259,19 @@ func ConstrainPricePercentage(percentage int) int {
return percentage
}
func CaculateSkuActVendorPrice(price, percentage, priceAdd int) (vendorPrice int) {
percentage = ConstrainPricePercentage(percentage)
vendorPrice = int(math.Round(float64(price*percentage)/100)) + priceAdd
if vendorPrice < 1 {
vendorPrice = 1
}
return vendorPrice
}
func CaculateSkuVendorPrice(price, percentage, priceAdd int) (vendorPrice int) {
percentage = ConstrainPricePercentage(percentage)
vendorPrice = int(math.Round(float64(price*percentage)/100)) + priceAdd
vendorPrice = int(math.Ceil(float64(vendorPrice)/10) * 10)
if vendorPrice < 1 {
vendorPrice = 1
}