withdrawal.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <?php
  2. session_start();
  3. if (isset($_SESSION["account"])) {
  4. ?>
  5. <?php require_once('common/header.php'); ?>
  6. <?php require_once('common/sidebar.php'); ?>
  7. <div class="main-content app-content mt-0">
  8. <div class="side-app">
  9. <!--占位-->
  10. <div class="card"> </div>
  11. <!--占位-->
  12. <!--这里开始查询代理的账户信息-->
  13. <?php
  14. include_once("../untils/conn.php");
  15. mysqli_query($con, "set names utf8");
  16. // 获取当前正在登录的账号信息的代理
  17. $proxy_acc = mysqli_real_escape_string($con, $_SESSION["account"]);
  18. $sql = "SELECT * FROM proxy WHERE proxy_acc = ?";
  19. $stmt = mysqli_prepare($con, $sql);
  20. mysqli_stmt_bind_param($stmt, "s", $proxy_acc);
  21. mysqli_stmt_execute($stmt);
  22. $result = mysqli_stmt_get_result($stmt);
  23. if (mysqli_num_rows($result) > 0) {
  24. // 获取相应数据
  25. $row = mysqli_fetch_assoc($result);
  26. // 余额
  27. $proxy_balance = $row["proxy_balance"];
  28. // 支付宝信息
  29. $proxy_alipay = $row["proxy_alipay"];
  30. $proxy_alipay_acc = $row["proxy_alipay_acc"];
  31. // 银行信息
  32. $proxy_yihname = $row["proxy_yihname"];
  33. $proxy_yhnum = $row["proxy_yhnum"];
  34. $proxy_bank_name = $row["proxy_bank_name"];
  35. $proxy_bank_zh = $row["proxy_bank_zh"];
  36. }
  37. ?>
  38. <!--这里结束查询-->
  39. <!-- CONTAINER -->
  40. <div class="main-container container-fluid">
  41. <!-- PAGE-HEADER -->
  42. <div class="row row-sm">
  43. <div class="col-lg-12">
  44. <div class="card">
  45. <div class="card-header">
  46. <button type="button" class="btn btn btn-info me-3 mt-2" data-bs-toggle="modal" data-bs-target="#input-modal" data-bs-whatever="@mdo">申请提现</button>
  47. <h3 class="card-title">提现记录</h3>
  48. </div>
  49. <div class="card-body">
  50. <div class="table-responsive">
  51. <table class="table table-bordered text-nowrap border-bottom" id="responsive-datatable">
  52. <thead>
  53. <tr>
  54. <th class="wd-10p border-bottom-0">提现账号</th>
  55. <th class="wd-10p border-bottom-0">姓名</th>
  56. <th class="wd-10p border-bottom-0">账号</th>
  57. <th class="wd-10p border-bottom-0">银行名称</th>
  58. <th class="wd-10p border-bottom-0">银行支行</th>
  59. <th class="wd-10p border-bottom-0">提现金额</th>
  60. <th class="wd-10p border-bottom-0">打款金额</th>
  61. <th class="wd-10p border-bottom-0">提现方式</th>
  62. <th class="wd-10p border-bottom-0">提现状态</th>
  63. <th class="wd-10p border-bottom-0">申请时间</th>
  64. <th class="wd-10p border-bottom-0">处理时间</th>
  65. <th class="wd-10p border-bottom-0">备注</th>
  66. </tr>
  67. </thead>
  68. <tbody id="txdata">
  69. </tbody>
  70. </table>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. <!-- CONTAINER CLOSED -->
  78. </div>
  79. </div>
  80. <!-- Inout modal -->
  81. <div class="modal fade" id="input-modal">
  82. <div class="modal-dialog" role="document">
  83. <div class="modal-content modal-content-demo">
  84. <div class="modal-header">
  85. <h6 class="modal-title">申请提现</h6>
  86. <button class="btn-close" data-bs-dismiss="modal" aria-label="Close">
  87. <span aria-hidden="true">×</span>
  88. </button>
  89. </div>
  90. <div class="modal-body">
  91. <form id="withdrawal-form" method="post" action="controller/Dowith.php">
  92. <div class="mb-3">
  93. <label for="recipient-name" class="col-form-label">提现金额:<p style="color:blue">可提现余额:<?php echo $proxy_balance ?></p></label>
  94. <input type="text" class="form-control" id="recipient-name" name="tx_price" value="0.00" onblur="checkWithdrawalAmount()">
  95. </div>
  96. <div class="mb-3">
  97. <label for="recipient-name" class="col-form-label">提现方式:<p style="color:red">企业请使用对公账号,否则审核不通过</p></label>
  98. <select class="form-control" id="tx_type" name="tx_type" size="1" onchange="changeWithdrawalType()">
  99. <!--<option value="0">微信</option>-->
  100. <option value="1">支付宝</option>
  101. <option value="2">银行账号</option>
  102. </select>
  103. </div>
  104. <div id="alipay-info" style="display:none;">
  105. <div class="mb-3">
  106. <label for="alipay-name" class="col-form-label">支付宝姓名:</label>
  107. <input type="text" class="form-control" id="alipay-name" name="alipay_name" value="<?php echo $proxy_alipay ?>">
  108. </div>
  109. <div class="mb-3">
  110. <label for="alipay-account" class="col-form-label">支付宝账号:</label>
  111. <input type="text" class="form-control" id="alipay-account" name="alipay_account" value="<?php echo $proxy_alipay_acc ?>">
  112. </div>
  113. </div>
  114. <div id="bank-info" style="display:none;">
  115. <div class="mb-3">
  116. <label for="bank-name" class="col-form-label">姓名:</label>
  117. <input type="text" class="form-control" id="tx_name" name="tx_name" value="<?php echo $proxy_yihname ?>">
  118. </div>
  119. <div class="mb-3">
  120. <label for="bank-account" class="col-form-label">银行账号:</label>
  121. <input type="text" class="form-control" id="tx_acc" name="tx_acc" value="<?php echo $proxy_yhnum ?>">
  122. </div>
  123. <div class="mb-3">
  124. <label for="bank-account" class="col-form-label">银行名称:</label>
  125. <input type="text" class="form-control" id="bank_name" name="bank_name" value="<?php echo $proxy_bank_name ?>">
  126. </div>
  127. <div class="mb-3">
  128. <label for="bank-branch" class="col-form-label">开户行支行名称:</label>
  129. <input type="text" class="form-control" id="bank-branch" name="bank_branch" value="<?php echo $proxy_bank_zh ?>">
  130. </div>
  131. </div>
  132. <!--时间戳-->
  133. <input type="hidden" name="cr_time" value="<?php echo time(); ?>">
  134. <!--提现人账号-->
  135. <input type="hidden" name="proxy_acc" value="<?php echo $proxy_acc ?>">
  136. </form>
  137. </div>
  138. <div class="modal-footer">
  139. <button class="btn ripple btn-success" type="submit" form="withdrawal-form">提交申请</button>
  140. <button class="btn ripple btn-danger" data-bs-dismiss="modal" type="button">取消</button>
  141. </div>
  142. </div>
  143. </div>
  144. </div>
  145. <?php
  146. session_start();
  147. include_once("../untils/conn.php");
  148. mysqli_query($con, "set names utf8");
  149. // 获取当前正在登录的账号信息的代理
  150. $proxy_acc = $_SESSION["account"];
  151. // 查询proxy表中的数据
  152. $query = "SELECT proxy_rename_sta FROM proxy WHERE proxy_acc = '$proxy_acc'";
  153. $result = mysqli_query($con, $query);
  154. $row = mysqli_fetch_assoc($result);
  155. if ($row) {
  156. $proxy_rename_sta = $row['proxy_rename_sta'];
  157. ?>
  158. <div class="modal fade" id="modaldemo5" data-bs-backdrop="static" data-bs-keyboard="false">
  159. <div class="modal-dialog modal-dialog-centered text-center" role="document">
  160. <div class="modal-content tx-size-sm">
  161. <div class="modal-body text-center p-4 pb-5">
  162. <i class="icon icon-close fs-70 text-danger lh-1 my-5 d-inline-block"></i>
  163. <h4 class="text-danger">警告: 您的账号未实名!</h4>
  164. <p class="mg-b-20 mg-x-20">平台要求所有代理商必须实名!否则无法使用平台功能!</p>
  165. <a href="profile.php" class="btn btn-primary pd-x-25">去实名</a>
  166. </div>
  167. </div>
  168. </div>
  169. </div>
  170. <!--/div-->
  171. <script src="assets/js/jquery.min.js"></script>
  172. <script>
  173. $(document).ready(function() {
  174. // 发起 Ajax 请求
  175. $.ajax({
  176. url: "controller/Withdrawal.php",
  177. type: "GET",
  178. dataType: "json",
  179. success: function(data) {
  180. // 渲染数据到表格中
  181. var html = "";
  182. $.each(data, function(index, item) {
  183. html += "<tr>";
  184. html += "<td>" + item.proxy_acc + "</td>";
  185. html += "<td>" + item.tx_name + "</td>";
  186. html += "<td>" + item.tx_acc + "</td>";
  187. html += "<td>" + item.tx_bank_name + "</td>";
  188. html += "<td>" + item.tx_bank_zh + "</td>";
  189. html += "<td>" + (item.tx_price ? "¥" + item.tx_price : "无") + "</td>";
  190. html += "<td>" + (item.dk_price ? "¥" + item.dk_price : "无") + "</td>";
  191. html += "<td>" + (item.tx_type == 0 ? "微信" : item.tx_type == 1 ? "支付宝" : item.tx_type == 2 ? "银行卡" : "无") + "</td>";
  192. html += "<td>" + (item.state == 0 ? "待审核" : item.state == 1 ? "已打款" : item.state == 2 ? "审核失败" : "无") + "</td>";
  193. html += "<td>" + item.cr_time + "</td>";
  194. html += "<td>" + item.cl_time + "</td>";
  195. html += "<td>" + (item.notes ? item.notes : "无") + "</td>";
  196. html += "</tr>";
  197. });
  198. $("#txdata").html(html);
  199. },
  200. error: function(xhr, status, error) {
  201. console.log("Error: " + error);
  202. }
  203. });
  204. });
  205. function checkWithdrawalAmount() {
  206. var inputElement = document.getElementById("recipient-name");
  207. var inputValue = parseFloat(inputElement.value);
  208. var balance = parseFloat("<?php echo $proxy_balance ?>");
  209. if (inputValue > balance) {
  210. inputElement.value = "0.00";
  211. }
  212. }
  213. function changeWithdrawalType() {
  214. var txType = document.getElementById("tx_type").value;
  215. var alipayInfo = document.getElementById("alipay-info");
  216. var bankInfo = document.getElementById("bank-info");
  217. if (txType == "1") {
  218. alipayInfo.style.display = "block";
  219. bankInfo.style.display = "none";
  220. } else if (txType == "2") {
  221. alipayInfo.style.display = "none";
  222. bankInfo.style.display = "block";
  223. } else {
  224. alipayInfo.style.display = "none";
  225. bankInfo.style.display = "none";
  226. }
  227. }
  228. </script>
  229. <script>
  230. $(document).ready(function() {
  231. <?php
  232. if ($proxy_rename_sta == 0) {
  233. // 未实名认证
  234. echo '$("#modaldemo5").modal("show");';
  235. echo '$("#modaldemo5").modal({backdrop: "static", keyboard: false});';
  236. } elseif ($proxy_rename_sta == 1) {
  237. // 已实名认证
  238. echo '$("#modaldemo5").modal("hide");';
  239. }
  240. ?>
  241. });
  242. </script>
  243. <?php
  244. } else {
  245. // 未找到相关数据
  246. // echo '数据不存在';
  247. }
  248. ?>
  249. <!-- End Datepicker modal -->
  250. <?php require_once('common/footer.php'); ?>
  251. <?php
  252. } else {
  253. echo "<script>alert('登录过过期,没有权限访问该页面');location.href='login.html';</script>";
  254. }
  255. ?>