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.
 
 
 
 
 
 

251 lines
8.7 KiB

  1. //普通车
  2. var commonHTML = '';
  3. //周边游
  4. var traveHTML = '';
  5. //已完成
  6. var didHTML = '';
  7. var inghave = '';
  8. var didhasno = '';
  9. $("#loading_html").show();
  10. window.onload = function(){
  11. //样式分两大块、普通车、周边游
  12. commonHTML = $('.common_bus').prop('outerHTML');
  13. traveHTML = $('.around_trave').prop('outerHTML');
  14. //didHTML = $('#did').html();
  15. $.ajax({
  16. url:base_api + "order/orderlist", //请求地址
  17. data:{},
  18. type: "post", //请求方式
  19. async:false,
  20. dataType: "json",
  21. success: function (data) {
  22. console.log(data);
  23. if(data.flag == true){
  24. didhasno = data.data.doing.length;
  25. inghave = data.data.done.length;
  26. reloadData(data);
  27. selectStatus(0);
  28. }else{
  29. alert(data.msg);
  30. }
  31. }
  32. });
  33. }
  34. //订单状态的切换和筛选
  35. function selectStatus(selectStatus){
  36. if (selectStatus == 0) {
  37. $('#hasnoinfo').addClass('ui_hide');
  38. $('#going').addClass('title_line');
  39. $('#going').removeClass('commongray_color');
  40. $('#completed').addClass('commongray_color');
  41. $('#completed').removeClass('title_line');
  42. $('#ing').removeClass('ui_hide');
  43. $('#did').addClass('ui_hide');
  44. if (didhasno == 0) {
  45. $('#hasnoinfo').removeClass('ui_hide');
  46. }else{
  47. $('#hasnoinfo').addClass('ui_hide');
  48. }
  49. } else{
  50. $('#hasnoinfo').addClass('ui_hide');
  51. $('#completed').addClass('title_line');
  52. $('#completed').removeClass('commongray_color');
  53. $('#going').addClass('commongray_color');
  54. $('#going').removeClass('title_line');
  55. $('#did').removeClass('ui_hide');
  56. $('#ing').addClass('ui_hide');
  57. if (inghave == 0) {
  58. $('#hasnoinfo').removeClass('ui_hide');
  59. }else{
  60. $('#hasnoinfo').addClass('ui_hide');
  61. }
  62. }
  63. }
  64. //加载数据
  65. function reloadData(data){
  66. var inglist = data.data.doing;
  67. var didlist = data.data.done;
  68. var newHTML = '';
  69. var newHTML1 = '';
  70. for(var i=0;i<inglist.length;i++){
  71. var common_state_img = "";
  72. var trave_state_img = "";
  73. var common_again_tick = "";
  74. var trave_again_tick = "";
  75. //普通车订单状态图片及重新购票、周边游状态图片及重新购票
  76. if(inglist[i].order_status=="145"){
  77. common_state_img = "img-weizhifu";
  78. common_again_tick = '<div style="color: #ff6d6d;top: 0.03rem;">前往支付</div>';
  79. trave_state_img = "img-weizhifu";
  80. trave_again_tick = '<div style="color: #ff6d6d;top: 0.03rem;">前往支付</div>';
  81. }else if(inglist[i].order_status=="146"){
  82. common_state_img = "img-yichupiao";
  83. common_again_tick = '<div></div>';
  84. trave_state_img = "img-yichupiao";
  85. trave_again_tick = '<div></div>';
  86. }else if(inglist[i].order_status=="147"){
  87. common_state_img = "img-yiwancheng";
  88. common_again_tick = '<div></div>';
  89. trave_state_img = "img-yiwancheng";
  90. trave_again_tick = '<div></div>';
  91. }else if(inglist[i].order_status=="148"){
  92. common_state_img = "img-yiquxiao";
  93. common_again_tick = '<div style="color: #519d9e;top: 0.03rem;">重新购票</div>';
  94. trave_state_img = "img-yiquxiao";
  95. trave_again_tick = '<div style="color: #519d9e;top: 0.03rem;">重新购票</div>';
  96. }
  97. if(inglist[i].line_type == "369"){
  98. //周边游样式
  99. var tempHTML = traveHTML;
  100. tempHTML=tempHTML.replace('none','block');
  101. tempHTML=tempHTML.replace('[35]',parseInt(Math.ceil(inglist[i].price)));
  102. tempHTML=tempHTML.replace('[10月09日]',inglist[i].start_date);
  103. tempHTML=tempHTML.replace('[10:45]',inglist[i].start_time);
  104. tempHTML=tempHTML.replace('[img_yiwancheng]',trave_state_img);
  105. tempHTML=tempHTML.replace('[千岛湖两日游]',inglist[i].line_name);
  106. tempHTML=tempHTML.replace('[含往返豪华大巴士接送]',inglist[i].line_describe);
  107. tempHTML=tempHTML.replace('[上海皇甫旅游集散地]',inglist[i].start_city+inglist[i].start_station);
  108. tempHTML=tempHTML.replace('[2]',inglist[i].pnum);
  109. tempHTML=tempHTML.replace('[重新购票]',trave_again_tick);
  110. tempHTML=tempHTML.replace('[今天]',inglist[i].week);
  111. tempHTML=tempHTML.replace('[order_id]',inglist[i].order_id);
  112. }else{
  113. //普通样式
  114. var tempHTML = commonHTML;
  115. tempHTML=tempHTML.replace('none','block');
  116. tempHTML=tempHTML.replace('[000000]',inglist[i].order_id);
  117. tempHTML=tempHTML.replace('[07:45]',inglist[i].start_time);
  118. tempHTML=tempHTML.replace('[img_yiwancheng]',common_state_img);
  119. tempHTML=tempHTML.replace('[35]',parseInt(Math.ceil(inglist[i].price)));
  120. tempHTML=tempHTML.replace('[南京]',inglist[i].start_city);
  121. tempHTML=tempHTML.replace('[马群马群]',inglist[i].start_station);
  122. tempHTML=tempHTML.replace('[南通]',inglist[i].end_city);
  123. tempHTML=tempHTML.replace('[仙鹤仙鹤仙鹤]',inglist[i].end_station);
  124. tempHTML=tempHTML.replace('[9月09日]',inglist[i].start_date);
  125. tempHTML=tempHTML.replace('[今天]',inglist[i].week);
  126. tempHTML=tempHTML.replace('[重新购票]',common_again_tick);
  127. tempHTML=tempHTML.replace('[order_id]',inglist[i].order_id);
  128. }
  129. newHTML+=tempHTML;
  130. }
  131. $('#ing').html(newHTML);
  132. for(var i=0;i<didlist.length;i++){
  133. var common_state_img = "";
  134. var trave_state_img = "";
  135. var common_again_tick = "";
  136. var trave_again_tick = "";
  137. //普通车订单状态图片及重新购票、周边游状态图片及重新购票
  138. if(didlist[i].order_status=="145"){
  139. common_state_img = "img-weizhifu";
  140. common_again_tick = '<div style="color: #ff6d6d;top: 0.03rem;">前往支付</div>';
  141. trave_state_img = "img-weizhifu";
  142. trave_again_tick = '<div style="color: #ff6d6d;top: 0.03rem;">前往支付</div>';
  143. }else if(didlist[i].order_status=="146"){
  144. common_state_img = "img-yichupiao";
  145. common_again_tick = '<div></div>';
  146. trave_state_img = "img-yichupiao";
  147. trave_again_tick = '<div></div>';
  148. }else if(didlist[i].order_status=="147"){
  149. common_state_img = "img-yiwancheng";
  150. common_again_tick = '<div></div>';
  151. trave_state_img = "img-yiwancheng";
  152. trave_again_tick = '<div></div>';
  153. }else if(didlist[i].order_status=="148"){
  154. common_state_img = "img-yiquxiao";
  155. common_again_tick = '<div style="color: #519d9e;top: 0.03rem;">重新购票</div>';
  156. trave_state_img = "img-yiquxiao";
  157. trave_again_tick = '<div style="color: #519d9e;top: 0.03rem;">重新购票</div>';
  158. }
  159. if(didlist[i].line_type == "369"){
  160. //周边游样式
  161. var tempHTML = traveHTML;
  162. tempHTML=tempHTML.replace('none','block');
  163. tempHTML=tempHTML.replace('[35]',parseInt(Math.ceil(didlist[i].price)));
  164. tempHTML=tempHTML.replace('[10月09日]',didlist[i].start_date);
  165. tempHTML=tempHTML.replace('[10:45]',didlist[i].start_time);
  166. tempHTML=tempHTML.replace('[img_yiwancheng]',trave_state_img);
  167. tempHTML=tempHTML.replace('[千岛湖两日游]',didlist[i].line_name);
  168. tempHTML=tempHTML.replace('[含往返豪华大巴士接送]',didlist[i].line_describe);
  169. tempHTML=tempHTML.replace('[上海皇甫旅游集散地]',didlist[i].start_city+didlist[i].start_station);
  170. tempHTML=tempHTML.replace('[2]',didlist[i].pnum);
  171. tempHTML=tempHTML.replace('[重新购票]',trave_again_tick);
  172. tempHTML=tempHTML.replace('[今天]',didlist[i].week);
  173. tempHTML=tempHTML.replace('[order_id]',didlist[i].order_id);
  174. }else{
  175. //普通样式
  176. var tempHTML = commonHTML;
  177. tempHTML=tempHTML.replace('none','block');
  178. tempHTML=tempHTML.replace('[000000]',didlist[i].order_id);
  179. tempHTML=tempHTML.replace('[07:45]',didlist[i].start_time);
  180. tempHTML=tempHTML.replace('[img_yiwancheng]',common_state_img);
  181. tempHTML=tempHTML.replace('[35]',parseInt(Math.ceil(didlist[i].price)));
  182. tempHTML=tempHTML.replace('[南京]',didlist[i].start_city);
  183. tempHTML=tempHTML.replace('[马群马群]',didlist[i].start_station);
  184. tempHTML=tempHTML.replace('[南通]',didlist[i].end_city);
  185. tempHTML=tempHTML.replace('[仙鹤仙鹤仙鹤]',didlist[i].end_station);
  186. tempHTML=tempHTML.replace('[9月09日]',didlist[i].start_date);
  187. tempHTML=tempHTML.replace('[今天]',didlist[i].week);
  188. tempHTML=tempHTML.replace('[重新购票]',common_again_tick);
  189. tempHTML=tempHTML.replace('[order_id]',didlist[i].order_id);
  190. }
  191. newHTML1+=tempHTML;
  192. }
  193. $('#did').html(newHTML1);
  194. $(".common_bus").click(function(){
  195. var order_id = $(this).attr("order_id");
  196. window.location.href="order_detail.html?order_id="+order_id;
  197. });
  198. $(".around_trave").click(function(){
  199. var order_id = $(this).attr("order_id");
  200. window.location.href="order_detail.html?order_id="+order_id;
  201. });
  202. }
  203. //跳转订单详情页面
  204. function goToDetail(order_id,order_status){
  205. window.location.href = './order_detail.html?order_id='+order_id;
  206. }
  207. //跳转支付页面
  208. function goToPay(order_id){
  209. window.location.href = './order_detail.html?order_id='+order_id;
  210. }
  211. //跳转退票
  212. function refundTicket(order_id){
  213. window.location.href = './order_detail.html?order_id='+order_id;
  214. }
  215. //预订
  216. function seeTheOrder(){
  217. window.location.href = './travel_book.html';
  218. }