|
@ -6,8 +6,9 @@ package ordercalc |
|
|
|
|
|
|
|
|
import ( |
|
|
import ( |
|
|
"errors" |
|
|
"errors" |
|
|
|
|
|
|
|
|
"strings" |
|
|
"strings" |
|
|
|
|
|
|
|
|
|
|
|
"git.tetele.net/tgo/helper" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -22,7 +23,7 @@ import ( |
|
|
*/ |
|
|
*/ |
|
|
func DistributionPrice(business map[string]string, productSpecialPrice []map[string]string, distributionPrice interface{}, percentAge interface{}, productPrice interface{}) (float64, error) { |
|
|
func DistributionPrice(business map[string]string, productSpecialPrice []map[string]string, distributionPrice interface{}, percentAge interface{}, productPrice interface{}) (float64, error) { |
|
|
|
|
|
|
|
|
product_price := ToString(productPrice) |
|
|
|
|
|
|
|
|
product_price := helper.ToString(productPrice) |
|
|
|
|
|
|
|
|
if len(business) < 1 { |
|
|
if len(business) < 1 { |
|
|
return 0, errors.New("参数错误") |
|
|
return 0, errors.New("参数错误") |
|
@ -34,13 +35,13 @@ func DistributionPrice(business map[string]string, productSpecialPrice []map[str |
|
|
return 0, errors.New("分销商参数错误") |
|
|
return 0, errors.New("分销商参数错误") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
distribution_price := ToString(distributionPrice) |
|
|
|
|
|
|
|
|
distribution_price := helper.ToString(distributionPrice) |
|
|
distribution_price_float, err := ToFloat64(distributionPrice) |
|
|
distribution_price_float, err := ToFloat64(distributionPrice) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return 0, err |
|
|
return 0, err |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
percent_age := ToString(percentAge) |
|
|
|
|
|
|
|
|
percent_age := helper.ToString(percentAge) |
|
|
|
|
|
|
|
|
if len(productSpecialPrice) < 1 && percent_age == "" { |
|
|
if len(productSpecialPrice) < 1 && percent_age == "" { |
|
|
return distribution_price_float, nil //没有特殊价格,没有分销比例,返回原分销价
|
|
|
return distribution_price_float, nil //没有特殊价格,没有分销比例,返回原分销价
|
|
@ -179,7 +180,7 @@ func DistributionPrice(business map[string]string, productSpecialPrice []map[str |
|
|
*/ |
|
|
*/ |
|
|
func VipPrice(productSpecialPrice []map[string]string, productPrice interface{}) (float64, error) { |
|
|
func VipPrice(productSpecialPrice []map[string]string, productPrice interface{}) (float64, error) { |
|
|
|
|
|
|
|
|
product_price := ToString(productPrice) |
|
|
|
|
|
|
|
|
product_price := helper.ToString(productPrice) |
|
|
|
|
|
|
|
|
product_price_float, _ := ToFloat64(productPrice) |
|
|
product_price_float, _ := ToFloat64(productPrice) |
|
|
|
|
|
|
|
|