profile.php 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  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. <!-- CONTAINER -->
  13. <div class="main-container container-fluid">
  14. <div class="row">
  15. <div class="col-sm-12 col-md-12">
  16. <?php
  17. session_start();
  18. include_once("../untils/conn.php");
  19. mysqli_query($con, "set names utf8");
  20. // 获取当前正在登录的账号信息的代理
  21. $proxy_acc = $_SESSION["account"];
  22. // 查询proxy表中的数据
  23. $query = "SELECT proxy_rename_sta FROM proxy WHERE proxy_acc = '$proxy_acc'";
  24. $result = mysqli_query($con, $query);
  25. $row = mysqli_fetch_assoc($result);
  26. if ($row) {
  27. $proxy_rename_sta = $row['proxy_rename_sta'];
  28. ?>
  29. <div class="panel-body tabs-menu-body p-0 border-0">
  30. <div class="tab-content">
  31. <div class="tab-pane active" id="tab5">
  32. <div class="card" style=" float: left;">
  33. <div class="card-body">
  34. <div class="mb-2 h4 text-dark " >
  35. 实名信息
  36. </div>
  37. <p>真实姓名:<t id="rename"></p>
  38. <p>手机号码:<t id="phone"></p>
  39. <p>身份证号:<t id="card_uid"></p>
  40. <?php
  41. if ($proxy_rename_sta == 0) {
  42. // 未实名认证
  43. echo '<button type="button" class="btn btn-secondary" data-bs-toggle="modal" data-bs-target="#rename-modal" data-bs-whatever="@mdo">实名认证</button>';
  44. } elseif ($proxy_rename_sta == 1) {
  45. // 已实名认证
  46. echo '<a href="" class="btn btn-secondary">已实名</a>';
  47. }
  48. ?>
  49. </div>
  50. <!-- Input modal -->
  51. <div class="modal fade" id="rename-modal">
  52. <div class="modal-dialog" role="document">
  53. <div class="modal-content modal-content-demo">
  54. <div class="modal-header">
  55. <h6 class="modal-title">实名认证</h6>
  56. <button class="btn-close" data-bs-dismiss="modal" aria-label="Close">
  57. <span aria-hidden="true">×</span>
  58. </button>
  59. </div>
  60. <div class="modal-body">
  61. <form>
  62. <div class="mb-3">
  63. <label for="proxy_rename" class="col-form-label">姓名:</label>
  64. <input type="text" class="form-control" id="proxy_rename" required>
  65. </div>
  66. <div class="mb-3">
  67. <label for="proxy_uid" class="col-form-label">身份证号:</label>
  68. <input type="text" class="form-control" id="proxy_uid" required>
  69. </div>
  70. <div class="mb-3">
  71. <label for="proxy_phone" class="col-form-label">手机号码:</label>
  72. <input type="text" class="form-control" id="proxy_phone" required>
  73. </div>
  74. <div class="mb-3">
  75. <label for="verification_code" class="col-form-label">验证码:</label>
  76. <input type="text" class="form-control" id="verification_code" required>
  77. </div>
  78. <div class="mb-3">
  79. <button class="btn btn-primary" id="get_verification_code">获取验证码</button>
  80. <span id="countdown"></span>
  81. </div>
  82. </form>
  83. </div>
  84. <div class="modal-footer">
  85. <button class="btn ripple btn-success" type="button" id="submit_btn_rename">保存提交</button>
  86. <button class="btn ripple btn-danger" data-bs-dismiss="modal" type="button">取消</button>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. <!-- End Input modal -->
  92. <!--<a href=""> <p class="btn btn-secondary" >修改资料</p></a>-->
  93. </div>
  94. <?php
  95. } else {
  96. }
  97. ?>
  98. <!--<div class="card">-->
  99. <!--<div class="card-body">-->
  100. <!-- <div class="mb-2 h4 text-dark">-->
  101. <!-- 微信绑定-->
  102. <!-- </div>-->
  103. <!-- <p>微信头像:</p>-->
  104. <!-- <p>微信昵称:</p>-->
  105. <!--<a href=""> <p class="btn btn-secondary">绑定账号</p></a>-->
  106. <!-- <button type="button" class="btn btn-secondary" data-bs-toggle="modal" data-bs-target="#wechat-modal" data-bs-whatever="@mdo">绑定微信</button>-->
  107. <!--</div>-->
  108. <!-- Input modal -->
  109. <div class="modal fade" id="wechat-modal">
  110. <div class="modal-dialog" role="document">
  111. <div class="modal-content modal-content-demo">
  112. <div class="modal-header">
  113. <h6 class="modal-title">绑定微信</h6>
  114. <button class="btn-close" data-bs-dismiss="modal" aria-label="Close">
  115. <span aria-hidden="true">×</span>
  116. </button>
  117. </div>
  118. <div class="modal-body">
  119. <form>
  120. <div>
  121. <img src="" alt="这是生成微信公众号的二维码">
  122. </div>
  123. </form>
  124. </div>
  125. <div class="modal-footer">
  126. <button class="btn ripple btn-success" type="button" id="submit_btn">保存提交</button>
  127. <button class="btn ripple btn-danger" data-bs-dismiss="modal" type="button">取消</button>
  128. </div>
  129. </div>
  130. </div>
  131. </div>
  132. <!-- End Datepicker modal -->
  133. </div>
  134. <div class="card">
  135. <div class="card-body">
  136. <div class="mb-2 h4 text-dark " >
  137. 支付宝账号
  138. </div>
  139. <p>姓名:<t id="alipay"></t></p>
  140. <p>账号:<t id="alipay_acc"></t></p>
  141. <!--<a href=""> <p class="btn btn-secondary">绑定账号</p></a>-->
  142. <button type="button" class="btn btn-secondary" data-bs-toggle="modal" data-bs-target="#alipay-modal" data-bs-whatever="@mdo">绑定账号</button>
  143. </div>
  144. <!-- Inout modal -->
  145. <div class="modal fade" id="alipay-modal">
  146. <div class="modal-dialog" role="document">
  147. <div class="modal-content modal-content-demo">
  148. <div class="modal-header">
  149. <h6 class="modal-title">绑定支付宝</h6>
  150. <button class="btn-close" data-bs-dismiss="modal" aria-label="Close">
  151. <span aria-hidden="true">×</span>
  152. </button>
  153. </div>
  154. <div class="modal-body">
  155. <form>
  156. <div class="mb-3">
  157. <label for="alipay_name" class="col-form-label">姓名:</label>
  158. <input type="text" class="form-control" id="alipay_name" required>
  159. </div>
  160. <div class="mb-3">
  161. <label for="alipay_acc_input" class="col-form-label">账号:</label>
  162. <input type="text" class="form-control" id="alipay_acc_input" required>
  163. </div>
  164. </form>
  165. </div>
  166. <div class="modal-footer">
  167. <button class="btn ripple btn-success" type="button" id="submit_btn_alipay">保存提交</button>
  168. <button class="btn ripple btn-danger" data-bs-dismiss="modal" type="button">取消</button>
  169. </div>
  170. </div>
  171. </div>
  172. </div>
  173. <!-- End Datepicker modal -->
  174. </div>
  175. <div class="card">
  176. <div class="card-body">
  177. <div class="mb-2 h4 text-dark " >
  178. 银行卡账号
  179. </div>
  180. <p>姓名:<t id="bank_name"></t></p>
  181. <p>账号:<t id="bank_acc"></t></p>
  182. <p>银行:<t id="proxy_bank_name"></t></p>
  183. <p>支行:<t id="proxy_bank_zh"></t></p>
  184. <!--<a href=""> <p class="btn btn-secondary">绑定账号</p></a>-->
  185. <button type="button" class="btn btn-secondary" data-bs-toggle="modal" data-bs-target="#bank-modal" data-bs-whatever="@mdo">绑定账号</button>
  186. </div>
  187. <!-- Inout modal -->
  188. <div class="modal fade" id="bank-modal">
  189. <div class="modal-dialog" role="document">
  190. <div class="modal-content modal-content-demo">
  191. <div class="modal-header">
  192. <h6 class="modal-title">绑定银行卡</h6>
  193. <button class="btn-close" data-bs-dismiss="modal" aria-label="Close">
  194. <span aria-hidden="true">×</span>
  195. </button>
  196. </div>
  197. <div class="modal-body">
  198. <form>
  199. <div class="mb-3">
  200. <label for="bank_names" class="col-form-label">姓名:</label>
  201. <input type="text" class="form-control" id="bank_names" required>
  202. </div>
  203. <div class="mb-3">
  204. <label for="bank_accs" class="col-form-label">账号:</label>
  205. <input type="text" class="form-control" id="bank_accs" required>
  206. </div>
  207. <div class="mb-3">
  208. <label for="proxy_bank_names" class="col-form-label">银行名称:<p style="color:red">只提供平台支持的银行</p></label>
  209. <select class="form-control" id="proxy_bank_names" required>
  210. <option value="中国银行">中国银行</option>
  211. <option value="工商银行">工商银行</option>
  212. <option value="招商银行">招商银行</option>
  213. <option value="邮政银行">邮政银行</option>
  214. <option value="交通银行">交通银行</option>
  215. <option value="建设银行">建设银行</option>
  216. <option value="农商银行">农商银行</option>
  217. </select>
  218. </div>
  219. <div class="mb-3">
  220. <label for="proxy_bank_zhs" class="col-form-label">银行支行:</label>
  221. <input type="text" class="form-control" id="proxy_bank_zhs" required>
  222. </div>
  223. </form>
  224. </div>
  225. <div class="modal-footer">
  226. <button class="btn ripple btn-success" type="button" id="submit_btn_banks">保存提交</button>
  227. <button class="btn ripple btn-danger" data-bs-dismiss="modal" type="button">取消</button>
  228. </div>
  229. </div>
  230. </div>
  231. </div>
  232. <!-- End Datepicker modal -->
  233. </div>
  234. </div>
  235. </div>
  236. </div>
  237. </div>
  238. <!-- End Row -->
  239. </div>
  240. <!-- CONTAINER CLOSE -->
  241. <script src="assets/js/jquery.min.js"></script>
  242. <script>
  243. $.ajax({
  244. url: "controller/Proxy.php",
  245. type: "POST",
  246. dataType: "json",
  247. success: function(data) {
  248. // 获取成功后的代码
  249. $("#avatar").attr("src", data.avatar);
  250. $("#name").text(data.name);
  251. $("#account").text(data.account);
  252. $("#rename").text(data.rename);
  253. $("#phone").text(data.phone);
  254. $("#card_uid").text(data.card_uid);
  255. $("#alipay").text(data.alipay);
  256. $("#alipay_acc").text(data.alipay_acc);
  257. $("#bank_name").text(data.bank_name);
  258. $("#bank_acc").text(data.bank_acc);
  259. $("#proxy_bank_name").text(data.proxy_bank_name);
  260. $("#proxy_bank_zh").text(data.proxy_bank_zh);
  261. $("#type").text(data.type);
  262. },
  263. error: function() {
  264. // 获取失败后的代码
  265. alert("获取代理信息失败");
  266. }
  267. });
  268. // <!-- 这里验证手机号 -->
  269. $(document).ready(function() {
  270. // 验证手机号码格式
  271. function validatePhoneNumber(phoneNumber) {
  272. var regex = /^1[0-9]{10}$/;
  273. return regex.test(phoneNumber);
  274. }
  275. // 点击获取验证码按钮
  276. $("#get_verification_code").click(function() {
  277. var phoneNumber = $("#proxy_phone").val();
  278. // 验证手机号码是否为空
  279. if (phoneNumber === "") {
  280. alert("请输入手机号码");
  281. return;
  282. }
  283. // 验证手机号码格式
  284. if (!validatePhoneNumber(phoneNumber)) {
  285. alert("请输入正确的手机号码");
  286. return;
  287. }
  288. // 发送手机号码到后端
  289. $.ajax({
  290. url: "controller/public/SendSms.php",
  291. type: "POST",
  292. data: { phoneNumber: phoneNumber },
  293. success: function(response) {
  294. // 处理成功响应的代码
  295. // console.log(response);
  296. alert("验证码发送成功");
  297. },
  298. error: function() {
  299. // 处理错误响应的代码
  300. alert("发送验证码失败");
  301. }
  302. });
  303. // 禁用获取验证码按钮
  304. $("#get_verification_code").prop("disabled", true);
  305. // 开始倒计时
  306. var countdown = 60;
  307. var countdownText = $("#countdown");
  308. countdownText.text(countdown + "秒后重新获取");
  309. var countdownInterval = setInterval(function() {
  310. countdown--;
  311. countdownText.text(countdown + "秒后重新获取");
  312. if (countdown <= 0) {
  313. // 倒计时结束,解除禁用获取验证码按钮
  314. clearInterval(countdownInterval);
  315. countdownText.text("");
  316. $("#get_verification_code").prop("disabled", false);
  317. }
  318. }, 1000);
  319. });
  320. // 监听保存提交按钮的点击事件
  321. $("#submit_btn_rename").click(function() {
  322. // 获取表单数据
  323. var renameData = {
  324. proxy_rename: $("#proxy_rename").val(),
  325. proxy_uid: $("#proxy_uid").val(),
  326. proxy_phone: $("#proxy_phone").val(),
  327. verification_code: $("#verification_code").val(),
  328. };
  329. // 发送Ajax请求
  330. $.ajax({
  331. url: "controller/DoUpProxy.php",
  332. type: "POST",
  333. data: renameData,
  334. dataType: "json",
  335. success: function(response) {
  336. // 处理成功响应的代码
  337. alert(response.msg);
  338. if (response.code === 2) {
  339. // 隐藏或关闭模态框
  340. $('#rename-modal').modal('hide');
  341. $('#rename-modal').on('hidden.bs.modal', function() {
  342. $(this).remove();
  343. location.reload();
  344. });
  345. }
  346. },
  347. error: function() {
  348. // 处理错误响应的代码
  349. alert("系统出错,请稍后再试!");
  350. }
  351. });
  352. });
  353. // 监听保存提交按钮的点击事件
  354. $("#submit_btn_alipay").click(function() {
  355. // 获取表单数据
  356. var alipayData = {
  357. alipay_name: $("#alipay_name").val(),
  358. alipay_acc: $("#alipay_acc_input").val(),
  359. };
  360. // 发送Ajax请求
  361. $.ajax({
  362. url: "controller/DoUpProxy.php",
  363. type: "POST",
  364. data: alipayData,
  365. dataType: "json",
  366. success: function(response) {
  367. // 处理成功响应的代码
  368. alert(response.msg);
  369. // console.log(response);
  370. if (response.code === 2) {
  371. // 隐藏或关闭模态框
  372. $('#alipay-modal').modal('hide');
  373. $('#alipay-modal').on('hidden.bs.modal', function() {
  374. $(this).remove();
  375. location.reload();
  376. });
  377. }
  378. },
  379. error: function() {
  380. // 处理错误响应的代码
  381. alert("系统出错,请稍后再试!");
  382. }
  383. });
  384. });
  385. // 监听保存提交按钮的点击事件
  386. $("#submit_btn_banks").click(function() {
  387. // 获取表单数据
  388. var bankData = {
  389. bank_name: $("#bank_names").val(),
  390. bank_acc: $("#bank_accs").val(),
  391. proxy_bank_name: $("#proxy_bank_names").val(),
  392. proxy_bank_zh: $("#proxy_bank_zhs").val()
  393. };
  394. // console.log(bankData);
  395. // 发送Ajax请求
  396. $.ajax({
  397. url: "controller/DoUpProxy.php",
  398. type: "POST",
  399. data: bankData,
  400. dataType: "json",
  401. success: function(response) {
  402. // 处理成功响应的代码
  403. alert(response.msg);
  404. if (response.code === 2) {
  405. // 隐藏或关闭模态框
  406. $('#bank-modal').modal('hide');
  407. $('#bank-modal').on('hidden.bs.modal', function() {
  408. $(this).remove();
  409. location.reload();
  410. });
  411. }
  412. },
  413. error: function() {
  414. // 处理错误响应的代码
  415. alert("系统出错,请稍后再试!");
  416. }
  417. });
  418. });
  419. });
  420. </script>
  421. <?php require_once('common/footer.php'); ?>
  422. <?php
  423. } else {
  424. echo "<script>alert('登录过过期,没有权限访问该页面');location.href='login.html';</script>";
  425. }