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.
 
 
 
 
 

167 lines
5.3 KiB

  1. //进行中 等待支付
  2. var waitHTML = '';
  3. //进行中 已出票
  4. var outHTML = '';
  5. //已完成
  6. var didHTML = '';
  7. var inghave = '';
  8. var didhasno = '';
  9. window.onload = function(){
  10. waitHTML = $('#wait_pay').prop('outerHTML');
  11. outHTML = $('#out_ticket').prop('outerHTML');
  12. didHTML = $('#did').html();
  13. $.ajax({
  14. url:'./zz_wxsct/Model/order/order_list.php', //请求地址
  15. type: "post", //请求方式
  16. async:false,
  17. dataType: "json",
  18. success: function (data) {
  19. console.log(data);
  20. if(data.code == 0){
  21. didhasno = data.goning.length;
  22. inghave = data.completed.length;
  23. reloadData(data);
  24. selectStatus(0);
  25. }else{
  26. alert(data.info);
  27. }
  28. }
  29. });
  30. }
  31. //订单状态的切换和筛选
  32. function selectStatus(selectStatus){
  33. if (selectStatus == 0) {
  34. $('#hasnoinfo').addClass('ui_hide');
  35. $('#going').addClass('title_line');
  36. $('#going').removeClass('commongray_color');
  37. $('#completed').addClass('commongray_color');
  38. $('#completed').removeClass('title_line');
  39. $('#ing').removeClass('ui_hide');
  40. $('#did').addClass('ui_hide');
  41. if (didhasno == 0) {
  42. $('#hasnoinfo').removeClass('ui_hide');
  43. }else{
  44. $('#hasnoinfo').addClass('ui_hide');
  45. }
  46. } else{
  47. $('#hasnoinfo').addClass('ui_hide');
  48. $('#completed').addClass('title_line');
  49. $('#completed').removeClass('commongray_color');
  50. $('#going').addClass('commongray_color');
  51. $('#going').removeClass('title_line');
  52. $('#did').removeClass('ui_hide');
  53. $('#ing').addClass('ui_hide');
  54. if (inghave == 0) {
  55. $('#hasnoinfo').removeClass('ui_hide');
  56. }else{
  57. $('#hasnoinfo').addClass('ui_hide');
  58. }
  59. }
  60. }
  61. //加载数据
  62. function reloadData(data){
  63. var inglist = data.goning;
  64. var newHTML = '';
  65. for(var i=0;i<inglist.length;i++){
  66. var tempHTML = '';
  67. if (inglist[i].ORDER_STATUS == "145") {
  68. tempHTML = waitHTML;
  69. } else{
  70. tempHTML = outHTML;
  71. }
  72. tempHTML=tempHTML.replace('none','block');
  73. tempHTML=tempHTML.replace('[185518]',inglist[i].ORDER_ID);
  74. tempHTML=tempHTML.replace('[50]',inglist[i].ORDER_PRICE);
  75. if (inglist[i].ORDER_STATUS == "145") {
  76. tempHTML=tempHTML.replace('[待支付]',inglist[i].ORDER_STATUS_info);
  77. } else{
  78. tempHTML=tempHTML.replace('[已出票]',inglist[i].ORDER_STATUS_info);
  79. if (inglist[i].CAN_DO == "0") {
  80. // $('#refund_ticket').hide();
  81. var cstr='<div class="text_middle ui_radiu_all ui_m_r30 ui_m_t05 ui_m_b05" id="refund_ticket" style="display: inline-block;padding:0.04rem 0.2rem; border: 1px solid white; color:white;font-size:0.15rem;margin-top: 0.08rem;margin-bottom: 0.08rem;">隐藏</div>';
  82. tempHTML=tempHTML.replace('<div class="tuipiao"></div>',cstr);
  83. }else{
  84. var cstr='<div class="text_middle ui_radiu_all ui_m_r30 ui_m_t05 ui_m_b05" id="refund_ticket" style="display: inline-block;padding:0.04rem 0.2rem; border: 1px solid #3d434f;font-size:0.15rem;margin-top: 0.08rem;margin-bottom: 0.08rem;" onclick="refundTicket('+inglist[i].ORDER_ID+')">退票</div>';
  85. tempHTML=tempHTML.replace('<div class="tuipiao"></div>',cstr);
  86. }
  87. }
  88. tempHTML=tempHTML.replace(/\[order_id]/g,inglist[i].ORDER_ID);
  89. // tempHTML=tempHTML.replace('待支付',inglist[i].ORDER_STATUS_info);
  90. tempHTML=tempHTML.replace('[乌镇]',inglist[i].PROD_START_STATION_AREA_NAME);
  91. tempHTML=tempHTML.replace('[上海]',inglist[i].PROD_END_STATION_AREA_NAME);
  92. tempHTML=tempHTML.replace('[上海迪士尼]',inglist[i].PROD_END_STATION_RES_NAME);
  93. tempHTML=tempHTML.replace('[西栅1号停车场]',inglist[i].PROD_START_STATION_RES_NAME);
  94. tempHTML=tempHTML.replace('[5人]',inglist[i].STAT_NUM+'人');
  95. tempHTML=tempHTML.replace('[普通座]',inglist[i].STAT_TYPE);
  96. tempHTML=tempHTML.replace('[8月24日 今天]',inglist[i].DATE);
  97. tempHTML=tempHTML.replace('[07:45]',inglist[i].TIME);
  98. newHTML+=tempHTML;
  99. }
  100. $('#ing').html(newHTML);
  101. //
  102. var didlist = data.completed;
  103. var newHTML1 = '';
  104. for(var i=0;i<didlist.length;i++){
  105. var tempHTML1 = didHTML;
  106. tempHTML1=tempHTML1.replace('none','block');
  107. tempHTML1=tempHTML1.replace('[185518]',didlist[i].ORDER_ID);
  108. tempHTML1=tempHTML1.replace('[50]',didlist[i].ORDER_PRICE);
  109. tempHTML1=tempHTML1.replace('[订单已关闭]',didlist[i].ORDER_STATUS_info);
  110. tempHTML1=tempHTML1.replace('[乌镇]',didlist[i].PROD_START_STATION_AREA_NAME);
  111. tempHTML1=tempHTML1.replace('[上海]',didlist[i].PROD_END_STATION_AREA_NAME);
  112. tempHTML1=tempHTML1.replace('[上海迪士尼]',didlist[i].PROD_END_STATION_RES_NAME);
  113. tempHTML1=tempHTML1.replace('[西栅1号停车场]',didlist[i].PROD_START_STATION_RES_NAME);
  114. tempHTML1=tempHTML1.replace('[5人]',didlist[i].STAT_NUM+'人');
  115. tempHTML1=tempHTML1.replace('[普通座]',didlist[i].STAT_TYPE);
  116. tempHTML1=tempHTML1.replace('[8月24日 今天]',didlist[i].DATE);
  117. tempHTML1=tempHTML1.replace('[07:45]',didlist[i].TIME);
  118. tempHTML1=tempHTML1.replace(/\[order_id]/g,didlist[i].ORDER_ID);
  119. newHTML1+=tempHTML1;
  120. }
  121. $('#did').html(newHTML1);
  122. }
  123. //跳转订单详情页面
  124. function goToDetail(order_id,order_status){
  125. window.location.href = './order_detail.html?order_id='+order_id;
  126. }
  127. //跳转支付页面
  128. function goToPay(order_id){
  129. window.location.href = './order_detail.html?order_id='+order_id;
  130. }
  131. //跳转退票
  132. function refundTicket(order_id){
  133. window.location.href = './order_detail.html?order_id='+order_id;
  134. }
  135. //预订
  136. function seeTheOrder(){
  137. window.location.href = './travel_book.html';
  138. }