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.
 
 
 
 

776 lines
27 KiB

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