diff --git a/application/admin/controller/Dashboard.php b/application/admin/controller/Dashboard.php index 3f56bf6..06f6484 100755 --- a/application/admin/controller/Dashboard.php +++ b/application/admin/controller/Dashboard.php @@ -223,7 +223,7 @@ class Dashboard extends Backend return $this->view->fetch('kpi_presale'); } - $this->error('当前岗位暂未支持'); + return $this->view->fetch('kpi_admin'); } diff --git a/application/admin/controller/Orderplan.php b/application/admin/controller/Orderplan.php index e927796..456c342 100644 --- a/application/admin/controller/Orderplan.php +++ b/application/admin/controller/Orderplan.php @@ -52,7 +52,13 @@ class Orderplan extends Backend public function dashboard() { - return $this->fetch('orderplan/index'); + $start = now()->modify('-14 days')->format('Y-m-d'); + $end_at = now()->format('Y-m-d'); + $default_daterange = $start . ' - ' . $end_at; + + return $this->fetch('orderplan/index',[ + 'default_daterange' => $default_daterange + ]); } public function data() @@ -144,7 +150,7 @@ class Orderplan extends Backend private function getPie() { $build = new OrderAbnormal(); - $res = $this->buildDate($build) + $res = $this->buildDate($build,name:'create_time') ->field([ 'abnormal_title name', 'count(id) value', @@ -212,7 +218,7 @@ class Orderplan extends Backend } - private function buildDate($build, $table_name = null) + private function buildDate($build, $table_name = null,$name = 'audit_time') { $start = now()->modify('-14 days')->format('Y-m-d'); $end_at = now()->format('Y-m-d 23:29:59'); @@ -228,9 +234,9 @@ class Orderplan extends Backend } // dd([$start, $end_at]); if ($table_name) { - $build->where($table_name . '.create_time', 'between', [$start, $end_at]); + $build->where($table_name . '.'.$name, 'between', [$start, $end_at]); } else { - $build->where('create_time', 'between', [$start, $end_at]); + $build->where($name, 'between', [$start, $end_at]); } return $build; diff --git a/application/admin/controller/statistics/Aftersale.php b/application/admin/controller/statistics/Aftersale.php index 857b031..54a46aa 100644 --- a/application/admin/controller/statistics/Aftersale.php +++ b/application/admin/controller/statistics/Aftersale.php @@ -29,12 +29,18 @@ class Aftersale extends Backend ->order('pid', 'asc') ->order('sort', 'desc') ->select(); + + $start = now()->modify('-30 days')->format('Y-m-d'); + $end_at = now()->format('Y-m-d'); + $default_daterange = $start . ' - ' . $end_at; + $tree = $this->buildTree($items); $formattedTree = $this->formatTree($tree); $this->items = $items; $this->itemsformattedTree = $formattedTree; $this->view->assign("items", $formattedTree); + $this->view->assign("default_daterange", $default_daterange); parent::_initialize(); } diff --git a/application/admin/controller/statistics/Item.php b/application/admin/controller/statistics/Item.php index 641a550..9510946 100644 --- a/application/admin/controller/statistics/Item.php +++ b/application/admin/controller/statistics/Item.php @@ -35,7 +35,12 @@ class Item extends Backend public function index() { - return $this->fetch('index'); + $start = now()->modify('-7 days')->format('Y-m-d'); + $end_at = now()->format('Y-m-d'); + $default_daterange = $start . ' - ' . $end_at; + return $this->fetch('index',[ + 'default_daterange' => $default_daterange + ]); } public function list() @@ -63,7 +68,7 @@ class Item extends Backend } - $build->whereBetween('create_time', [$start, $end_at]) + $build->whereBetween('audit_time', [$start, $end_at]) ->field([ 'item_title name', // 类型 'sum(total) total', // 营业额 @@ -140,7 +145,7 @@ class Item extends Backend } } - $res = $build->whereBetween('create_time', [$start, $end_at]) + $res = $build->whereBetween('audit_time', [$start, $end_at]) ->where('status', Order::STATUS_FINISHED) ->field([ 'item_title name', // 类型 diff --git a/application/admin/view/dashboard/kpi_admin.html b/application/admin/view/dashboard/kpi_admin.html new file mode 100644 index 0000000..a64ffea --- /dev/null +++ b/application/admin/view/dashboard/kpi_admin.html @@ -0,0 +1,9 @@ +
+
+

KPI面板

+
+
+
+
+
+
\ No newline at end of file diff --git a/application/admin/view/orderplan/index.html b/application/admin/view/orderplan/index.html index b08271f..4fd5607 100644 --- a/application/admin/view/orderplan/index.html +++ b/application/admin/view/orderplan/index.html @@ -36,7 +36,7 @@
- +
diff --git a/application/admin/view/statistics/aftersale/index.html b/application/admin/view/statistics/aftersale/index.html index bde4d1a..91a5e3a 100644 --- a/application/admin/view/statistics/aftersale/index.html +++ b/application/admin/view/statistics/aftersale/index.html @@ -178,7 +178,7 @@
-
@@ -200,7 +200,7 @@
- @@ -221,7 +221,7 @@ + placeholder="指定日期" name="filter[daterange]" value="{$default_daterange}" id="daterange-table3" autocomplete="off" > @@ -237,7 +237,7 @@
-
diff --git a/application/admin/view/statistics/item/index.html b/application/admin/view/statistics/item/index.html index 8a0c7a7..d97d0e4 100644 --- a/application/admin/view/statistics/item/index.html +++ b/application/admin/view/statistics/item/index.html @@ -26,7 +26,7 @@
- +
@@ -50,6 +50,7 @@