You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

755 lines
24 KiB

  1. var page_size = 10;
  2. var page_status = 0;
  3. var cur_url='';
  4. var cur_sel_bus_group='0';
  5. /*======================网络请求的Ajax的代码=======================*/
  6. // 创建一个Ajax对象
  7. if (window.ActiveXObject) {
  8. var myreq = new ActiveXObject("Microsoft.XMLHTTP");
  9. } else {
  10. var myreq = new XMLHttpRequest();
  11. }
  12. function ZZLog(str){
  13. var isLog=true;
  14. if(isLog){
  15. console.log(str);
  16. }
  17. }
  18. function selectPage(){
  19. page_size = $("#select_curpage").val();
  20. page_status = 1;
  21. }
  22. /**
  23. *
  24. * @param {Object} myURL 返回数据URL接口
  25. * @param {Object} myURL2 当前的URL
  26. */
  27. document.addEventListener('DOMContentLoaded', function() {
  28. carList_html = $("#carList").html();
  29. // 设置出发日期为当前日期
  30. page_size = getPar('page_size');
  31. if(!page_size){
  32. page_size = $("#select_curpage").val();
  33. }else{
  34. $("#select_curpage").val(page_size);
  35. }
  36. var run_hour = getPar('hour');
  37. var run_minute = getPar('minute');
  38. var currpage=getPar('currpage');
  39. var start_area = getPar('start_area');
  40. var end_area = getPar('end_area');
  41. var line = getPar('line');
  42. var start_date = getPar('start_date');
  43. var end_date = getPar('end_date');
  44. var select_status = getPar('run_status');
  45. var bus_type = getPar('bus_type');
  46. var bus_group = getPar('bus_group');
  47. if(currpage || start_area || end_area || line || start_date || end_date || select_status || bus_group){
  48. if(currpage==""){
  49. currpage=1;
  50. }
  51. var tnowtime = getDateTime(4);
  52. $('#start_area').val(start_area);
  53. $('#end_area').val(end_area);
  54. $('#prod').val(line);
  55. $('#id-date-picker-1').val(start_date);
  56. $('#id-date-picker-2').val(end_date);
  57. $("#select_status").val(select_status);
  58. $("#bus_type").val(bus_type);
  59. $('#bus_group').val(bus_group);
  60. cur_sel_bus_group=bus_group;
  61. var tnowtime = getDateTime(4);
  62. var myURL = "./st-xm/Api/runInfoControll.php?method=getRunList&currpage=" + currpage + "&page_size=" + page_size + "&start_area=" + start_area + "&end_area=" + end_area + "&line=" + line + "&start_date=" + start_date + "&end_date=" + end_date + "&run_status=" + select_status + "&bus_type=" + bus_type+"&bus_group="+bus_group+ "&hour=" + run_hour + "&minute=" + run_minute;
  63. var myURL2 = "./carList.html?method=getRunList&page_size=" + page_size + "&start_area=" + start_area + "&end_area=" + end_area + "&line=" + line + "&start_date=" + start_date + "&end_date=" + end_date + "&run_status=" + select_status + "&bus_type=" + bus_type+"&bus_group="+bus_group+ "&hour=" + run_hour + "&minute=" + run_minute;
  64. cur_url=myURL2;
  65. ZZLog(myURL);
  66. get_virtual_user_list(myURL, myURL2);
  67. }else{
  68. $("#id-date-picker-1").val(getDateTime(11));
  69. $("#id-date-picker-2").val(getDateTime(11));
  70. click_search();
  71. }
  72. }, false);
  73. // 请求方法,传入URL
  74. function get_virtual_user_list(myURL, myURL2) {
  75. var tnowtime = getDateTime(4);
  76. if (myURL.indexOf('?') >= 0) {
  77. myURL += '&tt=' + tnowtime;
  78. } else {
  79. myURL += '?tt=' + tnowtime;
  80. }
  81. $.getJSON(myURL, function(httpData) {
  82. ZZLog(httpData);
  83. if (httpData['code'] != '0') {
  84. $('#carList').html('');
  85. alert(httpData['info']);
  86. return;
  87. }
  88. if (httpData['run_list'].length <= 0) {
  89. $("#carList").html('');
  90. $('#test').html('');
  91. return;
  92. }
  93. $("#carList").html('');
  94. $('#test').html('');
  95. var total = httpData['total'];
  96. $("#select_curpage_all").val(total);
  97. var carList = httpData['run_list'];
  98. var carListHTML = ''
  99. for (var i = 0; i < carList.length; i++) {
  100. var tempDict = carList[i];
  101. var tempHTML = carList_html;
  102. tempHTML = tempHTML.replace('[dict-json]',JSON.stringify(tempDict));
  103. tempHTML = tempHTML.replace('[data-statu]', tempDict['run_status']);
  104. tempHTML = tempHTML.replace('[car_number]',tempDict['car_number']);
  105. tempHTML = tempHTML.replace('[run_date]', tempDict['run_date']);
  106. tempHTML = tempHTML.replace('[QDH]', tempDict['prod_name']);
  107. tempHTML = tempHTML.replace('[name]', tempDict['run_id']);
  108. tempHTML = tempHTML.replace('[线路]', tempDict['property'] + ' ' + tempDict['prod_name']);
  109. tempHTML = tempHTML.replace('[出发日期]', tempDict['run_date']);
  110. tempHTML = tempHTML.replace('[出发站点时间]', tempDict['start_time'] + ' ' + tempDict['res_name']);
  111. tempHTML = tempHTML.replace('[send_bus_no]',tempDict['send_bus_no']);
  112. var car_no=tempDict['car_number'];
  113. car_no=(Array(2).join(0)+car_no).slice(-2);
  114. tempHTML = tempHTML.replace('[车次]', car_no);
  115. if(tempDict['motorcade_name'] == null){
  116. tempDict['motorcade_name'] = '-';
  117. }
  118. tempHTML = tempHTML.replace('[承运车队]', tempDict['motorcade_name']);
  119. var bus_cost = tempDict['cost_price'];
  120. if( tempDict['cost_type'] == 477 ) {
  121. bus_cost = bus_cost + " 元/车";
  122. } else {
  123. bus_cost = bus_cost + " 元/座";
  124. }
  125. tempHTML = tempHTML.replace('[用车成本]', bus_cost );
  126. tempHTML = tempHTML.replace('[座位总数]', tempDict['seat_count']);
  127. tempHTML = tempHTML.replace('[已售座位]', tempDict['sale_seat']);
  128. if (tempDict['saled_count'].trim() == "0" && tempDict['max_count'].trim() == "0") {
  129. tempHTML = tempHTML.replace('[已售人数]', '-');
  130. } else {
  131. // tempHTML = tempHTML.replace('[已售]', tempDict['saled_count'] + '/' + tempDict['max_count']);
  132. var myURL3 = "order_list.html?tt=" + tnowtime +
  133. "&timelimit=" + '出发时间' +
  134. "&starttime=" + tempDict['run_date'] +
  135. "&endtime=" + tempDict['run_date'] +
  136. "&ordersource=" + '' +
  137. "&bus_type=" + '' +
  138. "&orderstatus=" + '' +
  139. "&paystatus=" + '' +
  140. "&billingstatus=" + '' +
  141. "&mealbounce=" + '' +
  142. "&refund=" + '' +
  143. "&moresearch=" + '' +
  144. "&start_area=" + '' +
  145. "&end_area=" + '' +
  146. "&line=" + encodeURIComponent(tempDict['property'])
  147. +"&currpage="+'1'
  148. +
  149. "&pagesize=" + '10' +
  150. "&search_bus_no=" + tempDict['car_number'] +
  151. "&run_time=" + tempDict['start_time'];
  152. var tmp_url = '<a target="_blank" onclick="open_new_path(this)" go_path="'+myURL3+'">'+tempDict['saled_count']+'</a>';
  153. tmp_url += '<br /><a style="margin-top: 10px;color:#777777;" onclick="disp_run_bus_passenger( '+ tempDict['run_id'] + ', '+ tempDict['car_number'] + ' )" >明细</a>';
  154. tempHTML = tempHTML.replace('[已售人数]', tmp_url);
  155. }
  156. tempHTML = tempHTML.replace('[运营状态]', tempDict['run_status']);
  157. var send_bus_no = tempDict['send_bus_no'];
  158. var send_driver_name = tempDict['send_driver_name'];
  159. var send_driver_mobile = tempDict['send_driver_mobile'];
  160. if( send_bus_no.length > 0 || send_driver_name.length > 0 ){
  161. tempHTML = tempHTML.replace('[收客状态]', "<div style='text-align: left;'>🚍:" + send_bus_no + "<br />👨:" + send_driver_name + "<br />📞:" + send_driver_mobile + "</div>");
  162. } else {
  163. tempHTML = tempHTML.replace('[收客状态]', tempDict['receiving']);
  164. }
  165. var caozuoStr = ''
  166. caozuoStr += '<a target="_blank" onclick="open_new_path(this)" go_path="carDetail.html?run_id=' + tempDict['run_id'] + '">查看</a>&nbsp;&nbsp;';
  167. caozuoStr += '<a target="_blank" onclick="open_new_path(this)" go_path="revisecartime.html?run_id=' + tempDict['run_id'] + '">修改</a>&nbsp;&nbsp;';
  168. if( send_bus_no.length > 0 || send_driver_name.length > 0 ){
  169. caozuoStr += "<a target='_blank' href='http://api.zhizhuchuxing.com/api1.0/send_message_confirm.php?run_id=" + tempDict['run_id'] + "&bus_order_id=" + tempDict['car_number'] + "'>出行短信</a>";
  170. }
  171. tempHTML = tempHTML.replace('[操作]', caozuoStr);
  172. carListHTML += tempHTML;
  173. }
  174. $("#carList").html(carListHTML);
  175. $('.one').css('display', 'table-row');
  176. var bus_group_list=httpData['bus_group_list'];
  177. var busgrouphtml='<option value="0" selected="selected">全部</option>';
  178. for (var i=0,m=bus_group_list.length;i<m;i++) {
  179. var tempDict=bus_group_list[i];
  180. var tempHTML='<option value="0">全部</option>';
  181. tempHTML=tempHTML.replace('value="0"','value='+tempDict['group_id']);
  182. tempHTML=tempHTML.replace('全部',tempDict['group_name']);
  183. busgrouphtml+=tempHTML;
  184. }
  185. $('#bus_group').html(busgrouphtml);
  186. $('#bus_group').val(cur_sel_bus_group);
  187. // *********************************
  188. var currpage = getPar("currpage");
  189. if (!currpage) {
  190. currpage = 1
  191. }
  192. var sum = parseInt(httpData['total']);
  193. var length = page_size;
  194. var tag = "test";
  195. var userUrl = myURL2;
  196. getPager(userUrl, sum, currpage, length, tag, 'currpage');
  197. })
  198. }
  199. var carList_html = ''
  200. // 复选框事件
  201. function select_checked(index) {
  202. //index=0最上面的全选 index=1表示的是下面所有的
  203. var cur_check = $('.ace')[0];
  204. var checkList = $('.ace');
  205. var checkCount = checkList.length - 1;
  206. var true_count = 0;
  207. for (var i = 1; i < checkList.length; i++) {
  208. if (index == '0') {
  209. checkList[i].checked = cur_check.checked;
  210. } else {
  211. if (checkList[i].checked == false) {
  212. cur_check.checked = false
  213. } else {
  214. true_count = true_count + 1;
  215. }
  216. }
  217. }
  218. //判断下面是否选中完
  219. if (checkCount == true_count) {
  220. cur_check.checked = true;
  221. }
  222. var temp_QDH='';
  223. var arr_bool_QDH= new Array();
  224. var arr_bool_statu=new Array();
  225. $('.ace').each(function(index, item) {
  226. if (this.checked && index != 0) {
  227. // arr_run_ids.push($(this).attr('data_QDH'));
  228. var QDH=$(this).attr('data_QDH');
  229. var statu=$(this).attr('data-statu');
  230. temp_QDH=QDH;
  231. if(QDH=="上海-千岛湖" || QDH=="千岛湖-上海" ||QDH=="上海市-千岛湖" || QDH=="千岛湖-上海市"){
  232. arr_bool_QDH.push(true);
  233. }else{
  234. arr_bool_QDH.push(false);
  235. }
  236. if(statu=="待审核"){
  237. arr_bool_statu.push('true');
  238. }else{
  239. arr_bool_statu.push('false');
  240. }
  241. }
  242. });
  243. $('#five_del').addClass('del');
  244. $('#five_del').attr('data-statu','false');
  245. $('#update_car_no').addClass('update_car_no');
  246. $('#update_car_no').attr('data-statu','false');
  247. if(arr_bool_QDH.length<1){
  248. $('#update_car_no').addClass('update_car_no');
  249. $('#update_car_no').attr('data-statu','false');
  250. } else if(arr_bool_QDH.length>1){
  251. $('#update_car_no').addClass('update_car_no');
  252. $('#update_car_no').attr('data-statu','false');
  253. }else /*if(arr_bool_QDH.length==1 && (temp_QDH=="上海-千岛湖" || temp_QDH=="千岛湖-上海" || temp_QDH=="上海市-千岛湖" || temp_QDH=="千岛湖-上海市"))*/{
  254. $('#update_car_no').removeClass('update_car_no');
  255. $('#update_car_no').attr('data-statu','true');
  256. }/*else{
  257. $('#update_car_no').addClass('update_car_no');
  258. $('#update_car_no').attr('data-statu','false');
  259. }*/
  260. if(arr_bool_statu.indexOf('false')!=-1){
  261. $('#five_del').addClass('del');
  262. $('#five_del').attr('data-statu','false');
  263. }else if(arr_bool_statu.indexOf('true')!=-1){
  264. $('#five_del').removeClass('del');
  265. $('#five_del').attr('data-statu','true');
  266. }else{
  267. $('#five_del').addClass('del');
  268. $('#five_del').attr('data-statu','false');
  269. }
  270. }
  271. //
  272. //结束日期value改变的时候触发
  273. $(document).ready(function() {
  274. var date = new Date();
  275. $('#id-date-picker-2').val(getDateTime(9));
  276. $('#id-date-picker-1').change(function() {
  277. //开始日期
  278. var start_date = $('#id-date-picker-1').val();
  279. if (start_date.trim().length <= 0) {
  280. swal(
  281. '操作失败',
  282. '请选择开始日期',
  283. 'error'
  284. );
  285. return;
  286. }
  287. //结束日期
  288. var end_date = $('#id-date-picker-2').val();
  289. if (end_date.trim().length < 0) {
  290. swal(
  291. '操作失败',
  292. '请选择结束日期',
  293. 'error'
  294. );
  295. return;
  296. }
  297. // 判断日期是否合理
  298. var date1 = new Date(start_date.replace(/\-/g, '/'));
  299. var date2 = new Date(end_date.replace(/\-/g, '/'));
  300. if (date1>date2 || end_date=="") {
  301. $('#id-date-picker-2').val(start_date);
  302. }
  303. });
  304. $('#id-date-picker-2').change(function() {
  305. //开始日期
  306. var start_date = $('#id-date-picker-1').val();
  307. if (start_date.trim().length <= 0) {
  308. swal(
  309. '操作失败',
  310. '请选择开始日期',
  311. 'error'
  312. );
  313. return;
  314. }
  315. //结束日期
  316. var end_date = $('#id-date-picker-2').val();
  317. if (end_date.trim().length < 0) {
  318. swal(
  319. '操作失败',
  320. '请选择结束日期',
  321. 'error'
  322. );
  323. return;
  324. }
  325. // 判断日期是否合理
  326. var date1 = new Date(start_date.replace(/\-/g, '/'));
  327. var date2 = new Date(end_date.replace(/\-/g, '/'));
  328. if (date2 < date1) {
  329. swal(
  330. '操作失败',
  331. '结束日期必须大于开始日期',
  332. 'error'
  333. );
  334. $('#id-date-picker-2').val('');
  335. return;
  336. }
  337. });
  338. });
  339. //查询按钮click事件
  340. function click_search(){
  341. $('#update_car_no').addClass('update_car_no');
  342. $('#update_car_no').attr('data-statu','false');
  343. $('#five_del').addClass('del');
  344. $('#five_del').attr('data-statu','false');
  345. $('.ace')[0].checked=false;
  346. cur_sel_bus_group=$('#bus_group').val();
  347. //班次时间
  348. var hour = $(".hour").val();
  349. var minute = $(".minute").val();
  350. //出发地
  351. var start_area = $('#start_area').val();
  352. //目的地
  353. var end_area = $('#end_area').val();
  354. //线路
  355. var line = $('#prod').val();
  356. //开始日期
  357. var start_date = $('#id-date-picker-1').val();
  358. if (start_date.trim().length <= 0) {
  359. swal(
  360. '操作失败',
  361. '请选择开始日期',
  362. 'error'
  363. );
  364. return;
  365. }
  366. //结束日期
  367. var end_date = $('#id-date-picker-2').val();
  368. if (end_date.trim().length <= 0) {
  369. swal(
  370. '操作失败',
  371. '请选择结束日期',
  372. 'error'
  373. );
  374. return;
  375. }
  376. // 判断日期是否合理
  377. var date1 = new Date(start_date.replace(/\-/g, '/'));
  378. var date2 = new Date(end_date.replace(/\-/g, '/'));
  379. if (date2 < date1) {
  380. swal(
  381. '操作失败',
  382. '结束日期必须大于开始日期',
  383. 'error'
  384. );
  385. return;
  386. }
  387. //运营状态
  388. var select_status = $("#select_status").val();
  389. if(page_status == 1){
  390. var currpage=getPar('currpage');
  391. }else{
  392. var currpage=1;
  393. }
  394. if (!currpage) {
  395. currpage = '1'
  396. }
  397. //车辆类型
  398. var bus_type = $("#bus_type").val();
  399. var bus_group = $('#bus_group').val();
  400. var tnowtime = getDateTime(4);
  401. var myURL = "./st-xm/Api/runInfoControll.php?method=getRunList&currpage=1&page_size=" + page_size + "&start_area=" + start_area + "&end_area=" + end_area + "&line=" + line + "&start_date=" + start_date + "&end_date=" + end_date + "&run_status=" + select_status + "&bus_type=" + bus_type+"&bus_group="+bus_group+"&hour="+hour+"&minute="+minute;
  402. var myURL2 = "./carList.html?method=getRunList&page_size=" + page_size + "&start_area=" + start_area + "&end_area=" + end_area + "&line=" + line + "&start_date=" + start_date + "&end_date=" + end_date + "&run_status=" + select_status + "&bus_type=" + bus_type+"&bus_group="+bus_group+"&hour="+hour+"&minute="+minute;
  403. cur_url=myURL2;
  404. ZZLog(myURL)
  405. get_virtual_user_list(myURL, myURL2);
  406. }
  407. //点击审核等按钮
  408. function click_five_btn(btn_value) {
  409. //先拿到run_id
  410. var arr_run_ids = new Array();
  411. var temp_run_id=0;
  412. var temp_run_date='';
  413. var temp_line='';
  414. var have_send_bus = false;
  415. $('.ace').each(function(index, item) {
  416. if (this.checked && index != 0) {
  417. var car_number=$(this).attr('data-carno');
  418. var run_id=$(this).attr('name');
  419. var cstr1="{"+run_id+","+car_number+"}";
  420. arr_run_ids.push(cstr1);
  421. temp_line=$(this).attr('data_QDH');
  422. temp_run_id=$(this).attr('name');
  423. temp_run_date=$(this).attr('data-date');
  424. temp_send_bus_no = $(this).attr('data-sendbusno');
  425. if( temp_send_bus_no.length > 0 ) {
  426. have_send_bus = true;
  427. }
  428. }
  429. });
  430. if (arr_run_ids.length <= 0) {
  431. swal(
  432. '操作失败',
  433. '请勾选具体所需操作的车次',
  434. 'error'
  435. );
  436. return;
  437. }
  438. if( btn_value=="2" && have_send_bus == true ) {
  439. swal(
  440. '停运失败',
  441. '已派车的车次无法停运',
  442. 'error'
  443. );
  444. return;
  445. }
  446. if(btn_value=="update_car_no"){
  447. var statu=$('#update_car_no').attr('data-statu');
  448. if(statu=='true'){
  449. ZZLog('可用');
  450. var line=temp_line;
  451. var run_id=temp_run_id;
  452. var run_date=temp_run_date;
  453. var next_url="update_car_no.html?line="+line+"&run_id="+run_id+"&start_date="+run_date;
  454. //window.open(next_url);
  455. $.cookie("path_url",cookie_path+next_url,{domain:domain_path});
  456. window.open(system_path);
  457. }else{
  458. ZZLog('不可用');
  459. }
  460. }else{
  461. if(btn_value=="4"){
  462. var va_4=$('#five_del').attr('data-statu');
  463. if(va_4!="true"){
  464. swal(
  465. '删除失败',
  466. '只有待审核的车次才可删除',
  467. 'error'
  468. );
  469. return;
  470. }
  471. }
  472. var run_id_str = arr_run_ids.join(',');
  473. ZZLog("/st-xm/Api/run_status_update.php?allrunid=" + run_id_str + "&status=" + btn_value);
  474. $.getJSON("/st-xm/Api/run_status_update.php?allrunid=" + run_id_str + "&status=" + btn_value, function(data) {
  475. ZZLog(data);
  476. if (data.errcode == 0) {
  477. swal({
  478. title: '操作成功',
  479. type: 'success',
  480. timer: 20000,
  481. confirmButtonText: 'OK'
  482. }).then(
  483. function () { location.replace(cur_url); },
  484. // handling the promise rejection
  485. function (dismiss) {
  486. location.replace(cur_url);
  487. }
  488. )
  489. } else {
  490. swal(
  491. '操作失败',
  492. data.errinfo,
  493. 'error'
  494. );
  495. }
  496. })
  497. }
  498. }
  499. function getPar(par) {
  500. //获取当前URL
  501. var local_url = document.location.href;
  502. local_url = decodeURI(local_url);
  503. //获取要取得的get参数位置
  504. var get = local_url.indexOf(par + "=");
  505. if (get == -1) {
  506. return false;
  507. }
  508. //截取字符串
  509. var get_par = local_url.slice(par.length + get + 1);
  510. //判断截取后的字符串是否还有其他get参数
  511. var nextPar = get_par.indexOf("&");
  512. if (nextPar != -1) {
  513. get_par = get_par.slice(0, nextPar);
  514. }
  515. return get_par;
  516. }
  517. function open_addcartime(){
  518. $.cookie("path_url",cookie_path+"addcartime.html",{domain:domain_path});
  519. //window.open(system_path);
  520. window.location.href ="addcartime.html";
  521. }
  522. function getDateTime(nTypeFlag) {
  523. var tNowTime = new Date();
  524. var myYear = ';' + tNowTime.getFullYear() + ';';
  525. var myMonth = ';' + (tNowTime.getMonth() + 1 - 0) + ';';
  526. var myDay = ';' + tNowTime.getDate() + ';';
  527. var myHour = ';' + tNowTime.getHours() + ';';
  528. var myMinu = ';' + tNowTime.getMinutes() + ';';
  529. var mySecond = ';' + tNowTime.getSeconds() + ';';
  530. if(myMonth.length < 4) myMonth = '0' + myMonth;
  531. if(myDay.length < 4) myDay = '0' + myDay;
  532. if(myHour.length < 4) myHour = '0' + myHour;
  533. if(myMinu.length < 4) myMinu = '0' + myMinu;
  534. if(mySecond.length < 4) mySecond = '0' + mySecond;
  535. var cNewTimeStr;
  536. //alert(tNowTime);
  537. switch(nTypeFlag + 1 - 1) {
  538. case 0:
  539. cNewTimeStr = myYear + '-' + myMonth + '-' + myDay;
  540. break;
  541. case 1:
  542. cNewTimeStr = myYear + myMonth + myDay;
  543. break;
  544. case 2:
  545. cNewTimeStr = myHour + ':' + myMinu + ':' + mySecond;
  546. break;
  547. case 3:
  548. cNewTimeStr = myHour + myMinu + mySecond;
  549. break;
  550. case 4:
  551. cNewTimeStr = myYear + myMonth + myDay + myHour + myMinu + mySecond;
  552. break;
  553. case 5:
  554. cNewTimeStr = myYear + '年' + myMonth + '月' + myDay + '日';
  555. break;
  556. case 6:
  557. cNewTimeStr = myYear;
  558. break;
  559. case 7:
  560. cNewTimeStr = myYear + '-' + myMonth;
  561. break;
  562. case 8: //得到上一个月的今天
  563. var date = getDateTime(0);
  564. var arr = date.split('-');
  565. var year = arr[0]; //获取当前日期的年份
  566. var month = arr[1]; //获取当前日期的月份
  567. var day = arr[2]; //获取当前日期的日
  568. var days = new Date(year, month, 0);
  569. days = days.getDate(); //获取当前日期中月的天数
  570. var year2 = year;
  571. var month2 = parseInt(month) - 1;
  572. if(month2 == 0) {
  573. year2 = parseInt(year2) - 1;
  574. month2 = 12;
  575. }
  576. var day2 = day;
  577. var days2 = new Date(year2, month2, 0);
  578. days2 = days2.getDate();
  579. if(day2 > days2) {
  580. day2 = days2;
  581. }
  582. if(month2 < 10) {
  583. month2 = '0' + month2;
  584. }
  585. cNewTimeStr = year2 + '-' + month2 + '-' + day2;
  586. break;
  587. case 9: //得到下一个月的今天
  588. var date = getDateTime(0);
  589. var arr = date.split('-');
  590. var year = arr[0]; //获取当前日期的年份
  591. var month = arr[1]; //获取当前日期的月份
  592. var day = arr[2]; //获取当前日期的日
  593. var days = new Date(year, month, 0);
  594. days = days.getDate(); //获取当前日期中的月的天数
  595. var year2 = year;
  596. var month2 = parseInt(month) + 1;
  597. if(month2 == 13) {
  598. year2 = parseInt(year2) + 1;
  599. month2 = 1;
  600. }
  601. var day2 = day;
  602. var days2 = new Date(year2, month2, 0);
  603. days2 = days2.getDate();
  604. if(day2 > days2) {
  605. day2 = days2;
  606. }
  607. if(month2 < 10) {
  608. month2 = '0' + month2;
  609. }
  610. var t2 = year2 + '-' + month2 + '-' + day2;
  611. return t2;
  612. break;
  613. case 10: //昨日日期
  614. var d=getDateTime(0);
  615. d = new Date(d);
  616. d = +d - 1000*60*60*24;
  617. d = new Date(d);
  618. //return d;
  619. //格式化
  620. var year = ";" + d.getFullYear() + ";";
  621. var month = ";" + (d.getMonth()+0+1) + ";";
  622. var day = ";" + d.getDate() + ";";
  623. if(year.length < 4) {
  624. year = "0" + year;
  625. }
  626. if(month.length < 4) {
  627. month = "0" + month;
  628. }
  629. if(day.length < 4) {
  630. day = "0" + day;
  631. }
  632. var datestr = year + "-" + month + "-" + day;
  633. datestr = datestr.replace(/;/g, "");
  634. return datestr;
  635. break;
  636. case 11: //明日日期
  637. var d=getDateTime(0);
  638. d = new Date(d);
  639. d = +d + 1000*60*60*24;
  640. d = new Date(d);
  641. //return d;
  642. //格式化
  643. var year = ";" + d.getFullYear() + ";";
  644. var month = ";" + (d.getMonth()+0+1) + ";";
  645. var day = ";" + d.getDate() + ";";
  646. if(year.length < 4) {
  647. year = "0" + year;
  648. }
  649. if(month.length < 4) {
  650. month = "0" + month;
  651. }
  652. if(day.length < 4) {
  653. day = "0" + day;
  654. }
  655. var datestr = year + "-" + month + "-" + day;
  656. datestr = datestr.replace(/;/g, "");
  657. return datestr;
  658. break;
  659. default:
  660. cNewTimeStr = myYear + '-' + myMonth + '-' + myDay + ' ' + myHour + ':' + myMinu + ':' + mySecond;
  661. break;
  662. }
  663. cNewTimeStr = cNewTimeStr.replace(/;/g, "");
  664. return cNewTimeStr;
  665. }
  666. function resetToBegin(obj) {
  667. if ($(obj).val()=='-1'){
  668. $(".hour").val(-1);
  669. $(".minute").val(-1);
  670. }
  671. }
  672. //add by qiusong on 2017.10.26
  673. function disp_run_bus_passenger( run_id, bus_order_id ) {
  674. $.ajax({
  675. url: './st-xm/Api/run_bus_passengers_static.php',
  676. type: "post",
  677. data: {
  678. run_id: run_id,
  679. bus_order_id: bus_order_id
  680. },
  681. dataType: "json",
  682. success: function (data) {
  683. if (data.code == 0) {
  684. var disp_table_html = '<table border="1"><tr><td >站点</td><td>上车</td><td>下车</td></tr>';
  685. for(var i = 0; i < data.data.length; i++) {
  686. disp_table_html += '<tr><td style="text-align: left;">' + data.data[i].RES_NAME + '</td><td>' + data.data[i].up_num + '</td><td>' + data.data[i].down_num + '</td></tr>';
  687. }
  688. disp_table_html += '</table>';
  689. swal({
  690. title: '上下车信息',
  691. type: 'info',
  692. html: disp_table_html,
  693. showCloseButton: true
  694. });
  695. return;
  696. } else {
  697. swal(
  698. '获取信息失败',
  699. data.info,
  700. 'error'
  701. );
  702. return;
  703. }
  704. },
  705. fail: function (data) {
  706. swal(
  707. '获取信息失败',
  708. data.info,
  709. 'error'
  710. );
  711. return;
  712. }
  713. });
  714. }