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

修改预约提交逻辑

... ... @@ -314,7 +314,6 @@ class YuyueController extends UserBaseController
$res = Db::name('yuyue')->insert($data);
if ($res) {
$stu_info = Db::name('user')->where(['id' => $data['uid']])->find();
$tea_info = Db::name('user')->where(['id' => $data['teach_id']])->find();
$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
$res = $tool->wxtemsg_send($param1);
$res = $tool->wxtemsg_send($param2);
return json(['code' => '1', 'msg' => '预约成功']);
} else {
return json(['code' => '0', 'msg' => '抱歉,预约失败']);
... ...
... ... @@ -204,7 +204,7 @@
<!--弹跳框-->
<div class="full_bg"></div>
<div class="yu_tan">
<div class="yu_tan" data-qr="1">
<div class="yu_tan_box">
<img src="/static/image/tan_car1.png" class="tan_car"/>
<h1 class="tan_text">您确定要预约08:00~09:00张教练的课程吗</h1>
... ... @@ -354,30 +354,36 @@
}
});
$("#btn_yuyue").click(function () {
var list = $('.time_bg_icon');
var day1 = $('.day_bg i').text();
var week = $('.day_bg b').text();
var hour1 = $('.time_bg_icon b').text();
var data_day = $('.day_bg i').attr("data-day").replace(/(\d{4})(\d{2})(\d{2})/, "$1-$2-$3");
var data_index = $('.time_bg_icon').length == 0 ? true : false;
if (data_index) {
layer.msg("请选择时间段!");
} else {
$.ajax({
url: "/user/yuyue/yueyue_do",
type: "post",
data: {
day: data_day,
week: week,
begin: parseInt(list[0].getElementsByTagName('b')[0].innerHTML.split("-")[0]),
end: parseInt(list[list.length - 1].getElementsByTagName('b')[0].innerHTML.split('-')[1])
}, success: function (res) {
console.log(res);
if (res.code == "1") {
window.location.href = "/user/yuyue/coach_list";
var data_qr = $('.yu_tan').attr("data-qr");
if (data_qr == 1) {
var list = $('.time_bg_icon');
var day1 = $('.day_bg i').text();
var week = $('.day_bg b').text();
var hour1 = $('.time_bg_icon b').text();
var data_day = $('.day_bg i').attr("data-day").replace(/(\d{4})(\d{2})(\d{2})/, "$1-$2-$3");
var data_index = $('.time_bg_icon').length == 0 ? true : false;
if (data_index) {
layer.msg("请选择时间段!");
} else {
$.ajax({
url: "/user/yuyue/yueyue_do",
type: "post",
data: {
day: data_day,
week: week,
begin: parseInt(list[0].getElementsByTagName('b')[0].innerHTML.split("-")[0]),
end: parseInt(list[list.length - 1].getElementsByTagName('b')[0].innerHTML.split('-')[1])
}, success: function (res) {
console.log(res);
if (res.code == "1") {
$('.yu_tan').attr("data-qr", "2");
tankuang();
window.location.href = "/user/yuyue/coach_list";
}
}
}
})
})
}
}
});
});
... ...