|
- // 目的地产品的开始
- var temp_httpData;
- var temp_typeID;
- function init_page(){
- var typeID = getPar('type_id');
- temp_typeID = typeID;
- var url = "http://xmwx.zhizhuchuxing.cn/core/detail.asp?prodcode=";
- get_virtual_user_list(url);
- }
- function reload_Info(httpData){
- temp_httpData = httpData;
- click_ticket_type(temp_typeID);
- }
- // 点击三个票种
- function click_ticket_type(type_id){
- temp_typeID = 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 = 'lawngreen';
- ship_ticket.style.borderBottomWidth = "2px";
- ship_ticket.style.borderBottomStyle = "solid";
- ship_ticket.style.borderBottomColor = "lawngreen";
- }else if(type_id=="2"){
- hotel_ticket.style.color = 'lawngreen';
- hotel_ticket.style.borderBottomWidth = "2px";
- hotel_ticket.style.borderBottomStyle = "solid";
- hotel_ticket.style.borderBottomColor = "lawngreen";
- }else{
- door_ticket.style.color = 'lawngreen';
- door_ticket.style.borderBottomWidth = "2px";
- door_ticket.style.borderBottomStyle = "solid";
- door_ticket.style.borderBottomColor = "lawngreen";
- }
-
-
- var recommand_list = temp_httpData.recommand_list;
- var recoomand_prod_list = recommand_list[type_id-1].recoomand_prod_list;
- var m_all_cell = document.getElementById("m_all_cell");
- var allcellHTML = '';
- for (var i=0;i<recoomand_prod_list.length;i++) {
- allcellHTML +='<div class="m_contain_cells" onclick="click_m_cell('+'\''+recoomand_prod_list[i].re_prod_code+'\''+')">';
- allcellHTML +='<div class="m_single_cell">';
- allcellHTML +='<div class="m_cell zh">';
- allcellHTML +='<div class="m_cell_left z">';
- allcellHTML +='<img class="ticket_img z" src="../'+recoomand_prod_list[i].re_prod_img+'" />';
- allcellHTML +='</div>';
- allcellHTML +='<div class="m_cell_right y">';
- allcellHTML +='<div class="m_cell_ticket_title">'+recoomand_prod_list[i].re_prod_title+'</div>'
- allcellHTML +='<div class="m_cell_ticket_price y">¥'+recoomand_prod_list[i].re_prod_price+'</div>'
- allcellHTML +='</div>'
- allcellHTML +='</div>'
- allcellHTML +='</div>'
- allcellHTML +='</div>'
- }
- // 执行
- m_all_cell.innerHTML = allcellHTML;
-
- }
- // 点击目的地产品的单元格
- function click_m_cell(prod_code){
- var listURL = "mdidiDetail.html?prod_code="+prod_code+'&type_id='+temp_typeID;
- // 跳转前将URL编码
- listURL = encodeURI(listURL);
- window.location.href = listURL;
- }
- // 清空三个票种的选中效果
- function clear_three_ticket_type(type){
- type.style.color = "black";
- type.style.backgroundColor = "white";
- type.style.borderBottomWidth = "0px";
- }
- // 目的地产品的结束
- // 从上一页的链接上获取参数
- 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;
- }
- /*======================网络请求的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;
-
- }
-
-
-
-
|