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.
 
 
 
 

772 lines
27 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. window.onload = function() {
  14. sourceText = document.getElementById("ordersource").innerHTML;
  15. tableText = document.getElementById("tableOrder").innerHTML;
  16. document.getElementById("tableOrder").innerHTML = "";
  17. // ticketText = document.getElementById("ticketText").innerHTML;
  18. ticketText = "<div>普通成人票 </div>";
  19. var currpage = getPar('currpage');
  20. if(!currpage) {
  21. $('#starttime').val(getDateTime(0));
  22. $('#endtime').val(getDateTime(0));
  23. getList(145);
  24. } else {
  25. var currpage = getPar("currpage");
  26. var billingstatus = '';
  27. var mealbounce = '';
  28. var refund = '';
  29. var timelimit = getPar('timelimit');
  30. var starttime = getPar('starttime');
  31. var endtime = getPar('endtime');
  32. var ordersource = getPar('ordersource');
  33. var orderstatus = getPar('orderstatus');
  34. var paystatus = getPar('paystatus');
  35. var moresearch = getPar('moresearch');
  36. //2016-07-15 新增参数
  37. var start_area = getPar('start_area');
  38. var end_area = getPar('end_area');
  39. var line = getPar('line');
  40. var tnowtime = getDateTime(4);
  41. if(!timelimit) {
  42. timelimit = "";
  43. } else {
  44. $('#timelimit').val(timelimit);
  45. }
  46. if(!starttime) {
  47. starttime = "";
  48. } else {
  49. $('#starttime').val(starttime);
  50. }
  51. if(!endtime) {
  52. endtime = "";
  53. } else {
  54. $('#endtime').val(endtime);
  55. }
  56. if(!ordersource) {
  57. ordersource = "";
  58. } {
  59. $('#ordersource').val(ordersource);
  60. }
  61. if(!paystatus) {
  62. paystatus = "";
  63. } else {
  64. $('#paystatus').val(paystatus);
  65. }
  66. if(!moresearch) {
  67. moresearch = "";
  68. } else {
  69. $('#moresearch').val(moresearch);
  70. }
  71. if(!start_area) {
  72. start_area = "";
  73. } else {
  74. $('#start_area').val(start_area);
  75. }
  76. if(!end_area) {
  77. end_area = "";
  78. } else {
  79. $('#end_area').val(end_area);
  80. }
  81. if(!line) {
  82. line = "";
  83. } else {
  84. $('#line').val(line);
  85. }
  86. var myURL =
  87. "./st-xm/Api/order_list_zzgl.php?tt=" + tnowtime +
  88. "&timelimit=" + timelimit +
  89. "&starttime=" + starttime +
  90. "&endtime=" + endtime +
  91. "&ordersource=" + ordersource +
  92. "&orderstatus=" + orderstatus +
  93. "&paystatus=" + paystatus +
  94. "&billingstatus=" + billingstatus +
  95. "&mealbounce=" + mealbounce +
  96. "&refund=" + refund +
  97. "&moresearch=" + moresearch +
  98. "&start_area=" + start_area +
  99. "&end_area=" + end_area +
  100. "&line=" + line +
  101. "&currpage=" + currpage +
  102. "&pagesize=" + pagesize;
  103. var myURL2 = "./order_list_zzgl.html?tt=" + tnowtime +
  104. "&timelimit=" + timelimit +
  105. "&starttime=" + starttime +
  106. "&endtime=" + endtime +
  107. "&ordersource=" + ordersource +
  108. "&orderstatus=" + orderstatus +
  109. "&paystatus=" + paystatus +
  110. "&billingstatus=" + billingstatus +
  111. "&mealbounce=" + mealbounce +
  112. "&refund=" + refund +
  113. "&moresearch=" + moresearch +
  114. "&start_area=" + start_area +
  115. "&end_area=" + end_area +
  116. "&line=" + line
  117. // +"&currpage="+currpage
  118. +
  119. "&pagesize=" + pagesize;
  120. method(myURL, myURL2);
  121. }
  122. }
  123. function getList(index) {
  124. // $("#minus").children().children().removeClass("addbackground");
  125. $("#add" + index).addClass("addbackground");
  126. click_type_id = index;
  127. var timelimit = $('#timelimit').val(); //时间类型
  128. var starttime = $('#starttime').val(); //开始时间
  129. var endtime = $('#endtime').val(); //结束时间
  130. //var ordersource=$('#ordersource').val();//订单渠道
  131. var ordersource = order_from_id; //订单渠道
  132. order_from_id = ordersource;
  133. var paystatus = $('#paystatus').val(); //支付状态
  134. /*以下三个条件暂时隐藏,''代替传入参数
  135. var billingstatus=document.getElementById("billingstatus").value;
  136. var mealbounce=document.getElementById("mealbounce").value;
  137. var refund=document.getElementById("refund").value;
  138. */
  139. var billingstatus = '';
  140. var mealbounce = '';
  141. var refund = '';
  142. var moresearch = document.getElementById("moresearch").value;
  143. //2016-07-15新增参数
  144. var start_area = $('#start_area').val();
  145. var end_area = $('#end_area').val();
  146. var line = $('#line').val();
  147. var tnowtime = getDateTime(4);
  148. var myURL =
  149. "./st-xm/Api/order_list_zzgl.php?tt=" + tnowtime +
  150. "&timelimit=" + timelimit +
  151. "&starttime=" + starttime +
  152. "&endtime=" + endtime +
  153. "&ordersource=" + ordersource +
  154. "&orderstatus=" + index +
  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=" + line +
  163. "&currpage=1" +
  164. "&pagesize=" + pagesize;
  165. var myURL2 = "./order_list_zzgl.html?tt=" + tnowtime +
  166. "&timelimit=" + timelimit +
  167. "&starttime=" + starttime +
  168. "&endtime=" + endtime +
  169. "&ordersource=" + ordersource +
  170. "&orderstatus=" + index +
  171. "&paystatus=" + paystatus +
  172. "&billingstatus=" + billingstatus +
  173. "&mealbounce=" + mealbounce +
  174. "&refund=" + refund +
  175. "&moresearch=" + moresearch +
  176. "&start_area=" + start_area +
  177. "&end_area=" + end_area +
  178. "&line=" + line
  179. // +"&currpage="+currpage
  180. +
  181. "&pagesize=" + pagesize;
  182. method(myURL, myURL2);
  183. $('#ordersource').val(order_from_id);
  184. }
  185. function cancel(orderNumber) {
  186. var cancel = window.prompt("请输入取消原因","");
  187. if(cancel){ //点击的是确定
  188. cancel_temp();
  189. }else if(cancel === ""){ //没有输入内窝 点击了取消
  190. cancel_temp();
  191. }else{ //点击了取消
  192. }
  193. function cancel_temp(){
  194. var url = "./st-xm/Api/order_list_zzgl.php?method=cancelOrder&reason="+cancel+"&clock="+CurrentTime()+"&order_id=" + orderNumber;
  195. $.getJSON(url, function(res_data) {
  196. if(res_data['code'] != "0") {
  197. alert(res_data['info']);
  198. return;
  199. }
  200. alert('取消成功');
  201. // getList(0);
  202. location.replace(location.href); //刷新当前页面
  203. })
  204. }
  205. }
  206. function meal(orderNumber) {
  207. alert("改签订单:编号为" + orderNumber);
  208. }
  209. function refund(orderNumber) {
  210. alert("退票订单:编号为" + orderNumber);
  211. }
  212. // 复选框事件
  213. function select_checked(index) {
  214. //index=0最上面的全选 index=1表示的是下面所有的
  215. var cur_check = $('.ace')[0];
  216. var checkList = $('.ace');
  217. var checkCount = checkList.length - 1;
  218. var true_count = 0;
  219. for(var i = 1; i < checkList.length; i++) {
  220. if(index == '0') {
  221. checkList[i].checked = cur_check.checked;
  222. } else {
  223. if(checkList[i].checked == false) {
  224. cur_check.checked = false
  225. } else {
  226. true_count = true_count + 1;
  227. }
  228. }
  229. }
  230. //判断下面是否选中完
  231. if(checkCount == true_count) {
  232. cur_check.checked = true;
  233. }
  234. }
  235. function method(myURL, myURL2) {
  236. $.getJSON(myURL, function(res_data) {
  237. $(".filter-item").click(function() {
  238. order_from_id = $(this).val();
  239. });
  240. $('#tableOrder').css('display', '');
  241. $('#test').html('');
  242. console.log(myURL);
  243. console.log(res_data);
  244. setStorJson("res_data", res_data);
  245. httpData = res_data;
  246. var code = httpData.code;
  247. if(code != "0") {
  248. alert(httpData.info);
  249. return;
  250. }
  251. //..显示 类型上面的数字
  252. if(httpData['orderStatus']) {
  253. var orderStatus = httpData['orderStatus'][0];
  254. if(click_type_id == "0" || click_type_id == 0) {
  255. $('#orderAll').html(orderStatus['status_all']);
  256. }
  257. if(httpData['orderPaid']='0'){
  258. $("#orderPaid").text("0");
  259. }
  260. if(httpData['orderIssued']='0'){
  261. $("#orderIssued").text("0");
  262. }
  263. if(httpData['orderCompleted']='0'){
  264. $("#orderCompleted").text("0");
  265. }
  266. if(httpData['orderCanceled']='0'){
  267. $("#orderCanceled").text("0");
  268. }
  269. $('#orderPaid').html(orderStatus['145']);
  270. $('#orderIssued').html(orderStatus['146']);
  271. $('#orderCompleted').html(orderStatus['147']);
  272. $('#orderCanceled').html(orderStatus['148']);
  273. }else{
  274. $("#orderAll").text("0");
  275. $("#orderPaid").text("0");
  276. $("#orderIssued").text("0");
  277. $("#orderCompleted").text("0");
  278. $("#orderCanceled").text("0");
  279. }
  280. var orderAll = document.getElementById("orderAll");
  281. var orderPaid = document.getElementById("orderPaid");
  282. var orderIssued = document.getElementById("orderIssued");
  283. var orderCompleted = document.getElementById("orderCompleted");
  284. var orderCanceled = document.getElementById("orderCanceled");
  285. var all = '';
  286. var paid = '';
  287. var issued = '';
  288. var completed = '';
  289. var canceled = '';
  290. //订单来源下拉框
  291. //var orderSource = document.getElementById("ordersource");
  292. // var newHtml = '';
  293. // newHtml = sourceText;
  294. // if(httpData.orderSource){
  295. // for (var i = 0;i<httpData.orderSource.length;i++) {
  296. // var source = sourceText;
  297. // // source = source.replace('selected="selected"','');
  298. // source = source.replace('-1',httpData.orderSource[i].org_id);
  299. // source = source.replace('item_1',httpData.orderSource[i].soure);
  300. // source = source.replace('请选择', httpData.orderSource[i].soure);
  301. // newHtml += source;
  302. // }
  303. // }
  304. // orderSource.innerHTML=newHtml;
  305. //表格
  306. orderSource = document.getElementById("tableOrder");
  307. newHtml = ""
  308. if(httpData.orderList) {
  309. for(var i = 0; i < httpData.orderList.length; i++) {
  310. var dict=httpData.orderList[i];
  311. var source = tableText;
  312. source = source.replace('[oneCheck]',dict['parent_orderNo']);
  313. source = source.replace('[order_id]', dict['parent_orderNo']);
  314. source = source.replace('订单编号', dict['parent_orderNo']);
  315. source = source.replace('下单时间', dict['create_time']);
  316. if(dict['org_name']==""){
  317. source = source.replace('订单来源', '-');
  318. }else{
  319. source = source.replace('订单来源', dict['org_name']);
  320. }
  321. source = source.replace('渠道订单号', dict['outside_order_no']);
  322. source = source.replace('line', dict['line']);
  323. var tt="("+dict['start_station']+")"+"-"+"("+dict['end_station']+")";
  324. source = source.replace('预订产品', tt);
  325. source = source.replace('<div>普通成人票 </div>', dict['seat'].replace('[br /]','<br />'));
  326. // var tk = '';
  327. // tk = httpData.orderList[i].predeterminedProduct.ticket;
  328. // for(var item1 in httpData.orderList[i].predeterminedProduct.ticket){
  329. // var text=ticketText;
  330. //// tk += text.replace('普通成人票', item1+' × '+httpData.orderList[i].predeterminedProduct.ticket[item1]);
  331. // tk += text.replace('普通成人票',item1);
  332. // }
  333. // source = source.replace('<div>普通成人票 </div>', tk);
  334. // if(httpData.orderList[i].predeterminedProduct.ordinary){
  335. // source = source.replace('普通成人票', '普通成人票 × '+httpData.orderList[i].predeterminedProduct.ordinary);
  336. // }else{
  337. // source = source.replace('普通成人票', '');
  338. // }
  339. // if(httpData.orderList[i].predeterminedProduct.vip){
  340. // source = source.replace('贵宾成人票', '贵宾成人票 × '+httpData.orderList[i].predeterminedProduct.vip);
  341. // }else{
  342. // source = source.replace('贵宾成人票', '');
  343. // }
  344. source = source.replace('出发时间', dict['travel_time']);
  345. source = source.replace('name', dict['contacts']);
  346. source = source.replace('phone', dict['tel']);
  347. var start_time = dict['travel_time'];
  348. var cur_time = getDateTime(0) + " " + getDateTime(2);
  349. // 判断日期是否合理
  350. var date1 = new Date(start_time.replace(/\-/g, '/'));
  351. var date2 = new Date(cur_time.replace(/\-/g, '/'));
  352. if(date2 > date1) {
  353. source = source.replace('cancelOrder', '');
  354. // source = source.replace('mealOrder', '');
  355. // source = source.replace('refundOrder', '');
  356. }
  357. if(httpData.orderList[i].run_status != "138") {
  358. source = source.replace('cancelOrder', '');
  359. }
  360. var or_st=dict['order_status'];
  361. if(or_st == "145") {
  362. source = source.replace('状态', '待支付');
  363. //paid = paid - 0 + 1;
  364. //all = all - 0 + 1;
  365. source = source.replace('cancel(0)', 'cancel(' + dict['parent_orderNo'] + ')');
  366. source = source.replace('meal(0)', 'meal(' + dict['parent_orderNo'] + ')');
  367. source = source.replace('refund(0)', 'refund(' + dict['parent_orderNo'] + ')');
  368. source = source.replace('cancelOrder', '取消 ');
  369. source = source.replace('mealOrder', '');
  370. source = source.replace('refundOrder', '');
  371. } else if(or_st == "146") {
  372. source = source.replace('状态', '已出票');
  373. //issued = issued - 0 + 1;
  374. //all = all - 0 + 1;
  375. source = source.replace('cancel(0)', 'cancel(' + dict['parent_orderNo'] + ')');
  376. source = source.replace('meal(0)', 'meal(' + dict['parent_orderNo'] + ')');
  377. source = source.replace('refund(0)', 'refund(' + dict['parent_orderNo'] + ')');
  378. source = source.replace('cancelOrder', '取消');
  379. source = source.replace('mealOrder', ' ');
  380. source = source.replace('refundOrder', ' ');
  381. } else if(or_st == "147") {
  382. source = source.replace('状态', '已完成');
  383. //completed = completed - 0 + 1;
  384. //all = all - 0 + 1;
  385. source = source.replace('cancel(0)', 'cancel(' + dict['parent_orderNo'] + ')');
  386. source = source.replace('meal(0)', 'meal(' + dict['parent_orderNo'] + ')');
  387. source = source.replace('refund(0)', 'refund(' + dict['parent_orderNo'] + ')');
  388. source = source.replace('cancelOrder', '');
  389. source = source.replace('mealOrder', '');
  390. source = source.replace('refundOrder', '');
  391. } else if(or_st == "148") {
  392. source = source.replace('状态', '已取消');
  393. //canceled = canceled - 0 + 1;
  394. //all = all - 0 + 1;
  395. source = source.replace('cancel(0)', 'cancel(' + dict['parent_orderNo'] + ')');
  396. source = source.replace('meal(0)', 'meal(' + dict['parent_orderNo'] + ')');
  397. source = source.replace('refund(0)', 'refund(' + dict['parent_orderNo'] + ')');
  398. source = source.replace('cancelOrder', '');
  399. source = source.replace('mealOrder', '');
  400. source = source.replace('refundOrder', '');
  401. } else {
  402. source = source.replace('状态', '待支付');
  403. //all = all - 0 + 1;
  404. source = source.replace('cancel(0)', 'cancel(' + dict['parent_orderNo'] + ')');
  405. source = source.replace('meal(0)', 'meal(' + dict['parent_orderNo'] + ')');
  406. source = source.replace('refund(0)', 'refund(' + dict['parent_orderNo'] + ')');
  407. source = source.replace('cancelOrder', '取消');
  408. source = source.replace('mealOrder', '');
  409. source = source.replace('refundOrder', '');
  410. }
  411. newHtml += source;
  412. }
  413. }
  414. if(newHtml) {
  415. orderSource.innerHTML = newHtml;
  416. var currpage = getPar("currpage");
  417. if(currpage) {} else {
  418. currpage = 1;
  419. }
  420. $('#page').html('');
  421. var sum = httpData.totalTickets;
  422. var tag = "page";
  423. getPager(myURL2, sum, currpage, pagesize, tag, 'currpage');
  424. document.getElementById("sum").innerHTML = "共"+sum+"条数据";
  425. }else {
  426. $('#page').html('');
  427. document.getElementById("sum").innerHTML = "共0条数据";
  428. orderSource.innerHTML = "";
  429. }
  430. // if(all){
  431. // orderAll.style.display="inline";
  432. // orderAll.innerText=all
  433. // }
  434. // if(paid){
  435. // orderPaid.style.display="inline";
  436. // orderPaid.innerText=paid
  437. // }
  438. // if(issued){
  439. // orderIssued.style.display="inline";
  440. // orderIssued.innerText=issued
  441. // }
  442. // if(completed){
  443. // orderCompleted.style.display="inline";
  444. // orderCompleted.innerText=completed
  445. // }
  446. // if(canceled){
  447. // orderCanceled.style.display="inline";
  448. // orderCanceled.innerText=canceled
  449. // }
  450. });
  451. }
  452. //.. 导出游客信息
  453. function exportToExcel(obj_this) {
  454. var btn_obj=$(obj_this);
  455. if(btn_obj.html()=="正在导出中。。。"){
  456. return;
  457. }
  458. btn_obj.html('正在导出中。。。');
  459. var starttime = $("#starttime").val();
  460. var endtime = $('#endtime').val();
  461. // if(!starttime) {
  462. // alert('请输入日期!!!');
  463. // return;
  464. // } else {
  465. // endtime = $('#endtime').val();
  466. // if(endtime == "") {
  467. // endtime = starttime;
  468. // }
  469. // }
  470. var timelimit = $('#timelimit').val(); //时间类型
  471. var ordersource = order_from_id; //订单渠道
  472. var paystatus = $('#paystatus').val(); //支付状态
  473. var billingstatus = '';
  474. var mealbounce = '';
  475. var refund = '';
  476. var moresearch = document.getElementById("moresearch").value;
  477. //2016-07-15新增参数
  478. var start_area = $('#start_area').val();
  479. var end_area = $('#end_area').val();
  480. var line = $('#line').val();
  481. var url =
  482. "./st-xm/Api/order_list2_limited.php?tt=" + getDateTime(4) +
  483. "&timelimit=" + timelimit +
  484. "&starttime=" + starttime +
  485. "&endtime=" + endtime +
  486. "&ordersource=" + ordersource +
  487. "&orderstatus=" + click_type_id +
  488. "&paystatus=" + paystatus +
  489. "&billingstatus=" + billingstatus +
  490. "&mealbounce=" + mealbounce +
  491. "&refund=" + refund +
  492. "&moresearch=" + moresearch +
  493. "&start_area=" + start_area +
  494. "&end_area=" + end_area +
  495. "&line=" + line +
  496. "&currpage=1" +
  497. "&pagesize=999999";
  498. var listURL = url;
  499. // 跳转前将URL编码
  500. listURL = encodeURI(listURL);
  501. window.location.href = listURL;
  502. btn_obj.html('导出游客信息');
  503. }
  504. function getDateTime(nTypeFlag) {
  505. var tNowTime = new Date();
  506. var myYear = ';' + tNowTime.getFullYear() + ';';
  507. var myMonth = ';' + (tNowTime.getMonth() + 1 - 0) + ';';
  508. var myDay = ';' + tNowTime.getDate() + ';';
  509. var myHour = ';' + tNowTime.getHours() + ';';
  510. var myMinu = ';' + tNowTime.getMinutes() + ';';
  511. var mySecond = ';' + tNowTime.getSeconds() + ';';
  512. if(myMonth.length < 4) myMonth = '0' + myMonth;
  513. if(myDay.length < 4) myDay = '0' + myDay;
  514. if(myHour.length < 4) myHour = '0' + myHour;
  515. if(myMinu.length < 4) myMinu = '0' + myMinu;
  516. if(mySecond.length < 4) mySecond = '0' + mySecond;
  517. var cNewTimeStr;
  518. //alert(tNowTime);
  519. switch(nTypeFlag + 1 - 1) {
  520. case 0:
  521. cNewTimeStr = myYear + '-' + myMonth + '-' + myDay;
  522. break;
  523. case 1:
  524. cNewTimeStr = myYear + myMonth + myDay;
  525. break;
  526. case 2:
  527. cNewTimeStr = myHour + ':' + myMinu + ':' + mySecond;
  528. break;
  529. case 3:
  530. cNewTimeStr = myHour + myMinu + mySecond;
  531. break;
  532. case 4:
  533. cNewTimeStr = myYear + myMonth + myDay + myHour + myMinu + mySecond;
  534. break;
  535. case 5:
  536. cNewTimeStr = myYear + '年' + myMonth + '月' + myDay + '日';
  537. break;
  538. case 6:
  539. cNewTimeStr = myYear;
  540. break;
  541. case 7:
  542. cNewTimeStr = myYear + '-' + myMonth;
  543. break;
  544. case 8: //得到上一个月的今天
  545. var date = getDateTime(0);
  546. var arr = date.split('-');
  547. var year = arr[0]; //获取当前日期的年份
  548. var month = arr[1]; //获取当前日期的月份
  549. var day = arr[2]; //获取当前日期的日
  550. var days = new Date(year, month, 0);
  551. days = days.getDate(); //获取当前日期中月的天数
  552. var year2 = year;
  553. var month2 = parseInt(month) - 1;
  554. if(month2 == 0) {
  555. year2 = parseInt(year2) - 1;
  556. month2 = 12;
  557. }
  558. var day2 = day;
  559. var days2 = new Date(year2, month2, 0);
  560. days2 = days2.getDate();
  561. if(day2 > days2) {
  562. day2 = days2;
  563. }
  564. if(month2 < 10) {
  565. month2 = '0' + month2;
  566. }
  567. cNewTimeStr = year2 + '-' + month2 + '-' + day2;
  568. break;
  569. case 9: //得到下一个月的今天
  570. var date = getDateTime(0);
  571. var arr = date.split('-');
  572. var year = arr[0]; //获取当前日期的年份
  573. var month = arr[1]; //获取当前日期的月份
  574. var day = arr[2]; //获取当前日期的日
  575. var days = new Date(year, month, 0);
  576. days = days.getDate(); //获取当前日期中的月的天数
  577. var year2 = year;
  578. var month2 = parseInt(month) + 1;
  579. if(month2 == 13) {
  580. year2 = parseInt(year2) + 1;
  581. month2 = 1;
  582. }
  583. var day2 = day;
  584. var days2 = new Date(year2, month2, 0);
  585. days2 = days2.getDate();
  586. if(day2 > days2) {
  587. day2 = days2;
  588. }
  589. if(month2 < 10) {
  590. month2 = '0' + month2;
  591. }
  592. var t2 = year2 + '-' + month2 + '-' + day2;
  593. return t2;
  594. break;
  595. default:
  596. cNewTimeStr = myYear + '-' + myMonth + '-' + myDay + ' ' + myHour + ':' + myMinu + ':' + mySecond;
  597. break;
  598. }
  599. cNewTimeStr = cNewTimeStr.replace(/;/g, "");
  600. return cNewTimeStr;
  601. }
  602. function getPar(par) {
  603. //获取当前URL
  604. var local_url = document.location.href;
  605. local_url = decodeURI(local_url);
  606. //获取要取得的get参数位置
  607. var get = local_url.indexOf(par + "=");
  608. if(get == -1) {
  609. return "";
  610. }
  611. //截取字符串
  612. var get_par = local_url.slice(par.length + get + 1);
  613. //判断截取后的字符串是否还有其他get参数
  614. var nextPar = get_par.indexOf("&");
  615. if(nextPar != -1) {
  616. get_par = get_par.slice(0, nextPar);
  617. }
  618. return get_par;
  619. }
  620. //设置字符串类型的本地缓存
  621. function setStorage(objName, objValue) {
  622. var sto = window.localStorage;
  623. if(sto)
  624. sto.setItem(objName, objValue);
  625. }
  626. //读取字符串类型的本地缓存
  627. function getStorage(objName) {
  628. var ret = '';
  629. var sto = window.localStorage;
  630. if(sto)
  631. ret = sto.getItem(objName);
  632. return ret;
  633. }
  634. //清除本地缓存,如没指定名称则为清空所有缓存
  635. function clearStorage(objName) {
  636. var sto = window.localStorage;
  637. if(sto) {
  638. if(objName)
  639. sto.removeItem(objName);
  640. else
  641. sto.clear();
  642. }
  643. }
  644. //设置Json类型的本地缓存
  645. function setStorJson(objName, json) {
  646. if(json)
  647. setStorage(objName, JSON.stringify(json));
  648. }
  649. //读取Json类型的本地缓存
  650. function getStorJson(objName) {
  651. var ret = null;
  652. var str = getStorage(objName);
  653. if(str)
  654. ret = JSON.parse(str);
  655. return ret;
  656. }
  657. //获取当前时间
  658. function CurrentTime() {
  659. var now = new Date();
  660. var year = now.getFullYear(); //年
  661. var month = now.getMonth() + 1; //月
  662. var day = now.getDate(); //日
  663. var hh = now.getHours(); //时
  664. var mm = now.getMinutes(); //分
  665. var ss = now.getSeconds(); //秒
  666. var clock = year + "-";
  667. if (month < 10)
  668. clock += "0";
  669. clock += month + "-";
  670. if (day < 10)
  671. clock += "0";
  672. clock += day + " ";
  673. if (hh < 10)
  674. clock += "0";
  675. clock += hh + ":";
  676. if (mm < 10) clock += '0';
  677. clock += mm + ":";
  678. if (ss < 10) clock += '0';
  679. clock += ss;
  680. return (clock);
  681. }
  682. //复选框判断
  683. function select_checked(index) {
  684. //index=0最上面的全选 index=1表示的是下面所有的
  685. var cur_check = $('.ace_check')[0];
  686. var checkList = $('.ace_check');
  687. var checkCount = checkList.length - 1;
  688. var true_count = 0;
  689. for (var i = 1; i < checkList.length; i++) {
  690. if (index == '0') {
  691. checkList[i].checked = cur_check.checked;
  692. } else {
  693. if (checkList[i].checked == false) {
  694. cur_check.checked = false
  695. } else {
  696. true_count = true_count + 1;
  697. }
  698. }
  699. }
  700. //判断下面是否选中完
  701. if (checkCount == true_count) {
  702. cur_check.checked = true;
  703. }
  704. }
  705. //打印功能
  706. function printInfo(){
  707. var str = '';
  708. $('.ace_check').each(function(index, item) {
  709. if (this.checked && index != 0) {
  710. var stopid = $(this).attr('checkid');
  711. //改变账号状态
  712. str = str + stopid +',';
  713. }
  714. });
  715. order_id = str.substring(0,str.length-1);
  716. window.open("./jqprint.html?order_id="+order_id)
  717. }
  718. /**
  719. * Created by Administrator on 2016/9/29.
  720. */