删除分类调价比例
This commit is contained in:
@@ -197,6 +197,10 @@ func StringList2Map(strList []string) map[string]int {
|
||||
return retVal
|
||||
}
|
||||
|
||||
func GetSliceLen(list interface{}) int {
|
||||
return reflect.ValueOf(list).Len()
|
||||
}
|
||||
|
||||
func RegularizeSkuQuality(specQuality float32, specUnit string) (g int) {
|
||||
lowerSpecUnit := strings.ToLower(specUnit)
|
||||
if lowerSpecUnit == "kg" || lowerSpecUnit == "l" {
|
||||
@@ -235,40 +239,28 @@ func CaculateUnitPrice(skuPrice int, specQuality float32, specUnit string, skuNa
|
||||
// } else if specQuality2 < 500 {
|
||||
// unitPrice = unitPrice * 100 / 105
|
||||
// }
|
||||
if unitPrice <= 0 {
|
||||
if unitPrice <= 1 {
|
||||
unitPrice = 1
|
||||
}
|
||||
return unitPrice
|
||||
}
|
||||
|
||||
func GetSliceLen(list interface{}) int {
|
||||
return reflect.ValueOf(list).Len()
|
||||
}
|
||||
|
||||
func CaculateSkuVendorPrice(price, percentage, catPercentage int) int {
|
||||
func CaculateSkuVendorPrice(price, percentage int) (vendorPrice int) {
|
||||
if percentage <= 10 || percentage >= 400 {
|
||||
percentage = 100
|
||||
}
|
||||
if catPercentage <= 10 || catPercentage >= 400 {
|
||||
catPercentage = 100
|
||||
}
|
||||
percentage = percentage * catPercentage / 100
|
||||
vendorPrice := int(math.Round(float64(price*percentage) / 100))
|
||||
vendorPrice = int(math.Round(float64(price*percentage) / 100))
|
||||
if vendorPrice < 0 {
|
||||
vendorPrice = 0
|
||||
}
|
||||
return vendorPrice
|
||||
}
|
||||
|
||||
func CaculateSkuPriceFromVendor(vendorPrice, percentage, catPercentage int) int {
|
||||
func CaculateSkuPriceFromVendor(vendorPrice, percentage int) (price int) {
|
||||
if percentage <= 10 || percentage >= 400 {
|
||||
percentage = 100
|
||||
}
|
||||
if catPercentage <= 10 || catPercentage >= 400 {
|
||||
catPercentage = 100
|
||||
}
|
||||
percentage = percentage * catPercentage / 100
|
||||
price := int(math.Round(float64(vendorPrice) * 100 / float64(percentage)))
|
||||
price = int(math.Round(float64(vendorPrice) * 100 / float64(percentage)))
|
||||
if price < 0 {
|
||||
price = 0
|
||||
}
|
||||
@@ -297,7 +289,7 @@ func GetPricePercentageByVendorPrice(l model.PricePercentagePack, vendorPrice in
|
||||
if len(l) > 0 {
|
||||
var lastItem *model.PricePercentageItem
|
||||
for _, v := range l {
|
||||
if CaculateSkuVendorPrice(v.BeginPrice, v.PricePercentage, 0) > vendorPrice {
|
||||
if CaculateSkuVendorPrice(v.BeginPrice, v.PricePercentage) > vendorPrice {
|
||||
break
|
||||
}
|
||||
lastItem = v
|
||||
|
||||
Reference in New Issue
Block a user