Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 

364 wiersze
15 KiB

  1. src="jquery-2.2.4.min.js";
  2. language="JavaScript";
  3. //结算信息
  4. window.onload = function() {
  5. initHtml();
  6. }
  7. //点击了关闭
  8. function click_cancel(father_name, self_name) {
  9. if(father_name) {
  10. var father = $(father_name);
  11. center_show(father);
  12. } else {
  13. $('.mask').css('display', 'none');
  14. }
  15. $(self_name).css('display', 'none');
  16. }
  17. //请求订单-短信通知
  18. function get_order_send_message(mes_url) {
  19. $.getJSON(mes_url, function(res_data) {
  20. if(res_data['code'] != "0") {
  21. $('#ht_tr_mes_one').html('');
  22. alert(res_data['info']);
  23. }
  24. if(res_data['message'].length <= 0) {
  25. $('#ht_tr_mes_one').html('');
  26. return;
  27. }
  28. $('.notifacation').html('短信通知:' + res_data['message'].length + '条');
  29. // $('#span_info_noti').html('短信通知:'+res_data['message'].length+'条');
  30. console.log("短信" + mes_url);
  31. console.log(res_data);
  32. var ht_tr_mes_one_str = $('#ht_tr_mes_one').prop('outerHTML');
  33. var ht_send_message_list = $('#ht_send_message_list');
  34. var order_send_message_arr = res_data['message'];
  35. if(order_send_message_arr == undefined) {
  36. return;
  37. }
  38. var mesHTML = '';
  39. for(var i = 0; i < order_send_message_arr.length; i++) {
  40. var dict = order_send_message_arr[i];
  41. var HTML = ht_tr_mes_one_str;
  42. HTML = HTML.replace('[内容]', dict['send_mobile'] + ":" + dict['message']);
  43. HTML = HTML.replace('[操作人]', dict['user_name']);
  44. HTML = HTML.replace('[发送时间]', dict['send_time']);
  45. mesHTML += HTML;
  46. }
  47. console.log(mesHTML);
  48. ht_send_message_list.html(mesHTML);
  49. });
  50. }
  51. //点击了三个固定的
  52. function click_show_div(objName, self_obj) {
  53. var obj = $(objName);
  54. if(obj.css('display') == 'none') {
  55. center_show(obj);
  56. } else {
  57. obj.css('display', 'none');
  58. }
  59. }
  60. //点击了第二级
  61. function click_two_show_div(father_name, self_name) {
  62. var father = $(father_name);
  63. var self = $(self_name);
  64. father.css('display', 'none');
  65. center_show(self);
  66. }
  67. //居中显示
  68. var tempDiv = null;
  69. function center_show(show_div) {
  70. tempDiv = show_div;
  71. //显示蒙板
  72. show_div.css('display', 'block');
  73. show_div.css('z-index', 10);
  74. show_div.css('background-color', 'white');
  75. show_div.css('position', 'fixed');
  76. var w = show_div.css('width');
  77. var h = show_div.css('height');
  78. w = w.substr(0, w.length - 2);
  79. h = h.substr(0, h.length - 2);
  80. // var s_left=(window.screen.availWidth-w)/2 +"px";
  81. // var s_top=(window.screen.availHeight-h)/2 +'px';
  82. var s_left = (window.innerWidth - w) / 2 + 'px';
  83. var s_top = (window.innerHeight - h) / 2 + 'px';
  84. show_div.css('left', s_left);
  85. show_div.css('top', s_top);
  86. $('.mask').css('display', 'block');
  87. }
  88. //点击蒙板
  89. function hide_all() {
  90. $('.mask').css('display', 'none');
  91. tempDiv.css('display', 'none');
  92. }
  93. function getPar(par) {
  94. //获取当前URL
  95. var local_url = document.location.href;
  96. local_url = decodeURI(local_url);
  97. //获取要取得的get参数位置
  98. var get = local_url.indexOf(par + "=");
  99. if(get == -1) {
  100. return "";
  101. }
  102. //截取字符串
  103. var get_par = local_url.slice(par.length + get + 1);
  104. //判断截取后的字符串是否还有其他get参数
  105. var nextPar = get_par.indexOf("&");
  106. if(nextPar != -1) {
  107. get_par = get_par.slice(0, nextPar);
  108. }
  109. return get_par;
  110. }
  111. var orderid = getPar("order_id");
  112. //var status=getQueryString("status");
  113. var url = "./st-xm/Api/order_details_qianlvhs.php?order_id=" + orderid;
  114. $.getJSON(url, function(res_data) {
  115. var jieguo = res_data;
  116. console.log(url);
  117. console.log(jieguo);
  118. if(jieguo.code == 0) {
  119. var order_no = jieguo.order_no;
  120. var order_status = jieguo.order_status;
  121. var order_source = jieguo.order_source;
  122. var order_status = jieguo.order_status;
  123. var sales = jieguo.sales;
  124. var order_sub = jieguo.order_sub;
  125. $('.order_no').html("订单号:" + order_no);
  126. $('.order_status').html(order_status);
  127. $('.order_source').html("订单来源:" + order_source);
  128. $('.sales').html("销售方式:" + sales);
  129. if(order_status == '待支付') {
  130. time = jieguo.pay_second;
  131. ShowCountDown();
  132. setInterval("ShowCountDown()", 1000); //1000为1秒钟
  133. $('#order-ticket').addClass('hide');
  134. $('#order-complete').addClass('hide');
  135. $('#order-cancel').addClass('hide');
  136. $('#order-pay .order_sub_date').html(order_sub.order_sub_date);
  137. $('#order-pay .order_sub_time').html(order_sub.order_sub_time);
  138. $('#order-pay').css("display", "block");
  139. } else if(order_status == '已出票') {
  140. var order_pay_success = jieguo.order_pay_success;
  141. var order_ticket_success = jieguo.order_ticket_success;
  142. $('#order-pay').addClass('hide');
  143. $('#order-complete').addClass('hide');
  144. $('#order-cancel').addClass('hide');
  145. $('#order-ticket .order_sub_date').html(order_sub.order_sub_date);
  146. $('#order-ticket .order_sub_time').html(order_sub.order_sub_time);
  147. $('#order-ticket .order_pay_success_date').html(order_pay_success.order_pay_success_date);
  148. $('#order-ticket .order_pay_success_time').html(order_pay_success.order_pay_success_time);
  149. $('#order-ticket .order_ticket_success_date').html(order_ticket_success.order_ticket_success_date);
  150. $('#order-ticket .order_ticket_success_time').html(order_ticket_success.order_ticket_success_time);
  151. $('#order-ticket').css("display", "block");
  152. } else if(order_status == '已完成') {
  153. var order_pay_success = jieguo.order_pay_success;
  154. var order_ticket_success = jieguo.order_ticket_success;
  155. var order_travel_success = jieguo.order_travel_success;
  156. $('#order-pay').addClass('hide');
  157. $('#order-ticket').addClass('hide');
  158. $('#order-cancel').addClass('hide');
  159. $('#order-complete .order_sub_date').html(order_sub.order_sub_date);
  160. $('#order-complete .order_sub_time').html(order_sub.order_sub_time);
  161. $('#order-complete .order_pay_success_date').html(order_pay_success.order_pay_success_date);
  162. $('#order-complete .order_pay_success_time').html(order_pay_success.order_pay_success_time);
  163. $('#order-complete .order_ticket_success_date').html(order_ticket_success.order_ticket_success_date);
  164. $('#order-complete .order_ticket_success_time').html(order_ticket_success.order_ticket_success_time);
  165. $('#order-complete .order_travel_success_date').html(order_travel_success.order_travel_success_date);
  166. $('#order-complete').css("display", "block");
  167. } else if(order_status == '已取消') {
  168. var order_cancel = jieguo.order_cancel;
  169. $('#order-pay').addClass('hide');
  170. $('#order-ticket').addClass('hide');
  171. $('#order-complete').addClass('hide');
  172. $('#order-cancel .order_sub_date').html(order_sub.order_sub_date);
  173. $('#order-cancel .order_sub_time').html(order_sub.order_sub_time);
  174. $('#order-cancel .order_cancel_reason').html(order_cancel.order_cancel_reason);
  175. $('#order-cancel .order_cancel_date').html(order_cancel.order_cancel_date);
  176. $('#order-cancel .order_cancel_time').html(order_cancel.order_cancel_time);
  177. $('#order-cancel').css("display", "block");
  178. }
  179. var line_info = jieguo.line_info;
  180. var insertTable = "";
  181. for(var item in line_info) {
  182. insertTable += "<tr><td><a href='#'>" + line_info[item].line_code + "</a>" + line_info[item].line_name + "</td><td>" + line_info[item].start_area + "</td><td>" + line_info[item].end_area + "</td>";
  183. var start_time = '';
  184. var car_number = '';
  185. var seat = '';
  186. var ticket_name = '';
  187. var seat_number = '';
  188. var if_print = '';
  189. var if_meal = '';
  190. var if_bounce = '';
  191. var price = '';
  192. for(var item1 in line_info[item].tickets) {
  193. (line_info[item].tickets[item1].if_print == 0) ? aif_print = "否": aif_print = "是";
  194. (line_info[item].tickets[item1].if_meal == 0) ? aif_meal = "否": aif_meal = "是";
  195. (line_info[item].tickets[item1].if_bounce == 0) ? aif_bounce = "否": aif_bounce = "已退票";
  196. if(line_info[item].tickets[item1].if_bounce != 0) {
  197. start_time += "<div class='padding gray'>" + line_info[item].tickets[item1].start_time + "</div>";
  198. car_number += "<div class='padding gray'>" + line_info[item].tickets[item1].car_number + "</div>";
  199. seat += "<div class='padding gray'>" + line_info[item].tickets[item1].seat + "</div>";
  200. ticket_name += "<div class='padding gray'>" + line_info[item].tickets[item1].ticket_name + "</div>";
  201. seat_number += "<div class='padding gray'>" + line_info[item].tickets[item1].seat_number + "</div>";
  202. if_print += "<div class='padding gray'>" + aif_print + "</div>";
  203. if_meal += "<div class='padding gray'>" + aif_meal + "</div>";
  204. if_bounce += "<div class='padding gray'>" + aif_bounce + "</div>";
  205. price += "<div class='padding gray' style='color:#FF9900;'><span style='font-family:Arial;'>&yen;</span>" + line_info[item].tickets[item1].price + "</div>";
  206. } else {
  207. start_time += "<div class='padding'>" + line_info[item].tickets[item1].start_time + "</div>";
  208. car_number += "<div class='padding'>" + line_info[item].tickets[item1].car_number + "</div>";
  209. seat += "<div class='padding'>" + line_info[item].tickets[item1].seat + "</div>";
  210. ticket_name += "<div class='padding'>" + line_info[item].tickets[item1].ticket_name + "</div>";
  211. seat_number += "<div class='padding'>" + line_info[item].tickets[item1].seat_number + "</div>";
  212. if_print += "<div class='padding'>" + aif_print + "</div>";
  213. if_meal += "<div class='padding'>" + aif_meal + "</div>";
  214. if_bounce += "<div class='padding'>" + aif_bounce + "</div>";
  215. price += "<div class='padding' style='color:#FF9900;'><span style='font-family:Arial;'>&yen;</span>" + line_info[item].tickets[item1].price + "</div>";
  216. }
  217. }
  218. insertTable += "<td>" + start_time + "</td><td>" + car_number + "</td><td>" + seat + "</td><td style='display:none;'>" + ticket_name + "</td><td>" + seat_number + "</td><td>" + if_print + "</td><td>" + if_meal + "</td><td>" + if_bounce + "</td><td>" + price + "</td></tr>";
  219. }
  220. insertTable += "<tr style='border-top:1px solid #797979;'><td colspan='9'></td><td>总额</td><td style='color:#FF9900;'><span style='font-family:Arial;'>&yen;</span>" + jieguo.total_rmb + "</td></tr>";
  221. //console.log(insertTable);
  222. $('#sample-table-1 tbody').html(insertTable);
  223. //循环添加乘客信息
  224. // var customer_info=jieguo['customer_info'];
  225. // var HTML='';
  226. // for (var i=0,m=customer_info.length;i<m;i++) {
  227. // var dict=customer_info[i];
  228. // var rowIndex=i/4;
  229. // var colIndex=i%4;
  230. // var tempHTML='';
  231. // if(i>3 && colIndex==0){
  232. // tempHTML+='<div class="col-sm-3" style="height: 84px;border-right:1px solid #ccc;padding-left:20px;overflow:hidden">';
  233. // tempHTML+='<p id="customer_name"></p>';
  234. // tempHTML+='<p id="customer_mobile"></p>';
  235. // tempHTML+='<p id="customer_mobile"></p>';
  236. // tempHTML+='</div>';
  237. // }
  238. // tempHTML+='<div class="col-sm-3" style="height: 84px;border-right:1px solid #ccc;padding-left:20px;overflow:hidden">';
  239. // tempHTML+='<p id="customer_name">联系人:'+dict['CUSTOMER_NAME']+'</p>';
  240. // tempHTML+='<p id="customer_mobile">手机:'+dict['CUSTOMER_MOBILE']+'</p>';
  241. // tempHTML+='<p id="customer_mobile">'+dict['TYPE_NAME']+':'+dict['CUSTOMER_ID_NO']+'</p>';
  242. // tempHTML+='</div>';
  243. // HTML+=tempHTML;
  244. // }
  245. // HTML+='<div id="fuelux-wizard" class="row-fluid col-sm-6" data-target="#step-container"></div>';
  246. // HTML+='<div style="clear:both;"></div>';
  247. // $('#customer').html(HTML);
  248. $('#customer_name').html("联系人:" + jieguo['customer_info'][0]['CUSTOMER_NAME']);
  249. $('#customer_mobile').html("手机号:" + jieguo['customer_info'][0]['CUSTOMER_MOBILE']);
  250. $('#customer_id').html(jieguo['customer_info'][0]['TYPE_NAME'] + ":" + jieguo['customer_info'][0]['CUSTOMER_ID_NO']);
  251. $('#order_remark').val(jieguo['customer_info'][0]['CUSTOMER_MEMO']);
  252. var driver=jieguo['driver'][0];
  253. $('#send_bus_no').html("车牌号:" + driver['bus_no']);
  254. $('#send_driver_name').html("司机姓名:" + driver['driver_name']);
  255. $('#send_driver_mobile').html("司机姓名:" + driver['driver_mobile']);
  256. $("#xm_show").css("display", "block");
  257. var msg_url = "./st-xm/Api/order_details_qianlvhs.php?method=get_msg&order_id=" + orderid;
  258. get_order_send_message(msg_url);
  259. $("#cancel").click(function() {
  260. var cancel = window.prompt("请输入取消原因","");
  261. $("#cancel").attr("disabled", "disabled");
  262. var url = "./st-xm/Api/order_list.php?method=cancelOrder&reason="+cancel+"&clock="+CurrentTime()+"&order_id=" + order_no;
  263. $.getJSON(url, function(res_data) {
  264. if(res_data['code'] != "0") {
  265. alert(res_data['info']);
  266. }
  267. alert('取消成功');
  268. location.replace(location.href);
  269. })
  270. });
  271. } else {
  272. $("#xm_show").html('');
  273. alert(jieguo.info);
  274. }
  275. });
  276. //时间倒计时
  277. function ShowCountDown() {
  278. time = Math.floor(time - 1);
  279. var leftsecond = time;
  280. minute = Math.floor((leftsecond) / 60);
  281. var second = Math.floor(leftsecond - minute * 60);
  282. cc = document.getElementById("countdown");
  283. if(time < 0) {
  284. return;
  285. }
  286. if(second < 10 && minute > 9) {
  287. cc.innerHTML = minute + "分0" + second + "秒";
  288. } else if(second < 10 && minute < 10) {
  289. cc.innerHTML = '0' + minute + "分:0" + second + "秒";
  290. } else if(second > 9 && minute < 10) {
  291. cc.innerHTML = '0' + minute + "分:" + second + "秒";
  292. } else {
  293. cc.innerHTML = minute + "分:" + second + "秒";
  294. }
  295. }
  296. //订单详情页结算信息
  297. function initHtml() {
  298. }
  299. //获取当前时间
  300. function CurrentTime() {
  301. var now = new Date();
  302. var year = now.getFullYear(); //年
  303. var month = now.getMonth() + 1; //月
  304. var day = now.getDate(); //日
  305. var hh = now.getHours(); //时
  306. var mm = now.getMinutes(); //分
  307. var ss = now.getSeconds(); //秒
  308. var clock = year + "-";
  309. if(month < 10)
  310. clock += "0";
  311. clock += month + "-";
  312. if(day < 10)
  313. clock += "0";
  314. clock += day + " ";
  315. if(hh < 10)
  316. clock += "0";
  317. clock += hh + ":";
  318. if (mm < 10) clock += '0';
  319. clock += mm + ":";
  320. if (ss < 10) clock += '0';
  321. clock += ss;
  322. return(clock);
  323. }/**
  324. * Created by Administrator on 2016/9/7.
  325. */
  326. /**
  327. * Created by Administrator on 2016/10/11.
  328. */