You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

189 lines
5.6 KiB

  1. // 目的地产品的开始
  2. var temp_httpData;
  3. var temp_typeID;
  4. function init_page(){
  5. var typeID = getPar('type_id');
  6. temp_typeID = typeID;
  7. var url = "http://xmwx.zhizhuchuxing.cn/core/detail.asp?prodcode=";
  8. get_virtual_user_list(url);
  9. }
  10. function reload_Info(httpData){
  11. temp_httpData = httpData;
  12. click_ticket_type(temp_typeID);
  13. }
  14. // 点击三个票种
  15. function click_ticket_type(type_id){
  16. temp_typeID = type_id;
  17. var ship_ticket = document.getElementById("ship_ticket");
  18. clear_three_ticket_type(ship_ticket);
  19. var hotel_ticket = document.getElementById("hotel_ticket");
  20. clear_three_ticket_type(hotel_ticket);
  21. var door_ticket = document.getElementById("door_ticket");
  22. clear_three_ticket_type(door_ticket);
  23. if(type_id=="1"){
  24. ship_ticket.style.color = 'lawngreen';
  25. ship_ticket.style.borderBottomWidth = "2px";
  26. ship_ticket.style.borderBottomStyle = "solid";
  27. ship_ticket.style.borderBottomColor = "lawngreen";
  28. }else if(type_id=="2"){
  29. hotel_ticket.style.color = 'lawngreen';
  30. hotel_ticket.style.borderBottomWidth = "2px";
  31. hotel_ticket.style.borderBottomStyle = "solid";
  32. hotel_ticket.style.borderBottomColor = "lawngreen";
  33. }else{
  34. door_ticket.style.color = 'lawngreen';
  35. door_ticket.style.borderBottomWidth = "2px";
  36. door_ticket.style.borderBottomStyle = "solid";
  37. door_ticket.style.borderBottomColor = "lawngreen";
  38. }
  39. var recommand_list = temp_httpData.recommand_list;
  40. var recoomand_prod_list = recommand_list[type_id-1].recoomand_prod_list;
  41. var m_all_cell = document.getElementById("m_all_cell");
  42. var allcellHTML = '';
  43. for (var i=0;i<recoomand_prod_list.length;i++) {
  44. allcellHTML +='<div class="m_contain_cells" onclick="click_m_cell('+'\''+recoomand_prod_list[i].re_prod_code+'\''+')">';
  45. allcellHTML +='<div class="m_single_cell">';
  46. allcellHTML +='<div class="m_cell zh">';
  47. allcellHTML +='<div class="m_cell_left z">';
  48. allcellHTML +='<img class="ticket_img z" src="../'+recoomand_prod_list[i].re_prod_img+'" />';
  49. allcellHTML +='</div>';
  50. allcellHTML +='<div class="m_cell_right y">';
  51. allcellHTML +='<div class="m_cell_ticket_title">'+recoomand_prod_list[i].re_prod_title+'</div>'
  52. allcellHTML +='<div class="m_cell_ticket_price y">¥'+recoomand_prod_list[i].re_prod_price+'</div>'
  53. allcellHTML +='</div>'
  54. allcellHTML +='</div>'
  55. allcellHTML +='</div>'
  56. allcellHTML +='</div>'
  57. }
  58. // 执行
  59. m_all_cell.innerHTML = allcellHTML;
  60. }
  61. // 点击目的地产品的单元格
  62. function click_m_cell(prod_code){
  63. var listURL = "mdidiDetail.html?prod_code="+prod_code+'&type_id='+temp_typeID;
  64. // 跳转前将URL编码
  65. listURL = encodeURI(listURL);
  66. window.location.href = listURL;
  67. }
  68. // 清空三个票种的选中效果
  69. function clear_three_ticket_type(type){
  70. type.style.color = "black";
  71. type.style.backgroundColor = "white";
  72. type.style.borderBottomWidth = "0px";
  73. }
  74. // 目的地产品的结束
  75. // 从上一页的链接上获取参数
  76. function getPar(par){
  77. //获取当前URL
  78. var local_url = document.location.href;
  79. // 接收的时候将URL 解码
  80. local_url = decodeURI(local_url);
  81. //获取要取得的get参数位置
  82. var get = local_url.indexOf(par +"=");
  83. if(get == -1){
  84. return false;
  85. }
  86. //截取字符串
  87. var get_par = local_url.slice(par.length + get + 1);
  88. //判断截取后的字符串是否还有其他get参数
  89. var nextPar = get_par.indexOf("&");
  90. if(nextPar != -1){
  91. get_par = get_par.slice(0, nextPar);
  92. }
  93. return get_par;
  94. }
  95. /*======================网络请求的Ajax的代码=======================*/
  96. // 创建一个Ajax对象
  97. if (window.ActiveXObject){
  98. var myreq = new ActiveXObject("Microsoft.XMLHTTP");
  99. }else{
  100. var myreq = new XMLHttpRequest();
  101. }
  102. // 请求方法,传入URL
  103. function get_virtual_user_list(myURL)
  104. {
  105. var tnowtime = getDateTime(4);
  106. // m_url = 接口
  107. // var myURL = m_url + 'op=userlink&vuser=' + cvuserid + '&tt=' + tnowtime;
  108. // var myURL = "http://xmwx.zhizhuchuxing.cn/core/area_target.asp?keyword=";
  109. myreq.open("get",myURL,true);
  110. // 接收的数据交给哪个函数处理
  111. myreq.onreadystatechange = show_user_list;
  112. myreq.send();
  113. }
  114. function show_user_list()
  115. {
  116. if (myreq.readyState == 4)
  117. {
  118. // newstr 就是接收到的数据
  119. var newstr = myreq.responseText;
  120. var httpData=JSON.parse(newstr);
  121. //
  122. reload_Info(httpData);
  123. }
  124. }
  125. function getDateTime(nTypeFlag)
  126. {
  127. var tNowTime = new Date();
  128. var myYear = ';' + tNowTime.getFullYear() + ';';
  129. var myMonth = ';' + (tNowTime.getMonth()+1-0) + ';';
  130. var myDay = ';' + tNowTime.getDate()+ ';';
  131. var myHour = ';' + tNowTime.getHours()+ ';';
  132. var myMinu = ';' + tNowTime.getMinutes()+ ';';
  133. var mySecond = ';' + tNowTime.getSeconds()+ ';';
  134. if (myMonth.length < 4) myMonth = '0' + myMonth;
  135. if (myDay.length < 4) myDay = '0' + myDay;
  136. if (myHour.length < 4) myHour = '0' + myHour;
  137. if (myMinu.length < 4) myMinu = '0' + myMinu;
  138. if (mySecond.length < 4) mySecond = '0' + mySecond;
  139. var cNewTimeStr;
  140. //alert(tNowTime);
  141. switch (nTypeFlag+1-1)
  142. {
  143. case 0:
  144. cNewTimeStr = myYear + '-' + myMonth + '-' + myDay;
  145. break;
  146. case 1:
  147. cNewTimeStr = myYear + myMonth + myDay;
  148. break;
  149. case 2:
  150. cNewTimeStr = myHour + ':' + myMinu + ':' + mySecond;
  151. break;
  152. case 3:
  153. cNewTimeStr = myHour + myMinu + mySecond;
  154. break;
  155. case 4:
  156. cNewTimeStr = myYear + myMonth + myDay + myHour + myMinu + mySecond;
  157. break;
  158. case 5:
  159. cNewTimeStr = myYear + '年' + myMonth + '月' + myDay + '日';
  160. break;
  161. case 6:
  162. cNewTimeStr = myYear;
  163. break;
  164. case 7:
  165. cNewTimeStr = myYear + '-' + myMonth;
  166. break;
  167. default:
  168. cNewTimeStr = myYear + '-' + myMonth + '-' + myDay + ' ' + myHour + ':' + myMinu + ':' + mySecond;
  169. break;
  170. }
  171. cNewTimeStr = cNewTimeStr.replace(/;/g,"");
  172. return cNewTimeStr;
  173. }