diff --git a/application/admin/controller/Orderplan.php b/application/admin/controller/Orderplan.php index ba2d728..8c1f39c 100644 --- a/application/admin/controller/Orderplan.php +++ b/application/admin/controller/Orderplan.php @@ -4,6 +4,7 @@ namespace app\admin\controller; use app\admin\addresmart\Address; use app\admin\model\Abnormal; +use app\admin\model\Aftersale; use app\admin\model\AuthGroupAccess; use app\admin\model\order\Invoice; use app\admin\model\OrderAbnormal; @@ -58,10 +59,12 @@ class Orderplan extends Backend $top = $this->getTopTotal(); $lines = $this->getLine(); $pie = $this->getPie(); + $order = $this->getOrder(); $this->success(data: [ 'top' => $top, 'lines' => $lines, 'pie' => $pie, + 'order' => $order, ]); } @@ -189,15 +192,71 @@ class Orderplan extends Backend } - private function buildDate($build) + private function buildDate($build,$table_name = null) { $start = now()->modify('-14 days')->format('Y-m-d'); $end_at = now()->format('Y-m-d'); - $build->where('create_time', 'between', [$start, $end_at]); + if ($table_name){ + $build->where($table_name.'.create_time', 'between', [$start, $end_at]); + }else{ + $build->where('create_time', 'between', [$start, $end_at]); + + } return $build; } + + + private function getOrder() + { + $build = new OrderAbnormal(); + $res = $build + ->where('status',0) + ->count('id'); + $out ['abnormal'] = $res; + + $build = new \app\admin\model\Order(); + $res = $build + ->where('status',\app\admin\model\Order::STATUS_CHECKING) + ->count('id'); + $out ['check'] = $res; + + + $build = new \app\admin\model\Order(); + $res = $build + ->where('status',\app\admin\model\Order::STATUS_AUDITING) + ->count('id'); + $out ['auditing'] = $res; + + + $build = new \app\admin\model\Order(); + $res = $build + ->alias('a') + ->join('order_review b','a.id = b.order_id','left') + ->where('a.status','in',[\app\admin\model\Order::STATUS_FINISHED,\app\admin\model\Order::STATUS_CANCEL]) + ->whereNull('b.id') + ->count('a.id'); + + $out ['review'] = $res; + + + $build = new Aftersale(); + $res = $build + ->where('status',1) + ->count('id'); + $out ['after_sale'] = $res; + + $build = new Invoice(); + $res = $build + ->where('status',0) + ->count('id'); + $out ['invoice'] = $res; + + return $out; + } + + private function prepareEchartsBarData(array $data, string $startDate, string $endDate): array { // 将原始数据用日期作为键索引 @@ -285,4 +344,5 @@ class Orderplan extends Backend } + } diff --git a/application/admin/view/orderplan/index.html b/application/admin/view/orderplan/index.html index 1a730f4..3db852c 100644 --- a/application/admin/view/orderplan/index.html +++ b/application/admin/view/orderplan/index.html @@ -17,196 +17,64 @@ -
报错
-单位/笔
-待配置
-单位/笔
-待审核
-单位/笔
-待回访
-单位/笔
-待售后
-单位/笔
-开票
-单位/笔
-报错
+单位/笔
+待配置
+单位/笔
+待审核
+单位/笔
+待回访
+单位/笔
+待售后
+单位/笔
+开票
+单位/笔
+¥8848
-今日收款
-¥8848
-本月收款
-88
-今日订单数
-8848
-本月订单数
-88
-今日新增师傅数
-8848
-本月新增师傅数
-8
-今日退款数
-88
-本月退款数
-88
-今日取消订单数
-88
-本月取消订单数
-¥8848
+今日收款
+¥8848
+本月收款
+88
+今日订单数
+8848
+本月订单数
+88
+今日新增师傅数
+8848
+本月新增师傅数
+8
+今日退款数
+88
+本月退款数
+88
+今日取消订单数
+88
+本月取消订单数
+