fix
This commit is contained in:
parent
9e2526405f
commit
b6d4d06c25
|
@ -91,13 +91,17 @@ func (l *GetProductStepPriceLogic) GetProductStepPrice(req *types.GetProductStep
|
|||
stepPurchaseQuantity := *modelPriceInfo.PackedUnit
|
||||
//购买数步进基数描述
|
||||
stepPurchaseQuantityDescription := "主体装箱数为步进基数"
|
||||
//配件价格
|
||||
fittingPrice := int64(0)
|
||||
if *modelPriceInfo.PartId > 0 {
|
||||
fittingPriceInfo, ok := mapFitting[*modelPriceInfo.PartId]
|
||||
if !ok {
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, fmt.Sprintf("fitting price is not exists:%d", *modelPriceInfo.PartId))
|
||||
}
|
||||
//最小价格要加配件
|
||||
minPrice += *fittingPriceInfo.Price
|
||||
//最小/最大价格要加配件
|
||||
fittingPrice = *fittingPriceInfo.Price
|
||||
minPrice += fittingPrice
|
||||
maxPrice += fittingPrice
|
||||
//如果配件装箱基数比主体大,则基数以配件为主
|
||||
if *fittingPriceInfo.PackedUnit > stepPurchaseQuantity {
|
||||
stepPurchaseQuantity = *fittingPriceInfo.PackedUnit
|
||||
|
@ -111,7 +115,7 @@ func (l *GetProductStepPriceLogic) GetProductStepPrice(req *types.GetProductStep
|
|||
begin := format.NumToStringWithThousandthPercentile(fmt.Sprintf("%d", rangeInfo.StartQuantity))
|
||||
stepRange = append(stepRange, map[string]interface{}{
|
||||
"range_description": fmt.Sprintf(">=%s Units", begin),
|
||||
"item_price": format.CentitoDollar(rangeInfo.Price, 3),
|
||||
"item_price": format.CentitoDollar(rangeInfo.Price+fittingPrice, 3),
|
||||
})
|
||||
break
|
||||
}
|
||||
|
@ -119,7 +123,7 @@ func (l *GetProductStepPriceLogic) GetProductStepPrice(req *types.GetProductStep
|
|||
end := format.NumToStringWithThousandthPercentile(fmt.Sprintf("%d", rangeInfo.EndQuantity))
|
||||
stepRange = append(stepRange, map[string]interface{}{
|
||||
"range_description": fmt.Sprintf("%s-%s Units", begin, end),
|
||||
"item_price": format.CentitoDollar(rangeInfo.Price, 3),
|
||||
"item_price": format.CentitoDollar(rangeInfo.Price+fittingPrice, 3),
|
||||
})
|
||||
}
|
||||
mapRsp[fmt.Sprintf("_%d", *modelPriceInfo.SizeId)] = map[string]interface{}{
|
||||
|
|
|
@ -8,11 +8,12 @@ import (
|
|||
|
||||
// 数字变成带千分位的字符串
|
||||
func NumToStringWithThousandthPercentile(numberStr string) string {
|
||||
numberStr = strings.TrimLeft(numberStr, "0") //去掉左边开始的0
|
||||
if _, err := strconv.ParseFloat(numberStr, 64); err != nil {
|
||||
log.Fatalln("is not a number")
|
||||
return ""
|
||||
}
|
||||
sliceList := strings.Split(numberStr, ".")
|
||||
sliceList := strings.Split(numberStr, ".") //切分开小数
|
||||
s := sliceList[0]
|
||||
f := ""
|
||||
if len(sliceList) == 2 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user