You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

272 lines
10 KiB

  1. //Created by HBuilder.
  2. //User: Miracle~
  3. //Date: 2016/11/14
  4. //Time: 9:00
  5. var type;
  6. var airprot_name;
  7. var place_name;
  8. var airprot_id;
  9. var place_id;
  10. var data_cur;
  11. var data_cur_str;
  12. var week_day;
  13. var data = {
  14. type: type, //接机与送机类型(1接2送)
  15. airprot_name: airprot_name, //机场名
  16. place_name: place_name, //上车地点(下车地点)
  17. airprot_id: airprot_id, //机场id
  18. place_id: place_id, //上车地点(下车地点)id
  19. data_cur: data_cur, //时间2016-11-11
  20. data_cur_str: data_cur_str, //时间11月11日
  21. week_day: week_day, //星期几
  22. };
  23. var tt = getDateTime(4);
  24. //开始加载
  25. window.onload = function() {
  26. var data_cur = getPar('data_cur');
  27. var data_cur_str = getPar('data_cur_str');
  28. var week_day = getPar('week_day');
  29. if(data_cur == '' || data_cur_str == '' || week_day == '') {
  30. //alert(getStorJson('pick_drop'));
  31. if(getStorJson('pick_drop') == null) {
  32. //没存过第一次加载
  33. data.type = 1; //默认接机
  34. //data.data_cur = getDateTime(13); //2016-11-11
  35. data.data_cur =after(getDateTime(0));//2016-11-11 明天
  36. temp_time = data.data_cur.replace(/-/g, "/");
  37. data.week_day = getWeekDay(temp_time);
  38. //data.week_day = '今天'; //今天显示今天
  39. // data.data_cur_str = getDateTime(11); //11月11日
  40. var month = getMonthAndDayByDate(data.data_cur,'month');
  41. var day = getMonthAndDayByDate(data.data_cur,'day');
  42. var new_newdate = month + '月' + day + '日';
  43. data.data_cur_str = new_newdate;
  44. data.airprot_name = '';
  45. data.place_name = '';
  46. data.airprot_id = '';
  47. data.place_id = '';
  48. setStorJson('pick_drop', data); //存入缓存
  49. //加载缓存
  50. $('#pick_div').show();
  51. $('#drop_div').hide();
  52. $('#drop_span').removeClass('head_text_click');
  53. $('#pick_span').addClass('head_text_click');
  54. $('#drop_span').addClass('head_text_normal');
  55. $('#pick_span').removeClass('head_text_normal');
  56. $('#pick_input_airprot').val(data.airprot_name);
  57. $('#pick_input_airprot').attr('airprot_id', data.airprot_id);
  58. $('#pick_input_place').val(data.place_name);
  59. $('#pick_input_place').attr('place_id', data.place_id);
  60. $('#time_string').html(data.data_cur_str);
  61. $('#time_string').attr('to_sql_time', data.data_cur);
  62. $('#today').html(data.week_day);
  63. $("#loading_html").show();
  64. } else {
  65. //不是第一次
  66. data = getStorJson('pick_drop');
  67. temp_time = data.data_cur.replace(/-/g, "/");
  68. data.week_day = getWeekDay(temp_time);
  69. setStorJson('pick_drop', data);
  70. if(data.type == 1) {
  71. //显示接机画面
  72. $('#pick_div').show();
  73. $('#drop_div').hide();
  74. $('#drop_span').removeClass('head_text_click');
  75. $('#pick_span').addClass('head_text_click');
  76. $('#drop_span').addClass('head_text_normal');
  77. $('#pick_span').removeClass('head_text_normal');
  78. $('#pick_input_airprot').val(data.airprot_name);
  79. $('#pick_input_airprot').attr('airprot_id', data.airprot_id);
  80. $('#pick_input_place').val(data.place_name);
  81. $('#pick_input_place').attr('place_id', data.place_id);
  82. $('#time_string').html(data.data_cur_str);
  83. $('#time_string').attr('to_sql_time', data.data_cur);
  84. $('#today').html(data.week_day);
  85. $("#loading_html").show();
  86. } else {
  87. //显示送机画面
  88. $('#pick_div').hide();
  89. $('#drop_div').show();
  90. $('#pick_span').removeClass('head_text_click');
  91. $('#drop_span').addClass('head_text_click');
  92. $('#pick_span').addClass('head_text_normal');
  93. $('#drop_span').removeClass('head_text_normal');
  94. $('#drop_input_airprot').val(data.airprot_name);
  95. $('#drop_input_airprot').attr('airprot_id', data.airprot_id);
  96. $('#drop_input_place').val(data.place_name);
  97. $('#drop_input_place').attr('place_id', data.place_id);
  98. $('#time_string').html(data.data_cur_str);
  99. $('#time_string').attr('to_sql_time', data.data_cur);
  100. $('#today').html(data.week_day);
  101. $("#loading_html").show();
  102. }
  103. }
  104. } else {
  105. //从日历转跳
  106. data = getStorJson('pick_drop'); //得到缓存
  107. data.data_cur = getPar('data_cur');
  108. data.data_cur_str = getPar('data_cur_str');
  109. data.week_day = getPar('week_day');
  110. temp_time = data.data_cur.replace(/-/g, "/");
  111. data.week_day = getWeekDay(temp_time);
  112. if(getDateTime(11) == data.data_cur_str) {
  113. //显示今天
  114. data.week_day = '今天';
  115. }
  116. setStorJson('pick_drop', data);
  117. if(data.type == 1) {
  118. //显示接机画面
  119. $('#pick_div').show();
  120. $('#drop_div').hide();
  121. $('#drop_span').removeClass('head_text_click');
  122. $('#pick_span').addClass('head_text_click');
  123. $('#drop_span').addClass('head_text_normal');
  124. $('#pick_span').removeClass('head_text_normal');
  125. $('#pick_input_airprot').val(data.airprot_name);
  126. $('#pick_input_airprot').attr('airprot_id', data.airprot_id);
  127. $('#pick_input_place').val(data.place_name);
  128. $('#pick_input_place').attr('place_id', data.place_id);
  129. $('#time_string').html(data.data_cur_str);
  130. $('#time_string').attr('to_sql_time', data.data_cur);
  131. $('#today').html(data.week_day);
  132. $("#loading_html").show();
  133. } else {
  134. //显示送机画面
  135. $('#pick_div').hide();
  136. $('#drop_div').show();
  137. $('#pick_span').removeClass('head_text_click');
  138. $('#drop_span').addClass('head_text_click');
  139. $('#pick_span').addClass('head_text_normal');
  140. $('#drop_span').removeClass('head_text_normal');
  141. $('#drop_input_airprot').val(data.airprot_name);
  142. $('#drop_input_airprot').attr('airprot_id', data.airprot_id);
  143. $('#drop_input_place').val(data.place_name);
  144. $('#drop_input_place').attr('place_id', data.place_id);
  145. $('#time_string').html(data.data_cur_str);
  146. $('#time_string').attr('to_sql_time', data.data_cur);
  147. $('#today').html(data.week_day);
  148. $("#loading_html").show();
  149. }
  150. }
  151. }
  152. //选择日期
  153. function select_date() {
  154. data = getStorJson('pick_drop');
  155. if(data.type == 1) {
  156. //存储接机缓存
  157. data.airprot_name = $('#pick_input_airprot').val();
  158. data.airprot_id = $('#pick_input_airprot').attr('airprot_id');
  159. data.place_name = $('#pick_input_place').val();
  160. data.place_id = $('#pick_input_place').attr('place_id');
  161. data.type = 1;
  162. data.data_cur = $('#time_string').attr('to_sql_time');
  163. data.data_cur_str = $('#time_string').html();
  164. data.week_day = $('#today').html();
  165. setStorJson('pick_drop', data); //存入缓存
  166. } else {
  167. //存储送机缓存
  168. data.airprot_name = $('#drop_input_airprot').val();
  169. data.airprot_id = $('#drop_input_airprot').attr('airport_id');
  170. data.place_name = $('#drop_input_place').val();
  171. data.place_id = $('#drop_input_place').attr('place_id');
  172. data.type = 2;
  173. data.data_cur = $('#time_string').attr('to_sql_time');
  174. data.data_cur_str = $('#time_string').html();
  175. data.week_day = $('#today').html();
  176. setStorJson('pick_drop', data); //存入缓存
  177. }
  178. window.location.href = "calendar.html?from=pick_drop"; //跳转日历
  179. }
  180. //显示接机
  181. function pick_person() {
  182. //切换画面,保存并覆盖原有内存
  183. $('#pick_div').show();
  184. $('#drop_div').hide();
  185. $('#drop_span').removeClass('head_text_click');
  186. $('#pick_span').addClass('head_text_click');
  187. $('#drop_span').addClass('head_text_normal');
  188. $('#pick_span').removeClass('head_text_normal');
  189. data = getStorJson('pick_drop');
  190. data.type = 1;
  191. data.airprot_name = '';
  192. data.place_name = '';
  193. data.airprot_id = '';
  194. data.place_id = '';
  195. data.data_cur = $('#time_string').attr('to_sql_time'); //传后台时间
  196. data.data_cur_str = $('#time_string').text(); //显示时间
  197. data.week_day = $('#today').text(); //显示星期几
  198. setStorJson('pick_drop', data); //存入缓存
  199. }
  200. //显示送机
  201. function drop_person() {
  202. //切换画面,保存并覆盖原有内存
  203. $('#pick_div').hide();
  204. $('#drop_div').show();
  205. $('#pick_span').removeClass('head_text_click');
  206. $('#drop_span').addClass('head_text_click');
  207. $('#pick_span').addClass('head_text_normal');
  208. $('#drop_span').removeClass('head_text_normal');
  209. data = getStorJson('pick_drop');
  210. data.type = 2;
  211. data.airprot_name = '';
  212. data.place_name = '';
  213. data.airprot_id = '';
  214. data.place_id = '';
  215. data.data_cur = $('#time_string').attr('to_sql_time'); //传后台时间
  216. data.data_cur_str = $('#time_string').text(); //显示时间
  217. data.week_day = $('#today').text(); //显示星期几
  218. setStorJson('pick_drop', data); //存入缓存
  219. }
  220. //接机选择机场
  221. //listURL='hot_city.html?op_type=end&tt='+tt;
  222. function select_pick_airprot() {
  223. //保存时间和接送类型
  224. 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; //站点选择
  225. }
  226. //接机选择站点
  227. function select_pick_place() {
  228. var temp_airport = $('#pick_input_airprot').val();
  229. var temp_airport_id = $('#pick_input_airprot').attr('airprot_id');
  230. if(temp_airport != '') {
  231. 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; //站点选择
  232. } else {
  233. alert("请选择接机机场!");
  234. }
  235. }
  236. //送机选择站点
  237. function select_drop_place() {
  238. 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; //站点选择
  239. }
  240. //送机选择机场
  241. function select_drop_airprot() {
  242. 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; //站点选择
  243. }
  244. function search_answer() {
  245. var start_area_id = '';
  246. var end_area_id = '';
  247. var run_date = $('#time_string').attr('to_sql_time'); //时间
  248. var temp_date = getStorJson('pick_drop');
  249. var temp_type = temp_date.type;
  250. if(temp_type == 1) {
  251. //接机
  252. start_area_id = $("#pick_input_airprot").attr("airprot_id");
  253. end_area_id = $("#pick_input_place").attr("place_id");
  254. } else {
  255. //送机
  256. start_area_id = $("#drop_input_place").attr("place_id");
  257. end_area_id = $("#drop_input_airprot").attr("airprot_id");
  258. }
  259. if(start_area_id != '' && end_area_id != '' && run_date != '') {
  260. window.location.href = "search_results.html?from=pick_drop_person&pick_drop_person_type=" + temp_type + "&start_area_id=" + start_area_id +
  261. "&end_area_id=" + end_area_id +
  262. "&run_date=" + run_date;
  263. } else {
  264. alert('请选择站点!');
  265. }
  266. }