From 4b03bcf1f1c675af123bb1912b6484022fb1a660 Mon Sep 17 00:00:00 2001 From: dengbw Date: Sat, 18 Sep 2021 14:08:59 +0800 Subject: [PATCH] admin_customer_918 --- admin/controllers/receiver/Clues.php | 1 + admin/controllers/receiver/Customer.php | 18 +++++- admin/views/receiver/customer/lists.php | 46 ++++++++++++-- admin/views/receiver/order/agent/lists.php | 4 +- admin/views/receiver/order/bill/lists.php | 4 +- admin/views/receiver/order/ckcar/lists.php | 4 +- admin/views/receiver/order/delivery/lists.php | 4 +- admin/views/receiver/order/loan/lists.php | 4 +- admin/views/receiver/order/sign/lists.php | 4 +- admin/views/receiver/orders/lists.php | 4 +- api/controllers/plan/Temp.php | 62 +++++++++++++++++++ 11 files changed, 136 insertions(+), 19 deletions(-) create mode 100644 api/controllers/plan/Temp.php diff --git a/admin/controllers/receiver/Clues.php b/admin/controllers/receiver/Clues.php index b3e62fea..c0006960 100644 --- a/admin/controllers/receiver/Clues.php +++ b/admin/controllers/receiver/Clues.php @@ -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']) ]; diff --git a/admin/controllers/receiver/Customer.php b/admin/controllers/receiver/Customer.php index f24ccb7a..3e79b3c4 100644 --- a/admin/controllers/receiver/Customer.php +++ b/admin/controllers/receiver/Customer.php @@ -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'] : '', diff --git a/admin/views/receiver/customer/lists.php b/admin/views/receiver/customer/lists.php index ad484b83..c4786e24 100644 --- a/admin/views/receiver/customer/lists.php +++ b/admin/views/receiver/customer/lists.php @@ -63,16 +63,36 @@
- +
+
+ +
+ +
+
+ +
+
+ $value) { ?>
@@ -117,6 +137,7 @@ ID 客户姓名 客户电话 + 来源类型 客户来源 所属门店 状态 @@ -131,13 +152,14 @@ {{v.name}} {{v.mobile_sub}} {{v.cf_title}} + {{v.cf_name}} {{v.biz_name}} {{v.status_name}} {{v.admin_name}} {{v.cont_time}} - +
@@ -218,6 +240,10 @@ lists: [], cityAry: [], countyAry: [], + cfrom_id:, + cfrom_id2:, + cfroms: [], + cfroms2: [], bizList: [], }, mounted: function () { @@ -226,8 +252,20 @@ vm.searchTpAry = ; vm.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: { diff --git a/admin/views/receiver/order/agent/lists.php b/admin/views/receiver/order/agent/lists.php index 0f4dd4e3..10c7b9a4 100644 --- a/admin/views/receiver/order/agent/lists.php +++ b/admin/views/receiver/order/agent/lists.php @@ -79,11 +79,11 @@
- +
+ placeholder="订单时间范围" autocomplete="off"/>
今天 diff --git a/admin/views/receiver/order/bill/lists.php b/admin/views/receiver/order/bill/lists.php index ef160b64..91c1b37b 100644 --- a/admin/views/receiver/order/bill/lists.php +++ b/admin/views/receiver/order/bill/lists.php @@ -79,11 +79,11 @@
- +
+ placeholder="订单时间范围" autocomplete="off"/>
今天 diff --git a/admin/views/receiver/order/ckcar/lists.php b/admin/views/receiver/order/ckcar/lists.php index 35f4a2ab..b45ba08c 100644 --- a/admin/views/receiver/order/ckcar/lists.php +++ b/admin/views/receiver/order/ckcar/lists.php @@ -92,11 +92,11 @@
- +
+ placeholder="订单时间范围" autocomplete="off"/>
今天 diff --git a/admin/views/receiver/order/delivery/lists.php b/admin/views/receiver/order/delivery/lists.php index 21cee349..f512adf1 100644 --- a/admin/views/receiver/order/delivery/lists.php +++ b/admin/views/receiver/order/delivery/lists.php @@ -92,11 +92,11 @@
- +
+ placeholder="订单时间范围" autocomplete="off"/>
今天 diff --git a/admin/views/receiver/order/loan/lists.php b/admin/views/receiver/order/loan/lists.php index afec4e0d..c570ee85 100644 --- a/admin/views/receiver/order/loan/lists.php +++ b/admin/views/receiver/order/loan/lists.php @@ -91,11 +91,11 @@
- +
+ placeholder="订单时间范围" autocomplete="off"/>
今天 diff --git a/admin/views/receiver/order/sign/lists.php b/admin/views/receiver/order/sign/lists.php index ee60cfc4..93059ea1 100644 --- a/admin/views/receiver/order/sign/lists.php +++ b/admin/views/receiver/order/sign/lists.php @@ -92,11 +92,11 @@
- +
+ placeholder="订单时间范围" autocomplete="off"/>
今天 diff --git a/admin/views/receiver/orders/lists.php b/admin/views/receiver/orders/lists.php index 27230d7f..e0a5c1f0 100644 --- a/admin/views/receiver/orders/lists.php +++ b/admin/views/receiver/orders/lists.php @@ -71,11 +71,11 @@
- +
+ placeholder="订单时间范围" autocomplete="off"/>
今天 diff --git a/api/controllers/plan/Temp.php b/api/controllers/plan/Temp.php new file mode 100644 index 00000000..67cfb9bb --- /dev/null +++ b/api/controllers/plan/Temp.php @@ -0,0 +1,62 @@ +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 '
本次更新客户来源id完成了:'; + echo '

成功更新 ' . $counts . ' 条'; + echo '

点击将再次更新客户来源id>>>'; + 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 '
成功更新:'; + $log && print_r($log); + echo '

数据库获取:'; + 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();//输出全部内容到浏览器 + } + +}