//Author:zhangsq //Date:20160906 //Description:订单列表 var orderHTML = ''; //已完成 var didHTML = ''; var inghave = ''; //记录得到的数组 var inglist = ''; var didlist = ''; window.onload = function(){ $("#loadingToast").show(); orderHTML = $('#wait_pay').html(); var url=base_api+"./application/custom_made/control.php"; var data = { type:'order_orderlist' } var parm=data; ZZLog(parm) $.post(url,parm,function(data){ data=JSON.parse(data); ZZLog(data); if (data.code == 0) { $("#loadingToast").hide(); $('#wait_pay').removeClass('ui_hide'); didhasno = data.goning.length; inghave = data.completed.length; inglist = data.goning; didlist = data.completed; selectStatus(0); }else{ $("#loadingToast").hide(); $('#wait_pay').removeClass('ui_hide'); alert(data.info); } }); } //加载数据 function reloadData(list,sel){ // var list = ''; // if (sel == 0) { // list = data.goning; // } else{ // list = data.completed; // } var newHTML = ''; for(var i=0;i[待支付]','
'+list[i].ORDER_STATUS_info+'
'); var cstr = '
去支付
'; tempHTML=tempHTML.replace('
',cstr); }else if (list[i].ORDER_STATUS == "146") { tempHTML=tempHTML.replace('
[待支付]
','
'+list[i].ORDER_STATUS_info+'
'); if (list[i].CAN_DO == "0") { $('#repalace').addClass('ui_hide'); }else{ var cstr='
退票
'; tempHTML=tempHTML.replace('
',cstr); } }else{ tempHTML=tempHTML.replace('
[待支付]
','
'+list[i].ORDER_STATUS_info+'
'); $('#repalace').addClass('ui_hide'); } tempHTML=tempHTML.replace(/\[order_id]/g,list[i].ORDER_ID); tempHTML=tempHTML.replace('[南京]',list[i].PROD_START_STATION_AREA_NAME); tempHTML=tempHTML.replace('[南通]',list[i].PROD_END_STATION_AREA_NAME); tempHTML=tempHTML.replace('[出发站点]',list[i].PROD_START_STATION_RES_NAME); tempHTML=tempHTML.replace('[目的站点]',list[i].PROD_END_STATION_RES_NAME); tempHTML=tempHTML.replace('[n]',list[i].STAT_NUM); tempHTML=tempHTML.replace('[8月24日 今天]',list[i].DATE); tempHTML=tempHTML.replace('[07:45]',list[i].TIME); newHTML+=tempHTML; } $('#wait_pay').html(newHTML); } //订单状态的切换和筛选 function selectStatus(selectStatus){ if (selectStatus == 0) { $('#going').addClass('title_line_selected'); $('#going').removeClass('title_line'); $('#completed').addClass('title_line'); $('#completed').removeClass('title_line_selected'); if (didhasno == 0) { $('#hasnoinfo').removeClass('ui_hide'); }else{ $('#hasnoinfo').addClass('ui_hide'); } selectStatus = 0; var datalist = inglist; reloadData(datalist,selectStatus); } else{ $('#completed').addClass('title_line_selected'); $('#completed').removeClass('title_line'); $('#going').addClass('title_line'); $('#going').removeClass('title_line_selected'); if (inghave == 0) { $('#hasnoinfo').removeClass('ui_hide'); }else{ $('#hasnoinfo').addClass('ui_hide'); } selectStatus = 1; var datalist = didlist; reloadData(datalist,selectStatus); } } //跳转订单详情页面 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 = './index.html'; }