admin_clues_721_2

This commit is contained in:
dengbw
2021-07-21 11:29:06 +08:00
committed by lccsw
parent e108f6e378
commit bf996a140f
3 changed files with 142 additions and 84 deletions
+81 -9
View File
@@ -8,6 +8,10 @@ class Clues extends HD_Controller{
public function __construct(){
parent::__construct();
$this->load->model('receiver/receiver_clues_model', 'clues_model');
$this->load->model('receiver/receiver_clues_cfrom_model', 'clues_cfrom_model');
$this->load->model('receiver/receiver_customers_model', 'customers_model');
$this->load->model('receiver/receiver_clue_oplogs_model', 'mdOplogs');
$this->log_dir = 'receiver_clues';
@@ -46,7 +50,7 @@ class Clues extends HD_Controller{
}
}
strlen($params['status']) && $where["status"] = $params['status'];
$count = $this->clues_model->count($where);
$lists = [];
if($count){
@@ -74,31 +78,47 @@ class Clues extends HD_Controller{
return $this->show_view('receiver/clues/lists', true);
}
public function get(){
public function get()
{
$params = $this->input->get();
$id = intval($params['id']);
if (!$id) {
return $this->show_json(SYS_CODE_FAIL, '非法参数!');
}
$statusList = $logsList = array();
$re = $this->clues_model->get(array('id'=>$id));
$statusList = $logsList = $intention = array();
$re = $this->clues_model->get(array('id' => $id));
$dataInfo = $re;
foreach ($this->clues_model->get_status() as $key => $value) {
$statusList[] = array("id" => $key, "name" => $value);
}
$dataInfo['editType'] = 0;
$re_cf = $this->clues_cfrom_model->get(array('id'=>$re['cf_id']));
$re_cf = $this->clues_cfrom_model->get(array('id' => $re['cf_id']));
$info_show['cfrom_title'] = $re_cf['title'] ? $re_cf['title'] : '';
$info_show['statusList'] = $statusList;
$info_show['status2List'] = array(array("id" => 1, "name" => '未回访'),array("id" => 2, "name" => '已回访'));
$info_show['status2List'] = array(array("id" => 1, "name" => '未回访'), array("id" => 2, "name" => '已回访'));
$info_show['c_time'] = date('Y-m-d H:i', $re['c_time']);
$info_show['mobile_sub'] = $re['mobile'] ? substr_replace($re['mobile'], '*****', 0, 5) : '';
$resLogs = $this->mdReceiverOplogs->select(array('clue_id'=>$id), 'id desc', 0, 0);
$resLogs = $this->mdOplogs->select(array('clue_id' => $id), 'c_time desc', 0, 0);
foreach ($resLogs as $key => $value) {
$setValue = array();
$setValue['uname'] = $value['uname'];
$setValue['log'] = $value['log'];
$setValue['type_name'] = '小记';
$setValue['c_time'] = date('Y-m-d H:i', $value['c_time']);
$logsList[] = $setValue;
}
$info_show['logsList'] = $logsList;
//意向信息
$this->load->model('auto/auto_brand_model', 'mdAutoBrand');
$this->load->model('auto/auto_series_model', 'mdAutoSeries');
$re_b = $this->mdAutoBrand->get(array('id' => $re['brand_id']), 'name');
$re_s = $this->mdAutoSeries->get(array('id' => $re['s_id']), 'name');
$jsondata = $re['jsondata'] ? json_decode($re['jsondata'], true) : array();
$intention['brand_name'] = '品牌:' . ($re_b ? $re_b['name'] : '');
$intention['s_name'] = '车系:' . ($re_s ? $re_s['name'] : '');
$intention['v_name'] = '车型:' . ($jsondata['car']['version']['title'] ? $jsondata['car']['version']['title'] : '');
$intention['cor_name'] = '车身颜色:' . ($jsondata['car']['color']['title'] ? $jsondata['car']['color']['title'] : '');
$info_show['intention'] = $intention;
$this->data['info'] = $dataInfo;
$this->data['info_show'] = $info_show;
$this->data['_title'] = '线索详情';
@@ -132,7 +152,33 @@ class Clues extends HD_Controller{
return $this->show_json(SYS_CODE_SUCCESS, '添加成功');
}
function add_excel(){
public function add_log()
{
$params = $this->input->post();
if (!$params['id']) {
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
}
if (!$params['log']) {
return $this->show_json(SYS_CODE_FAIL, '请输入内容!');
}
$addData = array(
'clue_id' => $params['id'],
'uid' => $this->uid,
'uname' => $this->username,
'type' => intval($params['type']),
'log' => $params['log'],
'c_time' => time()
);
$id = $this->mdOplogs->add($addData);
if ($id) {
return $this->show_json(SYS_CODE_SUCCESS, '添加成功');
} else {
return $this->show_json(SYS_CODE_FAIL, '添加失败');
}
}
function add_excel()
{
require_once COMMPATH . '/third_party/PHPExcel/IOFactory.php';
$res = $this->upload();
if (!$res['code']) {
@@ -169,7 +215,33 @@ class Clues extends HD_Controller{
}
//编辑单条数据
public function edit(){
public function edit()
{
$info = $this->input->post('info');
$opt_type = $this->input->post('opt_type');
if (!$info) {
return $this->show_json(SYS_CODE_FAIL, '非法参数!');
}
$re = $this->clues_model->get(array('id' => $info['id']));
if (!$re || empty($re)) {
return $this->show_json(SYS_CODE_FAIL, '线索不存在!');
}
if ($info['editType'] == 1) {
$status_name = $this->clues_model->get_status()[$re['status']];
$status_name_up = $this->clues_model->get_status()[$info['status']];
$log = '更新状态(' . $status_name . ')为(' . $status_name_up . ')';
$addData = array(
'clue_id' => $info['id'],
'uid' => $this->uid,
'uname' => $this->username,
'type' => 0,
'log' => $log,
'c_time' => time()
);
$this->mdOplogs->add($addData);
}
$this->clues_model->update(array('status' => $info['status']), array('id' => $info['id']));
return $this->show_json(SYS_CODE_SUCCESS, '成功修改状态!');
}
//删除单条数据
+60 -74
View File
@@ -17,7 +17,7 @@
</div>
</div>
</div>
<div class="col-sm-2">
<div class="col-sm-2" style="display: none">
<div class="my-panel">
<div class="text-center">
二级状态
@@ -54,21 +54,18 @@
<span href="javascript:void(0)" style="font-size: 20px">
用户信息
</span>
<span style="float:right;margin-top:5px">
<span style="float:right;margin-top:5px;display: none">
<a href="javascript:" @click="editType(2)"><i class="fa fa-edit"></i></a>
</span>
</div>
<div class="am-panel-bd am-g">
<table width="100%"
style="margin:10px 10px 10px 20px;">
<table width="100%" style="margin:10px 10px 10px 20px;">
<tr>
<td class="table-td" style="width: 35%;">
<table>
<tr>
<td>客户姓名:</td>
<td><input type="text" v-model="info.name" placeholder="请输入客户姓名"></td>
</tr>
</table>
<td class="table-td">
客户姓名:{{info.name}}
</td>
<td class="table-td">
业主电话:{{infoShow.mobile_sub}}
</td>
<td class="table-td">
渠道来源:{{infoShow.cfrom_title}}
@@ -77,17 +74,6 @@
加入时间:{{infoShow.c_time}}
</td>
</tr>
<tr>
<td class="table-td" style="width: 35%;">
<table>
<tr>
<td>业主电话:</td>
<td><input type="text" v-model="infoShow.mobile_sub" disabled="disabled"/></td>
</tr>
</table>
</td>
<td class="table-td" colspan="3"></td>
</tr>
<tr>
<td>
<div class="am-form-inline" style="padding-right: 30px;padding-top: 10px;">
@@ -127,7 +113,27 @@
<div class="am-panel am-panel-default">
<div class="am-panel-hd">
<span href="javascript:void(0)" style="font-size: 20px">
线索记录
意向信息
</span>
</div>
<div class="am-panel-bd am-g">
<table width="100%"
style="margin:10px 10px 10px 20px;">
<tr>
<td class="table-td">{{infoShow.intention.brand_name}}</td>
<td class="table-td">{{infoShow.intention.s_name}}</td>
<td class="table-td">{{infoShow.intention.v_name}}</td>
<td class="table-td">{{infoShow.intention.cor_name}}</td>
</tr>
</table>
</div>
</div>
</div>
<div class="am-u-lg-12">
<div class="am-panel am-panel-default">
<div class="am-panel-hd">
<span href="javascript:void(0)" style="font-size: 20px">
线索日志
</span>
<span style="float:right;margin-top:5px">
<a href="javascript:void(0)" @click="logModal()">新增小记</a>
@@ -135,54 +141,37 @@
</div>
<div class="am-panel-bd">
<div class="am-tabs" data-am-tabs>
<ul class="am-tabs-nav am-nav am-nav-tabs">
<li class="am-active"><a href="javascript: void(0)">线索日志</a></li>
</ul>
<div class="am-tabs-bd">
<div class="am-tab-panel am-active">
<table class="am-table">
<thead>
<div class="am-tab-panel am-active">
<table class="am-table">
<thead>
<tr>
<th width="15%"><span>操作人员</span></th>
<th width=""><span>内容</span></th>
<th width="13%"><span>类型</span></th>
<th width="15%"><span>操作时间</span></th>
</tr>
</thead>
<tbody>
<?php foreach ($info_show['logsList'] as $key => $val) { ?>
<tr>
<th width="10%"><span>操作人员</span></th>
<th width=""><span>内容</span></th>
<th width="13%"><span>类型</span></th>
<th width="15%"><span>操作时间</span></th>
<td style="vertical-align:middle;word-wrap:break-word"><?= $val['uname'] ?></td>
<td style="vertical-align:middle;word-wrap:break-word">
<? if ($val['rec_url']) { ?>
<audio controls="controls">
<source src="<?= $val['rec_url'] ?>"/>
</audio>
<? } else if ($val['rec_text']) { ?>
<?= $val['rec_text'] ?>
<? } else { ?>
<?= $val['log'] ?>
<? } ?>
</td>
<td style="vertical-align:middle;word-wrap:break-word"><?= $val['type_name'] ?></td>
<td style="vertical-align:middle;word-wrap:break-word;"><?= $val['c_time'] ?></td>
</tr>
</thead>
<tbody>
<?php foreach ($logsList as $key => $val) { ?>
<tr>
<td style="vertical-align:middle;word-wrap:break-word"><?= $val['admin_name'] ?></td>
<td style="vertical-align:middle;word-wrap:break-word">
<? if ($val['rec_url']) { ?>
<audio controls="controls">
<source src="<?= $val['rec_url'] ?>"/>
</audio>
<? } else if ($val['rec_text']) { ?>
<?= $val['rec_text'] ?>
<? } else { ?>
<?= $val['log'] ?>
<? } ?>
<? if ($val['imgs']) { ?>
<div class="photo-upload" style="padding-top: 10px;">
<?php foreach ($val['imgs'] as $key1 => $val1) { ?>
<div class="photo-upload-item">
<a href="javascript:void (0);">
<img src="<?= $val1 ?>" class="img-thumbnail"
data-tips-image
style="width:100px;height:100px;"></a>
</div>
<? } ?>
</div>
<? } ?>
</td>
<td style="vertical-align:middle;word-wrap:break-word"><?= $val['type_name'] ?></td>
<td style="vertical-align:middle;word-wrap:break-word;"><?= $val['c_time'] ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
@@ -208,7 +197,7 @@
el: '#vue-edit',
data: {
info: {},
infoShow: {},
infoShow: {"intention":{}},
goods: {"imgs_url": [], "imgs": [], "log": ''},
},
mounted: function () {
@@ -274,7 +263,7 @@
btn: ['保存', '取消'],
yes: function (index) {
$.ajax({
url: '/app/jdb/log/add',
url: '/receiver/clues/add_log',
type: 'post',
dataType: 'json',
data: {
@@ -306,9 +295,6 @@
},
saveEdit: function () {
var vm = this;
if (vm.info.editType == 6) {
vm.info.visit_time = $('#visit_time_id').val();
}
$.ajax({
url: '/receiver/clues/edit',
type: 'post',
+1 -1
View File
@@ -72,7 +72,7 @@
<div class="am-form-group fl ml10">
<button type="button" class="am-btn am-btn-success am-btn-sm w100"
data-modal="/receiver/clues/get" data-title="新增线索">新增</button>
data-modal="/receiver/clues/get_add" data-title="新增线索">新增</button>
</div>
</div>
</div>