Explorar el Código

fix: 优惠券满折价格计算精度问题

cuiyalong hace 3 años
padre
commit
8758c7f151
Se han modificado 1 ficheros con 3 adiciones y 3 borrados
  1. 3 3
      src/views/public/Buy.vue

+ 3 - 3
src/views/public/Buy.vue

@@ -325,7 +325,7 @@ export default {
       this.orderType = type || 0
 
       const { titleText, descType, specLabel, priceQuery, specList } = this.confMap
-      
+
       this.priceQuery = priceQuery[this.orderType]
       this.specList = specList[this.orderType]
       this.buySpecLabel = specLabel[this.orderType]
@@ -420,10 +420,10 @@ export default {
         pay_price: this.specActiveItem.price * 100
       }
       if (this.couponActiveItem?.disCount) {
-        tempPrice.pay_price = tempPrice.original_price - Math.floor(tempPrice.original_price * (1 - this.couponActiveItem.disCount / 10))
+        tempPrice.pay_price = tempPrice.original_price - (tempPrice.original_price * (1 - this.couponActiveItem.disCount / 10)).fixed(2)
       }
       if (this.couponActiveItem?.reduce) {
-        tempPrice.pay_price = Math.floor(tempPrice.original_price - this.couponActiveItem.reduce * 100)
+        tempPrice.pay_price = (tempPrice.original_price - this.couponActiveItem.reduce * 100).fixed(2)
       }
       this.computedPrice.total = tempPrice.original_price
       this.computedPrice.pay = tempPrice.pay_price