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.
 
 
 
 
 

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