|
|
|
|
@ -124,4 +124,65 @@ select combo_id as c_id,count(*) as count from orders where status in(2,4) group
|
|
|
|
|
return \Yz::Return(true,"查询成功",['type'=>$type,'crowd'=>$crowd]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取购买详情内容(详情页信息)
|
|
|
|
|
public function BuyInfo()
|
|
|
|
|
{
|
|
|
|
|
$hospital_id =request('hospital');
|
|
|
|
|
$combo_id =request('combo_id'); //购买的套餐id
|
|
|
|
|
$item_ids =request('item_ids'); //自选项目ids
|
|
|
|
|
$group_id =request('group_id'); //团检登记id
|
|
|
|
|
if(!isset($hospital_id)) return \Yz::echoError1("医院id不能为空");
|
|
|
|
|
$hospital=DB::table('hospitals')->where(['id'=>1,'status'=>1,'is_del'=>0])->first();
|
|
|
|
|
$combo_info=[];//套餐信息
|
|
|
|
|
if(isset($combo_id)){
|
|
|
|
|
$combo=DB::table('combos')->where(['hospital_id'=>$hospital_id,'combo_id'=>$combo_id,'status'=>1])->first();
|
|
|
|
|
if(!$combo) return \Yz::echoError1("套餐不存在");
|
|
|
|
|
$combo_info['price']=$combo->price;
|
|
|
|
|
$combo_info['original_price']=$combo->original_price;
|
|
|
|
|
$combo_items=json_decode($combo->items,true);
|
|
|
|
|
$groupedData = [];
|
|
|
|
|
foreach ($combo_items as $item){
|
|
|
|
|
$keshiName = $item['keshi_name'];
|
|
|
|
|
if (!isset($groupedData[$keshiName])) {
|
|
|
|
|
$groupedData[$keshiName] = [];
|
|
|
|
|
}
|
|
|
|
|
$groupedData[$keshiName][] = $item;
|
|
|
|
|
}
|
|
|
|
|
foreach ($groupedData as $keshiName => $children) {
|
|
|
|
|
$combo_info['items'][] = [
|
|
|
|
|
'keshi_name' => $keshiName,
|
|
|
|
|
'children' => $children
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
$items_info=[];//自选项目信息
|
|
|
|
|
if(isset($item_ids) and !empty($item_ids)){
|
|
|
|
|
$price=0;
|
|
|
|
|
$items=DB::table('items')->whereIn('item_id',$item_ids)->where(['status'=>1])->get();
|
|
|
|
|
$groupedData = [];
|
|
|
|
|
foreach ($items as $item){
|
|
|
|
|
$price=$price+$item->price;
|
|
|
|
|
$keshiName = $item->keshi_name;
|
|
|
|
|
if (!isset($groupedData[$keshiName])) {
|
|
|
|
|
$groupedData[$keshiName] = [];
|
|
|
|
|
}
|
|
|
|
|
$groupedData[$keshiName][] = ['desc'=>$item->jianjie,'name'=>$item->name];
|
|
|
|
|
}
|
|
|
|
|
$items_info['price']=$price;
|
|
|
|
|
foreach ($groupedData as $keshiName => $children) {
|
|
|
|
|
$items_info['items'][] = [
|
|
|
|
|
'keshi_name' => $keshiName,
|
|
|
|
|
'children' => $children
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
$data=[
|
|
|
|
|
'combo_info'=>$combo_info,
|
|
|
|
|
'items_info'=>$items_info
|
|
|
|
|
];
|
|
|
|
|
return \Yz::Return(true,"查询成功",$data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|