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.
 
 
 
 
 
 

148 lines
4.7 KiB

  1. //Author:zhangsq
  2. //Date:20160906
  3. //Description:订单列表
  4. var orderHTML = '';
  5. //已完成
  6. var didHTML = '';
  7. var inghave = '';
  8. //记录得到的数组
  9. var inglist = '';
  10. var didlist = '';
  11. window.onload = function(){
  12. $("#loadingToast").show();
  13. orderHTML = $('#wait_pay').html();
  14. var url=base_api+"./application/custom_made/control.php";
  15. var data = {
  16. type:'order_orderlist'
  17. }
  18. var parm=data;
  19. ZZLog(parm)
  20. $.post(url,parm,function(data){
  21. data=JSON.parse(data);
  22. ZZLog(data);
  23. if (data.code == 0) {
  24. $("#loadingToast").hide();
  25. $('#wait_pay').removeClass('ui_hide');
  26. didhasno = data.goning.length;
  27. inghave = data.completed.length;
  28. inglist = data.goning;
  29. didlist = data.completed;
  30. selectStatus(0);
  31. }else{
  32. $("#loadingToast").hide();
  33. $('#wait_pay').removeClass('ui_hide');
  34. alert(data.info);
  35. }
  36. });
  37. }
  38. //加载数据
  39. function reloadData(list,sel){
  40. // var list = '';
  41. // if (sel == 0) {
  42. // list = data.goning;
  43. // } else{
  44. // list = data.completed;
  45. // }
  46. var newHTML = '';
  47. for(var i=0;i<list.length;i++){
  48. var tempHTML = orderHTML;
  49. tempHTML=tempHTML.replace('[185518]',list[i].ORDER_ID);
  50. tempHTML=tempHTML.replace('[35]',list[i].ORDER_PRICE);
  51. if (list[i].ORDER_STATUS == "145") {
  52. tempHTML=tempHTML.replace('<div class="ub-f1 payred_color text_right ui_p_r15 ulev1" style="padding-top: 0.1rem;">[待支付]</div>','<div class="ub-f1 payred_color text_right ui_p_r15 ulev1" style="padding-top: 0.1rem;">'+list[i].ORDER_STATUS_info+'</div>');
  53. var cstr = '<div class="main_color text_middle white_color ulev2" id="pay" style="padding-top: 0.11rem;padding-bottom: 0.11rem;" onclick="goToPay('+list[i].ORDER_ID+')">去支付</div>';
  54. tempHTML=tempHTML.replace('<div class="replace ui_hide" id="repalace"></div>',cstr);
  55. }else if (list[i].ORDER_STATUS == "146") {
  56. tempHTML=tempHTML.replace('<div class="ub-f1 payred_color text_right ui_p_r15 ulev1" style="padding-top: 0.1rem;">[待支付]</div>','<div class="ub-f1 main_font_color text_right ui_p_r15 ulev1" style="padding-top: 0.1rem;">'+list[i].ORDER_STATUS_info+'</div>');
  57. if (list[i].CAN_DO == "0") {
  58. $('#repalace').addClass('ui_hide');
  59. }else{
  60. var cstr='<div class="ub" id="refund"><div class="ub-f1"></div><div style="border: 1px solid #3d434f;color: #3d434f;border-radius: 0.03rem;padding: 0.06rem 0.27rem;margin-top: 0.07rem;margin-bottom: 0.06rem;" class="ulev1 ui_m_r15" onclick="refundTicket('+list[i].ORDER_ID+')">退票</div></div>';
  61. tempHTML=tempHTML.replace('<div class="replace ui_hide" id="repalace"></div>',cstr);
  62. }
  63. }else{
  64. tempHTML=tempHTML.replace('<div class="ub-f1 payred_color text_right ui_p_r15 ulev1" style="padding-top: 0.1rem;">[待支付]</div>','<div class="ub-f1 fontmiddle_color text_right ui_p_r15 ulev1" style="padding-top: 0.1rem;">'+list[i].ORDER_STATUS_info+'</div>');
  65. $('#repalace').addClass('ui_hide');
  66. }
  67. tempHTML=tempHTML.replace(/\[order_id]/g,list[i].ORDER_ID);
  68. tempHTML=tempHTML.replace('[南京]',list[i].PROD_START_STATION_AREA_NAME);
  69. tempHTML=tempHTML.replace('[南通]',list[i].PROD_END_STATION_AREA_NAME);
  70. tempHTML=tempHTML.replace('[出发站点]',list[i].PROD_START_STATION_RES_NAME);
  71. tempHTML=tempHTML.replace('[目的站点]',list[i].PROD_END_STATION_RES_NAME);
  72. tempHTML=tempHTML.replace('[n]',list[i].STAT_NUM);
  73. tempHTML=tempHTML.replace('[8月24日 今天]',list[i].DATE);
  74. tempHTML=tempHTML.replace('[07:45]',list[i].TIME);
  75. newHTML+=tempHTML;
  76. }
  77. $('#wait_pay').html(newHTML);
  78. }
  79. //订单状态的切换和筛选
  80. function selectStatus(selectStatus){
  81. if (selectStatus == 0) {
  82. $('#going').addClass('title_line_selected');
  83. $('#going').removeClass('title_line');
  84. $('#completed').addClass('title_line');
  85. $('#completed').removeClass('title_line_selected');
  86. if (didhasno == 0) {
  87. $('#hasnoinfo').removeClass('ui_hide');
  88. }else{
  89. $('#hasnoinfo').addClass('ui_hide');
  90. }
  91. selectStatus = 0;
  92. var datalist = inglist;
  93. reloadData(datalist,selectStatus);
  94. } else{
  95. $('#completed').addClass('title_line_selected');
  96. $('#completed').removeClass('title_line');
  97. $('#going').addClass('title_line');
  98. $('#going').removeClass('title_line_selected');
  99. if (inghave == 0) {
  100. $('#hasnoinfo').removeClass('ui_hide');
  101. }else{
  102. $('#hasnoinfo').addClass('ui_hide');
  103. }
  104. selectStatus = 1;
  105. var datalist = didlist;
  106. reloadData(datalist,selectStatus);
  107. }
  108. }
  109. //跳转订单详情页面
  110. function goToDetail(order_id,order_status){
  111. window.location.href = './order_detail.html?order_id='+order_id;
  112. }
  113. //跳转支付页面
  114. function goToPay(order_id){
  115. window.location.href = './order_detail.html?order_id='+order_id;
  116. }
  117. //跳转退票
  118. function refundTicket(order_id){
  119. window.location.href = './order_detail.html?order_id='+order_id;
  120. }
  121. //预订
  122. function seeTheOrder(){
  123. window.location.href = './index.html';
  124. }