作者 刘朕
1 个管道 的构建 通过 耗费 1 秒

教室查看订单筛选修改

@@ -20,6 +20,7 @@ use think\Session; @@ -20,6 +20,7 @@ use think\Session;
20 class OrderSalesmanController extends WeChatBaseController 20 class OrderSalesmanController extends WeChatBaseController
21 { 21 {
22 protected $user_id; 22 protected $user_id;
  23 + protected $my_user;
23 protected $status; 24 protected $status;
24 protected $pid; 25 protected $pid;
25 protected $beforeActionList = [ 26 protected $beforeActionList = [
@@ -29,16 +30,16 @@ class OrderSalesmanController extends WeChatBaseController @@ -29,16 +30,16 @@ class OrderSalesmanController extends WeChatBaseController
29 protected function check() { 30 protected function check() {
30 $user_id = cmf_get_current_user_id(); 31 $user_id = cmf_get_current_user_id();
31 $this->user_id = $user_id; 32 $this->user_id = $user_id;
32 - $my_user = Db::name('my_user')->where(['uid'=>$user_id])->find();  
33 - if(empty($my_user)){ 33 + $this->my_user = Db::name('my_user')->where(['uid'=>$user_id])->find();
  34 + if(empty($this->my_user)){
34 $this->error('查无此人','','',''); 35 $this->error('查无此人','','','');
35 } 36 }
36 - $this->status = $my_user['status'];  
37 - $this->pid = $my_user['id'];  
38 - if($my_user['status'] != 2 && $my_user['status'] != 3){ 37 + $this->status = $this->my_user['status'];
  38 + $this->pid = $this->my_user['id'];
  39 + if($this->my_user['status'] != 2 && $this->my_user['status'] != 3){
39 $this->error('您还没有权限查看','','',''); 40 $this->error('您还没有权限查看','','','');
40 } 41 }
41 - $this->assign('my_user',$my_user); 42 + $this->assign('my_user',$this->my_user);
42 } 43 }
43 public function get_all(){ 44 public function get_all(){
44 $param = $this->request->param(); 45 $param = $this->request->param();
@@ -78,7 +79,12 @@ class OrderSalesmanController extends WeChatBaseController @@ -78,7 +79,12 @@ class OrderSalesmanController extends WeChatBaseController
78 $goods_count[$key]['number_sum'] = $number_sum; 79 $goods_count[$key]['number_sum'] = $number_sum;
79 } 80 }
80 $this->assign('goods_count',$goods_count); 81 $this->assign('goods_count',$goods_count);
81 - $school = Db::name('school')->where('uid',$user_id)->order('create_time desc')->select()->toArray(); 82 + // 身份为老师,获取上级业务员的id
  83 + $school_uid = $user_id;
  84 + if($this->my_user['status'] == 3) {
  85 + $school_uid = Db::name('my_user')->where('id',$this->my_user['pid'])->value('uid');
  86 + }
  87 + $school = Db::name('school')->where('uid',$school_uid)->order('create_time desc')->select()->toArray();
82 if(count($school)!=0){ 88 if(count($school)!=0){
83 $schools = []; 89 $schools = [];
84 foreach ($school as $key => $val){ 90 foreach ($school as $key => $val){
@@ -133,7 +139,12 @@ class OrderSalesmanController extends WeChatBaseController @@ -133,7 +139,12 @@ class OrderSalesmanController extends WeChatBaseController
133 // $where['is_courier'] = ['eq',1]; 139 // $where['is_courier'] = ['eq',1];
134 // }// 140 // }//
135 $user_id = $this->user_id; 141 $user_id = $this->user_id;
136 - $where['salesman_uid'] = ['eq',$user_id]; 142 + // 身份为老师,获取上级业务员的id
  143 + $school_uid = $user_id;
  144 + if($this->my_user['status'] == 3) {
  145 + $school_uid = Db::name('my_user')->where('id',$this->my_user['pid'])->value('uid');
  146 + }
  147 + $where['salesman_uid'] = ['eq',$school_uid];
137 $where['indent_type'] = ['eq',2]; 148 $where['indent_type'] = ['eq',2];
138 $indentModel = new IndentModel(); 149 $indentModel = new IndentModel();
139 $data = $indentModel->selectData($where); 150 $data = $indentModel->selectData($where);
@@ -367,7 +367,7 @@ @@ -367,7 +367,7 @@
367 </div> 367 </div>
368 </div>--> 368 </div>-->
369 369
370 -<if condition="$my_user['status'] eq 2"> 370 +<if condition="in_array($my_user['status'],[2,3])">
371 <div class="log_three_select_one log_three_select_school2"> 371 <div class="log_three_select_one log_three_select_school2">
372 <div class="log_three_select_title schools_word"> 372 <div class="log_three_select_title schools_word">
373 请选择学校 373 请选择学校
@@ -739,7 +739,7 @@ @@ -739,7 +739,7 @@
739 function zujian(data_class_arr) { 739 function zujian(data_class_arr) {
740 (function ($, doc) { 740 (function ($, doc) {
741 $.init(); 741 $.init();
742 - school_arr = "{$school}"; 742 + school_arr = {$school};
743 $.ready(function () { 743 $.ready(function () {
744 schoolpicker.setData(school_arr); 744 schoolpicker.setData(school_arr);
745 classpicker.setData(data_class_arr); 745 classpicker.setData(data_class_arr);