|
|
|
@ -71,6 +71,11 @@ class OrderController extends Controller
|
|
|
|
$type = request('type');//1个检2团检
|
|
|
|
$type = request('type');//1个检2团检
|
|
|
|
$group_id = request('group_id');//团检id
|
|
|
|
$group_id = request('group_id');//团检id
|
|
|
|
$item_ids = request('item_ids');//自选item的ids
|
|
|
|
$item_ids = request('item_ids');//自选item的ids
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (count($item_ids) != 0 and $item_ids[0]=="") {
|
|
|
|
|
|
|
|
$item_ids=[];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$duo_xuan_yi = request('duo_xuan_yi'); //多选1
|
|
|
|
$duo_xuan_yi = request('duo_xuan_yi'); //多选1
|
|
|
|
$plan_id = request('plan_id');//号源id
|
|
|
|
$plan_id = request('plan_id');//号源id
|
|
|
|
$plan_nmr_id = request('plan_nmr_id');//核磁号源id
|
|
|
|
$plan_nmr_id = request('plan_nmr_id');//核磁号源id
|
|
|
|
@ -79,6 +84,11 @@ class OrderController extends Controller
|
|
|
|
$jifen = request('jifen',0); //使用的积分数量
|
|
|
|
$jifen = request('jifen',0); //使用的积分数量
|
|
|
|
$yucunkuan = request('yucunkuan',0);//使用的预存款数量
|
|
|
|
$yucunkuan = request('yucunkuan',0);//使用的预存款数量
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$wj_flag= request('wj'); //问卷标记
|
|
|
|
|
|
|
|
if(isset($wj_flag) and $wj_flag==1){
|
|
|
|
|
|
|
|
$wj_zhekou=config('app.globals.Wj_ZheKou');//问卷过来的折扣率
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!isset($hospital_id)) return \Yz::echoError1('医院id不能为空');
|
|
|
|
if (!isset($hospital_id)) return \Yz::echoError1('医院id不能为空');
|
|
|
|
if (!isset($openid)) return \Yz::echoError1('openid不能为空');
|
|
|
|
if (!isset($openid)) return \Yz::echoError1('openid不能为空');
|
|
|
|
if (!isset($person_id)) return \Yz::echoError1('person_id不能为空');
|
|
|
|
if (!isset($person_id)) return \Yz::echoError1('person_id不能为空');
|
|
|
|
@ -167,11 +177,12 @@ class OrderController extends Controller
|
|
|
|
|
|
|
|
|
|
|
|
//如果有自选项目
|
|
|
|
//如果有自选项目
|
|
|
|
$items_list = [];
|
|
|
|
$items_list = [];
|
|
|
|
if (count($item_ids) != 0) {
|
|
|
|
if (count($item_ids) != 0 ) {
|
|
|
|
$items_list = DB::table('items')->whereIn('item_id', $item_ids)->where(['status' => 1])->get();
|
|
|
|
$items_list = DB::table('items')->whereIn('item_id', $item_ids)->where(['status' => 1])->get();
|
|
|
|
$existingIds = [];
|
|
|
|
$existingIds = [];
|
|
|
|
|
|
|
|
$item_price=0;
|
|
|
|
foreach ($items_list as $item) {
|
|
|
|
foreach ($items_list as $item) {
|
|
|
|
$price += $item->price;
|
|
|
|
$item_price+=$item->price;
|
|
|
|
$existingIds[] = $item->item_id;
|
|
|
|
$existingIds[] = $item->item_id;
|
|
|
|
$buy_info['items'][] = [
|
|
|
|
$buy_info['items'][] = [
|
|
|
|
'id' => $item->item_id,
|
|
|
|
'id' => $item->item_id,
|
|
|
|
@ -186,6 +197,10 @@ class OrderController extends Controller
|
|
|
|
];
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(isset($wj_flag) and $wj_flag==1){
|
|
|
|
|
|
|
|
$item_price=$item_price*$wj_zhekou;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$price += $item_price;
|
|
|
|
$missingIds = array_diff($item_ids, $existingIds);
|
|
|
|
$missingIds = array_diff($item_ids, $existingIds);
|
|
|
|
if (count($missingIds) > 0) return \Yz::echoError1("部分自选项目不可用,Id:" . implode(', ', $missingIds));
|
|
|
|
if (count($missingIds) > 0) return \Yz::echoError1("部分自选项目不可用,Id:" . implode(', ', $missingIds));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -194,6 +209,7 @@ class OrderController extends Controller
|
|
|
|
$buy_info['items']=array_merge($buy_info['items'],$Nx1_arrInfo);
|
|
|
|
$buy_info['items']=array_merge($buy_info['items'],$Nx1_arrInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$true_price = $price;
|
|
|
|
$true_price = $price;
|
|
|
|
|
|
|
|
|
|
|
|
//如果是团检
|
|
|
|
//如果是团检
|
|
|
|
$group_info = false;
|
|
|
|
$group_info = false;
|
|
|
|
if ($type == 2) {
|
|
|
|
if ($type == 2) {
|
|
|
|
@ -347,6 +363,7 @@ class OrderController extends Controller
|
|
|
|
'sex' => $person->sex,
|
|
|
|
'sex' => $person->sex,
|
|
|
|
'birthday' => $person->birthday,
|
|
|
|
'birthday' => $person->birthday,
|
|
|
|
'married' => $person->married,
|
|
|
|
'married' => $person->married,
|
|
|
|
|
|
|
|
'wj_flag'=>$wj_flag,
|
|
|
|
'created_at' =>$now_datetime,
|
|
|
|
'created_at' =>$now_datetime,
|
|
|
|
];
|
|
|
|
];
|
|
|
|
DB::beginTransaction();
|
|
|
|
DB::beginTransaction();
|
|
|
|
@ -506,10 +523,29 @@ class OrderController extends Controller
|
|
|
|
"预约时间" => $order_info->appointment_date . ' ' . $order_info->appointment_time,
|
|
|
|
"预约时间" => $order_info->appointment_date . ' ' . $order_info->appointment_time,
|
|
|
|
"介绍人" => $order_info->referral,
|
|
|
|
"介绍人" => $order_info->referral,
|
|
|
|
'套餐Id' => $order_info->combo_id == 0 ? null : $order_info->combo_id,
|
|
|
|
'套餐Id' => $order_info->combo_id == 0 ? null : $order_info->combo_id,
|
|
|
|
"可选项目信息" => $item_arr,
|
|
|
|
|
|
|
|
"已收费" => true,
|
|
|
|
"已收费" => true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
$cad2=[
|
|
|
|
|
|
|
|
"可选项目信息" => $item_arr,
|
|
|
|
"总计金额" => $order_info->price,
|
|
|
|
"总计金额" => $order_info->price,
|
|
|
|
];
|
|
|
|
];
|
|
|
|
|
|
|
|
if($order_info->wj_flag == 1){
|
|
|
|
|
|
|
|
$temp=[];
|
|
|
|
|
|
|
|
foreach ($item_arr as $k => $item) {
|
|
|
|
|
|
|
|
$temp[]=[
|
|
|
|
|
|
|
|
"Id"=> $item['Id'],
|
|
|
|
|
|
|
|
"已收费"=>$item['已收费'],
|
|
|
|
|
|
|
|
"优惠方式"=>"打折",
|
|
|
|
|
|
|
|
"优惠值"=> config('app.globals.Wj_ZheKou')
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$cad2=[
|
|
|
|
|
|
|
|
"可选项目信息" => $temp,
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$cad=array_merge($cad,$cad2);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$cad = [
|
|
|
|
$cad = [
|
|
|
|
'type' => 2,
|
|
|
|
'type' => 2,
|
|
|
|
|