Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 

1193 řádky
36 KiB

  1. var httpData;
  2. var pagesize = 10;
  3. var click_type_id = "0";
  4. var order_from_id = '-1';
  5. if(window.ActiveXObject) {
  6. var myreq = new ActiveXObject("Microsoft.XMLHTTP");
  7. } else {
  8. var myreq = new XMLHttpRequest();
  9. }
  10. var sourceText = '';
  11. var tableText = '';
  12. var ticketText = '';
  13. var run_duty_id = '-1';
  14. window.onload = function() {
  15. sourceText = document.getElementById("ordersource").innerHTML;
  16. run_duty = document.getElementById("run_duty").innerHTML;
  17. tableText = document.getElementById("tableOrder").innerHTML;
  18. document.getElementById("tableOrder").innerHTML = "";
  19. // ticketText = document.getElementById("ticketText").innerHTML;
  20. ticketText = "<div>普通成人票 </div>";
  21. load_order_list_page();
  22. }
  23. function load_order_list_page() {
  24. var currpage = getPar('currpage');
  25. if(!currpage) {
  26. var starttime = $('#starttime').val(); //开始时间
  27. var endtime = $('#endtime').val(); //结束时间
  28. if( starttime == "") {
  29. $('#starttime').val(getDateTime(0));
  30. }
  31. if( endtime == "") {
  32. $('#endtime').val(getDateTime(0));
  33. }
  34. getList(0);
  35. } else {
  36. var currpage = getPar("currpage");
  37. var billingstatus = '';
  38. var mealbounce = '';
  39. var refund = '';
  40. var timelimit = getPar('timelimit');
  41. var starttime = getPar('starttime');
  42. var endtime = getPar('endtime');
  43. var ordersource = getPar('ordersource');
  44. var run_duty = getPar('run_duty');
  45. var orderstatus = getPar('orderstatus');
  46. if(orderstatus) {
  47. $("#minus").find(".btn-primary").removeClass("btn-primary");
  48. $("#minus").find(".btn").addClass("btn-default");
  49. $("#add" + orderstatus).removeClass("btn-default");
  50. $("#add" + orderstatus).addClass("btn-primary");
  51. }
  52. var paystatus = getPar('paystatus');
  53. var moresearch = getPar('moresearch');
  54. var bus_type = getPar('bus_type');
  55. //2016-07-15 新增参数
  56. var start_area = getPar('start_area');
  57. var end_area = getPar('end_area');
  58. var line = decodeURIComponent(getPar('line'));
  59. var run_time = getPar('run_time');
  60. var search_bus_no = getPar('search_bus_no');
  61. var tnowtime = getDateTime(4);
  62. if(!timelimit) {
  63. timelimit = "";
  64. } else {
  65. $('#timelimit').val(timelimit);
  66. }
  67. if(!starttime) {
  68. starttime = "";
  69. } else {
  70. $('#starttime').val(starttime);
  71. }
  72. if(!endtime) {
  73. endtime = "";
  74. } else {
  75. $('#endtime').val(endtime);
  76. }
  77. if(!ordersource) {
  78. ordersource = "";
  79. } {
  80. $('#ordersource').val(ordersource);
  81. }
  82. if(!run_duty) {
  83. run_duty = "";
  84. } {
  85. $('#run_duty').val(run_duty);
  86. }
  87. if(!paystatus) {
  88. paystatus = "";
  89. } else {
  90. $('#paystatus').val(paystatus);
  91. }
  92. if(!moresearch) {
  93. moresearch = "";
  94. } else {
  95. $('#moresearch').val(moresearch);
  96. }
  97. if(!start_area) {
  98. start_area = "";
  99. } else {
  100. $('#start_area').val(start_area);
  101. }
  102. if(!run_time) {
  103. run_time = "";
  104. } else {
  105. $('#run_time').val(run_time);
  106. }
  107. if(!end_area) {
  108. end_area = "";
  109. } else {
  110. $('#end_area').val(end_area);
  111. }
  112. if(!line) {
  113. line = "";
  114. } else {
  115. $('#line').val(line);
  116. }
  117. if(!bus_type){
  118. bus_type="";
  119. }else{
  120. $('#select_bus_type').val(bus_type);
  121. }
  122. if(!search_bus_no){
  123. search_bus_no="";
  124. }else{
  125. $('#search_bus_no').val(search_bus_no);
  126. }
  127. var myURL =
  128. "./st-xm/Api/order_list.php?tt=" + tnowtime +
  129. "&timelimit=" + timelimit +
  130. "&starttime=" + starttime +
  131. "&endtime=" + endtime +
  132. "&ordersource=" + ordersource +
  133. "&orderstatus=" + orderstatus +
  134. "&bus_type=" + bus_type +
  135. "&paystatus=" + paystatus +
  136. "&billingstatus=" + billingstatus +
  137. "&mealbounce=" + mealbounce +
  138. "&refund=" + refund +
  139. "&moresearch=" + moresearch +
  140. "&start_area=" + start_area +
  141. "&end_area=" + end_area +
  142. "&line=" + encodeURIComponent(line) +
  143. "&currpage=" + currpage +
  144. "&pagesize=" + pagesize +
  145. "&run_time="+run_time +
  146. "&search_bus_no="+search_bus_no +
  147. "&run_duty="+ run_duty;
  148. var myURL2 = "./order_list.html?tt=" + tnowtime +
  149. "&timelimit=" + timelimit +
  150. "&starttime=" + starttime +
  151. "&endtime=" + endtime +
  152. "&ordersource=" + ordersource +
  153. "&bus_type=" + bus_type +
  154. "&orderstatus=" + orderstatus +
  155. "&paystatus=" + paystatus +
  156. "&billingstatus=" + billingstatus +
  157. "&mealbounce=" + mealbounce +
  158. "&refund=" + refund +
  159. "&moresearch=" + moresearch +
  160. "&start_area=" + start_area +
  161. "&end_area=" + end_area +
  162. "&line=" + encodeURIComponent(line)
  163. // +"&currpage="+currpage
  164. +
  165. "&pagesize=" + pagesize +
  166. "&run_time=" + run_time +
  167. "&search_bus_no="+search_bus_no +
  168. "&run_duty="+ run_duty;
  169. method(myURL, myURL2);
  170. }
  171. }
  172. function getList(index) {
  173. $("#minus").find(".btn-primary").removeClass("btn-primary");
  174. $("#minus").find(".btn").addClass("btn-default");
  175. $("#add" + index).removeClass("btn-default");
  176. $("#add" + index).addClass("btn-primary");
  177. click_type_id = index;
  178. var timelimit = $('#timelimit').val(); //时间类型
  179. var starttime = $('#starttime').val(); //开始时间
  180. var endtime = $('#endtime').val(); //结束时间
  181. //var ordersource=$('#ordersource').val();//订单渠道
  182. var ordersource = order_from_id; //订单渠道
  183. order_from_id = ordersource;
  184. var paystatus = $('#paystatus').val(); //支付状态
  185. var bus_type = $('#select_bus_type').val();//bus类型
  186. /*以下三个条件暂时隐藏,''代替传入参数
  187. var billingstatus=document.getElementById("billingstatus").value;
  188. var mealbounce=document.getElementById("mealbounce").value;
  189. var refund=document.getElementById("refund").value;
  190. */
  191. var billingstatus = '';
  192. var mealbounce = '';
  193. var refund = '';
  194. var moresearch = document.getElementById("moresearch").value;
  195. //2016-07-15新增参数
  196. var start_area = $('#start_area').val();
  197. var end_area = $('#end_area').val();
  198. var line = $('#line').val();
  199. var run_time = $("#run_time").val();
  200. var search_bus_no = $("#search_bus_no").val();
  201. var tnowtime = getDateTime(4);
  202. var run_duty = run_duty_id;
  203. run_duty_id = run_duty;
  204. var myURL =
  205. "./st-xm/Api/order_list.php?tt=" + tnowtime +
  206. "&timelimit=" + timelimit +
  207. "&starttime=" + starttime +
  208. "&endtime=" + endtime +
  209. "&ordersource=" + ordersource +
  210. "&orderstatus=" + index +
  211. "&bus_type=" + bus_type +
  212. "&paystatus=" + paystatus +
  213. "&billingstatus=" + billingstatus +
  214. "&mealbounce=" + mealbounce +
  215. "&refund=" + refund +
  216. "&moresearch=" + moresearch +
  217. "&start_area=" + start_area +
  218. "&end_area=" + end_area +
  219. "&line=" + encodeURIComponent(line) +
  220. "&currpage=1" +
  221. "&pagesize=" + pagesize +
  222. "&run_time=" + run_time +
  223. "&search_bus_no=" + search_bus_no +
  224. "&run_duty="+ run_duty;
  225. var myURL2 = "./order_list.html?tt=" + tnowtime +
  226. "&timelimit=" + timelimit +
  227. "&starttime=" + starttime +
  228. "&endtime=" + endtime +
  229. "&ordersource=" + ordersource +
  230. "&orderstatus=" + index +
  231. "&bus_type=" + bus_type +
  232. "&paystatus=" + paystatus +
  233. "&billingstatus=" + billingstatus +
  234. "&mealbounce=" + mealbounce +
  235. "&refund=" + refund +
  236. "&moresearch=" + moresearch +
  237. "&start_area=" + start_area +
  238. "&end_area=" + end_area +
  239. "&line=" + encodeURIComponent(line)
  240. // +"&currpage="+currpage
  241. +
  242. "&pagesize=" + pagesize +
  243. "&run_time=" + run_time +
  244. "&search_bus_no=" + search_bus_no +
  245. "&run_duty="+ run_duty;
  246. method(myURL, myURL2);
  247. $('#ordersource').val(order_from_id);
  248. $('#run_duty').val(run_duty_id);
  249. }
  250. function cancel(orderNumber) {
  251. swal({
  252. title: '请输入取消原因',
  253. input: 'text',
  254. showCancelButton: true,
  255. cancelButtonText: '返 回',
  256. confirmButtonText: '确 定',
  257. showLoaderOnConfirm: true,
  258. allowOutsideClick: false
  259. }).then(function (email) {
  260. cancel_temp( email );
  261. })
  262. function cancel_temp( cancel ){
  263. var url = "./st-xm/Api/order_list.php?method=cancelOrder&reason="+cancel+"&clock="+CurrentTime()+"&order_id=" + orderNumber;
  264. $.getJSON(url, function(res_data) {
  265. if(res_data['code'] != "0") {
  266. swal(
  267. '订单取消失败',
  268. res_data['info'],
  269. 'error'
  270. );
  271. return;
  272. }
  273. swal({
  274. title: '订单取消成功',
  275. type: 'success',
  276. timer: 20000,
  277. confirmButtonText: 'OK'
  278. }).then(
  279. function () { load_order_list_page(); },
  280. // handling the promise rejection
  281. function (dismiss) {
  282. load_order_list_page();
  283. }
  284. )
  285. })
  286. }
  287. }
  288. function copy_order( bus_type, run_id, start_area_id, end_area_id, start_station_id, end_station_id ) {
  289. window.location.href="/web/orderManager/single_order.html?line_type=" + bus_type + "&run_id=" + run_id + "&start_area_id=" + start_area_id + "&end_area_id=" + end_area_id + "&start_station_id=" + start_station_id + "&end_station_id=" + end_station_id;
  290. }
  291. function meal(orderNumber) {
  292. alert("改签订单:编号为" + orderNumber);
  293. }
  294. function refund(orderNumber) {
  295. alert("退票订单:编号为" + orderNumber);
  296. }
  297. // 复选框事件
  298. function select_checked(index) {
  299. //index=0最上面的全选 index=1表示的是下面所有的
  300. var cur_check = $('.ace')[0];
  301. var checkList = $('.ace');
  302. var checkCount = checkList.length - 1;
  303. var true_count = 0;
  304. for(var i = 1; i < checkList.length; i++) {
  305. if(index == '0') {
  306. checkList[i].checked = cur_check.checked;
  307. } else {
  308. if(checkList[i].checked == false) {
  309. cur_check.checked = false
  310. } else {
  311. true_count = true_count + 1;
  312. }
  313. }
  314. }
  315. //判断下面是否选中完
  316. if(checkCount == true_count) {
  317. cur_check.checked = true;
  318. }
  319. }
  320. function method(myURL, myURL2) {
  321. $.getJSON(myURL, function(res_data) {
  322. $(".filter-item1").click(function() {
  323. order_from_id = $(this).val();
  324. });
  325. $(".filter-item2").click(function() {
  326. run_duty_id = $(this).val();
  327. });
  328. $('#test').html('');
  329. //console.log(myURL);
  330. setStorJson("res_data", res_data);
  331. httpData = res_data;
  332. //console.log(httpData.totalTickets);
  333. //console.log(httpData.totalGmv);
  334. //console.log(httpData.totalPeople);
  335. //总GMV
  336. var totalGmv = httpData.totalGmv
  337. $('#GMV_sum').html(totalGmv);
  338. var orderCount = httpData.totalTickets;
  339. if(orderCount == null){
  340. $('#orderCount').html(0);
  341. }else{
  342. $('#orderCount').html(orderCount);
  343. }
  344. var totalPeople = httpData.totalPeople;
  345. if(totalPeople = null){
  346. $('#people_sum').html(0);
  347. }else{
  348. $('#people_sum').html(httpData.totalPeople);
  349. }
  350. var code = httpData.code;
  351. if(code != "0") {
  352. alert(httpData.info);
  353. if(httpData.info=="用户未登录"){
  354. window.location.href="http://cs.zhizhuchuxing.com";
  355. }
  356. return;
  357. }
  358. //..显示 类型上面的数字
  359. if(httpData['orderStatus']) {
  360. var orderStatus = httpData['orderStatus'][0];
  361. if(click_type_id == "0" || click_type_id == 0) {
  362. $('#orderAll').html(orderStatus['status_all']);
  363. }
  364. if(httpData['orderPaid']='0'){
  365. $("#orderPaid").text("0");
  366. }
  367. if(httpData['orderIssued']='0'){
  368. $("#orderIssued").text("0");
  369. }
  370. if(httpData['orderCompleted']='0'){
  371. $("#orderCompleted").text("0");
  372. }
  373. if(httpData['orderCanceled']='0'){
  374. $("#orderCanceled").text("0");
  375. }
  376. $('#orderPaid').html(orderStatus['145']);
  377. $('#orderIssued').html(orderStatus['146']);
  378. $('#orderCompleted').html(orderStatus['147']);
  379. $('#orderCanceled').html(orderStatus['148']);
  380. }else{
  381. $("#orderAll").text("0");
  382. $("#orderPaid").text("0");
  383. $("#orderIssued").text("0");
  384. $("#orderCompleted").text("0");
  385. $("#orderCanceled").text("0");
  386. }
  387. var orderAll = document.getElementById("orderAll");
  388. var orderPaid = document.getElementById("orderPaid");
  389. var orderIssued = document.getElementById("orderIssued");
  390. var orderCompleted = document.getElementById("orderCompleted");
  391. var orderCanceled = document.getElementById("orderCanceled")
  392. var all = '';
  393. var paid = '';
  394. var issued = '';
  395. var completed = '';
  396. var canceled = '';
  397. //订单来源下拉框
  398. //var orderSource = document.getElementById("ordersource");
  399. // var newHtml = '';
  400. // newHtml = sourceText;
  401. // if(httpData.orderSource){
  402. // for (var i = 0;i<httpData.orderSource.length;i++) {
  403. // var source = sourceText;
  404. // // source = source.replace('selected="selected"','');
  405. // source = source.replace('-1',httpData.orderSource[i].org_id);
  406. // source = source.replace('item_1',httpData.orderSource[i].soure);
  407. // source = source.replace('请选择', httpData.orderSource[i].soure);
  408. // newHtml += source;
  409. // }
  410. // }
  411. // orderSource.innerHTML=newHtml;
  412. //表格
  413. orderSource = document.getElementById("tableOrder");
  414. newHtml = ""
  415. if(httpData.orderList) {
  416. //var GMV_sum =0;
  417. for(var i = 0; i < httpData.orderList.length; i++) {
  418. var dict=httpData.orderList[i];
  419. var source = tableText;
  420. source = source.replace('[oneCheck]',dict['parent_orderNo']);
  421. source = source.replace('[order_id]', dict['parent_orderNo']);
  422. source = source.replace('[order_id2]', dict['parent_orderNo']);
  423. source = source.replace('[order_id3]', dict['parent_orderNo']);
  424. source = source.replace('[order_id4]', dict['parent_orderNo']);
  425. source = source.replace('订单编号', dict['parent_orderNo']);
  426. source = source.replace('下单时间', dict['create_time']);
  427. if(dict['org_name']==""){
  428. source = source.replace('订单来源', '-');
  429. }else{
  430. source = source.replace('订单来源', dict['org_name']);
  431. }
  432. if(dict['sub_channel_name']==""){
  433. source = source.replace('销售终端', '-');
  434. }else{
  435. source = source.replace('销售终端', dict['sub_channel_name']);
  436. }
  437. source = source.replace('[备注]', dict['remark']);
  438. source = source.replace('[备注2]', dict['remark']);
  439. source = source.replace('run_duty_name', dict['run_duty_name']?dict['run_duty_name']:'');
  440. source = source.replace('[出行人]', dict['passenger_info']);
  441. source = source.replace('[地址]', dict['customer_address']);
  442. source = source.replace('[地址2]', dict['customer_address']);
  443. source = source.replace('渠道订单号', dict['outside_order_no']);
  444. source = source.replace('销售终端号', dict['sub_channel_no']);
  445. source = source.replace('line', decodeURIComponent(dict['line']));
  446. var tt="("+dict['start_station']+")"+"-"+"("+dict['end_station']+")";
  447. source = source.replace('预订产品', tt);
  448. source = source.replace('<div>普通成人票 </div>', dict['seat'].replace('[br /]','<br />'));
  449. // var tk = '';
  450. // tk = httpData.orderList[i].predeterminedProduct.ticket;
  451. // for(var item1 in httpData.orderList[i].predeterminedProduct.ticket){
  452. // var text=ticketText;
  453. //// tk += text.replace('普通成人票', item1+' × '+httpData.orderList[i].predeterminedProduct.ticket[item1]);
  454. // tk += text.replace('普通成人票',item1);
  455. // }
  456. // source = source.replace('<div>普通成人票 </div>', tk);
  457. // if(httpData.orderList[i].predeterminedProduct.ordinary){
  458. // source = source.replace('普通成人票', '普通成人票 × '+httpData.orderList[i].predeterminedProduct.ordinary);
  459. // }else{
  460. // source = source.replace('普通成人票', '');
  461. // }
  462. // if(httpData.orderList[i].predeterminedProduct.vip){
  463. // source = source.replace('贵宾成人票', '贵宾成人票 × '+httpData.orderList[i].predeterminedProduct.vip);
  464. // }else{
  465. // source = source.replace('贵宾成人票', '');
  466. // }
  467. source = source.replace('出发时间', dict['travel_time']);
  468. source = source.replace('name', dict['contacts']);
  469. source = source.replace('phone', dict['tel']);
  470. source = source.replace('GMV', dict['order_price']);
  471. //GMV_sum += parseInt(dict['order_price']); ;
  472. //console.log(GMV_sum); //当前页面的总GMV
  473. //source = source.replace('phone', dict['tel']);
  474. source = source.replace('pay_type',dict['pay_type'])
  475. var start_time = dict['travel_time'];
  476. var cur_time = getDateTime(0) + " " + getDateTime(2);
  477. // 判断日期是否合理
  478. var date1 = new Date(start_time.replace(/\-/g, '/'));
  479. var date2 = new Date(cur_time.replace(/\-/g, '/'));
  480. //if(date2 > date1) {
  481. //source = source.replace('cancelOrder', '');
  482. // source = source.replace('mealOrder', '');
  483. // source = source.replace('refundOrder', '');
  484. //}
  485. //if(httpData.orderList[i].run_status != "138") {
  486. // source = source.replace('cancelOrder', '');
  487. //}
  488. if( dict['order_title_id'] > 0 || dict['agent_level'] > 1 ) {
  489. if( dict['order_title_id'] > 0 ) {
  490. source = source.replace('[orderType]', '<span class="label btn-success">组</span>');
  491. } else {
  492. source = source.replace('[orderType]', '<span class="label label-primary">单</span>');
  493. }
  494. source = source.replace('cancel(0)', 'cancel(' + dict['parent_orderNo'] + ')');
  495. source = source.replace('meal(0)', 'meal(' + dict['parent_orderNo'] + ')');
  496. source = source.replace('refund(0)', 'refund(' + dict['parent_orderNo'] + ')');
  497. source = source.replace('[btn]', '');
  498. source = source.replace('[btn-link-y]', '');
  499. source = source.replace('[btn-xs]', '');
  500. source = source.replace('cancelOrder', '');
  501. source = source.replace('mealOrder', '');
  502. source = source.replace('refundOrder', '');
  503. } else {
  504. source = source.replace('[orderType]', '<span class="label label-primary">单</span>');
  505. }
  506. var or_st=dict['order_status'];
  507. if(or_st == "145") {
  508. source = source.replace('状态', '待支付');
  509. //paid = paid - 0 + 1;
  510. //all = all - 0 + 1;
  511. source = source.replace('cancel(0)', 'cancel(' + dict['parent_orderNo'] + ')');
  512. source = source.replace('meal(0)', 'meal(' + dict['parent_orderNo'] + ')');
  513. source = source.replace('refund(0)', 'refund(' + dict['parent_orderNo'] + ')');
  514. source = source.replace('[btn]', 'btn');
  515. source = source.replace('[btn-link-y]', 'btn-link-y');
  516. source = source.replace('[btn-xs]', 'btn-xs');
  517. source = source.replace('cancelOrder', '取消 ');
  518. source = source.replace('mealOrder', '');
  519. source = source.replace('refundOrder', '');
  520. } else if(or_st == "146") {
  521. source = source.replace('状态', '已出票');
  522. //issued = issued - 0 + 1;
  523. //all = all - 0 + 1;
  524. source = source.replace('cancel(0)', 'cancel(' + dict['parent_orderNo'] + ')');
  525. source = source.replace('meal(0)', 'meal(' + dict['parent_orderNo'] + ')');
  526. source = source.replace('refund(0)', 'refund(' + dict['parent_orderNo'] + ')');
  527. source = source.replace('[btn]', 'btn');
  528. source = source.replace('[btn-link-y]', 'btn-link-y');
  529. source = source.replace('[btn-xs]', 'btn-xs');
  530. source = source.replace('cancelOrder', '取消');
  531. source = source.replace('mealOrder', ' ');
  532. source = source.replace('refundOrder', ' ');
  533. } else if(or_st == "147") {
  534. source = source.replace('状态', '已完成');
  535. //completed = completed - 0 + 1;
  536. //all = all - 0 + 1;
  537. source = source.replace('cancel(0)', 'cancel(' + dict['parent_orderNo'] + ')');
  538. source = source.replace('meal(0)', 'meal(' + dict['parent_orderNo'] + ')');
  539. source = source.replace('refund(0)', 'refund(' + dict['parent_orderNo'] + ')');
  540. source = source.replace('[btn]', 'btn');
  541. source = source.replace('[btn-link-y]', 'btn-link-y');
  542. source = source.replace('[btn-xs]', 'btn-xs');
  543. source = source.replace('cancelOrder', '取消');
  544. source = source.replace('mealOrder', '');
  545. source = source.replace('refundOrder', '');
  546. } else if(or_st == "148") {
  547. source = source.replace('状态', '已取消');
  548. //canceled = canceled - 0 + 1;
  549. //all = all - 0 + 1;
  550. source = source.replace('cancel(0)', 'cancel(' + dict['parent_orderNo'] + ')');
  551. source = source.replace('meal(0)', 'meal(' + dict['parent_orderNo'] + ')');
  552. source = source.replace('refund(0)', 'refund(' + dict['parent_orderNo'] + ')');
  553. source = source.replace('[btn]', '');
  554. source = source.replace('[btn-link-y]', '');
  555. source = source.replace('[btn-xs]', '');
  556. source = source.replace('cancelOrder', '');
  557. source = source.replace('mealOrder', '');
  558. source = source.replace('refundOrder', '');
  559. } else {
  560. source = source.replace('状态', '待支付');
  561. //all = all - 0 + 1;
  562. source = source.replace('cancel(0)', 'cancel(' + dict['parent_orderNo'] + ')');
  563. source = source.replace('meal(0)', 'meal(' + dict['parent_orderNo'] + ')');
  564. source = source.replace('refund(0)', 'refund(' + dict['parent_orderNo'] + ')');
  565. source = source.replace('cancelOrder', '取消');
  566. source = source.replace('mealOrder', '');
  567. source = source.replace('refundOrder', '');
  568. }
  569. if( dict['run_id'] == 0 ) {
  570. source = source.replace('copyOrder', '');
  571. } else {
  572. source = source.replace('copy_order(0)', 'copy_order(' + dict['bus_type'] + ',' + dict['run_id'] + ',' + dict['start_area_id'] + ',' + dict['end_area_id'] + ',' + dict['start_station_id'] + ',' + dict['end_station_id'] + ')');
  573. source = source.replace('copyOrder', '再次下单');
  574. }
  575. newHtml += source;
  576. }
  577. }
  578. if(newHtml) {
  579. orderSource.innerHTML = newHtml;
  580. var currpage = getPar("currpage");
  581. if(currpage) {} else {
  582. currpage = 1;
  583. }
  584. $('#page').html('');
  585. var sum = httpData.totalTickets;
  586. var tag = "page";
  587. getPager(myURL2, sum, currpage, pagesize, tag, 'currpage');
  588. document.getElementById("sum").innerHTML = "共"+sum+"条数据";
  589. $('#tableOrder').show();
  590. }else {
  591. $('#tableOrder').hide();
  592. $('#page').html('');
  593. document.getElementById("sum").innerHTML = "共0条数据";
  594. orderSource.innerHTML = "";
  595. }
  596. // if(all){
  597. // orderAll.style.display="inline";
  598. // orderAll.innerText=all
  599. // }
  600. // if(paid){
  601. // orderPaid.style.display="inline";
  602. // orderPaid.innerText=paid
  603. // }
  604. // if(issued){
  605. // orderIssued.style.display="inline";
  606. // orderIssued.innerText=issued
  607. // }
  608. // if(completed){
  609. // orderCompleted.style.display="inline";
  610. // orderCompleted.innerText=completed
  611. // }
  612. // if(canceled){
  613. // orderCanceled.style.display="inline";
  614. // orderCanceled.innerText=canceled
  615. // }
  616. });
  617. }
  618. //.. 导出游客信息
  619. function exportToExcel(obj_this) {
  620. var btn_obj=$(obj_this);
  621. if(btn_obj.html()=="正在导出中。。。"){
  622. return;
  623. }
  624. btn_obj.html('正在导出中。。。');
  625. var starttime = $("#starttime").val();
  626. var endtime = $('#endtime').val();
  627. var timelimit = $('#timelimit').val(); //时间类型
  628. var ordersource = order_from_id; //订单渠道
  629. var paystatus = $('#paystatus').val(); //支付状态
  630. var billingstatus = '';
  631. var mealbounce = '';
  632. var refund = '';
  633. var bus_type = $('#select_bus_type').val();
  634. var moresearch = document.getElementById("moresearch").value;
  635. //2016-07-15新增参数
  636. var start_area = $('#start_area').val();
  637. var end_area = $('#end_area').val();
  638. var line = $('#line').val();
  639. var run_time = $("#run_time").val();
  640. var search_bus_no = $("#search_bus_no").val();
  641. var run_duty = run_duty_id;
  642. var url =
  643. "./st-xm/Api/order_list2.php?tt=" + getDateTime(4) +
  644. "&timelimit=" + timelimit +
  645. "&starttime=" + starttime +
  646. "&endtime=" + endtime +
  647. "&ordersource=" + ordersource +
  648. "&orderstatus=" + click_type_id +
  649. "&paystatus=" + paystatus +
  650. "&billingstatus=" + billingstatus +
  651. "&mealbounce=" + mealbounce +
  652. "&refund=" + refund +
  653. "&moresearch=" + moresearch +
  654. "&start_area=" + start_area +
  655. "&end_area=" + end_area +
  656. "&line=" + line +
  657. "&bus_type="+bus_type+
  658. "&currpage=1" +
  659. "&pagesize=999999" +
  660. "&run_time=" + run_time +
  661. "&search_bus_no=" + search_bus_no +
  662. "&run_duty="+ run_duty;
  663. var listURL = url;
  664. // 跳转前将URL编码
  665. listURL = encodeURI(listURL);
  666. window.location.href = listURL;
  667. btn_obj.html('<span class="glyphicon glyphicon-save"></span> 订单导出');
  668. }
  669. function exportToExcel2(obj_this) {
  670. var btn_obj=$(obj_this);
  671. if(btn_obj.html()=="正在导出中。。。"){
  672. return;
  673. }
  674. btn_obj.html('正在导出中。。。');
  675. var starttime = $("#starttime").val();
  676. var endtime = $('#endtime').val();
  677. var timelimit = $('#timelimit').val(); //时间类型
  678. var ordersource = order_from_id; //订单渠道
  679. var paystatus = $('#paystatus').val(); //支付状态
  680. var billingstatus = '';
  681. var mealbounce = '';
  682. var refund = '';
  683. var bus_type = $('#select_bus_type').val();
  684. var moresearch = document.getElementById("moresearch").value;
  685. //2016-07-15新增参数
  686. var start_area = $('#start_area').val();
  687. var end_area = $('#end_area').val();
  688. var line = $('#line').val();
  689. var run_time = $("#run_time").val();
  690. var search_bus_no = $("#search_bus_no").val();
  691. var run_duty = run_duty_id;
  692. var url =
  693. "./st-xm/Api/order_list2.php?tt=" + getDateTime(4) +
  694. "&cusmo=1" +
  695. "&timelimit=" + timelimit +
  696. "&starttime=" + starttime +
  697. "&endtime=" + endtime +
  698. "&ordersource=" + ordersource +
  699. "&orderstatus=" + click_type_id +
  700. "&paystatus=" + paystatus +
  701. "&billingstatus=" + billingstatus +
  702. "&mealbounce=" + mealbounce +
  703. "&refund=" + refund +
  704. "&moresearch=" + moresearch +
  705. "&start_area=" + start_area +
  706. "&end_area=" + end_area +
  707. "&line=" + line +
  708. "&bus_type="+bus_type+
  709. "&currpage=1" +
  710. "&pagesize=999999" +
  711. "&run_time=" + run_time +
  712. "&search_bus_no=" + search_bus_no +
  713. "&run_duty="+ run_duty;
  714. var listURL = url;
  715. // 跳转前将URL编码
  716. listURL = encodeURI(listURL);
  717. window.location.href = listURL;
  718. btn_obj.html('<span class="glyphicon glyphicon-save"></span> 乘客导出');
  719. }
  720. function getDateTime(nTypeFlag) {
  721. var tNowTime = new Date();
  722. var myYear = ';' + tNowTime.getFullYear() + ';';
  723. var myMonth = ';' + (tNowTime.getMonth() + 1 - 0) + ';';
  724. var myDay = ';' + tNowTime.getDate() + ';';
  725. var myHour = ';' + tNowTime.getHours() + ';';
  726. var myMinu = ';' + tNowTime.getMinutes() + ';';
  727. var mySecond = ';' + tNowTime.getSeconds() + ';';
  728. if(myMonth.length < 4) myMonth = '0' + myMonth;
  729. if(myDay.length < 4) myDay = '0' + myDay;
  730. if(myHour.length < 4) myHour = '0' + myHour;
  731. if(myMinu.length < 4) myMinu = '0' + myMinu;
  732. if(mySecond.length < 4) mySecond = '0' + mySecond;
  733. var cNewTimeStr;
  734. //alert(tNowTime);
  735. switch(nTypeFlag + 1 - 1) {
  736. case 0:
  737. cNewTimeStr = myYear + '-' + myMonth + '-' + myDay;
  738. break;
  739. case 1:
  740. cNewTimeStr = myYear + myMonth + myDay;
  741. break;
  742. case 2:
  743. cNewTimeStr = myHour + ':' + myMinu + ':' + mySecond;
  744. break;
  745. case 3:
  746. cNewTimeStr = myHour + myMinu + mySecond;
  747. break;
  748. case 4:
  749. cNewTimeStr = myYear + myMonth + myDay + myHour + myMinu + mySecond;
  750. break;
  751. case 5:
  752. cNewTimeStr = myYear + '年' + myMonth + '月' + myDay + '日';
  753. break;
  754. case 6:
  755. cNewTimeStr = myYear;
  756. break;
  757. case 7:
  758. cNewTimeStr = myYear + '-' + myMonth;
  759. break;
  760. case 8: //得到上一个月的今天
  761. var date = getDateTime(0);
  762. var arr = date.split('-');
  763. var year = arr[0]; //获取当前日期的年份
  764. var month = arr[1]; //获取当前日期的月份
  765. var day = arr[2]; //获取当前日期的日
  766. var days = new Date(year, month, 0);
  767. days = days.getDate(); //获取当前日期中月的天数
  768. var year2 = year;
  769. var month2 = parseInt(month) - 1;
  770. if(month2 == 0) {
  771. year2 = parseInt(year2) - 1;
  772. month2 = 12;
  773. }
  774. var day2 = day;
  775. var days2 = new Date(year2, month2, 0);
  776. days2 = days2.getDate();
  777. if(day2 > days2) {
  778. day2 = days2;
  779. }
  780. if(month2 < 10) {
  781. month2 = '0' + month2;
  782. }
  783. cNewTimeStr = year2 + '-' + month2 + '-' + day2;
  784. break;
  785. case 9: //得到下一个月的今天
  786. var date = getDateTime(0);
  787. var arr = date.split('-');
  788. var year = arr[0]; //获取当前日期的年份
  789. var month = arr[1]; //获取当前日期的月份
  790. var day = arr[2]; //获取当前日期的日
  791. var days = new Date(year, month, 0);
  792. days = days.getDate(); //获取当前日期中的月的天数
  793. var year2 = year;
  794. var month2 = parseInt(month) + 1;
  795. if(month2 == 13) {
  796. year2 = parseInt(year2) + 1;
  797. month2 = 1;
  798. }
  799. var day2 = day;
  800. var days2 = new Date(year2, month2, 0);
  801. days2 = days2.getDate();
  802. if(day2 > days2) {
  803. day2 = days2;
  804. }
  805. if(month2 < 10) {
  806. month2 = '0' + month2;
  807. }
  808. var t2 = year2 + '-' + month2 + '-' + day2;
  809. return t2;
  810. break;
  811. default:
  812. cNewTimeStr = myYear + '-' + myMonth + '-' + myDay + ' ' + myHour + ':' + myMinu + ':' + mySecond;
  813. break;
  814. }
  815. cNewTimeStr = cNewTimeStr.replace(/;/g, "");
  816. return cNewTimeStr;
  817. }
  818. function getPar(par) {
  819. //获取当前URL
  820. var local_url = document.location.href;
  821. local_url = decodeURI(local_url);
  822. //获取要取得的get参数位置
  823. var get = local_url.indexOf(par + "=");
  824. if(get == -1) {
  825. return "";
  826. }
  827. //截取字符串
  828. var get_par = local_url.slice(par.length + get + 1);
  829. //判断截取后的字符串是否还有其他get参数
  830. var nextPar = get_par.indexOf("&");
  831. if(nextPar != -1) {
  832. get_par = get_par.slice(0, nextPar);
  833. }
  834. return get_par;
  835. }
  836. //设置字符串类型的本地缓存
  837. function setStorage(objName, objValue) {
  838. var sto = window.localStorage;
  839. if(sto)
  840. sto.setItem(objName, objValue);
  841. }
  842. //读取字符串类型的本地缓存
  843. function getStorage(objName) {
  844. var ret = '';
  845. var sto = window.localStorage;
  846. if(sto)
  847. ret = sto.getItem(objName);
  848. return ret;
  849. }
  850. //清除本地缓存,如没指定名称则为清空所有缓存
  851. function clearStorage(objName) {
  852. var sto = window.localStorage;
  853. if(sto) {
  854. if(objName)
  855. sto.removeItem(objName);
  856. else
  857. sto.clear();
  858. }
  859. }
  860. //设置Json类型的本地缓存
  861. function setStorJson(objName, json) {
  862. if(json)
  863. setStorage(objName, JSON.stringify(json));
  864. }
  865. //读取Json类型的本地缓存
  866. function getStorJson(objName) {
  867. var ret = null;
  868. var str = getStorage(objName);
  869. if(str)
  870. ret = JSON.parse(str);
  871. return ret;
  872. }
  873. //获取当前时间
  874. function CurrentTime() {
  875. var now = new Date();
  876. var year = now.getFullYear(); //年
  877. var month = now.getMonth() + 1; //月
  878. var day = now.getDate(); //日
  879. var hh = now.getHours(); //时
  880. var mm = now.getMinutes(); //分
  881. var ss = now.getSeconds(); //秒
  882. var clock = year + "-";
  883. if (month < 10)
  884. clock += "0";
  885. clock += month + "-";
  886. if (day < 10)
  887. clock += "0";
  888. clock += day + " ";
  889. if (hh < 10)
  890. clock += "0";
  891. clock += hh + ":";
  892. if (mm < 10) clock += '0';
  893. clock += mm + ":";
  894. if (ss < 10) clock += '0';
  895. clock += ss;
  896. return (clock);
  897. }
  898. //复选框判断
  899. function select_checked(index) {
  900. //index=0最上面的全选 index=1表示的是下面所有的
  901. var cur_check = $('.ace_check')[0];
  902. var checkList = $('.ace_check');
  903. var checkCount = checkList.length - 1;
  904. var true_count = 0;
  905. for (var i = 1; i < checkList.length; i++) {
  906. if (index == '0') {
  907. checkList[i].checked = cur_check.checked;
  908. } else {
  909. if (checkList[i].checked == false) {
  910. cur_check.checked = false
  911. } else {
  912. true_count = true_count + 1;
  913. }
  914. }
  915. }
  916. //判断下面是否选中完
  917. if (checkCount == true_count) {
  918. cur_check.checked = true;
  919. }
  920. }
  921. //修改备注
  922. function change_customer_memo(order_id, customer_memo) {
  923. swal({
  924. title: '请输入备注',
  925. input: 'textarea',
  926. inputValue: customer_memo,
  927. showCancelButton: true,
  928. cancelButtonText: '返 回',
  929. confirmButtonText: '确 定',
  930. showLoaderOnConfirm: true,
  931. allowOutsideClick: false
  932. }).then(function (email) {
  933. change_memo( order_id, email );
  934. })
  935. function change_memo( order_id, new_memo ){
  936. $.ajax({
  937. url: './st-xm/control.php',
  938. type: "post",
  939. data: {
  940. order_id: order_id,
  941. new_memo: new_memo,
  942. type: "des_changememo"
  943. },
  944. dataType: "json",
  945. success: function (data) {
  946. if (data.code == 0) {
  947. swal({
  948. title: '修改备注成功',
  949. type: 'success',
  950. timer: 20000,
  951. confirmButtonText: 'OK'
  952. }).then(
  953. function () { location.replace(location.href); },
  954. function (dismiss) {
  955. location.replace(location.href);
  956. }
  957. )
  958. } else {
  959. swal(
  960. '修改备注失败',
  961. ' ',
  962. 'error'
  963. );
  964. return;
  965. }
  966. },
  967. fail: function (data) {
  968. swal(
  969. '修改备注失败',
  970. ' ',
  971. 'error'
  972. );
  973. return;
  974. }
  975. });
  976. }
  977. }
  978. //修改备注
  979. function change_customer_address(order_id, customer_address) {
  980. swal({
  981. title: '请输入用户地址',
  982. input: 'textarea',
  983. inputValue: customer_address,
  984. showCancelButton: true,
  985. cancelButtonText: '返 回',
  986. confirmButtonText: '确 定',
  987. showLoaderOnConfirm: true,
  988. allowOutsideClick: false
  989. }).then(function (email) {
  990. change_address( order_id, email );
  991. })
  992. function change_address( order_id, new_memo ){
  993. $.ajax({
  994. url: './st-xm/control.php',
  995. type: "post",
  996. data: {
  997. order_id: order_id,
  998. new_address: new_memo,
  999. type: "des_changeaddress"
  1000. },
  1001. dataType: "json",
  1002. success: function (data) {
  1003. if (data.code == 0) {
  1004. swal({
  1005. title: '修改地址成功',
  1006. type: 'success',
  1007. timer: 20000,
  1008. confirmButtonText: 'OK'
  1009. }).then(
  1010. function () { location.replace(location.href); },
  1011. function (dismiss) {
  1012. location.replace(location.href);
  1013. }
  1014. )
  1015. } else {
  1016. swal(
  1017. '修改备注失败',
  1018. ' ',
  1019. 'error'
  1020. );
  1021. return;
  1022. }
  1023. },
  1024. fail: function (data) {
  1025. swal(
  1026. '修改备注失败',
  1027. ' ',
  1028. 'error'
  1029. );
  1030. return;
  1031. }
  1032. });
  1033. }
  1034. }
  1035. //打印功能
  1036. function printInfo(){
  1037. var str = '';
  1038. $('.ace_check').each(function(index, item) {
  1039. if (this.checked && index != 0) {
  1040. var stopid = $(this).attr('checkid');
  1041. //改变账号状态
  1042. str = str + stopid +',';
  1043. }
  1044. });
  1045. order_id = str.substring(0,str.length-1);
  1046. if(!order_id){
  1047. swal('请选择需要打印的订单!');
  1048. return;
  1049. }
  1050. // window.open("./jqprint.html?order_id="+order_id)
  1051. window.open( cs1_path+"/zzcs/ticket-design/to-print-ticket?order_id="+order_id);
  1052. }
  1053. //打印功能
  1054. function sendMessage(){
  1055. var str = '';
  1056. $('.ace_check').each(function(index, item) {
  1057. if (this.checked && index != 0) {
  1058. var stopid = $(this).attr('checkid');
  1059. //改变账号状态
  1060. str = str + stopid +',';
  1061. }
  1062. });
  1063. var order_id_list = str.substring(0,str.length-1);
  1064. if( order_id_list.length <= 0 ) {
  1065. return;
  1066. }
  1067. swal({
  1068. title: '请输入短信内容',
  1069. input: 'textarea',
  1070. inputValue: "",
  1071. showCancelButton: true,
  1072. cancelButtonText: '返 回',
  1073. confirmButtonText: '确 定',
  1074. showLoaderOnConfirm: true,
  1075. allowOutsideClick: false
  1076. }).then(function (email) {
  1077. send_messages( order_id_list, email );
  1078. })
  1079. function send_messages( order_id_list, send_context ){
  1080. $.ajax({
  1081. url: './st-xm/control.php',
  1082. type: "post",
  1083. data: {
  1084. order_id: order_id_list,
  1085. send_context: send_context,
  1086. type: "des_sendmessage"
  1087. },
  1088. dataType: "json",
  1089. success: function (data) {
  1090. if (data.code == 0) {
  1091. swal({
  1092. title: '发送短信成功',
  1093. type: 'success',
  1094. timer: 20000,
  1095. confirmButtonText: 'OK'
  1096. }).then(
  1097. function () { load_order_list_page(); },
  1098. function (dismiss) {
  1099. load_order_list_page();
  1100. }
  1101. )
  1102. } else {
  1103. swal(
  1104. '发送短信失败',
  1105. ' ',
  1106. 'error'
  1107. );
  1108. return;
  1109. }
  1110. },
  1111. fail: function (data) {
  1112. swal(
  1113. '发送短信失败',
  1114. ' ',
  1115. 'error'
  1116. );
  1117. return;
  1118. }
  1119. });
  1120. }
  1121. }
  1122. function contract(order_id){
  1123. window.open( cs1_path+"/zzcs/order/get-contract?order_id="+order_id);
  1124. }