修改 获取处方订单支付页详情 优惠卷数据
This commit is contained in:
parent
ab8db606ef
commit
6605000c91
@ -1212,6 +1212,10 @@ class PatientOrderService extends BaseService
|
||||
$payment_amount_total = 0.01;
|
||||
}
|
||||
|
||||
if ($payment_amount_total <= 0){
|
||||
return fail(HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
|
||||
// 确定支付渠道
|
||||
// 支付渠道(1:小程序支付 2:微信扫码支付)
|
||||
if ($client_type == 1) {
|
||||
@ -1580,7 +1584,10 @@ class PatientOrderService extends BaseService
|
||||
}
|
||||
|
||||
$amount_total = 0;
|
||||
$coupon_amount_total = 0;
|
||||
|
||||
// 优惠卷商品数据
|
||||
$coupon_product_datas = array();
|
||||
|
||||
foreach ($order_prescription_product as &$item) {
|
||||
$params = array();
|
||||
$params['product_id'] = $item['product_id'];
|
||||
@ -1600,7 +1607,25 @@ class PatientOrderService extends BaseService
|
||||
}
|
||||
}
|
||||
|
||||
$amount_total += $product['product_price'] * $item['prescription_product_num'];
|
||||
$amount_total = bcadd($amount_total,($product['product_price'] * $item['prescription_product_num']),2);
|
||||
|
||||
// 优惠卷商品数据
|
||||
$coupon_product_data = array();
|
||||
$product['product_num'] = $item['prescription_product_num'];
|
||||
$coupon_product_data = $product->toArray();
|
||||
$coupon_product_datas[] = $coupon_product_data;
|
||||
}
|
||||
|
||||
// 定义优惠卷金额默认值
|
||||
$coupon_amount_total = 0;
|
||||
|
||||
if (!empty($coupon_product_datas)) {
|
||||
// 获取患者购药可用的优惠卷
|
||||
$userCouponService = new UserCouponService();
|
||||
$user_coupons = $userCouponService->getUserProductUsableCoupon($user_info['user_id'], $coupon_product_datas);
|
||||
|
||||
// 获取可用优惠卷总金额
|
||||
$coupon_amount_total = $userCouponService->getCouponTotalPrice($user_coupons);
|
||||
}
|
||||
|
||||
// 获取运费金额
|
||||
@ -1613,11 +1638,10 @@ class PatientOrderService extends BaseService
|
||||
}
|
||||
}
|
||||
|
||||
// 实际支付金额
|
||||
// 实际支付金额=商品总金额-优惠卷金额+运费金额
|
||||
$payment_amount_total = bcadd(bcsub($amount_total , $coupon_amount_total,2), $logistics_fee, 2);
|
||||
if (env("APP_ENV") == "dev") {
|
||||
$payment_amount_total = 0.01;
|
||||
} else {
|
||||
$payment_amount_total = $amount_total + $logistics_fee;
|
||||
}
|
||||
|
||||
// 获取收货地址
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user