This commit is contained in:
wucongxing8150 2024-05-08 17:16:01 +08:00
parent a1fc3c3015
commit 0a169c4ce1

View File

@ -791,7 +791,8 @@ class PatientOrderService extends BaseService
$result = array();
$result['amount_total'] = 0; // 订单总额
$result['payment_amount_total'] = 0; // 实际订单金额
$result['coupon_amount_total'] = 0; // 优惠金额
$result['coupon_amount_total'] = 0; // 优惠卷金额
$result['discount_amount'] = 0; // 优惠金额
$result['order_no'] = $order_no; // 订单编号
$result['order_id'] = ""; // 订单主键id问诊订单order_inquiry_id 药品订单order_product_id
$result['created_at'] = ""; // 创建时间
@ -800,6 +801,7 @@ class PatientOrderService extends BaseService
$result['pay_config'] = []; // 小程序支付配置
$result['cannot_use_coupon_reason'] = ""; // 不可使用优惠卷原因
// 问诊订单
if ($order_type == 1) {
$params = array();
@ -852,13 +854,13 @@ class PatientOrderService extends BaseService
// 获取订单金额
$result['amount_total'] = $order_inquiry['amount_total']; // 订单金额
$result['payment_amount_total'] = $order_inquiry['payment_amount_total']; // 实际订单金额
$result['coupon_amount_total'] = $order_inquiry['coupon_amount_total'];; // 优惠金额
$result['coupon_amount_total'] = $order_inquiry['coupon_amount_total']; // 优惠卷金额
$result['discount_amount'] = 0; // 优惠金额
if ($order_inquiry['payment_amount_total'] > 0) {
// 发起支付
$WechatPay = new WechatPay(1, 1);
// 获取预支付交易会话标识
$prepay = $WechatPay->getJsapiPrepayId($order_no, (int)round($order_inquiry['payment_amount_total'] * 100), $user_info['open_id'], "问诊服务");
if (empty($prepay)) {
@ -921,6 +923,7 @@ 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['payment_amount_total']; // 优惠金额
// 获取优惠卷不可用原因。存在优惠卷,但是未使用-暂时废弃
/*if ($order_product['coupon_amount_total'] == 0){
@ -1033,6 +1036,7 @@ class PatientOrderService extends BaseService
$result['amount_total'] = $order_detection['amount_total']; // 订单金额
$result['payment_amount_total'] = $order_detection['amount_total'] - 0; // 实际订单金额
$result['coupon_amount_total'] = 0; // 优惠金额
$result['discount_amount'] = 0;
if ($order_detection['payment_amount_total'] > 0) {
// 发起支付
@ -1047,7 +1051,6 @@ class PatientOrderService extends BaseService
// 获取小程序支付配置
$pay_config = $WechatPay->getAppletsPayConfig($prepay['prepay_id']);
}
}
// 服务包订单
@ -1110,6 +1113,7 @@ class PatientOrderService extends BaseService
$result['amount_total'] = $order_service_package['amount_total']; // 订单金额
$result['payment_amount_total'] = $order_service_package['amount_total'] - 0; // 实际订单金额
$result['coupon_amount_total'] = 0; // 优惠金额
$result['discount_amount'] = 0;
// 检测是否存在同类型未完成的问诊订单
$PatientOrderService = new PatientOrderService();