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.
 
 
 
 
 

304 lines
10 KiB

  1. var temp_orderno;
  2. function init_page() {
  3. // 得到订单号
  4. var orderno = getPar('orderno');
  5. temp_orderno = orderno;
  6. // 我的订单详细
  7. // var url = "http://xmwx.zhizhuchuxing.cn/core/my_order.asp";
  8. var url = "http://xmwx.zhizhuchuxing.cn/core/order_detail.asp?orderno=" + orderno;
  9. // var url = "http://xmwx.zhizhuchuxing.cn/wechat/Core/getOpenid.php";
  10. get_virtual_user_list(url);
  11. }
  12. function click_orderlist() {
  13. var listURL = "http://xmwx.zhizhuchuxing.cn/core/my_order.asp";
  14. // 跳转前将URL编码
  15. listURL = encodeURI(listURL);
  16. window.location.href = listURL;
  17. }
  18. var temp_ticket_list;
  19. var interval = 1000;
  20. var time = 0;
  21. function reload_Info(httpData) {
  22. temp_ticket_list = httpData.ticket_list;
  23. if(httpData.code!="0"){
  24. alert(httpData.info);
  25. return;
  26. }
  27. // 单元格开始
  28. var wrapper = document.getElementById("header");
  29. // 单元格HTML
  30. var wrapper_HTML = '';
  31. wrapper_HTML += '<div style="margin-top:10px; border-top:1px solid #dadada; position:relative; width:100%;background:#fff;overflow:hidden;">';
  32. wrapper_HTML += '<img style="position:absolute;top:24px;left:4%;width:9px;height: 39px;" src="../img/smalllogo.png" alt="">';
  33. wrapper_HTML += '<div style="float:left;width:100%;">';
  34. wrapper_HTML += '<div style="float:left;width:75%;margin-top:11px;margin-left:10.5%;">';
  35. wrapper_HTML += '<div style="height:32px; line-height: 32px; width:100%; border-bottom:1px solid #ECEBEE;">';
  36. wrapper_HTML += '<span id="start_area" style="font-size:16px;color:#343434;">'+httpData.start_area+'</span>';
  37. wrapper_HTML += '<span id="go_info" style="float:right;color:#808080;font-size:14px;">'+httpData.go_info+'&nbsp;出发</span>';
  38. wrapper_HTML += '</div>';
  39. wrapper_HTML += '<div style="height:32px;width:100%; line-height: 32px;">';
  40. wrapper_HTML += '<span id="end_area" style="font-size:16px;color:#343434;">'+httpData.end_area+'</span>';
  41. wrapper_HTML += '<span id="back_info" style="float:right;color:#808080;font-size:14px;">'+httpData.back_info+'&nbsp;返回</span>';
  42. wrapper_HTML += '</div>';
  43. wrapper_HTML += '</div>';
  44. wrapper_HTML += '<div style="float:left;overflow:hidden;margin-top: 10px; padding-bottom:12px; border-bottom:1px solid #ECEBEE;width:98.7%;margin-left:2.89%;">';
  45. wrapper_HTML += '<div id="prod_name" style="float:left;color:#808080;font-size:13px;">'+httpData.prod_name+'</div>';
  46. wrapper_HTML += '<div style="float:left;margin-left:1.5%;">';
  47. // 是否包含车子
  48. var car = httpData.if_bus;
  49. if (car == "1") {
  50. wrapper_HTML += '<img id="if_bus" style="width:14px; height:15px;margin-right:2px;" src="../img/car2.png" alt="">';
  51. }
  52. // 是否包含宾馆
  53. var hotel = httpData.if_hotel;
  54. if (hotel == "1") {
  55. wrapper_HTML += '<img id="if_hotel" style="width:14px; height:15px;margin-right:2px;" src="../img/hotel2.png" alt="">';
  56. }
  57. // 是否包含景点
  58. var sightspot = httpData.if_sightspot;
  59. if (sightspot == "1") {
  60. wrapper_HTML += '<img id="if_sightspot" style="width:15px; height:15px;" src="../img/ticket.png" alt="">';
  61. }
  62. // 单元格结束
  63. wrapper.innerHTML = wrapper_HTML;
  64. // 金额
  65. var left_center = document.getElementById("left-center");
  66. var centerHTML = '';
  67. // centerHTML += '<span class="z">金额:</span>';
  68. // centerHTML += '<span class="price-p z">¥'+httpData.price+'</span>';
  69. // centerHTML += '<span class="y">^</span>';
  70. centerHTML += '<div class="ticketprice">';
  71. centerHTML += '<span class="balance z">金额:</span>';
  72. centerHTML += '<span class="z">¥</span>';
  73. centerHTML += '<span class="z">' + httpData.price + '</span>';
  74. centerHTML += '<img id="rr" class="y" src="../img/down_arrow.png" />';
  75. centerHTML += '</div>';
  76. //
  77. left_center.innerHTML = centerHTML;
  78. // 支付时间
  79. var right_time = document.getElementById("right-time");
  80. var timeHTML = '';
  81. // ' + second_change_min(httpData.pay_second) + '
  82. time = httpData.pay_second;
  83. setInterval("ShowCountDown()", 1000); //1000为1秒钟
  84. timeHTML += '<span id="time" class="y" style="margin-right: -3;font-size: 14px;">&nbsp;&nbsp;&nbsp;&nbsp;'+second_change_min(time)+'</span>';
  85. right_time.innerHTML = timeHTML;
  86. }
  87. //var time=document.getElementById('time')
  88. // var m=time.innerHTML;
  89. // var tim=null;
  90. // tim=setInterval(function(){
  91. // m--;
  92. // if (m==0) {
  93. // clearInterval(tim);
  94. // };
  95. // time.innerHTML=second_change_min(m);
  96. // },1000)
  97. // 将秒的时间转变成分钟+秒
  98. function second_change_min(times) {
  99. var min = Math.floor(times / 60);
  100. var second = times % 60;
  101. var minStr = '';
  102. if(second<=9){
  103. minStr=min + ':0' + second;
  104. }else{
  105. minStr=min + ':' + second;
  106. }
  107. return minStr;
  108. }
  109. var minute = 0;
  110. var cc = 0;
  111. function ShowCountDown() {
  112. time = Math.floor(time - 1);
  113. var leftsecond = time;
  114. minute = Math.floor((leftsecond) / 60);
  115. var second = Math.floor(leftsecond - minute * 60);
  116. cc = document.getElementById("time");
  117. if (time <= 0) {
  118. return;
  119. }
  120. if (second < 10) {
  121. cc.innerHTML = ''+minute + ":0" + second;
  122. } else {
  123. cc.innerHTML = ''+minute + ":" + second;
  124. }
  125. }
  126. // 占击支付方式最大的div--payway
  127. function click_payway(way) {
  128. cancel_checkbox_checked();
  129. if(temp_httpData.second<=0){
  130. alert("支付时间超过15分钟");
  131. return;
  132. }
  133. if (way == "wxpay") {
  134. var checkbox = document.getElementById("wxcheckbox");
  135. checkbox.checked = true;
  136. } else if (way == "qqpay") {
  137. // var checkbox = document.getElementById("qqcheckbox");
  138. // checkbox.checked=true;
  139. }
  140. }
  141. // 取消两个复选框
  142. function cancel_checkbox_checked() {
  143. var wxcheckbox = document.getElementById("wxcheckbox");
  144. // var qqcheckbox = document.getElementById("qqcheckbox");
  145. wxcheckbox.checked = false;
  146. // qqcheckbox.checked=false;
  147. }
  148. // 点击金额
  149. var isUp = true;
  150. function click_amount() {
  151. var ticket_list = temp_ticket_list;
  152. var rr = document.getElementById("rr");
  153. if (isUp == true) {
  154. rr.src = "../img/up_arrow.png";
  155. } else {
  156. rr.src = "../img/down_arrow.png";
  157. }
  158. isUp = !isUp;
  159. // 显示订单
  160. var order_list = document.getElementById("order-list");
  161. var listHTML = '';
  162. for (var i = 0; i < ticket_list.length; i++) {
  163. listHTML += '<div class="xorderone" style="background:white;overflow:hidden;width:96.2%;height:45px;line-height:45px; border:1px solid #f1f1f1;padding-left:3.8%;color:#616161;font-size:14px;font-family:‘黑体’;">';
  164. listHTML += '<span style="float:left;">' + ticket_list[i].ticket_name + '</span> ';
  165. listHTML += '<span style="float:right;color:#adadad;font-size:14px;margin-right:3.3%;">×&nbsp;' + ticket_list[i].ticket_count + '</span>';
  166. listHTML += '<span style="float:right;color:#ff8800;margin-right:2.5%;font-weight:bold;"><span style="margin-right:2px;font-size:13px">¥</span><span style="font-size:17px">' + ticket_list[i].ticket_price + '</span></span>';
  167. listHTML += '</div>';
  168. }
  169. order_list.innerHTML = listHTML;
  170. if (order_list.style.display == 'block') {
  171. order_list.style.display = 'none';
  172. } else {
  173. order_list.style.display = 'block';
  174. }
  175. }
  176. // 点击支付
  177. function click_pay() {
  178. // name == prod_code
  179. // orderid == orderno
  180. // money == price 按分计算,,传值的时候 *100
  181. var payURL = "http://xmwx.zhizhuchuxing.cn/wechat/WxPay/realpay/onlinePay.php?orderid=" + temp_orderno;
  182. // var payURL = "http://xmwx.zhizhuchuxing.cn/wechat/WxPay/pay/onlinePay.php?name=上海-舟山&orderid=qw111111&money=11";
  183. // var payURL = "http://xmwx.zhizhuchuxing.cn/wechat/WxPay/pay/onlinePay.php?orderid=" + temp_orderno;
  184. // 跳转前将URL编码
  185. payURL = encodeURI(payURL);
  186. window.location.href = payURL;
  187. }
  188. // 从上一页的链接上获取参数
  189. function getPar(par) {
  190. //获取当前URL
  191. var local_url = document.location.href;
  192. // 接收的时候将URL 解码
  193. local_url = decodeURI(local_url);
  194. //获取要取得的get参数位置
  195. var get = local_url.indexOf(par + "=");
  196. if (get == -1) {
  197. return false;
  198. }
  199. //截取字符串
  200. var get_par = local_url.slice(par.length + get + 1);
  201. //判断截取后的字符串是否还有其他get参数
  202. var nextPar = get_par.indexOf("&");
  203. if (nextPar != -1) {
  204. get_par = get_par.slice(0, nextPar);
  205. }
  206. return get_par;
  207. }
  208. /*======================网络请求的Ajax的代码=======================*/
  209. // 创建一个Ajax对象
  210. if (window.ActiveXObject) {
  211. var myreq = new ActiveXObject("Microsoft.XMLHTTP");
  212. } else {
  213. var myreq = new XMLHttpRequest();
  214. }
  215. // 请求方法,传入URL
  216. function get_virtual_user_list(myURL) {
  217. var tnowtime = getDateTime(4);
  218. // m_url = 接口
  219. // var myURL = m_url + 'op=userlink&vuser=' + cvuserid + '&tt=' + tnowtime;
  220. // var myURL = "http://xmwx.zhizhuchuxing.cn/core/area_target.asp?keyword=";
  221. myreq.open("get", myURL, true);
  222. // 接收的数据交给哪个函数处理
  223. myreq.onreadystatechange = show_user_list;
  224. myreq.send();
  225. }
  226. function show_user_list() {
  227. if (myreq.readyState == 4) {
  228. // newstr 就是接收到的数据
  229. var newstr = myreq.responseText;
  230. var httpData = JSON.parse(newstr);
  231. //
  232. reload_Info(httpData);
  233. }
  234. }
  235. function getDateTime(nTypeFlag) {
  236. var tNowTime = new Date();
  237. var myYear = ';' + tNowTime.getFullYear() + ';';
  238. var myMonth = ';' + (tNowTime.getMonth() + 1 - 0) + ';';
  239. var myDay = ';' + tNowTime.getDate() + ';';
  240. var myHour = ';' + tNowTime.getHours() + ';';
  241. var myMinu = ';' + tNowTime.getMinutes() + ';';
  242. var mySecond = ';' + tNowTime.getSeconds() + ';';
  243. if (myMonth.length < 4) myMonth = '0' + myMonth;
  244. if (myDay.length < 4) myDay = '0' + myDay;
  245. if (myHour.length < 4) myHour = '0' + myHour;
  246. if (myMinu.length < 4) myMinu = '0' + myMinu;
  247. if (mySecond.length < 4) mySecond = '0' + mySecond;
  248. var cNewTimeStr;
  249. //alert(tNowTime);
  250. switch (nTypeFlag + 1 - 1) {
  251. case 0:
  252. cNewTimeStr = myYear + '-' + myMonth + '-' + myDay;
  253. break;
  254. case 1:
  255. cNewTimeStr = myYear + myMonth + myDay;
  256. break;
  257. case 2:
  258. cNewTimeStr = myHour + ':' + myMinu + ':' + mySecond;
  259. break;
  260. case 3:
  261. cNewTimeStr = myHour + myMinu + mySecond;
  262. break;
  263. case 4:
  264. cNewTimeStr = myYear + myMonth + myDay + myHour + myMinu + mySecond;
  265. break;
  266. case 5:
  267. cNewTimeStr = myYear + '年' + myMonth + '月' + myDay + '日';
  268. break;
  269. case 6:
  270. cNewTimeStr = myYear;
  271. break;
  272. case 7:
  273. cNewTimeStr = myYear + '-' + myMonth;
  274. break;
  275. default:
  276. cNewTimeStr = myYear + '-' + myMonth + '-' + myDay + ' ' + myHour + ':' + myMinu + ':' + mySecond;
  277. break;
  278. }
  279. cNewTimeStr = cNewTimeStr.replace(/;/g, "");
  280. return cNewTimeStr;
  281. }
  282. //////////////////////////////////////