|
- //Created by HBuilder.
- //User: Miracle~
- //Date: 2016/11/14
- //Time: 9:00
- var type;
- var airprot_name;
- var place_name;
- var airprot_id;
- var place_id;
- var data_cur;
- var data_cur_str;
- var week_day;
- var data = {
- type: type, //接机与送机类型(1接2送)
- airprot_name: airprot_name, //机场名
- place_name: place_name, //上车地点(下车地点)
- airprot_id: airprot_id, //机场id
- place_id: place_id, //上车地点(下车地点)id
- data_cur: data_cur, //时间2016-11-11
- data_cur_str: data_cur_str, //时间11月11日
- week_day: week_day, //星期几
- };
- var tt = getDateTime(4);
- //开始加载
- window.onload = function() {
- var data_cur = getPar('data_cur');
- var data_cur_str = getPar('data_cur_str');
- var week_day = getPar('week_day');
- if(data_cur == '' || data_cur_str == '' || week_day == '') {
- //alert(getStorJson('pick_drop'));
- if(getStorJson('pick_drop') == null) {
- //没存过第一次加载
- data.type = 1; //默认接机
- //data.data_cur = getDateTime(13); //2016-11-11
- data.data_cur =after(getDateTime(0));//2016-11-11 明天
- temp_time = data.data_cur.replace(/-/g, "/");
- data.week_day = getWeekDay(temp_time);
- //data.week_day = '今天'; //今天显示今天
- // data.data_cur_str = getDateTime(11); //11月11日
- var month = getMonthAndDayByDate(data.data_cur,'month');
- var day = getMonthAndDayByDate(data.data_cur,'day');
- var new_newdate = month + '月' + day + '日';
- data.data_cur_str = new_newdate;
-
-
- data.airprot_name = '';
- data.place_name = '';
- data.airprot_id = '';
- data.place_id = '';
- setStorJson('pick_drop', data); //存入缓存
- //加载缓存
- $('#pick_div').show();
- $('#drop_div').hide();
- $('#drop_span').removeClass('head_text_click');
- $('#pick_span').addClass('head_text_click');
- $('#drop_span').addClass('head_text_normal');
- $('#pick_span').removeClass('head_text_normal');
- $('#pick_input_airprot').val(data.airprot_name);
- $('#pick_input_airprot').attr('airprot_id', data.airprot_id);
- $('#pick_input_place').val(data.place_name);
- $('#pick_input_place').attr('place_id', data.place_id);
- $('#time_string').html(data.data_cur_str);
- $('#time_string').attr('to_sql_time', data.data_cur);
- $('#today').html(data.week_day);
- $("#loading_html").show();
- } else {
- //不是第一次
- data = getStorJson('pick_drop');
- temp_time = data.data_cur.replace(/-/g, "/");
- data.week_day = getWeekDay(temp_time);
- setStorJson('pick_drop', data);
- if(data.type == 1) {
- //显示接机画面
- $('#pick_div').show();
- $('#drop_div').hide();
- $('#drop_span').removeClass('head_text_click');
- $('#pick_span').addClass('head_text_click');
- $('#drop_span').addClass('head_text_normal');
- $('#pick_span').removeClass('head_text_normal');
- $('#pick_input_airprot').val(data.airprot_name);
- $('#pick_input_airprot').attr('airprot_id', data.airprot_id);
- $('#pick_input_place').val(data.place_name);
- $('#pick_input_place').attr('place_id', data.place_id);
- $('#time_string').html(data.data_cur_str);
- $('#time_string').attr('to_sql_time', data.data_cur);
- $('#today').html(data.week_day);
- $("#loading_html").show();
- } else {
- //显示送机画面
- $('#pick_div').hide();
- $('#drop_div').show();
- $('#pick_span').removeClass('head_text_click');
- $('#drop_span').addClass('head_text_click');
- $('#pick_span').addClass('head_text_normal');
- $('#drop_span').removeClass('head_text_normal');
- $('#drop_input_airprot').val(data.airprot_name);
- $('#drop_input_airprot').attr('airprot_id', data.airprot_id);
- $('#drop_input_place').val(data.place_name);
- $('#drop_input_place').attr('place_id', data.place_id);
- $('#time_string').html(data.data_cur_str);
- $('#time_string').attr('to_sql_time', data.data_cur);
- $('#today').html(data.week_day);
- $("#loading_html").show();
- }
- }
- } else {
- //从日历转跳
- data = getStorJson('pick_drop'); //得到缓存
- data.data_cur = getPar('data_cur');
- data.data_cur_str = getPar('data_cur_str');
- data.week_day = getPar('week_day');
- temp_time = data.data_cur.replace(/-/g, "/");
- data.week_day = getWeekDay(temp_time);
- if(getDateTime(11) == data.data_cur_str) {
- //显示今天
- data.week_day = '今天';
- }
- setStorJson('pick_drop', data);
- if(data.type == 1) {
- //显示接机画面
- $('#pick_div').show();
- $('#drop_div').hide();
- $('#drop_span').removeClass('head_text_click');
- $('#pick_span').addClass('head_text_click');
- $('#drop_span').addClass('head_text_normal');
- $('#pick_span').removeClass('head_text_normal');
- $('#pick_input_airprot').val(data.airprot_name);
- $('#pick_input_airprot').attr('airprot_id', data.airprot_id);
- $('#pick_input_place').val(data.place_name);
- $('#pick_input_place').attr('place_id', data.place_id);
- $('#time_string').html(data.data_cur_str);
- $('#time_string').attr('to_sql_time', data.data_cur);
- $('#today').html(data.week_day);
- $("#loading_html").show();
- } else {
- //显示送机画面
- $('#pick_div').hide();
- $('#drop_div').show();
- $('#pick_span').removeClass('head_text_click');
- $('#drop_span').addClass('head_text_click');
- $('#pick_span').addClass('head_text_normal');
- $('#drop_span').removeClass('head_text_normal');
- $('#drop_input_airprot').val(data.airprot_name);
- $('#drop_input_airprot').attr('airprot_id', data.airprot_id);
- $('#drop_input_place').val(data.place_name);
- $('#drop_input_place').attr('place_id', data.place_id);
- $('#time_string').html(data.data_cur_str);
- $('#time_string').attr('to_sql_time', data.data_cur);
- $('#today').html(data.week_day);
- $("#loading_html").show();
- }
- }
-
- }
- //选择日期
- function select_date() {
- data = getStorJson('pick_drop');
- if(data.type == 1) {
- //存储接机缓存
- data.airprot_name = $('#pick_input_airprot').val();
- data.airprot_id = $('#pick_input_airprot').attr('airprot_id');
- data.place_name = $('#pick_input_place').val();
- data.place_id = $('#pick_input_place').attr('place_id');
- data.type = 1;
- data.data_cur = $('#time_string').attr('to_sql_time');
- data.data_cur_str = $('#time_string').html();
- data.week_day = $('#today').html();
- setStorJson('pick_drop', data); //存入缓存
- } else {
- //存储送机缓存
- data.airprot_name = $('#drop_input_airprot').val();
- data.airprot_id = $('#drop_input_airprot').attr('airport_id');
- data.place_name = $('#drop_input_place').val();
- data.place_id = $('#drop_input_place').attr('place_id');
- data.type = 2;
- data.data_cur = $('#time_string').attr('to_sql_time');
- data.data_cur_str = $('#time_string').html();
- data.week_day = $('#today').html();
- setStorJson('pick_drop', data); //存入缓存
- }
- window.location.href = "calendar.html?from=pick_drop"; //跳转日历
- }
- //显示接机
- function pick_person() {
- //切换画面,保存并覆盖原有内存
- $('#pick_div').show();
- $('#drop_div').hide();
- $('#drop_span').removeClass('head_text_click');
- $('#pick_span').addClass('head_text_click');
- $('#drop_span').addClass('head_text_normal');
- $('#pick_span').removeClass('head_text_normal');
- data = getStorJson('pick_drop');
- data.type = 1;
- data.airprot_name = '';
- data.place_name = '';
- data.airprot_id = '';
- data.place_id = '';
- data.data_cur = $('#time_string').attr('to_sql_time'); //传后台时间
- data.data_cur_str = $('#time_string').text(); //显示时间
- data.week_day = $('#today').text(); //显示星期几
- setStorJson('pick_drop', data); //存入缓存
- }
- //显示送机
- function drop_person() {
- //切换画面,保存并覆盖原有内存
- $('#pick_div').hide();
- $('#drop_div').show();
- $('#pick_span').removeClass('head_text_click');
- $('#drop_span').addClass('head_text_click');
- $('#pick_span').addClass('head_text_normal');
- $('#drop_span').removeClass('head_text_normal');
- data = getStorJson('pick_drop');
- data.type = 2;
- data.airprot_name = '';
- data.place_name = '';
- data.airprot_id = '';
- data.place_id = '';
- data.data_cur = $('#time_string').attr('to_sql_time'); //传后台时间
- data.data_cur_str = $('#time_string').text(); //显示时间
- data.week_day = $('#today').text(); //显示星期几
- setStorJson('pick_drop', data); //存入缓存
- }
- //接机选择机场
- //listURL='hot_city.html?op_type=end&tt='+tt;
- function select_pick_airprot() {
- //保存时间和接送类型
- window.location.href = "hot_city.html?from=pick_drop_person&line_type=380&poi_type=7+&op_type=in&type=1&area_type=airport&tt=" + tt; //站点选择
-
- }
- //接机选择站点
- function select_pick_place() {
- var temp_airport = $('#pick_input_airprot').val();
- var temp_airport_id = $('#pick_input_airprot').attr('airprot_id');
- if(temp_airport != '') {
- window.location.href = "hot_city.html?from=pick_drop_person&line_type=380&poi_type=&op_type=out&type=1&area_type=place&airprot_name=" + temp_airport + "&station_id=" + temp_airport_id + "&tt=" + tt; //站点选择
- } else {
- alert("请选择接机机场!");
- }
- }
- //送机选择站点
- function select_drop_place() {
- window.location.href = "hot_city.html?from=pick_drop_person&line_type=380&poi_type=&op_type=in&type=2&area_type=place&tt=" + tt; //站点选择
- }
- //送机选择机场
- function select_drop_airprot() {
- window.location.href = "hot_city.html?from=pick_drop_person&line_type=380&poi_type=7+&op_type=out&type=2&area_type=airport&tt=" + tt; //站点选择
-
- }
-
- function search_answer() {
- var start_area_id = '';
- var end_area_id = '';
- var run_date = $('#time_string').attr('to_sql_time'); //时间
- var temp_date = getStorJson('pick_drop');
- var temp_type = temp_date.type;
- if(temp_type == 1) {
- //接机
- start_area_id = $("#pick_input_airprot").attr("airprot_id");
- end_area_id = $("#pick_input_place").attr("place_id");
- } else {
- //送机
- start_area_id = $("#drop_input_place").attr("place_id");
- end_area_id = $("#drop_input_airprot").attr("airprot_id");
- }
- if(start_area_id != '' && end_area_id != '' && run_date != '') {
- window.location.href = "search_results.html?from=pick_drop_person&pick_drop_person_type=" + temp_type + "&start_area_id=" + start_area_id +
- "&end_area_id=" + end_area_id +
- "&run_date=" + run_date;
- } else {
- alert('请选择站点!');
- }
- }
|