|
- function reload_Info(httpData){
-
- //车票信息
- var detailTicketInfo=httpData['detailTicketInfo'];
- var ticket_info=$("#ttt");
- var tttHTML=ticket_info.html();
- var newHTML=''
-
- for(var i=0;i<detailTicketInfo.length;i++){
- var tempDict=detailTicketInfo[0];
- var tempHTML=tttHTML;
- var hour = parseInt(tempDict['total_time']/60);
- var min =tempDict['total_time']%60;
- var total_time_str = hour+'小时'+min+'分';
- $('#ID').html('<a href="#">'+tempDict['orderNo']+'</a>');
- tempHTML=tempHTML.replace('[微信服务号]',tempDict['orderNo']);
- tempHTML=tempHTML.replace('[出发地]',tempDict['start_area']);
- tempHTML=tempHTML.replace('[目的地]',tempDict['end_area']);
- tempHTML=tempHTML.replace('[上车点]',tempDict['up_station']);
- tempHTML=tempHTML.replace('[下车点]',tempDict['down_station']);
- tempHTML=tempHTML.replace('[线路代码]',tempDict['codeId']);
- tempHTML=tempHTML.replace('[总时间]',total_time_str);
- tempHTML=tempHTML.replace('[出行时间]',tempDict['start_time']);
- tempHTML=tempHTML.replace('[价格]',tempDict['price']);
- tempHTML=tempHTML.replace('[车位号]',tempDict['carNo']);
- tempHTML=tempHTML.replace('[座位号]',tempDict['seatNo']);
- tempHTML=tempHTML.replace('[人群]',tempDict['seat']);
- tempHTML=tempHTML.replace('[年龄]',tempDict['people']);
- tempHTML=tempHTML.replace('[打印]',tempDict['print']);
- tempHTML=tempHTML.replace('[出票]',tempDict['chuPiao']);
- tempHTML=tempHTML.replace('[改签]',tempDict['gaiqian']);
- tempHTML=tempHTML.replace('[车牌]',tempDict['carId']);
- tempHTML=tempHTML.replace('[品牌]',tempDict['brand']);
- tempHTML=tempHTML.replace('[车座]',tempDict['carSeat']);
- tempHTML=tempHTML.replace('[车公司]',tempDict['company']);
- tempHTML=tempHTML.replace('[司机]',tempDict['driverName']);
- tempHTML=tempHTML.replace('[工牌]',tempDict['job_no']);
- tempHTML=tempHTML.replace('[电话]',tempDict['tel']);
- tempHTML=tempHTML.replace('[司机公司]',tempDict['company']);
-
- newHTML+=tempHTML;
- }
- ticket_info.html(newHTML);
- $('.control-show').css({"display":""});
- }
- console.log(getDateTime(4));
- document.addEventListener('DOMContentLoaded',function(){
- console.log(getDateTime(4));
- var order_id=getPar('order_id');
- get_virtual_user_list('./st-xm/Api/ticket_details.php?order_id='+order_id);
- console.log(getDateTime(4));
- },false);
-
- //window.onload=function(){
- //// get_virtual_user_list('./json/detailJson.html');
- // var order_id=getPar('order_id');
- // get_virtual_user_list('http://192.168.6.107:8081/st-xm/Api/ticket_details.php?order_id='+order_id);
- //}
- /*======================网络请求的Ajax的代码=======================*/
- // 创建一个Ajax对象
- if (window.ActiveXObject){
- var myreq = new ActiveXObject("Microsoft.XMLHTTP");
- }else{
- var myreq = new XMLHttpRequest();
- }
- // 请求方法,传入URL
- function get_virtual_user_list(myURL)
- {
- myreq.open("get",myURL,true);
- // 接收的数据交给哪个函数处理
- myreq.onreadystatechange = show_user_list;
- myreq.send();
- }
- function show_user_list()
- {
- if (myreq.readyState == 4)
- {
- console.log(getDateTime(4));
- // newstr 就是接收到的数据
- var newstr = myreq.responseText;
- var httpData=JSON.parse(newstr);
- reload_Info(httpData);
- }
- }
-
- 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 getDateTime(nTypeFlag) {
- var tNowTime = new Date();
- var myYear = ';' + tNowTime.getFullYear() + ';';
- var myMonth = ';' + (tNowTime.getMonth() + 1 - 0) + ';';
- var myDay = ';' + tNowTime.getDate() + ';';
- var myHour = ';' + tNowTime.getHours() + ';';
- var myMinu = ';' + tNowTime.getMinutes() + ';';
- var mySecond = ';' + tNowTime.getSeconds() + ';';
-
- if (myMonth.length < 4) myMonth = '0' + myMonth;
- if (myDay.length < 4) myDay = '0' + myDay;
- if (myHour.length < 4) myHour = '0' + myHour;
- if (myMinu.length < 4) myMinu = '0' + myMinu;
- if (mySecond.length < 4) mySecond = '0' + mySecond;
-
- var cNewTimeStr;
- //alert(tNowTime);
- switch (nTypeFlag + 1 - 1) {
- case 0:
- cNewTimeStr = myYear + '-' + myMonth + '-' + myDay;
- break;
- case 1:
- cNewTimeStr = myYear + myMonth + myDay;
- break;
- case 2:
- cNewTimeStr = myHour + ':' + myMinu + ':' + mySecond;
- break;
- case 3:
- cNewTimeStr = myHour + myMinu + mySecond;
- break;
- case 4:
- cNewTimeStr = myYear + myMonth + myDay + myHour + myMinu + mySecond;
- break;
- case 5:
- cNewTimeStr = myYear + '年' + myMonth + '月' + myDay + '日';
- break;
- case 6:
- cNewTimeStr = myYear;
- break;
- case 7:
- cNewTimeStr = myYear + '-' + myMonth;
- break;
- default:
- cNewTimeStr = myYear + '-' + myMonth + '-' + myDay + ' ' + myHour + ':' + myMinu + ':' + mySecond;
- break;
- }
-
- cNewTimeStr = cNewTimeStr.replace(/;/g, "");
-
- return cNewTimeStr;
-
- }
|