|
- //普通车
- var commonHTML = '';
- //周边游
- var traveHTML = '';
- //已完成
- var didHTML = '';
-
- var inghave = '';
-
- var didhasno = '';
-
- $("#loading_html").show();
- window.onload = function(){
-
-
- //样式分两大块、普通车、周边游
- commonHTML = $('.common_bus').prop('outerHTML');
- traveHTML = $('.around_trave').prop('outerHTML');
- //didHTML = $('#did').html();
-
- $.ajax({
- url:base_api + "order/orderlist", //请求地址
- data:{},
- type: "post", //请求方式
- async:false,
- dataType: "json",
- success: function (data) {
- console.log(data);
- if(data.flag == true){
- didhasno = data.data.doing.length;
- inghave = data.data.done.length;
- reloadData(data);
- selectStatus(0);
- }else{
- alert(data.msg);
- }
-
- }
- });
-
-
- }
-
- //订单状态的切换和筛选
- function selectStatus(selectStatus){
- if (selectStatus == 0) {
- $('#hasnoinfo').addClass('ui_hide');
- $('#going').addClass('title_line');
- $('#going').removeClass('commongray_color');
- $('#completed').addClass('commongray_color');
- $('#completed').removeClass('title_line');
-
- $('#ing').removeClass('ui_hide');
- $('#did').addClass('ui_hide');
-
- if (didhasno == 0) {
-
- $('#hasnoinfo').removeClass('ui_hide');
- }else{
- $('#hasnoinfo').addClass('ui_hide');
- }
-
- } else{
- $('#hasnoinfo').addClass('ui_hide');
- $('#completed').addClass('title_line');
- $('#completed').removeClass('commongray_color');
- $('#going').addClass('commongray_color');
- $('#going').removeClass('title_line');
-
- $('#did').removeClass('ui_hide');
- $('#ing').addClass('ui_hide');
-
- if (inghave == 0) {
- $('#hasnoinfo').removeClass('ui_hide');
- }else{
- $('#hasnoinfo').addClass('ui_hide');
- }
- }
- }
-
- //加载数据
- function reloadData(data){
- var inglist = data.data.doing;
- var didlist = data.data.done;
- var newHTML = '';
- var newHTML1 = '';
- for(var i=0;i<inglist.length;i++){
- var common_state_img = "";
- var trave_state_img = "";
- var common_again_tick = "";
- var trave_again_tick = "";
-
- //普通车订单状态图片及重新购票、周边游状态图片及重新购票
- if(inglist[i].order_status=="145"){
- common_state_img = "img-weizhifu";
- common_again_tick = '<div style="color: #ff6d6d;top: 0.03rem;">前往支付</div>';
- trave_state_img = "img-weizhifu";
- trave_again_tick = '<div style="color: #ff6d6d;top: 0.03rem;">前往支付</div>';
- }else if(inglist[i].order_status=="146"){
- common_state_img = "img-yichupiao";
- common_again_tick = '<div></div>';
- trave_state_img = "img-yichupiao";
- trave_again_tick = '<div></div>';
- }else if(inglist[i].order_status=="147"){
- common_state_img = "img-yiwancheng";
- common_again_tick = '<div></div>';
- trave_state_img = "img-yiwancheng";
- trave_again_tick = '<div></div>';
- }else if(inglist[i].order_status=="148"){
- common_state_img = "img-yiquxiao";
- common_again_tick = '<div style="color: #519d9e;top: 0.03rem;">重新购票</div>';
- trave_state_img = "img-yiquxiao";
- trave_again_tick = '<div style="color: #519d9e;top: 0.03rem;">重新购票</div>';
- }
- if(inglist[i].line_type == "369"){
- //周边游样式
- var tempHTML = traveHTML;
- tempHTML=tempHTML.replace('none','block');
- tempHTML=tempHTML.replace('[35]',parseInt(Math.ceil(inglist[i].price)));
- tempHTML=tempHTML.replace('[10月09日]',inglist[i].start_date);
- tempHTML=tempHTML.replace('[10:45]',inglist[i].start_time);
- tempHTML=tempHTML.replace('[img_yiwancheng]',trave_state_img);
- tempHTML=tempHTML.replace('[千岛湖两日游]',inglist[i].line_name);
- tempHTML=tempHTML.replace('[含往返豪华大巴士接送]',inglist[i].line_describe);
- tempHTML=tempHTML.replace('[上海皇甫旅游集散地]',inglist[i].start_city+inglist[i].start_station);
- tempHTML=tempHTML.replace('[2]',inglist[i].pnum);
- tempHTML=tempHTML.replace('[重新购票]',trave_again_tick);
- tempHTML=tempHTML.replace('[今天]',inglist[i].week);
- tempHTML=tempHTML.replace('[order_id]',inglist[i].order_id);
-
- }else{
- //普通样式
- var tempHTML = commonHTML;
- tempHTML=tempHTML.replace('none','block');
- tempHTML=tempHTML.replace('[000000]',inglist[i].order_id);
- tempHTML=tempHTML.replace('[07:45]',inglist[i].start_time);
- tempHTML=tempHTML.replace('[img_yiwancheng]',common_state_img);
- tempHTML=tempHTML.replace('[35]',parseInt(Math.ceil(inglist[i].price)));
- tempHTML=tempHTML.replace('[南京]',inglist[i].start_city);
- tempHTML=tempHTML.replace('[马群马群]',inglist[i].start_station);
- tempHTML=tempHTML.replace('[南通]',inglist[i].end_city);
- tempHTML=tempHTML.replace('[仙鹤仙鹤仙鹤]',inglist[i].end_station);
- tempHTML=tempHTML.replace('[9月09日]',inglist[i].start_date);
- tempHTML=tempHTML.replace('[今天]',inglist[i].week);
- tempHTML=tempHTML.replace('[重新购票]',common_again_tick);
- tempHTML=tempHTML.replace('[order_id]',inglist[i].order_id);
-
- }
- newHTML+=tempHTML;
-
- }
- $('#ing').html(newHTML);
-
- for(var i=0;i<didlist.length;i++){
- var common_state_img = "";
- var trave_state_img = "";
- var common_again_tick = "";
- var trave_again_tick = "";
-
- //普通车订单状态图片及重新购票、周边游状态图片及重新购票
- if(didlist[i].order_status=="145"){
- common_state_img = "img-weizhifu";
- common_again_tick = '<div style="color: #ff6d6d;top: 0.03rem;">前往支付</div>';
- trave_state_img = "img-weizhifu";
- trave_again_tick = '<div style="color: #ff6d6d;top: 0.03rem;">前往支付</div>';
- }else if(didlist[i].order_status=="146"){
- common_state_img = "img-yichupiao";
- common_again_tick = '<div></div>';
- trave_state_img = "img-yichupiao";
- trave_again_tick = '<div></div>';
- }else if(didlist[i].order_status=="147"){
- common_state_img = "img-yiwancheng";
- common_again_tick = '<div></div>';
- trave_state_img = "img-yiwancheng";
- trave_again_tick = '<div></div>';
- }else if(didlist[i].order_status=="148"){
- common_state_img = "img-yiquxiao";
- common_again_tick = '<div style="color: #519d9e;top: 0.03rem;">重新购票</div>';
- trave_state_img = "img-yiquxiao";
- trave_again_tick = '<div style="color: #519d9e;top: 0.03rem;">重新购票</div>';
- }
- if(didlist[i].line_type == "369"){
- //周边游样式
- var tempHTML = traveHTML;
- tempHTML=tempHTML.replace('none','block');
- tempHTML=tempHTML.replace('[35]',parseInt(Math.ceil(didlist[i].price)));
- tempHTML=tempHTML.replace('[10月09日]',didlist[i].start_date);
- tempHTML=tempHTML.replace('[10:45]',didlist[i].start_time);
- tempHTML=tempHTML.replace('[img_yiwancheng]',trave_state_img);
- tempHTML=tempHTML.replace('[千岛湖两日游]',didlist[i].line_name);
- tempHTML=tempHTML.replace('[含往返豪华大巴士接送]',didlist[i].line_describe);
- tempHTML=tempHTML.replace('[上海皇甫旅游集散地]',didlist[i].start_city+didlist[i].start_station);
- tempHTML=tempHTML.replace('[2]',didlist[i].pnum);
- tempHTML=tempHTML.replace('[重新购票]',trave_again_tick);
- tempHTML=tempHTML.replace('[今天]',didlist[i].week);
- tempHTML=tempHTML.replace('[order_id]',didlist[i].order_id);
-
- }else{
- //普通样式
- var tempHTML = commonHTML;
- tempHTML=tempHTML.replace('none','block');
- tempHTML=tempHTML.replace('[000000]',didlist[i].order_id);
- tempHTML=tempHTML.replace('[07:45]',didlist[i].start_time);
- tempHTML=tempHTML.replace('[img_yiwancheng]',common_state_img);
- tempHTML=tempHTML.replace('[35]',parseInt(Math.ceil(didlist[i].price)));
- tempHTML=tempHTML.replace('[南京]',didlist[i].start_city);
- tempHTML=tempHTML.replace('[马群马群]',didlist[i].start_station);
- tempHTML=tempHTML.replace('[南通]',didlist[i].end_city);
- tempHTML=tempHTML.replace('[仙鹤仙鹤仙鹤]',didlist[i].end_station);
- tempHTML=tempHTML.replace('[9月09日]',didlist[i].start_date);
- tempHTML=tempHTML.replace('[今天]',didlist[i].week);
- tempHTML=tempHTML.replace('[重新购票]',common_again_tick);
- tempHTML=tempHTML.replace('[order_id]',didlist[i].order_id);
-
- }
- newHTML1+=tempHTML;
-
- }
- $('#did').html(newHTML1);
- $(".common_bus").click(function(){
- var order_id = $(this).attr("order_id");
- window.location.href="order_detail.html?order_id="+order_id;
- });
- $(".around_trave").click(function(){
- var order_id = $(this).attr("order_id");
- window.location.href="order_detail.html?order_id="+order_id;
- });
- }
-
-
- //跳转订单详情页面
- function goToDetail(order_id,order_status){
- window.location.href = './order_detail.html?order_id='+order_id;
- }
-
- //跳转支付页面
- function goToPay(order_id){
- window.location.href = './order_detail.html?order_id='+order_id;
- }
-
- //跳转退票
- function refundTicket(order_id){
- window.location.href = './order_detail.html?order_id='+order_id;
- }
-
-
- //预订
- function seeTheOrder(){
- window.location.href = './travel_book.html';
- }
|