|
@@ -20,6 +20,8 @@ use think\Session; |
|
@@ -20,6 +20,8 @@ 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 $status;
|
|
|
24
|
+ protected $pid;
|
23
|
protected $beforeActionList = [
|
25
|
protected $beforeActionList = [
|
24
|
'check' => ['except' => 'getGradeClass'],
|
26
|
'check' => ['except' => 'getGradeClass'],
|
25
|
];
|
27
|
];
|
|
@@ -31,9 +33,12 @@ class OrderSalesmanController extends WeChatBaseController |
|
@@ -31,9 +33,12 @@ class OrderSalesmanController extends WeChatBaseController |
31
|
if(empty($my_user)){
|
33
|
if(empty($my_user)){
|
32
|
$this->error('查无此人','','','');
|
34
|
$this->error('查无此人','','','');
|
33
|
}
|
35
|
}
|
34
|
- if($my_user['status'] != 2){
|
|
|
35
|
- $this->error('您还不是业务员那','','','');
|
36
|
+ $this->status = $my_user['status'];
|
|
|
37
|
+ $this->pid = $my_user['id'];
|
|
|
38
|
+ if($my_user['status'] != 2 && $my_user['status'] != 3){
|
|
|
39
|
+ $this->error('您还没有权限查看','','','');
|
36
|
}
|
40
|
}
|
|
|
41
|
+ $this->assign('my_user',$my_user);
|
37
|
}
|
42
|
}
|
38
|
public function get_all(){
|
43
|
public function get_all(){
|
39
|
$param = $this->request->param();
|
44
|
$param = $this->request->param();
|
|
@@ -41,7 +46,17 @@ class OrderSalesmanController extends WeChatBaseController |
|
@@ -41,7 +46,17 @@ class OrderSalesmanController extends WeChatBaseController |
41
|
$where['is_courier'] = ['eq',$param['is_courier']];
|
46
|
$where['is_courier'] = ['eq',$param['is_courier']];
|
42
|
}
|
47
|
}
|
43
|
$user_id = $this->user_id;
|
48
|
$user_id = $this->user_id;
|
|
|
49
|
+ if($this->status == 2){
|
44
|
$where['salesman_uid'] = ['eq',$user_id];
|
50
|
$where['salesman_uid'] = ['eq',$user_id];
|
|
|
51
|
+ }else{
|
|
|
52
|
+ //获取当前用户的所有下级
|
|
|
53
|
+ $user_child = Db::name('my_user')->where(['pid'=>$this->pid])->select();
|
|
|
54
|
+ $user_ids = [];
|
|
|
55
|
+ foreach($user_child as $key => $u_c){
|
|
|
56
|
+ $user_ids[] = $u_c['uid'];
|
|
|
57
|
+ }
|
|
|
58
|
+ $where['uid'] = ['in',$user_ids];
|
|
|
59
|
+ }
|
45
|
$where['indent_type'] = ['eq',2];
|
60
|
$where['indent_type'] = ['eq',2];
|
46
|
$where['state'] = ['eq',2];
|
61
|
$where['state'] = ['eq',2];
|
47
|
$indentModel = new IndentModel();
|
62
|
$indentModel = new IndentModel();
|