var httpData; if (window.ActiveXObject) { var myreq = new ActiveXObject("Microsoft.XMLHTTP"); } else { var myreq = new XMLHttpRequest(); } function loadData(){ myreq.open("get", "/core/detail.asp?prodcode="+m_projcode, true); myreq.onreadystatechange = showData; myreq.send(); } function showData(){ if (myreq.readyState == 4){ var newstr = myreq.responseText; httpData = JSON.parse(newstr); document.getElementById("start_area").innerText=httpData.start_area; document.getElementById("go_info").innerText=httpData.run_info; document.getElementById("end_area").innerText=httpData.end_area; if(httpData.direction == 1){ document.getElementById("back_info").style.display="none"; document.getElementById("exchangelogo").src="./img/single_arrow.png"; }else{ document.getElementById("back_info").style.display="block"; document.getElementById("exchangelogo").src="img/exchange.png"; document.getElementById("back_info").innerText=httpData.back_run_info; } document.getElementById("prod_name").innerText=httpData.prod_name; if(httpData.if_bus == "1"){ document.getElementById("if_bus").style.display = "inline"; }else{ document.getElementById("if_bus").style.display = "none"; } if(httpData.if_hotel == "1"){ document.getElementById("if_hotel").style.display = "inline"; }else{ document.getElementById("if_hotel").style.display = "none"; } if(httpData.if_sightspot == "1"){ document.getElementById("if_sightspot").style.display = "inline"; }else{ document.getElementById("if_sightspot").style.display = "none"; } if(!runid){ }else{ var tnowtime = getDateTime(4); var myURL = m_url + 'op=ticket&tt=' + tnowtime + '&projcode=' + m_projcode + '&runid=' + runid; myreq.open("get",myURL,true); myreq.onreadystatechange = show_ticket; myreq.send(null); } } } var m_url = '/core/partner.asp?'; var m_godate = ''; var m_gotime = ''; var m_backdate = ''; var m_backtime = ''; var m_projcode = ''; var m_go_run_id = ''; var arrayGoDate = new Array(); var arrayBackDate = new Array(); var arrayTicket = new Array(); var total = ''; var num =''; var userId = ''; var linkName = ''; var linkPhone = ''; var linkIdno = ''; var runid = ''; var m_godate = ''; var m_gotime = ''; var m_backdate = ''; var m_backtime = ''; var ticket = ''; var arrayTicketbak = new Array(); window.onload = function() { m_projcode = getPar('prodcode'); ticket = getPar('ticket'); if(!ticket){ arrayTicketbak.length = 0; }else{ arrayTicketbak.length = 0; var arrT = ticket.split("|"); for(var i = 0; i < arrT.length; i++){ var arrP = arrT[i].split("P"); if(arrP.length == 2){ arrayTicketbak[i] = new Array(); arrayTicketbak[i][0] = arrP[0]; arrayTicketbak[i][1] = arrP[1]; } } } runid = getPar('runid'); m_godate = getPar('m_godate'); m_gotime = getPar('m_gotime'); m_backdate = getPar('m_backdate'); m_backtime = getPar('m_backtime'); userId = getPar('user_id'); if(!userId){ }else{ linkName = getPar('link_name'); linkPhone = getPar('link_phone'); linkIdno = getPar('link_idno'); set_contacts(userId, linkName, linkPhone, linkIdno); } if(!m_godate || !m_gotime){ }else{ var obj1 = document.getElementById('show_go_run_info'); obj1.innerHTML = m_godate + ' ' + m_gotime + "  "; } if(!m_backdate || !m_backtime){ document.getElementById('back_time').style.display = "none" }else{ document.getElementById('back_time').style.display = "block" var obj1 = document.getElementById('show_back_run_info'); obj1.innerHTML = m_backdate + ' ' + m_backtime + "  "; } //m_projcode = 'HPTPZyx'; //调试代码 loadData(); //此处还需添加其他获取产品详细信息并显示的代码 } function go_date() { var listURL = "./select_date.html?prodcode="+m_projcode; if(!userId){ }else{ listURL += ("&user_id="+userId+"&link_name="+linkName+"&link_phone="+linkPhone+"&link_idno="+linkIdno); } // 跳转前将URL编码 listURL = encodeURI(listURL); window.location.href = listURL; } function get_backrundate(gorunid) { m_go_run_id = gorunid; var myURL = m_url + 'op=backdate&projcode=' + m_projcode + '&runid=' + gorunid; myreq.open("get",myURL,true); myreq.onreadystatechange = show_backrundate; myreq.send(null); } function show_gorundate() { if (myreq.readyState == 4) { var newstr = myreq.responseText; httpData = JSON.parse(newstr); var c_code = httpData.code; if (c_code == '0') { arrayGoDate.length = 0; for (var i = 0;i 0) { show_calendar(arrayGoDate[0],0); }else{ alert('没有可选择的发车日期'); show_calendar(getDateTime(0)) ; } } } function show_backrundate() { arrayBackDate.length = 0; if (myreq.readyState == 4){ var newstr = myreq.responseText; document.getElementById('div_date_runlist').innerHTML = ''; httpData = JSON.parse(newstr); var c_code = httpData.code; if (c_code == '0') { for (var i = 0;i 0) show_calendar(arrayBackDate[0],1); } } function show_calendar(cshowdate,goback) { var arrayRunDate = new Array(); if (goback == 0) { arrayRunDate = arrayGoDate; }else{ arrayRunDate = arrayBackDate; } var cnowdate = str2date(cshowdate); var cnowyear = cnowdate.getYear(); var cnowfullyear = cnowdate.getFullYear(); var cnowmonth = cnowdate.getMonth(); var ddate1 = new Date(cnowfullyear,cnowmonth+1,1); var denddate = new Date(ddate1-86400000); var cendday = denddate.getDate(); var clistdateweek = 0; var cnowdate2 = parseInt(cnowmonth)+1; cnowdate2 = cnowfullyear + '年' + cnowdate2 + '月'; var cnowdate3 = cnowfullyear + '-' + cnowmonth + '-1'; var cshow1 = '<<'; cshow1 += '' + cnowdate2 + ''; cshow1 += '>>'; document.getElementById('div_date_run_date').innerHTML = cshow1; var cshow = '星期一星期二星期三星期四星期五星期六星期日'; var nnum1 = 0; var dgodate = str2date(arrayRunDate[0]); var nnum2 = arrayRunDate.length; for (var i=1;i<=cendday;i++) { var clistdate = new Date(cnowfullyear,cnowmonth,i); clistdateweek = clistdate.getDay(); if (i==1) { if (clistdateweek == 0) clistdateweek = 7; for (var j=1;j0) { if (goback == 0) { cshow += '' + i + ''; }else{ cshow += '' + i + ''; } }else{ cshow += '' + i + ''; } } if (clistdateweek>0) { for (var i=clistdateweek;i<7;i++) { cshow += ' '; } } document.getElementById('div_date_calendar1').innerHTML = cshow; } function get_gorun(godate) { var tnowtime = getDateTime(4); m_godate = godate; var myURL = m_url + 'op=gorun&tt=' + tnowtime + '&projcode=' + m_projcode + '&godate=' + godate; myreq.open("get",myURL,true); myreq.onreadystatechange = show_gorun; myreq.send(null); } function get_backrun(backdate) { var runid = m_go_run_id; m_backdate = backdate; var myURL = m_url + 'op=backrun&runid=' + runid + '&projcode=' + m_projcode + '&backdate=' + backdate; myreq.open("get",myURL,true); myreq.onreadystatechange = show_backrun; myreq.send(null); } function show_gorun() { if (myreq.readyState == 4) { var newstr = myreq.responseText; var cshow =''; httpData = JSON.parse(newstr); var c_code = httpData.code; if (c_code == '0') { var nnum1 = httpData.go_run_list.length; if (nnum1 -0>0) { cshow = '
    '; for (var i=0;i' + httpData.go_run_list[i].runinfo + ''; } cshow += '
'; } var obj1 = document.getElementById('div_date_runlist'); obj1.innerHTML = cshow; }else{ alert(httpData.info); return; } } } function show_backrun() { if (myreq.readyState == 4) { var newstr = myreq.responseText; var cshow =''; httpData = JSON.parse(newstr); var c_code = httpData.code; if (c_code == '0') { var nnum1 = httpData.back_run_list.length; if (nnum1 -0>0) { cshow = '
    '; for (var i=0;i' + httpData.back_run_list[i].runinfo + ''; } cshow += '
'; } var obj1 = document.getElementById('div_date_runlist'); obj1.innerHTML = cshow; }else{ alert(httpData.info); return; } } } function get_next(gorunid,ifback,runtime) { m_ifback = ifback; m_gotime = runtime; var obj1 = document.getElementById('show_go_run_info'); obj1.innerHTML = '出行时间:' + m_godate + ' ' + m_gotime+ "  "; if (ifback == '0') { get_ticket(gorunid,'',0); }else{ //此处添加选返程日期的代码 document.getElementById('div_date_run_title').innerHTML = '请选择返程日期'; get_backrundate(gorunid); return; } } function get_ticket(runid,runtime,goback) { if (goback-1 == 0) { m_backtime = runtime; var obj1 = document.getElementById('show_back_run_info'); obj1.innerHTML = '返程时间:' + m_backdate + ' ' + m_backtime+ "  "; } var tnowtime = getDateTime(4); var myURL = m_url + 'op=ticket&tt=' + tnowtime + '&projcode=' + m_projcode + '&runid=' + runid; myreq.open("get",myURL,true); myreq.onreadystatechange = show_ticket; myreq.send(null); } function show_ticket() { if (myreq.readyState == 4) { var newstr = myreq.responseText; httpData = JSON.parse(newstr); var c_code = httpData.code; if (c_code == '0') { arrayTicket.length = 0; for (var i=0;i 0){ for(var j = 0; j < arrayTicketbak.length; j++){ if(arrayTicket[i][0] == arrayTicketbak[j][0]){ arrayTicket[i][4] = parseInt(arrayTicketbak[j][1]); } } }else{ arrayTicket[i][4] = parseInt(0); } } }else{ alert(httpData.info); return; } show_ticket1(); } } function show_ticket1(){ var nnum1 = arrayTicket.length; var cshow = ''; total = 0; num = 0; for (var i=0;i'; cshow += '
'; cshow += ''; cshow += ''+arrayTicket[i][2]+''; cshow += ''; cshow += ''; cshow += ''; cshow += ''; cshow += ''; cshow += ''; cshow += '
-'+ arrayTicket[i][4] +'+
'; cshow += '充足'; cshow += '
'; cshow += ''; total = (parseInt(total)-0) + (arrayTicket[i][2]*arrayTicket[i][4]-0); num = (parseInt(num)-0) + (arrayTicket[i][4]-0); } var obj1 = document.getElementById('ticket'); obj1.innerHTML = cshow; var obj2 = document.getElementById('back_ticket'); obj2.style.display = 'block'; document.getElementById("amount_price").innerText = total; if(!num || !userId){ document.getElementById("submit_order").style.background="#EBEBEB" document.getElementById("symbol").style.display="none"; document.getElementById("arrow").style.display="none"; document.getElementById("amount_price").style.display="none"; }else{ document.getElementById("submit_order").style.background="#FF8800"; document.getElementById("symbol").style.display="block"; document.getElementById("arrow").style.display="block"; document.getElementById("amount_price").style.display="block"; } } function subtraction(i){ if(arrayTicket[i][4] <= 0){ }else{ arrayTicket[i][4] = parseInt(arrayTicket[i][4])-1; show_ticket1(); } } function add(i){ if(arrayTicket[i][4] >= 0 && arrayTicket[i][4] < arrayTicket[i][3]){ arrayTicket[i][4] = (parseInt(arrayTicket[i][4])-0)+1; show_ticket1(); }else{ } } function customer_list() { var listURL = "./select_contacts.html?prodcode="+m_projcode; ticket = ''; for(var i = 0; i < arrayTicket.length; i++){ ticket += arrayTicket[i][0]+"P" + arrayTicket[i][4] + "|"; } if(!ticket){ }else{ listURL += "&ticket="+ticket; } if(!runid){ }else{ listURL += "&runid="+runid; if(!m_godate || !m_gotime){ }else{ listURL += "&m_godate="+m_godate; listURL += "&m_gotime="+m_gotime; } if(!m_backdate || !m_backtime){ }else{ listURL += "&m_backdate="+m_backdate; listURL += "&m_backtime="+m_backtime; } } // 跳转前将URL编码 listURL = encodeURI(listURL); window.location.href = listURL; } function set_contacts(link_id, link_name, link_phone, link_idno) { document.getElementById("linkman1").style.display = "none"; document.getElementById("linkman2").style.display = "block"; document.getElementById("id_one").value = link_id; document.getElementById("name_one").innerText = link_name; document.getElementById("phone_one").innerText = link_phone; document.getElementById("idno_one").innerText = link_idno; if(!num || !userId){ document.getElementById("submit_order").style.background="#EBEBEB" document.getElementById("symbol").style.display="none"; document.getElementById("arrow").style.display="none"; document.getElementById("amount_price").style.display="none"; }else{ document.getElementById("submit_order").style.background="#FF8800"; document.getElementById("symbol").style.display="block"; document.getElementById("arrow").style.display="block"; document.getElementById("amount_price").style.display="block"; } } function show_next_calendar(cshowdate,dealflag,goback) { var cnowdate = str2date(cshowdate); var cnowyear = cnowdate.getYear(); var cnowfullyear = cnowdate.getFullYear(); var cnowmonth = cnowdate.getMonth(); var ddate1 = new Date(cnowfullyear,cnowmonth+dealflag,1); var cnextfullyear = ddate1.getFullYear(); var cnextmonth = ddate1.getMonth(); var cnextdate = parseInt(cnextmonth)+1; cnextdate = cnextfullyear + '-' + cnextdate + '-1'; show_calendar(cnextdate,goback); } function str2date(DateStr){ if(typeof DateStr=="undefined")return new Date(); if(typeof DateStr=="date")return DateStr; var converted = Date.parse(DateStr); var myDate = new Date(converted); if(isNaN(myDate)){ DateStr=DateStr.replace(/:/g,"-"); DateStr=DateStr.replace(" ","-"); DateStr=DateStr.replace(".","-"); var arys= DateStr.split('-'); switch(arys.length){ case 7 : myDate = new Date(arys[0],--arys[1],arys[2],arys[3],arys[4],arys[5],arys[6]); break; case 6 : myDate = new Date(arys[0],--arys[1],arys[2],arys[3],arys[4],arys[5]); break; default: myDate = new Date(arys[0],--arys[1],arys[2]); break; }; }; return myDate; } 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; } function submit_order(){ if(!num || !userId){ document.getElementById("submit_order").style.background="#EBEBEB" document.getElementById("symbol").style.display="none"; document.getElementById("arrow").style.display="none"; document.getElementById("amount_price").style.display="none"; }else{ document.getElementById("submit_order").style.background="#FF8800"; document.getElementById("symbol").style.display="block"; document.getElementById("arrow").style.display="block"; document.getElementById("amount_price").style.display="block"; var ticket = ''; var customer = ''; var name_one = document.getElementById("name_one").innerText; var phone_one = document.getElementById("phone_one").innerText var idno_one = document.getElementById("idno_one").innerText for(var i = 0; i < arrayTicket.length; i++){ ticket += arrayTicket[i][0]+"P" + arrayTicket[i][4] + "|"; } customer = "{|" + name_one + "|" + phone_one + "|" + idno_one + "|}"; var tnowtime = getDateTime(4); var myURL = m_url + 'op=lock&projcode=' + m_projcode + '&tt=' + tnowtime + '&ticket=' + ticket + '&customer=' + customer; myreq.open("get",myURL,true); myreq.onreadystatechange = submit_my_order; myreq.send(null); } } function submit_my_order(){ if (myreq.readyState == 4){ var newstr = myreq.responseText; var cshow =''; httpData = JSON.parse(newstr); var c_code = httpData.code; if (c_code == '0'){ //alert(httpData.tradeno); var listURL = "./bookingHomePage/onlinePay.html?orderno="+httpData.tradeno; // 跳转前将URL编码 listURL = encodeURI(listURL); window.location.href = listURL; }else{ alert(httpData.info); return; } } } var arrowtype = '0'; function arrow_show(){ var a = document.getElementById("arrow"); var show_list = document.getElementById("show_list"); if(arrowtype == 0){ if(arrayTicket.length > 0){ var s = ''; for (var i=0;i 0){ arrowtype = '1'; s += '
'; s += ''+arrayTicket[i][1]+' '; s += '×'+arrayTicket[i][4]+''; s += ''+arrayTicket[i][2]+''; s += '
'; } } if(arrowtype == 1){ a.src = "../img/down_arrow.png"; document.getElementById("mask").style.display="block"; show_list.style.display = "block"; document.getElementById("ticket_list").innerHTML = s; } } }else{ arrowtype = '0'; a.src = "../img/up_arrow.png"; document.getElementById("mask").style.display="none"; show_list.style.display = "none"; } } function hide_mask_type(){ arrowtype = '0'; document.getElementById("mask").style.display="none"; document.getElementById("show_list").style.display="none"; document.getElementById("arrow").src = "../img/up_arrow.png"; } function notes(){ var listURL = "./notes.html?prodcode="+m_projcode; // 跳转前将URL编码 listURL = encodeURI(listURL); window.location.href = listURL; }