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.
 
 
 
 
 
 

309 lines
12 KiB

  1. $("#loading_html").show();
  2. var traveHTML = $('.around_trave').html();
  3. var commonHTML = $('.common_bus').html();
  4. var intDiff = '';//倒计时总秒数量
  5. var order_id = getPar('order_id');
  6. window.onload = function(){
  7. httpData();
  8. }
  9. //请求数据
  10. function httpData(){
  11. $.ajax({
  12. url:base_api + "order/orderlist/getDetaile", //请求地址
  13. type: "post", //请求方式
  14. data:{
  15. order_id:order_id
  16. },
  17. dataType: "json",
  18. success: function (data) {
  19. console.log(data);
  20. if(data.flag == true){
  21. // 倒计时
  22. intDiff = data.data.timer;
  23. reloadData(data.data);
  24. }else{
  25. alert(data.msg);
  26. }
  27. }
  28. });
  29. }
  30. //加载数据
  31. function reloadData(data){
  32. var if_car = data.line_type;
  33. if(data[0].order_status==145){
  34. $("#go_pay").show();
  35. $("#count_price").text(parseInt(Math.ceil(data.price)));
  36. $("#people_no").text("共"+data[0].pcount+"人");
  37. $("#title_content_back").show();
  38. $("#tishi_info").hide();
  39. timer(intDiff,'minute_show','second_show');
  40. }else{
  41. $("#go_pay").hide();
  42. $("#tishi_info").show();
  43. $("#title_content_back").hide();
  44. }
  45. //先判断周边游||普通车
  46. if(if_car == "369"){
  47. var tempHTML = traveHTML;
  48. var order_status = "";
  49. var trip_type_text = "";
  50. var operation_order = "";
  51. var trave_info = "";
  52. for(var m=0,k=data.customer.length;m<k;m++){
  53. trave_info += '<div class="ub">'
  54. +'<div class="ub-f1 ulev1 fontmiddle_color">'+data.customer[m].p_name+'</div>'
  55. + '<div class="ulev1 fontmiddle_color">'+data.customer[m].p_phone+'</div>'
  56. + '</div>'
  57. }
  58. //判断订单状态
  59. if(data[0].order_status == 145){
  60. order_status = '<div style="border-left: 4px solid #ff6d6d;padding: 0.12rem 0.25rem 0.12rem 0.21rem;" class="ub line_color_b ui_line_b ui_p_l10 ub-ae inner_down_line_color type_color">'
  61. + '<div class="ub-f1 pay145_color ui_p_r10 ulev2">待支付</div>'
  62. + '<div class="commongray_color">订单号:'+data[0].order_id+'</div>'
  63. + '</div>'
  64. operation_order = '<div class="ulev1" style="border: 1px solid #fff;border-radius: 0.2rem;width: 0.87rem;padding: 0.03rem 0;text-align: center;color:#FFFFFF;">支付</div>'
  65. }else if(data[0].order_status == 146){
  66. order_status = '<div style="border-left: 4px solid #1b1a20;padding: 0.12rem 0.25rem 0.12rem 0.21rem;" class="ub line_color_b ui_line_b ui_p_l10 ub-ae inner_down_line_color type_color">'
  67. + '<div class="ub-f1 pay146_color ui_p_r10 ulev2">已出票</div>'
  68. + '<div class="commongray_color">订单号:'+data[0].order_id+'</div>'
  69. + '</div>';
  70. if(data.back_ticket == 1){
  71. operation_order = '<div order_id="'+data[0].order_id+'" class="ulev1 return_ticket" style="border: 1px solid #3d434f;border-radius: 0.2rem;width: 0.87rem;padding: 0.03rem 0;text-align: center;">退票</div>'
  72. }else{
  73. operation_order = '<div class="ulev1" style="border: 1px solid #fff;border-radius: 0.2rem;width: 0.87rem;padding: 0.03rem 0;text-align: center;color:#FFFFFF;">不能退票</div>'
  74. }
  75. }else if(data[0].order_status == 147){
  76. order_status = '<div style="border-left: 4px solid #999999;padding: 0.12rem 0.25rem 0.12rem 0.21rem;" class="ub line_color_b ui_line_b ui_p_l10 ub-ae inner_down_line_color type_color">'
  77. + '<div class="ub-f1 pay147_color ui_p_r10 ulev2">已完成</div>'
  78. + '<div class="commongray_color">订单号:'+data[0].order_id+'</div>'
  79. + '</div>';
  80. operation_order = '<div class="ulev1" style="border: 1px solid #ffffff;border-radius: 0.2rem;width: 0.87rem;padding: 0.03rem 0;text-align: center;color:#ffffff">完成</div>'
  81. }else if(data[0].order_status == 148){
  82. order_status = '<div style="border-left: 4px solid #999999;padding: 0.12rem 0.25rem 0.12rem 0.21rem;" class="ub line_color_b ui_line_b ui_p_l10 ub-ae inner_down_line_color type_color">'
  83. + '<div class="ub-f1 pay148_color ui_p_r10 ulev2">已取消</div>'
  84. + '<div class="commongray_color">订单号:'+data[0].order_id+'</div>'
  85. + '</div>';
  86. operation_order = '<div class="ulev1 again_ticket" style="border: 1px solid #3d434f;border-radius: 0.2rem;width: 0.87rem;padding: 0.03rem 0;text-align: center;">重新购票</div>'
  87. }
  88. tempHTML=tempHTML.replace('[185518]',data[0].order_id);
  89. tempHTML=tempHTML.replace('[待支付]',order_status);
  90. tempHTML=tempHTML.replace('[千岛湖两日游]',data[0].line_name);
  91. tempHTML=tempHTML.replace('[含往返豪华大巴士接送]',data[0].line_describe);
  92. tempHTML=tempHTML.replace('[8月24日]',data[0].start_date);
  93. tempHTML=tempHTML.replace('[2016年10月12日]',data[0].start_date);
  94. tempHTML=tempHTML.replace('[2016年11月11日]',data[1].start_date);
  95. tempHTML=tempHTML.replace('[10:30]',data[0].start_time);
  96. tempHTML=tempHTML.replace('[09:30]',data[1].start_time);
  97. tempHTML=tempHTML.replace('[今天]',data[0].week);
  98. tempHTML=tempHTML.replace('[去程出发地站点]',data[0].start_station);
  99. tempHTML=tempHTML.replace('[返程出发地站点]',data[1].start_station);
  100. tempHTML=tempHTML.replace('[2]',data[0].pcount);
  101. tempHTML=tempHTML.replace('[退票]',operation_order);
  102. tempHTML=tempHTML.replace('[毛东东]',data[0].customer_name);
  103. tempHTML=tempHTML.replace('[18612345678]',data[0].customer_mobile);
  104. tempHTML=tempHTML.replace('[58]',parseInt(data.price));
  105. tempHTML=tempHTML.replace('[出行人信息]',trave_info);
  106. $('.around_trave').html(tempHTML);
  107. $('.around_trave').show();
  108. $(".return_ticket").click(function(){
  109. //TODO 周边游退票
  110. var r=confirm("确定要退票吗?");
  111. if (r==true){
  112. $.ajax({
  113. url:base_api+'order/order/cancelPay', //请求地址
  114. type: "post",
  115. data:{
  116. order_id:order_id
  117. },//请求方式
  118. async:false,
  119. dataType: "json",
  120. success: function (data) {
  121. console.log(data);
  122. if(data.flag == true){
  123. alert('退票成功!');
  124. window.location.href = "./order_list.html";
  125. }else{
  126. alert(data.msg);
  127. }
  128. }
  129. });
  130. }
  131. });
  132. $(".again_ticket").click(function(){
  133. window.location.href="travel_book.html";
  134. });
  135. }else{
  136. var tempHTML = commonHTML;
  137. var order_status = "";
  138. var trip_type = data.trip_type;
  139. var trip_type_text = "";
  140. var operation_order = "";
  141. //判断往返程
  142. if(trip_type == 1){
  143. trip_type_text = "单程";
  144. }else if(trip_type == 2){
  145. trip_type_text = "往返程";
  146. tempHTML=tempHTML.replace('[返程出发地站点]',data[1].start_station+' ('+data[1].start_time+')');
  147. tempHTML=tempHTML.replace('[返程下车地站点]',data[1].end_station+' ('+data[1].end_time+')');
  148. }
  149. //判断订单状态
  150. if(data[0].order_status == 145){
  151. order_status = '<div style="border-left: 4px solid #ff6d6d;padding: 0.12rem 0.25rem 0.12rem 0.21rem;" class="ub line_color_b ui_line_b ui_p_l10 ub-ae inner_down_line_color type_color">'
  152. + '<div class="ub-f1 pay145_color ui_p_r10 ulev2">待支付</div>'
  153. + '<div class="commongray_color">订单号:'+data[0].order_id+'</div>'
  154. + '</div>'
  155. operation_order = '<div class="ulev1" style="border: 1px solid #fff;border-radius: 0.2rem;width: 0.87rem;padding: 0.03rem 0;text-align: center;color:#FFFFFF;">支付</div>'
  156. }else if(data[0].order_status == 146){
  157. order_status = '<div style="border-left: 4px solid #1b1a20;padding: 0.12rem 0.25rem 0.12rem 0.21rem;" class="ub line_color_b ui_line_b ui_p_l10 ub-ae inner_down_line_color type_color">'
  158. + '<div class="ub-f1 pay146_color ui_p_r10 ulev2">已出票</div>'
  159. + '<div class="commongray_color">订单号:'+data[0].order_id+'</div>'
  160. + '</div>';
  161. if(data.back_ticket == 1){
  162. operation_order = '<div order_id="'+data[0].order_id+'" class="ulev1 return_ticket" style="border: 1px solid #3d434f;border-radius: 0.2rem;width: 0.87rem;padding: 0.03rem 0;text-align: center;">退票</div>'
  163. }else{
  164. operation_order = '<div class="ulev1" style="border: 1px solid #fff;border-radius: 0.2rem;width: 0.87rem;padding: 0.03rem 0;text-align: center;color:#FFFFFF;">退票</div>'
  165. }
  166. }else if(data[0].order_status == 147){
  167. order_status = '<div style="border-left: 4px solid #999999;padding: 0.12rem 0.25rem 0.12rem 0.21rem;" class="ub line_color_b ui_line_b ui_p_l10 ub-ae inner_down_line_color type_color">'
  168. + '<div class="ub-f1 pay147_color ui_p_r10 ulev2">已完成</div>'
  169. + '<div class="commongray_color">订单号:'+data[0].order_id+'</div>'
  170. + '</div>';
  171. operation_order = '<div class="ulev1" style="border: 1px solid #ffffff;border-radius: 0.2rem;width: 0.87rem;padding: 0.03rem 0;text-align: center;color:#ffffff">完成</div>'
  172. }else if(data[0].order_status == 148){
  173. order_status = '<div style="border-left: 4px solid #999999;padding: 0.12rem 0.25rem 0.12rem 0.21rem;" class="ub line_color_b ui_line_b ui_p_l10 ub-ae inner_down_line_color type_color">'
  174. + '<div class="ub-f1 pay148_color ui_p_r10 ulev2">已取消</div>'
  175. + '<div class="commongray_color">订单号:'+data[0].order_id+'</div>'
  176. + '</div>';
  177. operation_order = '<div class="ulev1 again_ticket" style="border: 1px solid #3d434f;border-radius: 0.2rem;width: 0.87rem;padding: 0.03rem 0;text-align: center;">重新购票</div>'
  178. }
  179. tempHTML=tempHTML.replace('[185518]',data[0].order_id);
  180. tempHTML=tempHTML.replace('[待支付]',order_status);
  181. tempHTML=tempHTML.replace('[order_id]',data[0].order_id);
  182. tempHTML=tempHTML.replace('[07:45]',data[0].start_time);
  183. tempHTML=tempHTML.replace('[8月24日]',data[0].start_date);
  184. tempHTML=tempHTML.replace('[今天]',data[0].week);
  185. tempHTML=tempHTML.replace('[去程出发地站点]',data[0].start_station+' ('+data[0].start_time+')');
  186. tempHTML=tempHTML.replace('[去程下车地站点]',data[0].end_station+' ('+data[0].end_time+')');
  187. tempHTML=tempHTML.replace('[单程]',trip_type_text);
  188. tempHTML=tempHTML.replace('[普通座]',data[0].seat_type);
  189. tempHTML=tempHTML.replace('[5]',data[0].pcount);
  190. tempHTML=tempHTML.replace('[退票]',operation_order);
  191. tempHTML=tempHTML.replace('[毛东东]',data[0].customer_name);
  192. tempHTML=tempHTML.replace('[18612345678]',data[0].customer_mobile);
  193. tempHTML=tempHTML.replace('[58]',parseInt(data.price));
  194. $('.common_bus').html(tempHTML);
  195. $('.common_bus').show();
  196. if(trip_type == 2){
  197. $(".fancheng").show();
  198. }else{
  199. $(".fancheng").hide();
  200. }
  201. $(".return_ticket").click(function(){
  202. //TODO 普通车退票
  203. var r=confirm("确定要退票吗?");
  204. if (r==true){
  205. $.ajax({
  206. url:base_api+'order/order/cancelPay', //请求地址
  207. type: "post",
  208. data:{
  209. order_id:order_id
  210. },//请求方式
  211. async:false,
  212. dataType: "json",
  213. success: function (data) {
  214. console.log(data);
  215. if(data.flag == true){
  216. alert('退票成功!');
  217. window.location.href = "./order_list.html";
  218. }else{
  219. alert(data.msg);
  220. }
  221. }
  222. });
  223. }
  224. });
  225. $(".again_ticket").click(function(){
  226. window.location.href="travel_book.html";
  227. });
  228. }
  229. }
  230. //支付
  231. function goToPay(){
  232. var minute = '';
  233. var second = '';
  234. // if (ifback == 0) {
  235. // minute = $('#minute_show_go').html();
  236. // second = $('#second_show_go').html();
  237. // } else{
  238. // minute = $('#minute_show').html();
  239. // second = $('#second_show').html();
  240. // }
  241. if (minute == '00分' && second == '00秒') {
  242. alert('支付已超时,请重新购票!');
  243. return false;
  244. }else{
  245. //支付地址
  246. window.location.href = 'http://wx.zhizhuchuxing.com/wechat/WxPay/realpay/weChatShopPay.php?order_id='+order_id;
  247. }
  248. }
  249. //倒计时
  250. function timer(intDiff,minstr,secstr){
  251. window.setInterval(function(){
  252. var day=0,
  253. hour=0,
  254. minute=0,
  255. second=0;//时间默认值
  256. if(intDiff > 0){
  257. day = Math.floor(intDiff / (60 * 60 * 24));
  258. hour = Math.floor(intDiff / (60 * 60)) - (day * 24);
  259. minute = Math.floor(intDiff / 60) - (day * 24 * 60) - (hour * 60);
  260. second = Math.floor(intDiff) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
  261. }
  262. if (minute <= 9) minute = '0' + minute;
  263. if (second <= 9) second = '0' + second;
  264. $('#'+minstr).html(minute+'分');
  265. $('#'+secstr).html(second+'秒');
  266. intDiff--;
  267. }, 1000);
  268. }