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;