userslog_418

This commit is contained in:
dengbw
2022-04-18 13:51:34 +08:00
parent ee13b9084f
commit c2a4dd1bdd
5 changed files with 393 additions and 153 deletions
+9
View File
@@ -20,6 +20,7 @@ class Main extends HD_Controller
$this->load->model('app/material/Material_biz_model', 'mdMaterialBiz');
$this->load->model('topics/topics_model', 'mdTopics');
$this->load->model('live/Live_polyv_session_model', 'mdPolyvSession');
$this->load->model('app/licheb/app_licheb_users_log_model', 'mdUsersLog');
}
public function index()
@@ -89,6 +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'),
// ),
// );
$conditions[] = array('icon' => 'am-icon-user', 'list' => $list);
/*小程序设置 end*/
+128
View File
@@ -0,0 +1,128 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Notes:狸车宝顾问_日志
* Created on: 2022/4/15 16:43
* Created by: dengbw
*/
class Userslog extends HD_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('app/licheb/app_licheb_users_model', 'mdUsers');
$this->load->model('app/licheb/app_licheb_users_log_model', 'mdUsersLog');
$this->load->model('receiver/receiver_customers_model', 'mdCustomers');
$this->load->model("biz/biz_model", 'mdBiz');
$this->load->model('area_model', 'mdArea');
}
public function index()
{
return $this->lists();
}
public function lists()
{
$params = $this->input->get();
$params['page'] = $params['page'] ? intval($params['page']) : 1;
$params['size'] = $params['size'] ? intval($params['size']) : 20;
$lists = $where = [];
if ($params['uname']) {
$where["sale_id in(select id from lc_app_licheb_users where uname like '%{$params['uname']}%')"] = null;
}
if ($params['biz_id']) {
$where['biz_id'] = $params['biz_id'];
} else if ($params['city_id']) {
$where_biz['status'] = 1;
$params['city_id'] && $where_biz['city_id'] = $params['city_id'];
$params['county_id'] && $where_biz['county_id'] = $params['county_id'];
$res_biz = $this->mdBiz->select($where_biz, 'id desc', 0, 0, 'id');
if ($res_biz) {
$str_ids = implode(',', array_column($res_biz, 'id'));
$where["biz_id in ({$str_ids})"] = null;
} else {
$where['biz_id'] = -2;
}
} else {
$params['city_id'] = '';
$params['county_id'] = '';
$params['biz_id'] = '';
}
if ($params['time']) {
$time = explode(' ~ ', $params['time']);
$time[0] && $where["log_date>="] = $time[0];
$time[1] && $where["log_date<="] = $time[1];
}
$total = $this->mdUsersLog->count($where);
if ($total) {
$res = $this->mdUsersLog->select($where, "id desc", $params['page'], $params['size']);
$sale_ids = $biz_ids = [];
foreach ($res as $v) {
$v['sale_id'] && !in_array($v['sale_id'], $sale_ids) && $sale_ids[] = $v['sale_id'];
$v['biz_id'] && !in_array($v['biz_id'], $biz_ids) && $biz_ids[] = $v['biz_id'];
}
$map_sale = $map_biz = $map_city = [];
if ($sale_ids) {
$str_ids = implode(',', $sale_ids);
$map_sale = $this->mdUsers->map('id', 'uname', ["id in ({$str_ids})" => null]);
}
if ($biz_ids) {
$str_ids = implode(',', $biz_ids);
$map_biz = $this->mdBiz->map('id', 'biz_name,type', ["id in ({$str_ids})" => null]);
}
$offlineSources = $this->mdCustomers->offlineSources();
$typeAry = $this->mdBiz->type_ary();
foreach ($res as $v) {
$uname = $biz_name = $biz_type = $city_name = '';
$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]);
}
$lists[] = ['uname' => $uname, 'biz_type' => $biz_type, 'biz_name' => $biz_name, 'city_name' => $city_name
, 'a_num' => $v['a_num'], 'orders' => $v['orders'], 'bills' => $v['bills'], 'follows' => $v['follows']
, '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);
}
public function get()
{
}
public function add()
{
}
public function edit()
{
}
public function del()
{
}
public function batch()
{
}
public function export()
{
}
}
-153
View File
@@ -1,153 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Notes:狸车宝顾问_日志
* Created on: 2022/4/15 16:43
* Created by: dengbw
*/
class usersLog extends HD_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('items/items_stock_log_model', 'mdStockLog');
$this->load->model('items/items_model', 'mdItems');
$this->load->model('auto/auto_brand_model', 'mdAutoBrand');
$this->load->model('auto/auto_series_model', 'mdAutoSeries');
$this->load->model("biz/biz_model", 'mdBiz');
$this->load->model('area_model', 'mdArea');
}
public function index()
{
return $this->lists();
}
public function lists()
{
$params = $this->input->get();
$params['page'] = $params['page'] ? intval($params['page']) : 1;
$params['size'] = $params['size'] ? intval($params['size']) : 20;
$lists = $where = [];
$params['days_sort'] = $params['days_sort'] ? $params['days_sort'] : '';
if ($params['days_sort']) {
$order = $params['days_sort'] == 1 ? 'stay_days desc,id desc' : 'stay_days asc,id desc';
} else {
$order = "id desc";
}
if ($params['brand_id']) {
$where['brand_id'] = $params['brand_id'];
}
if ($params['s_id']) {
$where['s_id'] = $params['s_id'];
}
if ($params['vin']) {
$where["item_id in(select id from lc_items where vin like '%{$params['vin']}%')"] = null;
}
if ($params['biz_id']) {
$where['biz_id'] = $params['biz_id'];
} else if ($params['city_id']) {
$where_biz['status'] = 1;
$params['city_id'] && $where_biz['city_id'] = $params['city_id'];
$params['county_id'] && $where_biz['county_id'] = $params['county_id'];
$res_biz = $this->mdBiz->select($where_biz, 'id desc', 0, 0, 'id');
if ($res_biz) {
$str_ids = implode(',', array_column($res_biz, 'id'));
$where["biz_id in ({$str_ids})"] = null;
} else {
$where['biz_id'] = -2;
}
} else {
$params['city_id'] = '';
$params['county_id'] = '';
$params['biz_id'] = '';
}
if ($params['time']) {
$time = explode(' ~ ', $params['time']);
$time[0] && $where["log_date>="] = $time[0];
$time[1] && $where["log_date<="] = $time[1];
}
$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), "id desc", 0, 0, 'id,name');
if ($params['brand_id']) {
$autoList[2] = $this->mdAutoSeries->select(array('status' => 1, 'brand_id' => $params['brand_id']), 'id desc', 0, 0, 'id,name');
}
$total = $this->mdStockLog->count($where);
if ($total) {
$res = $this->mdStockLog->select($where, $order, $params['page'], $params['size']);
$brand_ids = $s_ids = $biz_ids = $item_ids = array();
foreach ($res as $v) {
$v['brand_id'] && !in_array($v['brand_id'], $brand_ids) && $brand_ids[] = $v['brand_id'];
$v['s_id'] && !in_array($v['s_id'], $s_ids) && $s_ids[] = $v['s_id'];
$v['biz_id'] && !in_array($v['biz_id'], $biz_ids) && $biz_ids[] = $v['biz_id'];
$v['item_id'] && !in_array($v['item_id'], $item_ids) && $item_ids[] = $v['item_id'];
}
$map_brand = $map_sery = $map_biz = $map_item = array();
if ($brand_ids) {
$str_ids = implode(',', $brand_ids);
$map_brand = $this->mdAutoBrand->map('id', 'name', ["id in ({$str_ids})" => null]);
}
if ($s_ids) {
$str_ids = implode(',', $s_ids);
$map_sery = $this->mdAutoSeries->map('id', 'name', ["id in ({$str_ids})" => null]);
}
if ($biz_ids) {
$str_ids = implode(',', $biz_ids);
$map_biz = $this->mdBiz->map('id', 'biz_name', ["id in ({$str_ids})" => null]);
}
if ($item_ids) {
$str_ids = implode(',', $item_ids);
$map_item = $this->mdItems->map('id', 'vin', ["id in ({$str_ids})" => null]);
}
foreach ($res as $v) {
$address = $map_biz[$v['biz_id']];
$re_biz = $this->mdBiz->get(array('id' => $v['biz_id']));
if ($re_biz['county_id']) {
$re_area = $this->mdArea->get(array('county_id' => $re_biz['county_id']));
$re_area && $address = "{$re_area['city_name']} {$re_area['county_name']} {$address}";
} else if ($re_biz['city_id']) {
$re_area = $this->mdArea->get(array('city_id' => $re_biz['city_id']));
$re_area && $address = "{$re_area['city_name']} {$address}";
}
$title = "{$map_brand[$v['brand_id']]}-{$map_sery[$v['s_id']]}";
$vin = $map_item[$v['item_id']];
$in_time = !$v['in_time'] || '0000-00-00 00:00:00' == $v['in_time'] ? '' : substr($v['in_time'], 0, 10);
$lists[] = ['item_id' => $v['item_id'], 'title' => $title, 'vin' => $vin, 'in_time' => $in_time, 'address' => $address
, 'log_date' => $v['log_date'], 'stay_days' => $v['stay_days']];
}
}
$this->data['pager'] = array('count' => ceil($total / $params['size']), 'curr' => $params['page'], 'totle' => $total);
$this->data['lists'] = $lists;
$this->data['autoList'] = $autoList;
$this->data['params'] = $params;
$this->data['_title'] = "库存车辆日志";
$this->show_view('items/stock/lists', true);
}
public function get()
{
}
public function add()
{
}
public function edit()
{
}
public function del()
{
}
public function batch()
{
}
public function export()
{
}
}
+249
View File
@@ -0,0 +1,249 @@
<div class="coms-table-wrap mt10">
<form id="vue-app" class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
action="app/licheb/userslog">
<div class="am-form am-form-horizontal">
<div class="am-form-group fl">
<label class="am-para-label w80">顾问名字:</label>
<div class="am-para-inline w200">
<input type="text" name="uname" placeholder="顾问名字关键字" v-model="params.uname"/>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w80">门店:</label>
<div class="am-para-inline w120">
<select title="城市" name="city_id" v-model="params.city_id">
<option value="">选择城市</option>
<option :value="v.id" v-for="(v,i) in cityAry">{{v.name}}</option>
</select>
</div>
</div>
<div class="am-form-group fl">
<div class="am-para-inline w120">
<select title="行政区" name="county_id" v-model="params.county_id" @change="set_county">
<option value="">选择行政区</option>
<option :value="v.id" v-for="(v,i) in countyAry">{{v.name}}</option>
</select>
</div>
</div>
<div class="am-form-group fl">
<div class="am-para-inline w200">
<select title="门店" name="biz_id" v-model="params.biz_id">
<option value="">选择门店</option>
<option :value="v.id" v-for="(v,i) in bizAry">{{v.title}}</option>
</select>
</div>
</div>
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<div class="am-form-group fl">
<label class="am-para-label w80">日志日期:</label>
<div class="am-form-group fl">
<div class="am-para-inline w300">
<input id="id-time" name="time" type="text" value="<?= $params['time'] ?>"
placeholder="开始时间 ~ 结束时间" autocomplete="off"/>
</div>
<div class="am-para-inline" style="padding-top: 5px;">
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="today"
data-source="id-time">今天</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="yesterday"
data-source="id-time">昨日</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="7day"
data-source="id-time">最近7天</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="30day"
data-source="id-time">最近30天</a>
</div>
</div>
</div>
<div class="am-form-group fl ml30">
<div class="am-form-group fl ml10">
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
</div>
<div class="am-form-group fl ml10">
<button type="button" class="am-btn am-btn-success am-btn-sm w100" @click="reset">重置</button>
</div>
</div>
</div>
</form>
<div class="coms-table-bd">
<div class="fr">共有<?= $pager['totle'] ?>条数据</div>
<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="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['customers'] ?></td>
<td><?= $v['log_date'] ?></td>
</tr>
<? }
} ?>
</tbody>
</table>
</div>
<div class="coms-table-ft clearfix">
<div class="hander am-form">
</div>
<div class="coms-pagination fr mr20">
<?php page_view($pager) ?>
</div>
</div>
</div>
<script>
require(['laydate', 'autocomplete'], function (laydate) {
laydate.render({
elem: '#id-time', range: '~'
});
$('.id-day-btn').click(function () {
var type = $(this).data('date'), date = '', d_obj = new Date();
var source_id = $(this).data('source') || 'id-time';
switch (type) {
case 'today':
date = d_obj.Format('yyyy-MM-dd');
date = date + ' ~ ' + date;
break;
case 'yesterday':
date = (new Date(d_obj.getTime() - 86400000)).Format('yyyy-MM-dd');
date = date + ' ~ ' + date;
break;
case '7day':
date = (new Date(d_obj.getTime() - 86400000 * 7)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
break;
case '30day':
date = (new Date(d_obj.getTime() - 86400000 * 29)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
break;
}
$('#' + source_id).val(date);
});
});
$(function () {
vue_obj = new Vue({
el: '.coms-table-wrap',
data: {
params: {},
cityAry: [],//城市
countyAry: [],//行政区
bizAry: [],//门店
},
mounted: function () {
var vm = this;
vm.params = <?=json_encode($params)?>;
vm.init_citys();
},
methods: {
init_citys: function () {
var vm = this;
$.ajax({
type: 'get',
url: '/common/area',
dataType: 'json',
data: {
id: '350',
key: 'city',
type: 1
},
success: function (response) {
if (response.code == 1) {
vm.cityAry = response.data;
}
}
});
},
set_county: function () {
var that = this;
that.bizAry = [];
that.params.biz_id = that.params.addr_id = '';
},
reset: function () {
var that = this;
that.params.city_id = '';
that.params.vin = '';
$('#id-time').val('');
$('#bd-auto1-id').val(0);
$('#bd-auto2-id').val(0);
}
},
watch: {
'params.city_id': function (nv, ov) {
var that = this;
if (nv == '') {
that.countyAry = [];
that.params.county_id = '';
} else {
if (nv.substring(0, 4) != that.params.county_id.substring(0, 4)) {
that.params.county_id = '';
}
$.ajax({
type: 'get',
url: '/common/area',
dataType: 'json',
data: {
id: nv,
key: 'county',
type: 1
},
success: function (response) {
if (response.code == 1) {
that.countyAry = response.data;
}
}
});
}
},
'params.county_id': function (nv, ov) {
var that = this;
if (nv == '') {
that.bizAry = [];
that.params.biz_id = that.params.addr_id = '';
} else {
$.ajax({
type: 'post',
url: '/biz/store/store/json_lists',
dataType: 'json',
data: {
city_id: that.params.city_id,
county_id: that.params.county_id,
status: 1
},
success: function (response) {
if (response.code == 1) {
that.bizAry = response.data.list;
var biz_id = '';
if (that.params.biz_id > 0 || that.params.biz_id == -1) {
for (var i in that.bizAry) {
if (that.params.biz_id == that.bizAry[i].id) {
biz_id = that.params.biz_id;
break;
}
}
}
that.params.biz_id = biz_id;
}
}
});
}
},
}
});
<?php page_script($pager) ?>
});
</script>
+7
View File
@@ -27,6 +27,7 @@ class Auto extends Wxapp
protected function get_introduce()
{
$this->load->model('auto/auto_introduce_model', 'mdAutoIntroduce');
$this->load->model("biz/biz_model", 'mdBiz');
$id = intval($this->input_param('id'));
$biz_id = intval($this->input_param('biz_id'));
$re = $this->mdAutoIntroduce->get(array('id' => $id, 'status' => 1));
@@ -40,9 +41,15 @@ class Auto extends Wxapp
$this->addTag(['c_id' => $re_cus['id'], 'brand_id' => $re['brand_id']]);
}
}
$biz_name = '';
if ($biz_id) {
$re_biz = $this->mdBiz->get(array('id' => $biz_id, 'status' => 1));
$re_biz['biz_name'] && $biz_name = $re_biz['biz_name'];
}
$sign_up = $this->session['mobile'] ? 0 : 1;
$data = array(
'title' => '车型介绍',
'biz_name' => $biz_name,
"video" => $re['video'] ? build_qiniu_image_url($re['video'], 0, 0, 'video') : '',
'content' => $re['content'],
'sign_up' => $sign_up,