revenue.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  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="account">
  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="account">代理账号</a> </li>
  22. <li> <a tabindex="-1" href="javascript:void(0)" data-field="oderid">订单号</a> </li>
  23. </ul>
  24. </div>
  25. <input type="text" class="form-control" value="" name="keyword" placeholder="请输入查询信息">
  26. </div>
  27. </form>
  28. <div class="toolbar-btn-action">
  29. </div>
  30. </div>
  31. <div class="card-body">
  32. <div class="table-responsive">
  33. <form name="form1" id="form1" method="post" action="controller/deleteall.php">
  34. <table class="table table-bordered">
  35. <?php
  36. include_once("../untils/conn.php");
  37. mysqli_query($con, "set names utf8");
  38. if ($con) {
  39. if ($db) {
  40. // 获取搜索关键词和字段
  41. $keyword = $_GET['keyword'];
  42. $field = $_GET['search'];
  43. // 构建查询语句
  44. $sql = "SELECT * FROM revenue";
  45. if ($keyword != "") {
  46. $sql .= " WHERE $field LIKE '%$keyword%'";
  47. }
  48. // 获取数据总行数
  49. $data = mysqli_query($con, $sql);
  50. $maxrows = mysqli_num_rows($data);
  51. // 计算总页数
  52. $page_size = 10; // 每页显示数
  53. if ($maxrows % $page_size == 0) {
  54. $maxpage = (int)($maxrows / $page_size);
  55. } else {
  56. $maxpage = (int)($maxrows / $page_size) + 1;
  57. }
  58. // 获取当前页
  59. if (isset($_GET['curpage'])) {
  60. $page = $_GET['curpage'];
  61. } else {
  62. $page = 1;
  63. }
  64. // 分段取出数据
  65. $start = $page_size * ($page - 1);
  66. $get_sql = "$sql ORDER BY id DESC LIMIT $start, $page_size";
  67. // 获取数据显示
  68. $data = mysqli_query($con, $get_sql);
  69. ?>
  70. <thead>
  71. <tr>
  72. <th>ID</th>
  73. <th>账号</th>
  74. <th>订单号</th>
  75. <th>订单状态</th>
  76. <th>收件人</th>
  77. <th>类型</th>
  78. <th>金额</th>
  79. <th>状态</th>
  80. <th>备注说明</th>
  81. <th>创建时间</th>
  82. <th>到账时间</th>
  83. <th>资金说明</th>
  84. <th>操作</th>
  85. </tr>
  86. </thead>
  87. <tbody>
  88. <?php
  89. while ($row = mysqli_fetch_array($data)) {
  90. ?>
  91. <tr>
  92. <td style="width:3%;">
  93. <?php echo $row["id"] ?>
  94. </td>
  95. <td style="width:5%;">
  96. <?php echo $row["account"] ?>
  97. </td>
  98. <td style="width:5%;">
  99. <?php echo $row["oderid"] ?>
  100. </td>
  101. <td style="width:5%;">
  102. <?php
  103. switch ($row["oder_sta"]) {
  104. case 0:
  105. echo "待处理";
  106. break;
  107. case 1:
  108. echo "已下单";
  109. break;
  110. case 2:
  111. echo "已发货";
  112. break;
  113. case 3:
  114. echo "已完成";
  115. break;
  116. case 4:
  117. echo "开卡失败";
  118. break;
  119. default:
  120. echo "未知状态";
  121. }
  122. ?>
  123. </td>
  124. <td style="width:5%;">
  125. <?php echo $row["name"] ?>
  126. </td>
  127. <td style="width:5%;">
  128. <?php
  129. switch ($row["type"]) {
  130. case 0:
  131. echo "返佣";
  132. break;
  133. case 1:
  134. echo "扣费";
  135. break;
  136. default:
  137. echo "未知类型";
  138. }
  139. ?>
  140. </td>
  141. <td style="width:5%;">
  142. ¥<?php echo $row["price"] ?>
  143. </td>
  144. <td style="width:6.5%;">
  145. <?php
  146. switch ($row["state"]) {
  147. case 0:
  148. echo "待结算";
  149. break;
  150. case 1:
  151. echo "结算中";
  152. break;
  153. case 2:
  154. echo "结算完成";
  155. break;
  156. case 3:
  157. echo "已扣费";
  158. break;
  159. default:
  160. echo "未知状态";
  161. break;
  162. }
  163. ?>
  164. </td>
  165. <td style="width:10%;">
  166. <?php echo $row["beizhu"] ?>
  167. </td>
  168. <td style="width:6%;">
  169. <?php echo $date = date('Y-m-d H:i:s', $row["cr_time"]); ?>
  170. </td>
  171. <td style="width:6%;">
  172. <?php echo $date = date('Y-m-d H:i:s', $row["dz_time"]); ?>
  173. </td>
  174. <td style="width:6%;">
  175. <?php echo $row["fund_notes"] ?>
  176. </td>
  177. <td style="width:15%;">
  178. <?php if($row["oder_sta"] == 3) {
  179. switch($row["state"]) {
  180. case 0:
  181. echo '<a href="#" class="btn btn-success btn-sm" onclick="if(confirm(\'操作结算后不可撤回,请谨慎操作,确定要执行操作结算吗?\')){window.location.href=\'controller/Dorevenue.php?id=' . $row["id"] . '\';}">操作结算</a>';
  182. break;
  183. case 1:
  184. echo '<span class="btn btn-warning btn-sm">结算中</span>';
  185. break;
  186. case 2:
  187. echo '<span class="btn btn-info btn-sm">已结算</span>';
  188. break;
  189. case 3:
  190. echo '<span class="btn btn-info btn-sm">已扣费</span>';
  191. break;
  192. default:
  193. echo '<span class="btn btn-danger btn-sm">状态错误</span>';
  194. break;
  195. }
  196. } else {
  197. echo '<a href="#" class="btn btn-danger btn-sm">无需结算</a>';
  198. } ?>
  199. <a href="" class="btn btn-warning btn-sm">别点我</a>
  200. </td>
  201. </tr>
  202. <?php
  203. }
  204. ?>
  205. </tbody>
  206. <tfoot>
  207. <tr>
  208. <td colspan="12" style="text-align: right;">
  209. <?php
  210. echo "<p>共 $maxpage 页&nbsp;&nbsp;";
  211. echo "每页 $page_size 项&nbsp;&nbsp;";
  212. //设置上一页
  213. if ($page > 1) {
  214. $prepage = $page - 1;
  215. echo "<a href='?curpage=$prepage'>上一页</a>&nbsp;&nbsp;";
  216. }
  217. //设置下一页
  218. if ($page < $maxpage) {
  219. $nextpage = $page + 1;
  220. echo "<a href='?curpage=$nextpage'>下一页</a>&nbsp;&nbsp;";
  221. }
  222. echo "&nbsp;&nbsp;第 $page 页</p>";
  223. }
  224. }
  225. ?>
  226. </td>
  227. </tr>
  228. </tfoot>
  229. </table>
  230. </form>
  231. </div>
  232. </div>
  233. </div>
  234. </div>
  235. </div>
  236. </div>
  237. </div>
  238. </main>
  239. <script src="../merchant/assets/js/jquery.min.js"></script>
  240. <script>
  241. $(document).ready(function() {
  242. $('.dropdown-menu a').click(function(e) {
  243. e.preventDefault();
  244. var field = $(this).data('field');
  245. var buttonText = $(this).text();
  246. $('#search').val(field);
  247. $('#search-btn').html(buttonText + ' <span class="caret"></span>');
  248. });
  249. });
  250. </script>
  251. <!--End 页面主要内容-->
  252. <?php require_once('common/footer.php'); ?>
  253. <?php
  254. } else {
  255. echo "<script>alert('您尚未登录,没有权限访问该页面');location.href='login.php';</script>";
  256. }