diff --git a/admin/controllers/receiver/Customer.php b/admin/controllers/receiver/Customer.php index 50356391..61b40477 100644 --- a/admin/controllers/receiver/Customer.php +++ b/admin/controllers/receiver/Customer.php @@ -205,6 +205,7 @@ class Customer extends HD_Controller $qdjl_lists = $this->app_licheb_users_model->select(array('group_id' => 4, 'status' => 1, 'biz_id<>' => '0'), 'id desc', 0, 0, 'id,uname as name'); $show_info['levelAry'] = $this->customers_model->get_sdata('level'); $show_info['cfCluesAry'] = $this->customers_model->get_sdata('cfrom_clues'); + $show_info['cfTitleAry'] = $this->customers_model->get_sdata('cfrom'); $this->data['show_info'] = $show_info; $this->data['lists'] = $lists; $this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count); diff --git a/admin/controllers/receiver/Orders.php b/admin/controllers/receiver/Orders.php index 0ac1d51a..463be800 100644 --- a/admin/controllers/receiver/Orders.php +++ b/admin/controllers/receiver/Orders.php @@ -43,11 +43,11 @@ class Orders extends HD_Controller } $cate = $where = array(); $t2 = 'lc_receiver_orders'; - $where_c = ["$t2.id>" => 0]; + $where_c = ["$t2.status>=" => 0]; $where_c["{$t2}.brand_id<>3"] = null;//狸车品牌不显示 $where_c["{$t2}.biz_id<>1"] = null;//biz_id=1不显示 - if ($key == 6 || $key==7) { - $count1 = $this->orders_model->count(array("status" => $key, "brand_id<>3" => null)); + if ($key == 6 || $key == 7) { + $count1 = $this->orders_model->count(array("status" => $key, "biz_id<>" => 1, "brand_id<>" => 3)); } else { if ($key == 0) { $t1 = 'lc_receiver_order_signs'; @@ -82,7 +82,7 @@ class Orders extends HD_Controller } $status_arr[] = array("id" => $key, "name" => $value['name'], "cate" => $cate, "count" => $count1); } - $params['count_all'] = $this->orders_model->count(array("brand_id<>3" => null));//全部 + $params['count_all'] = $this->orders_model->count(array("status>=" => 0, "biz_id<>" => 1, "brand_id<>" => 3));//全部 $this->load->library('OrdersList'); $params['list_type'] = 'all'; $result = $this->orderslist->lists($params['status_pid'], $params); @@ -139,13 +139,13 @@ class Orders extends HD_Controller $row['delry_time'] = $row['delry_time'] != '0000-00-00 00:00:00' ? str_replace(" 00:00:00", "", $row['delry_time']) : ''; //获取车辆服务费 - $srv_info = $this->orders_entity->order_srv_money($row['id'],1); - $srv_info['total'] = number_format($srv_info['total'],2); + $srv_info = $this->orders_entity->order_srv_money($row['id'], 1); + $srv_info['total'] = number_format($srv_info['total'], 2); $srv_detail = ""; - if($srv_info['list']){ - foreach($srv_info['list'] as $key => $val){ - $d = $srv_detail ? ',':''; - $srv_detail .= $d.$val['title'].":".number_format($val['money'],2); + if ($srv_info['list']) { + foreach ($srv_info['list'] as $key => $val) { + $d = $srv_detail ? ',' : ''; + $srv_detail .= $d . $val['title'] . ":" . number_format($val['money'], 2); } } $srv_info['detail'] = $srv_detail; @@ -339,7 +339,7 @@ class Orders extends HD_Controller $upd = array( 'cardidA' => $cardidA, 'cardidB' => $cardidB, - 'status' => 1 + 'status' => 1 ); $result = $this->order_bills_model->update($upd, ['o_id' => $o_id]); if ($result) { @@ -364,37 +364,25 @@ class Orders extends HD_Controller //导出数据列表 public function export() { + $this->load->library('OrdersList'); $params = $this->input->get(); $params['page'] = 1; $params['size'] = 10000; + $indexs = []; + $fieldAry = $this->orderslist->get_fields($params['status_pid'], 1); + foreach ($fieldAry as $key => $value) { + $indexs[$key] = $value['title']; + } $this->load->library('OrdersList'); $result = $this->orderslist->lists($params['status_pid'], $params); $fileName = $result['_title']; foreach ($result['lists'] as $key => $value) { - $temp['name'] = $value['name']; - $temp['mobile'] = $value['mobile']; - $temp['car_name'] = $value['car_name']; - $temp['biz_name'] = $value['biz_name']; - $temp['price'] = $value['price']; - $temp['deposit'] = $value['deposit']; - $temp['payway_name'] = $value['payway_name']; - $temp['status_name'] = $value['status_name']; - $temp['cf_title'] = $value['cf_title']; - $temp['c_time'] = $value['c_time']; + $temp = array(); + foreach ($fieldAry as $key2 => $value2) { + $temp[$key2] = $value[$key2]; + } $data[] = $temp; } - $indexs = [ - 'name' => '客户姓名', - 'mobile' => '客户电话', - 'car_name' => '车辆', - 'biz_name' => '门店', - 'price' => '车辆平台价', - 'deposit' => '定金', - 'payway_name' => '付款方式', - 'status_name' => '状态', - 'cf_title' => '客户来源', - 'c_time' => '订单时间', - ]; array_unshift($data, $indexs); $this->load->library('excel'); return $this->excel->out_csv($data, $indexs, $fileName . "_" . date('YmdHis')); @@ -409,7 +397,7 @@ class Orders extends HD_Controller $file = $_FILES['file']; $row = $this->order_loans_model->get(['o_id' => $oid]); if (!$row) { - $this->order_loans_model->add(['o_id'=>$oid,'c_time'=>time()]); + $this->order_loans_model->add(['o_id' => $oid, 'c_time' => time()]); $row = $this->order_loans_model->get(['o_id' => $oid]); } $update = []; @@ -471,8 +459,8 @@ class Orders extends HD_Controller $update['loan_time'] = date('Y-m-d H:i:s', strtotime($loan_time)); } $result = $this->order_loans_model->update($update, ['id' => $row['id']]); - if($result){ - if($params['status']==2){ //设置等待放款 + if ($result) { + if ($params['status'] == 2) { //设置等待放款 $this->orders_model->update(['status' => 2], ['id' => $row['o_id']]); $ckcar = $this->order_ckcars_model->get(['o_id' => $row['o_id']]); $replace = [ @@ -482,14 +470,14 @@ class Orders extends HD_Controller ]; $ckcar && $replace['id'] = $ckcar['id']; $this->order_ckcars_model->replace($replace); - }elseif($params['status']==3){ //设置完成按揭 - $order_row = $this->orders_model->get(['id'=>$row['o_id']],'status'); - if($order_row['status']==4){ //完成代办 + } elseif ($params['status'] == 3) { //设置完成按揭 + $order_row = $this->orders_model->get(['id' => $row['o_id']], 'status'); + if ($order_row['status'] == 4) { //完成代办 $this->orders_model->update(['status' => 5], ['id' => $oid]); if (!$this->order_deliverys_model->count(['o_id' => $oid])) { $this->order_deliverys_model->add(['o_id' => $oid, 'c_time' => time]); } - }else{ + } else { $this->orders_model->update(['status' => 2], ['id' => $row['o_id']]); $ckcar = $this->order_ckcars_model->get(['o_id' => $row['o_id']]); $replace = [ @@ -556,7 +544,7 @@ class Orders extends HD_Controller if (!$row) { return $this->show_json(SYS_CODE_FAIL, '参数错误!'); } - if (!$bill && $row['status']>=3) { + if (!$bill && $row['status'] >= 3) { $add_data = [ 'o_id' => $row['id'], 'c_time' => time() @@ -674,16 +662,16 @@ class Orders extends HD_Controller $this->order_agents_model->update(['status' => 1], ['o_id' => $oid]); $loan = $this->order_loans_model->get(['o_id' => $oid]); - if($loan && !$row['payway']){ //分期 - if($loan['status']==3){ //判断是否完成代办 + if ($loan && !$row['payway']) { //分期 + if ($loan['status'] == 3) { //判断是否完成代办 $this->orders_model->update(['status' => 5], ['id' => $oid]); if (!$this->order_deliverys_model->count(['o_id' => $oid])) { $this->order_deliverys_model->add(['o_id' => $oid, 'c_time' => time]); } - }else{ + } else { return $this->show_json(SYS_CODE_FAIL, '修改失败,请先完成按揭'); } - }else{ + } else { $this->orders_model->update(['status' => 5], ['id' => $oid]); if (!$this->order_deliverys_model->count(['o_id' => $oid])) { $this->order_deliverys_model->add(['o_id' => $oid, 'c_time' => time]); @@ -732,19 +720,19 @@ class Orders extends HD_Controller 'pay_price!=' => 0 ]; $count = $this->app_liche_orders_model->count($where); - if($count){ - $rows = $this->app_liche_orders_model->select($where,'id desc',$page,$size,'id,total_price,type,pay_time,mch_id,descrip'); + if ($count) { + $rows = $this->app_liche_orders_model->select($where, 'id desc', $page, $size, 'id,total_price,type,pay_time,mch_id,descrip'); $type_arr = $this->app_liche_orders_model->get_type_arr(); - foreach($rows as $item){ + foreach ($rows as $item) { $company = ''; - if($item['mch_id']){ - $company = $this->sys_company_model->get(['wx_mchid'=>$item['mch_id']],'short'); + if ($item['mch_id']) { + $company = $this->sys_company_model->get(['wx_mchid' => $item['mch_id']], 'short'); } $list[] = [ 'money' => $item['total_price'], 'type_cn' => $type_arr[$item['type']], 'pay_time' => $item['pay_time'], - 'company' => $company ? $company['short']:'', + 'company' => $company ? $company['short'] : '', 'descrip' => $item['descrip'] ]; } @@ -768,7 +756,7 @@ class Orders extends HD_Controller $pay_time = $this->input->post('pay_time'); $wx_mchid = $this->input->post('wx_mchid'); $descrip = $this->input->post('descrip'); - if(!$money || !$pay_time ||!$row || !$wx_mchid){ + if (!$money || !$pay_time || !$row || !$wx_mchid) { return $this->show_json(SYS_CODE_FAIL, '参数错误'); } $this->load->helper('order'); @@ -796,7 +784,7 @@ class Orders extends HD_Controller } return $this->show_json(SYS_CODE_SUCCESS, '保存成功'); } - $companys = $this->sys_company_model->select(['status'=>1,'wx_mchid!='=>''],'id desc','','','id,wx_mchid,short'); + $companys = $this->sys_company_model->select(['status' => 1, 'wx_mchid!=' => ''], 'id desc', '', '', 'id,wx_mchid,short'); $this->data['companys'] = $companys; $this->data['id'] = $this->input->get('id'); return $this->show_view('receiver/orders/add_paylog'); diff --git a/admin/controllers/receiver/order/Agent.php b/admin/controllers/receiver/order/Agent.php index 58523ba1..5d4bfa05 100644 --- a/admin/controllers/receiver/order/Agent.php +++ b/admin/controllers/receiver/order/Agent.php @@ -12,6 +12,7 @@ class Agent extends HD_Controller{ public function __construct(){ parent::__construct(); + $this->load->library('OrdersList'); } public function index(){ @@ -20,7 +21,6 @@ class Agent extends HD_Controller{ public function lists(){ $params = $this->input->get(); - $this->load->library('OrdersList'); $result = $this->orderslist->lists($this->status_pid, $params); $this->data = $result; return $this->show_view($result['view'], true); @@ -53,32 +53,21 @@ class Agent extends HD_Controller{ $params = $this->input->get(); $params['page'] = 1; $params['size'] = 10000; + $indexs = []; + $fieldAry = $this->orderslist->get_fields($this->status_pid, 1); + foreach ($fieldAry as $key => $value) { + $indexs[$key] = $value['title']; + } $this->load->library('OrdersList'); $result = $this->orderslist->lists($this->status_pid, $params); $fileName = $result['_title']; foreach ($result['lists'] as $key => $value) { - $temp['name'] = $value['name']; - $temp['mobile'] = $value['mobile']; - $temp['car_name'] = $value['car_name']; - $temp['biz_name'] = $value['biz_name']; - $temp['price'] = $value['price']; - $temp['deposit'] = $value['deposit']; - $temp['payway_name'] = $value['payway_name']; - $temp['cf_title'] = $value['cf_title']; - $temp['status_name'] = $value['status_name']; + $temp = array(); + foreach ($fieldAry as $key2 => $value2) { + $temp[$key2] = $value[$key2]; + } $data[] = $temp; } - $indexs = [ - 'name' => '客户姓名', - 'mobile' => '客户电话', - 'car_name' => '车辆', - 'biz_name' => '门店', - 'price' => '车辆平台价', - 'deposit' => '定金', - 'payway_name' => '付款方式', - 'cf_title' => '客户来源', - 'status_name' => '状态' - ]; array_unshift($data, $indexs); $this->load->library('excel'); return $this->excel->out_csv($data, $indexs, $fileName . "_" . date('YmdHis')); diff --git a/admin/controllers/receiver/order/Bill.php b/admin/controllers/receiver/order/Bill.php index d26f6579..3a5aeb79 100644 --- a/admin/controllers/receiver/order/Bill.php +++ b/admin/controllers/receiver/order/Bill.php @@ -12,6 +12,7 @@ class Bill extends HD_Controller public function __construct() { parent::__construct(); + $this->load->library('OrdersList'); } public function index() @@ -23,7 +24,6 @@ class Bill extends HD_Controller { $params = $this->input->get(); !strlen($params['status']) && $params['status'] = 1; - $this->load->library('OrdersList'); $result = $this->orderslist->lists($this->status_pid, $params); $this->data = $result; return $this->show_view($result['view'], true); @@ -61,32 +61,21 @@ class Bill extends HD_Controller $params = $this->input->get(); $params['page'] = 1; $params['size'] = 10000; + $indexs = []; + $fieldAry = $this->orderslist->get_fields($this->status_pid, 1); + foreach ($fieldAry as $key => $value) { + $indexs[$key] = $value['title']; + } $this->load->library('OrdersList'); $result = $this->orderslist->lists($this->status_pid, $params); $fileName = $result['_title']; foreach ($result['lists'] as $key => $value) { - $temp['name'] = $value['name']; - $temp['mobile'] = $value['mobile']; - $temp['biz_name'] = $value['biz_name']; - $temp['car_name'] = $value['car_name']; - $temp['price'] = $value['price']; - $temp['deposit'] = $value['deposit']; - $temp['payway_name'] = $value['payway_name']; - $temp['cf_title'] = $value['cf_title']; - $temp['status_name'] = $value['status_name']; + $temp = array(); + foreach ($fieldAry as $key2 => $value2) { + $temp[$key2] = $value[$key2]; + } $data[] = $temp; } - $indexs = [ - 'name' => '客户姓名', - 'mobile' => '客户电话', - 'car_name' => '车辆', - 'biz_name' => '门店', - 'price' => '车辆平台价', - 'deposit' => '定金', - 'payway_name' => '付款方式', - 'cf_title' => '客户来源', - 'status_name' => '状态' - ]; array_unshift($data, $indexs); $this->load->library('excel'); return $this->excel->out_csv($data, $indexs, $fileName . "_" . date('YmdHis')); diff --git a/admin/controllers/receiver/order/Ckcar.php b/admin/controllers/receiver/order/Ckcar.php index 2d44cf4d..51af6530 100644 --- a/admin/controllers/receiver/order/Ckcar.php +++ b/admin/controllers/receiver/order/Ckcar.php @@ -13,6 +13,7 @@ class Ckcar extends HD_Controller public function __construct() { parent::__construct(); + $this->load->library('OrdersList'); } public function index() @@ -23,7 +24,6 @@ class Ckcar extends HD_Controller public function lists() { $params = $this->input->get(); - $this->load->library('OrdersList'); $result = $this->orderslist->lists($this->status_pid, $params); $this->data = $result; return $this->show_view($result['view'], true); @@ -61,32 +61,21 @@ class Ckcar extends HD_Controller $params = $this->input->get(); $params['page'] = 1; $params['size'] = 10000; + $indexs = []; + $fieldAry = $this->orderslist->get_fields($this->status_pid, 1); + foreach ($fieldAry as $key => $value) { + $indexs[$key] = $value['title']; + } $this->load->library('OrdersList'); $result = $this->orderslist->lists($this->status_pid, $params); $fileName = $result['_title']; foreach ($result['lists'] as $key => $value) { - $temp['name'] = $value['name']; - $temp['mobile'] = $value['mobile']; - $temp['car_name'] = $value['car_name']; - $temp['biz_name'] = $value['biz_name']; - $temp['price'] = $value['price']; - $temp['deposit'] = $value['deposit']; - $temp['payway_name'] = $value['payway_name']; - $temp['cf_title'] = $value['cf_title']; - $temp['status_name'] = $value['status_name']; + $temp = array(); + foreach ($fieldAry as $key2 => $value2) { + $temp[$key2] = $value[$key2]; + } $data[] = $temp; } - $indexs = [ - 'name' => '客户姓名', - 'mobile' => '客户电话', - 'car_name' => '车辆', - 'biz_name' => '门店', - 'price' => '车辆平台价', - 'deposit' => '定金', - 'payway_name' => '付款方式', - 'cf_title' => '客户来源', - 'status_name' => '状态' - ]; array_unshift($data, $indexs); $this->load->library('excel'); return $this->excel->out_csv($data, $indexs, $fileName . "_" . date('YmdHis')); diff --git a/admin/controllers/receiver/order/Deal.php b/admin/controllers/receiver/order/Deal.php index 45bc1beb..c655c4a7 100644 --- a/admin/controllers/receiver/order/Deal.php +++ b/admin/controllers/receiver/order/Deal.php @@ -14,6 +14,7 @@ class Deal extends HD_Controller public function __construct() { parent::__construct(); + $this->load->library('OrdersList'); } public function index() @@ -24,7 +25,6 @@ class Deal extends HD_Controller public function lists() { $params = $this->input->get(); - $this->load->library('OrdersList'); $result = $this->orderslist->lists($this->status_pid, $params); $this->data = $result; return $this->show_view($result['view'], true); @@ -62,34 +62,21 @@ class Deal extends HD_Controller $params = $this->input->get(); $params['page'] = 1; $params['size'] = 10000; + $indexs = []; + $fieldAry = $this->orderslist->get_fields($this->status_pid, 1); + foreach ($fieldAry as $key => $value) { + $indexs[$key] = $value['title']; + } $this->load->library('OrdersList'); $result = $this->orderslist->lists($this->status_pid, $params); $fileName = $result['_title']; foreach ($result['lists'] as $key => $value) { - $temp['name'] = $value['name']; - $temp['mobile'] = $value['mobile']; - $temp['car_name'] = $value['car_name']; - $temp['biz_name'] = $value['biz_name']; - $temp['price'] = $value['price']; - $temp['deposit'] = $value['deposit']; - $temp['payway_name'] = $value['payway_name']; - $temp['cf_title'] = $value['cf_title']; - $temp['status_name'] = $value['status_name']; - $temp['c_time'] = $value['c_time']; + $temp = array(); + foreach ($fieldAry as $key2 => $value2) { + $temp[$key2] = $value[$key2]; + } $data[] = $temp; } - $indexs = [ - 'name' => '客户姓名', - 'mobile' => '客户电话', - 'car_name' => '车辆', - 'biz_name' => '门店', - 'price' => '车辆平台价', - 'deposit' => '定金', - 'payway_name' => '付款方式', - 'cf_title' => '客户来源', - 'status_name' => '状态', - 'c_time' => '订单时间' - ]; array_unshift($data, $indexs); $this->load->library('excel'); return $this->excel->out_csv($data, $indexs, $fileName . "_" . date('YmdHis')); diff --git a/admin/controllers/receiver/order/Delivery.php b/admin/controllers/receiver/order/Delivery.php index 4852ed92..f64b6d3e 100644 --- a/admin/controllers/receiver/order/Delivery.php +++ b/admin/controllers/receiver/order/Delivery.php @@ -13,6 +13,7 @@ class Delivery extends HD_Controller public function __construct() { parent::__construct(); + $this->load->library('OrdersList'); } public function index() @@ -23,7 +24,6 @@ class Delivery extends HD_Controller public function lists() { $params = $this->input->get(); - $this->load->library('OrdersList'); $result = $this->orderslist->lists($this->status_pid, $params); $this->data = $result; return $this->show_view($result['view'], true); @@ -61,32 +61,21 @@ class Delivery extends HD_Controller $params = $this->input->get(); $params['page'] = 1; $params['size'] = 10000; + $indexs = []; + $fieldAry = $this->orderslist->get_fields($this->status_pid, 1); + foreach ($fieldAry as $key => $value) { + $indexs[$key] = $value['title']; + } $this->load->library('OrdersList'); $result = $this->orderslist->lists($this->status_pid, $params); $fileName = $result['_title']; foreach ($result['lists'] as $key => $value) { - $temp['name'] = $value['name']; - $temp['mobile'] = $value['mobile']; - $temp['car_name'] = $value['car_name']; - $temp['biz_name'] = $value['biz_name']; - $temp['price'] = $value['price']; - $temp['deposit'] = $value['deposit']; - $temp['payway_name'] = $value['payway_name']; - $temp['cf_title'] = $value['cf_title']; - $temp['status_name'] = $value['status_name']; + $temp = array(); + foreach ($fieldAry as $key2 => $value2) { + $temp[$key2] = $value[$key2]; + } $data[] = $temp; } - $indexs = [ - 'name' => '客户姓名', - 'mobile' => '客户电话', - 'car_name' => '车辆', - 'biz_name' => '门店', - 'price' => '车辆平台价', - 'deposit' => '定金', - 'payway_name' => '付款方式', - 'cf_title' => '客户来源', - 'status_name' => '状态', - ]; array_unshift($data, $indexs); $this->load->library('excel'); return $this->excel->out_csv($data, $indexs, $fileName . "_" . date('YmdHis')); diff --git a/admin/controllers/receiver/order/Loan.php b/admin/controllers/receiver/order/Loan.php index 24024d5a..a4c0cdef 100644 --- a/admin/controllers/receiver/order/Loan.php +++ b/admin/controllers/receiver/order/Loan.php @@ -13,6 +13,7 @@ class Loan extends HD_Controller public function __construct() { parent::__construct(); + $this->load->library('OrdersList'); } public function index() @@ -23,7 +24,6 @@ class Loan extends HD_Controller public function lists() { $params = $this->input->get(); - $this->load->library('OrdersList'); $result = $this->orderslist->lists($this->status_pid, $params); $this->data = $result; return $this->show_view($result['view'], true); @@ -61,30 +61,21 @@ class Loan extends HD_Controller $params = $this->input->get(); $params['page'] = 1; $params['size'] = 10000; + $indexs = []; + $fieldAry = $this->orderslist->get_fields($this->status_pid, 1); + foreach ($fieldAry as $key => $value) { + $indexs[$key] = $value['title']; + } $this->load->library('OrdersList'); $result = $this->orderslist->lists($this->status_pid, $params); $fileName = $result['_title']; foreach ($result['lists'] as $key => $value) { - $temp['name'] = $value['name']; - $temp['mobile'] = $value['mobile']; - $temp['title'] = $value['title']; - $temp['year'] = $value['year']; - $temp['first_price'] = $value['first_price']; - $temp['c_time'] = $value['c_time']; - $temp['cf_title'] = $value['cf_title']; - $temp['status_name'] = $value['status_name']; + $temp = array(); + foreach ($fieldAry as $key2 => $value2) { + $temp[$key2] = $value[$key2]; + } $data[] = $temp; } - $indexs = [ - 'name' => '客户姓名', - 'mobile' => '客户电话', - 'title' => '分期产品', - 'year' => '年限', - 'first_price' => '首付金额', - 'c_time' => '分期时间', - 'cf_title' => '客户来源', - 'status_name' => '状态' - ]; array_unshift($data, $indexs); $this->load->library('excel'); return $this->excel->out_csv($data, $indexs, $fileName . "_" . date('YmdHis')); diff --git a/admin/controllers/receiver/order/Refund.php b/admin/controllers/receiver/order/Refund.php index 30e3dba5..26e63013 100644 --- a/admin/controllers/receiver/order/Refund.php +++ b/admin/controllers/receiver/order/Refund.php @@ -14,6 +14,7 @@ class Refund extends HD_Controller public function __construct() { parent::__construct(); + $this->load->library('OrdersList'); } public function index() @@ -24,7 +25,6 @@ class Refund extends HD_Controller public function lists() { $params = $this->input->get(); - $this->load->library('OrdersList'); $result = $this->orderslist->lists($this->status_pid, $params); $this->data = $result; return $this->show_view($result['view'], true); @@ -62,34 +62,21 @@ class Refund extends HD_Controller $params = $this->input->get(); $params['page'] = 1; $params['size'] = 10000; + $indexs = []; + $fieldAry = $this->orderslist->get_fields($this->status_pid, 1); + foreach ($fieldAry as $key => $value) { + $indexs[$key] = $value['title']; + } $this->load->library('OrdersList'); $result = $this->orderslist->lists($this->status_pid, $params); $fileName = $result['_title']; foreach ($result['lists'] as $key => $value) { - $temp['name'] = $value['name']; - $temp['mobile'] = $value['mobile']; - $temp['car_name'] = $value['car_name']; - $temp['biz_name'] = $value['biz_name']; - $temp['price'] = $value['price']; - $temp['deposit'] = $value['deposit']; - $temp['payway_name'] = $value['payway_name']; - $temp['cf_title'] = $value['cf_title']; - $temp['status_name'] = $value['status_name']; - $temp['c_time'] = $value['c_time']; + $temp = array(); + foreach ($fieldAry as $key2 => $value2) { + $temp[$key2] = $value[$key2]; + } $data[] = $temp; } - $indexs = [ - 'name' => '客户姓名', - 'mobile' => '客户电话', - 'car_name' => '车辆', - 'biz_name' => '门店', - 'price' => '车辆平台价', - 'deposit' => '定金', - 'payway_name' => '付款方式', - 'cf_title' => '客户来源', - 'status_name' => '状态', - 'c_time' => '订单时间' - ]; array_unshift($data, $indexs); $this->load->library('excel'); return $this->excel->out_csv($data, $indexs, $fileName . "_" . date('YmdHis')); diff --git a/admin/controllers/receiver/order/Sign.php b/admin/controllers/receiver/order/Sign.php index 00180451..ae94e649 100644 --- a/admin/controllers/receiver/order/Sign.php +++ b/admin/controllers/receiver/order/Sign.php @@ -13,6 +13,7 @@ class Sign extends HD_Controller public function __construct() { parent::__construct(); + $this->load->library('OrdersList'); } public function index() @@ -23,7 +24,6 @@ class Sign extends HD_Controller public function lists() { $params = $this->input->get(); - $this->load->library('OrdersList'); $result = $this->orderslist->lists($this->status_pid, $params); $this->data = $result; return $this->show_view($result['view'], true); @@ -61,39 +61,23 @@ class Sign extends HD_Controller $params = $this->input->get(); $params['page'] = 1; $params['size'] = 10000; + $indexs = []; + $fieldAry = $this->orderslist->get_fields($this->status_pid, 1); + foreach ($fieldAry as $key => $value) { + $indexs[$key] = $value['title']; + } $this->load->library('OrdersList'); $result = $this->orderslist->lists($this->status_pid, $params); $fileName = $result['_title']; foreach ($result['lists'] as $key => $value) { - $temp['name'] = $value['name']; - $temp['mobile'] = $value['mobile']; - $temp['car_name'] = $value['car_name']; - $temp['biz_name'] = $value['biz_name']; - $temp['price'] = $value['price']; - $temp['deposit'] = $value['deposit']; - $temp['payway_name'] = $value['payway_name']; - $temp['admin_name'] = $value['admin_name']; - $temp['cf_title'] = $value['cf_title']; - $temp['status_name'] = $value['status_name']; - $temp['c_time'] = $value['c_time']; + $temp = array(); + foreach ($fieldAry as $key2 => $value2) { + $temp[$key2] = $value[$key2]; + } $data[] = $temp; } - $indexs = [ - 'name' => '客户姓名', - 'mobile' => '客户电话', - 'car_name' => '车辆', - 'biz_name' => '门店', - 'price' => '合同价', - 'deposit' => '定金', - 'payway_name' => '付款', - 'admin_name' => '销售员', - 'cf_title' => '客户来源', - 'status_name' => '合同状态', - 'c_time' => '订单时间' - ]; array_unshift($data, $indexs); $this->load->library('excel'); return $this->excel->out_csv($data, $indexs, $fileName . "_" . date('YmdHis')); } - } diff --git a/admin/libraries/OrdersList.php b/admin/libraries/OrdersList.php index 87a80e6e..5ed3cbc9 100644 --- a/admin/libraries/OrdersList.php +++ b/admin/libraries/OrdersList.php @@ -5,11 +5,9 @@ */ class OrdersList { - private $ci; private $searchTpAry = array('name' => '客户姓名', 'mobile' => '客户手机号', 'sid' => '订单号'); private $paywayAry = array(0 => '贷款', 1 => '全款'); - private $cfTitleAry = array('平台分配', '自有资源'); public function __construct() { @@ -17,6 +15,7 @@ class OrdersList $this->ci->load->model('receiver/order/receiver_orders_model', 'mdOrders'); $this->ci->load->model('app/licheb/app_licheb_users_model', 'mdLichebUsers'); $this->ci->load->model('receiver/receiver_customers_model', 'mdCustomers'); + $this->ci->load->model('receiver/receiver_clues_cfrom_model', 'mdCluesCfrom'); $this->ci->load->model("biz/biz_model"); $this->ci->load->model('auto/auto_series_model'); $this->ci->load->model('auto/auto_brand_model'); @@ -25,18 +24,25 @@ class OrdersList public function lists($status_pid, $params = array()) { - $result = array(); + $result = $show_info = array(); !$params['qdjl_id'] && $params['qdjl_id'] = ''; + !$params['cf_title'] && $params['cf_title'] = ''; + !$params['cf_clues'] && $params['cf_clues'] = ''; + !$params['payway'] && $params['payway'] = ''; + $fieldAry = $this->get_fields($status_pid); + $show_info['cfTitleAry'] = $this->ci->mdCustomers->get_sdata('cfrom');//来源类型 + $show_info['cfCluesAry'] = $this->ci->mdCustomers->get_sdata('cfrom_clues');//线下来源 + $show_info['paywayAry'] = $this->paywayAry;//付款方式 //渠道经理 - $qdjl_lists = $this->ci->mdLichebUsers->select(array('group_id' => 4, 'status' => 1, 'biz_id<>' => '0'), 'id desc', 0, 0, 'id,uname as name'); + $show_info['qdjl_lists'] = $this->ci->mdLichebUsers->select(array('group_id' => 4, 'status' => 1, 'biz_id<>' => '0') + , 'id desc', 0, 0, 'id,uname as name'); if (!strlen($status_pid) || $status_pid == 6 || $status_pid == 7) { if ($status_pid) { $params['status'] = $status_pid; } $result = $this->orders($params); - $result['qdjl_lists'] = $qdjl_lists; - $result['paywayAry'] = $this->paywayAry; - $result['cfTitleAry'] = $this->cfTitleAry; + $result['show_info'] = $show_info; + $result['fieldAry'] = $fieldAry; return $result; } if ($status_pid == 0) { @@ -58,9 +64,8 @@ class OrdersList $this->ci->load->model('receiver/order/receiver_order_deliverys_model', 'order_deliverys_model'); $result = $this->delivery($status_pid, $params); } - $result['qdjl_lists'] = $qdjl_lists; - $result['paywayAry'] = $this->paywayAry; - $result['cfTitleAry'] = $this->cfTitleAry; + $result['show_info'] = $show_info; + $result['fieldAry'] = $fieldAry; return $result; } @@ -76,22 +81,45 @@ class OrdersList $page = $params['page'] = $params['page'] ? intval($params['page']) : 1; $size = $params['size'] = $params['size'] ? intval($params['size']) : 20; $status_arr = $this->ci->mdOrders->statusAry(); + $view_type = 'orders'; if ($params['status']) { $where = ["status" => $params['status']]; $_title = $status_arr[$params['status']]['name']; - $view = 'receiver/order/deal/lists'; + $view = 'receiver/order/lists'; + if ($params['status'] == 6) { + $view_type = 'deal'; + } else if ($params['status'] == 7) { + $view_type = 'refund'; + } } else { $where = ["status>=" => 0]; $_title = '全部订单'; $view = 'receiver/orders/lists'; } - $where['biz_id!='] = 1; - if($_SESSION['admin_info']['biz_id']){ - $biz_ids = implode(',',$_SESSION['admin_info']['biz_id']); + $where['biz_id<>'] = 1; + if ($_SESSION['admin_info']['biz_id']) { + $biz_ids = implode(',', $_SESSION['admin_info']['biz_id']); $where["biz_id in ($biz_ids)"] = null; } - if ($params['cf_title']) { - $where['rid in (select id from lc_receiver_customers where cf_title = "' . $params['cf_title'] . '")'] = null; + if ($params['cf_title'] || $params['cf_clues'] || $params['cfrom_id'] || $params['cfrom_id2']) { + $where_c = 'status>=0'; + if ($params['cfrom_id'] == 24) { + $where_c .= ' and cf_id = 24'; + $params['cfrom_id2'] && $where_c .= ' and t_id = ' . $params['cfrom_id2']; + } else { + if ($params['cfrom_id2']) { + $where_c .= ' and cf_id = ' . $params['cfrom_id2']; + } else if ($params['cfrom_id']) { + $cf_rows = $this->ci->mdCluesCfrom->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_c .= " and cf_id in ({$cf_str_ids})"; + } + } + $params['cf_title'] && $where_c .= ' and cf_title = "' . $params['cf_title'] . '"'; + $params['cf_clues'] && $where_c .= ' and cf_clues = "' . $params['cf_clues'] . '"'; + $where['rid in (select id from lc_receiver_customers where ' . $where_c . ')'] = null; } if (strlen($params['payway'])) { $where["payway"] = $params['payway']; @@ -206,26 +234,31 @@ class OrdersList $attr_arr = array_merge($v_arr, $cor_arr, $incor_arr); $attr = $this->ci->auto_attr_model->get_map_by_ids($attr_arr, 'id,title'); foreach ($rows as $key => $val) { + $fields = array(); $brand_name = isset($brands[$val['brand_id']]) ? $brands[$val['brand_id']][0]['name'] : ''; $series_name = isset($series[$val['s_id']]) ? $series[$val['s_id']][0]['name'] : ''; $v_name = isset($attr[$val['v_id']]) ? $attr[$val['v_id']][0]['title'] : ''; $cor_name = isset($attr[$val['cor_id']]) ? $attr[$val['cor_id']][0]['title'] : ''; - $val['car_name'] = "{$brand_name}-{$series_name}-{$v_name}-{$cor_name}"; - $val['price'] = number_format($val['price'], 2); - $val['deposit'] = number_format($val['deposit'], 2); - $val['payway_name'] = $this->paywayAry[$val['payway']]; - $val['incor_name'] = isset($attr[$val['incor_id']]) ? $attr[$val['incor_id']][0]['title'] : ''; - $val['status_name'] = $status_arr[$val['status']]['name']; - $val['biz_name'] = $bizs[$val['biz_id']]; - $val['c_time'] = date('Y-m-d H:i:s', $val['c_time']); - $val['cf_title'] = $customers[$val['rid']]; - $lists[] = $val; + $fields['mobile'] = $val['mobile']; + $fields['name'] = $size > 1000 ? $val['name'] + : '' . $val['name'] . '
' . $val['mobile'] . '
'; + $fields['car_name'] = "{$brand_name}-{$series_name}-{$v_name}-{$cor_name}"; + $fields['price'] = number_format($val['price'], 2); + $fields['deposit'] = number_format($val['deposit'], 2); + $fields['payway_name'] = $this->paywayAry[$val['payway']]; + $fields['incor_name'] = isset($attr[$val['incor_id']]) ? $attr[$val['incor_id']][0]['title'] : ''; + $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']]; + $lists[] = $fields; } } $pager = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count); $_title = $size > 1000 ? $_title : $_title . '列表'; + $view_type != 'orders' && $status_arr = []; return array('lists' => $lists, 'pager' => $pager, 'params' => $params, 'status_arr' => $status_arr - , 'searchTpAry' => $this->searchTpAry, 'view' => $view, '_title' => $_title); + , 'searchTpAry' => $this->searchTpAry, 'view' => $view, 'view_type' => $view_type, '_title' => $_title); } /** @@ -246,12 +279,29 @@ class OrdersList "$t2.status>=" => 0, "$t2.biz_id!=" => 1, ]; - if($_SESSION['admin_info']['biz_id']){ - $biz_ids = implode(',',$_SESSION['admin_info']['biz_id']); + if ($_SESSION['admin_info']['biz_id']) { + $biz_ids = implode(',', $_SESSION['admin_info']['biz_id']); $where["$t2.biz_id in ($biz_ids)"] = null; } - if ($params['cf_title']) { - $where[$t2.'.rid in (select id from lc_receiver_customers where cf_title = "' . $params['cf_title'] . '")'] = null; + if ($params['cf_title'] || $params['cf_clues'] || $params['cfrom_id'] || $params['cfrom_id2']) { + $where_c = 'status>=0'; + if ($params['cfrom_id'] == 24) { + $where_c .= ' and cf_id = 24'; + $params['cfrom_id2'] && $where_c .= ' and t_id = ' . $params['cfrom_id2']; + } else { + if ($params['cfrom_id2']) { + $where_c .= ' and cf_id = ' . $params['cfrom_id2']; + } else if ($params['cfrom_id']) { + $cf_rows = $this->ci->mdCluesCfrom->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_c .= " and cf_id in ({$cf_str_ids})"; + } + } + $params['cf_title'] && $where_c .= ' and cf_title = "' . $params['cf_title'] . '"'; + $params['cf_clues'] && $where_c .= ' and cf_clues = "' . $params['cf_clues'] . '"'; + $where[$t2 . '.rid in (select id from lc_receiver_customers where ' . $where_c . ')'] = null; } if (strlen($params['payway'])) { $where["{$t2}.payway"] = $params['payway']; @@ -346,7 +396,6 @@ class OrdersList $where['admin_id'] = -1; } } - !$params['city_id_admin'] && $params['city_id_admin'] = ''; !$params['county_id_admin'] && $params['county_id_admin'] = ''; !$params['biz_id_admin'] && $params['biz_id_admin'] = ''; @@ -403,28 +452,32 @@ class OrdersList } } foreach ($rows as $key => $val) { + $fields = array(); $admin = $map_admin[$val['admin_id']]; $brand_name = isset($brands[$val['brand_id']]) ? $brands[$val['brand_id']][0]['name'] : ''; $series_name = isset($series[$val['s_id']]) ? $series[$val['s_id']][0]['name'] : ''; $v_name = isset($attr[$val['v_id']]) ? $attr[$val['v_id']][0]['title'] : ''; $cor_name = isset($attr[$val['cor_id']]) ? $attr[$val['cor_id']][0]['title'] : ''; - $val['car_name'] = "{$brand_name}-{$series_name}-{$v_name}-{$cor_name}"; - $val['payway_name'] = $this->paywayAry[$val['payway']]; - $val['c_time'] = date('Y-m-d H:i:s', $val['c_time']); - $val['incor_name'] = isset($attr[$val['incor_id']]) ? $attr[$val['incor_id']][0]['title'] : ''; - $val['status_name'] = $status_arr[$val['status']]; - $val['admin_name'] = $admin ? $admin['uname'] : ''; - $val['price'] = $val['price'] > 1 ? number_format($val['price']) : number_format($val['price'], 2); - $val['deposit'] = $val['deposit'] > 1 ? number_format($val['deposit']) : number_format($val['deposit'], 2); - $val['biz_name'] = $map_biz[$admin['biz_id']]; - $val['cf_title'] = $customers[$val['rid']]; - $lists[] = $val; + $fields['mobile'] = $val['mobile']; + $fields['name'] = $size > 1000 ? $val['name'] + : '' . $val['name'] . '
' . $val['mobile'] . '
'; + $fields['car_name'] = "{$brand_name}-{$series_name}-{$v_name}-{$cor_name}"; + $fields['payway_name'] = $this->paywayAry[$val['payway']]; + $fields['c_time'] = date('Y-m-d H:i:s', $val['c_time']); + $fields['incor_name'] = isset($attr[$val['incor_id']]) ? $attr[$val['incor_id']][0]['title'] : ''; + $fields['status_name'] = $status_arr[$val['status']]; + $fields['admin_name'] = $admin ? $admin['uname'] : ''; + $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']]; + $lists[] = $fields; } } $pager = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count); $_title = $size > 1000 ? $statusAry['name'] : $statusAry['name'] . '列表'; return array('lists' => $lists, 'pager' => $pager, 'params' => $params, 'status_arr' => $status_arr - , 'searchTpAry' => $this->searchTpAry, 'view' => 'receiver/order/sign/lists', '_title' => $_title); + , 'searchTpAry' => $this->searchTpAry, 'view' => 'receiver/order/lists', 'view_type' => 'sign', '_title' => $_title); } /** @@ -445,12 +498,29 @@ class OrdersList "$t2.status>=" => 0, "$t2.biz_id!=" => 1, ]; - if($_SESSION['admin_info']['biz_id']){ - $biz_ids = implode(',',$_SESSION['admin_info']['biz_id']); + if ($_SESSION['admin_info']['biz_id']) { + $biz_ids = implode(',', $_SESSION['admin_info']['biz_id']); $where["$t2.biz_id in ($biz_ids)"] = null; } - if ($params['cf_title']) { - $where[$t2.'.rid in (select id from lc_receiver_customers where cf_title = "' . $params['cf_title'] . '")'] = null; + if ($params['cf_title'] || $params['cf_clues'] || $params['cfrom_id'] || $params['cfrom_id2']) { + $where_c = 'status>=0'; + if ($params['cfrom_id'] == 24) { + $where_c .= ' and cf_id = 24'; + $params['cfrom_id2'] && $where_c .= ' and t_id = ' . $params['cfrom_id2']; + } else { + if ($params['cfrom_id2']) { + $where_c .= ' and cf_id = ' . $params['cfrom_id2']; + } else if ($params['cfrom_id']) { + $cf_rows = $this->ci->mdCluesCfrom->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_c .= " and cf_id in ({$cf_str_ids})"; + } + } + $params['cf_title'] && $where_c .= ' and cf_title = "' . $params['cf_title'] . '"'; + $params['cf_clues'] && $where_c .= ' and cf_clues = "' . $params['cf_clues'] . '"'; + $where[$t2 . '.rid in (select id from lc_receiver_customers where ' . $where_c . ')'] = null; } if (strlen($params['payway'])) { $where["{$t2}.payway"] = $params['payway']; @@ -564,20 +634,24 @@ class OrdersList $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) { + $fields = array(); $money_json = json_decode($val['money_json'], true); $price_loan = $money_json['price_loan'] ? $money_json['price_loan'] : 0; - $val['title'] = $finance_rows[$val['finance_id']] ? $finance_rows[$val['finance_id']][0]['title'] : ''; - $val['price_loan'] = number_format($price_loan, 2); - $val['c_time'] = date('Y-m-d H:i:s', $val['c_time']); - $val['status_name'] = $status_arr[$val['status']]; - $val['cf_title'] = $customers[$val['rid']]; - $lists[] = $val; + $fields['mobile'] = $val['mobile']; + $fields['name'] = $size > 1000 ? $val['name'] + : '' . $val['name'] . '
' . $val['mobile'] . '
'; + $fields['title'] = $finance_rows[$val['finance_id']] ? $finance_rows[$val['finance_id']][0]['title'] : ''; + $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']]; + $lists[] = $fields; } } $pager = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count); $_title = $size > 1000 ? $statusAry['name'] : $statusAry['name'] . '列表'; return array('lists' => $lists, 'pager' => $pager, 'params' => $params, 'status_arr' => $status_arr - , 'searchTpAry' => $this->searchTpAry, 'view' => 'receiver/order/loan/lists', '_title' => $_title); + , 'searchTpAry' => $this->searchTpAry, 'view' => 'receiver/order/lists', 'view_type' => 'loan', '_title' => $_title); } /** @@ -598,12 +672,29 @@ class OrdersList "$t2.status>=" => 0, "$t2.biz_id!=" => 1, ]; - if($_SESSION['admin_info']['biz_id']){ - $biz_ids = implode(',',$_SESSION['admin_info']['biz_id']); + if ($_SESSION['admin_info']['biz_id']) { + $biz_ids = implode(',', $_SESSION['admin_info']['biz_id']); $where["$t2.biz_id in ($biz_ids)"] = null; } - if ($params['cf_title']) { - $where[$t2.'.rid in (select id from lc_receiver_customers where cf_title = "' . $params['cf_title'] . '")'] = null; + if ($params['cf_title'] || $params['cf_clues'] || $params['cfrom_id'] || $params['cfrom_id2']) { + $where_c = 'status>=0'; + if ($params['cfrom_id'] == 24) { + $where_c .= ' and cf_id = 24'; + $params['cfrom_id2'] && $where_c .= ' and t_id = ' . $params['cfrom_id2']; + } else { + if ($params['cfrom_id2']) { + $where_c .= ' and cf_id = ' . $params['cfrom_id2']; + } else if ($params['cfrom_id']) { + $cf_rows = $this->ci->mdCluesCfrom->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_c .= " and cf_id in ({$cf_str_ids})"; + } + } + $params['cf_title'] && $where_c .= ' and cf_title = "' . $params['cf_title'] . '"'; + $params['cf_clues'] && $where_c .= ' and cf_clues = "' . $params['cf_clues'] . '"'; + $where[$t2 . '.rid in (select id from lc_receiver_customers where ' . $where_c . ')'] = null; } if (strlen($params['payway'])) { $where["{$t2}.payway"] = $params['payway']; @@ -730,25 +821,29 @@ class OrdersList $attr_arr = array_merge($v_arr, $cor_arr, $incor_arr); $attr = $this->ci->auto_attr_model->get_map_by_ids($attr_arr, 'id,title'); foreach ($rows as $key => $val) { + $fields = array(); $brand_name = isset($brands[$val['brand_id']]) ? $brands[$val['brand_id']][0]['name'] : ''; $series_name = isset($series[$val['s_id']]) ? $series[$val['s_id']][0]['name'] : ''; $v_name = isset($attr[$val['v_id']]) ? $attr[$val['v_id']][0]['title'] : ''; $cor_name = isset($attr[$val['cor_id']]) ? $attr[$val['cor_id']][0]['title'] : ''; - $val['car_name'] = "{$brand_name}-{$series_name}-{$v_name}-{$cor_name}"; - $val['price'] = number_format($val['price'], 2); - $val['deposit'] = number_format($val['deposit'], 2); - $val['payway_name'] = $this->paywayAry[$val['payway']]; - $val['incor_name'] = isset($attr[$val['incor_id']]) ? $attr[$val['incor_id']][0]['title'] : ''; - $val['status_name'] = $status_arr[$val['status']]; - $val['biz_name'] = $bizs[$val['biz_id']]; - $val['cf_title'] = $customers[$val['rid']]; - $lists[] = $val; + $fields['mobile'] = $val['mobile']; + $fields['name'] = $size > 1000 ? $val['name'] + : '' . $val['name'] . '
' . $val['mobile'] . '
'; + $fields['car_name'] = "{$brand_name}-{$series_name}-{$v_name}-{$cor_name}"; + $fields['price'] = number_format($val['price'], 2); + $fields['deposit'] = number_format($val['deposit'], 2); + $fields['payway_name'] = $this->paywayAry[$val['payway']]; + $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']]; + $lists[] = $fields; } } $pager = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count); $_title = $size > 1000 ? $statusAry['name'] : $statusAry['name'] . '列表'; return array('lists' => $lists, 'pager' => $pager, 'params' => $params, 'status_arr' => $status_arr - , 'searchTpAry' => $this->searchTpAry, 'view' => 'receiver/order/ckcar/lists', '_title' => $_title); + , 'searchTpAry' => $this->searchTpAry, 'view' => 'receiver/order/lists', 'view_type' => 'ckcar', '_title' => $_title); } /** @@ -769,12 +864,29 @@ class OrdersList "$t2.status>=" => 0, "$t2.biz_id!=" => 1, ]; - if($_SESSION['admin_info']['biz_id']){ - $biz_ids = implode(',',$_SESSION['admin_info']['biz_id']); + if ($_SESSION['admin_info']['biz_id']) { + $biz_ids = implode(',', $_SESSION['admin_info']['biz_id']); $where["$t2.biz_id in ($biz_ids)"] = null; } - if ($params['cf_title']) { - $where[$t2.'.rid in (select id from lc_receiver_customers where cf_title = "' . $params['cf_title'] . '")'] = null; + if ($params['cf_title'] || $params['cf_clues'] || $params['cfrom_id'] || $params['cfrom_id2']) { + $where_c = 'status>=0'; + if ($params['cfrom_id'] == 24) { + $where_c .= ' and cf_id = 24'; + $params['cfrom_id2'] && $where_c .= ' and t_id = ' . $params['cfrom_id2']; + } else { + if ($params['cfrom_id2']) { + $where_c .= ' and cf_id = ' . $params['cfrom_id2']; + } else if ($params['cfrom_id']) { + $cf_rows = $this->ci->mdCluesCfrom->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_c .= " and cf_id in ({$cf_str_ids})"; + } + } + $params['cf_title'] && $where_c .= ' and cf_title = "' . $params['cf_title'] . '"'; + $params['cf_clues'] && $where_c .= ' and cf_clues = "' . $params['cf_clues'] . '"'; + $where[$t2 . '.rid in (select id from lc_receiver_customers where ' . $where_c . ')'] = null; } if (strlen($params['payway'])) { $where["{$t2}.payway"] = $params['payway']; @@ -901,25 +1013,29 @@ class OrdersList $attr_arr = array_merge($v_arr, $cor_arr, $incor_arr); $attr = $this->ci->auto_attr_model->get_map_by_ids($attr_arr, 'id,title'); foreach ($rows as $key => $val) { + $fields = array(); $brand_name = isset($brands[$val['brand_id']]) ? $brands[$val['brand_id']][0]['name'] : ''; $series_name = isset($series[$val['s_id']]) ? $series[$val['s_id']][0]['name'] : ''; $v_name = isset($attr[$val['v_id']]) ? $attr[$val['v_id']][0]['title'] : ''; $cor_name = isset($attr[$val['cor_id']]) ? $attr[$val['cor_id']][0]['title'] : ''; - $val['car_name'] = "{$brand_name}-{$series_name}-{$v_name}-{$cor_name}"; - $val['price'] = number_format($val['price'], 2); - $val['deposit'] = number_format($val['deposit'], 2); - $val['payway_name'] = $this->paywayAry[$val['payway']]; - $val['incor_name'] = isset($attr[$val['incor_id']]) ? $attr[$val['incor_id']][0]['title'] : ''; - $val['status_name'] = $status_arr[$val['status']]; - $val['biz_name'] = $bizs[$val['biz_id']]; - $val['cf_title'] = $customers[$val['rid']]; - $lists[] = $val; + $fields['mobile'] = $val['mobile']; + $fields['name'] = $size > 1000 ? $val['name'] + : '' . $val['name'] . '
' . $val['mobile'] . '
'; + $fields['car_name'] = "{$brand_name}-{$series_name}-{$v_name}-{$cor_name}"; + $fields['price'] = number_format($val['price'], 2); + $fields['deposit'] = number_format($val['deposit'], 2); + $fields['payway_name'] = $this->paywayAry[$val['payway']]; + $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']]; + $lists[] = $fields; } } $pager = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count); $_title = $size > 1000 ? $statusAry['name'] : $statusAry['name'] . '列表'; return array('lists' => $lists, 'pager' => $pager, 'params' => $params, 'status_arr' => $status_arr - , 'searchTpAry' => $this->searchTpAry, 'view' => 'receiver/order/bill/lists', '_title' => $_title); + , 'searchTpAry' => $this->searchTpAry, 'view' => 'receiver/order/lists', 'view_type' => 'bill', '_title' => $_title); } /** @@ -940,12 +1056,29 @@ class OrdersList "$t2.status>=" => 0, "$t2.biz_id!=" => 1, ]; - if($_SESSION['admin_info']['biz_id']){ - $biz_ids = implode(',',$_SESSION['admin_info']['biz_id']); + if ($_SESSION['admin_info']['biz_id']) { + $biz_ids = implode(',', $_SESSION['admin_info']['biz_id']); $where["$t2.biz_id in ($biz_ids)"] = null; } - if ($params['cf_title']) { - $where[$t2.'.rid in (select id from lc_receiver_customers where cf_title = "' . $params['cf_title'] . '")'] = null; + if ($params['cf_title'] || $params['cf_clues'] || $params['cfrom_id'] || $params['cfrom_id2']) { + $where_c = 'status>=0'; + if ($params['cfrom_id'] == 24) { + $where_c .= ' and cf_id = 24'; + $params['cfrom_id2'] && $where_c .= ' and t_id = ' . $params['cfrom_id2']; + } else { + if ($params['cfrom_id2']) { + $where_c .= ' and cf_id = ' . $params['cfrom_id2']; + } else if ($params['cfrom_id']) { + $cf_rows = $this->ci->mdCluesCfrom->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_c .= " and cf_id in ({$cf_str_ids})"; + } + } + $params['cf_title'] && $where_c .= ' and cf_title = "' . $params['cf_title'] . '"'; + $params['cf_clues'] && $where_c .= ' and cf_clues = "' . $params['cf_clues'] . '"'; + $where[$t2 . '.rid in (select id from lc_receiver_customers where ' . $where_c . ')'] = null; } if (strlen($params['payway'])) { $where["{$t2}.payway"] = $params['payway']; @@ -1072,25 +1205,29 @@ class OrdersList $attr_arr = array_merge($v_arr, $cor_arr, $incor_arr); $attr = $this->ci->auto_attr_model->get_map_by_ids($attr_arr, 'id,title'); foreach ($rows as $key => $val) { + $fields = array(); $brand_name = isset($brands[$val['brand_id']]) ? $brands[$val['brand_id']][0]['name'] : ''; $series_name = isset($series[$val['s_id']]) ? $series[$val['s_id']][0]['name'] : ''; $v_name = isset($attr[$val['v_id']]) ? $attr[$val['v_id']][0]['title'] : ''; $cor_name = isset($attr[$val['cor_id']]) ? $attr[$val['cor_id']][0]['title'] : ''; - $val['car_name'] = "{$brand_name}-{$series_name}-{$v_name}-{$cor_name}"; - $val['price'] = number_format($val['price'], 2); - $val['deposit'] = number_format($val['deposit'], 2); - $val['payway_name'] = $this->paywayAry[$val['payway']]; - $val['incor_name'] = isset($attr[$val['incor_id']]) ? $attr[$val['incor_id']][0]['title'] : ''; - $val['status_name'] = $status_arr[$val['status']]; - $val['biz_name'] = $bizs[$val['biz_id']]; - $val['cf_title'] = $customers[$val['rid']]; - $lists[] = $val; + $fields['mobile'] = $val['mobile']; + $fields['name'] = $size > 1000 ? $val['name'] + : '' . $val['name'] . '
' . $val['mobile'] . '
'; + $fields['car_name'] = "{$brand_name}-{$series_name}-{$v_name}-{$cor_name}"; + $fields['price'] = number_format($val['price'], 2); + $fields['deposit'] = number_format($val['deposit'], 2); + $fields['payway_name'] = $this->paywayAry[$val['payway']]; + $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']]; + $lists[] = $fields; } } $pager = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count); $_title = $size > 1000 ? $statusAry['name'] : $statusAry['name'] . '列表'; return array('lists' => $lists, 'pager' => $pager, 'params' => $params, 'status_arr' => $status_arr - , 'searchTpAry' => $this->searchTpAry, 'view' => 'receiver/order/agent/lists', '_title' => $_title); + , 'searchTpAry' => $this->searchTpAry, 'view' => 'receiver/order/lists', 'view_type' => 'agent', '_title' => $_title); } /** @@ -1111,12 +1248,29 @@ class OrdersList "$t2.status>=" => 0, "$t2.biz_id!=" => 1, ]; - if($_SESSION['admin_info']['biz_id']){ - $biz_ids = implode(',',$_SESSION['admin_info']['biz_id']); + if ($_SESSION['admin_info']['biz_id']) { + $biz_ids = implode(',', $_SESSION['admin_info']['biz_id']); $where["$t2.biz_id in ($biz_ids)"] = null; } - if ($params['cf_title']) { - $where[$t2.'.rid in (select id from lc_receiver_customers where cf_title = "' . $params['cf_title'] . '")'] = null; + if ($params['cf_title'] || $params['cf_clues'] || $params['cfrom_id'] || $params['cfrom_id2']) { + $where_c = 'status>=0'; + if ($params['cfrom_id'] == 24) { + $where_c .= ' and cf_id = 24'; + $params['cfrom_id2'] && $where_c .= ' and t_id = ' . $params['cfrom_id2']; + } else { + if ($params['cfrom_id2']) { + $where_c .= ' and cf_id = ' . $params['cfrom_id2']; + } else if ($params['cfrom_id']) { + $cf_rows = $this->ci->mdCluesCfrom->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_c .= " and cf_id in ({$cf_str_ids})"; + } + } + $params['cf_title'] && $where_c .= ' and cf_title = "' . $params['cf_title'] . '"'; + $params['cf_clues'] && $where_c .= ' and cf_clues = "' . $params['cf_clues'] . '"'; + $where[$t2 . '.rid in (select id from lc_receiver_customers where ' . $where_c . ')'] = null; } if (strlen($params['payway'])) { $where["{$t2}.payway"] = $params['payway']; @@ -1243,27 +1397,76 @@ class OrdersList $attr_arr = array_merge($v_arr, $cor_arr, $incor_arr); $attr = $this->ci->auto_attr_model->get_map_by_ids($attr_arr, 'id,title'); foreach ($rows as $key => $val) { + $fields = array(); $brand_name = isset($brands[$val['brand_id']]) ? $brands[$val['brand_id']][0]['name'] : ''; $series_name = isset($series[$val['s_id']]) ? $series[$val['s_id']][0]['name'] : ''; $v_name = isset($attr[$val['v_id']]) ? $attr[$val['v_id']][0]['title'] : ''; $cor_name = isset($attr[$val['cor_id']]) ? $attr[$val['cor_id']][0]['title'] : ''; - $val['car_name'] = "{$brand_name}-{$series_name}-{$v_name}-{$cor_name}"; - $val['price'] = number_format($val['price'], 2); - $val['deposit'] = number_format($val['deposit'], 2); - $val['payway_name'] = $this->paywayAry[$val['payway']]; - $val['incor_name'] = isset($attr[$val['incor_id']]) ? $attr[$val['incor_id']][0]['title'] : ''; - $val['status_name'] = $status_arr[$val['status']]; - $val['biz_name'] = $bizs[$val['biz_id']]; - $val['cf_title'] = $customers[$val['rid']]; - $lists[] = $val; + $fields['mobile'] = $val['mobile']; + $fields['name'] = $size > 1000 ? $val['name'] + : '' . $val['name'] . '
' . $val['mobile'] . '
'; + $fields['car_name'] = "{$brand_name}-{$series_name}-{$v_name}-{$cor_name}"; + $fields['price'] = number_format($val['price'], 2); + $fields['deposit'] = number_format($val['deposit'], 2); + $fields['payway_name'] = $this->paywayAry[$val['payway']]; + $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']]; + $lists[] = $fields; } } $pager = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count); $_title = $size > 1000 ? $statusAry['name'] : $statusAry['name'] . '列表'; return array('lists' => $lists, 'pager' => $pager, 'params' => $params, 'status_arr' => $status_arr - , 'searchTpAry' => $this->searchTpAry, 'view' => 'receiver/order/delivery/lists', '_title' => $_title); + , 'searchTpAry' => $this->searchTpAry, 'view' => 'receiver/order/lists', 'view_type' => 'delivery', '_title' => $_title); } + /** + * Notes:获取字段 + * Created on: 2021/10/29 15:38 + * Created by: dengbw + * @param $status_pid + * @param int $export + * @return array + */ + public function get_fields($status_pid, $export = 0) + { + $fields1 = $fields2 = []; + if ($export) { + $fields1['name'] = ['title' => '客户姓名']; + $fields1['mobile'] = ['title' => '客户电话']; + } else { + $fields1['name'] = ['title' => '客户', 'width' => '14%']; + } + 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%'], + '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%']]; + $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%']]; + $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%'], + 'c_time' => ['title' => '订单时间', 'width' => '9%']]; + $fields = array_merge($fields1, $fields2); + } + return $fields; + } } diff --git a/admin/views/receiver/customer/lists.php b/admin/views/receiver/customer/lists.php index 3cedaed1..de855202 100644 --- a/admin/views/receiver/customer/lists.php +++ b/admin/views/receiver/customer/lists.php @@ -37,11 +37,9 @@
- + +
@@ -355,6 +353,7 @@ that.cfrom_id2 = 0; that.params.city_id_admin = ''; that.params.cf_clues = ''; + that.params.cf_title = ''; $('#cf_time').val(''); $(".order-times").map(function () { var id = this.value; diff --git a/admin/views/receiver/order/lists.php b/admin/views/receiver/order/lists.php new file mode 100644 index 00000000..d4bb6d99 --- /dev/null +++ b/admin/views/receiver/order/lists.php @@ -0,0 +1,598 @@ + + +
+
+ +
+ 1) { ?> +
+ +
+ +
+ + + +
+
+ 个订单 +
+ + + + + + + + + + + + $val) { ?> + + + + + +
+
+
+
+
+
+ +
+
+
+ diff --git a/admin/views/receiver/orders/lists.php b/admin/views/receiver/orders/lists.php index 2a3fd2db..66f0962e 100644 --- a/admin/views/receiver/orders/lists.php +++ b/admin/views/receiver/orders/lists.php @@ -86,6 +86,62 @@
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
@@ -113,30 +169,6 @@
-
- -
- -
-
-
- -
- -
-
@@ -169,15 +201,6 @@
-
- -
- -
-
@@ -196,7 +219,7 @@
- 个客户 + 个订单
@@ -216,9 +239,7 @@ - + @@ -280,17 +301,34 @@ attrcorAry: [],//车身颜色选项 admins: {cityAry: [], countyAry: [], bizAry: [], list: []}, lists: [], - qdjl_lists: [] + show_info: {cfTitleAry: [], qdjl_lists: []}, + cfrom_id:, + cfrom_id2:, + cfroms: [], + cfroms2: [], }, mounted: function () { var vm = this; vm.lists = ; vm.params = ; - vm.qdjl_lists = ; + vm.show_info = ; + vm.getCfroms(); vm.init_brands(); 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 + }); + } + }, export_out: function () { var count = ; if (count > 10000) { @@ -343,14 +381,40 @@ $("#search_tp").val('name'); $("#title").val(''); $("#id-create-time").val(''); - $("#payway").val(''); - $("#cf_title").val(''); + that.cfrom_id = 0; + that.cfrom_id2 = 0; + that.params.cf_title = ''; + that.params.cf_clues = ''; + that.params.payway = ''; that.params.brand_id = ''; that.params.city_id_admin = ''; that.params.qdjl_id = ''; } }, watch: { + '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.brand_id': function (nv, ov) { var vm = this; vm.seryAry = {};
- ' . $v['mobile'] ?> -