userslog_418_3
This commit is contained in:
@@ -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');
|
||||
|
||||
@@ -10,6 +10,14 @@
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w80">门店:</label>
|
||||
<div class="am-para-inline w120">
|
||||
<select title="类型" name="type" v-model="params.type">
|
||||
<option value="">选择类型</option>
|
||||
<option :value="i" v-for="(v,i) in typeAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-para-inline w120">
|
||||
<select title="城市" name="city_id" v-model="params.city_id">
|
||||
<option value="">选择城市</option>
|
||||
@@ -35,9 +43,9 @@
|
||||
</div>
|
||||
<div class="am-form-group" style="margin-bottom: 0px;"></div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w80">日志日期:</label>
|
||||
<label class="am-para-label w80">日期:</label>
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-para-inline w300">
|
||||
<div class="am-para-inline w250">
|
||||
<input id="id-time" name="time" type="text" value="<?= $params['time'] ?>"
|
||||
placeholder="开始时间 ~ 结束时间" autocomplete="off"/>
|
||||
</div>
|
||||
@@ -71,31 +79,29 @@
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="10%"><span>顾问名字</span></th>
|
||||
<th width="20%"><span>门店</span></th>
|
||||
<th width="15%"><span>类型</span></th>
|
||||
<th width="10%"><span>城市</span></th>
|
||||
<th width="10%"><span>到店数</span></th>
|
||||
<th width="10%"><span>订单数</span></th>
|
||||
<th width="10%"><span>开票数</span></th>
|
||||
<th width="10%"><span>顾问</span></th>
|
||||
<th width="20%"><span>客户数</span></th>
|
||||
<th width="10%"><span>进店数</span></th>
|
||||
<th width="10%"><span>跟进数</span></th>
|
||||
<th width="10%"><span>客户数</span></th>
|
||||
<th width="10%"><span>日志日期</span></th>
|
||||
<th width="10%"><span>订单数</span></th>
|
||||
<th width="10%"><span>战败数</span></th>
|
||||
<th width="10%"><span>开票数</span></th>
|
||||
<th width="10%"><span>日期</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<? if ($lists) {
|
||||
foreach ($lists as $v) { ?>
|
||||
<tr>
|
||||
<td><?= $v['uname'] ?></td>
|
||||
<td><?= $v['biz_name'] ?></td>
|
||||
<td><?= $v['biz_type'] ?></a></td>
|
||||
<td><?= $v['city_name'] ?></td>
|
||||
<td><?= $v['a_num'] ?></td>
|
||||
<td><?= $v['orders'] ?></td>
|
||||
<td><?= $v['bills'] ?></td>
|
||||
<td><?= $v['follows'] ?></td>
|
||||
<td><?= $v['uname'] ?></td>
|
||||
<td><?= $v['customers'] ?></td>
|
||||
<td><?= $v['a_num'] ?></td>
|
||||
<td><?= $v['follows'] ?></td>
|
||||
<td><?= $v['orders'] ?></td>
|
||||
<td><?= $v['defeats'] ?></td>
|
||||
<td><?= $v['bills'] ?></td>
|
||||
<td><?= $v['log_date'] ?></td>
|
||||
</tr>
|
||||
<? }
|
||||
@@ -143,6 +149,7 @@
|
||||
el: '.coms-table-wrap',
|
||||
data: {
|
||||
params: {},
|
||||
typeAry: [],//城市
|
||||
cityAry: [],//城市
|
||||
countyAry: [],//行政区
|
||||
bizAry: [],//门店
|
||||
@@ -150,6 +157,7 @@
|
||||
mounted: function () {
|
||||
var vm = this;
|
||||
vm.params = <?=json_encode($params)?>;
|
||||
vm.typeAry = <?=json_encode($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('');
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user