作者 lianghiu

BUgxiugai

1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 - <meta charset="UTF-8">  
5 - <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">  
6 - <meta content="yes" name="apple-mobile-web-app-capable">  
7 - <meta content="yes" name="apple-touch-fullscreen">  
8 - <meta name="viewport"  
9 - content="width=device-width, initial-scale=1,maximum-scale=1,maximum-scale=1, minimum-scale=1, user-scalable=no">  
10 - <title>预约学车</title>  
11 - <link rel="stylesheet" href="/static/css/common.css">  
12 - <link rel="stylesheet" href="/static/css/style.css">  
13 - <link rel="stylesheet" href="/static/css/swiper.min.css">  
14 - <style>  
15 - .btn_yuyue {  
16 - margin-bottom: 1rem;  
17 - } 4 + <meta charset="UTF-8">
  5 + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  6 + <meta content="yes" name="apple-mobile-web-app-capable">
  7 + <meta content="yes" name="apple-touch-fullscreen">
  8 + <meta name="viewport"
  9 + content="width=device-width, initial-scale=1,maximum-scale=1,maximum-scale=1, minimum-scale=1, user-scalable=no">
  10 + <title>预约学车</title>
  11 + <link rel="stylesheet" href="/static/css/common.css">
  12 + <link rel="stylesheet" href="/static/css/style.css">
  13 + <link rel="stylesheet" href="/static/css/swiper.min.css">
  14 + <style>
  15 + .btn_yuyue {
  16 + margin-bottom: 1rem;
  17 + }
18 18
19 - .yu_tan .yu_tan_box .tan_text {  
20 - width: 6.533333rem;  
21 - }  
22 - </style> 19 + .yu_tan .yu_tan_box .tan_text {
  20 + width: 6.533333rem;
  21 + }
  22 + </style>
23 </head> 23 </head>
24 <body style="background-color: #f6f6f6;"> 24 <body style="background-color: #f6f6f6;">
25 <div class="box"> 25 <div class="box">
26 - <div class="swiper-container">  
27 - <div class="swiper-wrapper">  
28 - <div class="swiper-slide">  
29 - <div class="day_list day_bg">  
30 - <b>周一</b>  
31 - <i>06-25</i>  
32 - </div>  
33 - </div>  
34 - <div class="swiper-slide">  
35 - <div class="day_list">  
36 - <b>周二</b>  
37 - <i>06-26</i>  
38 - </div>  
39 - </div>  
40 - <div class="swiper-slide">  
41 - <div class="day_list">  
42 - <b>周二</b>  
43 - <i>06-26</i>  
44 - </div>  
45 - </div>  
46 - <div class="swiper-slide">  
47 - <div class="day_list">  
48 - <b>周二</b>  
49 - <i>06-26</i>  
50 - </div>  
51 - </div>  
52 - <div class="swiper-slide">  
53 - <div class="day_list">  
54 - <b>周二</b>  
55 - <i>06-26</i>  
56 - </div>  
57 - </div>  
58 - <div class="swiper-slide">  
59 - <div class="day_list">  
60 - <b>周二</b>  
61 - <i>06-26</i>  
62 - </div>  
63 - </div>  
64 - <div class="swiper-slide">  
65 - <div class="day_list">  
66 - <b>周二</b>  
67 - <i>06-26</i>  
68 - </div>  
69 - </div>  
70 - <div class="swiper-slide">  
71 - <div class="day_list">  
72 - <b>周二</b>  
73 - <i>06-26</i>  
74 - </div>  
75 - </div>  
76 - <div class="swiper-slide">  
77 - <div class="day_list">  
78 - <b>周二</b>  
79 - <i>06-26</i>  
80 - </div>  
81 - </div>  
82 - <div class="swiper-slide">  
83 - <div class="day_list">  
84 - <b>周二</b>  
85 - <i>06-26</i>  
86 - </div>  
87 - </div>  
88 - <div class="swiper-slide">  
89 - <div class="day_list">  
90 - <b>周二</b>  
91 - <i>06-26</i>  
92 - </div>  
93 - </div>  
94 - <div class="swiper-slide">  
95 - <div class="day_list">  
96 - <b>周二</b>  
97 - <i>06-26</i>  
98 - </div>  
99 - </div>  
100 - <div class="swiper-slide">  
101 - <div class="day_list">  
102 - <b>周二</b>  
103 - <i>06-26</i>  
104 - </div>  
105 - </div>  
106 - <div class="swiper-slide">  
107 - <div class="day_list">  
108 - <b>周二</b>  
109 - <i>06-26</i>  
110 - </div>  
111 - </div>  
112 - <div class="swiper-slide">  
113 - <div class="day_list">  
114 - <b>周二</b>  
115 - <i>06-26</i>  
116 - </div>  
117 - </div>  
118 - </div>  
119 - </div>  
120 - <div class="yu_container">  
121 - <div class="time_list">  
122 - <b>06:00-07:00</b>  
123 - <i></i>  
124 - </div>  
125 - <div class="time_list">  
126 - <b>07:00-08:00</b>  
127 - <i></i>  
128 - </div>  
129 - <div class="time_list">  
130 - <b>08:00-09:00</b>  
131 - <i></i>  
132 - </div>  
133 - <div class="time_list">  
134 - <b>09:00-10:00</b>  
135 - <i></i>  
136 - </div>  
137 - <div class="time_list">  
138 - <b>10:00-11:00</b>  
139 - <i></i>  
140 - </div>  
141 - <div class="time_list time_bor">  
142 - <b>11:00-12:00</b>  
143 - <i></i>  
144 - </div>  
145 - <div class="time_list time_bor">  
146 - <b>12:00-13:00</b>  
147 - <i></i>  
148 - </div>  
149 - <div class="time_list time_bor time_bg_icon">  
150 - <b>13:00-14:00</b>  
151 - <i></i>  
152 - </div>  
153 - <div class="time_list time_bor">  
154 - <b>14:00-15:00</b>  
155 - <i></i>  
156 - </div>  
157 - <div class="time_list time_bor">  
158 - <b>15:00-16:00</b>  
159 - <i></i>  
160 - </div>  
161 - <div class="time_list time_bor">  
162 - <b>16:00-17:00</b>  
163 - <i></i>  
164 - </div>  
165 - <div class="time_list time_bor">  
166 - <b>17:00-18:00</b>  
167 - <i></i>  
168 - </div>  
169 - <div style="clear: both"></div>  
170 - <div class="btn_yuyue" style="display: block;margin-top:3.73rem" id="btn_yuyue">  
171 - <img src="/static/image/btn_yuyue.png"/>  
172 - </div>  
173 - </div> 26 + <div class="swiper-container">
  27 + <div class="swiper-wrapper">
  28 + <div class="swiper-slide">
  29 + <div class="day_list day_bg">
  30 + <b>周一</b>
  31 + <i>06-25</i>
  32 + </div>
  33 + </div>
  34 + <div class="swiper-slide">
  35 + <div class="day_list">
  36 + <b>周二</b>
  37 + <i>06-26</i>
  38 + </div>
  39 + </div>
  40 + <div class="swiper-slide">
  41 + <div class="day_list">
  42 + <b>周二</b>
  43 + <i>06-26</i>
  44 + </div>
  45 + </div>
  46 + <div class="swiper-slide">
  47 + <div class="day_list">
  48 + <b>周二</b>
  49 + <i>06-26</i>
  50 + </div>
  51 + </div>
  52 + <div class="swiper-slide">
  53 + <div class="day_list">
  54 + <b>周二</b>
  55 + <i>06-26</i>
  56 + </div>
  57 + </div>
  58 + <div class="swiper-slide">
  59 + <div class="day_list">
  60 + <b>周二</b>
  61 + <i>06-26</i>
  62 + </div>
  63 + </div>
  64 + <div class="swiper-slide">
  65 + <div class="day_list">
  66 + <b>周二</b>
  67 + <i>06-26</i>
  68 + </div>
  69 + </div>
  70 + <div class="swiper-slide">
  71 + <div class="day_list">
  72 + <b>周二</b>
  73 + <i>06-26</i>
  74 + </div>
  75 + </div>
  76 + <div class="swiper-slide">
  77 + <div class="day_list">
  78 + <b>周二</b>
  79 + <i>06-26</i>
  80 + </div>
  81 + </div>
  82 + <div class="swiper-slide">
  83 + <div class="day_list">
  84 + <b>周二</b>
  85 + <i>06-26</i>
  86 + </div>
  87 + </div>
  88 + <div class="swiper-slide">
  89 + <div class="day_list">
  90 + <b>周二</b>
  91 + <i>06-26</i>
  92 + </div>
  93 + </div>
  94 + <div class="swiper-slide">
  95 + <div class="day_list">
  96 + <b>周二</b>
  97 + <i>06-26</i>
  98 + </div>
  99 + </div>
  100 + <div class="swiper-slide">
  101 + <div class="day_list">
  102 + <b>周二</b>
  103 + <i>06-26</i>
  104 + </div>
  105 + </div>
  106 + <div class="swiper-slide">
  107 + <div class="day_list">
  108 + <b>周二</b>
  109 + <i>06-26</i>
  110 + </div>
  111 + </div>
  112 + <div class="swiper-slide">
  113 + <div class="day_list">
  114 + <b>周二</b>
  115 + <i>06-26</i>
  116 + </div>
  117 + </div>
  118 + </div>
  119 + </div>
  120 + <div class="yu_container">
  121 + <div class="time_list">
  122 + <b>06:00-07:00</b>
  123 + <i></i>
  124 + </div>
  125 + <div class="time_list">
  126 + <b>07:00-08:00</b>
  127 + <i></i>
  128 + </div>
  129 + <div class="time_list">
  130 + <b>08:00-09:00</b>
  131 + <i></i>
  132 + </div>
  133 + <div class="time_list">
  134 + <b>09:00-10:00</b>
  135 + <i></i>
  136 + </div>
  137 + <div class="time_list">
  138 + <b>10:00-11:00</b>
  139 + <i></i>
  140 + </div>
  141 + <div class="time_list time_bor">
  142 + <b>11:00-12:00</b>
  143 + <i></i>
  144 + </div>
  145 + <div class="time_list time_bor">
  146 + <b>12:00-13:00</b>
  147 + <i></i>
  148 + </div>
  149 + <div class="time_list time_bor time_bg_icon">
  150 + <b>13:00-14:00</b>
  151 + <i></i>
  152 + </div>
  153 + <div class="time_list time_bor">
  154 + <b>14:00-15:00</b>
  155 + <i></i>
  156 + </div>
  157 + <div class="time_list time_bor">
  158 + <b>15:00-16:00</b>
  159 + <i></i>
  160 + </div>
  161 + <div class="time_list time_bor">
  162 + <b>16:00-17:00</b>
  163 + <i></i>
  164 + </div>
  165 + <div class="time_list time_bor">
  166 + <b>17:00-18:00</b>
  167 + <i></i>
  168 + </div>
  169 + <div style="clear: both"></div>
  170 + <div class="btn_yuyue" style="display: block;margin-top:3.73rem" id="btn_yuyue">
  171 + <img src="/static/image/btn_yuyue.png"/>
  172 + </div>
  173 + </div>
174 174
175 </div> 175 </div>
176 176
177 <!--弹跳框--> 177 <!--弹跳框-->
178 <div class="full_bg"></div> 178 <div class="full_bg"></div>
179 <div class="yu_tan" data-qr="1"> 179 <div class="yu_tan" data-qr="1">
180 - <div class="yu_tan_box">  
181 - <img src="/static/image/tan_car1.png" class="tan_car"/>  
182 - <h1 class="tan_text">您确定要预约<span id="time_duan"></span>{$data.user_nickname}的课程吗</h1>  
183 - <h2 class="btn_qr">确认</h2>  
184 - </div>  
185 - <div class="syudy_cancel"></div> 180 + <div class="yu_tan_box">
  181 + <img src="/static/image/tan_car1.png" class="tan_car"/>
  182 + <h1 class="tan_text">您确定要预约<span id="time_duan"></span>{$data.user_nickname}的课程吗</h1>
  183 + <h2 class="btn_qr">确认</h2>
  184 + </div>
  185 + <div class="syudy_cancel"></div>
186 </div> 186 </div>
187 <script type="text/javascript" src="/static/js/jquery-1.11.0.min.js"></script> 187 <script type="text/javascript" src="/static/js/jquery-1.11.0.min.js"></script>
188 <script type="text/javascript" src="/static/js/common.js"></script> 188 <script type="text/javascript" src="/static/js/common.js"></script>
@@ -190,249 +190,249 @@ @@ -190,249 +190,249 @@
190 <script src="/static/js/swiper.min.js"></script> 190 <script src="/static/js/swiper.min.js"></script>
191 <script type="text/javascript" src="/static/js/study_car.js"></script> 191 <script type="text/javascript" src="/static/js/study_car.js"></script>
192 <script> 192 <script>
193 - var swiper = new Swiper('.swiper-container', {  
194 - slidesPerView: 7,  
195 - pagination: {  
196 - el: '.swiper-pagination',  
197 - clickable: true,  
198 - },  
199 - });  
200 - $('.day_list').click(function () {  
201 - $(this).addClass('day_bg').parent().siblings().children().removeClass('day_bg');  
202 - });  
203 - $(function () {  
204 - function get_ok_list(day) {  
205 - $.ajax({  
206 - url: "/portal/tool/get_relax_time",  
207 - type: "post",  
208 - data: {  
209 - day: day.replace(/(\d{4})(\d{2})(\d{2})/, "$1-$2-$3"),  
210 - uid: {$id}  
211 - }, success: function (res) {  
212 - if (res.code == "1") {  
213 - var date = new Date();  
214 - var year = date.getFullYear();  
215 - var mon = date.getMonth() + 1;  
216 - var days = date.getDate();  
217 - var hour = date.getHours() + 3;  
218 - var list = $('.time_list');  
219 - if (day == '' + year + check_num(mon) + check_num(days)) {  
220 - var time_list = [];  
221 - for (var i = 0; i < list.find('b').length; i++) {  
222 - time_list.push(list.find('b')[i].innerHTML.split('-'));  
223 - }  
224 - for (var j = 0; j < time_list.length; j++) {  
225 - if (parseInt(time_list[j][0]) < hour) {  
226 - list[j].setAttribute('class', 'time_list');  
227 - } else {  
228 - list[j].setAttribute('class', 'time_list time_bor');  
229 - }  
230 - list[j].setAttribute('data-index', j);  
231 - }  
232 - var list = JSON.parse(res.data);  
233 - var tiem_list = $('.time_list');  
234 - for (var i = 0; i < list.length; i++) {  
235 - if (list[i] == "yes") {  
236 - tiem_list[i].setAttribute('class', 'time_list time_bor');  
237 - } else {  
238 - tiem_list[i].setAttribute('class', 'time_list');  
239 - }  
240 - tiem_list[i].setAttribute("data-index", i);  
241 - }  
242 - } else {  
243 - for (var i = 0; i < list.length; i++) {  
244 - list[i].setAttribute('data-index', i);  
245 - list[i].setAttribute('class', 'time_list time_bor');  
246 - }  
247 - var list = JSON.parse(res.data);  
248 - var tiem_list = $('.time_list');  
249 - for (var i = 0; i < list.length; i++) {  
250 - if (list[i] == "yes") {  
251 - tiem_list[i].setAttribute('class', 'time_list time_bor');  
252 - } else {  
253 - tiem_list[i].setAttribute('class', 'time_list');  
254 - }  
255 - tiem_list[i].setAttribute("data-index", i);  
256 - }  
257 - } 193 + var swiper = new Swiper('.swiper-container', {
  194 + slidesPerView: 7,
  195 + pagination: {
  196 + el: '.swiper-pagination',
  197 + clickable: true,
  198 + },
  199 + });
  200 + $('.day_list').click(function () {
  201 + $(this).addClass('day_bg').parent().siblings().children().removeClass('day_bg');
  202 + });
  203 + $(function () {
  204 + function get_ok_list(day) {
  205 + $.ajax({
  206 + url: "/portal/tool/get_relax_time",
  207 + type: "post",
  208 + data: {
  209 + day: day.replace(/(\d{4})(\d{2})(\d{2})/, "$1-$2-$3"),
  210 + uid: {$id}
  211 + }, success: function (res) {
  212 + if (res.code == "1") {
  213 + var date = new Date();
  214 + var year = date.getFullYear();
  215 + var mon = date.getMonth() + 1;
  216 + var days = date.getDate();
  217 + var hour = date.getHours() + 3;
  218 + var list = $('.time_list');
  219 + if (day == '' + year + check_num(mon) + check_num(days)) {
  220 + var time_list = [];
  221 + var list = JSON.parse(res.data);
  222 + for (var i = 0; i < list.find('b').length; i++) {
  223 + time_list.push(list.find('b')[i].innerHTML.split('-'));
  224 + }
  225 + for (var j = 0; j < time_list.length; j++) {
  226 + if (parseInt(time_list[j][0]) < hour) {
  227 + list[j] = "no";
  228 + } else {
  229 + list[j] = "yes";
  230 + }
  231 + list[j].setAttribute('data-index', j);
  232 + }
  233 + var tiem_list = $('.time_list');
  234 + for (var i = 0; i < list.length; i++) {
  235 + if (list[i] == "yes") {
  236 + tiem_list[i].setAttribute('class', 'time_list time_bor');
  237 + } else {
  238 + tiem_list[i].setAttribute('class', 'time_list');
  239 + }
  240 + tiem_list[i].setAttribute("data-index", i);
  241 + }
  242 + } else {
  243 + for (var i = 0; i < list.length; i++) {
  244 + list[i].setAttribute('data-index', i);
  245 + list[i].setAttribute('class', 'time_list time_bor');
  246 + }
  247 + var list = JSON.parse(res.data);
  248 + var tiem_list = $('.time_list');
  249 + for (var i = 0; i < list.length; i++) {
  250 + if (list[i] == "yes") {
  251 + tiem_list[i].setAttribute('class', 'time_list time_bor');
  252 + } else {
  253 + tiem_list[i].setAttribute('class', 'time_list');
  254 + }
  255 + tiem_list[i].setAttribute("data-index", i);
  256 + }
  257 + }
258 258
259 - }  
260 - }  
261 - });  
262 - } 259 + }
  260 + }
  261 + });
  262 + }
263 263
264 - function check_num(num) {  
265 - if (num < 10) {  
266 - return "0" + num;  
267 - } else {  
268 - return num  
269 - }  
270 - } 264 + function check_num(num) {
  265 + if (num < 10) {
  266 + return "0" + num;
  267 + } else {
  268 + return num
  269 + }
  270 + }
271 271
272 - function checkToday() { 272 + function checkToday() {
273 273
274 - } 274 + }
275 275
276 - (function () {  
277 - var date = new Date();  
278 - var year = date.getFullYear();  
279 - var mon = check_num(date.getMonth() + 1);  
280 - var da = check_num(date.getDate());  
281 - var day = "" + year + mon + da;  
282 - get_ok_list(day);  
283 - })()  
284 - var cells = $('.day_list');  
285 - var clen = cells.length;  
286 - var currentFirstDate;  
287 - var formatDate = function (date) {  
288 - var year = date.getFullYear();  
289 - var month = (date.getMonth() + 1);  
290 - if (month < 10) {  
291 - month = "0" + month;  
292 - }  
293 - var day = date.getDate();  
294 - if (day < 10) {  
295 - day = "0" + day;  
296 - }  
297 - var month_day = month + '-' + day;  
298 - var week = ['周天', '周一', '周二', '周三', '周四', '周五', '周六'][date.getDay()];  
299 - return '<b>' + week + '</b>' + '<i data-day="' + year + '' + month + day + '">' + month_day + '</i>';  
300 - };  
301 - var addDate = function (date, n) {  
302 - date.setDate(date.getDate() + n);  
303 - return date;  
304 - };  
305 - var setDate = function (date) {  
306 - var week = date.getDay() - 1;  
307 - date = addDate(date, week * +0);  
308 - currentFirstDate = new Date(date);  
309 - for (var i = 0; i < clen; i++) {  
310 - cells[i].innerHTML = formatDate(i == 0 ? date : addDate(date, 1));  
311 - }  
312 - };  
313 - setDate(new Date());  
314 - $('.day_list').click(function () {  
315 - var day = $(this).children('i').attr('data-day');  
316 - get_ok_list(day);  
317 - });  
318 - $('.yu_container .time_list').click(function () {  
319 - if ($(this).hasClass('time_bor')) {  
320 - if ($('.time_bg_icon').length < 3) {  
321 - if ($(this).hasClass('time_bg_icon')) {  
322 - $(this).removeClass('time_bg_icon');  
323 - } else {  
324 - $(this).addClass('time_bg_icon');  
325 - }  
326 - } else {  
327 - if ($(this).hasClass('time_bg_icon')) {  
328 - $(this).removeClass('time_bg_icon');  
329 - } else {  
330 - layer.msg("选择的时间段不能超过3小时");  
331 - return;  
332 - }  
333 - }  
334 - var list = $('.time_bg_icon');  
335 - var acvList = [];  
336 - var boo = false;  
337 - for (var i = 0; i < list.length; i++) {  
338 - acvList.push(parseInt(list[i].getAttribute("data-index")));  
339 - }  
340 - var degin = acvList[0];  
341 - for (var j = 0; j < acvList.length; j++) {  
342 - if (acvList[j] != degin) {  
343 - boo = true;  
344 - break;  
345 - } else {  
346 - degin++;  
347 - }  
348 - }  
349 - if (boo) {  
350 - alert("请选择连续的时间段");  
351 - $(this).attr("class", "time_list time_bor");  
352 - }  
353 - }  
354 - });  
355 - var day1 = $('.day_bg i').text();  
356 - var week = $('.day_bg b').text();  
357 - var hour1 = $('.time_bg_icon b').text();  
358 - var data_day = $('.day_bg i').attr("data-day");  
359 - var data_index = $('.time_bg_icon').length == 0 ? null : $('.time_bg_icon').attr("data-index");  
360 - $("#btn_yuyue").click(function () {  
361 - var list = $('.time_bg_icon');  
362 - var acvList = [];  
363 - var boo = false;  
364 - for (var i = 0; i < list.length; i++) {  
365 - acvList.push(parseInt(list[i].getAttribute("data-index")));  
366 - }  
367 - var degin = acvList[0];  
368 - for (var j = 0; j < acvList.length; j++) {  
369 - if (acvList[j] != degin) {  
370 - boo = true;  
371 - break;  
372 - } else {  
373 - degin++;  
374 - }  
375 - }  
376 - if (boo) {  
377 - alert("请选择连续的时间段");  
378 - } else {  
379 - var hour1 = $('.time_bg_icon b').text();  
380 - $('.tan_car').css({"width": "4.97rem", "height": "2.88rem"});  
381 - $('#time_duan').text(hour1);  
382 - tankuang();  
383 - }  
384 - });  
385 - $('.btn_qr').click(function () {  
386 - var data_qr = $('.yu_tan').attr("data-qr");  
387 - var list = $('.time_bg_icon');  
388 - var acvList = [];  
389 - var boo = false;  
390 - for (var i = 0; i < list.length; i++) {  
391 - acvList.push(parseInt(list[i].getAttribute("data-index")));  
392 - }  
393 - var degin = acvList[0];  
394 - for (var j = 0; j < acvList.length; j++) {  
395 - if (acvList[j] != degin) {  
396 - boo = true;  
397 - break;  
398 - } else {  
399 - degin++;  
400 - }  
401 - }  
402 - if (data_qr == 1) {  
403 - $.ajax({  
404 - url: "{:url('yuyue_coach_do')}",  
405 - type: "post",  
406 - data: {  
407 - day: data_day.replace(/(\d{4})(\d{2})(\d{2})/, "$1-$2-$3"),  
408 - week: week,  
409 - begin: parseInt(list[0].getElementsByTagName('b')[0].innerHTML.split("-")[0]),  
410 - end: parseInt(list[list.length - 1].getElementsByTagName('b')[0].innerHTML.split('-')[1]),  
411 - id: {$id}  
412 - },  
413 - success: function (res) {  
414 - console.log(res);  
415 - }  
416 - });  
417 - $('.tan_text').html("恭喜您,预约成功");  
418 - tankuang();  
419 - $('.yu_tan').attr("data-qr", "2")  
420 - } else if (data_qr == 2) {  
421 - window.location.href = "/user/profile/percenter";  
422 - }  
423 - });  
424 - $('.syudy_cancel').click(function () {  
425 - var data_qr = $('.yu_tan').attr("data-qr");  
426 - if (data_qr == 1) {  
427 - $("html").css("overflow", "auto");  
428 - $("body").css("overflow", "auto");  
429 - $(".full_bg").hide();  
430 - $(".yu_tan").hide();  
431 - } else if (data_qr == 2) {  
432 - window.location.href = "/user/profile/percenter";  
433 - }  
434 - });  
435 - }); 276 + (function () {
  277 + var date = new Date();
  278 + var year = date.getFullYear();
  279 + var mon = check_num(date.getMonth() + 1);
  280 + var da = check_num(date.getDate());
  281 + var day = "" + year + mon + da;
  282 + get_ok_list(day);
  283 + })()
  284 + var cells = $('.day_list');
  285 + var clen = cells.length;
  286 + var currentFirstDate;
  287 + var formatDate = function (date) {
  288 + var year = date.getFullYear();
  289 + var month = (date.getMonth() + 1);
  290 + if (month < 10) {
  291 + month = "0" + month;
  292 + }
  293 + var day = date.getDate();
  294 + if (day < 10) {
  295 + day = "0" + day;
  296 + }
  297 + var month_day = month + '-' + day;
  298 + var week = ['周天', '周一', '周二', '周三', '周四', '周五', '周六'][date.getDay()];
  299 + return '<b>' + week + '</b>' + '<i data-day="' + year + '' + month + day + '">' + month_day + '</i>';
  300 + };
  301 + var addDate = function (date, n) {
  302 + date.setDate(date.getDate() + n);
  303 + return date;
  304 + };
  305 + var setDate = function (date) {
  306 + var week = date.getDay() - 1;
  307 + date = addDate(date, week * +0);
  308 + currentFirstDate = new Date(date);
  309 + for (var i = 0; i < clen; i++) {
  310 + cells[i].innerHTML = formatDate(i == 0 ? date : addDate(date, 1));
  311 + }
  312 + };
  313 + setDate(new Date());
  314 + $('.day_list').click(function () {
  315 + var day = $(this).children('i').attr('data-day');
  316 + get_ok_list(day);
  317 + });
  318 + $('.yu_container .time_list').click(function () {
  319 + if ($(this).hasClass('time_bor')) {
  320 + if ($('.time_bg_icon').length < 3) {
  321 + if ($(this).hasClass('time_bg_icon')) {
  322 + $(this).removeClass('time_bg_icon');
  323 + } else {
  324 + $(this).addClass('time_bg_icon');
  325 + }
  326 + } else {
  327 + if ($(this).hasClass('time_bg_icon')) {
  328 + $(this).removeClass('time_bg_icon');
  329 + } else {
  330 + layer.msg("选择的时间段不能超过3小时");
  331 + return;
  332 + }
  333 + }
  334 + var list = $('.time_bg_icon');
  335 + var acvList = [];
  336 + var boo = false;
  337 + for (var i = 0; i < list.length; i++) {
  338 + acvList.push(parseInt(list[i].getAttribute("data-index")));
  339 + }
  340 + var degin = acvList[0];
  341 + for (var j = 0; j < acvList.length; j++) {
  342 + if (acvList[j] != degin) {
  343 + boo = true;
  344 + break;
  345 + } else {
  346 + degin++;
  347 + }
  348 + }
  349 + if (boo) {
  350 + alert("请选择连续的时间段");
  351 + $(this).attr("class", "time_list time_bor");
  352 + }
  353 + }
  354 + });
  355 + var day1 = $('.day_bg i').text();
  356 + var week = $('.day_bg b').text();
  357 + var hour1 = $('.time_bg_icon b').text();
  358 + var data_day = $('.day_bg i').attr("data-day");
  359 + var data_index = $('.time_bg_icon').length == 0 ? null : $('.time_bg_icon').attr("data-index");
  360 + $("#btn_yuyue").click(function () {
  361 + var list = $('.time_bg_icon');
  362 + var acvList = [];
  363 + var boo = false;
  364 + for (var i = 0; i < list.length; i++) {
  365 + acvList.push(parseInt(list[i].getAttribute("data-index")));
  366 + }
  367 + var degin = acvList[0];
  368 + for (var j = 0; j < acvList.length; j++) {
  369 + if (acvList[j] != degin) {
  370 + boo = true;
  371 + break;
  372 + } else {
  373 + degin++;
  374 + }
  375 + }
  376 + if (boo) {
  377 + alert("请选择连续的时间段");
  378 + } else {
  379 + var hour1 = $('.time_bg_icon b').text();
  380 + $('.tan_car').css({"width": "4.97rem", "height": "2.88rem"});
  381 + $('#time_duan').text(hour1);
  382 + tankuang();
  383 + }
  384 + });
  385 + $('.btn_qr').click(function () {
  386 + var data_qr = $('.yu_tan').attr("data-qr");
  387 + var list = $('.time_bg_icon');
  388 + var acvList = [];
  389 + var boo = false;
  390 + for (var i = 0; i < list.length; i++) {
  391 + acvList.push(parseInt(list[i].getAttribute("data-index")));
  392 + }
  393 + var degin = acvList[0];
  394 + for (var j = 0; j < acvList.length; j++) {
  395 + if (acvList[j] != degin) {
  396 + boo = true;
  397 + break;
  398 + } else {
  399 + degin++;
  400 + }
  401 + }
  402 + if (data_qr == 1) {
  403 + $.ajax({
  404 + url: "{:url('yuyue_coach_do')}",
  405 + type: "post",
  406 + data: {
  407 + day: data_day.replace(/(\d{4})(\d{2})(\d{2})/, "$1-$2-$3"),
  408 + week: week,
  409 + begin: parseInt(list[0].getElementsByTagName('b')[0].innerHTML.split("-")[0]),
  410 + end: parseInt(list[list.length - 1].getElementsByTagName('b')[0].innerHTML.split('-')[1]),
  411 + id: {$id}
  412 + },
  413 + success: function (res) {
  414 + console.log(res);
  415 + }
  416 + });
  417 + $('.tan_text').html("恭喜您,预约成功");
  418 + tankuang();
  419 + $('.yu_tan').attr("data-qr", "2")
  420 + } else if (data_qr == 2) {
  421 + window.location.href = "/user/profile/percenter";
  422 + }
  423 + });
  424 + $('.syudy_cancel').click(function () {
  425 + var data_qr = $('.yu_tan').attr("data-qr");
  426 + if (data_qr == 1) {
  427 + $("html").css("overflow", "auto");
  428 + $("body").css("overflow", "auto");
  429 + $(".full_bg").hide();
  430 + $(".yu_tan").hide();
  431 + } else if (data_qr == 2) {
  432 + window.location.href = "/user/profile/percenter";
  433 + }
  434 + });
  435 + });
436 </script> 436 </script>
437 </body> 437 </body>
438 </html> 438 </html>