|
@@ -22,6 +22,11 @@ class CustomerDepositController extends Controller
|
22
|
22
|
*/
|
23
|
23
|
public function customerList(Request $request)
|
24
|
24
|
{
|
|
25
|
+ $self_role = session('role_name');
|
|
26
|
+ $admin_id = session('admin_id');
|
|
27
|
+ if($self_role == '超级管理员' || $self_role == '售后管理员'){
|
|
28
|
+ $admin_id=null;
|
|
29
|
+ }
|
25
|
30
|
$phone = trim( $request->input('phone') );
|
26
|
31
|
$name = trim( $request->input('name') );
|
27
|
32
|
$page = (int)$request->input('page');
|
|
@@ -32,9 +37,10 @@ class CustomerDepositController extends Controller
|
32
|
37
|
|
33
|
38
|
$offset = ($page-1) * $pageSize;
|
34
|
39
|
|
35
|
|
- $count = CustomerInfo::where(function($query) use($phone, $name){
|
|
40
|
+ $count = CustomerInfo::where(function($query) use($phone, $name, $admin_id){
|
36
|
41
|
if($phone) $query->where('phone', $phone);
|
37
|
42
|
if($name) $query->where('name', 'like', '%'. $name. '%');
|
|
43
|
+ if($admin_id) $query->where('admin_id', $admin_id);
|
38
|
44
|
})->count();
|
39
|
45
|
if ($count > 1) {
|
40
|
46
|
// 总页数
|
|
@@ -44,9 +50,10 @@ class CustomerDepositController extends Controller
|
44
|
50
|
$pages = 1;
|
45
|
51
|
}
|
46
|
52
|
|
47
|
|
- $result = CustomerInfo::where(function($query) use($phone, $name){
|
|
53
|
+ $result = CustomerInfo::where(function($query) use($phone, $name, $admin_id){
|
48
|
54
|
if($phone) $query->where('phone', $phone);
|
49
|
55
|
if($name) $query->where('name', 'like', '%'. $name. '%');
|
|
56
|
+ if($admin_id) $query->where('admin_id', $admin_id);
|
50
|
57
|
})->orderBy('id', 'desc')->offset($offset)->limit($pageSize)->get();
|
51
|
58
|
$result = json_decode(json_encode($result),true);
|
52
|
59
|
foreach($result as $k=>&$v){
|