Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 

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