修改创建问诊订单 优惠卷部分

This commit is contained in:
2023-11-08 14:11:13 +08:00
parent f333fd2722
commit d7a4d9ab4a
3 changed files with 101 additions and 44 deletions
+9 -4
View File
@@ -150,14 +150,20 @@ class InquiryService extends BaseService
return fail(HttpEnumCode::HTTP_ERROR, "当前非医生接诊时间");
}
// 定义优惠卷金额默认值
$coupon_amount_total = 0;
// 获取问诊价格
$DoctorInquiryService = new DoctorInquiryService();
$inquiry_price = $DoctorInquiryService->getDoctorInquiryPrice($request_params['inquiry_type'], $request_params['inquiry_mode'], $request_params['doctor_id'] ?: "");
if ($inquiry_price > 0) {
// 获取用户可用优惠卷
// 获取患者问诊可用优惠卷
$userCouponService = new UserCouponService();
$user_coupon = $userCouponService->getUserUsableCouponOne($user_info['user_id'], $request_params['inquiry_type']);
$user_coupon = $userCouponService->getUserInquiryUsableCoupon($user_info['user_id'], $request_params['inquiry_type']);
// 获取可用优惠卷总金额
$coupon_amount_total = $userCouponService->getCouponTotalPrice($user_coupon);
}
// 确定支付渠道
@@ -174,8 +180,7 @@ class InquiryService extends BaseService
try {
// 实际付款金额
$coupon_amount_total = $user_coupon['coupon']['coupon_price'] ?? 0;
$payment_amount_total = $inquiry_price - $coupon_amount_total;
$payment_amount_total = bcsub($inquiry_price , $coupon_amount_total,2);
if ($payment_amount_total < 0) {
$payment_amount_total = 0;
}