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.
 
 
 
 
 

295 lines
9.9 KiB

  1. var temp_typeID;
  2. var current_prod_code;
  3. var isFav=false;//是否是收藏
  4. var m_f_runid = '';
  5. var m_f_godate = '';
  6. var m_f_gotime = '';
  7. var m_f_backdate = '';
  8. var m_f_backtime = '';
  9. function init_page(){
  10. var prod_code = getPar('prod_code');
  11. current_prod_code = prod_code;
  12. var type_id = getPar('type_id');
  13. temp_typeID = type_id;
  14. var url = "http://xmwx.zhizhuchuxing.cn/core/detail.asp?prodcode="+prod_code;
  15. get_virtual_user_list(url);
  16. }
  17. function reload_Info(httpData){
  18. var header_center = document.getElementById("header-center");
  19. var centerHTML = '';
  20. centerHTML +='<div class="sight-image-div">';
  21. centerHTML +='<img class="sight-img" src="../img/fo.jpg" />';
  22. centerHTML +='</div>';
  23. centerHTML +='<div class="ticket-info">';
  24. var typeStr = "";
  25. typeStr = "船票";
  26. centerHTML +='<div class="ticket-name" style="margin-left:2%"><span class="prod_name">'+httpData.prod_name+'</span></div>';
  27. centerHTML +='<div class="ticket-type-price">';
  28. 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>';
  29. centerHTML +='</div>';
  30. centerHTML +='</div>';
  31. // 执行
  32. header_center.innerHTML = centerHTML;
  33. // 三个type
  34. var three_type_center = document.getElementById("three-type-center");
  35. var threeHTML = '';
  36. threeHTML +='<div name="type-title" id="type-title" class="type-title">';
  37. // circuitry_intro: "出行介绍文字内容包含图片[img]prod_img/001.jpg[/img]出行介绍文字内容包含图片",
  38. //station_intro: "上下站点介绍文字内容包含图片[img]prod_img/002.jpg[/img]上下站点介绍文字内容包含图片",
  39. //price_intro: "费用介绍文字内容包含图片[img]prod_img/003.jpg[/img]费用介绍文字内容包含图片",
  40. //threeHTML +='<span id="chuxingjs" class="z txtzh" onclick="click_chuxingjs('+'\''+subStrFormContext(httpData.circuitry_intro)[1]+'\''+')">介绍</span>';
  41. threeHTML +='<span id="chuxingjs" class="z txtzh" onclick="click_chuxingjs('+'\''+ httpData.circuitry_intro +'\''+')">介绍</span>';
  42. // threeHTML +='<span id="shangxiazd" class="z txtzh" onclick="click_shangxiazd('+'\''+subStrFormContext(httpData.station_intro)[1]+'\''+')">上下站点</span>';
  43. //threeHTML +='<span id="feiyongsm" class="y txtzh" onclick="click_feiyongsm('+'\''+subStrFormContext(httpData.price_intro)[1]+'\''+')">费用说明</span>';
  44. threeHTML +='<span id="feiyongsm" class="y txtzh" onclick="click_feiyongsm('+'\''+ httpData.price_intro +'\''+')">费用说明</span>';
  45. threeHTML +='</div>';
  46. //threeHTML +='<div id="type-info" class="type-info">'+subStrFormContext(httpData.circuitry_intro)[1]+'</div>';
  47. var cstr1 = '<p>普陀山素有“海天佛国”、“南海圣境”之称,是国家5A级旅游风景区,有普济寺、法雨寺、盘陀庵、灵石庵等寺庙和潮音洞、梵音洞等名胜。</p>';
  48. threeHTML +='<div id="type-info" class="type-info">'+ cstr1 +'</div>';
  49. //20160509获取初次开班信息
  50. m_f_runid = httpData.f_runid;
  51. m_f_godate = httpData.f_godate;
  52. m_f_gotime = httpData.f_gotime;
  53. m_f_backdate = httpData.f_backdate;
  54. m_f_backtime = httpData.f_backtime;
  55. // 执行
  56. three_type_center.innerHTML = threeHTML;
  57. }
  58. // 将出行介绍、上下班点、费用说明三个按钮颜色清空
  59. function clear_type_title_color(){
  60. var chuxingjs = document.getElementById("chuxingjs");
  61. // var shangxiazd = document.getElementById("shangxiazd");
  62. var feiyongsm = document.getElementById("feiyongsm");
  63. chuxingjs.style.color = "#343434";
  64. chuxingjs.style.borderBottomWidth="0px";
  65. // shangxiazd.style.color = "#343434";
  66. // shangxiazd.style.borderBottomWidth="0px";
  67. feiyongsm.style.color = "#343434";
  68. feiyongsm.style.borderBottomWidth="0px";
  69. }
  70. // 点击出行介绍
  71. function click_chuxingjs(intro){
  72. clear_type_title_color();
  73. var chuxingjs = document.getElementById("chuxingjs");
  74. change_css_type(chuxingjs);
  75. var type_info = document.getElementById("type-info");
  76. var cstr1 = '<p>普陀山素有“海天佛国”、“南海圣境”之称,是国家5A级旅游风景区,有普济寺、法雨寺、盘陀庵、灵石庵等寺庙和潮音洞、梵音洞等名胜。</p>';
  77. type_info.innerHTML = cstr1;
  78. //type_info.innerHTML=intro;
  79. }
  80. // 点击上下站点
  81. //function click_shangxiazd(intro){
  82. // clear_type_title_color();
  83. // var shangxiazd = document.getElementById("shangxiazd");
  84. // change_css_type(shangxiazd);
  85. // var type_info = document.getElementById("type-info");
  86. // type_info.innerHTML=intro;
  87. //}
  88. // 点击费用说明
  89. function click_feiyongsm(intro){
  90. clear_type_title_color();
  91. var feiyongsm = document.getElementById("feiyongsm");
  92. change_css_type(feiyongsm);
  93. var type_info = document.getElementById("type-info");
  94. //type_info.innerHTML=intro;
  95. var cstr1 = '<p style="margin-left:0%;">包含:普陀山大门票(二日可用)、朱家尖至普陀山单程船票、30万保额旅游意外险;</p><p style="margin-left:0%;">不包含:寺院香花卷,景区小交通。</p>'
  96. cstr1 += '<p style="margin-left:0%;margin-top:5px;">注:(1) 淡季1月份、12月份门票价格为140元/人</p>';
  97. cstr1 += '<p>(2) 旺季2月份至11月份门票介格为160元/人</p>';
  98. cstr1 += '<p>(3) 正月初一至初五、五月一日至三日、十月一日至五日上浮至200元/人</p>';
  99. cstr1 += '<p>(4) 朱家尖码头---普陀山码头单程船票25元/人</p>';
  100. cstr1 += '<p>(5) 景区景点意外险10元/人/单</p>';
  101. type_info.innerHTML=cstr1;
  102. }
  103. // 改变三个type的样式
  104. function change_css_type(type){
  105. type.style.borderBottomWidth="2px";
  106. type.style.borderBottomStyle="solid";
  107. type.style.borderBottomColor="#00cc9c";
  108. }
  109. // foot上的收藏和立即预订
  110. //function click_fav(){
  111. // var fav = document.getElementById("fav");
  112. // if(fav.innerHTML=="收藏"){
  113. // isFav = true;
  114. // var url = "http://xmwx.zhizhuchuxing.cn/core/keep.asp?prodcode="+current_prod_code;
  115. // get_virtual_user_list(url);
  116. // }
  117. //}
  118. // 收藏产品
  119. //function fav_product(httpData){
  120. // var fav = document.getElementById("fav");
  121. // if(httpData.code=="0"){
  122. // alert("收藏成功!");
  123. // fav.innerHTML="已收藏";
  124. // fav.style.backgroundColor='gray';
  125. // fav.disabled=true;
  126. // }else{
  127. // alert("收藏失败!");
  128. // fav.innerHTML="已收藏";
  129. // }
  130. //}
  131. function click_bookNow(){
  132. 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;
  133. // 跳转前将URL编码
  134. listURL = encodeURI(listURL);
  135. window.location.href = listURL;
  136. }
  137. // 从内容中截取图片名称
  138. function subStrFormContext(context){
  139. var imgName="";
  140. var i = context.indexOf("[img]");
  141. var j = context.indexOf("[/img]");
  142. if (j-i>0 && i>=0)
  143. {
  144. imgName=context.substring(i+5,j);
  145. // 去掉[img][/img]的文本内容
  146. var str1 = context.substring(0,i);
  147. var str2 = context.substring(j+6,context.length);
  148. var str = str1+str2;
  149. }
  150. var img_str = new Array();
  151. img_str.push(imgName); //0
  152. img_str.push(str); //1
  153. img_str.push(str1); //2
  154. img_str.push(str2); //3
  155. return img_str;
  156. }
  157. // 从上一页的链接上获取参数
  158. function getPar(par){
  159. //获取当前URL
  160. var local_url = document.location.href;
  161. // 接收的时候将URL 解码
  162. local_url = decodeURI(local_url);
  163. //获取要取得的get参数位置
  164. var get = local_url.indexOf(par +"=");
  165. if(get == -1){
  166. return false;
  167. }
  168. //截取字符串
  169. var get_par = local_url.slice(par.length + get + 1);
  170. //判断截取后的字符串是否还有其他get参数
  171. var nextPar = get_par.indexOf("&");
  172. if(nextPar != -1){
  173. get_par = get_par.slice(0, nextPar);
  174. }
  175. return get_par;
  176. }
  177. /*======================网络请求的Ajax的代码=======================*/
  178. // 创建一个Ajax对象
  179. if (window.ActiveXObject){
  180. var myreq = new ActiveXObject("Microsoft.XMLHTTP");
  181. }else{
  182. var myreq = new XMLHttpRequest();
  183. }
  184. // 请求方法,传入URL
  185. function get_virtual_user_list(myURL)
  186. {
  187. var tnowtime = getDateTime(4);
  188. // m_url = 接口
  189. // var myURL = m_url + 'op=userlink&vuser=' + cvuserid + '&tt=' + tnowtime;
  190. // var myURL = "http://xmwx.zhizhuchuxing.cn/core/area_target.asp?keyword=";
  191. myreq.open("get",myURL,true);
  192. // 接收的数据交给哪个函数处理
  193. myreq.onreadystatechange = show_user_list;
  194. myreq.send();
  195. }
  196. function show_user_list()
  197. {
  198. if (myreq.readyState == 4)
  199. {
  200. // newstr 就是接收到的数据
  201. var newstr = myreq.responseText;
  202. var httpData=JSON.parse(newstr);
  203. //
  204. if (isFav==false) {
  205. reload_Info(httpData);
  206. }else{
  207. // 收藏
  208. fav_product(httpData);
  209. }
  210. }
  211. }
  212. function getDateTime(nTypeFlag)
  213. {
  214. var tNowTime = new Date();
  215. var myYear = ';' + tNowTime.getFullYear() + ';';
  216. var myMonth = ';' + (tNowTime.getMonth()+1-0) + ';';
  217. var myDay = ';' + tNowTime.getDate()+ ';';
  218. var myHour = ';' + tNowTime.getHours()+ ';';
  219. var myMinu = ';' + tNowTime.getMinutes()+ ';';
  220. var mySecond = ';' + tNowTime.getSeconds()+ ';';
  221. if (myMonth.length < 4) myMonth = '0' + myMonth;
  222. if (myDay.length < 4) myDay = '0' + myDay;
  223. if (myHour.length < 4) myHour = '0' + myHour;
  224. if (myMinu.length < 4) myMinu = '0' + myMinu;
  225. if (mySecond.length < 4) mySecond = '0' + mySecond;
  226. var cNewTimeStr;
  227. //alert(tNowTime);
  228. switch (nTypeFlag+1-1)
  229. {
  230. case 0:
  231. cNewTimeStr = myYear + '-' + myMonth + '-' + myDay;
  232. break;
  233. case 1:
  234. cNewTimeStr = myYear + myMonth + myDay;
  235. break;
  236. case 2:
  237. cNewTimeStr = myHour + ':' + myMinu + ':' + mySecond;
  238. break;
  239. case 3:
  240. cNewTimeStr = myHour + myMinu + mySecond;
  241. break;
  242. case 4:
  243. cNewTimeStr = myYear + myMonth + myDay + myHour + myMinu + mySecond;
  244. break;
  245. case 5:
  246. cNewTimeStr = myYear + '年' + myMonth + '月' + myDay + '日';
  247. break;
  248. case 6:
  249. cNewTimeStr = myYear;
  250. break;
  251. case 7:
  252. cNewTimeStr = myYear + '-' + myMonth;
  253. break;
  254. default:
  255. cNewTimeStr = myYear + '-' + myMonth + '-' + myDay + ' ' + myHour + ':' + myMinu + ':' + mySecond;
  256. break;
  257. }
  258. cNewTimeStr = cNewTimeStr.replace(/;/g,"");
  259. return cNewTimeStr;
  260. }