wesmiler 3 лет назад
Родитель
Сommit
9763e349b5
1 измененных файлов с 5 добавлено и 5 удалено
  1. 5 5
      source/application/api/service/order/Checkout.php

+ 5 - 5
source/application/api/service/order/Checkout.php

@@ -477,19 +477,19 @@ class Checkout
             // 商品单独设置了会员折扣
             if ($goods['is_alone_grade'] && isset($goods['alone_grade_equity'][$this->user['grade_id']])) {
                 // 折扣比例
-                $discountRatio = helper::bcdiv($goods['alone_grade_equity'][$this->user['grade_id']], 10);
+                $discountRatio = helper::bcdiv($goods['alone_grade_equity'][$this->user['grade_id']], 10,6);
             } else {
                 // 折扣比例
-                $discountRatio = helper::bcdiv($this->user['grade']['equity']['discount'], 10);
+                $discountRatio = helper::bcdiv($this->user['grade']['equity']['discount'], 10,6);
             }
             if ($discountRatio > 0) {
                 // 会员折扣后的商品总金额
-                $gradeTotalPrice = max(0.01, helper::bcmul($goods['total_price'], $discountRatio));
+                $gradeTotalPrice = max(0.01, helper::bcmul($goods['total_price'], $discountRatio,6));
                 helper::setDataAttribute($goods, [
                     'is_user_grade' => true,
                     'grade_ratio' => $discountRatio,
-                    'grade_goods_price' => helper::number2(helper::bcmul($goods['goods_price'], $discountRatio), true),
-                    'grade_total_money' => helper::number2(helper::bcsub($goods['total_price'], $gradeTotalPrice)),
+                    'grade_goods_price' => helper::number2(helper::bcmul($goods['goods_price'], $discountRatio,6), true),
+                    'grade_total_money' => helper::number2(helper::bcsub($goods['total_price'], $gradeTotalPrice,6)),
                     'total_price' => $gradeTotalPrice,
                 ], false);
             }