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/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/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/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 @@ +