Merge branch 'dev'
Some checks failed
Build Docker / build (push) Has been cancelled

This commit is contained in:
wucongxing8150 2025-02-20 16:47:12 +08:00
commit ad9e345eb3
2 changed files with 38 additions and 5 deletions

View File

@ -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(); $result = array();
@ -922,7 +934,20 @@ class PatientOrderService extends BaseService
$result['amount_total'] = $order_product['amount_total']; // 订单金额 $result['amount_total'] = $order_product['amount_total']; // 订单金额
$result['payment_amount_total'] = $order_product['payment_amount_total']; // 实际订单金额 $result['payment_amount_total'] = $order_product['payment_amount_total']; // 实际订单金额
$result['coupon_amount_total'] = $order_product['coupon_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){ /*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; return $product_datas;
} }
} }

View File

@ -84,11 +84,11 @@ class UserCouponService extends BaseService
/** /**
* 获取可用优惠卷总金额 * 获取可用优惠卷总金额
* @param array $coupons 优惠卷数据 * @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){ foreach ($coupons as $coupon){
$coupon_total_price = bcadd($coupon_total_price,$coupon['coupon_price'],2); $coupon_total_price = bcadd($coupon_total_price,$coupon['coupon_price'],2);