已使用商品数量
This commit is contained in:
parent
f83580508a
commit
df935b6c82
@ -16,9 +16,10 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property int $product_id 商品id
|
||||
* @property string $product_name 商品名称
|
||||
* @property int $quantity 商品数量
|
||||
* @property int $used_quantity 已使用数量
|
||||
* @property string $discount_product_price 折扣商品价格
|
||||
* @property Carbon $created_at 创建时间
|
||||
* @property Carbon $updated_at 修改时间
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class OrderServicePackageProduct extends Model
|
||||
{
|
||||
@ -32,7 +33,7 @@ class OrderServicePackageProduct extends Model
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['service_product_id', 'order_service_id', 'product_id', 'product_name', 'quantity', 'discount_product_price', 'created_at', 'updated_at'];
|
||||
protected array $fillable = ['service_product_id', 'order_service_id', 'product_id', 'product_name', 'quantity', 'used_quantity', 'discount_product_price', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "service_product_id";
|
||||
|
||||
|
||||
@ -1002,6 +1002,11 @@ class InquiryService extends BaseService
|
||||
|
||||
}
|
||||
|
||||
// 获取服务包当月剩余次数
|
||||
|
||||
// 获取服务包到期天数
|
||||
|
||||
|
||||
$result = array();
|
||||
$result['doctor_user_id'] = $user_doctor['user_id'];
|
||||
$result['patient_user_id'] = $order_inquiry['user_id'];
|
||||
|
||||
@ -2887,30 +2887,28 @@ class PatientOrderService extends BaseService
|
||||
$result['order_product'] = $order_products->toArray();
|
||||
}
|
||||
|
||||
// 已使用商品数量
|
||||
$used_quantity = 0;
|
||||
foreach ($order_products as $order_product){
|
||||
// 获取详情item
|
||||
$params = array();
|
||||
$params['order_product_id'] = $order_product['order_product_id'];
|
||||
$order_product_items = OrderProductItem::getList($params);
|
||||
if (empty($order_product_items)){
|
||||
return fail(HttpEnumCode::SERVER_ERROR);
|
||||
// // 已使用商品数量
|
||||
// $used_quantity = 0;
|
||||
// foreach ($order_products as $order_product){
|
||||
// // 获取详情item
|
||||
// $params = array();
|
||||
// $params['order_product_id'] = $order_product['order_product_id'];
|
||||
// $order_product_items = OrderProductItem::getList($params);
|
||||
// if (empty($order_product_items)){
|
||||
// return fail(HttpEnumCode::SERVER_ERROR);
|
||||
// }
|
||||
//
|
||||
// foreach ($order_product_items as $order_product_item){
|
||||
// $used_quantity = $order_product_item["amount"];
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if ($used_quantity > 30){
|
||||
// $used_quantity = 30;
|
||||
// }
|
||||
//
|
||||
// $result['order_service_package_product'][0]['remaining_quantity'] = $used_quantity;
|
||||
}
|
||||
|
||||
foreach ($order_product_items as $order_product_item){
|
||||
$used_quantity = $order_product_item["amount"];
|
||||
}
|
||||
}
|
||||
|
||||
if ($used_quantity > 30){
|
||||
$used_quantity = 30;
|
||||
}
|
||||
|
||||
$result['order_service_package_product']['used_quantity'] = $used_quantity;
|
||||
}
|
||||
|
||||
// 获取药品剩余数量
|
||||
}
|
||||
|
||||
return success($result);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user