From 50c5e283814bd7426482200bcf23bfd9b2d8d76e Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Wed, 27 Sep 2023 16:51:29 +0800 Subject: [PATCH] fix --- server/product/internal/logic/getproductsteppricelogic.go | 6 ++++++ utils/format/number.go | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/server/product/internal/logic/getproductsteppricelogic.go b/server/product/internal/logic/getproductsteppricelogic.go index 9c8454ba..71bba318 100644 --- a/server/product/internal/logic/getproductsteppricelogic.go +++ b/server/product/internal/logic/getproductsteppricelogic.go @@ -126,6 +126,11 @@ func (l *GetProductStepPriceLogic) GetProductStepPrice(req *types.GetProductStep "item_price": format.CentitoDollar(rangeInfo.Price+fittingPrice, 3), }) } + //计算起购数量的单价 + _, minBuyUnitsQuantityPrice, err := l.svcCtx.Repositories.NewShoppingCart.CaculateStepPrice(stepPrice.MinBuyUnitsNum, stepPrice, fittingPrice) + if err != nil { + return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to get min buy quantity item price") + } mapRsp[fmt.Sprintf("_%d", *modelPriceInfo.SizeId)] = map[string]interface{}{ "step_purchase_quantity": stepPurchaseQuantity, "step_purchase_quantity_description": stepPurchaseQuantityDescription, @@ -133,6 +138,7 @@ func (l *GetProductStepPriceLogic) GetProductStepPrice(req *types.GetProductStep "max_price": maxPrice, "step_range": stepRange, "min_buy_units_quantity": stepPrice.MinBuyUnitsNum, + "min_buy_units_quantity_item_price": format.CentitoDollar(minBuyUnitsQuantityPrice, 3), } } return resp.SetStatusWithMessage(basic.CodeOK, "success", mapRsp) diff --git a/utils/format/number.go b/utils/format/number.go index dec25c3c..3782ac74 100644 --- a/utils/format/number.go +++ b/utils/format/number.go @@ -8,7 +8,6 @@ import ( // 数字变成带千分位的字符串 func NumToStringWithThousandthPercentile(numberStr string) string { - numberStr = strings.TrimLeft(numberStr, "0") //去掉左边开始的0 if _, err := strconv.ParseFloat(numberStr, 64); err != nil { logx.Error("is not a number") return ""