diff --git a/Laravel/app/Http/Controllers/API/AspNetZhuanController.php b/Laravel/app/Http/Controllers/API/AspNetZhuanController.php index 30b07f1..a2a0ef9 100644 --- a/Laravel/app/Http/Controllers/API/AspNetZhuanController.php +++ b/Laravel/app/Http/Controllers/API/AspNetZhuanController.php @@ -42,10 +42,10 @@ class AspNetZhuanController extends Controller return true; } //二线预约 - public static function GetNmrList($data,$nonce) + public static function ErXian($data,$nonce) { $res= self::Post(self::$BaseUrl . '/erxianzhongzhuan.aspx?str='.$nonce,$data,'二线号源'); - return $res['data']; + return $res['data']??true; } //发送短信 diff --git a/Laravel/app/Http/Controllers/API/H5/ComboController.php b/Laravel/app/Http/Controllers/API/H5/ComboController.php index 32900b9..ae7256a 100644 --- a/Laravel/app/Http/Controllers/API/H5/ComboController.php +++ b/Laravel/app/Http/Controllers/API/H5/ComboController.php @@ -453,7 +453,7 @@ select combo_id as c_id,count(*) as sale_count from orders where status in(2,4) } if(count($nmr_list)>0){ $nmr_list=[ - ['item_id' => '999999', + ['item_id' => $nmr_list[0]['item_id'], 'name' =>$temp_nmr] ]; diff --git a/Laravel/app/Http/Controllers/API/H5/NMRController.php b/Laravel/app/Http/Controllers/API/H5/NMRController.php index b5a9ebb..266ab70 100644 --- a/Laravel/app/Http/Controllers/API/H5/NMRController.php +++ b/Laravel/app/Http/Controllers/API/H5/NMRController.php @@ -30,7 +30,7 @@ class NMRController extends Controller } $aspnet=new AspNetZhuanController(); $list=[]; - $nmr=$aspnet::GetNmrList(['yyid'=>6,'data'=>$days ,'action'=>"1"],uniqid()); + $nmr=$aspnet::ErXian(['yyid'=>6,'data'=>$days ,'action'=>"1"],uniqid()); //获取每日数量 foreach($nmr as $k=>$v){ @@ -92,7 +92,7 @@ class NMRController extends Controller $aspnet=new AspNetZhuanController(); $week7=[]; $currentDate = new DateTime(); - $nmr=$aspnet::GetNmrList(['yyid'=>6,'data'=>$days7,'action'=>"1"],uniqid()); + $nmr=$aspnet::ErXian(['yyid'=>6,'data'=>$days7,'action'=>"1"],uniqid()); //获取每日数量 foreach($nmr as $k=>$v){ $t_v=[]; diff --git a/Laravel/app/Http/Controllers/API/H5/OrderController.php b/Laravel/app/Http/Controllers/API/H5/OrderController.php index 032ba84..fccf4ad 100644 --- a/Laravel/app/Http/Controllers/API/H5/OrderController.php +++ b/Laravel/app/Http/Controllers/API/H5/OrderController.php @@ -79,9 +79,9 @@ class OrderController extends Controller $duo_xuan_yi = request('duo_xuan_yi'); //多选1 $plan_id = request('plan_id');//号源id - $plan_nmr_id = request('plan_nmr_id');//核磁号源id + $plan_nmr_info = request('plan_nmr_info');//核磁号源信息 $doctor = request('doctor');//预约的医生名字 - $coupon_id=request('coupon_id');//优惠券 + $coupon_id = request('coupon_id');//优惠券 $jifen = request('jifen', 0); //使用的积分数量 $yucunkuan = request('yucunkuan', 0);//使用的预存款数量 @@ -91,6 +91,12 @@ class OrderController extends Controller } if (!isset($hospital_id)) return \Yz::echoError1('医院id不能为空'); + if ($hospital_id == 1) { + $yyid = 6; + } + if ($hospital_id == 4) { + $yyid = 2; + } if (!isset($openid)) return \Yz::echoError1('openid不能为空'); if (!isset($person_id)) return \Yz::echoError1('person_id不能为空'); if (!isset($type)) return \Yz::echoError1('type体检类型不能为空'); @@ -316,7 +322,7 @@ class OrderController extends Controller return \Yz::echoError1("预约日期不在单位有效时间范围内,请重新选择"); } } - + $plan_nmr_appointment_info=[]; //校验积分和预存款 $env = config('app.globals.Env'); $AspNet = new AspNetZhuanController(); @@ -335,50 +341,65 @@ class OrderController extends Controller if ($true_price < 0) $true_price = 0; //如果使用了代金券 - $quanInfo=false; - if(isset($coupon_id) and !empty($coupon_id)){ - if($true_price==0) return \Yz::echoError1("无需使用代金券"); - - - if($env=='pro') { //如果是正式环境 - $AspNet=new AspNetZhuanController(); - - $data=[ - 'ghzid'=>$person->ghzid, - 'action'=>1, - ]; - $YouHuiQuanList=$AspNet::YouHuiQuan($data); - foreach ($YouHuiQuanList as $key=>$quan){ - if($quan['DZJID']==$coupon_id){ - $quanInfo=$quan; - } + $quanInfo = false; + if (isset($coupon_id) and !empty($coupon_id)) { + if ($true_price == 0) return \Yz::echoError1("无需使用代金券"); + + $AspNet = new AspNetZhuanController(); + $data = [ + 'ghzid' => $person->ghzid, + 'action' => 1, + ]; + $YouHuiQuanList = $AspNet::YouHuiQuan($data); + foreach ($YouHuiQuanList as $key => $quan) { + if ($quan['DZJID'] == $coupon_id) { + $quanInfo = $quan; } + } - if($quanInfo['是否在有效内']===true and $quanInfo['TimeNuZTTextm']=="有效" and $quanInfo['ZT']==1){ + if ($quanInfo['是否在有效内'] === true and $quanInfo['TimeNuZTTextm'] == "有效" and $quanInfo['ZT'] == 1) { - }else{ - return \Yz::echoError1("此代金券不可用"); - } + } else { + return \Yz::echoError1("此代金券不可用"); + } - $quanType=false; - $YouHuiQuanType=$AspNet::YouHuiQuan(['action'=>2]); - foreach ($YouHuiQuanType as $key=>$qtype){ - if($quanInfo['DZJLBID']==$qtype['DZJLBID']){ - $quanType=$qtype; - } + $quanType = false; + $YouHuiQuanType = $AspNet::YouHuiQuan(['action' => 2]); + foreach ($YouHuiQuanType as $key => $qtype) { + if ($quanInfo['DZJLBID'] == $qtype['DZJLBID']) { + $quanType = $qtype; + } // if($qtype['TJXCXHX']==1 and ($qtype['MKJE']===0 || $qtype['MKJE']>=$true_price)){ // $YouHuiQuanType_ids[]=$qtype['DZJLBID']; // } - } - if($quanType===false or $quanInfo===false) return \Yz::echoError1("此代金券不可用"); - if($quanType['TJXCXHX']!=1 ) return \Yz::echoError1("此代金券不可用"); - if($quanType['MKJE']==0 or $quanType['MKJE']>=$true_price){ - //抵扣代金券金额,折扣暂未实现 - $true_price=($true_price-$quanInfo['JE'])>0 ? $true_price-$quanInfo['JE']:0; - } } + if ($quanType === false or $quanInfo === false) return \Yz::echoError1("此代金券不可用"); + if ($quanType['TJXCXHX'] != 1) return \Yz::echoError1("此代金券不可用"); + if ($quanType['MKJE'] == 0 or $quanType['MKJE'] >= $true_price) { + //抵扣代金券金额,折扣暂未实现 + $true_price = ($true_price - $quanInfo['JE']) > 0 ? $true_price - $quanInfo['JE'] : 0; + } + } + if (isset($plan_nmr_info) and !empty($plan_nmr_info)) { + $plan_nmr_temp = []; + foreach ($plan_nmr_info as $key => $plan_nmr) { + if ($plan_nmr['item_id'] <> -1) { + $p_nmr_data = [ + 'item_id' => $plan_nmr['item_id'], + 'name' => $plan_nmr['name'], + 'date' => substr($plan_nmr['time'], 0, 10), + 'time' => substr($plan_nmr['time'], 10, 5), + ]; + //调用接口校验号源是否可用 + $erxian_status = $AspNet::ErXian(['YYRQ' => $p_nmr_data['date'], 'YYSJ' => $p_nmr_data['time'], 'yyid' => $yyid, 'action' => 4], uniqid()); + if ($erxian_status !== true) return \Yz::echoError1($p_nmr_data['name'] . '号源不可用,请重新选择'); + $plan_nmr_temp[] = $p_nmr_data; + } + } + $plan_nmr_appointment_info=$plan_nmr_temp; + } } $now_datetime = date('Y-m-d H:i:s'); @@ -402,6 +423,7 @@ class OrderController extends Controller 'status' => 1, 'appointment_date' => $plan->date, 'appointment_time' => $plan->time, + 'erxian_appointment_info' => json_encode($plan_nmr_appointment_info, JSON_UNESCAPED_UNICODE), 'plan_id' => $plan->id, 'plan_number' => $plan->plan_number, 'combo_id' => $combo_id, @@ -412,7 +434,7 @@ class OrderController extends Controller 'birthday' => $person->birthday, 'married' => $person->married, 'wj_flag' => $wj_flag, - 'youhuiquan'=>$quanInfo===false?'':json_encode(['id'=>$quanInfo['DZJID'],'name'=>$quanInfo['DZJLBMC']],JSON_UNESCAPED_UNICODE), + 'youhuiquan' => $quanInfo === false ? '' : json_encode(['id' => $quanInfo['DZJID'], 'name' => $quanInfo['DZJLBMC']], JSON_UNESCAPED_UNICODE), 'created_at' => $now_datetime, ]; @@ -430,13 +452,7 @@ class OrderController extends Controller $jifen_dikou_status = true; $yucunkuan_dikou_status = true; $youhuiquan_dikou_status = true; - $r_yyid = $hospital_id; - if($r_yyid==1){ - $yyid=6; - } - if($r_yyid==4){ - $yyid=2; - } + if ($env == 'pro') { //如果是正式环境 if ($jifen > 0) { $jifen_dikou_status = false; @@ -448,16 +464,16 @@ class OrderController extends Controller } //核销优惠券 - if(isset($coupon_id) and !empty($coupon_id)){ - $youhuiquan_dikou_status=false; - $data=[ - 'action'=>3, - 'ghzid'=>$person->ghzid, - 'dzjid'=>$coupon_id, - 'hxbz'=>"抵扣体检H5订单", - 'yyid'=>$yyid + if (isset($coupon_id) and !empty($coupon_id)) { + $youhuiquan_dikou_status = false; + $data = [ + 'action' => 3, + 'ghzid' => $person->ghzid, + 'dzjid' => $coupon_id, + 'hxbz' => "抵扣体检H5订单", + 'yyid' => $yyid ]; - $youhuiquan_dikou_status=$AspNet::YouHuiQuan($data); + $youhuiquan_dikou_status = $AspNet::YouHuiQuan($data); } } @@ -688,13 +704,13 @@ class OrderController extends Controller $WaitingPaymentTime = config('app.globals.WaitingPaymentTime');//支付等待時間 $orderInfos = DB::table('orders')->where(['status' => 1])->get(); foreach ($orderInfos as $k => $orderInfo) { - $person=DB::table('web_user_person')->where(['id' => $orderInfo->person_id])->first(); + $person = DB::table('web_user_person')->where(['id' => $orderInfo->person_id])->first(); $datetime = new DateTime($orderInfo->created_at); $timestamp = $datetime->getTimestamp(); $orderInfo->end_time = $timestamp + (60 * $WaitingPaymentTime); if (time() > $orderInfo->end_time) { - $do=new OrderService(); - $do->Cancel($orderInfo); + $do = new OrderService(); + $do->Cancel($orderInfo); } } return \Yz::Return(true, "批量处理完成", []); diff --git a/h5/pages/main/tjyy/tjyy.vue b/h5/pages/main/tjyy/tjyy.vue index a2f4358..3d05232 100755 --- a/h5/pages/main/tjyy/tjyy.vue +++ b/h5/pages/main/tjyy/tjyy.vue @@ -279,7 +279,7 @@ const comfrimyy = async () => { "", item_ids: buyInfo.value.item_ids, plan_id: plan_id, - plan_nmr_id: plan_nmr_id, + plan_nmr_info:yytjInfo.value?.nmr_list || null, doctor: yytjInfo.value?.doctor_name || "", duo_xuan_yi: $store.getDuoXuanYi(), jifen: Math.ceil(jifen.value),