From 064683372a34bd6f2efe5dc872f5a8a174b04f09 Mon Sep 17 00:00:00 2001 From: lccsw <805383944@qq.com> Date: Wed, 25 May 2022 14:51:32 +0800 Subject: [PATCH] add-api-order_filter --- api/controllers/wxapp/licheb/CusorderV2.php | 218 ++++++++++++-------- api/controllers/wxapp/licheb/User.php | 98 ++++----- 2 files changed, 179 insertions(+), 137 deletions(-) diff --git a/api/controllers/wxapp/licheb/CusorderV2.php b/api/controllers/wxapp/licheb/CusorderV2.php index ac83f866..c1ace0ed 100644 --- a/api/controllers/wxapp/licheb/CusorderV2.php +++ b/api/controllers/wxapp/licheb/CusorderV2.php @@ -57,7 +57,7 @@ class CusorderV2 extends Wxapp{ }else{ return $this->lists(); } - } + } //创建订单 protected function post(){ @@ -187,7 +187,7 @@ class CusorderV2 extends Wxapp{ $color_arr = json_decode($business_row['colors'],true); $price_color = in_array($color_id,$color_arr) ? $business_row['price_color'] : 0; $price_coplus = $main_type ? $business_row['price_coplus'] : 0; - + $money_json = [ 'price_car' => $business_row['price_car'], 'price_book' => $deposit ? $deposit : 0, @@ -296,7 +296,7 @@ class CusorderV2 extends Wxapp{ $money_json['price_intention'] = $inten_money ? $inten_money : 0; $data['money_json'] = json_encode($money_json,JSON_UNESCAPED_UNICODE); - + $row['rid'] && $data['clue_id'] = $row['rid']; $o_id = $this->orders_model->add($data); if(!$o_id){ @@ -604,13 +604,17 @@ class CusorderV2 extends Wxapp{ return $data; } - private function lists(){ + private function lists() + { $group_id = $this->session['group_id']; $uid = $this->session['uid']; $keyword = $this->input_param('keyword'); $status = $this->input_param('status'); $page = $this->input_param('page'); $size = $this->input_param('size'); + $type = $this->input_param('type'); + $order_s_time = $this->input_param('order_s_time'); + $order_e_time = $this->input_param('order_e_time'); !$page && $page = 1; !$size && $size = 10; @@ -621,139 +625,162 @@ class CusorderV2 extends Wxapp{ ]; $group_id == 1 && $where['sale_id'] = $uid;//销售 - if($group_id == 4 && $this->biz_id!=1){ + if ($group_id == 4 && $this->biz_id != 1) { $where['brand_id!='] = 3; //渠道经理过滤 } - if($keyword){ + if ($keyword) { $where["(name='{$keyword}' or owner_name='{$keyword}')"] = null; } - if($status == 11 ){ //进行中 + if ($status == 11) { //进行中 $where['status'] = 0; - }elseif($status == 12 ){ //已完成 + } elseif ($status == 12) { //已完成 $where['status'] = 1; - }else{ + } else { strlen($status) && $where['status'] = $status; } + if ($type) { + unset($where['status']); + $where['status>='] = 0; + $where['id>='] = Orders_v2_entity::V2_START_ID; + $where['brand_id>'] = 0; + if ($type == 'fq') { + $where['payway'] = 0; + $where['id not in (select o_id from lc_receiver_order_status where pid_status=1 and status=2)'] = null; + } elseif ($type == 'pc') { + $where['id not in (select o_id from lc_receiver_order_status where pid_status=2 and status=1)'] = null; + } elseif ($type == 'kp') { + $where['id not in (select o_id from lc_receiver_order_status where pid_status=3 and status=1)'] = null; + $where['id in (select o_id from lc_receiver_order_status where pid_status=0 and status=2)'] = null; + } elseif ($type == 'jf') { + $where['id in (select o_id from lc_receiver_order_status where pid_status=3 and status=1)'] = null; + $where['id not in (select o_id from lc_receiver_order_status where pid_status=4 and status=2)'] = null; + } + } + //下定时间 + if ($order_s_time && $order_e_time) { + $where["order_time >="] = date('Y-m-d 00:00:00',strtotime($order_s_time)); + $where["order_time <="] = date('Y-m-d 00:00:00',strtotime($order_e_time)); + } $fileds = 'id,customer_id,name,mobile,brand_id,s_id,v_id,cor_id,incor_id,payway,status,c_time,money_json,if_num,info_json,main_type,owner_name,owner_mobile,item_id'; $count = $this->orders_model->count($where); $lists = []; - if($count){ - $rows = $this->orders_model->select($where,'id desc',$page,$size,$fileds); + if ($count) { + $rows = $this->orders_model->select($where, 'id desc', $page, $size, $fileds); //品牌车型 - $brand_arr = array_unique(array_column($rows,'brand_id')); - $brands = $this->auto_brand_model->get_map_by_ids($brand_arr,'id,name'); + $brand_arr = array_unique(array_column($rows, 'brand_id')); + $brands = $this->auto_brand_model->get_map_by_ids($brand_arr, 'id,name'); //车系车型 - $series_arr = array_unique(array_column($rows,'s_id')); - $series = $this->auto_series_model->get_map_by_ids($series_arr,'id,name'); + $series_arr = array_unique(array_column($rows, 's_id')); + $series = $this->auto_series_model->get_map_by_ids($series_arr, 'id,name'); //获取车辆属性 - $version_arr = array_unique(array_column($rows,'v_id')); - $color_arr = array_unique(array_column($rows,'cor_id')); - $attrs_arr = array_merge($version_arr,$color_arr); - $attrs = $this->auto_attr_model->get_map_by_ids($attrs_arr,'id,title'); + $version_arr = array_unique(array_column($rows, 'v_id')); + $color_arr = array_unique(array_column($rows, 'cor_id')); + $attrs_arr = array_merge($version_arr, $color_arr); + $attrs = $this->auto_attr_model->get_map_by_ids($attrs_arr, 'id,title'); //旧订单数据 $old_rows = []; - $old_ids = array_unique(array_column($rows,'id')); - if($old_ids){ - $ids_str = implode(',',$old_ids); + $old_ids = array_unique(array_column($rows, 'id')); + if ($old_ids) { + $ids_str = implode(',', $old_ids); $where = [ "id in ({$ids_str})" => null, ]; - $old_rows = $this->receiver_orders_model->map('id','status',$where,'','','','id,status'); + $old_rows = $this->receiver_orders_model->map('id', 'status', $where, '', '', '', 'id,status'); } $item_map = []; - $item_arr_ids = array_unique(array_column($rows,'item_id')); - if($item_arr_ids){ - $str_ids = implode(',',$item_arr_ids); + $item_arr_ids = array_unique(array_column($rows, 'item_id')); + if ($item_arr_ids) { + $str_ids = implode(',', $item_arr_ids); $where = [ "id in ({$str_ids})" => null ]; - $item_map = $this->items_model->map('id','vin',$where,'','','','id,vin'); + $item_map = $this->items_model->map('id', 'vin', $where, '', '', '', 'id,vin'); } //获取订单资料 - $order_datas = $this->receiver_order_datas_model->get_map_by_oids(array_column($rows,'id'),'id,o_id,cardida,business_licence,car_img,register_img,ins_img,other_img'); + $order_datas = $this->receiver_order_datas_model->get_map_by_oids(array_column($rows, 'id'), 'id,o_id,cardida,business_licence,car_img,register_img,ins_img,other_img'); $status_arr = $this->orders_model->get_status(); $old_status_arr = $this->receiver_orders_model->get_status(); - foreach($rows as $key=>$val){ - $info_json = json_decode($val['info_json'],true); - if($val['id']>=Orders_v2_entity::V2_START_ID){ - $money_json = json_decode($val['money_json'],true); - if($val['brand_id']){ //已选择车型 + foreach ($rows as $key => $val) { + $info_json = json_decode($val['info_json'], true); + if ($val['id'] >= Orders_v2_entity::V2_START_ID) { + $money_json = json_decode($val['money_json'], true); + if ($val['brand_id']) { //已选择车型 $brand_name = isset($brands[$val['brand_id']]) ? $brands[$val['brand_id']][0]['name'] : ''; $serie_name = isset($series[$val['s_id']]) ? $series[$val['s_id']][0]['name'] : ''; $color = isset($attrs[$val['cor_id']]) ? $attrs[$val['cor_id']][0]['title'] : ''; $version = isset($attrs[$val['v_id']]) ? $attrs[$val['v_id']][0]['title'] : ''; - $title = "{$brand_name}{$serie_name}-{$color}-{$version}"; + $title = "{$brand_name}{$serie_name}-{$color}-{$version}"; $img_status = $this->order_datas_entity->data_status($order_datas[$val['id']][0]); - $ck_user_status = $this->receiver_order_status_model->count(['o_id'=>$val['id'],'pid_status'=>4,'status'=>2]); //用户已确认 - $ck_admin_status = $this->receiver_order_status_model->count(['o_id'=>$val['id'],'pid_status'=>4,'status'=>1]); //顾问确认已确认 + $ck_user_status = $this->receiver_order_status_model->count(['o_id' => $val['id'], 'pid_status' => 4, 'status' => 2]); //用户已确认 + $ck_admin_status = $this->receiver_order_status_model->count(['o_id' => $val['id'], 'pid_status' => 4, 'status' => 1]); //顾问确认已确认 $ck_status = [ - ['value'=>'顾问确认','selected'=>$ck_admin_status?true:false], - ['value'=>'用户确认','selected'=>$ck_user_status?true:false] + ['value' => '顾问确认', 'selected' => $ck_admin_status ? true : false], + ['value' => '用户确认', 'selected' => $ck_user_status ? true : false] ]; $other_data = [ - '品牌车型' => ['type'=> 'text','value'=>$title,'bg_color'=>''], - '付款方式' => ['type'=> 'text','value'=>$val['payway']?'全款':'分期','bg_color'=>''], + '品牌车型' => ['type' => 'text', 'value' => $title, 'bg_color' => ''], + '付款方式' => ['type' => 'text', 'value' => $val['payway'] ? '全款' : '分期', 'bg_color' => ''], ]; - $book_is_pay = $this->app_liche_orders_model->get(['o_id'=>$val['id'],'type'=>1,'status>='=>0]); //定金 - $srv_is_pay = $this->app_liche_orders_model->get(['o_id'=>$val['id'],'type'=>2,'status>='=>0]); //服务费 - $int_is_pay = $this->app_liche_orders_model->get(['o_id'=>$val['id'],'type'=>4,'status>='=>0]); //意向金 - $p_row = $this->app_liche_orders_model->get(['o_id'=>$val['id'],'pid'=>0],'id'); //父订单 - $last_row = $this->app_liche_orders_model->get(['o_id'=>$val['id'],'pid'=>$p_row['id'],'type'=>3],'id'); //尾款订单 + $book_is_pay = $this->app_liche_orders_model->get(['o_id' => $val['id'], 'type' => 1, 'status>=' => 0]); //定金 + $srv_is_pay = $this->app_liche_orders_model->get(['o_id' => $val['id'], 'type' => 2, 'status>=' => 0]); //服务费 + $int_is_pay = $this->app_liche_orders_model->get(['o_id' => $val['id'], 'type' => 4, 'status>=' => 0]); //意向金 + $p_row = $this->app_liche_orders_model->get(['o_id' => $val['id'], 'pid' => 0], 'id'); //父订单 + $last_row = $this->app_liche_orders_model->get(['o_id' => $val['id'], 'pid' => $p_row['id'], 'type' => 3], 'id'); //尾款订单 //除去尾款已支付金额 - $total_pay = $this->app_liche_orders_model->sum('total_price',['pid'=>$p_row['id'],'o_id'=>$val['id'],'status'=>1,'id!='=>$last_row['id']]); + $total_pay = $this->app_liche_orders_model->sum('total_price', ['pid' => $p_row['id'], 'o_id' => $val['id'], 'status' => 1, 'id!=' => $last_row['id']]); //已支付尾款 - $last_pay = $this->app_liche_orders_model->sum('total_price',['pid'=>$last_row['id'],'status'=>1]); + $last_pay = $this->app_liche_orders_model->sum('total_price', ['pid' => $last_row['id'], 'status' => 1]); $is_pay_price = $total_pay['total_price'] + $last_pay['total_price']; - $need_pay = $this->orders_v2_entity->recevable_price($val['id'],false); //需要支付车款 + $need_pay = $this->orders_v2_entity->recevable_price($val['id'], false); //需要支付车款 $need_last_pay = $need_pay - $money_json['price_book']; - if($int_is_pay['status']){ - $price_book_text = $int_is_pay['total_price']."(已支付)"; - $other_data['意向金金额'] = ['type'=> 'text','value'=>$price_book_text,'bg_color'=>'']; + if ($int_is_pay['status']) { + $price_book_text = $int_is_pay['total_price'] . "(已支付)"; + $other_data['意向金金额'] = ['type' => 'text', 'value' => $price_book_text, 'bg_color' => '']; } - if($book_is_pay){ - $book_is_pay_text = $book_is_pay['status'] ? '已支付':'未支付'; - $price_book_text = $money_json['price_book']."($book_is_pay_text)"; - $other_data['定金金额'] = ['type'=> 'text','value'=>$price_book_text,'bg_color'=>'']; + if ($book_is_pay) { + $book_is_pay_text = $book_is_pay['status'] ? '已支付' : '未支付'; + $price_book_text = $money_json['price_book'] . "($book_is_pay_text)"; + $other_data['定金金额'] = ['type' => 'text', 'value' => $price_book_text, 'bg_color' => '']; } - $last_is_pay_text = $is_pay_price >= $need_pay ? '已支付':'未支付'; - $last_text = $need_last_pay."($last_is_pay_text)"; - $other_data['尾款金额'] = ['type'=> 'text','value'=>$last_text,'bg_color'=>'']; - if($srv_is_pay){ - $last_is_pay_text = $srv_is_pay['status'] ? '已支付':'未支付'; - $srv_text = intval($srv_is_pay['total_price'])."($last_is_pay_text)"; - $other_data['服务费'] = ['type'=> 'text','value'=>$srv_text,'bg_color'=>'']; + $last_is_pay_text = $is_pay_price >= $need_pay ? '已支付' : '未支付'; + $last_text = $need_last_pay . "($last_is_pay_text)"; + $other_data['尾款金额'] = ['type' => 'text', 'value' => $last_text, 'bg_color' => '']; + if ($srv_is_pay) { + $last_is_pay_text = $srv_is_pay['status'] ? '已支付' : '未支付'; + $srv_text = intval($srv_is_pay['total_price']) . "($last_is_pay_text)"; + $other_data['服务费'] = ['type' => 'text', 'value' => $srv_text, 'bg_color' => '']; } - if($int_is_pay['status'] || $book_is_pay['status'] || $this->app_liche_orders_model->count(['o_id'=>$val['id'],'type'=>6,'status'=>1])){ - if(!$val['payway']){ - $other_data['分期办理'] = ['type'=> 'text','value'=>$this->orders_status_entity->status_cn($val['id'],1),'bg_color'=>'']; + if ($int_is_pay['status'] || $book_is_pay['status'] || $this->app_liche_orders_model->count(['o_id' => $val['id'], 'type' => 6, 'status' => 1])) { + if (!$val['payway']) { + $other_data['分期办理'] = ['type' => 'text', 'value' => $this->orders_status_entity->status_cn($val['id'], 1), 'bg_color' => '']; } $pc_cn = '待分配'; - if($this->orders_status_entity->get_finish($val['id'],2,1)){ //已配车 + if ($this->orders_status_entity->get_finish($val['id'], 2, 1)) { //已配车 $pc_cn = $item_map[$val['item_id']]; } - $other_data['车辆分配'] = ['type'=> 'text','value'=>$pc_cn,'bg_color'=>'']; - $other_data['发票'] = ['type'=> 'text','value'=>$this->orders_status_entity->status_cn($val['id'],3),'bg_color'=>'']; - if($val['main_type']){//公司 - $other_data['营业执照'] = ['type'=> 'text','value'=>$img_status['business_licence']['text'],'bg_color'=>$img_status['business_licence']['color']]; - }else{ - $other_data['身份证'] = ['type'=> 'text','value'=>$img_status['cardida']['text'],'bg_color'=>$img_status['cardida']['color']]; + $other_data['车辆分配'] = ['type' => 'text', 'value' => $pc_cn, 'bg_color' => '']; + $other_data['发票'] = ['type' => 'text', 'value' => $this->orders_status_entity->status_cn($val['id'], 3), 'bg_color' => '']; + if ($val['main_type']) {//公司 + $other_data['营业执照'] = ['type' => 'text', 'value' => $img_status['business_licence']['text'], 'bg_color' => $img_status['business_licence']['color']]; + } else { + $other_data['身份证'] = ['type' => 'text', 'value' => $img_status['cardida']['text'], 'bg_color' => $img_status['cardida']['color']]; } - $other_data['登记证'] = ['type'=> 'text','value'=>$img_status['register_img']['text'],'bg_color'=>$img_status['register_img']['color']]; - $other_data['行驶证'] = ['type'=> 'text','value'=>$img_status['car_img']['text'],'bg_color'=>$img_status['car_img']['color']]; - $other_data['保单'] = ['type'=> 'text','value'=>$img_status['ins_img']['text'],'bg_color'=>$img_status['ins_img']['color']]; - $other_data['交车合照'] = ['type'=> 'text','value'=>$img_status['other_img']['text'],'bg_color'=>$img_status['other_img']['color']]; - $other_data['交付'] = ['type'=> 'checkbox','value'=>'','lists' => $ck_status,'bg_color'=>'']; + $other_data['登记证'] = ['type' => 'text', 'value' => $img_status['register_img']['text'], 'bg_color' => $img_status['register_img']['color']]; + $other_data['行驶证'] = ['type' => 'text', 'value' => $img_status['car_img']['text'], 'bg_color' => $img_status['car_img']['color']]; + $other_data['保单'] = ['type' => 'text', 'value' => $img_status['ins_img']['text'], 'bg_color' => $img_status['ins_img']['color']]; + $other_data['交车合照'] = ['type' => 'text', 'value' => $img_status['other_img']['text'], 'bg_color' => $img_status['other_img']['color']]; + $other_data['交付'] = ['type' => 'checkbox', 'value' => '', 'lists' => $ck_status, 'bg_color' => '']; } - $other_data['订单日期'] = ['type'=> 'text','value'=>date('Y-m-d',$val['c_time']),'bg_color'=>'']; - }else{ + $other_data['订单日期'] = ['type' => 'text', 'value' => date('Y-m-d', $val['c_time']), 'bg_color' => '']; + } else { $price_intention = $money_json['price_intention'] ? $money_json['price_intention'] : ''; $other_data = [ - '意向金' => ['type'=> 'text','value'=> $price_intention,'bg_color'=>''], - '订单日期' => ['type'=> 'text','value'=>date('Y-m-d',$val['c_time']),'bg_color'=>''], + '意向金' => ['type' => 'text', 'value' => $price_intention, 'bg_color' => ''], + '订单日期' => ['type' => 'text', 'value' => date('Y-m-d', $val['c_time']), 'bg_color' => ''], ]; } $lists[] = [ @@ -767,29 +794,29 @@ class CusorderV2 extends Wxapp{ 'status_name' => $status_arr[$val['status']], 'other_data' => $other_data, ]; - }else{//旧订单 + } else {//旧订单 $status = $old_rows[$val['id']] ? $old_rows[$val['id']] : 0; - $money_json = json_decode($val['money_json'],true); - if($val['brand_id']){ //已选择车型 + $money_json = json_decode($val['money_json'], true); + if ($val['brand_id']) { //已选择车型 $brand_name = isset($brands[$val['brand_id']]) ? $brands[$val['brand_id']][0]['name'] : ''; $serie_name = isset($series[$val['s_id']]) ? $series[$val['s_id']][0]['name'] : ''; $color = isset($attrs[$val['cor_id']]) ? $attrs[$val['cor_id']][0]['title'] : ''; $version = isset($attrs[$val['v_id']]) ? $attrs[$val['v_id']][0]['title'] : ''; //是否需要代办 - $srv_arr = explode(',',$val['srv_ids']); - $db_title = in_array(2,$srv_arr) ? '需要' : ''; + $srv_arr = explode(',', $val['srv_ids']); + $db_title = in_array(2, $srv_arr) ? '需要' : ''; $other_data = [ '品牌车型' => "{$brand_name}{$serie_name}-{$color}-{$version}", - '付款方式' => $val['payway']?'全款':'分期', + '付款方式' => $val['payway'] ? '全款' : '分期', '代办车牌' => $db_title, '定金金额' => $money_json['price_book'], - '订单日期' => date('Y-m-d',$val['c_time']), + '订单日期' => date('Y-m-d', $val['c_time']), ]; - }else{ + } else { $other_data = [ '意向金' => $money_json['price_intention'] ? $money_json['price_intention'] : '', - '订单日期' => date('Y-m-d',$val['c_time']), + '订单日期' => date('Y-m-d', $val['c_time']), ]; } $lists[] = [ @@ -862,7 +889,16 @@ class CusorderV2 extends Wxapp{ ['key' =>11 ,'name' => '进行中'], ['key' =>12 ,'name' => '已完成'], ]; - return $lists; + $data['filters'] = [ + 'type' => [ + ['key' => 'fq','name' => '分期办理'], + ['key' => 'pc','name' => '车辆匹配'], + ['key' => 'kp','name' => '发票开具'], + ['key' => 'jf','name' => '交付确认'], + ], + ]; + $data['tabs'] = $lists; + return $data; } //修改用户基本信息 diff --git a/api/controllers/wxapp/licheb/User.php b/api/controllers/wxapp/licheb/User.php index 0229d6eb..6ac42563 100644 --- a/api/controllers/wxapp/licheb/User.php +++ b/api/controllers/wxapp/licheb/User.php @@ -26,6 +26,7 @@ class User extends Wxapp $this->load->model('auto/auto_brand_model'); $this->load->model('items/items_model', 'mdItems'); $this->load->model('items/items_oplogs_model', 'mdItemsOplogs'); + $this->load->library('receiver/orders_v2_entity'); } /** @@ -222,6 +223,7 @@ class User extends Wxapp $group_id = $this->session['group_id']; $this->load->model('receiver/receiver_customers_model', 'customers_model'); $this->load->model('receiver/order/receiver_orders_model', 'orders_model'); + $this->load->model('receiver/order/receiver_orders_v2_model'); $this->load->model('receiver/order/receiver_order_signs_model', 'order_signs_model'); $this->load->model('receiver/receiver_customers_visit_model', 'mdCustomersVisit'); $where = [ @@ -255,52 +257,6 @@ class User extends Wxapp $group_id == 4 && $where['brand_id!='] = 3; //渠道经理过滤 $loan_count = $this->orders_model->count($where); - //为创建订单客户 - $where = [ - 'lc_receiver_customers.status' => 2, - 'lc_receiver_customers.biz_id' => $biz_id, - 'lc_receiver_orders.id is null' => null - ]; - $group_id == 1 && $where['lc_receiver_customers.admin_id'] = $uid; - $group_id == 4 && $where['lc_receiver_customers.brand_id!='] = 3; //渠道经理过滤 - $uncre_count = $this->customers_model->count_order($where); - $t1 = 'lc_receiver_order_signs'; - $t2 = 'lc_receiver_orders'; - $where = [ - "status" => 0, - "biz_id" => $biz_id - ]; - $group_id == 1 && $where["admin_id"] = $uid; - $group_id == 4 && $where['brand_id!='] = 3; //渠道经理过滤 - $need_sign = $this->orders_model->count($where);//需要签名 - //$where = [ - // "status"=>1, - // "biz_id" => $biz_id - //]; - //$group_id == 1 && $where["admin_id"] = $uid; - //$group_id == 4 && $where['brand_id!='] = 3; //渠道经理过滤 - //$loan_count = $this->orders_model->count($where);//未选择分期 - $where = [ - "status" => 3, - "biz_id" => $biz_id - ]; - $group_id == 1 && $where["admin_id"] = $uid; - $group_id == 4 && $where['brand_id!='] = 3; //渠道经理过滤 - $bill_count = $this->orders_model->count($where);//开票相关 - $where = [ - "status" => 5, - "biz_id" => $biz_id - ]; - $group_id == 1 && $where["admin_id"] = $uid; - $group_id == 4 && $where['brand_id!='] = 3; //渠道经理过滤 - $del_count = $this->orders_model->count($where);//交付确认 - $deallist = [ - ['title' => '登记订单', 'icon' => 'icon-dengji', 'total' => $uncre_count, 'page' => '/pages/order/register/index'], - ['title' => '需邀请签名', 'icon' => 'icon-qianming1', 'total' => $need_sign, 'page' => '/pages/order/filterList/index?key=0&ismy=1'], - //['title'=>'未选择分期','icon'=>'icon-fenpei','total'=>$loan_count,'page'=>'/pages/order/filterList/index?key=1&ismy=1'], - ['title' => '开票相关', 'icon' => 'icon-kaipiao1', 'total' => $bill_count, 'page' => '/pages/order/filterList/index?key=3&ismy=1'], - ['title' => '交付确认', 'icon' => 'icon-jiaofu', 'total' => $del_count, 'page' => '/pages/order/filterList/index?key=5&ismy=1'], - ]; //客户代办事项 $where_v = array('a.biz_id' => $biz_id, 'a.status<>' => 2,'b.contact' => 1, 'b.status' => 1); $group_id == 1 && $where_v['a.admin_id'] = $uid; @@ -323,6 +279,56 @@ class User extends Wxapp ['title' => '战败申请(人)', 'icon' => 'icon-statistics-custom-5', 'total' => $defeat_count, 'page' => '/pages/customer/optDefeat/index'], ]; } + $where = [ + 'status>=' => 0, + 'payway' => 0, + 'id>=' => Orders_v2_entity::V2_START_ID, + 'brand_id>' => 0, + 'id not in (select o_id from lc_receiver_order_status where pid_status=1 and status=2)' => null, + 'biz_id' => $biz_id + ]; + $group_id == 1 && $where['sale_id'] = $uid; + $group_id == 4 && $where['brand_id!='] = 3; //渠道经理过滤 + $fq_total = $this->receiver_orders_v2_model->count($where); + $where = [ + 'status>=' => 0, + 'id>=' => Orders_v2_entity::V2_START_ID, + 'brand_id>' => 0, + 'id not in (select o_id from lc_receiver_order_status where pid_status=2 and status=1)' => null, + 'biz_id' => $biz_id + ]; + $group_id == 1 && $where['sale_id'] = $uid; + $group_id == 4 && $where['brand_id!='] = 3; //渠道经理过滤 + $pc_total = $this->receiver_orders_v2_model->count($where); + $where = [ + 'status>=' => 0, + 'id>=' => Orders_v2_entity::V2_START_ID, + 'brand_id>' => 0, + 'id not in (select o_id from lc_receiver_order_status where pid_status=3 and status=1)' => null, + 'id in (select o_id from lc_receiver_order_status where pid_status=0 and status=2)' => null, + 'biz_id' => $biz_id + ]; + $group_id == 1 && $where['sale_id'] = $uid; + $group_id == 4 && $where['brand_id!='] = 3; //渠道经理过滤 + $kp_total = $this->receiver_orders_v2_model->count($where); + $where = [ + 'status>=' => 0, + 'id>=' => Orders_v2_entity::V2_START_ID, + 'brand_id>' => 0, + 'id in (select o_id from lc_receiver_order_status where pid_status=3 and status=1)' => null, + 'id not in (select o_id from lc_receiver_order_status where pid_status=4 and status=2)' => null, + 'biz_id' => $biz_id + ]; + $group_id == 1 && $where['sale_id'] = $uid; + $group_id == 4 && $where['brand_id!='] = 3; //渠道经理过滤 + $ck_total = $this->receiver_orders_v2_model->count($where); + $deallist = [ + ['title' => '分期办理 ', 'icon' => 'icon-banfenqi', 'total' => $fq_total, 'page' => '/pages/order/filterList/index2?type=fq&title=分期办理'], + ['title' => '车辆匹配', 'icon' => 'icon-cheliangfenpei', 'total' => $pc_total, 'page' => '/pages/order/filterList/index2?type=pc&title=车辆分配'], + ['title' => '发票开具', 'icon' => 'icon-kaipiao1', 'total' => $kp_total, 'page' => '/pages/order/filterList/index2?type=kp&title=发票开具'], + ['title' => '交付确认', 'icon' => 'icon-jiaofu', 'total' => $ck_total, 'page' => '/pages/order/filterList/index2?type=jf&title=交付确认'], + ]; + $data = [ 'wl_count' => $wl_count, 'gz_count' => $gz_count,