From 353fd4c3ebe41de79c592e0059cd3eaf37320276 Mon Sep 17 00:00:00 2001 From: hant Date: Tue, 27 May 2025 23:54:30 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=80=E6=AC=BE=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controller/statistics/Aftersale.php | 84 +- application/admin/model/Item.php | 40 +- .../view/statistics/aftersale/index.html | 33 +- .../admin/view/statistics/aftersale/test.html | 968 ++++++++++++++++++ public/assets/css/select.css | 8 + .../assets/js/backend/statistics/aftersale.js | 50 + public/assets/js/cascader.js | 18 +- 7 files changed, 1186 insertions(+), 15 deletions(-) create mode 100644 application/admin/view/statistics/aftersale/test.html diff --git a/application/admin/controller/statistics/Aftersale.php b/application/admin/controller/statistics/Aftersale.php index 9163f45..857b031 100644 --- a/application/admin/controller/statistics/Aftersale.php +++ b/application/admin/controller/statistics/Aftersale.php @@ -185,7 +185,7 @@ class Aftersale extends Backend $start = now()->modify('-30 days')->format('Y-m-d'); $end_at = now()->format('Y-m-d 23:29:59'); - $area_code = request()->get('area_id'); + $item_id = request()->get('item_id'); $filter = request()->get('range', ''); if (!empty($filter)) { $arr = explode(' - ', $filter); @@ -201,8 +201,11 @@ class Aftersale extends Backend $build->group('a.item_title'); - if ($area_code) { - $build->where('area_id', 'like', $this->getSelectAreaCode($area_code) . '%'); + + if ($item_id) { + $item_ids = $this->getItemsById($item_id); + $item_ids [] = $item_id; + $build->whereIn('item_id', $item_ids); } $build->field( @@ -243,4 +246,79 @@ class Aftersale extends Backend return $val; } + private function getItemsById(mixed $item_id) + { + $build = new \app\admin\model\Item(); + $data = $build->getAllData(); + return \app\admin\model\Item::getAllChildIds($data,$item_id); + } + + + public function worker() + { + $build = new \app\admin\model\Worker(); + $build->alias('a') + ->join('order b', 'a.id = b.worker_id', 'right') + ->join('aftersale c', 'b.id = c.admin_id', 'left') + ->where('b.status', Order::STATUS_FINISHED); + + + $start = now()->modify('-30 days')->format('Y-m-d'); + $end_at = now()->format('Y-m-d 23:29:59'); + + + $filter = request()->get('range', ''); + if (!empty($filter)) { + $arr = explode(' - ', $filter); + if (trim($arr[0])) { + $start = trim($arr[0]); + } + if (trim($arr[1])) { + $end_at = trim($arr[1]) . ' 23:29:59'; + } + } + $keyword = request()->get('keyword'); + + + $build->where('audit_time', '>=', $start); + $build->where('audit_time', '<=', $end_at); + + if (!is_null($keyword)) { + $build->where(function ($q) use ($keyword) { + $q->where('name', 'like', '%' . $keyword . '%') + ->whereor('a.tel', 'like', '%' . $keyword . '%'); + }); + } + + + $build->group('a.id'); + $build->field( + [ + 'a.id', + 'a.name', + 'a.tel', + 'count(b.id) order_total', + 'count(c.id) after_total', + ] + ); + + $res = $build->paginate(); + $total = $res->total(); + $ress = $res->items(); +// dd(Admin::getLastSql()); + $data = []; + foreach ($ress as $res) { + $item = $res->toArray(); + $item['rate'] = $this->mydiv($item['after_total'],$item['order_total']) . '%'; + $data [] = $item; + } + return [ + 'rows' => $data, + 'total' => $total + ]; + + + + } + } diff --git a/application/admin/model/Item.php b/application/admin/model/Item.php index f46706f..075962b 100644 --- a/application/admin/model/Item.php +++ b/application/admin/model/Item.php @@ -70,12 +70,50 @@ class Item extends Model foreach ($items as $item){ if ($item['pid'] != 0 && isset($pid_map[$item['pid']])){ $res_items [] = [ - ...$item,'ptitle' => $pid_map[$item['pid']]['title'] + ...$item->toArray(),'ptitle' => $pid_map[$item['pid']]['title'] ]; } } return $res_items; } + public function getAllData(){ + $items = $this + ->where('status',1) + ->field(['id','title','key_word','pid']) + ->order('pid','asc') + ->order('sort','desc') + ->select(); + $res_items = []; + foreach ($items as $item){ + $res_items [] = $item->toArray(); + } + return $res_items; + } + + + static function getAllChildIds(array $data, int $parentId): array { + // 先构建 pid 索引表,加速查找 + $index = []; + foreach ($data as $item) { + $index[$item['pid']][] = $item; + } + + // 递归函数,闭包形式避免污染全局 + $collect = function($pid) use (&$collect, &$index) { + $ids = []; + if (isset($index[$pid])) { + foreach ($index[$pid] as $child) { + $ids[] = $child['id']; + $ids = array_merge($ids, $collect($child['id'])); + } + } + return $ids; + }; + + return $collect($parentId); + } + + } diff --git a/application/admin/view/statistics/aftersale/index.html b/application/admin/view/statistics/aftersale/index.html index d436f76..bde4d1a 100644 --- a/application/admin/view/statistics/aftersale/index.html +++ b/application/admin/view/statistics/aftersale/index.html @@ -167,7 +167,7 @@
  • 城市退款
  • 服务项目退款
  • 师傅退款
  • -
  • 全部退款订单
  • + @@ -177,7 +177,7 @@
    - + @@ -214,12 +214,14 @@
    -
    +
    - +
    + +
    - +
    @@ -231,13 +233,24 @@
    + +
    +
    + + + +
    + + +
    -
    - -
    -
    + + + +
    diff --git a/application/admin/view/statistics/aftersale/test.html b/application/admin/view/statistics/aftersale/test.html new file mode 100644 index 0000000..50d154f --- /dev/null +++ b/application/admin/view/statistics/aftersale/test.html @@ -0,0 +1,968 @@ +array:138 [ +0 => array:5 [ +"id" => 598 +"title" => "刷墙补漆" +"key_word" => null +"pid" => 0 +"status_text" => "" +] +1 => array:5 [ +"id" => 614 +"title" => "美缝施工" +"key_word" => null +"pid" => 0 +"status_text" => "" +] +2 => array:5 [ +"id" => 619 +"title" => "拆除清运" +"key_word" => null +"pid" => 0 +"status_text" => "" +] +3 => array:5 [ +"id" => 627 +"title" => "家政保洁" +"key_word" => null +"pid" => 0 +"status_text" => "" +] +4 => array:5 [ +"id" => 638 +"title" => "电路维修" +"key_word" => null +"pid" => 0 +"status_text" => "" +] +5 => array:5 [ +"id" => 646 +"title" => "水路维修" +"key_word" => null +"pid" => 0 +"status_text" => "" +] +6 => array:5 [ +"id" => 668 +"title" => "开锁换锁" +"key_word" => null +"pid" => 0 +"status_text" => "" +] +7 => array:5 [ +"id" => 676 +"title" => "门窗维修" +"key_word" => null +"pid" => 0 +"status_text" => "" +] +8 => array:5 [ +"id" => 686 +"title" => "收纳整理" +"key_word" => null +"pid" => 0 +"status_text" => "" +] +9 => array:5 [ +"id" => 695 +"title" => "沙发翻新" +"key_word" => null +"pid" => 0 +"status_text" => "" +] +10 => array:5 [ +"id" => 704 +"title" => "地板维修" +"key_word" => null +"pid" => 0 +"status_text" => "" +] +11 => array:5 [ +"id" => 719 +"title" => "软装清洗" +"key_word" => null +"pid" => 0 +"status_text" => "" +] +12 => array:5 [ +"id" => 599 +"title" => "墙面修补" +"key_word" => null +"pid" => 598 +"status_text" => "" +] +13 => array:5 [ +"id" => 607 +"title" => "墙面刷漆" +"key_word" => null +"pid" => 598 +"status_text" => "" +] +14 => array:5 [ +"id" => 610 +"title" => "墙面翻新" +"key_word" => null +"pid" => 598 +"status_text" => "" +] +15 => array:5 [ +"id" => 600 +"title" => "裂缝" +"key_word" => null +"pid" => 599 +"status_text" => "" +] +16 => array:5 [ +"id" => 601 +"title" => "孔洞" +"key_word" => null +"pid" => 599 +"status_text" => "" +] +17 => array:5 [ +"id" => 602 +"title" => "起皮" +"key_word" => null +"pid" => 599 +"status_text" => "" +] +18 => array:5 [ +"id" => 603 +"title" => "发霉" +"key_word" => null +"pid" => 599 +"status_text" => "" +] +19 => array:5 [ +"id" => 604 +"title" => "鼓包" +"key_word" => null +"pid" => 599 +"status_text" => "" +] +20 => array:5 [ +"id" => 605 +"title" => "墙面污渍" +"key_word" => null +"pid" => 599 +"status_text" => "" +] +21 => array:5 [ +"id" => 606 +"title" => "划痕" +"key_word" => null +"pid" => 599 +"status_text" => "" +] +22 => array:5 [ +"id" => 608 +"title" => "乳胶漆" +"key_word" => null +"pid" => 607 +"status_text" => "" +] +23 => array:5 [ +"id" => 609 +"title" => "艺术漆" +"key_word" => null +"pid" => 607 +"status_text" => "" +] +24 => array:5 [ +"id" => 611 +"title" => "毛坯房刷漆" +"key_word" => null +"pid" => 610 +"status_text" => "" +] +25 => array:5 [ +"id" => 612 +"title" => "局部翻新" +"key_word" => null +"pid" => 610 +"status_text" => "" +] +26 => array:5 [ +"id" => 613 +"title" => "整体翻新" +"key_word" => null +"pid" => 610 +"status_text" => "" +] +27 => array:5 [ +"id" => 615 +"title" => "瓷砖美缝" +"key_word" => null +"pid" => 614 +"status_text" => "" +] +28 => array:5 [ +"id" => 616 +"title" => "石材美缝" +"key_word" => null +"pid" => 614 +"status_text" => "" +] +29 => array:5 [ +"id" => 617 +"title" => "马赛克美缝" +"key_word" => null +"pid" => 614 +"status_text" => "" +] +30 => array:5 [ +"id" => 618 +"title" => "美缝清理维护" +"key_word" => null +"pid" => 614 +"status_text" => "" +] +31 => array:5 [ +"id" => 620 +"title" => "墙体拆除" +"key_word" => null +"pid" => 619 +"status_text" => "" +] +32 => array:5 [ +"id" => 621 +"title" => "地面拆除" +"key_word" => null +"pid" => 619 +"status_text" => "" +] +33 => array:5 [ +"id" => 622 +"title" => "吊顶拆除" +"key_word" => null +"pid" => 619 +"status_text" => "" +] +34 => array:5 [ +"id" => 623 +"title" => "门窗拆除" +"key_word" => null +"pid" => 619 +"status_text" => "" +] +35 => array:5 [ +"id" => 624 +"title" => "家具拆除" +"key_word" => null +"pid" => 619 +"status_text" => "" +] +36 => array:5 [ +"id" => 625 +"title" => "垃圾清运" +"key_word" => null +"pid" => 619 +"status_text" => "" +] +37 => array:5 [ +"id" => 626 +"title" => "建筑废料处理" +"key_word" => null +"pid" => 619 +"status_text" => "" +] +38 => array:5 [ +"id" => 628 +"title" => "日常保洁" +"key_word" => null +"pid" => 627 +"status_text" => "" +] +39 => array:5 [ +"id" => 629 +"title" => "深度保洁" +"key_word" => null +"pid" => 627 +"status_text" => "" +] +40 => array:5 [ +"id" => 630 +"title" => "开荒保洁" +"key_word" => null +"pid" => 627 +"status_text" => "" +] +41 => array:5 [ +"id" => 631 +"title" => "玻璃清洗" +"key_word" => null +"pid" => 627 +"status_text" => "" +] +42 => array:5 [ +"id" => 632 +"title" => "地毯清洗" +"key_word" => null +"pid" => 627 +"status_text" => "" +] +43 => array:5 [ +"id" => 633 +"title" => "沙发清洗" +"key_word" => null +"pid" => 627 +"status_text" => "" +] +44 => array:5 [ +"id" => 634 +"title" => "窗帘清洗" +"key_word" => null +"pid" => 627 +"status_text" => "" +] +45 => array:5 [ +"id" => 635 +"title" => "家电清洗" +"key_word" => null +"pid" => 627 +"status_text" => "" +] +46 => array:5 [ +"id" => 636 +"title" => "卫生间除垢" +"key_word" => null +"pid" => 627 +"status_text" => "" +] +47 => array:5 [ +"id" => 637 +"title" => "厨房除油" +"key_word" => null +"pid" => 627 +"status_text" => "" +] +48 => array:5 [ +"id" => 639 +"title" => "电路检修" +"key_word" => null +"pid" => 638 +"status_text" => "" +] +49 => array:5 [ +"id" => 640 +"title" => "灯具安装维修" +"key_word" => null +"pid" => 638 +"status_text" => "" +] +50 => array:5 [ +"id" => 641 +"title" => "开关插座安装维修" +"key_word" => null +"pid" => 638 +"status_text" => "" +] +51 => array:5 [ +"id" => 642 +"title" => "配电箱维修" +"key_word" => null +"pid" => 638 +"status_text" => "" +] +52 => array:5 [ +"id" => 643 +"title" => "线路改造" +"key_word" => null +"pid" => 638 +"status_text" => "" +] +53 => array:5 [ +"id" => 644 +"title" => "电器维修" +"key_word" => null +"pid" => 638 +"status_text" => "" +] +54 => array:5 [ +"id" => 645 +"title" => "智能家居安装调试" +"key_word" => null +"pid" => 638 +"status_text" => "" +] +55 => array:5 [ +"id" => 647 +"title" => "水路维修" +"key_word" => null +"pid" => 646 +"status_text" => "" +] +56 => array:5 [ +"id" => 654 +"title" => "水路改造" +"key_word" => null +"pid" => 646 +"status_text" => "" +] +57 => array:5 [ +"id" => 655 +"title" => "漏水" +"key_word" => null +"pid" => 646 +"status_text" => "" +] +58 => array:5 [ +"id" => 656 +"title" => "堵塞" +"key_word" => null +"pid" => 646 +"status_text" => "" +] +59 => array:5 [ +"id" => 657 +"title" => "噪音" +"key_word" => null +"pid" => 646 +"status_text" => "" +] +60 => array:5 [ +"id" => 658 +"title" => "水压异常" +"key_word" => null +"pid" => 646 +"status_text" => "" +] +61 => array:5 [ +"id" => 659 +"title" => "水质浑浊" +"key_word" => null +"pid" => 646 +"status_text" => "" +] +62 => array:5 [ +"id" => 660 +"title" => "管道疏通" +"key_word" => null +"pid" => 646 +"status_text" => "" +] +63 => array:5 [ +"id" => 667 +"title" => "化粪池清理" +"key_word" => null +"pid" => 646 +"status_text" => "" +] +64 => array:5 [ +"id" => 648 +"title" => "水龙头更换维修" +"key_word" => null +"pid" => 647 +"status_text" => "" +] +65 => array:5 [ +"id" => 649 +"title" => "角阀更换维修" +"key_word" => null +"pid" => 647 +"status_text" => "" +] +66 => array:5 [ +"id" => 650 +"title" => "马桶维修" +"key_word" => null +"pid" => 647 +"status_text" => "" +] +67 => array:5 [ +"id" => 651 +"title" => "地漏维修" +"key_word" => null +"pid" => 647 +"status_text" => "" +] +68 => array:5 [ +"id" => 652 +"title" => "热水器维修" +"key_word" => null +"pid" => 647 +"status_text" => "" +] +69 => array:5 [ +"id" => 653 +"title" => "净水器安装维修" +"key_word" => null +"pid" => 647 +"status_text" => "" +] +70 => array:5 [ +"id" => 661 +"title" => "下水道疏通" +"key_word" => null +"pid" => 660 +"status_text" => "" +] +71 => array:5 [ +"id" => 662 +"title" => "马桶疏通" +"key_word" => null +"pid" => 660 +"status_text" => "" +] +72 => array:5 [ +"id" => 663 +"title" => "地漏疏通" +"key_word" => null +"pid" => 660 +"status_text" => "" +] +73 => array:5 [ +"id" => 664 +"title" => "洗手池疏通" +"key_word" => null +"pid" => 660 +"status_text" => "" +] +74 => array:5 [ +"id" => 665 +"title" => "浴缸疏通" +"key_word" => null +"pid" => 660 +"status_text" => "" +] +75 => array:5 [ +"id" => 666 +"title" => "厨房管道疏通" +"key_word" => null +"pid" => 660 +"status_text" => "" +] +76 => array:5 [ +"id" => 669 +"title" => "门锁开锁" +"key_word" => null +"pid" => 668 +"status_text" => "" +] +77 => array:5 [ +"id" => 670 +"title" => "汽车开锁" +"key_word" => null +"pid" => 668 +"status_text" => "" +] +78 => array:5 [ +"id" => 671 +"title" => "保险柜开锁" +"key_word" => null +"pid" => 668 +"status_text" => "" +] +79 => array:5 [ +"id" => 672 +"title" => "门锁更换" +"key_word" => null +"pid" => 668 +"status_text" => "" +] +80 => array:5 [ +"id" => 673 +"title" => "指纹锁安装" +"key_word" => null +"pid" => 668 +"status_text" => "" +] +81 => array:5 [ +"id" => 674 +"title" => "智能锁安装" +"key_word" => null +"pid" => 668 +"status_text" => "" +] +82 => array:5 [ +"id" => 675 +"title" => "锁具维修" +"key_word" => null +"pid" => 668 +"status_text" => "" +] +83 => array:5 [ +"id" => 677 +"title" => "门窗安装" +"key_word" => null +"pid" => 676 +"status_text" => "" +] +84 => array:5 [ +"id" => 678 +"title" => "门窗维修" +"key_word" => null +"pid" => 676 +"status_text" => "" +] +85 => array:5 [ +"id" => 679 +"title" => "门窗更换" +"key_word" => null +"pid" => 676 +"status_text" => "" +] +86 => array:5 [ +"id" => 680 +"title" => "门窗密封条更换" +"key_word" => null +"pid" => 676 +"status_text" => "" +] +87 => array:5 [ +"id" => 681 +"title" => "门窗五金件更换" +"key_word" => null +"pid" => 676 +"status_text" => "" +] +88 => array:5 [ +"id" => 682 +"title" => "纱窗安装维修" +"key_word" => null +"pid" => 676 +"status_text" => "" +] +89 => array:5 [ +"id" => 683 +"title" => "变形" +"key_word" => null +"pid" => 676 +"status_text" => "" +] +90 => array:5 [ +"id" => 684 +"title" => "开裂" +"key_word" => null +"pid" => 676 +"status_text" => "" +] +91 => array:5 [ +"id" => 685 +"title" => "漏风" +"key_word" => null +"pid" => 676 +"status_text" => "" +] +92 => array:5 [ +"id" => 687 +"title" => "衣橱整理" +"key_word" => null +"pid" => 686 +"status_text" => "" +] +93 => array:5 [ +"id" => 688 +"title" => "厨房整理" +"key_word" => null +"pid" => 686 +"status_text" => "" +] +94 => array:5 [ +"id" => 689 +"title" => "书房整理" +"key_word" => null +"pid" => 686 +"status_text" => "" +] +95 => array:5 [ +"id" => 690 +"title" => "儿童房整理" +"key_word" => null +"pid" => 686 +"status_text" => "" +] +96 => array:5 [ +"id" => 691 +"title" => "客厅整理" +"key_word" => null +"pid" => 686 +"status_text" => "" +] +97 => array:5 [ +"id" => 692 +"title" => "储物间整理" +"key_word" => null +"pid" => 686 +"status_text" => "" +] +98 => array:5 [ +"id" => 693 +"title" => "搬家整理" +"key_word" => null +"pid" => 686 +"status_text" => "" +] +99 => array:5 [ +"id" => 694 +"title" => "空间规划" +"key_word" => null +"pid" => 686 +"status_text" => "" +] +100 => array:5 [ +"id" => 696 +"title" => "沙发清洗" +"key_word" => null +"pid" => 695 +"status_text" => "" +] +101 => array:5 [ +"id" => 697 +"title" => "沙发维修" +"key_word" => null +"pid" => 695 +"status_text" => "" +] +102 => array:5 [ +"id" => 698 +"title" => "沙发换皮" +"key_word" => null +"pid" => 695 +"status_text" => "" +] +103 => array:5 [ +"id" => 699 +"title" => "沙发换布" +"key_word" => null +"pid" => 695 +"status_text" => "" +] +104 => array:5 [ +"id" => 700 +"title" => "沙发更换海绵" +"key_word" => null +"pid" => 695 +"status_text" => "" +] +105 => array:5 [ +"id" => 701 +"title" => "沙发框架加固" +"key_word" => null +"pid" => 695 +"status_text" => "" +] +106 => array:5 [ +"id" => 702 +"title" => "破损" +"key_word" => null +"pid" => 695 +"status_text" => "" +] +107 => array:5 [ +"id" => 703 +"title" => "塌陷" +"key_word" => null +"pid" => 695 +"status_text" => "" +] +108 => array:5 [ +"id" => 705 +"title" => "地板安装" +"key_word" => null +"pid" => 704 +"status_text" => "" +] +109 => array:5 [ +"id" => 706 +"title" => "地板维修" +"key_word" => null +"pid" => 704 +"status_text" => "" +] +110 => array:5 [ +"id" => 707 +"title" => "地板更换" +"key_word" => null +"pid" => 704 +"status_text" => "" +] +111 => array:5 [ +"id" => 708 +"title" => "地板打磨翻新" +"key_word" => null +"pid" => 704 +"status_text" => "" +] +112 => array:5 [ +"id" => 709 +"title" => "地板打蜡保养" +"key_word" => null +"pid" => 704 +"status_text" => "" +] +113 => array:5 [ +"id" => 710 +"title" => "木地板防潮处理" +"key_word" => null +"pid" => 704 +"status_text" => "" +] +114 => array:5 [ +"id" => 711 +"title" => "地板开裂" +"key_word" => null +"pid" => 704 +"status_text" => "" +] +115 => array:5 [ +"id" => 712 +"title" => "地板起供" +"key_word" => null +"pid" => 704 +"status_text" => "" +] +116 => array:5 [ +"id" => 713 +"title" => "地板磨损" +"key_word" => null +"pid" => 704 +"status_text" => "" +] +117 => array:5 [ +"id" => 714 +"title" => "地板异响" +"key_word" => null +"pid" => 704 +"status_text" => "" +] +118 => array:5 [ +"id" => 715 +"title" => "地板变色" +"key_word" => null +"pid" => 704 +"status_text" => "" +] +119 => array:5 [ +"id" => 716 +"title" => "地板受潮" +"key_word" => null +"pid" => 704 +"status_text" => "" +] +120 => array:5 [ +"id" => 717 +"title" => "地板松动" +"key_word" => null +"pid" => 704 +"status_text" => "" +] +121 => array:5 [ +"id" => 718 +"title" => "地板老化" +"key_word" => null +"pid" => 704 +"status_text" => "" +] +122 => array:5 [ +"id" => 720 +"title" => "窗帘清洗" +"key_word" => null +"pid" => 719 +"status_text" => "" +] +123 => array:5 [ +"id" => 721 +"title" => "地毯清洗" +"key_word" => null +"pid" => 719 +"status_text" => "" +] +124 => array:5 [ +"id" => 722 +"title" => "沙发清洗" +"key_word" => null +"pid" => 719 +"status_text" => "" +] +125 => array:5 [ +"id" => 723 +"title" => "床垫清洗" +"key_word" => null +"pid" => 719 +"status_text" => "" +] +126 => array:5 [ +"id" => 724 +"title" => "抱枕清洗" +"key_word" => null +"pid" => 719 +"status_text" => "" +] +127 => array:5 [ +"id" => 725 +"title" => "桌布清洗" +"key_word" => null +"pid" => 719 +"status_text" => "" +] +128 => array:5 [ +"id" => 726 +"title" => "布艺家具清洗" +"key_word" => null +"pid" => 719 +"status_text" => "" +] +129 => array:5 [ +"id" => 727 +"title" => "家电清洗" +"key_word" => null +"pid" => 719 +"status_text" => "" +] +130 => array:5 [ +"id" => 728 +"title" => "空调清洗" +"key_word" => null +"pid" => 719 +"status_text" => "" +] +131 => array:5 [ +"id" => 729 +"title" => "油烟机清洗" +"key_word" => null +"pid" => 719 +"status_text" => "" +] +132 => array:5 [ +"id" => 730 +"title" => "冰箱清洗" +"key_word" => null +"pid" => 719 +"status_text" => "" +] +133 => array:5 [ +"id" => 731 +"title" => "洗衣机清洗" +"key_word" => null +"pid" => 719 +"status_text" => "" +] +134 => array:5 [ +"id" => 732 +"title" => "热水器清洗" +"key_word" => null +"pid" => 719 +"status_text" => "" +] +135 => array:5 [ +"id" => 733 +"title" => "微波炉清洗" +"key_word" => null +"pid" => 719 +"status_text" => "" +] +136 => array:5 [ +"id" => 734 +"title" => "烤箱清洗" +"key_word" => null +"pid" => 719 +"status_text" => "" +] +137 => array:5 [ +"id" => 735 +"title" => "饮水机清洗" +"key_word" => null +"pid" => 719 +"status_text" => "" +] +] \ No newline at end of file diff --git a/public/assets/css/select.css b/public/assets/css/select.css index 68a6043..6c82287 100644 --- a/public/assets/css/select.css +++ b/public/assets/css/select.css @@ -36,6 +36,14 @@ transition: all .3s; pointer-events: none; } +.zd-input__close { + position: absolute; + height: 100%; + right: 30px; + top: 0; + text-align: center; + color: #c0c4cc; +} .zd-input__suffix-inner { pointer-events: all; diff --git a/public/assets/js/backend/statistics/aftersale.js b/public/assets/js/backend/statistics/aftersale.js index a2b8ae8..26705eb 100644 --- a/public/assets/js/backend/statistics/aftersale.js +++ b/public/assets/js/backend/statistics/aftersale.js @@ -15,6 +15,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'addtabs' Controller.api.second(); }else if (tabVal === 'third'){ Controller.api.third(); + }else if (tabVal === 'fourth'){ + Controller.api.fourth(); } }); Controller.api.first(); @@ -70,6 +72,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'addtabs' }); }, + second: function (){ Table.api.init(); // 表格2 @@ -162,6 +165,53 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'addtabs' }); Controller.api.itemspicker(); }, + + fourth: function (){ + Table.api.init(); + // 表格2 + var table = $("#table4"); + table.bootstrapTable({ + url: 'statistics/aftersale/worker', + sortName: 'id', + search: false, + commonSearch: false, + visible: false, + showToggle: false, + showColumns: false, + showExport: true, + searchFormVisible: true, + columns: [ + [ + {field: 'name', title: '名称', operate: false}, + {field: 'tel', title: '电话', operate: false}, + {field: 'order_total', title: '订单总数', operate: false}, + {field: 'after_total', title: '退款订单数', operate: false}, + {field: 'rate', title: '退款率', operate: false}, + ] + ] + }); + // 为表格2绑定事件 + Table.api.bindevent(table); + + $('#first-search4').on('click', function () { + + const range = $('#daterange-table4').val(); + const keyword = $('#keyword4').val(); + let data = ''; + if (range !== ''){ + data += 'range=' + range; + } + if (keyword !== ''){ + data += '&keyword=' + keyword; + } + // data = encodeURIComponent(data); + $("#table4").bootstrapTable('refresh',{ + url:'statistics/aftersale/worker?' + data, + }); + }); + + }, + datepicker: function () { var ranges = {}; ranges[__('Today')] = [Moment().startOf('day'), Moment().endOf('day')]; diff --git a/public/assets/js/cascader.js b/public/assets/js/cascader.js index dc09116..1416d66 100644 --- a/public/assets/js/cascader.js +++ b/public/assets/js/cascader.js @@ -71,6 +71,13 @@ this.$container = this.$el.wrap(`
    `) .wrap(`
    `).addClass(this.CLASS.input).prop('readonly', !this.options.search).closest('.' + this.CLASS.wrap); + this.$closeBtn = $(` + + + + + + `).insertAfter(this.$el); //文本框右侧图标 this.$arrow = $(` @@ -85,6 +92,7 @@ `).insertAfter(this.$el); + //下拉列表 this.$dropdownWrap = $(`
    `).appendTo(this.$container).wrap(`
    `); @@ -107,12 +115,13 @@ }, this)); this.$container.on('click.item', '.' + this.CLASS.menuNode, $.proxy(this._nodeClick, this)) + .on('click.item', '.' + 'zd-input__close', $.proxy(this._clear, this)) .on('dblclick.item', '.' + this.CLASS.menuNode, $.proxy(this._nodeDoubleClick, this)); this.$el.on('keyup.wrap', $.proxy(this._keyup, this)); this.$el.on('input', $.proxy(function (event) { - this.search(this.$el.val()) + this.search(this.$el.val()); }, this)); } ZdCascader.prototype._wrapClick = function () { @@ -157,6 +166,13 @@ } else this._loadChildren($that); } + ZdCascader.prototype._clear = function (event) { + if (this.options.onChange && typeof this.options.onChange === "function") { + this.options.onChange(this, {id:null}, ''); + } + this.$el.val(''); + event.stopPropagation(); + } ZdCascader.prototype._nodeDoubleClick = function (event) { var $that = event.currentTarget ? $(event.currentTarget) : $(event); // li var $wrap = $that.closest('.' + this.CLASS.menuWrap);