Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 

405 rader
14 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. var httpData=null;
  10. //
  11. /*======================网络请求的Ajax的代码=======================*/
  12. // 创建一个Ajax对象
  13. if (window.ActiveXObject) {
  14. var myreq = new ActiveXObject("Microsoft.XMLHTTP");
  15. } else {
  16. var myreq = new XMLHttpRequest();
  17. }
  18. console.log('startTime-load='+getDateTime(4));
  19. //window.onload=function(){
  20. var prod_code = getPar('prod_code');
  21. current_prod_code = prod_code;
  22. // var type_id = getPar('type_id');
  23. // temp_typeID = type_id;
  24. if(!prod_code)prod_code='dsnhz004';
  25. console.log('startTime='+getDateTime(4));
  26. var url = "http://xmwx.zhizhuchuxing.cn/core/detail.asp?prodcode=" + prod_code;
  27. // var url = "http://xmwx.zhizhuchuxing.cn/core/detail.asp?prodcode=dsnhz004";
  28. console.log(url)
  29. get_virtual_user_list(url);
  30. // }
  31. // 请求方法,传入URL
  32. function get_virtual_user_list(myURL) {
  33. var tnowtime = getDateTime(4);
  34. if (myURL.indexOf('?') >= 0) {
  35. myURL += '&tt=' + tnowtime;
  36. } else {
  37. myURL += '?tt=' + tnowtime;
  38. }
  39. myreq.open("get", myURL, true);
  40. // 接收的数据交给哪个函数处理
  41. myreq.onreadystatechange = function() {
  42. if (myreq.readyState == 4) {
  43. // newstr 就是接收到的数据
  44. var newstr = myreq.responseText;
  45. httpData = JSON.parse(newstr);
  46. console.log('endTime='+getDateTime(4));
  47. //top img
  48. // var tttt=httpData['cir_img'];
  49. // console.log('<img class="sight-img" src="'+tttt+'"/>');
  50. //票名称
  51. document.getElementById('ticket-name').innerHTML=httpData['prod_name'];
  52. //迪士尼价格
  53. document.getElementById('dsn_price').innerHTML='<span style="font-size:13px;">¥</span>'+httpData['price'];
  54. // //交通
  55. //和柴哥约定,,,交通用 circuitry_intro 预订须知用station_intro
  56. if (httpData['circuitry_intro'].trim().length<=0) {
  57. document.getElementById('son1').style.display='none';
  58. }else{
  59. var traffic=httpData['circuitry_intro'];
  60. traffic=traffic.replace(/\/br/g,'<br/>');
  61. document.getElementById('son_traffic').innerHTML=traffic;
  62. }
  63. // //酒店
  64. if (httpData['hotel_intro'].trim().length<=0) {
  65. document.getElementById('son2').style.display='none';
  66. }else{
  67. var hotel=httpData['hotel_intro'];
  68. hotel=hotel.replace(/\/br/g,'<br/>');
  69. document.getElementById('son_hotel').innerHTML=hotel;
  70. }
  71. //费用说明
  72. var fee_intro=httpData['price_intro'];
  73. // cstr1 = cstr1.replace(/\[\/J\]/g,'<li class="li_3"><span class="span_2"></span></li>\n');
  74. fee_intro=fee_intro.replace(/\/br/g,'<br/>');
  75. document.getElementById('son_fee_intro').innerHTML=fee_intro;
  76. if (httpData['circuitry_intro'].trim().length<=0&&
  77. httpData['hotel_intro'].trim().length<=0&&
  78. httpData['park_intro'].trim().length<=0&&
  79. httpData['show_intro'].trim().length<=0) {
  80. }else{
  81. //出行介绍选中
  82. var chu1=document.getElementById('chuxingjs');
  83. click_type(chu1, chu1.innerHTML, null);
  84. }
  85. console.log('page_endTime='+getDateTime(4));
  86. // 头图
  87. document.getElementById("top-img").innerHTML='<img class="sight-img" src="'+httpData['cir_img']+'"/>';
  88. //迪士尼 img
  89. if (httpData['park_intro'].trim().length<=0) {
  90. document.getElementById('son3').style.display='none';
  91. }else{
  92. document.getElementsByClassName('son_disney_ticket')[0].innerHTML='<img style="margin-bottom: 30px;" width="100%" src="'+httpData['park_intro']+'"/>'
  93. }
  94. //狮子王 img
  95. if (httpData['show_intro'].trim().length<=0) {
  96. document.getElementById('son4').style.display='none';
  97. }else{
  98. document.getElementsByClassName('son_lion_king_ticket')[0].innerHTML='<img style="margin-bottom: 30px;" width="100%" src="'+httpData['show_intro']+'"/>'
  99. }
  100. // //20160509获取初次开班信息
  101. // m_f_runid = httpData.f_runid;
  102. // m_f_godate = httpData.f_godate;
  103. // m_f_gotime = httpData.f_gotime;
  104. // m_f_backdate = httpData.f_backdate;
  105. // m_f_backtime = httpData.f_backtime;
  106. }
  107. };
  108. myreq.send();
  109. }
  110. //点击 type 切换
  111. function click_type(self_obj, type_name, father_name_id) {
  112. clear_type_title_color();
  113. clear_type_son_color();
  114. hidden_son_div();
  115. if (father_name_id) {
  116. change_css_type(document.getElementById(father_name_id))
  117. self_obj.className = 'type_son_select z txtzh son';
  118. } else {
  119. change_css_type(self_obj);
  120. }
  121. switch (type_name) {
  122. case "出行介绍":
  123. document.getElementById('intro-type').style.display = 'block';
  124. document.getElementById('son1').className = 'type_son_select z txtzh son';
  125. document.getElementById('son_traffic').style.display='block';
  126. break;
  127. case "费用说明":
  128. document.getElementById('intro-type').style.display = 'none';
  129. document.getElementById('son_fee_intro').style.display='block';
  130. break;
  131. case "交通":
  132. document.getElementById('son_traffic').style.display='block';
  133. break;
  134. case "酒店":
  135. document.getElementById('son_hotel').style.display='block';
  136. break;
  137. case "迪士尼门票":
  138. document.getElementById('son_disney_ticket').style.display='block';
  139. break;
  140. case "狮子王门票":
  141. document.getElementById('son_lion_king_ticket').style.display='block';
  142. break;
  143. default:
  144. break;
  145. }
  146. }
  147. function hidden_son_div(){
  148. var arr_son_divs=document.getElementsByClassName('son_div');
  149. for (var i=0;i<arr_son_divs.length;i++) {
  150. arr_son_divs[i].style.display='none';
  151. }
  152. }
  153. function clear_type_son_color() {
  154. var arr_type_sons = document.getElementsByClassName('son');
  155. for (var i = 0; i < arr_type_sons.length; i++) {
  156. arr_type_sons[i].className = 'type_son z txtzh son';
  157. }
  158. }
  159. // 颜色清空
  160. function clear_type_title_color() {
  161. var arr_typenames = document.getElementsByClassName('typename');
  162. for (var i = 0; i < arr_typenames.length; i++) {
  163. arr_typenames[i].style.color = "#343434";
  164. arr_typenames[i].style.borderBottomWidth = "0px";
  165. arr_typenames[i].style.backgroundColor = 'white';
  166. }
  167. }
  168. // 改变三个type的样式
  169. function change_css_type(type) {
  170. type.style.borderBottomWidth = "2px";
  171. type.style.borderBottomStyle = "solid";
  172. type.style.borderBottomColor = "#00cc9c";
  173. }
  174. function click_bookNow() {
  175. // 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;
  176. var listURL = "../reserve_style2.html?prodcode=" + current_prod_code;
  177. // 跳转前将URL编码
  178. listURL = encodeURI(listURL);
  179. window.location.href = listURL;
  180. }
  181. // 从上一页的链接上获取参数
  182. function getPar(par) {
  183. //获取当前URL
  184. var local_url = document.location.href;
  185. // 接收的时候将URL 解码
  186. local_url = decodeURI(local_url);
  187. //获取要取得的get参数位置
  188. var get = local_url.indexOf(par + "=");
  189. if (get == -1) {
  190. return false;
  191. }
  192. //截取字符串
  193. var get_par = local_url.slice(par.length + get + 1);
  194. //判断截取后的字符串是否还有其他get参数
  195. var nextPar = get_par.indexOf("&");
  196. if (nextPar != -1) {
  197. get_par = get_par.slice(0, nextPar);
  198. }
  199. return get_par;
  200. }
  201. //
  202. //function reload_Info(httpData){
  203. // var header_center = document.getElementById("header-center");
  204. // var centerHTML = '';
  205. // centerHTML +='<div class="sight-image-div">';
  206. // centerHTML +='<img class="sight-img" src="../img/fo.jpg" />';
  207. // centerHTML +='</div>';
  208. // centerHTML +='<div class="ticket-info">';
  209. // var typeStr = "";
  210. // typeStr = "船票";
  211. // centerHTML +='<div class="ticket-name" style="margin-left:2%"><span class="prod_name">'+httpData.prod_name+'</span></div>';
  212. // centerHTML +='<div class="ticket-type-price">';
  213. // 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>';
  214. // centerHTML +='</div>';
  215. // centerHTML +='</div>';
  216. // // 执行
  217. // header_center.innerHTML = centerHTML;
  218. //
  219. // // 三个type
  220. // var three_type_center = document.getElementById("three-type-center");
  221. // var threeHTML = '';
  222. // threeHTML +='<div name="type-title" id="type-title" class="type-title">';
  223. //
  224. //// circuitry_intro: "出行介绍文字内容包含图片[img]prod_img/001.jpg[/img]出行介绍文字内容包含图片",
  225. ////station_intro: "上下站点介绍文字内容包含图片[img]prod_img/002.jpg[/img]上下站点介绍文字内容包含图片",
  226. ////price_intro: "费用介绍文字内容包含图片[img]prod_img/003.jpg[/img]费用介绍文字内容包含图片",
  227. //
  228. // //threeHTML +='<span id="chuxingjs" class="z txtzh" onclick="click_chuxingjs('+'\''+subStrFormContext(httpData.circuitry_intro)[1]+'\''+')">介绍</span>';
  229. // threeHTML +='<span id="chuxingjs" class="z txtzh" onclick="click_chuxingjs('+'\''+ httpData.circuitry_intro +'\''+')">介绍</span>';
  230. //// threeHTML +='<span id="shangxiazd" class="z txtzh" onclick="click_shangxiazd('+'\''+subStrFormContext(httpData.station_intro)[1]+'\''+')">上下站点</span>';
  231. // //threeHTML +='<span id="feiyongsm" class="y txtzh" onclick="click_feiyongsm('+'\''+subStrFormContext(httpData.price_intro)[1]+'\''+')">费用说明</span>';
  232. // threeHTML +='<span id="feiyongsm" class="y txtzh" onclick="click_feiyongsm('+'\''+ httpData.price_intro +'\''+')">费用说明</span>';
  233. // threeHTML +='</div>';
  234. // //threeHTML +='<div id="type-info" class="type-info">'+subStrFormContext(httpData.circuitry_intro)[1]+'</div>';
  235. //
  236. // var cstr1 = '<p>普陀山素有“海天佛国”、“南海圣境”之称,是国家5A级旅游风景区,有普济寺、法雨寺、盘陀庵、灵石庵等寺庙和潮音洞、梵音洞等名胜。</p>';
  237. // threeHTML +='<div id="type-info" class="type-info">'+ cstr1 +'</div>';
  238. //
  239. //// //20160509获取初次开班信息
  240. // m_f_runid = httpData.f_runid;
  241. // m_f_godate = httpData.f_godate;
  242. // m_f_gotime = httpData.f_gotime;
  243. // m_f_backdate = httpData.f_backdate;
  244. // m_f_backtime = httpData.f_backtime;
  245. //
  246. // // 执行
  247. // three_type_center.innerHTML = threeHTML;
  248. //
  249. //}
  250. //
  251. //// 点击出行介绍
  252. //function click_chuxingjs(intro){
  253. // clear_type_title_color();
  254. // var chuxingjs = document.getElementById("chuxingjs");
  255. // change_css_type(chuxingjs);
  256. // var type_info = document.getElementById("type-info");
  257. //
  258. // var cstr1 = '<p>普陀山素有“海天佛国”、“南海圣境”之称,是国家5A级旅游风景区,有普济寺、法雨寺、盘陀庵、灵石庵等寺庙和潮音洞、梵音洞等名胜。</p>';
  259. // type_info.innerHTML = cstr1;
  260. //
  261. // //type_info.innerHTML=intro;
  262. //}
  263. //// 点击上下站点
  264. ////function click_shangxiazd(intro){
  265. //// clear_type_title_color();
  266. //// var shangxiazd = document.getElementById("shangxiazd");
  267. //// change_css_type(shangxiazd);
  268. //// var type_info = document.getElementById("type-info");
  269. //// type_info.innerHTML=intro;
  270. ////}
  271. //// 点击费用说明
  272. //function click_feiyongsm(intro){
  273. // clear_type_title_color();
  274. // var feiyongsm = document.getElementById("feiyongsm");
  275. // change_css_type(feiyongsm);
  276. // var type_info = document.getElementById("type-info");
  277. //
  278. // //type_info.innerHTML=intro;
  279. // var cstr1 = '<p style="margin-left:0%;">包含:普陀山大门票(二日可用)、朱家尖至普陀山单程船票、30万保额旅游意外险;</p><p style="margin-left:0%;">不包含:寺院香花卷,景区小交通。</p>'
  280. // cstr1 += '<p style="margin-left:0%;margin-top:5px;">注:(1) 淡季1月份、12月份门票价格为140元/人</p>';
  281. // cstr1 += '<p>(2) 旺季2月份至11月份门票介格为160元/人</p>';
  282. // cstr1 += '<p>(3) 正月初一至初五、五月一日至三日、十月一日至五日上浮至200元/人</p>';
  283. // cstr1 += '<p>(4) 朱家尖码头---普陀山码头单程船票25元/人</p>';
  284. // cstr1 += '<p>(5) 景区景点意外险10元/人/单</p>';
  285. //
  286. // type_info.innerHTML=cstr1;
  287. //}
  288. //// foot上的收藏和立即预订
  289. ////function click_fav(){
  290. //// var fav = document.getElementById("fav");
  291. //// if(fav.innerHTML=="收藏"){
  292. //// isFav = true;
  293. //// var url = "http://xmwx.zhizhuchuxing.cn/core/keep.asp?prodcode="+current_prod_code;
  294. //// get_virtual_user_list(url);
  295. //// }
  296. ////}
  297. //// 收藏产品
  298. ////function fav_product(httpData){
  299. //// var fav = document.getElementById("fav");
  300. //// if(httpData.code=="0"){
  301. //// alert("收藏成功!");
  302. //// fav.innerHTML="已收藏";
  303. //// fav.style.backgroundColor='gray';
  304. //// fav.disabled=true;
  305. //// }else{
  306. //// alert("收藏失败!");
  307. //// fav.innerHTML="已收藏";
  308. //// }
  309. ////}
  310. //// 从内容中截取图片名称
  311. //function subStrFormContext(context){
  312. // var imgName="";
  313. // var i = context.indexOf("[img]");
  314. // var j = context.indexOf("[/img]");
  315. // if (j-i>0 && i>=0)
  316. // {
  317. // imgName=context.substring(i+5,j);
  318. // // 去掉[img][/img]的文本内容
  319. // var str1 = context.substring(0,i);
  320. // var str2 = context.substring(j+6,context.length);
  321. // var str = str1+str2;
  322. // }
  323. //
  324. // var img_str = new Array();
  325. // img_str.push(imgName); //0
  326. // img_str.push(str); //1
  327. // img_str.push(str1); //2
  328. // img_str.push(str2); //3
  329. // return img_str;
  330. //}
  331. //
  332. //
  333. //
  334. //
  335. //
  336. //
  337. function getDateTime(nTypeFlag) {
  338. var tNowTime = new Date();
  339. var myYear = ';' + tNowTime.getFullYear() + ';';
  340. var myMonth = ';' + (tNowTime.getMonth() + 1 - 0) + ';';
  341. var myDay = ';' + tNowTime.getDate() + ';';
  342. var myHour = ';' + tNowTime.getHours() + ';';
  343. var myMinu = ';' + tNowTime.getMinutes() + ';';
  344. var mySecond = ';' + tNowTime.getSeconds() + ';';
  345. if (myMonth.length < 4) myMonth = '0' + myMonth;
  346. if (myDay.length < 4) myDay = '0' + myDay;
  347. if (myHour.length < 4) myHour = '0' + myHour;
  348. if (myMinu.length < 4) myMinu = '0' + myMinu;
  349. if (mySecond.length < 4) mySecond = '0' + mySecond;
  350. var cNewTimeStr;
  351. //alert(tNowTime);
  352. switch (nTypeFlag + 1 - 1) {
  353. case 0:
  354. cNewTimeStr = myYear + '-' + myMonth + '-' + myDay;
  355. break;
  356. case 1:
  357. cNewTimeStr = myYear + myMonth + myDay;
  358. break;
  359. case 2:
  360. cNewTimeStr = myHour + ':' + myMinu + ':' + mySecond;
  361. break;
  362. case 3:
  363. cNewTimeStr = myHour + myMinu + mySecond;
  364. break;
  365. case 4:
  366. cNewTimeStr = myYear + myMonth + myDay + myHour + myMinu + mySecond;
  367. break;
  368. case 5:
  369. cNewTimeStr = myYear + '年' + myMonth + '月' + myDay + '日';
  370. break;
  371. case 6:
  372. cNewTimeStr = myYear;
  373. break;
  374. case 7:
  375. cNewTimeStr = myYear + '-' + myMonth;
  376. break;
  377. default:
  378. cNewTimeStr = myYear + '-' + myMonth + '-' + myDay + ' ' + myHour + ':' + myMinu + ':' + mySecond;
  379. break;
  380. }
  381. cNewTimeStr = cNewTimeStr.replace(/;/g, "");
  382. return cNewTimeStr;
  383. }