Parcourir la source

折扣的计算

zhuliu il y a 1 an
Parent
commit
3976e45d29
1 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 2 2
      myComponents/pay/pay.js

+ 2 - 2
myComponents/pay/pay.js

@@ -54,8 +54,8 @@ Component({
       if (typeof decimal !== 'number' || isNaN(decimal) || decimal <= 0 || decimal >= 1) {  
         return '' 
       }  
-      // 将小数乘以10,四舍五入到最近的整数,并转换为字符串  
-      var discount = Math.round(decimal * 10);  
+      // 将小数乘以10,并转换为字符串  
+      var discount = Decimal.mul([decimal,10]);  
       // 添加"折"字作为单位  
       return discount + '折';  
     },