//进行中 等待支付
var waitHTML = '';
//进行中 已出票
var outHTML = '';
//已完成
var didHTML = '';
var inghave = '';
var didhasno = '';
window.onload = function(){
waitHTML = $('#wait_pay').prop('outerHTML');
outHTML = $('#out_ticket').prop('outerHTML');
didHTML = $('#did').html();
$.ajax({
url:'./zz_wxsct/Model/order/order_list.php', //请求地址
type: "post", //请求方式
async:false,
dataType: "json",
success: function (data) {
console.log(data);
if(data.code == 0){
didhasno = data.goning.length;
inghave = data.completed.length;
reloadData(data);
selectStatus(0);
}else{
alert(data.info);
}
}
});
}
//订单状态的切换和筛选
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.goning;
var newHTML = '';
for(var i=0;i',cstr);
}else{
var cstr='退票
';
tempHTML=tempHTML.replace('',cstr);
}
}
tempHTML=tempHTML.replace(/\[order_id]/g,inglist[i].ORDER_ID);
// tempHTML=tempHTML.replace('待支付',inglist[i].ORDER_STATUS_info);
tempHTML=tempHTML.replace('[乌镇]',inglist[i].PROD_START_STATION_AREA_NAME);
tempHTML=tempHTML.replace('[上海]',inglist[i].PROD_END_STATION_AREA_NAME);
tempHTML=tempHTML.replace('[上海迪士尼]',inglist[i].PROD_END_STATION_RES_NAME);
tempHTML=tempHTML.replace('[西栅1号停车场]',inglist[i].PROD_START_STATION_RES_NAME);
tempHTML=tempHTML.replace('[5人]',inglist[i].STAT_NUM+'人');
tempHTML=tempHTML.replace('[普通座]',inglist[i].STAT_TYPE);
tempHTML=tempHTML.replace('[8月24日 今天]',inglist[i].DATE);
tempHTML=tempHTML.replace('[07:45]',inglist[i].TIME);
newHTML+=tempHTML;
}
$('#ing').html(newHTML);
//
var didlist = data.completed;
var newHTML1 = '';
for(var i=0;i