修改 获取处方订单支付页详情 金额、优惠卷问题
This commit is contained in:
@@ -1256,4 +1256,28 @@ class OrderServicePackageService extends BaseService
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取服务包剩余药品数量
|
||||
* @param string|int $order_service_id
|
||||
* @param string|int $product_id
|
||||
* @return int
|
||||
*/
|
||||
public function getOrderServiceProductRemainingQuantity(string|int $order_service_id,string|int $product_id): int
|
||||
{
|
||||
$remaining_quantity = 0;
|
||||
|
||||
$params = array();
|
||||
$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)){
|
||||
$remaining_quantity = $order_service_package_product['quantity'] - $order_service_package_product['used_quantity'];
|
||||
if ($remaining_quantity < 0){
|
||||
$remaining_quantity = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return $remaining_quantity;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user