FinancialOverview.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: 陈武杰
  5. * Date: 2021/1/13
  6. * Time: 17:34
  7. */
  8. namespace App\Admin\Controllers\DataCenter;
  9. use App\Admin\Controllers\Chart\OrderChart;
  10. use App\Admin\Controllers\Sta;
  11. use App\Http\Controllers\Controller;
  12. use Encore\Admin\Controllers\Dashboard;
  13. use Encore\Admin\Layout\Column;
  14. use Encore\Admin\Layout\Content;
  15. use Encore\Admin\Layout\Row;
  16. use Encore\Admin\Widgets\InfoBox;
  17. class FinancialOverview
  18. {
  19. public function index(Content $content)
  20. {
  21. return $content
  22. ->title('欢迎进入后台管理系统')
  23. ->description('后台数据中心')
  24. ->row('<h1 text-align="center">财务概况</h1>')
  25. ->row(function (Row $row) {
  26. // 产品类型(1.电话咨询 2.图文咨询 3.门诊预约 4.疫苗接种预约 5.儿保预约 6.服务包 7.充值)
  27. $row->column(3, function (Column $column) {
  28. $column->append(infoBox('收入总金额', 'dropbox', '', 'green', FinancialSta::getTotalIncome()));
  29. });
  30. $row->column(3, function (Column $column) {
  31. $column->append(infoBox('退款总金额', 'dropbox', '', 'green', FinancialSta::getTotalRefund()));
  32. });
  33. $row->column(3, function (Column $column) {
  34. $column->append(infoBox('用户充值总金额', 'dropbox', '', 'green', FinancialSta::getTotalRecharge()));
  35. });
  36. $row->column(3, function (Column $column) {
  37. $column->append(infoBox('用户总余额', 'dropbox', '', 'green', FinancialSta::getTotalUserBalance()));
  38. });
  39. })
  40. ->row('<h1 text-align="center">充值记录</h1>')
  41. ->row(function (Row $row){
  42. $row->column(3,function (Column $column){
  43. $column->append(infoBox('当日充值金额', 'dropbox', '', 'green', FinancialSta::getTodayReCharge()));
  44. });
  45. $row->column(3,function (Column $column){
  46. $column->append(infoBox('近七日充值金额', 'dropbox', '', 'green', FinancialSta::getSevenDayReCharge()));
  47. });
  48. $row->column(3,function (Column $column){
  49. $column->append(infoBox('近三十日充值金额', 'dropbox', '', 'green', FinancialSta::getOneMonthReCharge()));
  50. });
  51. })
  52. ->row(function (Row $row){
  53. (new FinancialRechargeChart())->chart($row);
  54. })
  55. ;
  56. }
  57. }
  58. /**
  59. * 消息框
  60. * @param $name
  61. * @param $icon
  62. * @param $link
  63. * @param $color
  64. * @param $info
  65. * @return string HTML
  66. */
  67. function infoBox($name, $icon, $link, $color, $info)
  68. {
  69. return (new InfoBox($name, $icon, $color, $link, $info))->render();
  70. }