|
-
- //var base_url="http://temp.zhizhuchuxing.com";
- var base_url="";
- //var base_url="http://127.0.0.1:8020/%E8%9C%98%E8%9B%9B2.0%E8%83%BD%E5%86%99PHP";
-
- function show_detail(index) {
- var obj1 = document.getElementById("content_" + index);
- var cstr1 = obj1.style.display;
- if(cstr1 == 'block') {
- obj1.style.display = 'none';
- } else {
- obj1.style.display = 'block';
- }
- }
- window.onload = function() {
- $('#id-date-picker-1').val(getDateTime(0));
- var res_id = getPar('res_id');
- var res_name = getPar('res_name');
- $('#h1_title').html(res_name);
- var start_date = $('#id-date-picker-1').val();
- var end_date = start_date;
- // var url = "./st-xm/Api/car_team_controll.php?method=getDriverRunByCompany&start_date=" + start_date + "&end_date=" + end_date + "&res_id=" + res_id;
- var url=base_url+"/st-xm/Api/car_team_controll.php?method=getDriverRunByCompany&start_date=" + start_date + "&end_date=" + end_date + "&res_id=" + res_id;
- get_data_for_url(url);
- }
-
- function selectDate(date) {
- var res_id = getPar('res_id');
- var start_date = $('#id-date-picker-1').val();
- var end_date = start_date;
- var search_res = $('#search_res_name').val();
- var url =base_url+"/st-xm/Api/car_team_controll.php?method=getDriverRunByCompany&start_date=" + start_date + "&end_date=" + end_date + "&res_id=" + res_id+ "&search_res=" + search_res;
- get_data_for_url(url);
- }
-
- function get_data_for_url(url) {
- //根据
-
- console.log(url);
- $.getJSON(url, function(res_data) {
- console.log(res_data);
- $('#warn_info').html('');
- if(res_data['code'] != "0") {
- // alert(res_data['info']);
- // 用其它方式来提醒
- $('#warn_info').html(res_data['info']);
- }
- var driver_run = res_data['driver_run'];
- if(!driver_run) {
- return;
- }
- var titleHTML = '';
- for(var i = 0, m = driver_run.length; i < m; i++) {
- var dict = driver_run[i];
- titleHTML += '<li class="li_title" onclick="show_detail(' + i + ')">'
- titleHTML += '<span>' + dict['run_date'] + ' 【' + dict['run_time'] + '】</span>';
- titleHTML += '<span>' + dict['prod_name'] + '</span>';
- titleHTML += '<span>' + dict['driver_name'] + '</span>';
- titleHTML += '<span>' + dict['driver_mobile'] + '</span>';
- if(dict['customer'].length > 0) {
- titleHTML += '<span id="count" style="color:blue;">【' + dict['ticket_count'] + '人】</span>';
- } else {
- titleHTML += '<span style="color:red;">无乘客</span>';
- }
-
- titleHTML += '</li>';
- titleHTML += '<li class="li_content" style="display: none;" id="content_' + i + '">';
- titleHTML += '<span style="color:red;width:60px;">编号</span><span style="width:200px;color:red">姓名</span><span style="color:red">手机号</span><span style="display:none;color:red">订单号</span><span style="color:red">上车站</span><span style="display:none;color:red">下车站</span><span style="width:60px;color:red">人数</span></br>';
- for(var j = 0, n = dict['customer'].length; j < n; j++) {
- var twoDict = dict['customer'][j];
- titleHTML += '<span style="width:60px">' + parseInt(j + 1) + '</span>';
- titleHTML += '<span style="width:200px">' + twoDict['customer_name'] + '</span>';
- titleHTML += '<a href="tel:'+twoDict['customer_mobile']+'"><span>' + twoDict['customer_mobile'] + '</span></a>';
- // titleHTML += '<span>' + twoDict['parent_order_id'] + '</span>';
- titleHTML += '<span>' + twoDict['start_station_res_name'] + '</span>';
- // titleHTML += '<span>' + twoDict['end_station_res_name'] + '</span>';
- titleHTML += '<span style="width:60px">' + twoDict['ticket_count'] + '</span>';
- titleHTML += '<hr style="margin-top:0px;margin-bottom:0px;border:0;border-top:1px solid #eee;">'
- titleHTML += '</br>';
- }
- titleHTML += '</li>';
- }
- if(titleHTML) {
- $('#all_ul').html(titleHTML);
-
- } else {
- $('#all_ul').html('');
- }
-
- });
- }
-
- 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 "";
- }
- //截取字符串
- 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;
- }
-
-
- /*
- function get_before_day() {
- var dateStr=$('#id-date-picker-1').val();
- var t_temp_sdate = dateStr.split('-');
- var now = new Date(t_temp_sdate[0], t_temp_sdate[1], t_temp_sdate[2]);
- now.setDate(now.getDate() - 0 - 1);
- var year = ";" + now.getFullYear() + ";";
- var month = ";" + now.getMonth() + ";";
- var day = ";" + now.getDate() + ";";
- if(year.length < 4) {
- year = "0" + year;
- }
- if(month.length < 4) {
- month = "0" + month;
- }
- if(day.length < 4) {
- day = "0" + day;
- }
- var datestr = year + "-" + month + "-" + day;
- datestr = datestr.replace(/;/g, "");
- $('#id-date-picker-1').val(datestr);
- selectDate(dateStr);
- }
-
-
- // 得到明天的
- function get_after_day() {
- var dateStr=$('#id-date-picker-1').val();
- var t_temp_sdate = dateStr.split('-');
- var now = new Date(t_temp_sdate[0], t_temp_sdate[1], t_temp_sdate[2]);
- now.setDate(now.getDate() - 0 + 1);
- var year = ";" + now.getFullYear() + ";";
- var month = ";" + now.getMonth() + ";";
- var day = ";" + now.getDate() + ";";
- if(year.length < 4) {
- year = "0" + year;
- }
- if(month.length < 4) {
- month = "0" + month;
- }
- if(day.length < 4) {
- day = "0" + day;
- }
- var datestr = year + "-" + month + "-" + day;
- datestr = datestr.replace(/;/g, "");
- $('#id-date-picker-1').val(datestr);
- selectDate(dateStr);
- }
-
- */
- function get_current_day() {
- var dateStr=$('#id-date-picker-1').val();
- selectDate(dateStr);
- }
-
-
- function get_before_day() {
- var dateStr=$('#id-date-picker-1').val()
- d = new Date(dateStr);
- d = +d - 10006060 / 3 * 24;
- d = new Date(d);
- //return d;
- //格式化
- var year = ";" + d.getFullYear() + ";";
- var month = ";" + (d.getMonth() + 0 + 1) + ";";
- var day = ";" + d.getDate() + ";";
- if(year.length < 4) {
- year = "0" + year;
- }
- if(month.length < 4) {
- month = "0" + month;
- }
- if(day.length < 4) {
- day = "0" + day;
- }
- var datestr = year + "-" + month + "-" + day;
- datestr = datestr.replace(/;/g, "");
- $('#id-date-picker-1').val(datestr);
- selectDate(dateStr);
- }
-
- function get_after_day(){
- var dateStr=$('#id-date-picker-1').val()
- d = new Date(dateStr);
- d = +d + 10006060 / 3 * 24;
- d = new Date(d);
- //return d;
- //格式化
- var year = ";" + d.getFullYear() + ";";
- var month = ";" + (d.getMonth() + 0 + 1) + ";";
- var day = ";" + d.getDate() + ";";
- if(year.length < 4) {
- year = "0" + year;
- }
- if(month.length < 4) {
- month = "0" + month;
- }
- if(day.length < 4) {
- day = "0" + day;
- }
- var datestr = year + "-" + month + "-" + day;
- datestr = datestr.replace(/;/g, "");
- $('#id-date-picker-1').val(datestr);
- selectDate(dateStr);
- }
-
- function getDateTime(nTypeFlag) {
- var tNowTime = new Date();
- var myYear = ';' + tNowTime.getFullYear() + ';';
- var myMonth = ';' + (tNowTime.getMonth() + 1 - 0) + ';';
- var myDay = ';' + tNowTime.getDate() + ';';
- var myHour = ';' + tNowTime.getHours() + ';';
- var myMinu = ';' + tNowTime.getMinutes() + ';';
- var mySecond = ';' + tNowTime.getSeconds() + ';';
-
- if(myMonth.length < 4) myMonth = '0' + myMonth;
- if(myDay.length < 4) myDay = '0' + myDay;
- if(myHour.length < 4) myHour = '0' + myHour;
- if(myMinu.length < 4) myMinu = '0' + myMinu;
- if(mySecond.length < 4) mySecond = '0' + mySecond;
-
- var cNewTimeStr;
- //alert(tNowTime);
- switch(nTypeFlag + 1 - 1) {
- case 0:
- cNewTimeStr = myYear + '-' + myMonth + '-' + myDay;
- break;
- case 1:
- cNewTimeStr = myYear + myMonth + myDay;
- break;
- case 2:
- cNewTimeStr = myHour + ':' + myMinu + ':' + mySecond;
- break;
- case 3:
- cNewTimeStr = myHour + myMinu + mySecond;
- break;
- case 4:
- cNewTimeStr = myYear + myMonth + myDay + myHour + myMinu + mySecond;
- break;
- case 5:
- cNewTimeStr = myYear + '年' + myMonth + '月' + myDay + '日';
- break;
- case 6:
- cNewTimeStr = myYear;
- break;
- case 7:
- cNewTimeStr = myYear + '-' + myMonth;
- break;
- case 8: //得到上一个月的今天
- var date = getDateTime(0);
- var arr = date.split('-');
- var year = arr[0]; //获取当前日期的年份
- var month = arr[1]; //获取当前日期的月份
- var day = arr[2]; //获取当前日期的日
- var days = new Date(year, month, 0);
- days = days.getDate(); //获取当前日期中月的天数
- var year2 = year;
- var month2 = parseInt(month) - 1;
- if(month2 == 0) {
- year2 = parseInt(year2) - 1;
- month2 = 12;
- }
- var day2 = day;
- var days2 = new Date(year2, month2, 0);
- days2 = days2.getDate();
- if(day2 > days2) {
- day2 = days2;
- }
- if(month2 < 10) {
- month2 = '0' + month2;
- }
- cNewTimeStr = year2 + '-' + month2 + '-' + day2;
- break;
- case 9: //得到下一个月的今天
- var date = getDateTime(0);
- var arr = date.split('-');
- var year = arr[0]; //获取当前日期的年份
- var month = arr[1]; //获取当前日期的月份
- var day = arr[2]; //获取当前日期的日
- var days = new Date(year, month, 0);
- days = days.getDate(); //获取当前日期中的月的天数
- var year2 = year;
- var month2 = parseInt(month) + 1;
- if(month2 == 13) {
- year2 = parseInt(year2) + 1;
- month2 = 1;
- }
- var day2 = day;
- var days2 = new Date(year2, month2, 0);
- days2 = days2.getDate();
- if(day2 > days2) {
- day2 = days2;
- }
- if(month2 < 10) {
- month2 = '0' + month2;
- }
-
- var t2 = year2 + '-' + month2 + '-' + day2;
- return t2;
- break;
- case 10: //昨日日期
- var dateStr = getDateTime(0);
- var t_temp_sdate = dateStr.split('-');
- var now = new Date(t_temp_sdate[0], t_temp_sdate[1], t_temp_sdate[2]);
- now.setDate(now.getDate() - 0 - 1);
- var year = ";" + now.getFullYear() + ";";
- var month = ";" + now.getMonth() + ";";
- var day = ";" + now.getDate() + ";";
- if(year.length < 4) {
- year = "0" + year;
- }
- if(month.length < 4) {
- month = "0" + month;
- }
- if(day.length < 4) {
- day = "0" + day;
- }
- var datestr = year + "-" + month + "-" + day;
- datestr = datestr.replace(/;/g, "");
- return datestr;
- break;
- case 11: //明日日期
- var dateStr = getDateTime(0);
- var t_temp_sdate = dateStr.split('-');
- var now = new Date(t_temp_sdate[0], t_temp_sdate[1], t_temp_sdate[2]);
- now.setDate(now.getDate() - 0 + 1);
- var year = ";" + now.getFullYear() + ";";
- var month = ";" + now.getMonth() + ";";
- var day = ";" + now.getDate() + ";";
- if(year.length < 4) {
- year = "0" + year;
- }
- if(month.length < 4) {
- month = "0" + month;
- }
- if(day.length < 4) {
- day = "0" + day;
- }
- var datestr = year + "-" + month + "-" + day;
- datestr = datestr.replace(/;/g, "");
- return datestr;
- break;
- default:
- cNewTimeStr = myYear + '-' + myMonth + '-' + myDay + ' ' + myHour + ':' + myMinu + ':' + mySecond;
- break;
- }
-
- cNewTimeStr = cNewTimeStr.replace(/;/g, "");
-
- return cNewTimeStr;
- }
|