channeloder.php 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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. <div class="toolbar-btn-action">
  14. <a class="btn btn-primary m-r-5" href="#"><i class="mdi mdi-plus"></i>导出订单</a>
  15. <a class="btn btn-info m-r-5" href="#"><i class="mdi mdi-poll"></i>打印订单</a>
  16. </div>
  17. </div>
  18. <div class="card-body">
  19. <div class="table-responsive">
  20. <form name="form1" id="form1" method="post" action="controller/deleteall.php">
  21. <table class="table table-bordered">
  22. <?php
  23. include_once("../untils/conn.php");
  24. mysqli_query($con, "set names utf8");
  25. if ($con) {
  26. if ($db) {
  27. //获取数据总行数
  28. $channel_id = $_GET['channel_id'];
  29. $sql = "select * from oder WHERE channel = '$channel_id'";
  30. $data = mysqli_query($con, $sql);
  31. $maxrows = mysqli_num_rows($data);
  32. //计算总页数
  33. $page_size = 10; //每页显示数
  34. if ($maxrows % $page_size == 0) {
  35. $maxpage = (int)($maxrows / $page_size);
  36. } else {
  37. $maxpage = (int)($maxrows / $page_size) + 1;
  38. }
  39. //获取当前页
  40. if (isset($_GET['curpage'])) {
  41. $page = $_GET['curpage'];
  42. } else {
  43. $page = 1;
  44. }
  45. //分段取出数据
  46. $start = $page_size * ($page - 1);
  47. $get_sql = "select * from oder WHERE channel = '$channel_id' limit $start,$page_size";
  48. //得到数据显示
  49. $data = mysqli_query($con, $get_sql);
  50. // $timestamp= $row["time"];
  51. // $time = date('Y-m-d H:i:s', $timestamp);
  52. ?>
  53. <thead>
  54. <tr>
  55. <th>订单ID</th>
  56. <th>商品名称</th>
  57. <th>姓名</th>
  58. <th>身份证号</th>
  59. <th>手机号码</th>
  60. <th>省份</th>
  61. <th>城市</th>
  62. <th>县区</th>
  63. <th>详细地址</th>
  64. <th>处理状态</th>
  65. <th>备注</th>
  66. <th>下单时间</th>
  67. <th>操作</th>
  68. </tr>
  69. </thead>
  70. <tbody>
  71. <?php
  72. while ($row = mysqli_fetch_array($data)) {
  73. ?>
  74. <tr>
  75. <td style="width:5%;">
  76. <?php echo $row["id"] ?>
  77. </td>
  78. <td style="width:10%;"><?php echo $row["goods"] ?>
  79. </td>
  80. <td style="width:10%;"><?php echo $row["name"] ?>
  81. </td>
  82. <td style="width:10%;"><?php echo $row["uid"] ?>
  83. </td>
  84. <td style="width:10%;"><?php echo $row["phone"] ?>
  85. </td>
  86. <td style="width:10%;"><?php echo $row["sf"] ?>
  87. </td>
  88. <td style="width:10%;"><?php echo $row["city"] ?>
  89. </td>
  90. <td style="width:7.5%;"><?php echo $row["xian"] ?>
  91. </td>
  92. <td style="width:7.5%;"><?php echo $row["dizhi"] ?>
  93. </td>
  94. <td style="width:7.5%;">
  95. <?php
  96. switch ($row["status"]) {
  97. case 0:
  98. echo "未处理";
  99. break;
  100. case 1:
  101. echo "已下单";
  102. break;
  103. case 2:
  104. echo "已发货";
  105. break;
  106. case 3:
  107. echo "开卡失败";
  108. break;
  109. default:
  110. echo "未知状态";
  111. break;
  112. }
  113. ?>
  114. </td>
  115. <td style="width:7.5%;"><?php echo $row["beizhu"] ?>
  116. </td>
  117. <td style="width:7.5%;">
  118. <?php
  119. $timestamp= $row["time"] ;
  120. $date = date('Y-m-d H:i:s', $timestamp);
  121. echo $date; // 输出:2021-07-22 16:52:07
  122. ?>
  123. </td>
  124. <td style="width:15%;">
  125. <a href=updatesta.php?id=<?php echo $row['id'] ?> class="btn btn-danger btn-sm">处理</a>
  126. <a href="postapi.php?id=<?php echo $row['id'] ?>" class="btn btn-success btn-sm">提审</a>
  127. </td>
  128. <!-- 上下架按钮
  129. <td>
  130. <div class="custom-control custom-switch">
  131. <input type="checkbox" class="custom-control-input" value="1">
  132. <label class="custom-control-label"></label>
  133. </div>
  134. </td> -->
  135. </tr>
  136. <?php
  137. }
  138. ?>
  139. </tbody>
  140. <tfoot>
  141. <tr>
  142. <td colspan="12" style="text-align: right;">
  143. <?php
  144. echo "<p>共 $maxpage 页&nbsp;&nbsp;";
  145. echo "每页 $page_size 项&nbsp;&nbsp;";
  146. //设置上一页
  147. if ($page > 1) {
  148. $prepage = $page - 1;
  149. echo "<a href='?curpage=$prepage'>上一页</a>&nbsp;&nbsp;";
  150. }
  151. //设置下一页
  152. if ($page < $maxpage) {
  153. $nextpage = $page + 1;
  154. echo "<a href='?curpage=$nextpage'>下一页</a>&nbsp;&nbsp;";
  155. }
  156. echo "&nbsp;&nbsp;第 $page 页</p>";
  157. }
  158. }
  159. ?>
  160. </td>
  161. </tr>
  162. </tfoot>
  163. </table>
  164. </form>
  165. </div>
  166. </div>
  167. </div>
  168. </div>
  169. </div>
  170. </div>
  171. </div>
  172. <script>
  173. $(document).ready(function(){
  174. $('.update-btn').click(function(e){
  175. e.preventDefault();
  176. var id = $(this).data('id');
  177. $.ajax({
  178. url: 'updatesta.php',
  179. type: 'GET',
  180. data: {id: id},
  181. success: function(data){
  182. alert('状态处理成功!');
  183. },
  184. error: function(jqXHR, textStatus, errorThrown){
  185. console.log(textStatus);
  186. }
  187. });
  188. });
  189. });
  190. </script>
  191. </main>
  192. <!--End 页面主要内容-->
  193. <?php require_once('common/footer.php'); ?>
  194. <?php
  195. } else {
  196. echo "<script>alert('您尚未登录,没有权限访问该页面');location.href='login.php';</script>";
  197. }