var detailHTML = '';
window.onload = function(){
detailHTML = $('#detail_info').html();
var order_id = getPar('order');
$.ajax({
url:'http://sfx.zhizhuchuxing.com/zz-fx/Model/distribut/OrderDetail.php',
type:'post',
data:{
order_id:order_id,
},
async:false,
dataType: "json",
success: function (data) {
if(data.code == 0){
console.log(data);
//展示信息
showDetailInfo(data);
}else{
console.log(data);
window.wxc.xcConfirm(data.info, window.wxc.xcConfirm.typeEnum.info);
}
},
fail: function (date) {
window.wxc.xcConfirm("数据加载失败!", window.wxc.xcConfirm.typeEnum.info);
}
});
}
//填充信息
function showDetailInfo(data){
var newHTML = '';
var tempHTML = detailHTML;
tempHTML = tempHTML.replace('[订单号]',data.data.order_id);
tempHTML = tempHTML.replace('[已完成]',data.data.order_status_2);
tempHTML = tempHTML.replace('[线路]',data.data.line_name);
tempHTML = tempHTML.replace('[出发地]',data.data.start_station+'('+data.data.start_res_name+')');
tempHTML = tempHTML.replace('[目的地]',data.data.end_station+'('+data.data.end_res_name+')');
tempHTML = tempHTML.replace('[出发时间]',data.data.run_time);
tempHTML = tempHTML.replace('[车次]',data.data.bus_order);
tempHTML = tempHTML.replace('[联系人信息]',data.data.CUSTOMER_NAME+''+data.data.CUSTOMER_MOBILE);
tempHTML = tempHTML.replace('[数量]',data.data.tic_count);
tempHTML = tempHTML.replace('[金额]',data.data.order_price);
tempHTML = tempHTML.replace('[车牌号]',data.data.driver_mobile);
tempHTML = tempHTML.replace('[司机姓名]',data.data.driver_name);
newHTML += tempHTML;
$('#detail_info').html(newHTML);
// alert(data.data.time[0]);
console.log($('#one').eq(2));
$('#one').children().eq(2).html(data.data.time[0]);
$('#one').children().eq(3).html(data.data.time[1]);
if (data.data.order_status == '145') {
$('#one').addClass('active');
// $('#one').children().eq(2).html(data.data.time[0]);
// $('#one').children().eq(3).html(data.data.time[1]);
} else if (data.data.order_status == '146') {
$('#one').addClass('active');
$('#two').addClass('active');
$('#three').addClass('active');
// $('#one').children().eq(2).html(data.data.time[0]);
// $('#one').children().eq(3).html(data.data.time[1]);
$('#two').children().eq(2).html(data.data.time[2]);
$('#two').children().eq(3).html(data.data.time[3]);
$('#three').children().eq(2).html(data.data.time[2]);
$('#three').children().eq(3).html(data.data.time[3]);
} else{
$('#one').addClass('active');
$('#two').addClass('active');
$('#three').addClass('active');
$('#four').addClass('active');
// $('#one').children().eq(2).html(data.data.time[0]);
// $('#one').children().eq(3).html(data.data.time[1]);
$('#two').children().eq(2).html(data.data.time[2]);
$('#two').children().eq(3).html(data.data.time[3]);
$('#three').children().eq(2).html(data.data.time[2]);
$('#three').children().eq(3).html(data.data.time[3]);
$('#four').children().eq(2).html(data.data.time[4]);
$('#four').children().eq(3).html(data.data.time[5]);
}
}
//获取参数
function getPar(par) {
//获取当前URL
var local_url = document.location.href;
local_url = decodeURI(local_url);
//获取要取得的get参数位置
var get = local_url.indexOf(par + "=");
if (get == -1) {
return false;
}
//截取字符串
var get_par = local_url.slice(par.length + get + 1);
//判断截取后的字符串是否还有其他get参数
var nextPar = get_par.indexOf("&");
if (nextPar != -1) {
get_par = get_par.slice(0, nextPar);
}
return get_par;
}