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.
 
 
 
 

132 lines
5.3 KiB

  1. <?php
  2. /*
  3. Author:XM
  4. Compeny:Spiders Travel
  5. */
  6. require_once '../../Common/Mysql.php';
  7. if (ALLOW_ORIGIN)
  8. header("Access-Control-Allow-Origin:*");
  9. $order_id = isset($_POST['order_id'])?$_POST['order_id']:'';
  10. if(!$order_id){
  11. echo json_encode(array('code'=>'1','info'=>'订单号有误'));die;
  12. }
  13. $pdo=conn();
  14. $list = Find($order_id);
  15. if(!$list){
  16. echo json_encode(array('code'=>'1','info'=>'订单号有误'));die;
  17. }
  18. $sql = "SELECT SEND_BUS_NO,SEND_DRIVER_NAME,SEND_DRIVER_MOBILE FROM RUN_BUS WHERE CANCEL_FLAG=0 AND RUN_ID=" . $list["run_id"] . " AND BUS_ORDER_ID=" . $list["bus_order"];
  19. $pdo = conn();
  20. $result = $pdo -> query($sql);
  21. $rowset = $result -> fetchAll(PDO::FETCH_ASSOC);
  22. //var_dump($rowset);
  23. $order_bus_no = "暂未指派";
  24. //车牌号
  25. $order_driver_name = "暂未指派";
  26. //司机名称
  27. $driver_mobile ='暂未指派';
  28. if (!empty($rowset[0]["SEND_BUS_NO"])) {
  29. $driver_mobile = $rowset[0]['SEND_DRIVER_MOBILE'];
  30. $order_bus_no = $rowset[0]["SEND_BUS_NO"];
  31. $order_driver_name = $rowset[0]["SEND_DRIVER_NAME"];
  32. }
  33. $data =array();
  34. $data['line_name']=$list['line_name'];
  35. $data['start_station']=$list['start_station'];
  36. $data['start_res_name']=$list['start_res_name'];
  37. $data['end_station']=$list['end_station'];
  38. $data['end_res_name']=$list['end_res_name'];
  39. $data['run_time']=$list['run_time'];
  40. $data['bus_order']=$list['bus_order'];
  41. $data['CUSTOMER_NAME']=$list['CUSTOMER_NAME'];
  42. $data['CUSTOMER_MOBILE']=$list['CUSTOMER_MOBILE'];
  43. $data['bus_no']=$order_bus_no;
  44. $data['driver_name']=$order_driver_name;
  45. $data['driver_mobile']=$driver_mobile;
  46. $data['order_status']=$list['order_status'];
  47. $data['order_price']=$list['order_price'];
  48. $data['order_id']=$order_id;
  49. if($data['order_status'] == 145){
  50. $data['order_status_2']='待支付';
  51. }elseif($data['order_status'] == 146){
  52. $data['order_status_2']='已出票';
  53. }elseif($data['order_status'] == 147){
  54. $data['order_status_2']='已出行';
  55. }elseif($data['order_status'] == 148){
  56. $data['order_status_2']='已取消';
  57. }
  58. $data['time']=array(substr($list['create_time'],0,10),substr($list['create_time'],11,5),substr($list['pay_time'],0,10),substr($list['pay_time'],11,5),$list['run_date'],$list['run_time']);
  59. $data['tic_count']=$list['count'];
  60. echo json_encode(array('code'=>'0','data' =>$data));
  61. function Find($order_id){
  62. $pdo= conn1();
  63. $sql = "select order_description,order_price,order_pay_main_id "
  64. . "from order_main "
  65. . "where order_id=".$order_id;
  66. $result=$pdo->query($sql);
  67. if(!$result){
  68. return FALSE;
  69. }
  70. $rowset = $result -> fetchAll(PDO::FETCH_ASSOC);
  71. $order_price = $rowset[0];//订单总价格 订单票的数量
  72. $sql = "SELECT DISTINCT
  73. order_description,parent_order_id,create_time,order_pay_time,order_status,run_id,parent_prod_name,CUSTOMER_NAME,CUSTOMER_MOBILE,run_date,run_bus_order_id,run_time,PROD_START_STATION_AREA_NAME,PROD_START_STATION_RES_NAME,PROD_END_STATION_AREA_NAME,PROD_END_STATION_RES_NAME
  74. FROM `order_main`
  75. where PARENT_ORDER_ID=".$order_id;
  76. $result=$pdo->query($sql);
  77. $rowset = $result -> fetchAll(PDO::FETCH_ASSOC);
  78. $order_station = $rowset[0];//订单来往地址 订单时间 订单好
  79. if(empty($order_station))
  80. return false;
  81. $array_order_desc=array();
  82. $arr_temp = explode('|',$order_price['order_description']);
  83. $arr=array();
  84. foreach ($arr_temp as $k=>$v2) {
  85. if(!empty($v2))
  86. $array_order_desc[]= explode (',', $v2); //订单票 * 数量
  87. }
  88. $list = array();
  89. //上海(黄浦旅游集散站) - 乌镇(西栅1号停车场)//反的数组
  90. $list['station'] = $order_station['PROD_START_STATION_AREA_NAME'].'('.$order_station['PROD_START_STATION_RES_NAME'].')'
  91. .'-'.$order_station['PROD_END_STATION_AREA_NAME'].'('.$order_station['PROD_END_STATION_RES_NAME'].')';
  92. $list['start_station']=$order_station['PROD_START_STATION_AREA_NAME'];
  93. $list['end_station']=$order_station['PROD_END_STATION_AREA_NAME'];
  94. $list['start_res_name'] = $order_station['PROD_START_STATION_RES_NAME'];
  95. $list['end_res_name'] = $order_station['PROD_END_STATION_RES_NAME'];
  96. $list['run_date'] = $order_station['run_date'];
  97. $list['run_time'] = $order_station['run_time'];
  98. $list['count']='';
  99. $list['line_name'] = $order_station['parent_prod_name'];
  100. $list['bus_order'] = $order_station['run_bus_order_id'];
  101. $list['CUSTOMER_NAME'] = $order_station['CUSTOMER_NAME'];
  102. $list['CUSTOMER_MOBILE'] = $order_station['CUSTOMER_MOBILE'];
  103. $list['create_time'] = $order_station['create_time'];
  104. $list['pay_time'] = $order_station['order_pay_time'];
  105. foreach ($array_order_desc as $v){
  106. $list['count'] .= ' '.$v[0].' × '.$v[2];
  107. }
  108. $list['order_price'] = $order_price['order_price'];
  109. $sql = "select pay_serial_number from order_pay_detail where pay_main_id =".$order_price['order_pay_main_id'];
  110. $result=$pdo->query($sql);
  111. $rowset = $result -> fetchAll(PDO::FETCH_ASSOC);
  112. $list['pay_num'] = $rowset[0]['pay_serial_number'];
  113. $list['run_id'] =$order_station['run_id'];
  114. $list['order_status'] =$order_station['order_status'];
  115. return $list;
  116. }