oderlist.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <?php
  2. session_start();
  3. if (isset($_SESSION["username"])) {
  4. ?>
  5. <?php require_once('common/header.php'); ?>
  6. <!--页面主要内容-->
  7. <main class="lyear-layout-content">
  8. <div class="container-fluid">
  9. <div class="row">
  10. <div class="col-lg-12">
  11. <div class="card">
  12. <div class="card-toolbar clearfix">
  13. <form class="pull-right search-bar" method="get" action="" role="form">
  14. <div class="input-group">
  15. <div class="input-group-btn">
  16. <input type="hidden" name="search" id="search" value="name">
  17. <button class="btn btn-default dropdown-toggle" id="search-btn" data-toggle="dropdown" type="button" aria-haspopup="true" aria-expanded="false">
  18. 姓名查询 <span class="caret"></span>
  19. </button>
  20. <ul class="dropdown-menu">
  21. <!--<li> <a tabindex="-1" href="javascript:void(0)" data-field="title">渠道来源</a> </li>-->
  22. <li> <a tabindex="-1" href="javascript:void(0)" data-field="name">姓名查询</a> </li>
  23. <li> <a tabindex="-1" href="javascript:void(0)" data-field="phone">收货人号码</a> </li>
  24. <li> <a tabindex="-1" href="javascript:void(0)" data-field="order_id">订单号查询</a> </li>
  25. <li> <a tabindex="-1" href="javascript:void(0)" data-field="goods">商品名称查询</a> </li>
  26. </ul>
  27. </div>
  28. <input type="text" class="form-control" value="" name="keyword" placeholder="请输入查询信息">
  29. </div>
  30. </form>
  31. <div class="toolbar-btn-action">
  32. <a class="btn btn-primary m-r-5" href="PHPexcel.php"><i class="mdi mdi-plus"></i>导出订单</a>
  33. <!--<a class="btn btn-info m-r-5" href="#"><i class="mdi mdi-poll"></i>打印订单</a>-->
  34. <a class="btn btn-info m-r-5" href="controller/GteApista.php"><i class="mdi mdi-cube-outline"></i>同步订单状态</a>
  35. </div>
  36. </div>
  37. <div class="card-body">
  38. <div class="table-responsive">
  39. <form name="form1" id="form1" method="post" action="controller/deleteall.php">
  40. <table class="table table-bordered">
  41. <?php
  42. include_once("../untils/conn.php");
  43. mysqli_query($con, "set names utf8");
  44. if ($con) {
  45. if ($db) {
  46. //获取数据总行数
  47. $sql = "SELECT oder.id,oder.oderid, oder.channel, oder.goods, oder.proxy_id, oder.name, oder.uid, oder.phone, oder.sf, oder.city, oder.xian, oder.dizhi, oder.status, oder.beizhu, oder.time, oder.card_sta, channel.channel_name
  48. FROM oder
  49. LEFT JOIN channel
  50. ON oder.channel = channel.channel_id";
  51. // 根据查询方式和查询信息筛选订单数据
  52. if (isset($_GET['search']) && isset($_GET['keyword'])) {
  53. $search = $_GET['search'];
  54. $keyword = $_GET['keyword'];
  55. if ($search == 'name') {
  56. $sql .= " WHERE oder.name LIKE '%$keyword%'";
  57. } elseif ($search == 'phone') {
  58. $sql .= " WHERE oder.phone LIKE '%$keyword%'";
  59. } elseif ($search == 'order_id') {
  60. $sql .= " WHERE oder.oderid LIKE '%$keyword%'";
  61. }elseif ($search == 'goods') {
  62. $sql .= " WHERE oder.goods LIKE '%$keyword%'";
  63. }
  64. }
  65. $sql .= " ORDER BY oder.id DESC";
  66. $data = mysqli_query($con, $sql);
  67. $maxrows = mysqli_num_rows($data);
  68. //计算总页数
  69. $page_size = 10; //每页显示数
  70. if ($maxrows % $page_size == 0) {
  71. $maxpage = (int)($maxrows / $page_size);
  72. } else {
  73. $maxpage = (int)($maxrows / $page_size) + 1;
  74. }
  75. //获取当前页
  76. if (isset($_GET['curpage'])) {
  77. $page = $_GET['curpage'];
  78. } else {
  79. $page = 1;
  80. }
  81. //分段取出数据
  82. $start = $page_size * ($page - 1);
  83. $get_sql = $sql . " LIMIT $start,$page_size";
  84. //得到数据显示
  85. $data = mysqli_query($con, $get_sql);
  86. ?>
  87. <thead>
  88. <tr>
  89. <th>订单ID</th>
  90. <th>订单号</th>
  91. <th>订单来源</th>
  92. <th>商品名称</th>
  93. <th>姓名</th>
  94. <th>身份证号</th>
  95. <th>手机号码</th>
  96. <th>省份</th>
  97. <th>城市</th>
  98. <th>县区</th>
  99. <th>详细地址</th>
  100. <th>处理状态</th>
  101. <th>号码状态</th>
  102. <th>备注</th>
  103. <th>下单时间</th>
  104. <th>操作</th>
  105. </tr>
  106. </thead>
  107. <tbody>
  108. <?php
  109. while ($row = mysqli_fetch_array($data)) {
  110. ?>
  111. <tr>
  112. <td style="width:5%;">
  113. <?php echo $row["id"] ?>
  114. </td>
  115. <td style="width:5%;">
  116. <?php echo $row["oderid"] ?>
  117. </td>
  118. <td style="width:7%;">
  119. <?php
  120. if (isset($row["proxy_id"]) && $row["proxy_id"] != null) {
  121. echo "代理商:".$row["proxy_id"];
  122. } else {
  123. if ($row["channel_name"]) {
  124. echo $row["channel_name"];
  125. } else {
  126. if ($row["channel"] == null || $row["channel"] == 0) {
  127. echo "官方渠道";
  128. } else {
  129. echo $row["channel"];
  130. }
  131. }
  132. }
  133. ?>
  134. </td>
  135. <td style="width:7.5%;"><?php echo $row["goods"] ?>
  136. </td>
  137. <td style="width:5%;"><?php echo $row["name"] ?>
  138. </td>
  139. <td style="width:5%;"><?php echo $row["uid"] ?>
  140. </td>
  141. <td style="width:5%;"><?php echo $row["phone"] ?>
  142. </td>
  143. <td style="width:5%;"><?php echo $row["sf"] ?>
  144. </td>
  145. <td style="width:5%;"><?php echo $row["city"] ?>
  146. </td>
  147. <td style="width:7.5%;"><?php echo $row["xian"] ?>
  148. </td>
  149. <td style="width:7.5%;"><?php echo $row["dizhi"] ?>
  150. </td>
  151. <td style="width:7.5%;">
  152. <?php
  153. switch ($row["status"]) {
  154. case 0:
  155. echo "未处理";
  156. break;
  157. case 1:
  158. echo "已下单";
  159. break;
  160. case 2:
  161. echo "已发货";
  162. break;
  163. case 3:
  164. echo "已完成";
  165. break;
  166. default:
  167. echo "开卡失败";
  168. break;
  169. }
  170. ?>
  171. </td>
  172. <td style="width:7.5%;">
  173. <?php
  174. switch ($row["card_sta"]) {
  175. case 0:
  176. echo "未激活";
  177. break;
  178. case 1:
  179. echo "已激活";
  180. break;
  181. default:
  182. echo "未知状态";
  183. break;
  184. }
  185. ?>
  186. </td>
  187. <td style="width:7.5%;"><?php echo $row["beizhu"] ?>
  188. </td>
  189. <td style="width:10%;">
  190. <?php
  191. $date = date('Y-m-d H:i:s', $row["time"]);
  192. echo $date; // 输出:2021-07-22 16:52:07
  193. ?>
  194. </td>
  195. <td style="width:15%;">
  196. <a href=updatesta.php?id=<?php echo $row['id'] ?> class="btn btn-danger btn-sm">处理</a>
  197. <a href="postapi.php?id=<?php echo $row['id'] ?>" class="btn btn-success btn-sm">提审</a>
  198. </td>
  199. </tr>
  200. <?php
  201. }
  202. ?>
  203. </tbody>
  204. <tfoot>
  205. <tr>
  206. <td colspan="12" style="text-align: right;">
  207. <?php
  208. echo "<p>共 $maxpage 页&nbsp;&nbsp;";
  209. echo "每页 $page_size 项&nbsp;&nbsp;";
  210. //设置上一页
  211. if ($page > 1) {
  212. $prepage = $page - 1;
  213. echo "<a href='?curpage=$prepage'>上一页</a>&nbsp;&nbsp;";
  214. }
  215. //设置下一页
  216. if ($page < $maxpage) {
  217. $nextpage = $page + 1;
  218. echo "<a href='?curpage=$nextpage'>下一页</a>&nbsp;&nbsp;";
  219. }
  220. echo "&nbsp;&nbsp;第 $page 页</p>";
  221. }
  222. }
  223. ?>
  224. </td>
  225. </tr>
  226. </tfoot>
  227. </table>
  228. </form>
  229. </div>
  230. </div>
  231. </div>
  232. </div>
  233. </div>
  234. </div>
  235. </div>
  236. <script src="../merchant/assets/js/jquery.min.js"></script>
  237. <script>
  238. $(document).ready(function(){
  239. $('.update-btn').click(function(e){
  240. e.preventDefault();
  241. var id = $(this).data('id');
  242. $.ajax({
  243. url: 'updatesta.php',
  244. type: 'GET',
  245. data: {id: id},
  246. success: function(data){
  247. alert('状态处理成功!');
  248. },
  249. error: function(jqXHR, textStatus, errorThrown){
  250. console.log(textStatus);
  251. }
  252. });
  253. });
  254. });
  255. $(document).ready(function() {
  256. $('.dropdown-menu a').click(function(e) {
  257. e.preventDefault();
  258. var field = $(this).data('field');
  259. var buttonText = $(this).text();
  260. $('#search').val(field);
  261. $('#search-btn').html(buttonText + ' <span class="caret"></span>');
  262. });
  263. });
  264. </script>
  265. </main>
  266. <!--End 页面主要内容-->
  267. <?php require_once('common/footer.php'); ?>
  268. <?php
  269. } else {
  270. echo "<script>alert('您尚未登录,没有权限访问该页面');location.href='login.php';</script>";
  271. }