|
- $("#loading_html").show();
- var traveHTML = $('.around_trave').html();
- var commonHTML = $('.common_bus').html();
-
-
- var intDiff = '';//倒计时总秒数量
-
- var order_id = getPar('order_id');
-
- window.onload = function(){
-
- httpData();
-
- }
-
- //请求数据
- function httpData(){
- $.ajax({
- url:base_api + "order/orderlist/getDetaile", //请求地址
- type: "post", //请求方式
- data:{
- order_id:order_id
- },
- dataType: "json",
- success: function (data) {
- console.log(data);
- if(data.flag == true){
- // 倒计时
- intDiff = data.data.timer;
- reloadData(data.data);
- }else{
- alert(data.msg);
- }
- }
- });
- }
-
-
- //加载数据
- function reloadData(data){
-
- var if_car = data.line_type;
- if(data[0].order_status==145){
- $("#go_pay").show();
-
- $("#count_price").text(parseInt(Math.ceil(data.price)));
- $("#people_no").text("共"+data[0].pcount+"人");
-
- $("#title_content_back").show();
- $("#tishi_info").hide();
- timer(intDiff,'minute_show','second_show');
- }else{
- $("#go_pay").hide();
- $("#tishi_info").show();
- $("#title_content_back").hide();
- }
- //先判断周边游||普通车
- if(if_car == "369"){
- var tempHTML = traveHTML;
- var order_status = "";
- var trip_type_text = "";
- var operation_order = "";
- var trave_info = "";
- for(var m=0,k=data.customer.length;m<k;m++){
-
- trave_info += '<div class="ub">'
- +'<div class="ub-f1 ulev1 fontmiddle_color">'+data.customer[m].p_name+'</div>'
- + '<div class="ulev1 fontmiddle_color">'+data.customer[m].p_phone+'</div>'
- + '</div>'
- }
-
- //判断订单状态
- if(data[0].order_status == 145){
-
- order_status = '<div style="border-left: 4px solid #ff6d6d;padding: 0.12rem 0.25rem 0.12rem 0.21rem;" class="ub line_color_b ui_line_b ui_p_l10 ub-ae inner_down_line_color type_color">'
- + '<div class="ub-f1 pay145_color ui_p_r10 ulev2">待支付</div>'
- + '<div class="commongray_color">订单号:'+data[0].order_id+'</div>'
- + '</div>'
- operation_order = '<div class="ulev1" style="border: 1px solid #fff;border-radius: 0.2rem;width: 0.87rem;padding: 0.03rem 0;text-align: center;color:#FFFFFF;">支付</div>'
-
-
- }else if(data[0].order_status == 146){
- order_status = '<div style="border-left: 4px solid #1b1a20;padding: 0.12rem 0.25rem 0.12rem 0.21rem;" class="ub line_color_b ui_line_b ui_p_l10 ub-ae inner_down_line_color type_color">'
- + '<div class="ub-f1 pay146_color ui_p_r10 ulev2">已出票</div>'
- + '<div class="commongray_color">订单号:'+data[0].order_id+'</div>'
- + '</div>';
- if(data.back_ticket == 1){
- operation_order = '<div order_id="'+data[0].order_id+'" class="ulev1 return_ticket" style="border: 1px solid #3d434f;border-radius: 0.2rem;width: 0.87rem;padding: 0.03rem 0;text-align: center;">退票</div>'
- }else{
- operation_order = '<div class="ulev1" style="border: 1px solid #fff;border-radius: 0.2rem;width: 0.87rem;padding: 0.03rem 0;text-align: center;color:#FFFFFF;">不能退票</div>'
- }
-
-
- }else if(data[0].order_status == 147){
- order_status = '<div style="border-left: 4px solid #999999;padding: 0.12rem 0.25rem 0.12rem 0.21rem;" class="ub line_color_b ui_line_b ui_p_l10 ub-ae inner_down_line_color type_color">'
- + '<div class="ub-f1 pay147_color ui_p_r10 ulev2">已完成</div>'
- + '<div class="commongray_color">订单号:'+data[0].order_id+'</div>'
- + '</div>';
- operation_order = '<div class="ulev1" style="border: 1px solid #ffffff;border-radius: 0.2rem;width: 0.87rem;padding: 0.03rem 0;text-align: center;color:#ffffff">完成</div>'
-
- }else if(data[0].order_status == 148){
- order_status = '<div style="border-left: 4px solid #999999;padding: 0.12rem 0.25rem 0.12rem 0.21rem;" class="ub line_color_b ui_line_b ui_p_l10 ub-ae inner_down_line_color type_color">'
- + '<div class="ub-f1 pay148_color ui_p_r10 ulev2">已取消</div>'
- + '<div class="commongray_color">订单号:'+data[0].order_id+'</div>'
- + '</div>';
- operation_order = '<div class="ulev1 again_ticket" style="border: 1px solid #3d434f;border-radius: 0.2rem;width: 0.87rem;padding: 0.03rem 0;text-align: center;">重新购票</div>'
-
- }
- tempHTML=tempHTML.replace('[185518]',data[0].order_id);
- tempHTML=tempHTML.replace('[待支付]',order_status);
- tempHTML=tempHTML.replace('[千岛湖两日游]',data[0].line_name);
- tempHTML=tempHTML.replace('[含往返豪华大巴士接送]',data[0].line_describe);
- tempHTML=tempHTML.replace('[8月24日]',data[0].start_date);
- tempHTML=tempHTML.replace('[2016年10月12日]',data[0].start_date);
- tempHTML=tempHTML.replace('[2016年11月11日]',data[1].start_date);
- tempHTML=tempHTML.replace('[10:30]',data[0].start_time);
- tempHTML=tempHTML.replace('[09:30]',data[1].start_time);
- tempHTML=tempHTML.replace('[今天]',data[0].week);
- tempHTML=tempHTML.replace('[去程出发地站点]',data[0].start_station);
- tempHTML=tempHTML.replace('[返程出发地站点]',data[1].start_station);
- tempHTML=tempHTML.replace('[2]',data[0].pcount);
- tempHTML=tempHTML.replace('[退票]',operation_order);
- tempHTML=tempHTML.replace('[毛东东]',data[0].customer_name);
- tempHTML=tempHTML.replace('[18612345678]',data[0].customer_mobile);
- tempHTML=tempHTML.replace('[58]',parseInt(data.price));
- tempHTML=tempHTML.replace('[出行人信息]',trave_info);
-
-
- $('.around_trave').html(tempHTML);
- $('.around_trave').show();
- $(".return_ticket").click(function(){
- //TODO 周边游退票
- var r=confirm("确定要退票吗?");
- if (r==true){
- $.ajax({
- url:base_api+'order/order/cancelPay', //请求地址
- type: "post",
- data:{
- order_id:order_id
- },//请求方式
- async:false,
- dataType: "json",
- success: function (data) {
- console.log(data);
- if(data.flag == true){
- alert('退票成功!');
- window.location.href = "./order_list.html";
- }else{
- alert(data.msg);
- }
- }
- });
- }
- });
- $(".again_ticket").click(function(){
- window.location.href="travel_book.html";
- });
-
-
- }else{
- var tempHTML = commonHTML;
- var order_status = "";
- var trip_type = data.trip_type;
- var trip_type_text = "";
- var operation_order = "";
- //判断往返程
- if(trip_type == 1){
- trip_type_text = "单程";
- }else if(trip_type == 2){
- trip_type_text = "往返程";
- tempHTML=tempHTML.replace('[返程出发地站点]',data[1].start_station+' ('+data[1].start_time+')');
- tempHTML=tempHTML.replace('[返程下车地站点]',data[1].end_station+' ('+data[1].end_time+')');
-
- }
- //判断订单状态
- if(data[0].order_status == 145){
-
- order_status = '<div style="border-left: 4px solid #ff6d6d;padding: 0.12rem 0.25rem 0.12rem 0.21rem;" class="ub line_color_b ui_line_b ui_p_l10 ub-ae inner_down_line_color type_color">'
- + '<div class="ub-f1 pay145_color ui_p_r10 ulev2">待支付</div>'
- + '<div class="commongray_color">订单号:'+data[0].order_id+'</div>'
- + '</div>'
- operation_order = '<div class="ulev1" style="border: 1px solid #fff;border-radius: 0.2rem;width: 0.87rem;padding: 0.03rem 0;text-align: center;color:#FFFFFF;">支付</div>'
-
-
- }else if(data[0].order_status == 146){
- order_status = '<div style="border-left: 4px solid #1b1a20;padding: 0.12rem 0.25rem 0.12rem 0.21rem;" class="ub line_color_b ui_line_b ui_p_l10 ub-ae inner_down_line_color type_color">'
- + '<div class="ub-f1 pay146_color ui_p_r10 ulev2">已出票</div>'
- + '<div class="commongray_color">订单号:'+data[0].order_id+'</div>'
- + '</div>';
- if(data.back_ticket == 1){
- operation_order = '<div order_id="'+data[0].order_id+'" class="ulev1 return_ticket" style="border: 1px solid #3d434f;border-radius: 0.2rem;width: 0.87rem;padding: 0.03rem 0;text-align: center;">退票</div>'
- }else{
- operation_order = '<div class="ulev1" style="border: 1px solid #fff;border-radius: 0.2rem;width: 0.87rem;padding: 0.03rem 0;text-align: center;color:#FFFFFF;">退票</div>'
- }
-
-
- }else if(data[0].order_status == 147){
- order_status = '<div style="border-left: 4px solid #999999;padding: 0.12rem 0.25rem 0.12rem 0.21rem;" class="ub line_color_b ui_line_b ui_p_l10 ub-ae inner_down_line_color type_color">'
- + '<div class="ub-f1 pay147_color ui_p_r10 ulev2">已完成</div>'
- + '<div class="commongray_color">订单号:'+data[0].order_id+'</div>'
- + '</div>';
- operation_order = '<div class="ulev1" style="border: 1px solid #ffffff;border-radius: 0.2rem;width: 0.87rem;padding: 0.03rem 0;text-align: center;color:#ffffff">完成</div>'
-
- }else if(data[0].order_status == 148){
- order_status = '<div style="border-left: 4px solid #999999;padding: 0.12rem 0.25rem 0.12rem 0.21rem;" class="ub line_color_b ui_line_b ui_p_l10 ub-ae inner_down_line_color type_color">'
- + '<div class="ub-f1 pay148_color ui_p_r10 ulev2">已取消</div>'
- + '<div class="commongray_color">订单号:'+data[0].order_id+'</div>'
- + '</div>';
- operation_order = '<div class="ulev1 again_ticket" style="border: 1px solid #3d434f;border-radius: 0.2rem;width: 0.87rem;padding: 0.03rem 0;text-align: center;">重新购票</div>'
-
- }
- tempHTML=tempHTML.replace('[185518]',data[0].order_id);
- tempHTML=tempHTML.replace('[待支付]',order_status);
- tempHTML=tempHTML.replace('[order_id]',data[0].order_id);
- tempHTML=tempHTML.replace('[07:45]',data[0].start_time);
- tempHTML=tempHTML.replace('[8月24日]',data[0].start_date);
- tempHTML=tempHTML.replace('[今天]',data[0].week);
- tempHTML=tempHTML.replace('[去程出发地站点]',data[0].start_station+' ('+data[0].start_time+')');
- tempHTML=tempHTML.replace('[去程下车地站点]',data[0].end_station+' ('+data[0].end_time+')');
- tempHTML=tempHTML.replace('[单程]',trip_type_text);
- tempHTML=tempHTML.replace('[普通座]',data[0].seat_type);
- tempHTML=tempHTML.replace('[5]',data[0].pcount);
- tempHTML=tempHTML.replace('[退票]',operation_order);
- tempHTML=tempHTML.replace('[毛东东]',data[0].customer_name);
- tempHTML=tempHTML.replace('[18612345678]',data[0].customer_mobile);
- tempHTML=tempHTML.replace('[58]',parseInt(data.price));
-
-
- $('.common_bus').html(tempHTML);
- $('.common_bus').show();
- if(trip_type == 2){
- $(".fancheng").show();
- }else{
- $(".fancheng").hide();
- }
- $(".return_ticket").click(function(){
- //TODO 普通车退票
- var r=confirm("确定要退票吗?");
- if (r==true){
- $.ajax({
- url:base_api+'order/order/cancelPay', //请求地址
- type: "post",
- data:{
- order_id:order_id
- },//请求方式
- async:false,
- dataType: "json",
- success: function (data) {
- console.log(data);
- if(data.flag == true){
- alert('退票成功!');
- window.location.href = "./order_list.html";
- }else{
- alert(data.msg);
- }
- }
- });
- }
- });
- $(".again_ticket").click(function(){
- window.location.href="travel_book.html";
- });
- }
-
- }
-
- //支付
- function goToPay(){
- var minute = '';
- var second = '';
- // if (ifback == 0) {
- // minute = $('#minute_show_go').html();
- // second = $('#second_show_go').html();
- // } else{
- // minute = $('#minute_show').html();
- // second = $('#second_show').html();
- // }
- if (minute == '00分' && second == '00秒') {
- alert('支付已超时,请重新购票!');
- return false;
- }else{
- //支付地址
- window.location.href = 'http://wx.zhizhuchuxing.com/wechat/WxPay/realpay/weChatShopPay.php?order_id='+order_id;
- }
- }
-
-
- //倒计时
- function timer(intDiff,minstr,secstr){
- 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;
- $('#'+minstr).html(minute+'分');
- $('#'+secstr).html(second+'秒');
- intDiff--;
- }, 1000);
- }
|