Browse Source

fix:小数点位数显示

zqbao 6 months ago
parent
commit
cdeef9b86e
1 changed files with 1 additions and 2 deletions
  1. 1 2
      utils/common.go

+ 1 - 2
utils/common.go

@@ -2759,8 +2759,7 @@ func RoundNumber(num string, decimalPlaces int, hasPercent bool) string {
 	if hasPercent {
 		numDecimal = numDecimal.Mul(decimal.NewFromInt(100))
 	}
-	numFloat, _ := numDecimal.Round(int32(decimalPlaces)).Float64()
-	numStr := strconv.FormatFloat(numFloat, 'f', decimalPlaces, 64)
+	numStr := numDecimal.Round(int32(decimalPlaces)).StringFixed(int32(decimalPlaces))
 	if hasPercent {
 		numStr += "%"
 	}