CaculateJxPriceByPricePack
This commit is contained in:
@@ -253,7 +253,7 @@ func CaculateUnitPrice(skuPrice int, specQuality float32, specUnit string, skuNa
|
||||
}
|
||||
|
||||
func ConstrainPricePercentage(percentage int) int {
|
||||
if percentage <= model.MinVendorPricePercentage || percentage >= model.MaxVendorPricePercentage {
|
||||
if percentage < model.MinVendorPricePercentage || percentage > model.MaxVendorPricePercentage {
|
||||
percentage = model.DefVendorPricePercentage
|
||||
}
|
||||
return percentage
|
||||
@@ -271,8 +271,8 @@ func CaculateSkuVendorPrice(price, percentage, priceAdd int) (vendorPrice int) {
|
||||
func CaculateSkuPriceFromVendor(vendorPrice, percentage, priceAdd int) (price int) {
|
||||
percentage = ConstrainPricePercentage(percentage)
|
||||
price = int(math.Round(float64(vendorPrice-priceAdd) * 100 / float64(percentage)))
|
||||
if price < 0 {
|
||||
price = 0
|
||||
if price < 1 {
|
||||
price = 1
|
||||
}
|
||||
return price
|
||||
}
|
||||
@@ -330,6 +330,12 @@ func CaculatePriceByPricePack(l model.PricePercentagePack, defPricePercentage, p
|
||||
return CaculateSkuVendorPrice(price, pricePercentage, priceAdd)
|
||||
}
|
||||
|
||||
func CaculateJxPriceByPricePack(l model.PricePercentagePack, defPricePercentage, vendorPrice int) (jxPrice int) {
|
||||
pricePercentage, priceAdd := GetPricePercentageByVendorPrice(l, vendorPrice, defPricePercentage)
|
||||
jxPrice = CaculateSkuPriceFromVendor(vendorPrice, pricePercentage, priceAdd)
|
||||
return jxPrice
|
||||
}
|
||||
|
||||
func ConstrainPayPercentage(payPerCentage int) int {
|
||||
if payPerCentage <= 50 {
|
||||
payPerCentage = 70
|
||||
|
||||
Reference in New Issue
Block a user