|
- // 当前网页加载的时候
- var current_prod_code;
- function init_page(){
- // 获得上一页面的参数
- var prod_code = getPar('prod_code');
- current_prod_code = prod_code;
- // 根据prod_code 查询详情
- if(prod_code!=false){
- var url = 'http://xmwx.zhizhuchuxing.cn/core/detail.asp?prodcode='+prod_code;
- get_virtual_user_list(url);
- }
- }
- // 刷新
- var temp_httpData;
- function reload_Info(httpData){
- temp_httpData = httpData;
- // 得到arr
- console.log(temp_httpData)
- var bus_list = httpData.bus_list;
- var recommand_list = httpData.recommand_list;
-
- var container = document.getElementById("container");
- var header = document.getElementById("header");
- var center = document.getElementById("center");
- // 单元格HTML
- var wrapper_HTML = '';
- wrapper_HTML += '<div style="margin-top:10px; border-top:1px solid #dadada; position:relative; width:100%;background:#fff;overflow:hidden;">';
- wrapper_HTML += '<img style="position:absolute;top:24px;left:4%;width:9px;height: 39px;" src="../img/smalllogo.png" alt="">';
- wrapper_HTML +='<div style="float:left;width:100%;">';
- wrapper_HTML +='<div style="float:left;width:75%;margin-top:11px;margin-left:10.5%;">';
- wrapper_HTML +='<div style="height:32px; line-height: 32px; width:100%; border-bottom:1px solid #ECEBEE;">';
- wrapper_HTML +='<span id="start_area" style="font-size:16px;color:#343434;">上海</span>';
- wrapper_HTML +='<span id="go_info" style="float:right;color:#808080;font-size:14px;">04.15 07:30 出发</span>';
- wrapper_HTML +='</div>';
- wrapper_HTML +='<div style="height:32px;width:100%; line-height: 32px;">';
- wrapper_HTML +='<span id="end_area" style="font-size:16px;color:#343434;">舟山</span>';
- wrapper_HTML +='<span id="back_info" style="float:right;color:#808080;font-size:14px;">04.15 07:30 返回</span>';
- wrapper_HTML +='</div>';
- wrapper_HTML +='</div>';
- wrapper_HTML +='<div style="float:left;overflow:hidden;margin-top: 10px; padding-bottom:12px; border-bottom:1px solid #ECEBEE;width:98.7%;margin-left:2.89%;">';
- wrapper_HTML +='<div id="prod_name" style="float:left;color:#808080;font-size:13px;">豪华大巴陆地航空式顶级商务座</div>';
- wrapper_HTML +='<div style="float:left;margin-left:1.5%;">';
- // 是否包含车子
- var car = httpData.if_bus;
- if(car=="1"){
- wrapper_HTML += '<img id="if_bus" style="width:14px; height:15px;" src="../img/car2.png" alt="">';
- }
- // 是否包含宾馆
- var hotel = httpData.if_hotel;
- if (hotel=="1"){
- wrapper_HTML += '<img id="if_hotel" style="width:15px; height:15px;" src="../img/hotel2.png" alt="">';
- }
- // 是否包含景点
- var sightspot = httpData.if_sightspot;
- if (sightspot=="1") {
- wrapper_HTML += '<img id="if_sightspot" style="width:15px; height:15px;" src="../img/ticket.png" alt="">';
- }
- // 单元格结束
- // 单元格下面补充
- wrapper_HTML +='<div class="boxpricediv">';
- wrapper_HTML +='<div class="ticketprice">';
- wrapper_HTML +='<span>¥</span>';
- wrapper_HTML +='<span>'+httpData.price+'</span>';
- wrapper_HTML +='<img class="y" src="../img/right_arrow_orange.png" />';
- wrapper_HTML +='<a href="spend.html"><span class="y>费用说明</span></a>';
- wrapper_HTML +='</div>';
- wrapper_HTML +='</div>';
- // 补充结束
-
- // header执行cell
- header.innerHTML=wrapper_HTML;
-
-
- // 线路介绍
- var intro = httpData.circuitry_intro;
- var xcontent = document.getElementById("xcontent");
- // alert(s.replace(/\LOVE/g, "爱"));
- //var text= "javascript 非常强大 !JAVASCRIPT 是我最喜欢的一门语言 !";
- //17 text.replace(/javascript/ig, "JavaScript");18 // 返回:JavaScript 非常强大 !JavaScript 是我最喜欢的一门语言 !
- var xcHTML='';
- xcHTML+='<div style="overflow:hidden;margin-bottom:16px;">';
- xcHTML+='<img style="width:21px;height:24px;float:left;" src="../img/getin.jpg" alt="">';
-
- xcHTML+='</div>';
- xcHTML+='<div>';
- xcHTML+='<img style="width:8px;height:12px;margin-left:2.05%;float:left;" src="../img/xarive.jpg" alt="">';
- xcHTML+='';
- xcHTML+='';
- xcHTML+='';
- xcHTML+='';
- var t ='<span style="float:left;margin-left:6.4%;margin-top:1px;margin-bottom:8px;margin-top:-2px;">';
- var t2 ='</span><br>';
- intro=intro.replace(/[T]/g,t);
- intro=intro.replace(/[/T]/g,t2);
- var s = '<div style="float:left;margin-left:10.4%;margin-bottom:19px;">';
- var s2=' </div>';
- intro=intro.replace(/[S]/g,s);
- intro=intro.replace(/[/S]/g,s2);
- // var a ='';
- // var a2 ='';
- // introl=introl.replace(/[A]/g,a);
- // introl=introl.replace(/[/A]/g,a2);
- var sc = '<span style="font-size:17px;color:#030303;float:left;margin-left:3.4%;margin-top:1px;">';
- var sc2 ='</span>';
- intro=intro.replace(/[SC]/g,sc);
- intro=intro.replace(/[/SC]/g,sc2);
-
-
-
- // alert(intro);
-
-
-
-
-
- }
- // 将出行介绍、上下班点、费用说明三个按钮颜色清空
- function clear_type_title_color(){
- var chuxingjs = document.getElementById("chuxingjs");
- var shangxiazd = document.getElementById("shangxiazd");
- var feiyongsm = document.getElementById("feiyongsm");
-
- chuxingjs.style.color = "black";
- chuxingjs.style.borderBottomWidth="0px";
- shangxiazd.style.color = "black";
- shangxiazd.style.borderBottomWidth="0px";
- feiyongsm.style.color = "black";
- feiyongsm.style.borderBottomWidth="0px";
-
- }
- // 点击出行介绍
- function click_chuxingjs(intro){
- clear_type_title_color();
- var chuxingjs = document.getElementById("chuxingjs");
- change_css_type(chuxingjs);
- var type_info = document.getElementById("type-info");
- type_info.innerHTML=intro;
- }
- // 点击上下站点
- function click_shangxiazd(intro){
- clear_type_title_color();
- var shangxiazd = document.getElementById("shangxiazd");
- change_css_type(shangxiazd);
- var type_info = document.getElementById("type-info");
- type_info.innerHTML=intro;
- }
- // 点击费用说明
- function click_feiyongsm(intro){
- clear_type_title_color();
- var feiyongsm = document.getElementById("feiyongsm");
- change_css_type(feiyongsm);
- var type_info = document.getElementById("type-info");
- type_info.innerHTML=intro;
- }
- // 改变三个type的样式
- function change_css_type(type){
- type.style.color="#00CC9C";
- type.style.borderBottomWidth="2px";
- type.style.borderBottomStyle="solid";
- type.style.borderBottomColor="#00CC9C";
- }
- // 点击更多
- function click_more_more(type_id){
- var listURL = "mdidiProduct.html?type_id="+type_id;
- // 跳转前将URL编码
- listURL = encodeURI(listURL);
- window.location.href = listURL;
-
- }
- // 点击单元格
- function click_cell_box(prod_code){
- var listURL = "mdidiDetail.html?prod_code="+prod_code;
- // 跳转前将URL编码
- listURL = encodeURI(listURL);
- window.location.href = listURL;
-
- }
- // 点击立即预订
- function click_booking(){
- var listURL = "../reserve.html?prodcode="+current_prod_code;
- // 跳转前将URL编码
- listURL = encodeURI(listURL);
- window.location.href = listURL;
- }
-
-
-
- // 从内容中截取图片名称
- function subStrFormContext(context){
- var imgName="";
- var i = context.indexOf("[img]");
- var j = context.indexOf("[/img]");
- imgName=context.substring(i+5,j);
- // 去掉[img][/img]的文本内容
- var str1 = context.substring(0,i);
- var str2 = context.substring(j+6,context.length);
- var str = str1+str2;
-
- var img_str = new Array();
- img_str.push(imgName); //0
- img_str.push(str); //1
- img_str.push(str1); //2
- img_str.push(str2); //3
- return img_str;
- }
-
- // 从上一页的链接上获取参数
- function getPar(par){
- //获取当前URL
- var local_url = document.location.href;
- // 接收的时候将URL 解码
- 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;
- }
- //目的地 三个type
- // 点击三个票种
- function click_ticket_type(type_id){
- var ship_ticket = document.getElementById("ship_ticket");
- clear_three_ticket_type(ship_ticket);
- var hotel_ticket = document.getElementById("hotel_ticket");
- clear_three_ticket_type(hotel_ticket);
- var door_ticket = document.getElementById("door_ticket");
- clear_three_ticket_type(door_ticket);
- if(type_id=="1"){
- ship_ticket.style.color = '#00CC9C';
- ship_ticket.style.borderBottomWidth = "2px";
- ship_ticket.style.borderBottomStyle = "solid";
- ship_ticket.style.borderBottomColor = "#00CC9C";
- }else if(type_id=="2"){
- hotel_ticket.style.color = '#00CC9C';
- hotel_ticket.style.borderBottomWidth = "2px";
- hotel_ticket.style.borderBottomStyle = "solid";
- hotel_ticket.style.borderBottomColor = "#00CC9C";
- }else{
- door_ticket.style.color = '#00CC9C';
- door_ticket.style.borderBottomWidth = "2px";
- door_ticket.style.borderBottomStyle = "solid";
- door_ticket.style.borderBottomColor = "#00CC9C";
- }
- }
- // 清空三个票种的选中效果
- function clear_three_ticket_type(type){
- type.style.color = "black";
- type.style.backgroundColor = "white";
- type.style.borderBottomWidth = "0px";
- }
-
-
-
- /*======================网络请求的Ajax的代码=======================*/
-
- // 创建一个Ajax对象
- if (window.ActiveXObject){
- var myreq = new ActiveXObject("Microsoft.XMLHTTP");
- }else{
- var myreq = new XMLHttpRequest();
- }
- // 请求方法,传入URL
- function get_virtual_user_list(myURL)
- {
- var tnowtime = getDateTime(4);
- // m_url = 接口
-
- // var myURL = m_url + 'op=userlink&vuser=' + cvuserid + '&tt=' + tnowtime;
- // var myURL = "http://xmwx.zhizhuchuxing.cn/core/area_target.asp?keyword=";
- myreq.open("get",myURL,true);
- // 接收的数据交给哪个函数处理
- myreq.onreadystatechange = show_user_list;
- myreq.send();
- }
- function show_user_list()
- {
- if (myreq.readyState == 4)
- {
- // newstr 就是接收到的数据
- var newstr = myreq.responseText;
- var httpData=JSON.parse(newstr);
- //
- reload_Info(httpData);
- }
- }
- 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;
-
- }
-
-
|