diff --git a/admin/controllers/receiver/Orders.php b/admin/controllers/receiver/Orders.php index cbd7a53c..c21417e6 100644 --- a/admin/controllers/receiver/Orders.php +++ b/admin/controllers/receiver/Orders.php @@ -21,6 +21,7 @@ class Orders extends HD_Controller $this->load->model('auto/auto_attr_model'); $this->load->model('auto/auto_finance_model'); $this->load->model('sys/sys_finance_model'); + $this->load->model('sys/sys_company_model'); $this->load->model('app/liche/app_liche_orders_model'); $this->load->library('receiver/orders_entity'); @@ -683,14 +684,20 @@ 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'); + 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'); + } $list[] = [ 'money' => $item['total_price'], 'type_cn' => $type_arr[$item['type']], - 'pay_time' => $item['pay_time'] + 'pay_time' => $item['pay_time'], + 'company' => $company ? $company['short']:'', + 'descrip' => $item['descrip'] ]; } } @@ -711,7 +718,9 @@ class Orders extends HD_Controller $row = $this->orders_model->get(['id' => $id]); $money = $this->input->post('money'); $pay_time = $this->input->post('pay_time'); - if (!$money || !$pay_time || !$row) { + $wx_mchid = $this->input->post('wx_mchid'); + $descrip = $this->input->post('descrip'); + if(!$money || !$pay_time ||!$row || !$wx_mchid){ return $this->show_json(SYS_CODE_FAIL, '参数错误'); } $this->load->helper('order'); @@ -719,6 +728,7 @@ class Orders extends HD_Controller $data = [ 'o_id' => $row['id'], 'sid' => $sid, + 'mch_id' => $wx_mchid, 'brand_id' => $row['brand_id'], 's_id' => $row['s_id'], 'v_id' => $row['v_id'], @@ -731,12 +741,15 @@ class Orders extends HD_Controller 'pay_time' => date('Y-m-d H:i:s', strtotime($pay_time)), 'c_time' => time() ]; + $descrip && $data['descrip'] = $descrip; $res = $this->app_liche_orders_model->add($data); if (!$res) { return $this->show_json(SYS_CODE_FAIL, '保存失败'); } return $this->show_json(SYS_CODE_SUCCESS, '保存成功'); } + $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/views/receiver/orders/add_paylog.php b/admin/views/receiver/orders/add_paylog.php index 31f39de6..0e5475f2 100644 --- a/admin/views/receiver/orders/add_paylog.php +++ b/admin/views/receiver/orders/add_paylog.php @@ -8,10 +8,28 @@ +
+ +
+ +
+
+
- + +
+
+ +
+ +
+
diff --git a/admin/views/receiver/orders/paylog.php b/admin/views/receiver/orders/paylog.php index 65f93aaf..ed41a430 100644 --- a/admin/views/receiver/orders/paylog.php +++ b/admin/views/receiver/orders/paylog.php @@ -8,6 +8,8 @@ 付款金额 类型 + 收款公司 + 备注 付款时间 @@ -15,6 +17,8 @@ {{item.money}} {{item.type_cn}} + {{item.company}} + {{item.descrip}} {{item.pay_time}} diff --git a/api/controllers/wxapp/licheb/Cusorder.php b/api/controllers/wxapp/licheb/Cusorder.php index 055a5479..1b4a2600 100644 --- a/api/controllers/wxapp/licheb/Cusorder.php +++ b/api/controllers/wxapp/licheb/Cusorder.php @@ -241,8 +241,8 @@ class Cusorder extends Wxapp{ //订单列表头部 protected function get_tabs(){ $lists = [ - ['key' =>0 ,'name' => '进行中'], - ['key' =>1 ,'name' => '已完成'], + ['key' =>10 ,'name' => '进行中'], + ['key' =>11 ,'name' => '已完成'], ]; return $lists; } @@ -267,15 +267,19 @@ class Cusorder extends Wxapp{ ]; $group_id == 1 && $where['admin_id'] = $uid;//销售 + $group_id == 4 && $where['brand_id!='] = 3; //渠道经理过滤 if($keyword){ $where["(name='{$keyword}' or mobile='{$keyword}')"] = null; } - if($status){ //已完成 + if($status == 11){ //已完成 $where['status'] = 6; - }else{ //进行中 + }elseif($status == 10 ){ //进行中 $where['status>='] = 0; $where['status!='] = 6; + $p_row = $this->app_liche_orders_model->get(['o_id'=>$row['id'],'pid'=>0,'status>='=>0],'id'); + }else{ + strlen($status) && $where['status'] = $status; } $fileds = 'id,name,mobile,car_json,brand_id,s_id,deposit,payway,status,c_time'; $count = $this->orders_model->count($where); diff --git a/api/controllers/wxapp/licheb/Customers.php b/api/controllers/wxapp/licheb/Customers.php index 9c5955a4..5dadf715 100644 --- a/api/controllers/wxapp/licheb/Customers.php +++ b/api/controllers/wxapp/licheb/Customers.php @@ -368,7 +368,7 @@ class Customers extends Wxapp{ if($group_id==1 || $ismy){ $where["admin_id"] = $uid; } - + $group_id == 4 && $where['brand_id!='] = 3; //渠道经理过滤 if($s_time && $e_time){ $where['c_time >='] = strtotime($s_time); $where['c_time <='] = strtotime(date('Y-m-d 23:59:59',strtotime($e_time))); diff --git a/api/controllers/wxapp/licheb/Statistics.php b/api/controllers/wxapp/licheb/Statistics.php index 414c7a46..0145a286 100644 --- a/api/controllers/wxapp/licheb/Statistics.php +++ b/api/controllers/wxapp/licheb/Statistics.php @@ -25,22 +25,12 @@ class Statistics extends Wxapp{ protected function get_cust(){ $season = $this->input_param('season'); $city_id = $this->input_param('city_id'); - //!strlen($season) && $season = ceil((date('n'))/3)-1;//当月是第几季度 - //$season_data = $this->season_data($season+1); - //$days = getMonth($season+1); !strlen($season) && $season = date('n')-1;//当前月份 $month = $season+1; $season_data = $this->months(); $series = []; $bizs = []; $months_arr = []; - //foreach($days as $val){ - // $months_arr[] = [ - // 'cn' => date('n月',strtotime($val)), - // 's_time' => date('Y-m-01 00:00:00',strtotime($val)), - // 'e_time' => date('Y-m-t 23:59:59',strtotime($val)), - // ]; - //} $months_arr[] = [ 'cn' => $season_data[$season], 's_time' => date("Y-{$month}-01 00:00:00"), @@ -449,6 +439,7 @@ class Statistics extends Wxapp{ 'status' => $key ]; $group_id == 1 && $where['admin_id'] = $uid; + $group_id == 4 && $where['brand_id!='] = 3; //渠道经理过滤 $count = $this->customers_model->count($where); $count_data[] = [ 'value' => $count, @@ -461,6 +452,7 @@ class Statistics extends Wxapp{ 'biz_id'=>$biz_id ]; $group_id == 1 && $where['admin_id'] = $uid; + $group_id == 4 && $where['brand_id!='] = 3; //渠道经理过滤 $count = $this->customers_model->count($where); $where = [ 'status>='=>0, @@ -468,6 +460,7 @@ class Statistics extends Wxapp{ 'is_top'=>1 ]; $group_id == 1 && $where['admin_id'] = $uid; + $group_id == 4 && $where['brand_id!='] = 3; //渠道经理过滤 $top_count = $this->customers_model->count($where); //关注 $where = [ 'status>='=>0, @@ -475,6 +468,7 @@ class Statistics extends Wxapp{ "cont_time = '0000-00-00 00:00:00'"=>null ]; $group_id == 1 && $where['admin_id'] = $uid; + $group_id == 4 && $where['brand_id!='] = 3; //渠道经理过滤 $un_count = $this->customers_model->count($where);//未联系 $stat_data = [ 'tooltip' =>[ @@ -544,6 +538,7 @@ class Statistics extends Wxapp{ 'status' => $key ]; $group_id == 1 && $where['admin_id'] = $uid; + $group_id == 4 && $where['brand_id!='] = 3; //渠道经理过滤 $count = $this->orders_model->count($where); $total += $count; $count_data[] = [ diff --git a/api/controllers/wxapp/licheb/User.php b/api/controllers/wxapp/licheb/User.php index 1199db94..9387b45e 100644 --- a/api/controllers/wxapp/licheb/User.php +++ b/api/controllers/wxapp/licheb/User.php @@ -140,6 +140,7 @@ class User extends Wxapp{ 'biz_id'=>$biz_id ]; $group_id == 1 && $where['admin_id'] = $uid; + $group_id == 4 && $where['brand_id!='] = 3; //渠道经理过滤 $wl_count = $this->customers_model->count($where); $where = [ 'status>'=>-1, @@ -147,21 +148,29 @@ class User extends Wxapp{ 'biz_id'=>$biz_id ]; $group_id == 1 && $where['admin_id'] = $uid; + $group_id == 4 && $where['brand_id!='] = 3; //渠道经理过滤 $gz_count = $this->customers_model->count($where); $where = [ 'status'=>0, 'biz_id'=>$biz_id ]; $group_id == 1 && $where['admin_id'] = $uid; + $group_id == 4 && $where['brand_id!='] = 3; //渠道经理过滤 $sign_count = $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); //未派单客户 - $unuse_count = $this->customers_model->count(['admin_id'=>0,'biz_id'=>$biz_id]); + $where = [ + 'admin_id' => 0, + 'biz_id' => $biz_id + ]; + $group_id == 4 && $where['brand_id!='] = 3; //渠道经理过滤 + $unuse_count = $this->customers_model->count($where); //为创建订单客户 $where = [ 'lc_receiver_customers.status'=>2, @@ -169,6 +178,7 @@ class User extends Wxapp{ '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'; @@ -177,24 +187,28 @@ class User extends Wxapp{ "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'], diff --git a/sql/app/liche.sql b/sql/app/liche.sql index a0cd3a5d..be5ba766 100644 --- a/sql/app/liche.sql +++ b/sql/app/liche.sql @@ -92,5 +92,5 @@ create table lc_app_liche_orders ( c_time int(10) unsigned not null default '0' comment '创建时间', u_time timestamp null default current_timestamp on update current_timestamp, primary key (id) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户购车订单'; +alter table lc_app_liche_orders add descrip varchar(255) not null default '' comment '备注/描述' after pay_price;