var submite_success = getStorJson("submite_success"); var login_data = getStorJson("login_data"); var intDiff = parseInt(submite_success.shengyu_time);//倒计时总秒数量 var goHTML = ''; var backHTML = ''; window.onload = function(){ goHTML = $('#go').html(); backHTML = $('#back').html(); console.log(submite_success); if (submite_success.ifback == 0) { $('#go').removeClass('ui_hide'); $('#back').addClass('ui_hide'); reloadDataInfos(0); timer(intDiff); } else{ $('#back').removeClass('ui_hide'); $('#go').addClass('ui_hide'); reloadDataInfos(1); timer(intDiff); } } function reloadDataInfos(ifback){ if (ifback ==0 ) { var go_list = submite_success.go_list; var temp = goHTML; temp = temp.replace('上海',go_list.start_area); temp = temp.replace('(黄浦旅游集散站)',go_list.start_res); temp = temp.replace('乌镇',go_list.end_area); temp = temp.replace('(西栅1号停车场)',go_list.end_res); temp = temp.replace('2016-07-26',go_list.run_date); temp = temp.replace('07:40',go_list.run_time); temp = temp.replace('[普通座]',go_list.site_type); temp = temp.replace('[n]',go_list.num); temp = temp.replace('小橙子',go_list.customer_name); temp = temp.replace('18602525520',go_list.customer_mobile); var aaa = $('#total').html(); aaa = aaa.replace('110',go_list.order_price); $('#total').html(aaa); $('#go').html(temp); }else{ var go_list = submite_success.go_list; var back_list = submite_success.back_list; var temp = backHTML; temp = temp.replace('[去程出发地]',go_list.start_area); temp = temp.replace('去程出发站点',go_list.start_res); temp = temp.replace('[去程目的地]',go_list.end_area); temp = temp.replace('去程目的站点',go_list.end_res); temp = temp.replace('[去程日期]',go_list.run_date); temp = temp.replace('[去程时间]',go_list.run_time); temp = temp.replace('[去程座]',go_list.site_type); temp = temp.replace('[去程数量]',go_list.num); temp = temp.replace('[返程出发地]',back_list.start_area); temp = temp.replace('返程出发站点',back_list.start_res); temp = temp.replace('[返程目的地]',back_list.end_area); temp = temp.replace('返程目的站点',back_list.end_res); temp = temp.replace('[返程日期]',back_list.run_date); temp = temp.replace('[返程时间]',back_list.run_time); temp = temp.replace('[返程座]',back_list.site_type); temp = temp.replace('[返程数量]',back_list.num); temp = temp.replace('小橙子',back_list.customer_name); temp = temp.replace('18602525520',back_list.customer_mobile); var bbb = $('#total').html(); bbb = bbb.replace('110',parseInt(go_list.order_price)+parseInt(back_list.order_price)); console.log(go_list.order_price); console.log(back_list.order_price); $('#total').html(bbb); $('#back').html(temp); } } //二维码支付 $("#pay_code").click(function(){ window.location.href="pay_code_bus.html"; }) //选中微信支付 $("#change_wechat").click(function(){ if($("#duigou").attr("src")=="images/duigou_no.png"){ $("#duigou").attr("src","images/duigou_yes.png"); }else if($("#duigou").attr("src")=="images/duigou_yes.png"){ $("#duigou").attr("src","images/duigou_no.png"); } }) //支付 $("#wechat_pay").click(function(){ if($("#duigou").attr("src")=="images/duigou_no.png"){ alert("请选择支付方式!"); }else if($('#minute_show').html() == '00分' && $('#second_show').html() == '00秒'){ $('#info').addClass('ui_hide'); $('#outtime').removeClass('ui_hide'); }else{ if(login_data.main_corp_id==4) { var pay_url = "http://qdh.zhizhuchuxing.cn/"; } else { var pay_url = "http://wx.zhizhuchuxing.com/"; } if(login_data.login_type==1){ window.location.href= pay_url + "wechat/WxPay/realpay/onlinePay.php?orderid="+submite_success.order_id+"&ifdisney="+submite_success.ifdisney+"&fx=11&code2=11"; }else{ window.location.href= pay_url + "wechat/WxPay/realpay/onlinePay.php?orderid="+submite_success.order_id+"&ifdisney="+submite_success.ifdisney+"&fx=11"; } } }) //倒计时 function timer(intDiff){ window.setInterval(function(){ var day=0, hour=0, minute=0, second=0;//时间默认值 if(intDiff > 0){ day = Math.floor(intDiff / (60 * 60 * 24)); hour = Math.floor(intDiff / (60 * 60)) - (day * 24); minute = Math.floor(intDiff / 60) - (day * 24 * 60) - (hour * 60); second = Math.floor(intDiff) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60); } if (minute <= 9) minute = '0' + minute; if (second <= 9) second = '0' + second; $('#minute_show').html(minute+'分'); $('#second_show').html(second+'秒'); intDiff--; }, 1000); } //超时重新预订 function payAgain(){ window.location.href = './resever_bus.html'; }