|
- var pagesize = 10;
- var aa = '';
-
- var tr_str='';
- var aaaHTML='';
-
-
- function reload_Info(httpData, myURL2) {
- currpage = getPar("currpage");
- aa = currpage;
- if (currpage) {} else {
- currpage = 1;
- }
- var sum = httpData['totalTickets'];
- var tag = "test";
- var sendurl = myURL2;
-
- //总数
- var count = httpData['totalTickets'];
- var aaa = $("#aaa");
- if(count==undefined || count=='' || count<=0 || count==false){
- aaa.html('');
- }else{
- var tempStr = aaaHTML.replace('6', count);
- aaa.html(tempStr);
- }
-
- //车票信息
- var searchTicketInfo = httpData['searchInfo'];
- var ttt = $("#ttt");
- var tttHTML = tr_str;
- var newHTML = '';
-
- for (var i = 0; i < searchTicketInfo.length; i++) {
- var tempDict = searchTicketInfo[i];
- var tempHTML = tttHTML;
- // var str= '<a href="order_details.html?">'+tempDict['parent_orderNo']+'';
- var parent_detail_id = tempDict['parent_orderNo'];
- var parentid = '<a onclick="open_new_path(this)" go_path="order_details.html?order_id=' + parent_detail_id + '" target="_black">' + tempDict['parent_orderNo'] + '';
- var carNo = tempDict['carNo'];
- carNo=(Array(2).join(0)+carNo).slice(-2);
- tempHTML = tempHTML.replace('[线路]', tempDict['line']);
- tempHTML = tempHTML.replace('[出发地]', tempDict['start_area']);
- tempHTML = tempHTML.replace('[目的地]', tempDict['end_area']);
- tempHTML = tempHTML.replace('[出行时间]', tempDict['travel_time']);
- tempHTML = tempHTML.replace('[车次]', carNo);
- tempHTML = tempHTML.replace('[座位]', tempDict['seat']);
- // tempHTML = tempHTML.replace('[人群]', tempDict['people']);
- tempHTML = tempHTML.replace('[座号]', tempDict['seatNo']);
- tempHTML = tempHTML.replace('[售价]', tempDict['price']);
- tempHTML = tempHTML.replace('[打印]', tempDict['print']);
- // tempHTML=tempHTML.replace('[订单号]',tempDict['orderNo']);
- tempHTML = tempHTML.replace('[订单号]', parentid);
- var orrder_detail_id = tempDict['orderNo'];
- var see = '<a onclick="open_new_path(this)" go_path="detailTicket.html?order_id=' + orrder_detail_id + '" target="_black">查看';
- tempHTML = tempHTML.replace('[查看]', see);
- newHTML += tempHTML;
- }
-
- ttt.html(newHTML);
- $('#ttt').css({
- "display": ""
- });
- $('.footer').css({
- "display": ""
- });
- $('#test').html('');
- if(sum>0){
- getPager(sendurl, sum, currpage, pagesize, tag, 'currpage');
- }
- }
- window.onload = function() {
- tr_str=$("#ttt").html();
- aaaHTML=$("#aaa").html();
-
- var start = getPar("startarea")?getPar("startarea"):'';
- var end = getPar("endarea")? getPar("endarea"):'';
- var line = getPar("line")?getPar("line"):'';
- var start_time = getPar("starttime")?getPar("starttime"):'';
- var carNo = getPar("carNo")?getPar("carNo"):'';
- var seatNo = getPar("seatNo")?getPar("seatNo"):'';
- var name = getPar("name")?getPar("name"):'';
-
- $('#sstart_area').val(start);
- $('#send_area').val(end);
- $('#sline').val(line);
- $('#id-date-picker-1').val(start_time);
- $('#scarNo').val(carNo);
- $('#sseatNo').val(seatNo);
- $('#sname').val(name);
-
- click_search();
-
- }
-
- /*======================网络请求的Ajax的代码=======================*/
-
- // 创建一个Ajax对象
- if (window.ActiveXObject) {
- var myreq = new ActiveXObject("Microsoft.XMLHTTP");
- } else {
- var myreq = new XMLHttpRequest();
- }
-
- // 请求方法,传入URL
- function get_virtual_user_list(myURL, myURL2) {
-
- myreq.open("get", myURL, true);
-
- // 接收的数据交给哪个函数处理
- myreq.onreadystatechange = function() {
- if (myreq.readyState == 4) {
- // newstr 就是接收到的数据
- var newstr = myreq.responseText;
- var httpData = JSON.parse(newstr);
- reload_Info(httpData, myURL2);
- }
- };
- myreq.send();
- }
-
- function getPar(par) {
- //获取当前URL
- var local_url = document.location.href;
- local_url = decodeURI(local_url);
- //获取要取得的get参数位置
- var get = local_url.indexOf(par + "=");
- if (get == -1) {
- return false;
- }
- //截取字符串
- var get_par = local_url.slice(par.length + get + 1);
- //判断截取后的字符串是否还有其他get参数
- var nextPar = get_par.indexOf("&");
- if (nextPar != -1) {
- get_par = get_par.slice(0, nextPar);
- }
- return get_par;
- }
-
- function click_search() {
-
- var start = $('#sstart_area').val();
- var end =$('#send_area').val();
- var line =$('#sline').val();
- var start_time = $('#id-date-picker-1').val()?$('#id-date-picker-1').val():'';
- var carNo = $('#scarNo').val();
- var seatNo =$('#sseatNo').val();
- var name = $('#sname').val();
-
- currpage = getPar("currpage");
- if(!currpage){currpage=1;}
- aa = currpage;
- var myUrl1 = "./st-xm/Api/search_ticket.php?startarea=" + start + "&endarea=" + end + "&starttime=" + start_time + "&line=" + line + "&carNo=" + carNo + "&seatNo=" + seatNo + "&name=" + name + "&pagesize=" + pagesize + "&currpage=" + aa;
- // var myUrl1 = "http://192.168.6.107:8081/st-xm/Api/search_ticket.php?startarea=&endarea=&starttime=&line=%E4%B8%8A%E6%B5%B7&carNo=&seatNo=&name=&currpage=2&pagesize=1"
- var myUrl2 = "./searchTicket.html?startarea=" + start + "&endarea=" + end + "&starttime=" + start_time + "&line=" + line + "&carNo=" + carNo + "&seatNo=" + seatNo + "&name=" + name + "&pagesize=" + pagesize;
- get_virtual_user_list(myUrl1, myUrl2);
- }
- $(document).ready(function() {
- $("#searchBtn").click(function() {
- click_search();
- })
- });
|