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 @@
| 顾问名字 | 门店 | -类型 | -城市 | -到店数 | -订单数 | -开票数 | +顾问 | +客户数 | +进店数 | 跟进数 | -客户数 | -日志日期 | +订单数 | +战败数 | +开票数 | +日期 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| = $v['uname'] ?> | = $v['biz_name'] ?> | -= $v['biz_type'] ?> | -= $v['city_name'] ?> | -= $v['a_num'] ?> | -= $v['orders'] ?> | -= $v['bills'] ?> | -= $v['follows'] ?> | += $v['uname'] ?> | = $v['customers'] ?> | += $v['a_num'] ?> | += $v['follows'] ?> | += $v['orders'] ?> | += $v['defeats'] ?> | += $v['bills'] ?> | = $v['log_date'] ?> |