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.
 
 
 
 
 
 

796 lines
26 KiB

  1. var httpData;
  2. if (window.ActiveXObject) {
  3. var myreq = new ActiveXObject("Microsoft.XMLHTTP");
  4. } else {
  5. var myreq = new XMLHttpRequest();
  6. }
  7. function loadData(){
  8. myreq.open("get", "http://wx.zhizhuchuxing.com/core/detail.asp?prodcode="+m_projcode, true);
  9. myreq.onreadystatechange = showData;
  10. myreq.send();
  11. }
  12. function showData(){
  13. if (myreq.readyState == 4){
  14. var newstr = myreq.responseText;
  15. httpData = JSON.parse(newstr);
  16. document.getElementById('dsn_prod_name').innerHTML=httpData['prod_name'];
  17. /* document.getElementById("start_area").innerText=httpData.start_area;
  18. document.getElementById("go_info").innerText=httpData.run_info;
  19. document.getElementById("end_area").innerText=httpData.end_area;
  20. if(httpData.direction == 1){
  21. document.getElementById("back_info").style.display="none";
  22. }else{
  23. document.getElementById("back_info").style.display="block";
  24. document.getElementById("back_info").innerText=httpData.back_run_info;
  25. }
  26. document.getElementById("prod_name").innerText=httpData.prod_name;
  27. if(httpData.if_bus == "1"){
  28. document.getElementById("if_bus").style.display = "inline";
  29. }else{
  30. document.getElementById("if_bus").style.display = "none";
  31. }
  32. if(httpData.if_hotel == "1"){
  33. document.getElementById("if_hotel").style.display = "inline";
  34. }else{
  35. document.getElementById("if_hotel").style.display = "none";
  36. }
  37. if(httpData.if_sightspot == "1"){
  38. document.getElementById("if_sightspot").style.display = "inline";
  39. }else{
  40. document.getElementById("if_sightspot").style.display = "none";
  41. }*/
  42. if(!runid){
  43. }else{
  44. var tnowtime = getDateTime(4);
  45. var myURL = m_url + 'op=ticket&tt=' + tnowtime + '&projcode=' + m_projcode + '&runid=' + runid;
  46. myreq.open("get",myURL,true);
  47. myreq.onreadystatechange = show_ticket;
  48. myreq.send(null);
  49. }
  50. }
  51. }
  52. var m_url = '/core/partner.asp?';
  53. var m_godate = '';
  54. var m_gotime = '';
  55. var m_backdate = '';
  56. var m_backtime = '';
  57. var m_projcode = '';
  58. var m_go_run_id = '';
  59. var arrayGoDate = new Array();
  60. var arrayBackDate = new Array();
  61. var arrayTicket = new Array();
  62. var total = '';
  63. var num ='';
  64. var userId = '';
  65. var linkName = '';
  66. var linkPhone = '';
  67. var linkIdno = '';
  68. var runid = '';
  69. var m_godate = '';
  70. var m_gotime = '';
  71. var m_backdate = '';
  72. var m_backtime = '';
  73. var ticket = '';
  74. var arrayTicketbak = new Array();
  75. window.onload = function()
  76. {
  77. m_projcode = getPar('prodcode');
  78. ticket = getPar('ticket');
  79. if(!ticket){
  80. arrayTicketbak.length = 0;
  81. }else{
  82. arrayTicketbak.length = 0;
  83. var arrT = ticket.split("|");
  84. for(var i = 0; i < arrT.length; i++){
  85. var arrP = arrT[i].split("P");
  86. if(arrP.length == 2){
  87. arrayTicketbak[i] = new Array();
  88. arrayTicketbak[i][0] = arrP[0];
  89. arrayTicketbak[i][1] = arrP[1];
  90. }
  91. }
  92. }
  93. runid = getPar('runid');
  94. m_godate = getPar('m_godate');
  95. m_gotime = getPar('m_gotime');
  96. m_backdate = getPar('m_backdate');
  97. m_backtime = getPar('m_backtime');
  98. userId = getPar('user_id');
  99. if(!userId){
  100. }else{
  101. linkName = getPar('link_name');
  102. linkPhone = getPar('link_phone');
  103. linkIdno = getPar('link_idno');
  104. set_contacts(userId, linkName, linkPhone, linkIdno);
  105. }
  106. if(!m_godate || !m_gotime){
  107. }else{
  108. var obj1 = document.getElementById('show_go_run_info');
  109. obj1.innerHTML = m_godate + ' ' + "&nbsp;&nbsp";
  110. }
  111. if(!m_backdate || !m_backtime){
  112. document.getElementById('back_time').style.display = "none"
  113. }else{
  114. document.getElementById('back_time').style.display = "block"
  115. var obj1 = document.getElementById('show_back_run_info');
  116. obj1.innerHTML = m_backdate + ' ' + m_backtime + "&nbsp;&nbsp";
  117. }
  118. //m_projcode = 'HPTPZyx'; //调试代码
  119. loadData();
  120. //此处还需添加其他获取产品详细信息并显示的代码
  121. }
  122. function go_date() {
  123. var listURL = "./select_date2.html?prodcode="+m_projcode;
  124. if(!userId){
  125. }else{
  126. listURL += ("&user_id="+userId+"&link_name="+linkName+"&link_phone="+linkPhone+"&link_idno="+linkIdno);
  127. }
  128. // 跳转前将URL编码
  129. listURL = encodeURI(listURL);
  130. window.location.href = listURL;
  131. }
  132. function get_backrundate(gorunid) {
  133. m_go_run_id = gorunid;
  134. var myURL = m_url + 'op=backdate&projcode=' + m_projcode + '&runid=' + gorunid;
  135. myreq.open("get",myURL,true);
  136. myreq.onreadystatechange = show_backrundate;
  137. myreq.send(null);
  138. }
  139. function show_gorundate()
  140. {
  141. if (myreq.readyState == 4)
  142. {
  143. var newstr = myreq.responseText;
  144. httpData = JSON.parse(newstr);
  145. var c_code = httpData.code;
  146. if (c_code == '0')
  147. {
  148. arrayGoDate.length = 0;
  149. for (var i = 0;i<httpData.date_list.length;i++)
  150. {
  151. arrayGoDate[i] = httpData.date_list[i].godate;
  152. }
  153. }else{
  154. alert(httpData.info);
  155. return;
  156. }
  157. if (arrayGoDate.length > 0)
  158. {
  159. show_calendar(arrayGoDate[0],0);
  160. }else{
  161. alert('没有可选择的发车日期');
  162. show_calendar(getDateTime(0)) ;
  163. }
  164. }
  165. }
  166. function show_backrundate()
  167. {
  168. arrayBackDate.length = 0;
  169. if (myreq.readyState == 4){
  170. var newstr = myreq.responseText;
  171. document.getElementById('div_date_runlist').innerHTML = '';
  172. httpData = JSON.parse(newstr);
  173. var c_code = httpData.code;
  174. if (c_code == '0')
  175. {
  176. for (var i = 0;i<httpData.date_list.length;i++)
  177. {
  178. arrayBackDate[i] = httpData.date_list[i].backdate;
  179. }
  180. }else{
  181. alert(httpData.info);
  182. return;
  183. }
  184. if (arrayBackDate.length > 0) show_calendar(arrayBackDate[0],1);
  185. }
  186. }
  187. function show_calendar(cshowdate,goback)
  188. {
  189. var arrayRunDate = new Array();
  190. if (goback == 0)
  191. {
  192. arrayRunDate = arrayGoDate;
  193. }else{
  194. arrayRunDate = arrayBackDate;
  195. }
  196. var cnowdate = str2date(cshowdate);
  197. var cnowyear = cnowdate.getYear();
  198. var cnowfullyear = cnowdate.getFullYear();
  199. var cnowmonth = cnowdate.getMonth();
  200. var ddate1 = new Date(cnowfullyear,cnowmonth+1,1);
  201. var denddate = new Date(ddate1-86400000);
  202. var cendday = denddate.getDate();
  203. var clistdateweek = 0;
  204. var cnowdate2 = parseInt(cnowmonth)+1;
  205. cnowdate2 = cnowfullyear + '年' + cnowdate2 + '月';
  206. var cnowdate3 = cnowfullyear + '-' + cnowmonth + '-1';
  207. var cshow1 = '<span class="span_move_month" id="span_last_month" onclick="show_next_calendar(\'' + cnowdate3 + '\',0,' + goback + ')" ><<</span>';
  208. cshow1 += '<span id="span_now_month" >' + cnowdate2 + '</span>';
  209. cshow1 += '<span class="span_move_month" id="span_next_month" onclick="show_next_calendar(\'' + cnowdate3 + '\',2,' + goback + ')" >>></span>';
  210. document.getElementById('div_date_run_date').innerHTML = cshow1;
  211. var cshow = '<span class="span_calendar_title" >星期一</span><span class="span_calendar_title" >星期二</span><span class="span_calendar_title" >星期三</span><span class="span_calendar_title" >星期四</span><span class="span_calendar_title" >星期五</span><span class="span_calendar_title" >星期六</span><span class="span_calendar_title" >星期日</span>';
  212. var nnum1 = 0;
  213. var dgodate = str2date(arrayRunDate[0]);
  214. var nnum2 = arrayRunDate.length;
  215. for (var i=1;i<=cendday;i++)
  216. {
  217. var clistdate = new Date(cnowfullyear,cnowmonth,i);
  218. clistdateweek = clistdate.getDay();
  219. if (i==1)
  220. {
  221. if (clistdateweek == 0) clistdateweek = 7;
  222. for (var j=1;j<clistdateweek;j++)
  223. {
  224. cshow += '<span class="span_calendar_blank" >&nbsp;</span>';
  225. }
  226. }
  227. while ((dgodate - clistdate < 0) && (nnum1 < nnum2))
  228. {
  229. nnum1++;
  230. if (nnum1<arrayRunDate.length) dgodate = str2date(arrayRunDate[nnum1]);
  231. }
  232. var c11 = clistdate.getYear();
  233. var c12 = clistdate.getMonth();
  234. var c13 = clistdate.getDate();
  235. var c21 = dgodate.getYear();
  236. var c22 = dgodate.getMonth();
  237. var c23 = dgodate.getDate();
  238. if (c11==c21 && c12==c22 && c13==c23 && arrayRunDate.length>0)
  239. {
  240. if (goback == 0)
  241. {
  242. cshow += '<span class="span_calendar_enable" onclick=get_gorun(\'' + arrayRunDate[nnum1] + '\')>' + i + '</span>';
  243. }else{
  244. cshow += '<span class="span_calendar_enable" onclick=get_backrun(\'' + arrayRunDate[nnum1] + '\')>' + i + '</span>';
  245. }
  246. }else{
  247. cshow += '<span class="span_calendar_disable" >' + i + '</span>';
  248. }
  249. }
  250. if (clistdateweek>0)
  251. {
  252. for (var i=clistdateweek;i<7;i++)
  253. {
  254. cshow += '<span class="span_calendar_blank" >&nbsp;</span>';
  255. }
  256. }
  257. document.getElementById('div_date_calendar1').innerHTML = cshow;
  258. }
  259. function get_gorun(godate)
  260. {
  261. var tnowtime = getDateTime(4);
  262. m_godate = godate;
  263. var myURL = m_url + 'op=gorun&tt=' + tnowtime + '&projcode=' + m_projcode + '&godate=' + godate;
  264. myreq.open("get",myURL,true);
  265. myreq.onreadystatechange = show_gorun;
  266. myreq.send(null);
  267. }
  268. function get_backrun(backdate)
  269. {
  270. var runid = m_go_run_id;
  271. m_backdate = backdate;
  272. var myURL = m_url + 'op=backrun&runid=' + runid + '&projcode=' + m_projcode + '&backdate=' + backdate;
  273. myreq.open("get",myURL,true);
  274. myreq.onreadystatechange = show_backrun;
  275. myreq.send(null);
  276. }
  277. function show_gorun()
  278. {
  279. if (myreq.readyState == 4)
  280. {
  281. var newstr = myreq.responseText;
  282. var cshow ='';
  283. httpData = JSON.parse(newstr);
  284. var c_code = httpData.code;
  285. if (c_code == '0')
  286. {
  287. var nnum1 = httpData.go_run_list.length;
  288. if (nnum1 -0>0)
  289. {
  290. cshow = '<ul>';
  291. for (var i=0;i<httpData.go_run_list.length;i++)
  292. {
  293. //此处以后应加上runback的处理代码
  294. cshow += '<li onclick="get_next(\'' + httpData.go_run_list[i].runid + '\',\'' + httpData.go_run_list[i].runback + '\',\'' + httpData.go_run_list[i].runtime + '\')">' + httpData.go_run_list[i].runinfo + '</li>';
  295. }
  296. cshow += '</ul>';
  297. }
  298. var obj1 = document.getElementById('div_date_runlist');
  299. obj1.innerHTML = cshow;
  300. }else{
  301. alert(httpData.info);
  302. return;
  303. }
  304. }
  305. }
  306. function show_backrun()
  307. {
  308. if (myreq.readyState == 4)
  309. {
  310. var newstr = myreq.responseText;
  311. var cshow ='';
  312. httpData = JSON.parse(newstr);
  313. var c_code = httpData.code;
  314. if (c_code == '0')
  315. {
  316. var nnum1 = httpData.back_run_list.length;
  317. if (nnum1 -0>0)
  318. {
  319. cshow = '<ul>';
  320. for (var i=0;i<httpData.back_run_list.length;i++)
  321. {
  322. cshow += '<li onclick="get_ticket(\'' + httpData.back_run_list[i].runid +'\',\'' + httpData.back_run_list[i].runtime + '\',1)">' + httpData.back_run_list[i].runinfo + '</li>';
  323. }
  324. cshow += '</ul>';
  325. }
  326. var obj1 = document.getElementById('div_date_runlist');
  327. obj1.innerHTML = cshow;
  328. }else{
  329. alert(httpData.info);
  330. return;
  331. }
  332. }
  333. }
  334. function get_next(gorunid,ifback,runtime)
  335. {
  336. m_ifback = ifback;
  337. m_gotime = runtime;
  338. var obj1 = document.getElementById('show_go_run_info');
  339. obj1.innerHTML = '出行时间:' + m_godate + ' ' + m_gotime+ "&nbsp;&nbsp";
  340. if (ifback == '0')
  341. {
  342. get_ticket(gorunid,'',0);
  343. }else{
  344. //此处添加选返程日期的代码
  345. document.getElementById('div_date_run_title').innerHTML = '请选择返程日期';
  346. get_backrundate(gorunid);
  347. return;
  348. }
  349. }
  350. function get_ticket(runid,runtime,goback)
  351. {
  352. if (goback-1 == 0)
  353. {
  354. m_backtime = runtime;
  355. var obj1 = document.getElementById('show_back_run_info');
  356. obj1.innerHTML = '返程时间:' + m_backdate + ' ' + m_backtime+ "&nbsp;&nbsp";
  357. }
  358. var tnowtime = getDateTime(4);
  359. var myURL = m_url + 'op=ticket&tt=' + tnowtime + '&projcode=' + m_projcode + '&runid=' + runid;
  360. myreq.open("get",myURL,true);
  361. myreq.onreadystatechange = show_ticket;
  362. myreq.send(null);
  363. }
  364. function show_ticket()
  365. {
  366. if (myreq.readyState == 4)
  367. {
  368. var newstr = myreq.responseText;
  369. httpData = JSON.parse(newstr);
  370. var c_code = httpData.code;
  371. if (c_code == '0')
  372. {
  373. arrayTicket.length = 0;
  374. for (var i=0;i<httpData.ticket_list.length;i++)
  375. {
  376. arrayTicket[i] = new Array();
  377. arrayTicket[i][0] = httpData.ticket_list[i].ticketid;
  378. arrayTicket[i][1] = httpData.ticket_list[i].ticketname;
  379. arrayTicket[i][2] = httpData.ticket_list[i].ticketprice;
  380. arrayTicket[i][3] = httpData.ticket_list[i].ticketcount;
  381. arrayTicket[i][4] = parseInt(0);
  382. if(arrayTicketbak.length > 0){
  383. for(var j = 0; j < arrayTicketbak.length; j++){
  384. if(arrayTicket[i][0] == arrayTicketbak[j][0]){
  385. arrayTicket[i][4] = parseInt(arrayTicketbak[j][1]);
  386. }
  387. }
  388. }else{
  389. arrayTicket[i][4] = parseInt(0);
  390. }
  391. }
  392. }else{
  393. alert(httpData.info);
  394. return;
  395. }
  396. show_ticket1();
  397. }
  398. }
  399. function show_ticket1(){
  400. var nnum1 = arrayTicket.length;
  401. var cshow = '';
  402. total = 0;
  403. num = 0;
  404. for (var i=0;i<nnum1;i++){
  405. cshow += '<div style="float:left;height:77px; width:95.7%; border-bottom:1px solid #E2E2E2;margin-left:4.3%;">';
  406. cshow += '<div style="height:28px;color:#4d4d4d;font-size:15px;margin-top:10px;margin-left:22.22%;">' + arrayTicket[i][1] + '</div>';
  407. cshow += '<div style="overflow:hidden;margin-left:22.22%;">';
  408. cshow += '<span style="float:left;font-size:13px; color:#ff8800; font-weight:bold;margin-top:6px;">¥</span>';
  409. cshow += '<span style="float:left;font-size:17px; color:#ff8800; font-weight:bold;margin-top:3px;">'+arrayTicket[i][2]+'</span>';
  410. cshow += '<table style="heigh:24px;width:30%;float:right;border:1px solid #dbdbdb;margin-right:4%;">';
  411. cshow += '<tr style=" font-size:11px;">';
  412. cshow += '<td style="border-right:1px solid #dbdbdb;text-align:center;color:#33d6b0;font-size:16px;font-weight:bold;width:29%;" onclick="subtraction('+'\''+ i+'\')">-</td>';
  413. cshow += '<td style="border-right:1px solid #dbdbdb;text-align:center;width:42%;">'+ arrayTicket[i][4] +'</td>';
  414. cshow += '<td style="text-align:center;color:#33d6b0;font-size:16px;font-weight:bold;width:29%;" onclick="add('+'\''+ i+'\')">+</td>';
  415. cshow += '</tr>';
  416. cshow += '</table>';
  417. cshow += '<span style="float:right;font-size:14px;margin-right:9%;margin-top:3px; color: #808080;">充足</span>';
  418. cshow += '</div>';
  419. cshow += '</div>';
  420. total = (parseInt(total)-0) + (arrayTicket[i][2]*arrayTicket[i][4]-0);
  421. num = (parseInt(num)-0) + (arrayTicket[i][4]-0);
  422. }
  423. var obj1 = document.getElementById('ticket');
  424. obj1.innerHTML = cshow;
  425. var obj2 = document.getElementById('back_ticket');
  426. obj2.style.display = 'block';
  427. document.getElementById("amount_price").innerText = total;
  428. if(!num&&userId){
  429. document.getElementById("submit_order").style.background="#EBEBEB"
  430. document.getElementById("symbol").style.display="none";
  431. document.getElementById("arrow").style.display="none";
  432. document.getElementById("amount_price").style.display="none";
  433. }else if(num&&!userId){
  434. document.getElementById("submit_order").style.background="#EBEBEB"
  435. document.getElementById("symbol").style.display="block";
  436. document.getElementById("arrow").style.display="block";
  437. document.getElementById("amount_price").style.display="block";
  438. }else if(!num&&!userId){
  439. document.getElementById("submit_order").style.background="#EBEBEB"
  440. document.getElementById("symbol").style.display="none";
  441. document.getElementById("arrow").style.display="none";
  442. document.getElementById("amount_price").style.display="none";
  443. }else if(num&&userId){
  444. document.getElementById("submit_order").style.background="#FF8800";
  445. document.getElementById("symbol").style.display="block";
  446. document.getElementById("arrow").style.display="block";
  447. document.getElementById("amount_price").style.display="block";
  448. }else{
  449. }
  450. // if(!num || !userId){
  451. // document.getElementById("submit_order").style.background="#EBEBEB"
  452. // document.getElementById("symbol").style.display="none";
  453. // document.getElementById("arrow").style.display="none";
  454. // document.getElementById("amount_price").style.display="none";
  455. // }else{
  456. // document.getElementById("submit_order").style.background="#FF8800";
  457. // document.getElementById("symbol").style.display="block";
  458. // document.getElementById("arrow").style.display="block";
  459. // document.getElementById("amount_price").style.display="block";
  460. // }
  461. }
  462. function subtraction(i){
  463. if(arrayTicket[i][4] <= 0){
  464. }else{
  465. arrayTicket[i][4] = parseInt(arrayTicket[i][4])-1;
  466. show_ticket1();
  467. }
  468. }
  469. function add(i){
  470. if(arrayTicket[i][4] >= 0 && arrayTicket[i][4] < arrayTicket[i][3]){
  471. arrayTicket[i][4] = (parseInt(arrayTicket[i][4])-0)+1;
  472. show_ticket1();
  473. }else{
  474. }
  475. }
  476. function customer_list() {
  477. var listURL = "./select_contacts2.html?prodcode="+m_projcode;
  478. ticket = '';
  479. for(var i = 0; i < arrayTicket.length; i++){
  480. ticket += arrayTicket[i][0]+"P" + arrayTicket[i][4] + "|";
  481. }
  482. if(!ticket){
  483. }else{
  484. listURL += "&ticket="+ticket;
  485. }
  486. if(!runid){
  487. }else{
  488. listURL += "&runid="+runid;
  489. if(!m_godate || !m_gotime){
  490. }else{
  491. listURL += "&m_godate="+m_godate;
  492. listURL += "&m_gotime="+m_gotime;
  493. }
  494. if(!m_backdate || !m_backtime){
  495. }else{
  496. listURL += "&m_backdate="+m_backdate;
  497. listURL += "&m_backtime="+m_backtime;
  498. }
  499. }
  500. // 跳转前将URL编码
  501. listURL = encodeURI(listURL);
  502. window.location.href = listURL;
  503. }
  504. var ll
  505. function set_contacts(link_id, link_name, link_phone, link_idno) {
  506. document.getElementById("linkman1").style.display = "none";
  507. document.getElementById("linkman2").style.display = "block";
  508. document.getElementById("id_one").value = link_id;
  509. document.getElementById("name_one").innerText = link_name;
  510. document.getElementById("phone_one").innerText = link_phone;
  511. document.getElementById("idno_one").innerText = link_idno;
  512. if(!num&&userId){
  513. document.getElementById("submit_order").style.background="#EBEBEB"
  514. document.getElementById("symbol").style.display="none";
  515. document.getElementById("arrow").style.display="none";
  516. document.getElementById("amount_price").style.display="none";
  517. }else if(num&&!userId){
  518. document.getElementById("submit_order").style.background="#EBEBEB"
  519. document.getElementById("symbol").style.display="block";
  520. document.getElementById("arrow").style.display="block";
  521. document.getElementById("amount_price").style.display="block";
  522. }else if(!num&&!userId){
  523. document.getElementById("submit_order").style.background="#EBEBEB"
  524. document.getElementById("symbol").style.display="none";
  525. document.getElementById("arrow").style.display="none";
  526. document.getElementById("amount_price").style.display="none";
  527. }else if(num&&userId){
  528. document.getElementById("submit_order").style.background="#FF8800";
  529. document.getElementById("symbol").style.display="block";
  530. document.getElementById("arrow").style.display="block";
  531. document.getElementById("amount_price").style.display="block";
  532. }
  533. // if(!num || !userId){
  534. // document.getElementById("submit_order").style.background="#EBEBEB"
  535. // document.getElementById("symbol").style.display="none";
  536. // document.getElementById("arrow").style.display="none";
  537. // document.getElementById("amount_price").style.display="none";
  538. // }else{
  539. // document.getElementById("submit_order").style.background="#FF8800";
  540. // document.getElementById("symbol").style.display="block";
  541. // document.getElementById("arrow").style.display="block";
  542. // document.getElementById("amount_price").style.display="block";
  543. // }
  544. }
  545. function show_next_calendar(cshowdate,dealflag,goback)
  546. {
  547. var cnowdate = str2date(cshowdate);
  548. var cnowyear = cnowdate.getYear();
  549. var cnowfullyear = cnowdate.getFullYear();
  550. var cnowmonth = cnowdate.getMonth();
  551. var ddate1 = new Date(cnowfullyear,cnowmonth+dealflag,1);
  552. var cnextfullyear = ddate1.getFullYear();
  553. var cnextmonth = ddate1.getMonth();
  554. var cnextdate = parseInt(cnextmonth)+1;
  555. cnextdate = cnextfullyear + '-' + cnextdate + '-1';
  556. show_calendar(cnextdate,goback);
  557. }
  558. function str2date(DateStr){
  559. if(typeof DateStr=="undefined")return new Date();
  560. if(typeof DateStr=="date")return DateStr;
  561. var converted = Date.parse(DateStr);
  562. var myDate = new Date(converted);
  563. if(isNaN(myDate)){
  564. DateStr=DateStr.replace(/:/g,"-");
  565. DateStr=DateStr.replace(" ","-");
  566. DateStr=DateStr.replace(".","-");
  567. var arys= DateStr.split('-');
  568. switch(arys.length){
  569. case 7 : myDate = new Date(arys[0],--arys[1],arys[2],arys[3],arys[4],arys[5],arys[6]);
  570. break;
  571. case 6 : myDate = new Date(arys[0],--arys[1],arys[2],arys[3],arys[4],arys[5]);
  572. break;
  573. default: myDate = new Date(arys[0],--arys[1],arys[2]);
  574. break;
  575. };
  576. };
  577. return myDate;
  578. }
  579. function getPar(par){
  580. //获取当前URL
  581. var local_url = document.location.href;
  582. local_url = decodeURI(local_url);
  583. //获取要取得的get参数位置
  584. var get = local_url.indexOf(par +"=");
  585. if(get == -1){
  586. return false;
  587. }
  588. //截取字符串
  589. var get_par = local_url.slice(par.length + get + 1);
  590. //判断截取后的字符串是否还有其他get参数
  591. var nextPar = get_par.indexOf("&");
  592. if(nextPar != -1){
  593. get_par = get_par.slice(0, nextPar);
  594. }
  595. return get_par;
  596. }
  597. function getDateTime(nTypeFlag)
  598. {
  599. var tNowTime = new Date();
  600. var myYear = ';' + tNowTime.getFullYear() + ';';
  601. var myMonth = ';' + (tNowTime.getMonth()+1-0) + ';';
  602. var myDay = ';' + tNowTime.getDate()+ ';';
  603. var myHour = ';' + tNowTime.getHours()+ ';';
  604. var myMinu = ';' + tNowTime.getMinutes()+ ';';
  605. var mySecond = ';' + tNowTime.getSeconds()+ ';';
  606. if (myMonth.length < 4) myMonth = '0' + myMonth;
  607. if (myDay.length < 4) myDay = '0' + myDay;
  608. if (myHour.length < 4) myHour = '0' + myHour;
  609. if (myMinu.length < 4) myMinu = '0' + myMinu;
  610. if (mySecond.length < 4) mySecond = '0' + mySecond;
  611. var cNewTimeStr;
  612. //alert(tNowTime);
  613. switch (nTypeFlag+1-1)
  614. {
  615. case 0:
  616. cNewTimeStr = myYear + '-' + myMonth + '-' + myDay;
  617. break;
  618. case 1:
  619. cNewTimeStr = myYear + myMonth + myDay;
  620. break;
  621. case 2:
  622. cNewTimeStr = myHour + ':' + myMinu + ':' + mySecond;
  623. break;
  624. case 3:
  625. cNewTimeStr = myHour + myMinu + mySecond;
  626. break;
  627. case 4:
  628. cNewTimeStr = myYear + myMonth + myDay + myHour + myMinu + mySecond;
  629. break;
  630. case 5:
  631. cNewTimeStr = myYear + '年' + myMonth + '月' + myDay + '日';
  632. break;
  633. case 6:
  634. cNewTimeStr = myYear;
  635. break;
  636. case 7:
  637. cNewTimeStr = myYear + '-' + myMonth;
  638. break;
  639. default:
  640. cNewTimeStr = myYear + '-' + myMonth + '-' + myDay + ' ' + myHour + ':' + myMinu + ':' + mySecond;
  641. break;
  642. }
  643. cNewTimeStr = cNewTimeStr.replace(/;/g,"");
  644. return cNewTimeStr;
  645. }
  646. function submit_order(){
  647. if(!num&&userId){
  648. document.getElementById("submit_order").style.background="#EBEBEB"
  649. document.getElementById("symbol").style.display="none";
  650. document.getElementById("arrow").style.display="none";
  651. document.getElementById("amount_price").style.display="none";
  652. }else if(num&&!userId){
  653. document.getElementById("submit_order").style.background="#EBEBEB"
  654. document.getElementById("symbol").style.display="block";
  655. document.getElementById("arrow").style.display="block";
  656. document.getElementById("amount_price").style.display="block";
  657. }else if(!num&&!userId){
  658. document.getElementById("submit_order").style.background="#EBEBEB"
  659. document.getElementById("symbol").style.display="none";
  660. document.getElementById("arrow").style.display="none";
  661. document.getElementById("amount_price").style.display="none";
  662. }else if(num&&userId){
  663. document.getElementById("submit_order").style.background="#FF8800";
  664. document.getElementById("symbol").style.display="block";
  665. document.getElementById("arrow").style.display="block";
  666. document.getElementById("amount_price").style.display="block";
  667. var ticket = '';
  668. var customer = '';
  669. var name_one = document.getElementById("name_one").innerText;
  670. var phone_one = document.getElementById("phone_one").innerText
  671. var idno_one = document.getElementById("idno_one").innerText
  672. for(var i = 0; i < arrayTicket.length; i++){
  673. ticket += arrayTicket[i][0]+"P" + arrayTicket[i][4] + "|";
  674. }
  675. customer = "{|" + name_one + "|" + phone_one + "|" + idno_one + "|}";
  676. var tnowtime = getDateTime(4);
  677. var myURL = m_url + 'op=lock&projcode=' + m_projcode + '&tt=' + tnowtime + '&ticket=' + ticket + '&customer=' + customer;
  678. myreq.open("get",myURL,true);
  679. myreq.onreadystatechange = submit_my_order;
  680. myreq.send(null);
  681. }
  682. // if(!num || !userId){
  683. // document.getElementById("submit_order").style.background="#EBEBEB"
  684. // document.getElementById("symbol").style.display="none";
  685. // document.getElementById("arrow").style.display="none";
  686. // document.getElementById("amount_price").style.display="none";
  687. //
  688. // }else{
  689. // document.getElementById("submit_order").style.background="#FF8800";
  690. // document.getElementById("symbol").style.display="block";
  691. // document.getElementById("arrow").style.display="block";
  692. // document.getElementById("amount_price").style.display="block";
  693. // var ticket = '';
  694. // var customer = '';
  695. // var name_one = document.getElementById("name_one").innerText;
  696. // var phone_one = document.getElementById("phone_one").innerText
  697. // var idno_one = document.getElementById("idno_one").innerText
  698. // for(var i = 0; i < arrayTicket.length; i++){
  699. // ticket += arrayTicket[i][0]+"P" + arrayTicket[i][4] + "|";
  700. // }
  701. // customer = "{|" + name_one + "|" + phone_one + "|" + idno_one + "|}";
  702. // var tnowtime = getDateTime(4);
  703. // var myURL = m_url + 'op=lock&tt=' + tnowtime + '&ticket=' + ticket + '&customer=' + customer;
  704. // myreq.open("get",myURL,true);
  705. // myreq.onreadystatechange = submit_my_order;
  706. // myreq.send(null);
  707. // }
  708. }
  709. function submit_my_order(){
  710. if (myreq.readyState == 4){
  711. var newstr = myreq.responseText;
  712. var cshow ='';
  713. httpData = JSON.parse(newstr);
  714. var c_code = httpData.code;
  715. if (c_code == '0'){
  716. //alert(httpData.tradeno);
  717. var listURL = "./bookingHomePage/onlinePay2.html?orderno="+httpData.tradeno;
  718. // 跳转前将URL编码
  719. listURL = encodeURI(listURL);
  720. window.location.href = listURL;
  721. }else{
  722. alert(httpData.info);
  723. return;
  724. }
  725. }
  726. }
  727. var arrowtype = '0';
  728. function arrow_show(){
  729. var a = document.getElementById("arrow");
  730. var show_list = document.getElementById("show_list");
  731. if(arrowtype == 0){
  732. if(arrayTicket.length > 0){
  733. var s = '';
  734. for (var i=0;i<arrayTicket.length;i++){
  735. if(arrayTicket[i][4] > 0){
  736. arrowtype = '1';
  737. s += '<div style="overflow:hidden;width:100%;height:45px;line-height:45px; border-top:1px solid #E2E2E2; color:#303030;font-size:14px;font-family:‘黑体’;">';
  738. s += '<span style="float:left; margin-left: 4%;">'+arrayTicket[i][1]+'</span> ';
  739. s += '<span style="float:right;color:#adadad;font-size:11px;margin-right:3.3%;">×'+arrayTicket[i][4]+'</span>';
  740. s += '<span style="float:right;color:#ff8800;margin-right:1.5%;font-weight:bold;"><span style="margin-right:2px;">¥</span>'+arrayTicket[i][2]+'</span>';
  741. s += '</div>';
  742. }
  743. }
  744. if(arrowtype == 1){
  745. a.src = "../img/down_arrow.png";
  746. document.getElementById("mask").style.display="block";
  747. show_list.style.display = "block";
  748. document.getElementById("ticket_list").innerHTML = s;
  749. }
  750. }
  751. }else{
  752. arrowtype = '0';
  753. a.src = "../img/up_arrow.png";
  754. document.getElementById("mask").style.display="none";
  755. show_list.style.display = "none";
  756. }
  757. }
  758. function hide_mask_type(){
  759. arrowtype = '0';
  760. document.getElementById("mask").style.display="none";
  761. document.getElementById("show_list").style.display="none";
  762. document.getElementById("arrow").src = "../img/up_arrow.png";
  763. }
  764. function notes(){
  765. var listURL = "./notes2.html?prodcode="+m_projcode;
  766. // 跳转前将URL编码
  767. listURL = encodeURI(listURL);
  768. window.location.href = listURL;
  769. }