From e3457cbc12ce87da540eea3a5c13e2430fb01a26 Mon Sep 17 00:00:00 2001 From: todaywindy Date: Thu, 29 May 2025 20:10:20 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/Index.php | 8 ++-- application/admin/controller/Message.php | 4 +- application/admin/controller/Order.php | 20 +++++++++ .../admin/controller/aftersales/Aftersale.php | 12 +++++- application/admin/view/order/add.html | 42 +++++++++---------- application/admin/view/order/delete.html | 4 +- .../admin/view/setting/abnormal/edit.html | 1 + public/assets/js/backend/order.js | 4 +- 8 files changed, 64 insertions(+), 31 deletions(-) diff --git a/application/admin/controller/Index.php b/application/admin/controller/Index.php index 48be8eb..c6adf66 100755 --- a/application/admin/controller/Index.php +++ b/application/admin/controller/Index.php @@ -39,11 +39,13 @@ class Index extends Backend config('fastadmin.' . $key, $cookieValue); } } + + $order = new \app\admin\model\Order(); + $to_dispatch = $order->where('status',\app\admin\model\Order::STATUS_DISPATCHING)->count(); + //左侧菜单 list($menulist, $navlist, $fixedmenu, $referermenu) = $this->auth->getSidebar([ - 'dashboard' => 'hot', - 'addon' => ['new', 'red', 'badge'], - 'auth/rule' => __('Menu'), + 'order/index' => [$to_dispatch, 'red', 'badge'], //待派单 ], $this->view->site['fixedpage']); $action = $this->request->request('action'); if ($this->request->isPost()) { diff --git a/application/admin/controller/Message.php b/application/admin/controller/Message.php index 868e8f2..a91bd66 100644 --- a/application/admin/controller/Message.php +++ b/application/admin/controller/Message.php @@ -129,7 +129,7 @@ class Message extends Backend { $count = 0; //超管不提醒新消息 - if(!$this->auth->isSuperAdmin()){ +// if(!$this->auth->isSuperAdmin()){ $count = $this->model ->where('type',1) ->auth($this->auth) @@ -137,7 +137,7 @@ class Message extends Backend ->whereRaw("FIND_IN_SET({$this->auth->id}, read_uid) = 0 OR read_uid = '' or read_uid is null") ->whereTime('create_time', '>=', '-30 days') ->count(); - } +// } return [ 'count' => $count ]; diff --git a/application/admin/controller/Order.php b/application/admin/controller/Order.php index d78c35d..b1fc0e8 100644 --- a/application/admin/controller/Order.php +++ b/application/admin/controller/Order.php @@ -4,6 +4,7 @@ namespace app\admin\controller; use app\admin\addresmart\Address; use app\admin\controller\orders\DispatchLogic; +use app\admin\model\Message; use app\admin\model\order\Invoice; use app\admin\model\OrderDispatch; use app\admin\model\Worker; @@ -194,6 +195,9 @@ class Order extends Backend return $this->view->fetch(); } $params = $this->request->post('row/a'); + $params = array_filter($params,function ($val){ + return $val != ''; + }); if (empty($params)) { $this->error(__('Parameter %s can not be empty', '')); } @@ -412,6 +416,14 @@ class Order extends Backend if ($ids) { $order = $this->model->where('id', $ids)->find(); } + + Message::create([ + 'to_id' => $order->admin_id, + 'type' => 1, + 'title' => '订单报错通知', + 'content' => '【订单报错通知】您有一条订单号为'.$order->order_no.'的订单订单信息录入错误,请前往报错订单界面进行查看,并立即处理!' + ]); + $this->success($order['order_no']); } @@ -433,6 +445,7 @@ class Order extends Backend } $params = $this->preExcludeFields($params); + $order = model('order')->get($params['order_id']); $result = false; Db::startTrans(); @@ -450,6 +463,13 @@ class Order extends Backend 'update_time' => now()->format('Y-m-d H:m:s'), ]; + Message::create([ + 'to_id' => $order->admin_id, + 'type' => 1, + 'title' => '订单报错通知', + 'content' => '【订单报错通知】您有一条订单号为'.$order->order_no.'的订单订单信息录入错误,请前往报错订单界面进行查看,并立即处理!' + ]); + $result = \model('order_abnormal')->insert($insert); Db::commit(); } catch (ValidateException | PDOException | Exception $e) { diff --git a/application/admin/controller/aftersales/Aftersale.php b/application/admin/controller/aftersales/Aftersale.php index 9dc2c37..5a1d763 100644 --- a/application/admin/controller/aftersales/Aftersale.php +++ b/application/admin/controller/aftersales/Aftersale.php @@ -3,6 +3,7 @@ namespace app\admin\controller\aftersales; use app\admin\model\Admin; +use app\admin\model\Message; use app\admin\model\Order; use app\common\controller\Backend; use app\common\Logic\OrderLogic; @@ -157,8 +158,8 @@ class Aftersale extends Backend $params['admin_id'] = $this->auth->id; $params['admin_user'] = $this->auth->nickname; if(!empty($order->dispatch)){ - $params['worker_id'] = $order->dispatch->worker_id; - $params['worker_name'] = $order->dispatch->worker_name; + $params['worker_id'] = $order->dispatch->worker_id ?? 0; + $params['worker_name'] = $order->dispatch->worker_name ?? ''; } $params['status'] = 1; @@ -171,6 +172,13 @@ class Aftersale extends Backend $params['dispatch_admin_id'] = $order->dispatch_admin_id ?? 0; $params['dispatch_admin_user'] = $order->dispatch_admin_user ?? ''; + Message::create([ + 'to_id' => $params['dispatch_admin_id'], + 'type' => 1, + 'title' => '订单报错通知', + 'content' => '【售后申请通知】您有一条售后申请待处理,请前往订单售后界面进行处理!' + ]); + $result = $this->model->allowField(true)->save($params); $order->aftersale_id = $this->model->id; $order->save(); diff --git a/application/admin/view/order/add.html b/application/admin/view/order/add.html index 14e1137..5e8c5a3 100644 --- a/application/admin/view/order/add.html +++ b/application/admin/view/order/add.html @@ -7,14 +7,14 @@
-
-
+
+
-
+
@@ -22,15 +22,15 @@
-
+
-
- +
+
-
+
@@ -60,14 +60,14 @@
-
+
-
+
@@ -75,7 +75,7 @@
-
+
@@ -91,9 +91,9 @@
-
+
-
+
-
+
@@ -134,7 +134,7 @@
-
+
@@ -143,7 +143,7 @@ -
+
-
+
{foreach $options as $item} @@ -25,7 +25,7 @@
- +
diff --git a/application/admin/view/setting/abnormal/edit.html b/application/admin/view/setting/abnormal/edit.html index 6c867f2..ab36b32 100644 --- a/application/admin/view/setting/abnormal/edit.html +++ b/application/admin/view/setting/abnormal/edit.html @@ -19,3 +19,4 @@
+ diff --git a/public/assets/js/backend/order.js b/public/assets/js/backend/order.js index 07c8328..0be2471 100644 --- a/public/assets/js/backend/order.js +++ b/public/assets/js/backend/order.js @@ -390,7 +390,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function table.bootstrapTable('refresh', {}); return false; }); - + const timer = setInterval(function () { + table.bootstrapTable('refresh', {}); + },1000 * 120); }, add: function () { $("#mybuttom").on("click", function () {