This commit is contained in:
xiaoyu
2024-11-28 21:53:30 +08:00
parent 2d5a5cb6e1
commit 5409d83eb9
2 changed files with 182 additions and 57 deletions
+70 -5
View File
@@ -377,7 +377,7 @@ class Clues extends HD_Controller
'mobile' => '',
'cf_id' => '',
'cf2_id' => '',
'province_id' => 0,
'province_id' => 350000,
'city_id' => 0,
'county_id' => 0,
'biz_id' => 0,
@@ -404,8 +404,8 @@ class Clues extends HD_Controller
public function add()
{
$info = $this->input->post('info');
if (!$info['name']) {
return $this->show_json(SYS_CODE_FAIL, '请填写姓名');
if (!$info['name'] && !$info['sex']) {
return $this->show_json(SYS_CODE_FAIL, '请填写姓名或称谓');
}
if (!mobile_valid($info['mobile'])) {
@@ -424,7 +424,7 @@ class Clues extends HD_Controller
}
$add = array(
'name' => $info['name'],
'name' => $info['name'].$info['sex'],
'mobile' => $info['mobile'],
'cf_id' => $info['cf_id'],
'cf2_id' => $info['cf2_id'],
@@ -445,6 +445,71 @@ class Clues extends HD_Controller
if ($ret) {
$log = '新增线索';
$this->addLog(array('clue_id' => $ret, 'type' => 3, 'log' => $log));
if($info['text']){
$log = $info['text'];
sleep(1);
$this->addLog(array('clue_id' => $ret, 'type' => 0, 'log' => $log));
}
if($info['push'] && $info['biz_id']) {
if ($this->customers_model->get(array('mobile' => $info['mobile'], 'status >' => -1, 'biz_id' => $info['biz_id']))) {
$code = SYS_CODE_FAIL;
$msg = '门店已在跟踪';
} else {
$this->load->helper("order");
$biz = $this->biz_model->get(array('id' => $info['biz_id']));
$add = array(
'rid' => $ret,
'cid' => create_customer_no($biz['county_id']),
'name' => $info['name'].$info['sex'],
'mobile' => $info['mobile'],
'biz_id' => $info['biz_id'],
'level' => 'H',
'cf_title' => '数字营销中台',
'of_id' => $info['cf_id'],
'of2_id' => $info['cf2_id'],
'brand_id' => $info['brand_id'],
'series_id' => $info['series_id'],
'p_time' => date('Y-m-d H:i:s'),
'c_time' => time(),
);
$info['province_id'] && $add['province_id'] = $info['province_id'];
$info['city_id'] && $add['city_id'] = $info['city_id'];
$info['county_id'] && $add['county_id'] = $info['county_id'];
$customers_id = $this->customers_model->add($add);
if ($customers_id) {
sleep(1);
$this->addLog(array('clue_id' => $ret, 'type' => 3, 'log' => '转交门店跟进'));
$this->clues_model->update(['status' => 1, 'status2' => 2], ['id' => $ret]);
//同步线索日志到客户日志
$this->load->library('receiver/customers_entity');
$this->customers_entity->syn_clues($customers_id, $ret);
//短信通知店长
$this->load->model('app/licheb/app_licheb_users_model');
$where = array('biz_id' => $info['biz_id'], 'status' => 1, 'group_id' => 2);
$res_u = $this->app_licheb_users_model->select($where);
if ($res_u) {
foreach ($res_u as $v) {
if ($info['biz_id'] != 1) {
b2m_send_sms($v['mobile'], '【理车宝】您好,门店新增了1个客户线索。请及时到小程序"理车宝-待分配客户”分配给销售顾问跟进。祝您生活愉快!');
}
}
}
$code = SYS_CODE_SUCCESS;
$msg = '转交成功';
} else {
$code = SYS_CODE_FAIL;
$msg = '转交失败';
}
}
return $this->show_json($code, $msg);
}
return $this->show_json(SYS_CODE_SUCCESS, '新增成功');
} else {
debug_log("[error]# add fail; " . $this->clues_model->db->last_query(), __FUNCTION__, $this->log_dir);
@@ -654,7 +719,7 @@ class Clues extends HD_Controller
$customers_id = $this->customers_model->add($add);
if ($customers_id) {
$this->addLog(array('clue_id' => $re['id'], 'type' => 3, 'log' => '转交门店跟进'));
$this->clues_model->update(['status' => 1, 'status2' => 1], ['id' => $re['id']]);
$this->clues_model->update(['status' => 1, 'status2' => 2], ['id' => $re['id']]);
//同步线索日志到客户日志
$this->load->library('receiver/customers_entity');
+112 -52
View File
@@ -3,9 +3,13 @@
action="" id="edit-form">
<div class="am-form-group">
<label class="am-para-label">姓名:</label>
<div class="am-para-input w150">
<div class="am-para-inline w150">
<input type="text" placeholder="输入姓名" v-model="info.name" name="name"/>
</div>
<div class="am-para-inline w100">
<input type="radio" v-model="info.sex" name="sex" value="先生"> <label style="text-align: center;font-size: 1.6rem;line-height: 37px;">先生</label>
<input type="radio" v-model="info.sex" name="sex" value="女士"><label style="text-align: center;font-size: 1.6rem;line-height: 37px;">女士</label>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">手机号:</label>
@@ -13,6 +17,32 @@
<input type="text" placeholder="输入手机号" v-model="info.mobile" name="mobile" maxlength="11"/>
</div>
</div>
<div class="am-form-group fl" style="width:1920px">
<label class="am-para-label w110">派单门店:</label>
<div class="am-para-inline w100">
<select title="省份" name="province_id_admin" v-model="province_id_admin">
<option :value="v.province_id" v-for="(v,i) in admins.provinceAry">{{v.province_name}}</option>
</select>
</div>
<div class="am-para-inline w100">
<select title="城市" name="city_id_admin" v-model="city_id_admin">
<option value="0">城市</option>
<option :value="v.id" v-for="(v,i) in admins.cityAry">{{v.name}}</option>
</select>
</div>
<div class="am-para-inline w100">
<select title="行政区" name="county_id_admin" v-model="county_id_admin">
<option value="0">行政区</option>
<option :value="v.id" v-for="(v,i) in admins.countyAry">{{v.name}}</option>
</select>
</div>
<div class="am-para-inline w180">
<select name="biz_id_admin" v-model="biz_id_admin">
<option value="0">门店</option>
<option :value="v.id" v-for="(v,i) in admins.bizAry">{{v.title}}</option>
</select>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">所在地区:</label>
<div class="am-form-group am-para-inline w100">
@@ -35,34 +65,6 @@
</div>
</div>
<div class="am-form-group fl" style="width:1920px">
<label class="am-para-label w110">派单门店:</label>
<div class="am-para-inline w100">
<select title="省份" name="province_id_admin" v-model="province_id_admin">
<option value="0">省份</option>
<option :value="v.province_id" v-for="(v,i) in admins.provinceAry">{{v.province_name}}</option>
</select>
</div>
<div class="am-para-inline w100">
<select title="城市" name="city_id_admin" v-model="city_id_admin">
<option value="0">城市</option>
<option :value="v.id" v-for="(v,i) in admins.cityAry">{{v.name}}</option>
</select>
</div>
<div class="am-para-inline w100">
<select title="行政区" name="county_id_admin" v-model="county_id_admin">
<option value="0">行政区</option>
<option :value="v.id" v-for="(v,i) in admins.countyAry">{{v.name}}</option>
</select>
</div>
<div class="am-para-inline w180">
<select name="biz_id_admin" v-model="biz_id_admin">
<option value="0">门店</option>
<option :value="v.id" v-for="(v,i) in admins.bizAry">{{v.title}}</option>
</select>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">来源:</label>
<div class="am-para-input w300">
@@ -78,20 +80,30 @@
</div>
<div class="am-form-group">
<label class="am-para-label">关注车型:</label>
<div class="am-para-inline w120">
<select name="brand_id" v-model="info.brand_id">
<option :value="v.id" v-for="(v,i) in brandAry">{{v.name}}</option>
</select>
<div class="am-para-inline w160">
<input type="text" v-model="inputValue" @input="handleInput" placeholder="输入品牌">
<ul class="am-dropdown-content" :style="'display:'+[showSelect?'block':'none']">
<li v-for="item in inputSelect">
<a href="javascript:;" @click="selectInput(item)">{{item.name}}</a>
</li>
</ul>
</div>
<div class="am-para-inline w120">
<div class="am-para-inline w160">
<select name="series_id" v-model="info.series_id">
<option :value="v.id" v-for="(v,i) in seryAry">{{v.name}}</option>
</select>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">填写小记:</label>
<div class="am-para-inline">
<textarea v-model="info.text" style="width: 600px; height: 100px;"></textarea>
</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>
<button class="am-btn am-btn-danger" type="button" id="push-btn" @click="savePush">保存并转交</button>
</div>
</div>
</form>
@@ -103,10 +115,10 @@
el: '#edit-form',
data: {
info: {},
province_id:0,
province_id:350000,
city_id:0,
county_id:0,
province_id_admin:0,
province_id_admin:350000,
city_id_admin:0,
county_id_admin:0,
biz_id_admin:0,
@@ -119,6 +131,9 @@
seryAry: [],
admins: {provinceAry: <?=json_encode($provinces, JSON_UNESCAPED_UNICODE)?>, cityAry: [], countyAry: [], bizAry: []},
action: "",
inputValue: "",
showSelect: false,
inputSelect: []
},
mounted: function () {
this.init_provinces();
@@ -128,17 +143,29 @@
this.info = <?=json_encode($info, JSON_UNESCAPED_UNICODE)?>;
this.cfromAry = <?=json_encode($cfromAry, JSON_UNESCAPED_UNICODE)?>;
this.action = "<?=$action?>";
this.init_brands();
if (this.info.series_id) {
this.get_series()
}
this.get_series();
// this.init_brands();
// this.get_series();
},
methods: {
init_brands: function () {
var vm = this;
$.get('/common/auto', {'type': 1, 'tp': 0}, function (response) {
vm.brandAry = response.data;
selectInput: function (item){
console.log(item)
this.inputValue = item.name
this.info.brand_id = item.id
this.showSelect = false
},
handleInput: function (event) {
console.log('输入值:', this.inputValue);
// 请求接口
var that = this;
$.get('/common/auto_search', {'name': this.inputValue}, function (response) {
that.inputSelect = response.data;
setTimeout(function (){
if(that.inputSelect && that.inputSelect.length>0){
that.showSelect = true
}else{
that.showSelect = false
}
},100)
})
},
get_series: function () {
@@ -146,10 +173,6 @@
vm.seryAry = {};
$.get('/common/auto', {'type': 2, 'tp': 0, 'pid': vm.info.brand_id}, function (response) {
vm.seryAry = response.data;
// if (if_reset) {
// vm.params.series_id = 0;
// vm.params.car_id = 0;
// }
})
},
init_provinces: function () {
@@ -167,7 +190,7 @@
vm.cityAry = response.data;
}
});
$.get('common/area', {id: vm.province_id_admin, key: 'city', type: 1}, function (response) {
$.get('common/area', {id: 350000, key: 'city', type: 1}, function (response) {
if (response.code == 1) {
vm.admins.cityAry = response.data;
}
@@ -213,6 +236,45 @@
loading = 1;
vm.info.biz_id = vm.biz_id_admin;
$.ajax({
url: "receiver/clues/" + vm.action,
type: 'post',
dataType: 'json',
data: {
info: vm.info
},
beforeSend: function () {
layer.load(1, {
shade: [0.1, '#fff'] //0.1透明度的白色背景
});
},
success: function (data) {
if (1 == data['code']) {
layer.msg(data.msg, {
icon: 1,
time: 2000
}, function () {
window.location.reload();
});
} else {
layer.msg(data.msg, {icon: 2});
}
},
complete: function () {
loading = false;
layer.closeAll('loading');
}
});
},
savePush: function () {
var vm = this;
if (loading) {
return;
}
loading = 1;
vm.info.biz_id = vm.biz_id_admin;
vm.info.push = 1;
$.ajax({
url: "receiver/clues/" + vm.action,
type: 'post',
@@ -249,7 +311,6 @@
if (nv !== '') {
this.get_series()
}
},
'info.province_id': function (nv, ov) {
var that = this;
@@ -413,4 +474,3 @@
});
});
</script>