|
-
-
- //========================列表页的主页=============================//
- 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<product_list.length;i++) {
- myArray[i] = new Array();
- myArray[i][0] = product_list[i].prod_code;
- myArray[i][1] = product_list[i].prod_name;
- myArray[i][2] = product_list[i].price;
- myArray[i][3] = product_list[i].start_area;
- myArray[i][4] = product_list[i].end_area;
- myArray[i][5] = product_list[i].run_info;
- myArray[i][6] = product_list[i].back_run_info;
- myArray[i][7] = product_list[i].run_count;
- myArray[i][8] = product_list[i].direction;
- myArray[i][9] = product_list[i].if_bus;
- myArray[i][10] = product_list[i].if_hotel;
- myArray[i][11] = product_list[i].if_sightspot;
- myArray[i][12] = product_list[i].run_days;
- }
- // 执行
- show_product_list(0,-1,-1,-1,0);
- }
- var temp_lino=0;
- function show_product_list(lino,c_ifbus,c_ifhotel,c_ifsightspot,c_direction)
- {
-
- temp_lino=lino;
- if(lino!=0){
- c_get_type(lino);
- var c_header_all = document.getElementById("c_header_all");
- c_header_all.style.backgroundSize='0px 0px';
- }
-
-
-
- var cstr1 = '';
- var cstr2 = '';
- var num1 = myArray.length;
- var num2 = 0;
- var cstr3 = '';
- for (var i=0;i<num1;i++)
- {
- num2 = 0;
- if (c_ifbus-0>=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 += '<div class="cell-start zh" onclick="click_cell(\''+ cstr3 +'\')">';
- cstr2 += cstr1;
- cstr1 = '';
- }
- cstr3 = myArray[i][0];
- //if (i==(num1-1)) {
- // cstr1 += '<div class="cell-start-last cell-start zh" onclick="click_cell(\'' + myArray[i][0] + '\')">';
- //}else{
- // cstr1 += '<div class="cell-start zh" onclick="click_cell(\''+ myArray[i][0] +'\')">';
- //}
- cstr1 += '<div class="smallbox">';
- cstr1 += '<img style="position:absolute;top:23px;left:4%;width:9px;height: 39px;" class="smalllogo" src="../img/smalllogo.png">';
- cstr1 += '<div class="smallboxleft z">';
- cstr1 += '<div class="smallareainput z" style="margin-top:10px;">';
- cstr1 += '<div style="height:32px; line-height: 32px; width:100%; border-bottom:1px solid #ECEBEE;">';
- cstr1 +='<span id="start_area" style="font-size:16px;color:#343434;">'+myArray[i][3]+'</span>';
- cstr1 +='<span id="go_info" style="float:right;color:#808080;font-size:14px;">'+myArray[i][5]+'</span>';
- cstr1 +='</div>';
- cstr1 +='<div style="height:32px;width:100%; line-height: 32px;">';
- cstr1 +='<span id="end_area" style="font-size:16px;color:#343434;">'+myArray[i][4]+'</span>';
- cstr1 +='<span id="back_info" style="float:right;color:#808080;font-size:14px;">'+myArray[i][7]+' 班 / 天</span>';
- cstr1 +='</div>';
- cstr1 +='</div>';
-
- 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 += '<div class="tickettitle z" style="float:left;color:#808080;font-size:13px;margin-left:4.89%;margin-top:14px;">'+name+'</div>';
- cstr1 += '</div>';
-
- // 判断往返程信息
- if(myArray[i][8]=="1"){
- cstr1 += '<img class="exchangelogo" style="position:absolute;top:36px;right:6.8%;width:13px; height: 13px;" src="../img/single_arrow.png">';
- }else if(myArray[i][8]=="2"){
- cstr1 += '<img class="exchangelogo" style="position:absolute;top:36px;right:6.8%;width:13px; height: 13px;" src="../img/go_back.png">';
- }
- cstr1 += '<div class="smallboxright y" style="margin-right:-3px; text-align: center;">';
- cstr1 += '<div class="ticketprice" style="margin-right:0px;">';
- cstr1 += '<span style="margin-right:-2px;">¥ </span>';
- cstr1 += '<span>'+myArray[i][2]+'</span>';
- cstr1 += '</div>';
- cstr1 += '<div class="tickettypeimage" style="width:100%;margin-top:29px;float:left;">';
- // 是否包含车子
- var car = myArray[i][9];
- if(car=="1"){
- cstr1 += '<img class="img car" style="" src="../img/car.png" alt="">';
- }
- // 是否包含宾馆
- var hotel = myArray[i][10];
- if (hotel=="1"){
- cstr1 += '<img class="img ticket" style="width: 15px;" src="../img/hotel.png" alt="">';
- }
- // 是否包含景点
- var sightspot = myArray[i][11];
- if (sightspot=="1") {
- cstr1 += '<img class="img hotel" style="width:16px;margin-right:0px;" src="../img/ticket.png" alt="">';
- }
- cstr1 += '</div>';
- cstr1 += '</div>';
- cstr1 += '</div>';
- cstr1 += '</div>';
- }
- }
- if (cstr1 != '')
- {
- cstr2 += '<div class="cell-start-last cell-start zh" onclick="click_cell(\'' + cstr3 + '\')">';
- 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.length;i++) {
- cstr1 = myArray[i];
-
- if (cstr1 == area2)
- {
- city_listHTML +='<li id="li'+(i+1)+'" class="m_button" style="background:#00cc9c;color:#ffffff;border-color:#00cc9c;" onclick="m_get_target_area('+'\''+myArray[i]+'\''+')">'+myArray[i]+'</li>';
- }else{
- city_listHTML +='<li id="li'+(i+1)+'" class="m_button" onclick="m_get_target_area('+'\''+myArray[i]+'\''+')">'+myArray[i]+'</li>';
- }
- }
-
-
- // for (var i=0;i<city_list.length;i++) {
- // cstr1 = city_list[i].city;
- //
- // if (cstr1 == area2)
- // {
- // city_listHTML +='<li id="li'+(i+1)+'" class="m_button" style="background:#00cc9c;color:#ffffff;border-color:#00cc9c;" onclick="m_get_target_area('+'\''+city_list[i].city+'\''+')">'+city_list[i].city+'</li>';
- // }else{
- // city_listHTML +='<li id="li'+(i+1)+'" class="m_button" onclick="m_get_target_area('+'\''+city_list[i].city+'\''+')">'+city_list[i].city+'</li>';
- // }
- // }
- // 执行
- 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.length;i++) {
- cstr2 = myArray2[i];
- if(area2==cstr2){
- sightspot_listHTML +='<li class="m_button" style="color: #FFFFFF;background-color: #00CC9C;border-color: #00CC9C;border-style: solid;"><a id="m_dsn" onclick="m_get_target_area('+'\''+myArray2[i]+'\''+')">'+myArray2[i]+'</a></li>';
- }else{
- sightspot_listHTML +='<li class="m_button"><a id="m_dsn" onclick="m_get_target_area('+'\''+myArray2[i]+'\''+')">'+myArray2[i]+'</a></li>';
- }
-
- }
- // for (var i=0;i<sightspot_list.length;i++) {
- // if(area2==sightspot_list[i].sightspot){
- // sightspot_listHTML +='<li class="m_button" style="color: #FFFFFF;background-color: #00CC9C;border-color: #00CC9C;border-style: solid;"><a id="m_dsn" onclick="m_get_target_area('+'\''+sightspot_list[i].sightspot+'\''+')">'+sightspot_list[i].sightspot+'</a></li>';
- // }else{
- // sightspot_listHTML +='<li class="m_button"><a id="m_dsn" onclick="m_get_target_area('+'\''+sightspot_list[i].sightspot+'\''+')">'+sightspot_list[i].sightspot+'</a></li>';
- // }
- //
- // }
- // 执行
- 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<num1;i++)
- {
- listArray[0][5]++;
- if ((myArray[i][9]-1)==0 && (myArray[i][8]-1)==0 && (myArray[i][10]-0)==0 && (myArray[i][11]-0)==0) listArray[1][5]++;
- if ((myArray[i][9]-1)==0 && (myArray[i][8]-2)==0 && (myArray[i][10]-0)==0 && (myArray[i][11]-0)==0) listArray[2][5]++;
- if ((myArray[i][9]-1)==0 && (myArray[i][8]-1)==0 && (myArray[i][10]-1)==0 && (myArray[i][11]-0)==0) listArray[3][5]++;
- if ((myArray[i][9]-1)==0 && (myArray[i][8]-1)==0 && (myArray[i][10]-0)==0 && (myArray[i][11]-1)==0) listArray[4][5]++;
- if ((myArray[i][9]-1)==0 && (myArray[i][8]-1)==0 && (myArray[i][10]-1)==0 && (myArray[i][11]-1)==0) listArray[5][5]++;
- if ((myArray[i][9]-1)==0 && (myArray[i][8]-2)==0 && (myArray[i][10]-1)==0 && (myArray[i][11]-0)==0) listArray[6][5]++;
- if ((myArray[i][9]-1)==0 && (myArray[i][8]-2)==0 && (myArray[i][10]-0)==0 && (myArray[i][11]-1)==0) listArray[7][5]++;
- if ((myArray[i][9]-1)==0 && (myArray[i][8]-2)==0 && (myArray[i][10]-1)==0 && (myArray[i][11]-1)==0) listArray[8][5]++;
- }
- // var cstr1 = '<span class="type_title z">全部</span><span class="type_count y">' + listArray[0][5] + '条</span>';
- var cstr1 = '<span class="type_title z">全部</span><span class="z" style="margin-left:20px;color:#808080">' + listArray[0][5] + '条</span>';
- 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 +='<img class="y" style="margin-top:7px;width:20px;height:20px;" src="../img/list_check.png"/>';
- }
- document.getElementById('c_header_all').innerHTML = cstr1;
- cstr1 = '<ul>';
- for (var i=1;i<9;i++)
- {
- if ((listArray[i][5] - 0) != 0){
- if(i==temp_lino){
- cstr1 += '<li id="li'+i+'" style="background:url(../img/list_check.png) no-repeat;background-size: 20px 20px;background-position:100%; height:55px;line-height:55px;border-bottom: 1px solid #e5e5e5;" onclick="show_product_list('+ i + ','+ listArray[i][1] + ',' + listArray[i][2] + ',' + listArray[i][3] + ',' + listArray[i][4] + ')"><span class="z" style="color:#4d4d4d;">' + listArray[i][0] + '</span> <span class="z" style="margin-left:20px;color:#808080">' + listArray[i][5] + '条</span></li>';
- }else{
- // cstr1 += '<li onclick="show_product_list(' + listArray[i][1] + ',' + listArray[i][2] + ',' + listArray[i][3] + ',' + listArray[i][4] + ')">' + listArray[i][0] + '<span>' + listArray[i][5] + '条</span></li>';
- cstr1 += '<li id="li'+i+'" style="height:55px;line-height:55px;border-bottom: 1px solid #e5e5e5;" onclick="show_product_list('+ i + ','+ listArray[i][1] + ',' + listArray[i][2] + ',' + listArray[i][3] + ',' + listArray[i][4] + ')"><span class="z" style="color:#4d4d4d;">' + listArray[i][0] + '</span> <span class="z" style="margin-left:20px;color:#808080">' + listArray[i][5] + '条</span></li>';
-
- }
- }
- }
- cstr1 += '</ul>';
- 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;
-
- }
|