diff --git a/admin/controllers/app/licheb/Main.php b/admin/controllers/app/licheb/Main.php index d56cfd6c..deaf3883 100644 --- a/admin/controllers/app/licheb/Main.php +++ b/admin/controllers/app/licheb/Main.php @@ -90,14 +90,14 @@ class Main extends HD_Controller array('name' => '查看详情', 'url' => '/live/polyv'), ), ); -// $value = $this->mdUsersLog->count(); -// $list[] = array( -// 'title' => '顾问日志', -// 'value' => $value, -// 'btns' => array( -// array('name' => '查看详情', 'url' => 'app/licheb/userslog'), -// ), -// ); + $value = $this->mdUsersLog->count(); + $list[] = array( + 'title' => '顾问日志', + 'value' => $value, + 'btns' => array( + array('name' => '查看详情', 'url' => 'app/licheb/userslog'), + ), + ); $conditions[] = array('icon' => 'am-icon-user', 'list' => $list); /*小程序设置 end*/ diff --git a/admin/controllers/app/licheb/Userslog.php b/admin/controllers/app/licheb/Userslog.php index 4500ac00..0898e81f 100644 --- a/admin/controllers/app/licheb/Userslog.php +++ b/admin/controllers/app/licheb/Userslog.php @@ -29,6 +29,12 @@ 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); + $this->show_view('app/licheb/userslog/lists', true); + } + + private function dataSelect($params) + { $lists = $where = []; if ($params['uname']) { $where["sale_id in(select id from lc_app_licheb_users where uname like '%{$params['uname']}%')"] = null; @@ -93,14 +99,13 @@ class Userslog extends HD_Controller , 'customers' => $customers, 'log_date' => $v['log_date']]; } } - $this->data['pager'] = array('count' => ceil($total / $params['size']), 'curr' => $params['page'], 'totle' => $total); - $this->data['lists'] = $lists; - $this->data['params'] = $params; - $this->data['_title'] = "顾问日志"; - $this->show_view('app/licheb/userslog/lists', true); + $data['pager'] = array('count' => ceil($total / $params['size']), 'curr' => $params['page'], 'totle' => $total); + $data['lists'] = $lists; + $data['params'] = $params; + $data['_title'] = "顾问日志"; + return $data; } - public function get() { } @@ -124,5 +129,39 @@ class Userslog extends HD_Controller public function export() { + $params = $this->input->get(); + $params['page'] = 1; + $params['size'] = 10000; + $data = $indexs = array(); + $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; + } + $indexs = [ + 'uname' => '顾问名字', + 'biz_name' => '门店', + 'biz_type' => '类型', + 'city_name' => '城市', + 'a_num' => '到店数', + "orders" => "订单数", + "bills" => "开票数", + "follows" => "跟进数", + "customers" => "客户数", + "log_date" => "日志日期", + ]; + array_unshift($data, $indexs); + $this->load->library('excel'); + $this->excel->out_csv($data, $indexs, $fileName . "_" . date('YmdHis')); } } \ No newline at end of file diff --git a/admin/views/app/licheb/userslog/lists.php b/admin/views/app/licheb/userslog/lists.php index 835c0537..509b5dcd 100644 --- a/admin/views/app/licheb/userslog/lists.php +++ b/admin/views/app/licheb/userslog/lists.php @@ -60,6 +60,9 @@
+
+ +
@@ -176,10 +179,8 @@ reset: function () { var that = this; that.params.city_id = ''; - that.params.vin = ''; + that.params.uname = ''; $('#id-time').val(''); - $('#bd-auto1-id').val(0); - $('#bd-auto2-id').val(0); } }, watch: { @@ -245,5 +246,16 @@ } }); + $('#export').click(function () { + var count = ; + if (count > 10000) { + layer.msg('单次导出数据不能超过10000'); + return false; + } + var href = $.menu.parseUri(window.location.href); + var arr = href.split('?'); + href = '/app/licheb/userslog/export?' + arr[1]; + window.location.href = href; + }); });