- SkuCategory下添加调价比例:JdPricePercentage,EbaiPricePercentage,MtwmPricePercentage

This commit is contained in:
gazebo
2019-05-15 16:02:23 +08:00
parent 5c436326bf
commit a3aabcf8a8
8 changed files with 55 additions and 18 deletions

View File

@@ -177,7 +177,14 @@ func GetSliceLen(list interface{}) int {
return reflect.ValueOf(list).Len()
}
func CaculateSkuVendorPrice(price int, percentage int) int {
func CaculateSkuVendorPrice(price, percentage, catPercentage int) int {
if percentage <= 10 || percentage >= 400 {
percentage = 100
}
if catPercentage <= 10 || catPercentage >= 400 {
catPercentage = 100
}
percentage = percentage * catPercentage / 100
storePrice := int(math.Round(float64(price*percentage) / 100))
if storePrice < 0 {
storePrice = 0