From 0a089aff4c865577a586078e727967832d08fe8e Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Thu, 18 Apr 2024 15:28:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=A4=84=E6=96=B9=E8=AE=A2=E5=8D=95=E6=94=AF=E4=BB=98=E9=A1=B5?= =?UTF-8?q?=E8=AF=A6=E6=83=85=20=E9=87=91=E9=A2=9D=E3=80=81=E4=BC=98?= =?UTF-8?q?=E6=83=A0=E5=8D=B7=E9=97=AE=E9=A2=981?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/OrderServicePackageService.php | 2 +- app/Services/PatientOrderService.php | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/app/Services/OrderServicePackageService.php b/app/Services/OrderServicePackageService.php index d32a49c..e4fd4e8 100644 --- a/app/Services/OrderServicePackageService.php +++ b/app/Services/OrderServicePackageService.php @@ -1268,7 +1268,7 @@ class OrderServicePackageService extends BaseService $remaining_quantity = 0; $params = array(); - $params['order_service_id'] = $$order_service_id; + $params['order_service_id'] = $order_service_id; $params['product_id'] = $product_id; $order_service_package_product = OrderServicePackageProduct::getOne($params); if (!empty($order_service_package_product)){ diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index e5727a0..3a37949 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -1751,7 +1751,8 @@ class PatientOrderService extends BaseService $order_prescription_id = $this->request->route('order_prescription_id'); $fields = [ - "order_prescription_id" + "order_prescription_id", + "order_inquiry_id" ]; $params = array(); @@ -1840,15 +1841,26 @@ class PatientOrderService extends BaseService // 处理商品数量 $OrderServicePackageService = new OrderServicePackageService(); + $amount_total = 0; foreach ($product_datas as &$product_data){ + // 获取服务包剩余药品数量 $remaining_quantity = $OrderServicePackageService->getOrderServiceProductRemainingQuantity($order_service_package_inquiry['order_service_id'],$product_data['product_id']); + // 可用数量大于处方商品数量,此情况把商品数量置为0 if ($remaining_quantity >= $product_data['product_num']){ $product_data['product_num'] = 0; } // 此处重新计算药品总金额 - $amount_total = bcadd($amount_total,($product_data['product_price'] * $product_data['product_num']),2); + $amount_total = bcadd( + $amount_total, + bcmul( + $product_data['product_price'], + $product_data['product_num'], + 2 + ), + 2 + ); } } @@ -1871,16 +1883,12 @@ 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; - } // 获取收货地址 $params = array(); $params['user_id'] = $user_info['user_id']; $user_ship_addresss = UserShipAddress::getList($params); - unset($item); foreach ($user_ship_addresss as $item) { if ($item['is_default'] == 1) { $user_ship_address = $item;