From 41dd493e5743169dc802b7aa19f7edf6464d4104 Mon Sep 17 00:00:00 2001 From: todaywindy Date: Tue, 3 Jun 2025 11:51:01 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/Dashboard.php | 2 +- application/admin/controller/Orderplan.php | 16 +++++++++++----- .../admin/controller/statistics/Aftersale.php | 6 ++++++ application/admin/controller/statistics/Item.php | 11 ++++++++--- application/admin/view/dashboard/kpi_admin.html | 9 +++++++++ application/admin/view/orderplan/index.html | 2 +- .../admin/view/statistics/aftersale/index.html | 8 ++++---- .../admin/view/statistics/item/index.html | 3 ++- 8 files changed, 42 insertions(+), 15 deletions(-) create mode 100644 application/admin/view/dashboard/kpi_admin.html 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 @@
From e2842bf17c7892a4bf027fba7b9c10b719326f44 Mon Sep 17 00:00:00 2001 From: todaywindy Date: Tue, 3 Jun 2025 15:39:35 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/address/bootstrap.js | 2 - .../admin/controller/orders/Auditorder.php | 3 +- .../admin/controller/orders/Configorder.php | 4 +- .../admin/view/orders/auditorder/edit.html | 10 ++++- .../admin/view/orders/configorder/edit.html | 37 ++++++++++++------- public/assets/js/addons.js | 1 - 6 files changed, 37 insertions(+), 20 deletions(-) diff --git a/addons/address/bootstrap.js b/addons/address/bootstrap.js index 9d832ac..d87e3f8 100644 --- a/addons/address/bootstrap.js +++ b/addons/address/bootstrap.js @@ -1,7 +1,5 @@ require([], function () { //绑定data-toggle=addresspicker属性点击事件 - console.log('111'); - $(document).on('click', "[data-toggle='addresspicker']", function () { var that = this; var callback = $(that).data('callback'); diff --git a/application/admin/controller/orders/Auditorder.php b/application/admin/controller/orders/Auditorder.php index 31d9eec..c9e8b66 100644 --- a/application/admin/controller/orders/Auditorder.php +++ b/application/admin/controller/orders/Auditorder.php @@ -108,8 +108,9 @@ class Auditorder extends Backend $this->error(__('You have no permission')); } if (false === $this->request->isPost()) { + $order = Order::where('id',$ids)->find(); $this->view->assign('row', $row); - $this->view->assign('worker',Worker::where('status',$order->worker_id)->find()); + $this->view->assign('worker',Worker::where('id',$order->worker_id)->find()); return $this->view->fetch(); } $params = $this->request->post('row/a'); diff --git a/application/admin/controller/orders/Configorder.php b/application/admin/controller/orders/Configorder.php index 235e1a1..2f96d10 100644 --- a/application/admin/controller/orders/Configorder.php +++ b/application/admin/controller/orders/Configorder.php @@ -136,8 +136,8 @@ class Configorder extends Backend 'amount_images' => $params['amount_images'], 'material_cost' => $params['material_cost'], 'cost_rate' => $params['cost_rate'], - 'cost_remark' => $params['cost_remark'], - 'material_images' => $params['material_images'], + 'cost_remark' => $params['cost_remark'] ?? '', + 'material_images' => $params['material_images'] ?? '', ]; $last_amount = bcadd($params['online_amount_last'],$params['offline_amount'],2); diff --git a/application/admin/view/orders/auditorder/edit.html b/application/admin/view/orders/auditorder/edit.html index 6e261d9..b2637b0 100644 --- a/application/admin/view/orders/auditorder/edit.html +++ b/application/admin/view/orders/auditorder/edit.html @@ -126,10 +126,18 @@
+
+ +
+ +
+
+ +
- +
diff --git a/application/admin/view/orders/configorder/edit.html b/application/admin/view/orders/configorder/edit.html index 20eef6b..092c19f 100644 --- a/application/admin/view/orders/configorder/edit.html +++ b/application/admin/view/orders/configorder/edit.html @@ -92,12 +92,27 @@
- +
- +
+
+ +
+ +
+
+ +
+ +
+ +
+
+ +
@@ -105,16 +120,6 @@
- -
- -
- -
-
- - -
@@ -184,11 +189,17 @@
+
+ +
+ +
+
- +
diff --git a/public/assets/js/addons.js b/public/assets/js/addons.js index 844ff8c..6299f6b 100755 --- a/public/assets/js/addons.js +++ b/public/assets/js/addons.js @@ -1,7 +1,6 @@ define([], function () { require([], function () { //绑定data-toggle=addresspicker属性点击事件 - console.log('111'); $(document).on('click', "[data-toggle='addresspicker']", function () { var that = this;