//========================列表页的主页=============================// var myArray = new Array(); var c_ifbus = -1; var c_ifhotel = -1; var c_ifsightspot = -1; var c_direction = 0; var is_show_cir = false; // 判断是否显示黄色小圆点 var area1=getPar('area1'); var area2=getPar('area2'); //var endspan=getPar('endspan'); function init_page(){ // if(endspan!="false"){ // var choosearea = document.getElementById(endspan); // choosearea.style.color='#FFFFFF'; // choosearea.style.backgroundColor='#00cc9c'; // choosearea.style.borderColor='#00cc9c'; // choosearea.style.borderStyle='solid'; // } if(area1!="false"){ var url = "http://xmwxc.zhizhuchuxing.cn/core/query.asp?area1="+area1+"&area2="+area2; get_virtual_user_list(url); } } // 刷新表格 var temp_httpData; function reload_cell(httpData){ if(httpData.code!="0"){ alert(httpData.info);return; } temp_httpData = httpData; // 得到center对象 var center = document.getElementById("center"); // 得到数据中的数据 var product_list = httpData.product_list; var htmlStr=""; for (var i=0;i=0 && myArray[i][9]-c_ifbus!=0) num2 = 1; if (c_ifhotel-0>=0 && myArray[i][10]-c_ifhotel!=0) num2 = 1; if (c_ifsightspot-0>=0 && myArray[i][11]-c_ifsightspot!=0) num2 = 1; if ((c_direction-0)>0 && (myArray[i][8]-c_direction)!=0) num2 = 1; if (num2 - 0 == 0) { if (cstr1 != '') { cstr2 += '
'; cstr2 += cstr1; cstr1 = ''; } cstr3 = myArray[i][0]; //if (i==(num1-1)) { // cstr1 += '
'; //}else{ // cstr1 += '
'; //} cstr1 += '
'; cstr1 += ''; cstr1 += '
'; cstr1 += '
'; cstr1 += '
'; cstr1 +=''+myArray[i][3]+''; cstr1 +=''+myArray[i][5]+''; cstr1 +='
'; cstr1 +='
'; cstr1 +=''+myArray[i][4]+''; cstr1 +=''+myArray[i][7]+' 班 / 天'; cstr1 +='
'; cstr1 +='
'; var width = window.screen.width ; var name = myArray[i][1]; if (width>320){ if(name.length>19){ name = name.substr(0,18)+'...'; }else{ name = name.substr(0,20); } }else if(width==320){ if(name.length>17){ name = name.substr(0,15)+'...'; }else{ name = name.substr(0,17); } }else if(width>=300 && width<320){ if(name.length>15){ name = name.substr(0,13)+'...'; }else{ name = name.substr(0,15); } } cstr1 += '
'+name+'
'; cstr1 += '
'; // 判断往返程信息 if(myArray[i][8]=="1"){ cstr1 += ''; }else if(myArray[i][8]=="2"){ cstr1 += ''; } cstr1 += '
'; cstr1 += '
'; cstr1 += '¥ '; cstr1 += ''+myArray[i][2]+''; cstr1 += '
'; cstr1 += '
'; // 是否包含车子 var car = myArray[i][9]; if(car=="1"){ cstr1 += ''; } // 是否包含宾馆 var hotel = myArray[i][10]; if (hotel=="1"){ cstr1 += ''; } // 是否包含景点 var sightspot = myArray[i][11]; if (sightspot=="1") { cstr1 += ''; } cstr1 += '
'; cstr1 += '
'; cstr1 += '
'; cstr1 += '
'; } } if (cstr1 != '') { cstr2 += '
'; cstr2 += cstr1; } var obj1 = document.getElementById('center'); obj1.innerHTML = cstr2; hide_mask_type(); } // 点击单元格 function click_cell(prod_code){ // var listURL = "details.html?prod_code="+prod_code; var listURL = "/core/prod_detail.asp?prod_code="+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 clickMudidi(){ load_mudidi_citys_sightspot(); // 动态加载目的地的城市和景点 hide_mask_type(); // 隐藏蒙板和出发、目的地层 // 得到蒙板层 var mask = document.getElementById("mask"); // 目的地 var mudidi = document.getElementById("m_mudidi"); // 得到目的地按钮 var toaddess = document.getElementById("toaddess"); // toaddess.style.background='url(../img/list_cir.png) no-repeat'; toaddess.style.backgroundColor='white'; toaddess.style.backgroundSize='7px'; toaddess.style.backgroundPosition='62% 7px'; mask.style.display = 'block'; mudidi.style.display = 'block'; toaddess.style.color='#00CC9C'; // 得到图片 var img = document.getElementById("type1-arrow"); img.src='../img/list_up.png'; } // 动态加载目的地的城市和景点 function load_mudidi_citys_sightspot(){ var m_city = document.getElementById("m_city"); var m_scenery = document.getElementById("m_scenery"); var city_list = temp_httpData.city_list; var city_listHTML = ''; var cstr1 = ''; var myArray = new Array(); myArray[0] = '上海'; // myArray[1] = '苏州'; // myArray[2] = '杭州'; // myArray[3] = '常州'; // myArray[4] = '嘉兴'; // myArray[5] = '湖州'; // myArray[6] = '扬州'; for (var i=0;i'+myArray[i]+''; }else{ city_listHTML +='
  • '+myArray[i]+'
  • '; } } // for (var i=0;i'+city_list[i].city+''; // }else{ // city_listHTML +='
  • '+city_list[i].city+'
  • '; // } // } // 执行 m_city.innerHTML = city_listHTML; var sightspot_list = temp_httpData.sightspot_list; var sightspot_listHTML = ''; var cstr2 = ''; var myArray2 = new Array(); myArray2[0] = '千岛湖'; myArray2[1] = '乌镇'; myArray2[2] = '萧山机场'; myArray2[3] = '西塘'; // myArray2[0] = '千岛湖'; // myArray2[1] = '安吉'; // myArray2[2] = '天目湖'; // myArray2[3] = '南山竹海'; // myArray2[4] = '乌镇'; // myArray2[5] = '同里'; // myArray2[6] = '留园'; // myArray2[7] = '灵山大佛'; // myArray2[8] = '甪直'; // myArray2[9] = '锦溪'; // myArray2[10] = '周庄'; // myArray2[11] = '萧山机场'; // myArray2[12] = '恐龙园'; // myArray2[13] = '嬉戏谷'; // myArray2[14] = '大明山'; // myArray2[15] = '青山湖'; // myArray2[16] = '西塘'; // myArray2[17] = '南浔'; // myArray2[18] = '桐庐'; // myArray2[19] = '莫干山'; for (var i=0;i'+myArray2[i]+''; }else{ sightspot_listHTML +='
  • '+myArray2[i]+'
  • '; } } // for (var i=0;i'+sightspot_list[i].sightspot+''; // }else{ // sightspot_listHTML +='
  • '+sightspot_list[i].sightspot+'
  • '; // } // // } // 执行 m_scenery.innerHTML = sightspot_listHTML; } // 选中目的地层上的地点 function m_get_target_area(area){ // 选择了地点之后,将蒙板去掉、将该层隐藏 hide_mask_type(); var listURL = "list.html?area1="+area1+'&area2='+area; // 跳转前将URL编码 listURL = encodeURI(listURL); window.location.href = listURL; // var center = document.getElementById("center"); // center.innerHTML=""; // var url = "http://xmwxc.zhizhuchuxing.cn/core/query.asp?area1="+area1+"&area2="+area; // get_virtual_user_list(url); } // 点击了出发类型 function clickType(){ load_type_data(); // 动态加载出发类型的数据 hide_mask_type(); // 得到蒙板层 var mask = document.getElementById("mask"); // 出发类型 var c_type = document.getElementById("c_type"); // 得到出发类型按钮 var type = document.getElementById("type"); // type.style.background='url(../img/list_cir.png) no-repeat'; type.style.backgroundColor='white'; type.style.backgroundSize='7px'; // type.style.backgroundPosition='67% 7px'; mask.style.display = 'block'; c_type.style.display = 'block'; type.style.color = "#00CC9C"; var img = document.getElementById("type2-arrow"); img.src='../img/list_up.png'; } // 动态加载出发类型上的数据 function load_type_data(){ if(temp_lino==0){ var c_header_all = document.getElementById("c_header_all"); c_header_all.style.backgroundImage='url(../img/list_check.png)'; c_header_all.style.backgroundRepeat='no-repeat'; c_header_all.style.backgroundSize='0px 0px'; c_header_all.style.backgroundPosition='100%'; } // 全部 var num1 = myArray.length; if(myArray.length<1)return; var num2 = 0; var listArray = new Array(); listArray[0] = ['全部',-1,-1,-1,0,0]; listArray[1] = ['单程票',1,0,0,1,0]; listArray[2] = ['往返程票',1,0,0,2,0]; listArray[3] = ['单程票+酒店',1,1,0,1,0]; listArray[4] = ['单程票+景点门票',1,0,1,1,0]; listArray[5] = ['单程票+酒店+景点门票',1,1,1,1,0]; listArray[6] = ['往返程票+酒店',1,1,0,2,0]; listArray[7] = ['往返程票+景点门票',1,0,1,2,0]; listArray[8] = ['往返程票+酒店+景点门票',1,1,1,2,0]; for (var i=0;i'; var cstr1 = '全部' + listArray[0][5] + '条'; if(temp_lino==0){ var c_header_all = document.getElementById("c_header_all"); c_header_all.style.backgroundImage='url(../img/list_check.png)'; c_header_all.style.backgroundRepeat='no-repeat'; c_header_all.style.backgroundSize='20px 20px'; c_header_all.style.backgroundPosition='100%'; // cstr1 +=''; } document.getElementById('c_header_all').innerHTML = cstr1; cstr1 = '
      '; for (var i=1;i<9;i++) { if ((listArray[i][5] - 0) != 0){ if(i==temp_lino){ cstr1 += '
    • ' + listArray[i][0] + '    ' + listArray[i][5] + '条
    • '; }else{ // cstr1 += '
    • ' + listArray[i][0] + '' + listArray[i][5] + '条
    • '; cstr1 += '
    • ' + listArray[i][0] + '    ' + listArray[i][5] + '条
    • '; } } } cstr1 += '
    '; var obj1 = document.getElementById('div_product_type_list'); obj1.innerHTML = cstr1; } // 选中出发类型上的类型 function c_get_type(lino){ var li = document.getElementById("li"+lino); li.style.backgroundImage='url(../img/list_check.png)'; li.style.backgroundRepeat='no-repeat'; li.style.backgroundSize='20px 20px'; li.style.backgroundPosition='100%'; } // 隐藏蒙板和出发、目的地层 function hide_mask_type(){ // 蒙板 var mask = document.getElementById("mask"); // 出发类型层 var c_type = document.getElementById("c_type"); mask.style.display = 'none'; c_type.style.display = 'none'; // 目的地层 var m_mudidi = document.getElementById("m_mudidi"); m_mudidi.style.display = 'none'; // 目的地按钮 var toaddess = document.getElementById("toaddess"); toaddess.style.color='#585858'; toaddess.style.backgroundPosition='1000px'; // 出发类型按钮 var type = document.getElementById("type"); type.style.color='#585858'; type.style.backgroundPosition='1000px'; var img1 = document.getElementById("type1-arrow"); img1.src = '../img/list_down.png'; var img2 = document.getElementById("type2-arrow"); img2.src = '../img/list_down.png'; } /*======================网络请求的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://xmwxc.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_cell(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; }