customer_411

This commit is contained in:
dengbw
2022-04-11 13:53:28 +08:00
committed by lccsw
parent a34bdfe703
commit 00e074f421
7 changed files with 44 additions and 126 deletions
+10 -8
View File
@@ -235,13 +235,13 @@ class Clues extends HD_Controller
}
//获取分销用户
$cf_user = '';
if($dataInfo['recommend_id']){
if ($dataInfo['recommend_id']) {
$this->load->model('app/liche/app_liche_users_model');
$user = $this->app_liche_users_model->get(['id'=>$dataInfo['recommend_id']],'id,nickname,up_uid');
$user['up_uid'] && $up_user = $this->app_liche_users_model->get(['id'=>$user['up_uid']],'id,nickname'); //上一级分销用户
if($up_user){
$user = $this->app_liche_users_model->get(['id' => $dataInfo['recommend_id']], 'id,nickname,up_uid');
$user['up_uid'] && $up_user = $this->app_liche_users_model->get(['id' => $user['up_uid']], 'id,nickname'); //上一级分销用户
if ($up_user) {
$cf_user = "{$up_user['nickname']}(一级) => {$user['nickname']}(二级)";
}else{
} else {
$cf_user = $user['nickname'];
}
}
@@ -341,7 +341,7 @@ class Clues extends HD_Controller
if (!mobile_valid($info['mobile'])) {
return $this->show_json(SYS_CODE_FAIL, '手机号码不准确');
}
if($this->clues_model->get(['mobile'=>$info['mobile']])){
if ($this->clues_model->get(['mobile' => $info['mobile']])) {
return $this->show_json(SYS_CODE_FAIL, '手机号已存在');
}
$cf_id = 0;
@@ -601,7 +601,7 @@ class Clues extends HD_Controller
foreach ($ids_arr as $val) {
$clues_row = $clues_rows[$val][0];
//判断是否已分配
$cus_row = $this->customers_model->get(['rid' => $val,'status>='=>0]);
$cus_row = $this->customers_model->get(['rid' => $val, 'status>=' => 0]);
if ($clues_row && !$cus_row) {
$jsondata = json_decode($clues_row['jsondata'], true);
$add_data = [
@@ -615,6 +615,8 @@ class Clues extends HD_Controller
's_id' => $clues_row['s_id'],
'if_driver' => $clues_row['if_driver'],
'cf_title' => '平台分配',
'of_id' => 3,
'of2_id' => 37,
'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'])
@@ -813,7 +815,7 @@ class Clues extends HD_Controller
$fails[] = array('data' => $v, 'msg' => 'mobile valid fail');
continue;
}
if($this->clues_model->get(['mobile'=>$v['mobile']])){
if ($this->clues_model->get(['mobile' => $v['mobile']])) {
$fails[] = array('data' => $v, 'msg' => '手机号已存在');
continue;
}
+1 -24
View File
@@ -161,31 +161,12 @@ class Customer extends HD_Controller
$order_time[0] && $where["order_time >="] = $order_time[0] . ' 00:00:00';
$order_time[1] && $where["order_time <="] = $order_time[1] . ' 23:59:59';
}
if ($params['cfrom_id'] || $params['cfrom_id2']) {
if ($params['cfrom_id'] == 24) {
$where['cf_id'] = 24;
$params['cfrom_id2'] && $where['t_id'] = $params['cfrom_id2'];
} else {
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 = [];
$offlineSources = $this->customers_model->offlineSources();
if ($count) {
$fileds = 'id,name,mobile,cf_title,cf_clues,cont_time,admin_id,status,biz_id,cf_id,level,of_id,of2_id';
$fileds = 'id,name,mobile,cf_title,cf_clues,cont_time,admin_id,status,biz_id,level,of_id,of2_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');
@@ -212,7 +193,6 @@ class Customer extends HD_Controller
'level' => $val['level'],
'cf_title' => $val['cf_title'],
'of_title' => $of_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'] : '',
@@ -268,7 +248,6 @@ class Customer extends HD_Controller
} else {
$mobile_sub = $row['mobile'] ? substr_replace($row['mobile'], '*****', 0, 5) : '';
}
$cf_row = $this->clues_cfrom_model->get(['id' => $row['cf_id']], 'id,title');
//获取分销用户
$cf_user = '';
$clues = $this->clues_model->get(['id' => $row['rid']], 'recommend_id');
@@ -293,8 +272,6 @@ class Customer extends HD_Controller
'id' => $row['id'],
'name' => $row['name'],
'mobile' => $mobile_sub,
'cf_title' => $row['cf_title'],
'cf_name' => $cf_row['title'],
'of_title' => $of_title,
'cf_user' => $cf_user,
'c_time' => date('Y-m-d H:i:s', $row['c_time']),
+2 -5
View File
@@ -50,22 +50,19 @@
<tr>
<td><span class="mr5">客户姓名:</span></td>
<td><input id="info_name" type="text" v-model="info.name" placeholder="请输入客户姓名"
style="width: 150px;"></td>
style="width: 200px;"></td>
</tr>
</table>
</td>
<td class="table-td"><span class="mr5">客户电话:</span>{{info.mobile}}</td>
<td class="table-td"><span class="mr5">渠道来源:</span>{{info.cf_title}}</td>
<td class="table-td"><span class="mr5">加入时间:</span>{{info.c_time}}</td>
</tr>
<tr>
<td class="table-td"><span class="mr5">线下来源:</span>{{info.of_title}}</td>
<td class="table-td"><span class="mr5">线上来源:</span>{{info.cf_name}}</td>
<td class="table-td">
<template v-if="info.cf_user"><span class="mr5">分销来源:</span>{{info.cf_user}}</template>
</td>
<td class="table-td">
</td>
<td class="table-td"></td>
</tr>
<tr>
<td>
+16 -78
View File
@@ -62,41 +62,6 @@
</div>
</div>
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<div class="am-form-group fl">
<label class="am-para-label w100">线下来源:</label>
<div class="am-form-group am-para-inline w120">
<select name="of_id" v-model="params.of_id">
<option value="">请选择</option>
<option :value="i" v-for="(v,i) in show_info.offlineSourcesAry">{{v.name}}</option>
</select>
</div>
<div class="am-form-group am-para-inline w120">
<select name="of2_id" v-model="params.of2_id">
<option value="">请选择</option>
<option :value="i" v-for="(v,i) in of2Ary">{{v}}</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 w120">
<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>
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<div class="am-form-group fl">
<label class="am-para-label w100">销售员:</label>
<div class="am-para-inline w120">
@@ -128,6 +93,21 @@
</select>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w100">线下来源:</label>
<div class="am-form-group am-para-inline w120">
<select name="of_id" v-model="params.of_id">
<option value="">请选择</option>
<option :value="i" v-for="(v,i) in show_info.offlineSourcesAry">{{v.name}}</option>
</select>
</div>
<div class="am-form-group am-para-inline w120">
<select name="of2_id" v-model="params.of2_id">
<option value="">请选择</option>
<option :value="i" v-for="(v,i) in of2Ary">{{v}}</option>
</select>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w100">渠道经理:</label>
<div class="am-para-inline w100">
@@ -187,7 +167,6 @@
<th width="5%"><span>客户等级</span></th>
<th width="6%"><span>来源类型</span></th>
<th width="8%"><span>线下来源</span></th>
<th width="8%"><span>线上来源</span></th>
<th width="8%"><span>所属门店</span></th>
<th width="5%"><span>状态</span></th>
<th width="5%"><span>销售员</span></th>
@@ -203,14 +182,13 @@
<td>{{v.level}}</td>
<td>{{v.cf_title}}</td>
<td>{{v.of_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="11">
<td colspan="10">
<div class="row">
<div class="col-md-4 align-l">
</div>
@@ -297,10 +275,6 @@
searchTpAry: [],
lists: [],
qdjl_lists: [],
cfrom_id:<?=$params['cfrom_id'] ? $params['cfrom_id'] : 0?>,
cfrom_id2:<?=$params['cfrom_id2'] ? $params['cfrom_id2'] : 0?>,
cfroms: [],
cfroms2: [],
admins: {cityAry: [], countyAry: [], bizAry: [], list: []},
show_info: {levelAry: [], offlineSourcesAry: []},
of2Ary: [],
@@ -312,22 +286,9 @@
vm.lists = <?=json_encode($lists)?>;
vm.qdjl_lists = <?=json_encode($qdjl_lists)?>;
vm.show_info = <?=json_encode($show_info)?>;
this.getCfroms();
vm.init_citys();
},
methods: {
getCfroms: function () {
var that = this
$.get('/receiver/clues/get_cfroms', function (result) {
that.cfroms = result.data.data
});
if (that.cfrom_id > 0) {
var url = that.cfrom_id == 24 ? '/common/material' : '/receiver/clues/get_cfroms';
$.get(url, {'id': that.cfrom_id}, function (result) {
that.cfroms2 = result.data.data
});
}
},
btnTimes: function () {
layer.open({
type: 1,
@@ -410,29 +371,6 @@
that.of2Ary = that.show_info.offlineSourcesAry[nv]['list'];
}
},
'cfrom_id': function (nv, ov) {
var that = this;
if (nv == '') {
that.cfrom_id2 = 0;
that.cfroms = [];
} else {
var url = nv == 24 ? '/common/material' : '/receiver/clues/get_cfroms';
$.get(url, {'id': nv}, function (result) {
that.cfroms2 = result.data.data;
if (that.cfrom_id2 > 0) {
var cfrom_id2 = '0';
for (var i in that.cfroms) {
var county = that.cfroms[i];
if (county.id == that.cfrom_id2) {
cfrom_id2 = county.id;
break;
}
}
that.cfrom_id2 = cfrom_id2;
}
});
}
},
'params.city_id_admin': function (nv, ov) {
var that = this;
if (nv == '') {
+12 -5
View File
@@ -152,14 +152,19 @@ class Temp extends HD_Controller
{
$this->load->model('receiver/receiver_customers_model', 'mdCustomers');
$param = $this->input->get();
if ($param['up_id']) {
$ret = $this->mdCustomers->update(['of_id' => 3, 'of2_id' => 37], ['id' => $param['up_id']]);
echo $ret ? '<br>更新成功:' : '<br>更新失败:';
exit;
}
$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("cf_title" => '素材推广');
$res = $this->mdCustomers->select($where, 'id ASC', $param['page'], $param['size'], 'id,cf_title');
$where = array("cf_id" => 29);
$res = $this->mdCustomers->select($where, 'id ASC', $param['page'], $param['size'], 'id,of_id');
if (!$res) {
echo '<br>本次更新客户线下来源完成了:';
echo '<br><br>成功更新 <span style="color: red;">' . $counts . '</span> 条';
@@ -168,9 +173,11 @@ class Temp extends HD_Controller
}
$log = array();
foreach ($res as $key => $value) {
$this->mdCustomers->update(['cf_title' => '自有资源', 'of_id' => 5, 'of2_id' => 53], ['id' => $value['id']]);
$log[] = array('id' => $value['id'], 'of_id' => 5);
$counts++;
if (!$value['of_id']) {
$this->mdCustomers->update(['of_id' => 5, 'of2_id' => 53], ['id' => $value['id']]);
$log[] = array('id' => $value['id'], 'of_id' => 5);
$counts++;
}
}
echo '<br>成功更新:';
$log && print_r($log);
+2 -5
View File
@@ -196,13 +196,10 @@ class Biz extends Wxapp
if (!$re_biz) {
return $this->Hd_exception(SYS_CODE_FAIL, '预约的门店不存在!');
}
$of_id = $of2_id = 0;
if ($type == 'biz') {
$cf_id = 29;
} else {
$cf_id = $this->cf_id;
$of_id = 5;
$of2_id = 53;//狸车素材
}
$add_data = [
'name' => $this->session['uname'] ? $this->session['uname'] : '',
@@ -211,13 +208,13 @@ class Biz extends Wxapp
'city_id' => $re_biz['city_id'],
'county_id' => $re_biz['county_id'],
'cf_title' => '自有资源',
'of_id' => 5,
'of2_id' => 53,
'cf_id' => $cf_id,
't_id' => $t_id,
'p_time' => date('Y-m-d H:i:s'),
'c_time' => time()
];
$of_id && $add_data['of_id'] = $of_id;
$of2_id && $add_data['of2_id'] = $of2_id;
$where = ['biz_id' => $biz_id, 'mobile' => $add_data['mobile']];
$re_cus = $this->mdCustomers->get($where);
if ($re_cus) {
@@ -82,7 +82,7 @@ class Receiver_customers_model extends HD_Model
$arr[2] = ['name' => '转介绍', 'list' => [20 => '其他4S店', 21 => '其他二网', 22 => '汽车美容', 23 => '二手车',
24 => '修车厂', 25 => '驾校', 26 => '老车主', 27 => '亲朋好友']];
$arr[3] = ['name' => '网络推广', 'list' => [30 => '抖音', 31 => '区域媒体', 32 => '懂车帝', 33 => '易车',
34 => '汽车之家', 35 => '网红', 36 => '厂商分配']];
34 => '汽车之家', 35 => '网红', 36 => '厂商分配', 37 => '狸车分配']];
$arr[4] = ['name' => '外展外拓', 'list' => [40 => '巡展', 41 => '车展', 42 => '静展', 43 => '大客户']];
$arr[5] = ['name' => '自媒体', 'list' => [50 => '小红书号', 51 => '咸鱼号', 52 => '抖音号', 53 => '狸车素材', 54 => '知乎号']];
if ($id) {