user_statistics.html 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <!DOCTYPE html>
  2. <html lang="en" style="width: 100%">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>用户地域统计</title>
  8. <style type="text/css">
  9. *{
  10. margin: 0;
  11. padding: 0;
  12. }
  13. </style>
  14. <script src="js/jquery.min.js"></script>
  15. <link href="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
  16. <script type="text/javascript">
  17. $(function(){
  18. $.post("./user/getUserOrderByCity", {}, function(resp) {
  19. if (resp.code == 'error') {
  20. console.log(resp.code);
  21. }else{
  22. for(let index in resp.data){
  23. var sequence = parseInt(index) + 1;
  24. var str = "<tr><td>" + sequence + "</td><td>";
  25. if(resp.data[index].city == null || resp.data[index].city == ""){
  26. str += "未知</td><td>";
  27. }else{
  28. str += resp.data[index].city + "</td><td>";
  29. }
  30. str += resp.data[index].quantity + "</td></tr>"
  31. $("table").append(str);
  32. }
  33. }
  34. });
  35. })
  36. </script>
  37. </head>
  38. <body style="width: 100%">
  39. <table class="table table-condensed">
  40. <tr>
  41. <th>#</th>
  42. <th>地区</th>
  43. <th>人数</th>
  44. </tr>
  45. </table>
  46. </body>
  47. </html>