diff --git a/admin/controllers/receiver/Customer.php b/admin/controllers/receiver/Customer.php
index dba170be..25112763 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_model', 'clues_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');
@@ -259,11 +260,29 @@ 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');
+ if($clues['recommend_id']){
+ $this->load->model('app/liche/app_liche_users_model');
+ $user = $this->app_liche_users_model->get(['id'=>$clues['recommend_id']],'id,nickname,up_uid');
+ $user['up_uid'] && $up_user = $this->app_liche_users_model->get(['id'=>$user['up_uid']],'id,nickname'); //上一级分销用户
+ print_r($up_user);
+ if($up_user){
+ $cf_user = "{$up_user['nickname']}(一级) => {$user['nickname']}(二级)";
+ }else{
+ $cf_user = $user['nickname'];
+ }
+ }
$info = array(
'id' => $row['id'],
'name' => $row['name'],
'mobile' => $mobile_sub,
'cf_title' => $row['cf_title'],
+ 'cf_name' => $cf_row['title'],
+ 'cf_clues' => $row['cf_clues'],
+ 'cf_user' => $cf_user,
'c_time' => date('Y-m-d H:i:s', $row['c_time']),
'status' => $row['status'],
);
diff --git a/admin/controllers/receiver/Orders.php b/admin/controllers/receiver/Orders.php
index 7ade8e63..ba54f364 100644
--- a/admin/controllers/receiver/Orders.php
+++ b/admin/controllers/receiver/Orders.php
@@ -566,6 +566,7 @@ class Orders extends HD_Controller
$bill['id'] = $this->order_bills_model->add($add_data);
}
$bill['src_file'] = $bill['file'] ? build_qiniu_image_url($bill['file']) : '';
+ $bill['bill_time'] = $row['bill_time'] != '0000-00-00 00:00:00' ? $row['bill_time'] : '';
$this->data['bill'] = $bill;
return $this->show_view('receiver/orders/get_bill');
}
@@ -595,6 +596,7 @@ class Orders extends HD_Controller
, 'com_time' => $bill_time, 'biz_id' => $row_order['biz_id'], 'addr_id' => $row_order['addr_id']);
$this->items_entity->add_log($params);
}
+ $this->orders_model->update(['bill_time'=>$bill_time],['id'=>$row['o_id']]);
}
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
} else {
diff --git a/admin/libraries/OrdersList.php b/admin/libraries/OrdersList.php
index 2164bea6..b272194c 100644
--- a/admin/libraries/OrdersList.php
+++ b/admin/libraries/OrdersList.php
@@ -150,6 +150,16 @@ class OrdersList
$where["c_time <="] = strtotime($c_time[1] . ' 23:59:59');
}
}
+ //开票时间
+ if ($params['bill_time']) {
+ $bill_time = explode(' ~ ', $params['bill_time']);
+ if ($bill_time[0]) {
+ $where["bill_time >="] = $bill_time[0] . ' 00:00:00';
+ }
+ if ($bill_time[1]) {
+ $where["bill_time <="] = $bill_time[1] . ' 23:59:59';
+ }
+ }
if ($params['brand_id']) {//品牌
$where["brand_id"] = $params['brand_id'];
} else {
@@ -221,7 +231,15 @@ class OrdersList
//客户来源
$str_rids = implode(',', array_unique(array_column($rows, 'rid')));
!$str_rids && $str_rids = 0;
- $customers = $this->ci->mdCustomers->map('id', 'cf_title', array("id in({$str_rids})" => null));
+ $customers = $this->ci->mdCustomers->map('id', '', array("id in({$str_rids})" => null),'','','','id,cf_title,cf_clues,cf_id');
+ $cfroms = [];
+ if($customers){
+ foreach($customers as $key=>$val){
+ $cf_id_arr[] = $val[0]['cf_id'];
+ }
+ //获取来源
+ $cfroms = $this->ci->mdCluesCfrom->get_map_by_ids($cf_id_arr, 'id,title');
+ }
//门店
$str_biz_ids = implode(',', array_unique(array_column($rows, 'biz_id')));
!$str_biz_ids && $str_biz_ids = 0;
@@ -255,7 +273,9 @@ class OrdersList
$fields['status_name'] = $status_arr[$val['status']]['name'];
$fields['biz_name'] = $bizs[$val['biz_id']];
$fields['c_time'] = date('Y-m-d H:i:s', $val['c_time']);
- $fields['cf_title'] = $customers[$val['rid']];
+ $fields['cf_title'] = $customers[$val['rid']][0]['cf_title'];
+ $fields['cf_clues'] = $customers[$val['rid']][0]['cf_clues'];
+ $fields['cf_name'] = $cfroms[$customers[$val['rid']][0]['cf_id']][0]['title'];
$lists[] = $fields;
}
}
@@ -431,7 +451,15 @@ class OrdersList
//客户来源
$str_rids = implode(',', array_unique(array_column($rows, 'rid')));
!$str_rids && $str_rids = 0;
- $customers = $this->ci->mdCustomers->map('id', 'cf_title', array("id in({$str_rids})" => null));
+ $customers = $this->ci->mdCustomers->map('id', '', array("id in({$str_rids})" => null),'','','','id,cf_title,cf_clues,cf_id');
+ $cfroms = [];
+ if($customers){
+ foreach($customers as $key=>$val){
+ $cf_id_arr[] = $val[0]['cf_id'];
+ }
+ //获取来源
+ $cfroms = $this->ci->mdCluesCfrom->get_map_by_ids($cf_id_arr, 'id,title');
+ }
//品牌车型
$brands = $this->ci->auto_brand_model->get_map_by_ids($brand_arr, 'id,name');
//车系车型
@@ -479,7 +507,11 @@ class OrdersList
$fields['price'] = $val['price'] > 1 ? number_format($val['price']) : number_format($val['price'], 2);
$fields['deposit'] = $val['deposit'] > 1 ? number_format($val['deposit']) : number_format($val['deposit'], 2);
$fields['biz_name'] = $map_biz[$admin['biz_id']];
- $fields['cf_title'] = $customers[$val['rid']];
+ $fields['cf_title'] = $customers[$val['rid']][0]['cf_title'];
+ $cf_name = '';
+ $cfroms[$customers[$val['rid']][0]['cf_id']][0]['title'] && $cf_name = $cfroms[$customers[$val['rid']][0]['cf_id']][0]['title'].'(线上)
';
+ $customers[$val['rid']][0]['cf_clues'] && $cf_name .= $customers[$val['rid']][0]['cf_clues'].'(线下)';
+ $fields['cf_name'] = $cf_name;
$lists[] = $fields;
}
}
@@ -643,7 +675,15 @@ class OrdersList
//客户来源
$str_rids = implode(',', array_unique(array_column($rows, 'rid')));
!$str_rids && $str_rids = 0;
- $customers = $this->ci->mdCustomers->map('id', 'cf_title', array("id in({$str_rids})" => null));
+ $customers = $this->ci->mdCustomers->map('id', '', array("id in({$str_rids})" => null),'','','','id,cf_title,cf_clues,cf_id');
+ $cfroms = [];
+ if($customers){
+ foreach($customers as $key=>$val){
+ $cf_id_arr[] = $val[0]['cf_id'];
+ }
+ //获取来源
+ $cfroms = $this->ci->mdCluesCfrom->get_map_by_ids($cf_id_arr, 'id,title');
+ }
$finance_arr = array_column($rows, 'finance_id');
$finance_rows = $this->ci->sys_finance_model->get_map_by_ids($finance_arr, 'id,title');
foreach ($rows as $key => $val) {
@@ -657,7 +697,11 @@ class OrdersList
$fields['price_loan'] = number_format($price_loan, 2);
$fields['c_time'] = date('Y-m-d H:i:s', $val['c_time']);
$fields['status_name'] = $status_arr[$val['status']];
- $fields['cf_title'] = $customers[$val['rid']];
+ $fields['cf_title'] = $customers[$val['rid']][0]['cf_title'];
+ $cf_name = '';
+ $cfroms[$customers[$val['rid']][0]['cf_id']][0]['title'] && $cf_name = $cfroms[$customers[$val['rid']][0]['cf_id']][0]['title'].'(线上)
';
+ $customers[$val['rid']][0]['cf_clues'] && $cf_name .= $customers[$val['rid']][0]['cf_clues'].'(线下)';
+ $fields['cf_name'] = $cf_name;
$lists[] = $fields;
}
}
@@ -820,7 +864,15 @@ class OrdersList
//客户来源
$str_rids = implode(',', array_unique(array_column($rows, 'rid')));
!$str_rids && $str_rids = 0;
- $customers = $this->ci->mdCustomers->map('id', 'cf_title', array("id in({$str_rids})" => null));
+ $customers = $this->ci->mdCustomers->map('id', '', array("id in({$str_rids})" => null),'','','','id,cf_title,cf_clues,cf_id');
+ $cfroms = [];
+ if($customers){
+ foreach($customers as $key=>$val){
+ $cf_id_arr[] = $val[0]['cf_id'];
+ }
+ //获取来源
+ $cfroms = $this->ci->mdCluesCfrom->get_map_by_ids($cf_id_arr, 'id,title');
+ }
//门店
$str_biz_ids = implode(',', array_unique(array_column($rows, 'biz_id')));
!$str_biz_ids && $str_biz_ids = 0;
@@ -853,7 +905,11 @@ class OrdersList
$fields['incor_name'] = isset($attr[$val['incor_id']]) ? $attr[$val['incor_id']][0]['title'] : '';
$fields['status_name'] = $status_arr[$val['status']];
$fields['biz_name'] = $bizs[$val['biz_id']];
- $fields['cf_title'] = $customers[$val['rid']];
+ $fields['cf_title'] = $customers[$val['rid']][0]['cf_title'];
+ $cf_name = '';
+ $cfroms[$customers[$val['rid']][0]['cf_id']][0]['title'] && $cf_name = $cfroms[$customers[$val['rid']][0]['cf_id']][0]['title'].'(线上)
';
+ $customers[$val['rid']][0]['cf_clues'] && $cf_name .= $customers[$val['rid']][0]['cf_clues'].'(线下)';
+ $fields['cf_name'] = $cf_name;
$lists[] = $fields;
}
}
@@ -1016,7 +1072,15 @@ class OrdersList
//客户来源
$str_rids = implode(',', array_unique(array_column($rows, 'rid')));
!$str_rids && $str_rids = 0;
- $customers = $this->ci->mdCustomers->map('id', 'cf_title', array("id in({$str_rids})" => null));
+ $customers = $this->ci->mdCustomers->map('id', '', array("id in({$str_rids})" => null),'','','','id,cf_title,cf_clues,cf_id');
+ $cfroms = [];
+ if($customers){
+ foreach($customers as $key=>$val){
+ $cf_id_arr[] = $val[0]['cf_id'];
+ }
+ //获取来源
+ $cfroms = $this->ci->mdCluesCfrom->get_map_by_ids($cf_id_arr, 'id,title');
+ }
//门店
$str_biz_ids = implode(',', array_unique(array_column($rows, 'biz_id')));
!$str_biz_ids && $str_biz_ids = 0;
@@ -1050,6 +1114,11 @@ class OrdersList
$fields['status_name'] = $status_arr[$val['status']];
$fields['biz_name'] = $bizs[$val['biz_id']];
$fields['cf_title'] = $customers[$val['rid']];
+ $fields['cf_title'] = $customers[$val['rid']][0]['cf_title'];
+ $cf_name = '';
+ $cfroms[$customers[$val['rid']][0]['cf_id']][0]['title'] && $cf_name = $cfroms[$customers[$val['rid']][0]['cf_id']][0]['title'].'(线上)
';
+ $customers[$val['rid']][0]['cf_clues'] && $cf_name .= $customers[$val['rid']][0]['cf_clues'].'(线下)';
+ $fields['cf_name'] = $cf_name;
$lists[] = $fields;
}
}
@@ -1212,7 +1281,15 @@ class OrdersList
//客户来源
$str_rids = implode(',', array_unique(array_column($rows, 'rid')));
!$str_rids && $str_rids = 0;
- $customers = $this->ci->mdCustomers->map('id', 'cf_title', array("id in({$str_rids})" => null));
+ $customers = $this->ci->mdCustomers->map('id', '', array("id in({$str_rids})" => null),'','','','id,cf_title,cf_clues,cf_id');
+ $cfroms = [];
+ if($customers){
+ foreach($customers as $key=>$val){
+ $cf_id_arr[] = $val[0]['cf_id'];
+ }
+ //获取来源
+ $cfroms = $this->ci->mdCluesCfrom->get_map_by_ids($cf_id_arr, 'id,title');
+ }
//门店
$str_biz_ids = implode(',', array_unique(array_column($rows, 'biz_id')));
!$str_biz_ids && $str_biz_ids = 0;
@@ -1245,7 +1322,11 @@ class OrdersList
$fields['incor_name'] = isset($attr[$val['incor_id']]) ? $attr[$val['incor_id']][0]['title'] : '';
$fields['status_name'] = $status_arr[$val['status']];
$fields['biz_name'] = $bizs[$val['biz_id']];
- $fields['cf_title'] = $customers[$val['rid']];
+ $fields['cf_title'] = $customers[$val['rid']][0]['cf_title'];
+ $cf_name = '';
+ $cfroms[$customers[$val['rid']][0]['cf_id']][0]['title'] && $cf_name = $cfroms[$customers[$val['rid']][0]['cf_id']][0]['title'].'(线上)
';
+ $customers[$val['rid']][0]['cf_clues'] && $cf_name .= $customers[$val['rid']][0]['cf_clues'].'(线下)';
+ $fields['cf_name'] = $cf_name;
$lists[] = $fields;
}
}
@@ -1408,7 +1489,15 @@ class OrdersList
//客户来源
$str_rids = implode(',', array_unique(array_column($rows, 'rid')));
!$str_rids && $str_rids = 0;
- $customers = $this->ci->mdCustomers->map('id', 'cf_title', array("id in({$str_rids})" => null));
+ $customers = $this->ci->mdCustomers->map('id', '', array("id in({$str_rids})" => null),'','','','id,cf_title,cf_clues,cf_id');
+ $cfroms = [];
+ if($customers){
+ foreach($customers as $key=>$val){
+ $cf_id_arr[] = $val[0]['cf_id'];
+ }
+ //获取来源
+ $cfroms = $this->ci->mdCluesCfrom->get_map_by_ids($cf_id_arr, 'id,title');
+ }
//门店
$str_biz_ids = implode(',', array_unique(array_column($rows, 'biz_id')));
!$str_biz_ids && $str_biz_ids = 0;
@@ -1441,7 +1530,11 @@ class OrdersList
$fields['incor_name'] = isset($attr[$val['incor_id']]) ? $attr[$val['incor_id']][0]['title'] : '';
$fields['status_name'] = $status_arr[$val['status']];
$fields['biz_name'] = $bizs[$val['biz_id']];
- $fields['cf_title'] = $customers[$val['rid']];
+ $fields['cf_title'] = $customers[$val['rid']][0]['cf_title'];
+ $cf_name = '';
+ $cfroms[$customers[$val['rid']][0]['cf_id']][0]['title'] && $cf_name = $cfroms[$customers[$val['rid']][0]['cf_id']][0]['title'].'(线上)
';
+ $customers[$val['rid']][0]['cf_clues'] && $cf_name .= $customers[$val['rid']][0]['cf_clues'].'(线下)';
+ $fields['cf_name'] = $cf_name;
$lists[] = $fields;
}
}
@@ -1471,26 +1564,29 @@ class OrdersList
if (strlen($status_pid) && $status_pid == 0) {
$fields2 = ['car_name' => ['title' => '车辆', 'width' => '22%'],
'biz_name' => ['title' => '门店', 'width' => '10%'], 'price' => ['title' => '合同价', 'width' => '7%'],
- 'deposit' => ['title' => '定金', 'width' => '7%'], 'payway_name' => ['title' => '付款', 'width' => '5%'],
- 'admin_name' => ['title' => '销售员', 'width' => '7%'], 'cf_title' => ['title' => '来源类型', 'width' => '8%'],
+ 'payway_name' => ['title' => '付款', 'width' => '5%'],'admin_name' => ['title' => '销售员', 'width' => '7%'],
+ 'cf_title' => ['title' => '来源类型', 'width' => '8%'],'cf_name' => ['title' => '来源','width' => '10%'],
'status_name' => ['title' => '合同状态', 'width' => '7%'], 'c_time' => ['title' => '订单时间', 'width' => '12%']];
$fields = array_merge($fields1, $fields2);
} else if ($status_pid == 1) {
$fields2 = ['title' => ['title' => '分期产品', 'width' => '15%'],
'price_loan' => ['title' => '贷款金额', 'width' => '10%'], 'c_time' => ['title' => '分期时间', 'width' => '7%'],
- 'cf_title' => ['title' => '来源类型', 'width' => '10%'], 'status_name' => ['title' => '状态', 'width' => '10%']];
+ 'cf_title' => ['title' => '来源类型', 'width' => '10%'], 'cf_name' => ['title' => '来源','width' => '10%'],
+ 'status_name' => ['title' => '状态', 'width' => '10%']];
$fields = array_merge($fields1, $fields2);
} else if ($status_pid == 2 || $status_pid == 3 || $status_pid == 4 || $status_pid == 5) {
$fields2 = ['car_name' => ['title' => '车辆', 'width' => '27%'],
'biz_name' => ['title' => '门店', 'width' => '12%'], 'price' => ['title' => '车辆平台价', 'width' => '9%'],
- 'deposit' => ['title' => '定金', 'width' => '8%'], 'payway_name' => ['title' => '付款方式', 'width' => '8%'],
- 'cf_title' => ['title' => '来源类型', 'width' => '9%'], 'status_name' => ['title' => '状态', 'width' => '9%']];
+ 'payway_name' => ['title' => '付款方式', 'width' => '8%'],
+ 'cf_title' => ['title' => '来源类型', 'width' => '9%'], 'cf_name' => ['title' => '来源','width' => '10%'],
+ 'status_name' => ['title' => '状态', 'width' => '9%']];
$fields = array_merge($fields1, $fields2);
} else {
$fields2 = ['car_name' => ['title' => '车辆', 'width' => '27%'],
'biz_name' => ['title' => '门店', 'width' => '12%'], 'price' => ['title' => '车辆平台价', 'width' => '9%'],
- 'deposit' => ['title' => '定金', 'width' => '8%'], 'payway_name' => ['title' => '付款方式', 'width' => '8%'],
- 'cf_title' => ['title' => '来源类型', 'width' => '9%'], 'status_name' => ['title' => '状态', 'width' => '9%'],
+ 'payway_name' => ['title' => '付款方式', 'width' => '8%'],
+ 'cf_title' => ['title' => '来源类型', 'width' => '9%'], 'cf_name' => ['title' => '来源','width' => '10%'],
+ 'status_name' => ['title' => '状态', 'width' => '9%'],
'c_time' => ['title' => '订单时间', 'width' => '9%']];
$fields = array_merge($fields1, $fields2);
}
diff --git a/admin/views/receiver/customer/get.php b/admin/views/receiver/customer/get.php
index 4b1b2535..9abdc285 100644
--- a/admin/views/receiver/customer/get.php
+++ b/admin/views/receiver/customer/get.php
@@ -61,6 +61,22 @@
加入时间:{{info.c_time}}
+