From 1e13c81f1614520f152f20ef4f9618787004539f Mon Sep 17 00:00:00 2001 From: xman <1946321327@qq.com> Date: Mon, 2 Jun 2025 20:45:29 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controller/aftersales/Aftersale.php | 4 +--- .../admin/controller/aftersales/Aftersale2.php | 3 ++- application/admin/controller/statistics/Worker.php | 13 +++++++++++++ .../admin/view/aftersales/aftersale2/edit.html | 11 ++++++----- public/assets/js/backend/statistics/worker.js | 2 ++ 5 files changed, 24 insertions(+), 9 deletions(-) diff --git a/application/admin/controller/aftersales/Aftersale.php b/application/admin/controller/aftersales/Aftersale.php index cf40b7c..494eb5a 100644 --- a/application/admin/controller/aftersales/Aftersale.php +++ b/application/admin/controller/aftersales/Aftersale.php @@ -187,8 +187,6 @@ class Aftersale extends Backend Db::commit(); } catch (ValidateException|PDOException|Exception $e) { Db::rollback(); - throw $e; -// $this->error($e->getMessage()); } if ($result === false) { $this->error(__('No rows were inserted')); @@ -239,7 +237,7 @@ class Aftersale extends Backend } $params['handle_admin_id'] = $this->auth->id; $params['handle_admin_user'] = $this->auth->nickname; - if($params['handle_type'] == 1){ + if($row->type == 1){ $params['refund_amount'] = bcadd($params['company_refund_amount'],$params['worker_refund_amount'],2); }else{ unset($params['company_refund_amount']); diff --git a/application/admin/controller/aftersales/Aftersale2.php b/application/admin/controller/aftersales/Aftersale2.php index 233ffeb..3c0638b 100644 --- a/application/admin/controller/aftersales/Aftersale2.php +++ b/application/admin/controller/aftersales/Aftersale2.php @@ -243,7 +243,7 @@ class Aftersale2 extends Backend $row->validateFailException()->validate($validate); } $params['refund_admin_id'] = $this->auth->id; - if($params['handle_type'] == 1){ + if($params['type'] == 1){ $params['refund_amount'] = bcadd($params['company_refund_amount'],$params['worker_refund_amount'],2); }else{ unset($params['company_refund_amount']); @@ -258,6 +258,7 @@ class Aftersale2 extends Backend } $params['status'] = 4; + $params['handle_type'] = 1; $params['refund_time'] = date('Y-m-d H:i:s'); $result = $row->allowField(true)->save($params); diff --git a/application/admin/controller/statistics/Worker.php b/application/admin/controller/statistics/Worker.php index ef3558b..b8600dc 100644 --- a/application/admin/controller/statistics/Worker.php +++ b/application/admin/controller/statistics/Worker.php @@ -14,6 +14,7 @@ use think\Exception; use think\exception\DbException; use think\Loader; use think\response\Json; +use function Symfony\Component\Clock\now; /** * 师傅列管理 @@ -65,6 +66,9 @@ class Worker extends Backend */ public function index() { + + $today = now()->format('Y-m-01'); + $today_end = now()->format('Y-m-d'); //设置过滤方法 $this->request->filter(['strip_tags', 'trim']); if (false === $this->request->isAjax()) { @@ -109,6 +113,8 @@ class Worker extends Backend ]; } $this->assign('locationData',json_encode($arr)); + + $this->assignconfig('default_daterange',now()->format('Y-m-01 00:00:00').' - '.now()->format('Y-m-d 23:59:59')); return $this->view->fetch(); } //如果发送的来源是 Selectpage,则转发到 Selectpage @@ -141,6 +147,7 @@ class Worker extends Backend ->field([ 'fa_worker.*', 'IFNULL(a.dispatch_count, 0) AS dispatch_count', + 'IFNULL(a.get_js_count, 0) AS get_js_count', 'IFNULL(a.get_count, 0) AS get_count', 'IFNULL(a.refuse_count, 0) AS refuse_count', 'IFNULL(a.arrive_count, 0) AS arrive_count', @@ -195,6 +202,8 @@ class Worker extends Backend // 使用 IFNULL 确保结果为 null 时返回 0 "IFNULL(COUNT(*), 0) AS dispatch_count", //分配数 "IFNULL(COUNT(CASE WHEN status NOT IN (0, -10) THEN 1 END), 0) AS get_count", //接单数 + + "IFNULL(COUNT(CASE WHEN status IN (30, 60) THEN 1 END), 0) AS get_js_count", //接单数 //"COUNT(CASE WHEN status IN (60) THEN 1 END) AS finish_count", //完成数 "IFNULL(COUNT(CASE WHEN status NOT IN (-10) THEN 1 END), 0) AS refuse_count", //拒绝数 "IFNULL(COUNT(arrive_time), 0) AS arrive_count", //上门数 @@ -293,6 +302,10 @@ class Worker extends Backend //好评率 $datum->good_rate = $this->_calc($datum->good_count,$datum->finish_num,4,true); + //及时联系率 + $datum->get_time_rate = $this->_calc($datum->get_js_count,$datum->get_count,4,true); + + $datum->avg_time_diff = $this->_calc($datum->avg_time_diff,3600,2); } } diff --git a/application/admin/view/aftersales/aftersale2/edit.html b/application/admin/view/aftersales/aftersale2/edit.html index a241227..94bccbb 100644 --- a/application/admin/view/aftersales/aftersale2/edit.html +++ b/application/admin/view/aftersales/aftersale2/edit.html @@ -46,6 +46,7 @@ +
@@ -170,16 +172,15 @@
+
-
- {foreach name="statusList" item="vo"} - - {/foreach} +
-
diff --git a/public/assets/js/backend/statistics/worker.js b/public/assets/js/backend/statistics/worker.js index 49bb94a..55c3d80 100644 --- a/public/assets/js/backend/statistics/worker.js +++ b/public/assets/js/backend/statistics/worker.js @@ -43,6 +43,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts', 'echarts-t {field: 'cash_value', title: __('变现值'), operate: false}, {field: 'refuse_rate', title: __('拒单率(%)'), operate: false}, {field: 'arrive_rate', title: __('上门率(%)'), operate: false}, + {field: 'get_time_rate', title: __('接单及时率(%)'), operate: false}, + {field: 'good_rate', title: __('好评率(%)'), operate: false}, //{field: 'refund_total', title: __('退款金额(¥)'), operate: false},