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

+ 7 - 10
source/application/api/service/order/Checkout.php

@@ -429,10 +429,10 @@ class Checkout
         // 商品总价 - 优惠抵扣
         foreach ($this->goodsList as &$goods) {
             // 减去优惠券抵扣金额
-            $value = helper::bcsub($goods['total_price'], $goods['coupon_money'],6);
+            $value = helper::bcsub($goods['total_price'], $goods['coupon_money'],8);
             // 减去积分抵扣金额
             if ($this->orderData['is_allow_points'] && $this->orderData['is_use_points']) {
-                $value = helper::bcsub($value, $goods['points_money'],6);
+                $value = helper::bcsub($value, $goods['points_money'],8);
             }
             $goods['total_pay_price'] = helper::number2($value);
         }
@@ -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,6);
+                $discountRatio = helper::bcdiv($goods['alone_grade_equity'][$this->user['grade_id']], 10,8);
             } else {
                 // 折扣比例
-                $discountRatio = helper::bcdiv($this->user['grade']['equity']['discount'], 10,6);
+                $discountRatio = helper::bcdiv($this->user['grade']['equity']['discount'], 10,8);
             }
             if ($discountRatio > 0) {
                 // 会员折扣后的商品总金额
-                $gradeTotalPrice = max(0.01, helper::bcmul($goods['total_price'], $discountRatio,6));
+                $gradeTotalPrice = max(0.01, helper::bcmul($goods['total_price'], $discountRatio,2));
                 helper::setDataAttribute($goods, [
                     'is_user_grade' => true,
                     'grade_ratio' => $discountRatio,
-                    '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)),
+                    'grade_goods_price' => helper::number2(helper::bcmul($goods['goods_price'], $discountRatio,2), true),
+                    'grade_total_money' => helper::number2(helper::bcsub($goods['total_price'], $gradeTotalPrice,2)),
                     'total_price' => $gradeTotalPrice,
                 ], false);
             }
@@ -620,9 +620,6 @@ class Checkout
                 $grade = $grade?$grade->toArray() : [];
                 $upgrade = isset($grade['upgrade']) && !is_array($grade['upgrade'])? json_decode($grade['upgrade'], true)  : [];
                 $upgradeMoney = isset($upgrade['expend_money'])?$upgrade['expend_money'] : 0;
-                var_dump($upgrade);
-                var_dump($upgradeMoney);
-                var_dump($grade);
                 if($upgradeMoney>=$this->model['total_price']){
                     $this->error = '当前级别不能购买低级别套餐';
                     return false;