admin_customer_918

This commit is contained in:
dengbw
2021-09-18 14:08:59 +08:00
committed by lccsw
parent db4c05dc64
commit 4b03bcf1f1
11 changed files with 136 additions and 19 deletions
+1
View File
@@ -600,6 +600,7 @@ class Clues extends HD_Controller
's_id' => $clues_row['s_id'],
'if_driver' => $clues_row['if_driver'],
'cf_title' => '平台分配',
'cf_id' => $clues_row['cf_id'],
'p_time' => date('Y-m-d H:i:s'),
'c_time' => $clues_row['en_time'] == '0000-00-00 00:00:00' ? $clues_row['c_time'] : strtotime($clues_row['en_time'])
];
+17 -1
View File
@@ -20,6 +20,7 @@ class Customer extends HD_Controller
parent::__construct();
$this->load->model('receiver/receiver_customers_model', 'customers_model');
$this->load->model('receiver/receiver_customer_oplogs_model', 'customer_oplogs_model');
$this->load->model('receiver/receiver_clues_cfrom_model', 'clues_cfrom_model');
$this->load->model('receiver/receiver_xz_model');
$this->load->model('app/licheb/app_licheb_users_model');
$this->load->model("biz/biz_model");
@@ -81,11 +82,25 @@ class Customer extends HD_Controller
$dt_time[0] && $where["dt_time >="] = $dt_time[0] . ' 00:00:00';
$dt_time[1] && $where["dt_time <="] = $dt_time[1] . ' 23:59:59';
}
if ($params['cfrom_id'] || $params['cfrom_id2']) {
if ($params['cfrom_id2']) {
$where['cf_id'] = $params['cfrom_id2'];
} else {
$cf_rows = $this->clues_cfrom_model->select(['pid' => $params['cfrom_id']], '', '', '', 'id');
$cf_ids = array_column($cf_rows, 'id');
$cf_ids[] = $params['cfrom_id'];
$cf_str_ids = implode(',', array_filter($cf_ids));
$cf_str_ids && $where["cf_id in ({$cf_str_ids})"] = null;
}
}
$count = $this->customers_model->count($where);
$lists = [];
if ($count) {
$fileds = 'id,name,mobile,cf_title,cont_time,admin_id,status,biz_id';
$fileds = 'id,name,mobile,cf_title,cont_time,admin_id,status,biz_id,cf_id';
$rows = $this->customers_model->select($where, 'id desc', $page, $size, $fileds);
//获取来源
$cf_id_arr = array_unique(array_column($rows, 'cf_id'));
$cf_rows = $this->clues_cfrom_model->get_map_by_ids($cf_id_arr, 'id,title');
//获取销售员
$admin_id_arr = array_unique(array_column($rows, 'admin_id'));
$admin_id_arr && $admin_rows = $this->app_licheb_users_model->get_map_by_ids($admin_id_arr, 'id,uname');
@@ -104,6 +119,7 @@ class Customer extends HD_Controller
'mobile' => $val['mobile'],
'mobile_sub' => $mobile_sub,
'cf_title' => $val['cf_title'],
'cf_name' => isset($cf_rows[$val['cf_id']]) ? $cf_rows[$val['cf_id']][0]['title'] : '',
'status_name' => $status_arr[$val['status']],
'admin_name' => isset($admin_rows[$val['admin_id']]) ? $admin_rows[$val['admin_id']][0]['uname'] : '',
'biz_name' => isset($biz_rows[$val['biz_id']]) ? $biz_rows[$val['biz_id']][0]['biz_name'] : '',
+42 -4
View File
@@ -63,16 +63,36 @@
</div>
<div class="am-form-group fl">
<label class="am-para-label w100">门店</label>
<label class="am-para-label w100">来源类型</label>
<div class="am-form-group am-para-inline w150">
<select name="cf_title" id="cf_time">
<option value="">客户来源</option>
<option value="">全部类型</option>
<option value="平台分配" <?= $params['cf_title'] == '平台分配' ? 'selected' : '' ?>>平台分配</option>
<option value="自有资源" <?= $params['cf_title'] == '自有资源' ? 'selected' : '' ?>>自有资源</option>
</select>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w100">客户来源:</label>
<div class="am-form-group am-para-inline w150">
<select name="cfrom_id" v-model="cfrom_id">
<option value=0>请选择</option>
<template v-for="(v,i) in cfroms">
<option :value="v.id">{{v.title}}</option>
</template>
</select>
</div>
<div class="am-form-group am-para-inline w150">
<select name="cfrom_id2" v-model="cfrom_id2">
<option value=0>请选择</option>
<template v-for="(v,i) in cfroms2">
<option :value="v.id">{{v.title}}</option>
</template>
</select>
</div>
</div>
<? foreach ($searchTimeAry as $key => $value) { ?>
<div id="show-<?= $key ?>" style="display:<?= $params[$key] ? 'block' : 'none' ?>">
<div class="am-form-group" style="margin-bottom: 0px;"></div>
@@ -117,6 +137,7 @@
<th width="3%">ID</th>
<th width="5%"><span>客户姓名</span></th>
<th width="5%"><span>客户电话</span></th>
<th width="8%"><span>来源类型</span></th>
<th width="8%"><span>客户来源</span></th>
<th width="7%"><span>所属门店</span></th>
<th width="8%"><span>状态</span></th>
@@ -131,13 +152,14 @@
<td>{{v.name}}</td>
<td>{{v.mobile_sub}}</td>
<td>{{v.cf_title}}</td>
<td>{{v.cf_name}}</td>
<td>{{v.biz_name}}</td>
<td>{{v.status_name}}</td>
<td>{{v.admin_name}}</td>
<td>{{v.cont_time}}</td>
</tr>
<tr>
<td colspan="8">
<td colspan="9">
<div class="row">
<div class="col-md-4 align-l">
</div>
@@ -218,6 +240,10 @@
lists: [],
cityAry: [],
countyAry: [],
cfrom_id:<?=$params['cfrom_id'] ? $params['cfrom_id'] : 0?>,
cfrom_id2:<?=$params['cfrom_id2'] ? $params['cfrom_id2'] : 0?>,
cfroms: [],
cfroms2: [],
bizList: [],
},
mounted: function () {
@@ -226,8 +252,20 @@
vm.searchTpAry = <?=json_encode($searchTpAry)?>;
vm.lists = <?=json_encode($lists)?>;
this.init_citys();
this.getCfroms();
},
methods: {
getCfroms: function () {
var that = this
$.get('/receiver/clues/get_cfroms', function (result) {
that.cfroms = result.data.data
});
if (that.cfrom_id > 0) {
$.get('/receiver/clues/get_cfroms', {'id': that.cfrom_id}, function (result) {
that.cfroms2 = result.data.data
});
}
},
btnTimes: function () {
layer.open({
type: 1,
@@ -282,7 +320,7 @@
$('#id-' + id).val('');
$('#show-' + id).hide();
});
$("#times_checkbox").prop("checked",false);
$("#times_checkbox").prop("checked", false);
}
},
watch: {
+2 -2
View File
@@ -79,11 +79,11 @@
<div class="am-form-group fl">
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<label class="am-para-label w100">创建时间:</label>
<label class="am-para-label w100">订单时间:</label>
<div class="am-form-group fl">
<div class="am-para-inline w300">
<input id="id-create-time" name="c_time" type="text" value="<?= $params['c_time'] ?>"
placeholder="创建时间范围" autocomplete="off"/>
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">今天</a>
+2 -2
View File
@@ -79,11 +79,11 @@
<div class="am-form-group fl">
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<label class="am-para-label w100">创建时间:</label>
<label class="am-para-label w100">订单时间:</label>
<div class="am-form-group fl">
<div class="am-para-inline w300">
<input id="id-create-time" name="c_time" type="text" value="<?= $params['c_time'] ?>"
placeholder="创建时间范围" autocomplete="off"/>
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">今天</a>
+2 -2
View File
@@ -92,11 +92,11 @@
<div class="am-form-group fl">
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<label class="am-para-label w100">创建时间:</label>
<label class="am-para-label w100">订单时间:</label>
<div class="am-form-group fl">
<div class="am-para-inline w300">
<input id="id-create-time" name="c_time" type="text" value="<?= $params['c_time'] ?>"
placeholder="创建时间范围" autocomplete="off"/>
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">今天</a>
@@ -92,11 +92,11 @@
<div class="am-form-group fl">
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<label class="am-para-label w100">创建时间:</label>
<label class="am-para-label w100">订单时间:</label>
<div class="am-form-group fl">
<div class="am-para-inline w300">
<input id="id-create-time" name="c_time" type="text" value="<?= $params['c_time'] ?>"
placeholder="创建时间范围" autocomplete="off"/>
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">今天</a>
+2 -2
View File
@@ -91,11 +91,11 @@
<div class="am-form-group fl">
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<label class="am-para-label w100">创建时间:</label>
<label class="am-para-label w100">订单时间:</label>
<div class="am-form-group fl">
<div class="am-para-inline w300">
<input id="id-create-time" name="c_time" type="text" value="<?= $params['c_time'] ?>"
placeholder="创建时间范围" autocomplete="off"/>
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">今天</a>
+2 -2
View File
@@ -92,11 +92,11 @@
<div class="am-form-group fl">
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<label class="am-para-label w100">创建时间:</label>
<label class="am-para-label w100">订单时间:</label>
<div class="am-form-group fl">
<div class="am-para-inline w300">
<input id="id-create-time" name="c_time" type="text" value="<?= $params['c_time'] ?>"
placeholder="创建时间范围" autocomplete="off"/>
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">今天</a>
+2 -2
View File
@@ -71,11 +71,11 @@
<div class="am-form-group fl">
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<label class="am-para-label w100">创建时间:</label>
<label class="am-para-label w100">订单时间:</label>
<div class="am-form-group fl">
<div class="am-para-inline w300">
<input id="id-create-time" name="c_time" type="text" value="<?= $params['c_time'] ?>"
placeholder="创建时间范围" autocomplete="off"/>
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">今天</a>
+62
View File
@@ -0,0 +1,62 @@
<?php
/**
* Notes:临时数据操作
* Created on: 2021/9/18 17:15
* Created by: dengbw
*/
class Temp extends HD_Controller
{
private $log_file;
public function __construct()
{
parent::__construct();
$this->log_file = 'temp.log';
}
/**
* Notes:更新客户表来源id
* Created on: 2021/9/18 11:58
* Created by: dengbw
* https://liche-api-dev.xiaoyu.com/plan/temp/receiver_customer
* https://api.liche.cn/plan/temp/receiver_customer
*/
public function receiver_customer()
{
$this->load->model('receiver/receiver_clues_model', 'mdClues');
$this->load->model('receiver/receiver_customers_model', 'mdCustomers');
$param = $this->input->get();
$param['page'] = intval($param['page']);
$param['size'] = intval($param['size']);
!$param['size'] && $param['size'] = 50;
!$param['page'] && $param['page'] = 1;
$counts = intval($param['counts']);
ob_start(); //打开缓冲区
$where = array('rid >' => 0);
$res = $this->mdCustomers->select($where, 'id ASC', $param['page'], $param['size'], 'id,rid,cf_id');
if (!$res) {
echo '<br>本次更新客户来源id完成了:';
echo '<br><br>成功更新 <span style="color: red;">' . $counts . '</span> 条';
echo '<br><br><a href="/plan/xmcard/tem_wxqy">点击将再次更新客户来源id>>></a>';
exit;
}
$log = array();
foreach ($res as $key => $value) {
$re_c = $this->mdClues->get(array('id' => $value['rid']));
if ($re_c['cf_id']) {
$this->mdCustomers->update(array('cf_id' => $re_c['cf_id']), array('id' => $value['id']));
$log[] = array('id' => $value['id'], 'cf_id' => $re_c['cf_id']);
$counts++;
}
}
echo '<br>成功更新:';
$log && print_r($log);
echo '<br><br>数据库获取:';
echo json_encode($res, JSON_UNESCAPED_UNICODE);
header('refresh:3;url=/plan/temp/receiver_customer?counts=' . $counts . '&size=' . $param['size'] . '&page=' . ($param['page'] + 1));
ob_end_flush();//输出全部内容到浏览器
}
}