This commit is contained in:
xiaoyu
2024-05-13 17:15:15 +08:00
parent aefec6d339
commit bdfcb7bb07
5 changed files with 78 additions and 134 deletions
+46 -50
View File
@@ -4,7 +4,7 @@ defined('BASEPATH') or exit('No direct script access allowed');
class Clues extends HD_Controller
{
private $searchTpAry = array('mobile' => '客户手机号', 'name' => '客户姓名', 'void' => 'voId', );
private $searchTpAry = array('mobile' => '客户手机号', 'name' => '客户姓名', 'void' => 'voId' );
private $bizs = array(
'350' => array(
'name' => '福建',
@@ -36,8 +36,8 @@ class Clues extends HD_Controller
),
'100421' => array(
'biz' => '南平绿衡',
'sa' => '周伟豪',
'mobile' => '16659478792'
'sa' => '黄小英',
'mobile' => '15759156127'
),
'100179' => array(
'biz' => '莆田众诚',
@@ -127,7 +127,7 @@ class Clues extends HD_Controller
),
)
),
'410' => array(
'450' => array(
'name' => '广西',
'list' => array(
'100813' => array(
@@ -194,7 +194,7 @@ class Clues extends HD_Controller
$statusAry = $this->clues_model->statusAry();
$params = $this->input->get();
$this->data['pro_id'] = $pro_id = intval($params['pro_id']);
$this->data['province_id'] = $province_id = intval($params['province_id']);
$this->data['biz_id'] = $biz_id = intval($params['biz_id']);
$page = $params['page'] = $params['page'] ? intval($params['page']) : 1;
@@ -217,20 +217,24 @@ class Clues extends HD_Controller
strlen($params['status']) && $where["status"] = $params['status'];
$pro_id && $where['pro_id'] = $pro_id;
$province_id && $where['province_id'] = $province_id;
$biz_id && $where['biz_id'] = $biz_id;
$count = $this->clues_model->count($where);
$lists = [];
if ($count) {
$fileds = 'id,void, name,mobile,c_time,admin_id,status,status2';
$fileds = 'id,void, name,mobile,c_time,admin_id,status, province_id, biz_id';
$rows = $this->clues_model->select($where, 'id desc', $page, $size, $fileds);
foreach ($rows as $key => $val) {
$status_name = $statusAry[$val['status']]['name'];
$val['status2'] && $status_name .= '' . $statusAry[$val['status']]['list'][$val['status2']];
$val['status_name'] = $status_name;
$val['status_name'] = $statusAry[$val['status']]['name'];
if($val['province_id']){
$pro = $this->bizs[$val['province_id']];
$val['pro_name'] = $pro['name'];
$biz = $this->bizs[$val['province_id']]['list'][$val['biz_id']];
$val['biz_name'] = $biz['biz'];
}
$lists[] = $val;
}
}
@@ -324,17 +328,12 @@ class Clues extends HD_Controller
} else {
$info = array(
'name' => '',
'mobile' => '',
'cf_id1' => '',
'cf_id2' => '',
'mobile' => ''
);
$title = "新增线索";
$action = "add";
}
$where = array('status' => 1, 'pid' => 0);
$select = 'id, title';
$this->data['info'] = $info;
$this->data['action'] = $action;
@@ -550,10 +549,10 @@ class Clues extends HD_Controller
}
public function get_bizs(){
$pro_id = $this->input->get('pro_id');
$province_id = $this->input->get('province_id');
if($pro_id){
$bizs = $this->bizs[$pro_id];
if($province_id){
$bizs = $this->bizs[$province_id];
if($bizs){
foreach ($bizs['list'] as $k => $v){
@@ -580,12 +579,12 @@ class Clues extends HD_Controller
public function edit_adviser(){
$id = $this->input->post('id');
$pro_id = $this->input->post('pro_id');
$province_id = $this->input->post('province_id');
$biz_id = $this->input->post('biz_id');
$intent = $this->input->post('intent');
$remark = $this->input->post('remark');
$biz = $this->bizs[$pro_id]['list'][$biz_id];
$biz = $this->bizs[$province_id]['list'][$biz_id];
if (!$biz) {
return $this->show_json(SYS_CODE_FAIL, '请选择分配门店!');
@@ -594,17 +593,24 @@ class Clues extends HD_Controller
$clue_row = $this->clues_model->get(['id' => $id]);
if ($clue_row) {
if($clue_row['status']){
return $this->show_json(SYS_CODE_FAIL, '已分配!');
}
// if($clue_row['status']){
// return $this->show_json(SYS_CODE_FAIL, '已分配!');
// }
$result = $this->push_neta($clue_row['name'], $clue_row['mobile'], $pro_id, $biz, $intent, $remark);
$result = $this->push_neta($clue_row['name'], $clue_row['mobile'], $province_id, $biz, $intent, $remark);
$json = json_decode($result, true);
if($json['dataInfo']['rtnMessage'] == '处理成功'){
$this->clues_model->update(['status' => 1], ['id' => $id]);
if($json['dataInfo'][0]['rtnMessage'] == '处理成功'){
$update = array(
'status' => 1,
'province_id' => $province_id,
'biz_id' => $biz_id,
'voId' => $json['dataInfo'][0]['voId'],
'intentModel' => $intent,
'jsondata' => json_encode($json),
);
$this->clues_model->update($update, ['id' => $id]);
return $this->show_json(SYS_CODE_SUCCESS, '分配成功!');
}
@@ -613,21 +619,6 @@ class Clues extends HD_Controller
return $this->show_json(SYS_CODE_FAIL, '分配失败!');
}
private function upload()
{
$config['upload_path'] = $_SERVER['DOCUMENT_ROOT'] . '/temp/';
$config['allowed_types'] = 'xls|xlsx';
$config['max_size'] = 5120;
$config['file_name'] = 'receiver_clues' . time() . rand(1, 99999);
$this->load->library('upload', $config);
if (!$this->upload->do_upload('file')) {
return array('code' => SYS_CODE_FAIL, 'message' => $this->upload->display_errors('', ''));
} else {
$data = $this->upload->data();
return array('code' => SYS_CODE_SUCCESS, 'path' => $data['full_path'], 'file_ext' => $data['file_ext']);
}
}
/**
* 批量新增
* @param $lists
@@ -655,11 +646,10 @@ class Clues extends HD_Controller
$fails[] = array('data' => $v, 'msg' => '手机号已存在');
continue;
}
$cf_id = $map_cfrom[$v['cfrom']];
$adds[] = array(
'name' => $v['name'],
'mobile' => $v['mobile'],
'cf_id' => $cf_id ? $cf_id : 0,
'c_time' => time(),
);
$done++;
@@ -707,13 +697,19 @@ class Clues extends HD_Controller
return $this->show_json(SYS_CODE_SUCCESS);
}
public function push_neta($customerName, $mobile, $pro_id, $biz, $intentModel = '', $remark = '')
public function push_neta($customerName, $mobile, $province_id, $biz, $intentModel = '', $remark = '')
{
$voId = $pro_id . date('mdHis') . sprintf("%06d", rand(1,999999));
$voId = $province_id . date('mdHis') . sprintf("%06d", rand(1,999999));
if(in_array($biz['id'], array('100958', '100966', '101077'))){
$cusSource3 = '023409'; //区域云店 福泉厦
}else{
$cusSource3 = '023305'; //本地通
}
$data[] = array(
'voId' => $voId,
'cusSource3' => '023409',
'cusSource3' => $cusSource3,
'customerName' => $customerName,
'dealerCode' => $biz['id'],
'fromSystem' => "好店云",
@@ -727,8 +723,8 @@ class Clues extends HD_Controller
$data = json_encode($data, JSON_UNESCAPED_UNICODE);
//测试地址
$url = 'https://salespp-sit.hozonauto.com/appservice/app/if/salesclue/createSalesclue';
//$url = 'https://salesapp.hozonauto.com/appservice/app/if/salesclue/createSalesclue';
//$url = 'https://salespp-sit.hozonauto.com/appservice/app/if/salesclue/createSalesclue';
$url = 'https://salesapp.hozonauto.com/appservice/app/if/salesclue/createSalesclue';
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
+1 -43
View File
@@ -12,19 +12,6 @@
<input type="text" placeholder="输入手机号" v-model="info.mobile" name="mobile"/>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">来源:</label>
<div class="am-para-input w300">
<select name="cf_id1" v-model="info.cf_id1" style="width: 45%;display: inline">
<option value="">选择来源</option>
<option :value="i" v-for="(v,i) in cfromAry">{{v}}</option>
</select>
<select name="cf_id2" v-model="info.cf_id2" style="width: 45%;display: inline">
<option value="">选择来源</option>
<option :value="i" v-for="(v,i) in cfromAry2">{{v}}</option>
</select>
</div>
</div>
<div class="am-form-group">
<div class="am-para-input">
<button class="am-btn am-btn-secondary" type="button" id="add-btn" @click="saveEdit">保存</button>
@@ -39,14 +26,11 @@
el: '#edit-form',
data: {
info:{},
cfromAry:[],
cfromAry2:[],
action:""
},
mounted:function() {
var vm = this;
vm.info = <?=json_encode($info, JSON_UNESCAPED_UNICODE)?>;
vm.cfromAry = <?=json_encode($cfromAry, JSON_UNESCAPED_UNICODE)?>;
vm.action = "<?=$action?>";
},
methods:{
@@ -58,7 +42,7 @@
loading = 1;
$.ajax({
url: "receiver/clues/" + vm.action,
url: "hdcloud/clues/" + vm.action,
type: 'post',
dataType: 'json',
data: {
@@ -89,32 +73,6 @@
}
},
watch:{
'info.cf_id1':function(nv, ov){
var vm = this;
if(nv > 0){
$.ajax({
url: "receiver/clues/json_map_cfrom",
type: 'post',
dataType: 'json',
data: {
pid:vm.info.cf_id1,
status:1
},
beforeSend: function () {},
success: function (data) {
if (1 == data.code) {
vm.cfromAry2 = data.data;
if(undefined == vm.cfromAry2[vm.info.cf_id2]){
vm.info.cf_id2 = '';
}
}
}
});
} else {
vm.cfromAry2 = [];
vm.info.cf_id2 = '';
}
}
}
});
});
+8 -6
View File
@@ -6,10 +6,11 @@
<div class="am-para-input">
<div class="am-form-inline">
<div class="am-form-group w200">
<select name="pro_id" v-model="pro_id">
<select name="province_id" v-model="province_id">
<option value="0">请选择省份</option>
<option value="350">福建</option>
<option value="440">广东</option>
<option value="450">广西</option>
</select>
</div>
</div>
@@ -34,6 +35,7 @@
<div class="am-form-group w200">
<select name="intent" v-model="intent">
<option value="">请选择车系</option>
<option value="哪吒X">哪吒L</option>
<option value="哪吒X">哪吒X</option>
<option value="哪吒U">哪吒U</option>
<option value="哪吒AYA">哪吒AYA</option>
@@ -63,7 +65,7 @@
vue_obj = new Vue({
el: '#edit-form',
data: {
pro_id: 0,
province_id: 0,
biz_id: 0,
bizList: [],
intent: '',
@@ -75,14 +77,14 @@
methods: {
init_bizs:function(){
var vm = this;
$.get('hdcloud/clues/get_bizs',{pro_id:'0'},function(response){
$.get('hdcloud/clues/get_bizs',{province_id:'0'},function(response){
if (response.code == 1) {
vm.bizList = response.data;
}
});
},
save:function(){
pdata = {pro_id:this.pro_id, 'biz_id':this.biz_id, 'id':'<?=$id?>', 'intent':this.intent, 'remark':this.remark}
pdata = {province_id:this.province_id, 'biz_id':this.biz_id, 'id':'<?=$id?>', 'intent':this.intent, 'remark':this.remark}
$.post('hdcloud/clues/edit_adviser',pdata,function(response){
if (response.code == 1) {
layer.msg(response.msg,{'icon':1},function(){
@@ -96,13 +98,13 @@
}
},
watch:{
'pro_id':function(nv, ov){
'province_id':function(nv, ov){
var that = this;
if (nv == '') {
that.bizList = [];
that.biz_id = '0';
} else {
$.get('hdcloud/clues/get_bizs',{pro_id:nv},function(response){
$.get('hdcloud/clues/get_bizs',{province_id:nv},function(response){
that.bizList = response.data;
if (that.biz_id > 0) {
var biz_id = '0';
+13 -25
View File
@@ -67,12 +67,13 @@
</div>
</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="pro_id" v-model="pro_id">
<select name="province_id" v-model="province_id">
<option value="0">请选择省份</option>
<option value="350">福建</option>
<option value="440">广东</option>
<option value="450">广西</option>
</select>
</div>
<div class="am-form-group am-para-inline w150">
@@ -84,17 +85,6 @@
</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>
<div class="am-form-group">
<div class="am-form-group" style="margin-bottom: 0px;"></div>
@@ -124,9 +114,9 @@
<button type="button" class="am-btn am-btn-success am-btn-sm w100" @click="reset">重置</button>
</div>
<div class="am-form-group fl ml10">
<!--div class="am-form-group fl ml10">
<button type="button" id="import" class="am-btn am-btn-success am-btn-sm w100">导入</button>
</div>
</div-->
<div class="am-form-group fl ml10">
<button type="button" class="am-btn am-btn-success am-btn-sm w100"
@@ -142,12 +132,10 @@
<table class="am-table am-table-bordered">
<thead>
<tr>
<th width="5%"><label class="checkall">
<input type="checkbox" data-check-target=".order-ids"> 全选</label></th>
<th width="10%"><span>ID</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="15%"><span>创建时间</span></th>
<th width="15%"><span>操作</span></th>
@@ -160,11 +148,11 @@
<td><?= $v['void'] ?></td>
<td><?= $v['name'] ?></td>
<td><?= $v['mobile'] ?></td>
<td><?= $v['poi'] ?></td>
<td><?= $v['pro_name'] ?> <?= $v['biz_name'] ?></td>
<td><?= $v['status_name'] ?></td>
<td><?= date('Y-m-d H:i:s', $v['c_time']) ?></td>
<td><a data-open="/hdcloud/clues/get?id=<?= $v['id'] ?>&type=clues" href="javascript:void(0);" class="am-btn am-btn-primary am-btn-xs">详情</a>
<a href="javascript:void(0);" class="am-btn am-btn-primary am-btn-xs" onclick="edit_adviser(<?= $v['id'] ?>);">分配</a>
<? if(!$v['void']){ ?><a href="javascript:void(0);" class="am-btn am-btn-primary am-btn-xs" onclick="edit_adviser(<?= $v['id'] ?>);">派单</a> <?php }?>
</td>
</tr>
<? }
@@ -204,7 +192,7 @@
vue_obj = new Vue({
el: '#search_form',
data: {
pro_id:<?=$params['pro_id'] ? $params['pro_id']:0?>,
province_id:<?=$params['province_id'] ? $params['province_id']:0?>,
bizList:[],
biz_id:0
},
@@ -214,7 +202,7 @@
methods: {
init_bizs:function(){
var vm = this;
$.get('hdcloud/clues/get_bizs',{pro_id:'0'},function(response){
$.get('hdcloud/clues/get_bizs',{province_id:'0'},function(response){
vm.bizList = response.data;
});
},
@@ -224,17 +212,17 @@
$('#title').val('');
$('#id-create-time').val('');
$('#id-en-time').val('');
that.pro_id = '0';
that.province_id = '0';
}
},
watch:{
'pro_id':function(nv, ov){
'province_id':function(nv, ov){
var that = this;
if (nv == '') {
that.bizList = [];
that.biz_id = '0';
} else {
$.get('hdcloud/clues/get_bizs',{pro_id:nv},function(response){
$.get('hdcloud/clues/get_bizs',{province_id:nv},function(response){
that.bizList = response.data;
if (that.biz_id > 0) {
var biz_id = '0';
+10 -10
View File
@@ -16,13 +16,13 @@ class Welcome extends CI_Controller {
//测试地址
//$url = 'https://salespp-sit.hozonauto.com/appservice/app/if/salesclue/createSalesclue';
$cus = array('19372510901');
$cus = array('18878903790');
$comments = '100531'; //门店编码
$samobile = '19377780781';//销售手机
$comments = '100681'; //门店编码
$samobile = '18677222303';//销售手机
//$cusSource3 = '023305'; //本地通
$cusSource3 = '023409'; //区域云店 福泉厦
$cusSource3 = '023305'; //本地通
//$cusSource3 = '023409'; //区域云店 福泉厦
$city_id = '350200';
//$voId = $city_id . date('mdHis') . sprintf("%06d", rand(1,999999));
@@ -40,7 +40,7 @@ class Welcome extends CI_Controller {
'mobile' => $v,
'saMobile' => $samobile,
'cusType' => '30111001',
'remark' => '加微信',
'remark' => '网约车',
'intentModel' => "哪吒AYA",
);
}
@@ -73,8 +73,8 @@ class Welcome extends CI_Controller {
public function add_clues()
{
$mobiles = array('17759669876','17850230885','18006966001','18060283294','18150717109','18159553460');
$dealerCode = '100619';
$mobiles = array('18299532612','18552705955','18720570824','18770155172','18579260710','18707011686','18303119255','18568568479','18567662606');
$dealerCode = '100231';
foreach ($mobiles as $k => $v) {
$city_id = '350200';
@@ -82,12 +82,12 @@ class Welcome extends CI_Controller {
$data[] = array(
'voId' => $voId,
'cusSource3' => '023410',//023410:云店营销节点
'cusSource3' => '023409',//023410:云店营销节点
'customerName' => '客户',
'dealerCode' => $dealerCode,
'fromSystem' => "好店云",
'mobile' => $v,
'saMobile' => '',
'saMobile' => '13385022812',
'cusType' => '30111001',
'remark' => "",
'intentModel' => "",