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.
 
 
 
 

759 lines
26 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_qianlv.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_qianlv.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_qianlv.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_qianlv.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_qianlv.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. var to_from=dict['to_back_orderid'];
  314. if(to_from!=""){
  315. source = source.replace('line', "往返:"+dict['line']);
  316. source = source.replace('订单编号', to_from);
  317. }else{
  318. source = source.replace('line', dict['line']);
  319. source = source.replace('订单编号', dict['parent_orderNo']);
  320. }
  321. source = source.replace('[order_id]', dict['parent_orderNo']);
  322. source = source.replace('下单时间', dict['create_time']);
  323. if(dict['org_name']==""){
  324. source = source.replace('订单来源', '-');
  325. }else{
  326. source = source.replace('订单来源', dict['org_name']);
  327. }
  328. source = source.replace('渠道订单号', dict['outside_order_no']);
  329. var tt="("+dict['start_station']+")"+"-"+"("+dict['end_station']+")";
  330. source = source.replace('预订产品', tt);
  331. source = source.replace('<div>普通成人票 </div>', dict['seat'].replace('[br /]','<br />'));
  332. source = source.replace('出发时间', dict['travel_time']);
  333. source = source.replace('name', dict['contacts']);
  334. source = source.replace('phone', dict['tel']);
  335. var start_time = dict['travel_time'];
  336. var cur_time = getDateTime(0) + " " + getDateTime(2);
  337. // 判断日期是否合理
  338. var date1 = new Date(start_time.replace(/\-/g, '/'));
  339. var date2 = new Date(cur_time.replace(/\-/g, '/'));
  340. if(date2 > date1) {
  341. source = source.replace('cancelOrder', '');
  342. // source = source.replace('mealOrder', '');
  343. // source = source.replace('refundOrder', '');
  344. }
  345. if(httpData.orderList[i].run_status != "138") {
  346. source = source.replace('cancelOrder', '');
  347. }
  348. var or_st=dict['order_status'];
  349. if(or_st == "145") {
  350. source = source.replace('状态', '待支付');
  351. //paid = paid - 0 + 1;
  352. //all = all - 0 + 1;
  353. source = source.replace('cancel(0)', 'cancel(' + dict['parent_orderNo'] + ')');
  354. source = source.replace('meal(0)', 'meal(' + dict['parent_orderNo'] + ')');
  355. source = source.replace('refund(0)', 'refund(' + dict['parent_orderNo'] + ')');
  356. source = source.replace('cancelOrder', '取消 ');
  357. source = source.replace('mealOrder', '');
  358. source = source.replace('refundOrder', '');
  359. } else if(or_st == "146") {
  360. source = source.replace('状态', '已出票');
  361. //issued = issued - 0 + 1;
  362. //all = all - 0 + 1;
  363. source = source.replace('cancel(0)', 'cancel(' + dict['parent_orderNo'] + ')');
  364. source = source.replace('meal(0)', 'meal(' + dict['parent_orderNo'] + ')');
  365. source = source.replace('refund(0)', 'refund(' + dict['parent_orderNo'] + ')');
  366. source = source.replace('cancelOrder', '取消');
  367. source = source.replace('mealOrder', ' ');
  368. source = source.replace('refundOrder', ' ');
  369. } else if(or_st == "147") {
  370. source = source.replace('状态', '已完成');
  371. //completed = completed - 0 + 1;
  372. //all = all - 0 + 1;
  373. source = source.replace('cancel(0)', 'cancel(' + dict['parent_orderNo'] + ')');
  374. source = source.replace('meal(0)', 'meal(' + dict['parent_orderNo'] + ')');
  375. source = source.replace('refund(0)', 'refund(' + dict['parent_orderNo'] + ')');
  376. source = source.replace('cancelOrder', '');
  377. source = source.replace('mealOrder', '');
  378. source = source.replace('refundOrder', '');
  379. } else if(or_st == "148") {
  380. source = source.replace('状态', '已取消');
  381. //canceled = canceled - 0 + 1;
  382. //all = all - 0 + 1;
  383. source = source.replace('cancel(0)', 'cancel(' + dict['parent_orderNo'] + ')');
  384. source = source.replace('meal(0)', 'meal(' + dict['parent_orderNo'] + ')');
  385. source = source.replace('refund(0)', 'refund(' + dict['parent_orderNo'] + ')');
  386. source = source.replace('cancelOrder', '');
  387. source = source.replace('mealOrder', '');
  388. source = source.replace('refundOrder', '');
  389. } else {
  390. source = source.replace('状态', '待支付');
  391. //all = all - 0 + 1;
  392. source = source.replace('cancel(0)', 'cancel(' + dict['parent_orderNo'] + ')');
  393. source = source.replace('meal(0)', 'meal(' + dict['parent_orderNo'] + ')');
  394. source = source.replace('refund(0)', 'refund(' + dict['parent_orderNo'] + ')');
  395. source = source.replace('cancelOrder', '取消');
  396. source = source.replace('mealOrder', '');
  397. source = source.replace('refundOrder', '');
  398. }
  399. newHtml += source;
  400. }
  401. }
  402. if(newHtml) {
  403. orderSource.innerHTML = newHtml;
  404. var currpage = getPar("currpage");
  405. if(currpage) {} else {
  406. currpage = 1;
  407. }
  408. $('#page').html('');
  409. var sum = httpData.totalTickets;
  410. var tag = "page";
  411. getPager(myURL2, sum, currpage, pagesize, tag, 'currpage');
  412. document.getElementById("sum").innerHTML = "共"+sum+"条数据";
  413. }else {
  414. $('#page').html('');
  415. document.getElementById("sum").innerHTML = "共0条数据";
  416. orderSource.innerHTML = "";
  417. }
  418. // if(all){
  419. // orderAll.style.display="inline";
  420. // orderAll.innerText=all
  421. // }
  422. // if(paid){
  423. // orderPaid.style.display="inline";
  424. // orderPaid.innerText=paid
  425. // }
  426. // if(issued){
  427. // orderIssued.style.display="inline";
  428. // orderIssued.innerText=issued
  429. // }
  430. // if(completed){
  431. // orderCompleted.style.display="inline";
  432. // orderCompleted.innerText=completed
  433. // }
  434. // if(canceled){
  435. // orderCanceled.style.display="inline";
  436. // orderCanceled.innerText=canceled
  437. // }
  438. });
  439. }
  440. //.. 导出游客信息
  441. function exportToExcel(obj_this) {
  442. var btn_obj=$(obj_this);
  443. if(btn_obj.html()=="正在导出中。。。"){
  444. return;
  445. }
  446. btn_obj.html('正在导出中。。。');
  447. var starttime = $("#starttime").val();
  448. var endtime = $('#endtime').val();
  449. // if(!starttime) {
  450. // alert('请输入日期!!!');
  451. // return;
  452. // } else {
  453. // endtime = $('#endtime').val();
  454. // if(endtime == "") {
  455. // endtime = starttime;
  456. // }
  457. // }
  458. var timelimit = $('#timelimit').val(); //时间类型
  459. var ordersource = order_from_id; //订单渠道
  460. var paystatus = $('#paystatus').val(); //支付状态
  461. var billingstatus = '';
  462. var mealbounce = '';
  463. var refund = '';
  464. var moresearch = document.getElementById("moresearch").value;
  465. //2016-07-15新增参数
  466. var start_area = $('#start_area').val();
  467. var end_area = $('#end_area').val();
  468. var line = $('#line').val();
  469. var url =
  470. "./st-xm/Api/order_list2_limited.php?tt=" + getDateTime(4) +
  471. "&timelimit=" + timelimit +
  472. "&starttime=" + starttime +
  473. "&endtime=" + endtime +
  474. "&ordersource=" + ordersource +
  475. "&orderstatus=" + click_type_id +
  476. "&paystatus=" + paystatus +
  477. "&billingstatus=" + billingstatus +
  478. "&mealbounce=" + mealbounce +
  479. "&refund=" + refund +
  480. "&moresearch=" + moresearch +
  481. "&start_area=" + start_area +
  482. "&end_area=" + end_area +
  483. "&line=" + line +
  484. "&currpage=1" +
  485. "&pagesize=999999";
  486. var listURL = url;
  487. // 跳转前将URL编码
  488. listURL = encodeURI(listURL);
  489. window.location.href = listURL;
  490. btn_obj.html('导出游客信息');
  491. }
  492. function getDateTime(nTypeFlag) {
  493. var tNowTime = new Date();
  494. var myYear = ';' + tNowTime.getFullYear() + ';';
  495. var myMonth = ';' + (tNowTime.getMonth() + 1 - 0) + ';';
  496. var myDay = ';' + tNowTime.getDate() + ';';
  497. var myHour = ';' + tNowTime.getHours() + ';';
  498. var myMinu = ';' + tNowTime.getMinutes() + ';';
  499. var mySecond = ';' + tNowTime.getSeconds() + ';';
  500. if(myMonth.length < 4) myMonth = '0' + myMonth;
  501. if(myDay.length < 4) myDay = '0' + myDay;
  502. if(myHour.length < 4) myHour = '0' + myHour;
  503. if(myMinu.length < 4) myMinu = '0' + myMinu;
  504. if(mySecond.length < 4) mySecond = '0' + mySecond;
  505. var cNewTimeStr;
  506. //alert(tNowTime);
  507. switch(nTypeFlag + 1 - 1) {
  508. case 0:
  509. cNewTimeStr = myYear + '-' + myMonth + '-' + myDay;
  510. break;
  511. case 1:
  512. cNewTimeStr = myYear + myMonth + myDay;
  513. break;
  514. case 2:
  515. cNewTimeStr = myHour + ':' + myMinu + ':' + mySecond;
  516. break;
  517. case 3:
  518. cNewTimeStr = myHour + myMinu + mySecond;
  519. break;
  520. case 4:
  521. cNewTimeStr = myYear + myMonth + myDay + myHour + myMinu + mySecond;
  522. break;
  523. case 5:
  524. cNewTimeStr = myYear + '年' + myMonth + '月' + myDay + '日';
  525. break;
  526. case 6:
  527. cNewTimeStr = myYear;
  528. break;
  529. case 7:
  530. cNewTimeStr = myYear + '-' + myMonth;
  531. break;
  532. case 8: //得到上一个月的今天
  533. var date = getDateTime(0);
  534. var arr = date.split('-');
  535. var year = arr[0]; //获取当前日期的年份
  536. var month = arr[1]; //获取当前日期的月份
  537. var day = arr[2]; //获取当前日期的日
  538. var days = new Date(year, month, 0);
  539. days = days.getDate(); //获取当前日期中月的天数
  540. var year2 = year;
  541. var month2 = parseInt(month) - 1;
  542. if(month2 == 0) {
  543. year2 = parseInt(year2) - 1;
  544. month2 = 12;
  545. }
  546. var day2 = day;
  547. var days2 = new Date(year2, month2, 0);
  548. days2 = days2.getDate();
  549. if(day2 > days2) {
  550. day2 = days2;
  551. }
  552. if(month2 < 10) {
  553. month2 = '0' + month2;
  554. }
  555. cNewTimeStr = year2 + '-' + month2 + '-' + day2;
  556. break;
  557. case 9: //得到下一个月的今天
  558. var date = getDateTime(0);
  559. var arr = date.split('-');
  560. var year = arr[0]; //获取当前日期的年份
  561. var month = arr[1]; //获取当前日期的月份
  562. var day = arr[2]; //获取当前日期的日
  563. var days = new Date(year, month, 0);
  564. days = days.getDate(); //获取当前日期中的月的天数
  565. var year2 = year;
  566. var month2 = parseInt(month) + 1;
  567. if(month2 == 13) {
  568. year2 = parseInt(year2) + 1;
  569. month2 = 1;
  570. }
  571. var day2 = day;
  572. var days2 = new Date(year2, month2, 0);
  573. days2 = days2.getDate();
  574. if(day2 > days2) {
  575. day2 = days2;
  576. }
  577. if(month2 < 10) {
  578. month2 = '0' + month2;
  579. }
  580. var t2 = year2 + '-' + month2 + '-' + day2;
  581. return t2;
  582. break;
  583. default:
  584. cNewTimeStr = myYear + '-' + myMonth + '-' + myDay + ' ' + myHour + ':' + myMinu + ':' + mySecond;
  585. break;
  586. }
  587. cNewTimeStr = cNewTimeStr.replace(/;/g, "");
  588. return cNewTimeStr;
  589. }
  590. function getPar(par) {
  591. //获取当前URL
  592. var local_url = document.location.href;
  593. local_url = decodeURI(local_url);
  594. //获取要取得的get参数位置
  595. var get = local_url.indexOf(par + "=");
  596. if(get == -1) {
  597. return "";
  598. }
  599. //截取字符串
  600. var get_par = local_url.slice(par.length + get + 1);
  601. //判断截取后的字符串是否还有其他get参数
  602. var nextPar = get_par.indexOf("&");
  603. if(nextPar != -1) {
  604. get_par = get_par.slice(0, nextPar);
  605. }
  606. return get_par;
  607. }
  608. //设置字符串类型的本地缓存
  609. function setStorage(objName, objValue) {
  610. var sto = window.localStorage;
  611. if(sto)
  612. sto.setItem(objName, objValue);
  613. }
  614. //读取字符串类型的本地缓存
  615. function getStorage(objName) {
  616. var ret = '';
  617. var sto = window.localStorage;
  618. if(sto)
  619. ret = sto.getItem(objName);
  620. return ret;
  621. }
  622. //清除本地缓存,如没指定名称则为清空所有缓存
  623. function clearStorage(objName) {
  624. var sto = window.localStorage;
  625. if(sto) {
  626. if(objName)
  627. sto.removeItem(objName);
  628. else
  629. sto.clear();
  630. }
  631. }
  632. //设置Json类型的本地缓存
  633. function setStorJson(objName, json) {
  634. if(json)
  635. setStorage(objName, JSON.stringify(json));
  636. }
  637. //读取Json类型的本地缓存
  638. function getStorJson(objName) {
  639. var ret = null;
  640. var str = getStorage(objName);
  641. if(str)
  642. ret = JSON.parse(str);
  643. return ret;
  644. }
  645. //获取当前时间
  646. function CurrentTime() {
  647. var now = new Date();
  648. var year = now.getFullYear(); //年
  649. var month = now.getMonth() + 1; //月
  650. var day = now.getDate(); //日
  651. var hh = now.getHours(); //时
  652. var mm = now.getMinutes(); //分
  653. var ss = now.getSeconds(); //秒
  654. var clock = year + "-";
  655. if (month < 10)
  656. clock += "0";
  657. clock += month + "-";
  658. if (day < 10)
  659. clock += "0";
  660. clock += day + " ";
  661. if (hh < 10)
  662. clock += "0";
  663. clock += hh + ":";
  664. if (mm < 10) clock += '0';
  665. clock += mm + ":";
  666. if (ss < 10) clock += '0';
  667. clock += ss;
  668. return (clock);
  669. }
  670. //复选框判断
  671. function select_checked(index) {
  672. //index=0最上面的全选 index=1表示的是下面所有的
  673. var cur_check = $('.ace_check')[0];
  674. var checkList = $('.ace_check');
  675. var checkCount = checkList.length - 1;
  676. var true_count = 0;
  677. for (var i = 1; i < checkList.length; i++) {
  678. if (index == '0') {
  679. checkList[i].checked = cur_check.checked;
  680. } else {
  681. if (checkList[i].checked == false) {
  682. cur_check.checked = false
  683. } else {
  684. true_count = true_count + 1;
  685. }
  686. }
  687. }
  688. //判断下面是否选中完
  689. if (checkCount == true_count) {
  690. cur_check.checked = true;
  691. }
  692. }
  693. //打印功能
  694. function printInfo(){
  695. var str = '';
  696. $('.ace_check').each(function(index, item) {
  697. if (this.checked && index != 0) {
  698. var stopid = $(this).attr('checkid');
  699. //改变账号状态
  700. str = str + stopid +',';
  701. }
  702. });
  703. order_id = str.substring(0,str.length-1);
  704. window.open("./jqprint.html?order_id="+order_id)
  705. }