diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index 017347e..737696a 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -647,7 +647,19 @@ class PatientOrderService extends BaseService } // 处理优惠金额 - $order_product['discount_amount'] = $order_product['amount_total'] + $order_product['logistics_fee'] - $order_product['coupon_amount_total'] - $order_product['payment_amount_total']; // 优惠金额 + $order_product['discount_amount'] = bcsub( + bcsub( + bcadd( + $order_product['amount_total'], + $order_product['logistics_fee'] + ,2 + ), + $order_product['coupon_amount_total'], + 2 + ), + $order_product['payment_amount_total'], + 2 + ); // 优惠金额 $result = array(); @@ -922,7 +934,20 @@ class PatientOrderService extends BaseService $result['amount_total'] = $order_product['amount_total']; // 订单金额 $result['payment_amount_total'] = $order_product['payment_amount_total']; // 实际订单金额 $result['coupon_amount_total'] = $order_product['coupon_amount_total']; // 优惠金额 - $result['discount_amount'] = $order_product['amount_total'] - $order_product['coupon_amount_total'] + $order_product['logistics_fee'] - $order_product['payment_amount_total']; // 优惠金额 + $result['discount_amount'] = + bcsub( + bcadd( + bcsub( + $order_product['amount_total'], + $order_product['coupon_amount_total'], + 2 + ), + $order_product['logistics_fee'], + 2 + ), + $order_product['payment_amount_total'], + 2 + ); // 优惠金额 // 获取优惠卷不可用原因。存在优惠卷,但是未使用-暂时废弃 /*if ($order_product['coupon_amount_total'] == 0){ @@ -3500,6 +3525,14 @@ class PatientOrderService extends BaseService } } + foreach ($product_datas as &$product_data){ + $product_data["actual_product_price"] = bcdiv( + $product_data['actual_product_price'], + $product_data['actual_quantity'], + 2 + ); + } + return $product_datas; } } \ No newline at end of file diff --git a/app/Services/UserCouponService.php b/app/Services/UserCouponService.php index 9a74aea..754de13 100644 --- a/app/Services/UserCouponService.php +++ b/app/Services/UserCouponService.php @@ -84,11 +84,11 @@ class UserCouponService extends BaseService /** * 获取可用优惠卷总金额 * @param array $coupons 优惠卷数据 - * @return int + * @return string */ - public function getCouponTotalPrice(array $coupons): int + public function getCouponTotalPrice(array $coupons): string { - $coupon_total_price = 0; + $coupon_total_price = "0"; foreach ($coupons as $coupon){ $coupon_total_price = bcadd($coupon_total_price,$coupon['coupon_price'],2);