|
- var temp_typeID='';
- var current_prod_code='';
- //var isFav=false;//是否是收藏
- var m_f_runid = '';
- var m_f_godate = '';
- var m_f_gotime = '';
- var m_f_backdate = '';
- var m_f_backtime = '';
-
- var httpData=null;
-
- //
- /*======================网络请求的Ajax的代码=======================*/
-
- // 创建一个Ajax对象
- if (window.ActiveXObject) {
- var myreq = new ActiveXObject("Microsoft.XMLHTTP");
- } else {
- var myreq = new XMLHttpRequest();
- }
- console.log('startTime-load='+getDateTime(4));
- //window.onload=function(){
- var prod_code = getPar('prod_code');
- current_prod_code = prod_code;
- // var type_id = getPar('type_id');
- // temp_typeID = type_id;
- if(!prod_code)prod_code='dsnhz004';
- console.log('startTime='+getDateTime(4));
- var url = "http://xmwx.zhizhuchuxing.cn/core/detail.asp?prodcode=" + prod_code;
- // var url = "http://xmwx.zhizhuchuxing.cn/core/detail.asp?prodcode=dsnhz004";
- console.log(url)
- get_virtual_user_list(url);
- // }
- // 请求方法,传入URL
- function get_virtual_user_list(myURL) {
- var tnowtime = getDateTime(4);
- if (myURL.indexOf('?') >= 0) {
- myURL += '&tt=' + tnowtime;
- } else {
- myURL += '?tt=' + tnowtime;
- }
- myreq.open("get", myURL, true);
- // 接收的数据交给哪个函数处理
- myreq.onreadystatechange = function() {
- if (myreq.readyState == 4) {
- // newstr 就是接收到的数据
- var newstr = myreq.responseText;
- httpData = JSON.parse(newstr);
- console.log('endTime='+getDateTime(4));
- //top img
- // var tttt=httpData['cir_img'];
- // console.log('<img class="sight-img" src="'+tttt+'"/>');
-
-
- //票名称
- document.getElementById('ticket-name').innerHTML=httpData['prod_name'];
- //迪士尼价格
- document.getElementById('dsn_price').innerHTML='<span style="font-size:13px;">¥</span>'+httpData['price'];
- // //交通
- //和柴哥约定,,,交通用 circuitry_intro 预订须知用station_intro
- if (httpData['circuitry_intro'].trim().length<=0) {
- document.getElementById('son1').style.display='none';
- }else{
- var traffic=httpData['circuitry_intro'];
- traffic=traffic.replace(/\/br/g,'<br/>');
- document.getElementById('son_traffic').innerHTML=traffic;
- }
-
- // //酒店
- if (httpData['hotel_intro'].trim().length<=0) {
- document.getElementById('son2').style.display='none';
- }else{
- var hotel=httpData['hotel_intro'];
- hotel=hotel.replace(/\/br/g,'<br/>');
- document.getElementById('son_hotel').innerHTML=hotel;
- }
- //费用说明
- var fee_intro=httpData['price_intro'];
- // cstr1 = cstr1.replace(/\[\/J\]/g,'<li class="li_3"><span class="span_2"></span></li>\n');
- fee_intro=fee_intro.replace(/\/br/g,'<br/>');
- document.getElementById('son_fee_intro').innerHTML=fee_intro;
- if (httpData['circuitry_intro'].trim().length<=0&&
- httpData['hotel_intro'].trim().length<=0&&
- httpData['park_intro'].trim().length<=0&&
- httpData['show_intro'].trim().length<=0) {
- }else{
- //出行介绍选中
- var chu1=document.getElementById('chuxingjs');
- click_type(chu1, chu1.innerHTML, null);
- }
- console.log('page_endTime='+getDateTime(4));
- // 头图
- document.getElementById("top-img").innerHTML='<img class="sight-img" src="'+httpData['cir_img']+'"/>';
- //迪士尼 img
- if (httpData['park_intro'].trim().length<=0) {
- document.getElementById('son3').style.display='none';
- }else{
- document.getElementsByClassName('son_disney_ticket')[0].innerHTML='<img style="margin-bottom: 30px;" width="100%" src="'+httpData['park_intro']+'"/>'
- }
-
- //狮子王 img
- if (httpData['show_intro'].trim().length<=0) {
- document.getElementById('son4').style.display='none';
- }else{
- document.getElementsByClassName('son_lion_king_ticket')[0].innerHTML='<img style="margin-bottom: 30px;" width="100%" src="'+httpData['show_intro']+'"/>'
- }
-
-
-
- // //20160509获取初次开班信息
- // m_f_runid = httpData.f_runid;
- // m_f_godate = httpData.f_godate;
- // m_f_gotime = httpData.f_gotime;
- // m_f_backdate = httpData.f_backdate;
- // m_f_backtime = httpData.f_backtime;
- }
- };
- myreq.send();
- }
-
- //点击 type 切换
- function click_type(self_obj, type_name, father_name_id) {
- clear_type_title_color();
- clear_type_son_color();
- hidden_son_div();
- if (father_name_id) {
- change_css_type(document.getElementById(father_name_id))
- self_obj.className = 'type_son_select z txtzh son';
- } else {
- change_css_type(self_obj);
- }
- switch (type_name) {
- case "出行介绍":
- document.getElementById('intro-type').style.display = 'block';
- document.getElementById('son1').className = 'type_son_select z txtzh son';
- document.getElementById('son_traffic').style.display='block';
- break;
- case "费用说明":
- document.getElementById('intro-type').style.display = 'none';
- document.getElementById('son_fee_intro').style.display='block';
- break;
- case "交通":
- document.getElementById('son_traffic').style.display='block';
- break;
- case "酒店":
- document.getElementById('son_hotel').style.display='block';
- break;
- case "迪士尼门票":
- document.getElementById('son_disney_ticket').style.display='block';
- break;
- case "狮子王门票":
- document.getElementById('son_lion_king_ticket').style.display='block';
- break;
- default:
- break;
- }
- }
- function hidden_son_div(){
- var arr_son_divs=document.getElementsByClassName('son_div');
- for (var i=0;i<arr_son_divs.length;i++) {
- arr_son_divs[i].style.display='none';
- }
- }
- function clear_type_son_color() {
- var arr_type_sons = document.getElementsByClassName('son');
- for (var i = 0; i < arr_type_sons.length; i++) {
- arr_type_sons[i].className = 'type_son z txtzh son';
- }
- }
- // 颜色清空
- function clear_type_title_color() {
- var arr_typenames = document.getElementsByClassName('typename');
- for (var i = 0; i < arr_typenames.length; i++) {
- arr_typenames[i].style.color = "#343434";
- arr_typenames[i].style.borderBottomWidth = "0px";
- arr_typenames[i].style.backgroundColor = 'white';
- }
- }
- // 改变三个type的样式
- function change_css_type(type) {
- type.style.borderBottomWidth = "2px";
- type.style.borderBottomStyle = "solid";
- type.style.borderBottomColor = "#00cc9c";
- }
-
- function click_bookNow() {
- // var listURL = "../reserve_style2.html?prodcode=" + current_prod_code + '&runid=' + m_f_runid + '&m_godate=' + m_f_godate + '&m_gotime=' + m_f_gotime + '&m_backdate=' + m_f_backdate + '&m_backtime=' + m_f_backtime;
- var listURL = "../reserve_style2.html?prodcode=" + current_prod_code;
- // 跳转前将URL编码
- listURL = encodeURI(listURL);
- window.location.href = listURL;
- }
- // 从上一页的链接上获取参数
- 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;
- }
- //
- //function reload_Info(httpData){
- // var header_center = document.getElementById("header-center");
- // var centerHTML = '';
- // centerHTML +='<div class="sight-image-div">';
- // centerHTML +='<img class="sight-img" src="../img/fo.jpg" />';
- // centerHTML +='</div>';
- // centerHTML +='<div class="ticket-info">';
- // var typeStr = "";
- // typeStr = "船票";
- // centerHTML +='<div class="ticket-name" style="margin-left:2%"><span class="prod_name">'+httpData.prod_name+'</span></div>';
- // centerHTML +='<div class="ticket-type-price">';
- // centerHTML +='<span class="ticket-price z price-p"><span style="font-size:13px;">¥</span>195<span style="font-size:14px;margin-left:1px;"></span></span>';
- // centerHTML +='</div>';
- // centerHTML +='</div>';
- // // 执行
- // header_center.innerHTML = centerHTML;
- //
- // // 三个type
- // var three_type_center = document.getElementById("three-type-center");
- // var threeHTML = '';
- // threeHTML +='<div name="type-title" id="type-title" class="type-title">';
- //
- //// circuitry_intro: "出行介绍文字内容包含图片[img]prod_img/001.jpg[/img]出行介绍文字内容包含图片",
- ////station_intro: "上下站点介绍文字内容包含图片[img]prod_img/002.jpg[/img]上下站点介绍文字内容包含图片",
- ////price_intro: "费用介绍文字内容包含图片[img]prod_img/003.jpg[/img]费用介绍文字内容包含图片",
- //
- // //threeHTML +='<span id="chuxingjs" class="z txtzh" onclick="click_chuxingjs('+'\''+subStrFormContext(httpData.circuitry_intro)[1]+'\''+')">介绍</span>';
- // threeHTML +='<span id="chuxingjs" class="z txtzh" onclick="click_chuxingjs('+'\''+ httpData.circuitry_intro +'\''+')">介绍</span>';
- //// threeHTML +='<span id="shangxiazd" class="z txtzh" onclick="click_shangxiazd('+'\''+subStrFormContext(httpData.station_intro)[1]+'\''+')">上下站点</span>';
- // //threeHTML +='<span id="feiyongsm" class="y txtzh" onclick="click_feiyongsm('+'\''+subStrFormContext(httpData.price_intro)[1]+'\''+')">费用说明</span>';
- // threeHTML +='<span id="feiyongsm" class="y txtzh" onclick="click_feiyongsm('+'\''+ httpData.price_intro +'\''+')">费用说明</span>';
- // threeHTML +='</div>';
- // //threeHTML +='<div id="type-info" class="type-info">'+subStrFormContext(httpData.circuitry_intro)[1]+'</div>';
- //
- // var cstr1 = '<p>普陀山素有“海天佛国”、“南海圣境”之称,是国家5A级旅游风景区,有普济寺、法雨寺、盘陀庵、灵石庵等寺庙和潮音洞、梵音洞等名胜。</p>';
- // threeHTML +='<div id="type-info" class="type-info">'+ cstr1 +'</div>';
- //
- //// //20160509获取初次开班信息
- // m_f_runid = httpData.f_runid;
- // m_f_godate = httpData.f_godate;
- // m_f_gotime = httpData.f_gotime;
- // m_f_backdate = httpData.f_backdate;
- // m_f_backtime = httpData.f_backtime;
- //
- // // 执行
- // three_type_center.innerHTML = threeHTML;
- //
- //}
- //
-
- //// 点击出行介绍
- //function click_chuxingjs(intro){
- // clear_type_title_color();
- // var chuxingjs = document.getElementById("chuxingjs");
- // change_css_type(chuxingjs);
- // var type_info = document.getElementById("type-info");
- //
- // var cstr1 = '<p>普陀山素有“海天佛国”、“南海圣境”之称,是国家5A级旅游风景区,有普济寺、法雨寺、盘陀庵、灵石庵等寺庙和潮音洞、梵音洞等名胜。</p>';
- // type_info.innerHTML = cstr1;
- //
- // //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;
- // var cstr1 = '<p style="margin-left:0%;">包含:普陀山大门票(二日可用)、朱家尖至普陀山单程船票、30万保额旅游意外险;</p><p style="margin-left:0%;">不包含:寺院香花卷,景区小交通。</p>'
- // cstr1 += '<p style="margin-left:0%;margin-top:5px;">注:(1) 淡季1月份、12月份门票价格为140元/人</p>';
- // cstr1 += '<p>(2) 旺季2月份至11月份门票介格为160元/人</p>';
- // cstr1 += '<p>(3) 正月初一至初五、五月一日至三日、十月一日至五日上浮至200元/人</p>';
- // cstr1 += '<p>(4) 朱家尖码头---普陀山码头单程船票25元/人</p>';
- // cstr1 += '<p>(5) 景区景点意外险10元/人/单</p>';
- //
- // type_info.innerHTML=cstr1;
- //}
-
- //// foot上的收藏和立即预订
- ////function click_fav(){
- //// var fav = document.getElementById("fav");
- //// if(fav.innerHTML=="收藏"){
- //// isFav = true;
- //// var url = "http://xmwx.zhizhuchuxing.cn/core/keep.asp?prodcode="+current_prod_code;
- //// get_virtual_user_list(url);
- //// }
- ////}
- //// 收藏产品
- ////function fav_product(httpData){
- //// var fav = document.getElementById("fav");
- //// if(httpData.code=="0"){
- //// alert("收藏成功!");
- //// fav.innerHTML="已收藏";
- //// fav.style.backgroundColor='gray';
- //// fav.disabled=true;
- //// }else{
- //// alert("收藏失败!");
- //// fav.innerHTML="已收藏";
- //// }
- ////}
-
- //// 从内容中截取图片名称
- //function subStrFormContext(context){
- // var imgName="";
- // var i = context.indexOf("[img]");
- // var j = context.indexOf("[/img]");
- // if (j-i>0 && i>=0)
- // {
- // 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 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;
-
- }
|