Browse Source

修复商品卡片销量可能会出现余数的问题

Signed-off-by: DH <ji534@outlook.com>
DH 1 year ago
parent
commit
829bea3861
1 changed files with 1 additions and 1 deletions
  1. 1 1
      sheep/hooks/useGoods.js

+ 1 - 1
sheep/hooks/useGoods.js

@@ -56,7 +56,7 @@ export function formatNum(prefix, type, num) {
   // 例如:100  - 199  显示为 100+
   // 例如:100  - 199  显示为 100+
   //      9000 - 9999 显示为 9000+
   //      9000 - 9999 显示为 9000+
   let pow = Math.pow(10, `${num}`.length - 1);
   let pow = Math.pow(10, `${num}`.length - 1);
-  return `${prefix}${(num / pow) * pow}+`;
+  return `${prefix}${Math.round((num / pow) * pow)}+`;
 }
 }
 
 
 // 格式化价格
 // 格式化价格