From d0f34871d623aefdb6832a050b751e9b7c2e1a94 Mon Sep 17 00:00:00 2001 From: dengbw Date: Mon, 18 Apr 2022 16:51:26 +0800 Subject: [PATCH] userslog_418_3 --- admin/controllers/app/licheb/Userslog.php | 55 ++++++++++++----------- admin/views/app/licheb/userslog/lists.php | 43 +++++++++++------- api/controllers/plan/Licheb.php | 5 ++- 3 files changed, 58 insertions(+), 45 deletions(-) diff --git a/admin/controllers/app/licheb/Userslog.php b/admin/controllers/app/licheb/Userslog.php index 0898e81f..d56c988d 100644 --- a/admin/controllers/app/licheb/Userslog.php +++ b/admin/controllers/app/licheb/Userslog.php @@ -29,7 +29,9 @@ class Userslog extends HD_Controller $params = $this->input->get(); $params['page'] = $params['page'] ? intval($params['page']) : 1; $params['size'] = $params['size'] ? intval($params['size']) : 20; - $this->data = $this->dataSelect($params); + $data = $this->dataSelect($params); + $data['typeAry'] = $this->mdBiz->type_ary(); + $this->data = $data; $this->show_view('app/licheb/userslog/lists', true); } @@ -57,6 +59,11 @@ class Userslog extends HD_Controller $params['county_id'] = ''; $params['biz_id'] = ''; } + if ($params['type']) { + $where["type"] = $params['type']; + } else { + $params['type'] = ''; + } if ($params['time']) { $time = explode(' ~ ', $params['time']); $time[0] && $where["log_date>="] = $time[0]; @@ -82,19 +89,24 @@ class Userslog extends HD_Controller $offlineSources = $this->mdCustomers->offlineSources(); $typeAry = $this->mdBiz->type_ary(); foreach ($res as $v) { - $uname = $biz_name = $biz_type = $city_name = ''; + $uname = $biz_name = $biz_type = $customers_info = ''; + $customers = 0; $map_sale[$v['sale_id']] && $uname = $map_sale[$v['sale_id']]; $map_biz[$v['biz_id']]['biz_name'] && $biz_name = $map_biz[$v['biz_id']]['biz_name']; $map_biz[$v['biz_id']]['type'] && $biz_type = $typeAry[$map_biz[$v['biz_id']]['type']]; - if ($v['city_id']) { - $re_area = $this->mdArea->get(array('city_id' => $v['city_id'])); - $re_area['city_name'] && $city_name = $re_area['city_name']; - } - $customers = 0; foreach ($offlineSources as $key1 => $value1) { - $customers += intval($v['customer_' . $key1]); + $nums = intval($v['customer_' . $key1]); + if ($nums) { + $customers += $nums; + if ($customers_info) { + $customers_info = $customers_info . '+' . $value1['name'] . '(' . $nums . ')'; + } else { + $customers_info = $value1['name'] . '(' . $nums . ')'; + } + } } - $lists[] = ['uname' => $uname, 'biz_type' => $biz_type, 'biz_name' => $biz_name, 'city_name' => $city_name + $customers_info && $customers = $customers . '=' . $customers_info; + $lists[] = ['uname' => $uname, 'biz_type' => $biz_type, 'biz_name' => $biz_name, 'defeats' => $v['defeats'] , 'a_num' => $v['a_num'], 'orders' => $v['orders'], 'bills' => $v['bills'], 'follows' => $v['follows'] , 'customers' => $customers, 'log_date' => $v['log_date']]; } @@ -136,29 +148,18 @@ class Userslog extends HD_Controller $res = $this->dataSelect($params); $fileName = $res['_title']; foreach ($res['lists'] as $key => $value) { - $temp['uname'] = $value['uname']; - $temp['biz_name'] = $value['biz_name']; - $temp['biz_type'] = $value['biz_type']; - $temp['city_name'] = $value['city_name']; - $temp['a_num'] = $value['a_num']; - $temp['orders'] = $value['orders']; - $temp['bills'] = $value['bills']; - $temp['follows'] = $value['follows']; - $temp['customers'] = $value['customers']; - $temp['log_date'] = $value['log_date']; - $data[] = $temp; + $data[] = $value; } $indexs = [ - 'uname' => '顾问名字', 'biz_name' => '门店', - 'biz_type' => '类型', - 'city_name' => '城市', - 'a_num' => '到店数', + 'uname' => '顾问', + 'customers' => '客户数', + 'a_num' => '进店数', + 'follows' => '跟进数', "orders" => "订单数", + "defeats" => "战败数", "bills" => "开票数", - "follows" => "跟进数", - "customers" => "客户数", - "log_date" => "日志日期", + "log_date" => "日期", ]; array_unshift($data, $indexs); $this->load->library('excel'); diff --git a/admin/views/app/licheb/userslog/lists.php b/admin/views/app/licheb/userslog/lists.php index 509b5dcd..df157566 100644 --- a/admin/views/app/licheb/userslog/lists.php +++ b/admin/views/app/licheb/userslog/lists.php @@ -10,6 +10,14 @@
+
+ +
+
+
@@ -71,31 +79,29 @@ - - - - - - + + + - - + + + + - - - - - - - + + + + + + ; + vm.typeAry = ; vm.init_citys(); }, methods: { @@ -180,6 +188,7 @@ var that = this; that.params.city_id = ''; that.params.uname = ''; + that.params.type = ''; $('#id-time').val(''); } }, diff --git a/api/controllers/plan/Licheb.php b/api/controllers/plan/Licheb.php index 05cdc1a6..6bf4745b 100644 --- a/api/controllers/plan/Licheb.php +++ b/api/controllers/plan/Licheb.php @@ -80,6 +80,9 @@ class Licheb extends HD_Controller $follows = $this->mdCustomerOpLogs->count(['uid' => $sale_id, 'type<>' => 3, 'c_time>=' => $s_time, 'c_time<=' => $e_time, "customer_id in(select id from lc_receiver_customers where admin_id={$sale_id} and biz_id={$biz_id})" => null], 'distinct(customer_id)' ); + $defeats = $this->mdCustomerOpLogs->count(['uid' => $sale_id, 'type' => 7, 'c_time>=' => $s_time, 'c_time<=' => $e_time, + "customer_id in(select id from lc_receiver_customers where admin_id={$sale_id} and biz_id={$biz_id})" => null] + ); $orders = $this->mdOrdersV2->count(['sale_id' => $sale_id, 'biz_id' => $biz_id, 'status>=' => 0, 'order_time>=' => "{$log_date} 00:00:00", 'order_time<=' => "{$log_date} 23:59:59"] ); @@ -87,7 +90,7 @@ class Licheb extends HD_Controller 'bill_time>=' => "{$log_date} 00:00:00", 'bill_time<=' => "{$log_date} 23:59:59"] ); $add_item = ['sale_id' => $sale_id, 'biz_id' => $biz_id, 'type' => $type, 'city_id' => $city_id, 'a_num' => $a_num - , 'orders' => $orders, 'bills' => $bills, 'follows' => $follows, 'log_date' => $log_date, 'c_time' => time()]; + , 'orders' => $orders, 'bills' => $bills, 'follows' => $follows, 'defeats' => $defeats, 'log_date' => $log_date, 'c_time' => time()]; $customer_json = ''; foreach ($offlineSources as $key1 => $value1) { $customer_num1 = $this->mdCustomers->count(['of_id' => $key1, 'admin_id' => $sale_id
顾问名字 门店类型城市到店数订单数开票数顾问客户数进店数 跟进数客户数日志日期订单数战败数开票数日期