作者 sgj
1 个管道 的构建 通过 耗费 3 秒

修改预约提交逻辑

@@ -314,7 +314,6 @@ class YuyueController extends UserBaseController @@ -314,7 +314,6 @@ class YuyueController extends UserBaseController
314 314
315 $res = Db::name('yuyue')->insert($data); 315 $res = Db::name('yuyue')->insert($data);
316 if ($res) { 316 if ($res) {
317 -  
318 $stu_info = Db::name('user')->where(['id' => $data['uid']])->find(); 317 $stu_info = Db::name('user')->where(['id' => $data['uid']])->find();
319 $tea_info = Db::name('user')->where(['id' => $data['teach_id']])->find(); 318 $tea_info = Db::name('user')->where(['id' => $data['teach_id']])->find();
320 $msg = "您好!您已成功预约:{$data['yuyue_day']}/{$data['yuyue_begin']}:00 - {$data['yuyue_end']}:00 时间段{$tea_info['user_nickname']}的课程,请按时上课,教练电话:{$tea_info['mobile']},如有问题可直接与教练或您的学车顾问进行联系。【悠乐驾】"; 319 $msg = "您好!您已成功预约:{$data['yuyue_day']}/{$data['yuyue_begin']}:00 - {$data['yuyue_end']}:00 时间段{$tea_info['user_nickname']}的课程,请按时上课,教练电话:{$tea_info['mobile']},如有问题可直接与教练或您的学车顾问进行联系。【悠乐驾】";
@@ -352,10 +351,7 @@ class YuyueController extends UserBaseController @@ -352,10 +351,7 @@ class YuyueController extends UserBaseController
352 351
353 $res = $tool->wxtemsg_send($param1); 352 $res = $tool->wxtemsg_send($param1);
354 $res = $tool->wxtemsg_send($param2); 353 $res = $tool->wxtemsg_send($param2);
355 -  
356 -  
357 -  
358 - 354 +
359 return json(['code' => '1', 'msg' => '预约成功']); 355 return json(['code' => '1', 'msg' => '预约成功']);
360 } else { 356 } else {
361 return json(['code' => '0', 'msg' => '抱歉,预约失败']); 357 return json(['code' => '0', 'msg' => '抱歉,预约失败']);
@@ -204,7 +204,7 @@ @@ -204,7 +204,7 @@
204 204
205 <!--弹跳框--> 205 <!--弹跳框-->
206 <div class="full_bg"></div> 206 <div class="full_bg"></div>
207 -<div class="yu_tan"> 207 +<div class="yu_tan" data-qr="1">
208 <div class="yu_tan_box"> 208 <div class="yu_tan_box">
209 <img src="/static/image/tan_car1.png" class="tan_car"/> 209 <img src="/static/image/tan_car1.png" class="tan_car"/>
210 <h1 class="tan_text">您确定要预约08:00~09:00张教练的课程吗</h1> 210 <h1 class="tan_text">您确定要预约08:00~09:00张教练的课程吗</h1>
@@ -354,30 +354,36 @@ @@ -354,30 +354,36 @@
354 } 354 }
355 }); 355 });
356 $("#btn_yuyue").click(function () { 356 $("#btn_yuyue").click(function () {
357 - var list = $('.time_bg_icon');  
358 - var day1 = $('.day_bg i').text();  
359 - var week = $('.day_bg b').text();  
360 - var hour1 = $('.time_bg_icon b').text();  
361 - var data_day = $('.day_bg i').attr("data-day").replace(/(\d{4})(\d{2})(\d{2})/, "$1-$2-$3");  
362 - var data_index = $('.time_bg_icon').length == 0 ? true : false;  
363 - if (data_index) {  
364 - layer.msg("请选择时间段!");  
365 - } else {  
366 - $.ajax({  
367 - url: "/user/yuyue/yueyue_do",  
368 - type: "post",  
369 - data: {  
370 - day: data_day,  
371 - week: week,  
372 - begin: parseInt(list[0].getElementsByTagName('b')[0].innerHTML.split("-")[0]),  
373 - end: parseInt(list[list.length - 1].getElementsByTagName('b')[0].innerHTML.split('-')[1])  
374 - }, success: function (res) {  
375 - console.log(res);  
376 - if (res.code == "1") {  
377 - window.location.href = "/user/yuyue/coach_list"; 357 +
  358 + var data_qr = $('.yu_tan').attr("data-qr");
  359 + if (data_qr == 1) {
  360 + var list = $('.time_bg_icon');
  361 + var day1 = $('.day_bg i').text();
  362 + var week = $('.day_bg b').text();
  363 + var hour1 = $('.time_bg_icon b').text();
  364 + var data_day = $('.day_bg i').attr("data-day").replace(/(\d{4})(\d{2})(\d{2})/, "$1-$2-$3");
  365 + var data_index = $('.time_bg_icon').length == 0 ? true : false;
  366 + if (data_index) {
  367 + layer.msg("请选择时间段!");
  368 + } else {
  369 + $.ajax({
  370 + url: "/user/yuyue/yueyue_do",
  371 + type: "post",
  372 + data: {
  373 + day: data_day,
  374 + week: week,
  375 + begin: parseInt(list[0].getElementsByTagName('b')[0].innerHTML.split("-")[0]),
  376 + end: parseInt(list[list.length - 1].getElementsByTagName('b')[0].innerHTML.split('-')[1])
  377 + }, success: function (res) {
  378 + console.log(res);
  379 + if (res.code == "1") {
  380 + $('.yu_tan').attr("data-qr", "2");
  381 + tankuang();
  382 + window.location.href = "/user/yuyue/coach_list";
  383 + }
378 } 384 }
379 - }  
380 - }) 385 + })
  386 + }
381 } 387 }
382 }); 388 });
383 }); 389 });