Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
朱继来
/
后台订单管理
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a913760d
authored
May 12, 2020
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
调整推送页面
parent
263b6b0b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
114 additions
and
70 deletions
app/Http/Controllers/OrderController.php
app/Http/Controllers/PermController.php
config/perm_args.php
resources/views/detail/sendSales.blade.php
app/Http/Controllers/OrderController.php
View file @
a913760d
...
...
@@ -487,7 +487,7 @@ Class OrderController extends Controller
$info
=
$this
->
_search
(
$request
,
$tid
);
$perm
=
new
PermController
;
$sale_list
=
$perm
->
getUserBy
PositionId
([
62
,
63
,
64
,
65
]
);
// 获取所有的销售
$sale_list
=
$perm
->
getUserBy
Condition
(
''
,
Config
(
'perm_args.sales_position_id'
)
);
// 获取所有的销售
//获取订单列表
$url
=
Config
(
'website.api_domain'
)
.
'order/getAllOrder'
;
...
...
@@ -686,10 +686,10 @@ Class OrderController extends Controller
}
}
else
{
$perm
=
new
PermController
;
$info
[
'buyers'
]
=
$perm
->
getUserBy
PositionId
(
39
);
// 获取采购员, ID - 39
$info
[
'buyers'
]
=
$perm
->
getUserBy
Condition
(
''
,
39
);
// 获取采购员, ID - 39
$perm
=
new
PermController
;
$sale_list
=
$perm
->
getUserBy
PositionId
([
62
,
63
,
64
,
65
]
,
0
);
// 获取所有的销售 (过滤已离职的)
$sale_list
=
$perm
->
getUserBy
Condition
(
''
,
Config
(
'perm_args.sales_position_id'
)
,
0
);
// 获取所有的销售 (过滤已离职的)
$info
[
'cc_sales'
]
=
$sale_list
?
array_merge
(
$info
[
'buyers'
],
$sale_list
)
:
$info
[
'buyers'
];
}
...
...
@@ -950,51 +950,33 @@ Class OrderController extends Controller
$perm
=
new
PermController
;
$tags
=
$request
->
input
(
'tags'
,
''
);
// 联营
$joint_manager
=
$perm
->
getRoleUsers
(
$request
,
'经理'
);
$joint_in_charge_1
=
$perm
->
getRoleUsers
(
$request
,
'线销一组主管'
);
$joint_in_charge_2
=
$perm
->
getRoleUsers
(
$request
,
'线销二组主管'
);
$joint_in_charge_3
=
$perm
->
getRoleUsers
(
$request
,
'线销三组主管'
);
$joint_kefu_1
=
$perm
->
getRoleUsers
(
$request
,
'线销一组客服'
);
$joint_kefu_2
=
$perm
->
getRoleUsers
(
$request
,
'线销二组客服'
);
$joint_kefu_3
=
$perm
->
getRoleUsers
(
$request
,
'线销三组客服'
);
$sale_list
=
$perm
->
getRoleUsers
(
$request
,
'交易员'
);
$test
=
$perm
->
getRoleUsers
(
$request
,
'测试'
);
$sale_manager
=
$perm
->
getRoleUsers
(
$request
,
'交易主管'
);
$self_manager
=
$self_kefu
=
''
;
if
(
$tags
&&
$tags
==
'self'
)
{
$self_manager
=
$perm
->
getRoleUsers
(
$request
,
'自营客服主管'
);
$self_assistant
=
$perm
->
getRoleUsers
(
$request
,
'自营客服主管助理'
);
$self_kefu
=
$perm
->
getRoleUsers
(
$request
,
'自营客服'
);
$self_kefu
=
array_merge
(
$self_assistant
,
$self_kefu
);
}
$info
[
'joint_manager'
]
=
$this
->
filterLeave
(
$joint_manager
);
$info
[
'kefu_manager'
]
=
Config
(
'perm_args.kefu_manager'
);
$joint_in_charge_1
=
$this
->
filterLeave
(
$joint_in_charge_1
);
$joint_in_charge_2
=
$this
->
filterLeave
(
$joint_in_charge_2
);
$joint_in_charge_3
=
$this
->
filterLeave
(
$joint_in_charge_3
);
$info
[
'joint_in_charge'
]
=
$this
->
remove_duplicate
(
array_merge
(
$joint_in_charge_1
,
$joint_in_charge_2
,
$joint_in_charge_3
));
// 临时处理 (主管里面去掉张娟)
foreach
(
$info
[
'joint_in_charge'
]
as
$k
=>
$v
)
{
if
(
$v
->
userId
==
'1445'
)
{
unset
(
$info
[
'joint_in_charge'
][
$k
]);
$manager
=
$perm
->
getRoleUsers
(
$request
,
'管理员'
);
// 管理员角色人员
// 过滤掉 1351
foreach
(
$manager
as
$k
=>
$v
)
{
if
(
in_array
(
$v
->
userId
,
[
1351
]))
{
unset
(
$manager
[
$k
]);
}
}
$info
[
'joint_kefu_1'
]
=
$this
->
filterLeave
(
$joint_kefu_1
);
$info
[
'joint_kefu_2'
]
=
$this
->
filterLeave
(
$joint_kefu_2
);
$info
[
'joint_kefu_3'
]
=
$this
->
filterLeave
(
$joint_kefu_3
);
$info
[
'sale_list'
]
=
$this
->
filterLeave
(
$sale_list
);
$info
[
'test'
]
=
$this
->
filterLeave
(
$test
);
$info
[
'self_manager'
]
=
$this
->
filterLeave
(
$self_manager
);
$info
[
'self_kefu'
]
=
$this
->
filterLeave
(
$self_kefu
);
$info
[
'sale_manager'
]
=
$this
->
filterLeave
(
$sale_manager
);
$info
[
'manager'
]
=
array_merge
(
$manager
);
// 重新索引
$info
[
'online_sales_chief'
]
=
$perm
->
getUserByCondition
(
33
,
66
,
0
);
// 线上销售-33 总监-66
$info
[
'online_sales_mgr'
]
=
$perm
->
getDepartmentUser
(
33
,
64
);
// 线上销售-33 主管-64
$info
[
'online_sales_kefu_1'
]
=
$perm
->
getUserByCondition
(
34
,
''
,
0
);
// 线上一组
$info
[
'online_sales_kefu_2'
]
=
$perm
->
getUserByCondition
(
35
,
''
,
0
);
// 线上二组
$info
[
'online_sales_kefu_3'
]
=
$perm
->
getUserByCondition
(
36
,
''
,
0
);
// 线上三组
$info
[
'online_sales_kefu_4'
]
=
$perm
->
getUserByCondition
(
37
,
''
,
0
);
// 线上四组
$info
[
'offline_sales_chief'
]
=
$perm
->
getUserByCondition
(
40
,
66
,
0
);
// 线下销售-39 总监-66
$info
[
'offline_sales_all'
]
=
$perm
->
getDepartmentUser
(
40
,
62
);
// 线下销售各组人员
$info
[
'self_manager'
]
=
$perm
->
getUserByCondition
(
38
,
[
64
,
66
]);
// 自营销售部总监、主管
$info
[
'self_kefu'
]
=
$perm
->
getUserByCondition
(
38
,
62
);
// 自营销售部客服
$info
[
'test'
]
=
$perm
->
getUserByCondition
(
''
,
Config
(
'perm_args.test_position_id'
),
0
);
// 测试
$info
[
'sale_id'
]
=
$request
->
user
->
userId
;
$info
[
'role'
]
=
$perm
->
getUserRole
(
$request
);
...
...
app/Http/Controllers/PermController.php
View file @
a913760d
...
...
@@ -370,20 +370,29 @@
}
/* 订单系统权限调整 --- 20200511 */
// 获取指定职位的用户ID
public
function
getUserByPositionId
(
$position_id
,
$status
=
''
)
/**
* 根据指定条件获取用户
* @param string $department_id [description]
* @param [type] $position_id [description]
* @param string $status [description]
* @return [type] [description]
*/
public
function
getUserByCondition
(
$department_id
=
''
,
$position_id
=
''
,
$status
=
''
)
{
$map
=
[];
if
(
is_array
(
$position_id
))
{
// 数组
// $map[] = ['in' => ['position_id' => $position_id]];
$str
=
implode
(
','
,
$position_id
);
$map
[]
=
[
DB
::
raw
(
"position_id in (
{
$str
}
)"
),
'1'
];
}
else
{
$map
[
'position_id'
]
=
$position_id
;
if
(
$position_id
!==
''
)
{
if
(
is_array
(
$position_id
))
{
// 数组
// $map[] = ['in' => ['position_id' => $position_id]];
$str
=
implode
(
','
,
$position_id
);
$map
[]
=
[
DB
::
raw
(
"position_id in (
{
$str
}
)"
),
'1'
];
}
else
{
$map
[
'position_id'
]
=
$position_id
;
}
}
$department_id
!==
''
&&
$map
[
'department_id'
]
=
$department_id
;
$status
!==
''
&&
$map
[
'status'
]
=
$status
;
// 0-在职用户,1-离职用户
return
DB
::
table
(
'user_info'
)
->
where
(
$map
)
->
select
(
'userId'
,
'name'
,
'position_id'
,
'position_name'
,
'department_id'
,
'department_name'
,
'status'
)
->
get
();
...
...
@@ -423,5 +432,25 @@
return
array_unique
(
$sale_ids
);
// 去重返回
}
// 根据部门、职位获取下面人员(主管/组内销售)
public
function
getDepartmentUser
(
$department_id
,
$position_id
)
{
// 获取下级部门
$sub_department
=
DB
::
table
(
'user_department'
)
->
where
(
'parent_id'
,
$department_id
)
->
select
(
'department_id'
,
'department_name'
)
->
get
();
if
(
!
$sub_department
)
return
false
;
$user
=
[];
foreach
(
$sub_department
as
$v
)
{
$tmp
=
DB
::
table
(
'user_info'
)
->
where
(
'department_id'
,
$v
->
department_id
)
->
where
(
'position_id'
,
$position_id
)
->
select
(
'userId'
,
'name'
)
->
first
();
if
(
!
$tmp
)
continue
;
$user
[]
=
$tmp
;
}
return
$user
;
}
}
\ No newline at end of file
config/perm_args.php
View file @
a913760d
...
...
@@ -81,4 +81,10 @@ return [
'查看订单'
=>
4
,
],
// 销售职位ID (62-销售,63-销售经理,64-销售主管,65-销售助理,66-总监)
'sales_position_id'
=>
[
62
,
63
,
64
,
65
,
66
],
// 测试人员职位ID
'test_position_id'
=>
[
23
,
24
,
25
],
];
resources/views/detail/sendSales.blade.php
View file @
a913760d
...
...
@@ -9,12 +9,12 @@
<input
type=
"hidden"
name=
"order_id"
value=
"{{ $order_info['order_id'] }}"
>
<table
class=
"table table-bordered table-hover check-table"
style=
"min-height:150px;"
>
@if (!empty($
joint_
manager))
@if (!empty($manager))
<tr>
<td
class=
"check-table-title"
width=
"15%"
></td>
<td>
<ul>
@foreach ($
joint_
manager as $vo)
@foreach ($manager as $vo)
@if ($vo->userId == $order_info['sale_id'])
<li><label><input
type=
"radio"
name=
"sale_id"
value=
"{{$vo->userId}}"
checked
/><span>
{{$vo->name}}
</span></label></li>
@else
...
...
@@ -26,12 +26,12 @@
</tr>
@endif
@if (!empty($
kefu_manager
))
@if (!empty($
online_sales_chief
))
<tr>
<td
class=
"check-table-title"
></td>
<td>
<ul>
@foreach ($
kefu_manager
as $vo)
@foreach ($
online_sales_chief
as $vo)
@if ($vo->userId == $order_info['sale_id'])
<li><label><input
type=
"radio"
name=
"sale_id"
value=
"{{$vo->userId}}"
checked
/><span>
{{$vo->name}}
</span></label></li>
@else
...
...
@@ -43,9 +43,9 @@
</tr>
@endif
@if (!empty($
joint_in_charge
))
@if (!empty($
online_sales_mgr
))
<tr>
<td
class=
"check-table-title"
>
联营客服
:
</td>
<td
class=
"check-table-title"
>
线上销售
:
</td>
<td>
<ul>
<table
class=
"table table-bordered table-hover"
>
...
...
@@ -53,7 +53,7 @@
<td
width=
"10%"
>
主管:
</td>
<td>
<ul>
@foreach ($
joint_in_charge
as $vo)
@foreach ($
online_sales_mgr
as $vo)
@if ($vo->userId == $order_info['sale_id'])
<li><label><input
type=
"radio"
name=
"sale_id"
value=
"{{$vo->userId}}"
checked
/><span>
{{$vo->name}}
</span></label></li>
@else
...
...
@@ -63,11 +63,13 @@
</ul>
</td>
</tr>
@if (!empty($online_sales_kefu_1))
<tr>
<td>
线销一组:
</td>
<td>
<ul>
@foreach ($
joint
_kefu_1 as $vo)
@foreach ($
online_sales
_kefu_1 as $vo)
@if ($vo->userId == $order_info['sale_id'])
<li><label><input
type=
"radio"
name=
"sale_id"
value=
"{{$vo->userId}}"
checked
/><span>
{{$vo->name}}
</span></label></li>
@else
...
...
@@ -77,11 +79,14 @@
</ul>
</td>
</tr>
@endif
@if (!empty($online_sales_kefu_2))
<tr>
<td>
线销二组:
</td>
<td>
<ul>
@foreach ($
joint
_kefu_2 as $vo)
@foreach ($
online_sales
_kefu_2 as $vo)
@if ($vo->userId == $order_info['sale_id'])
<li><label><input
type=
"radio"
name=
"sale_id"
value=
"{{$vo->userId}}"
checked
/><span>
{{$vo->name}}
</span></label></li>
@else
...
...
@@ -91,11 +96,14 @@
</ul>
</td>
</tr>
@endif
@if (!empty($online_sales_kefu_3))
<tr>
<td>
线销三组:
</td>
<td>
<ul>
@foreach ($
joint
_kefu_3 as $vo)
@foreach ($
online_sales
_kefu_3 as $vo)
@if ($vo->userId == $order_info['sale_id'])
<li><label><input
type=
"radio"
name=
"sale_id"
value=
"{{$vo->userId}}"
checked
/><span>
{{$vo->name}}
</span></label></li>
@else
...
...
@@ -105,18 +113,36 @@
</ul>
</td>
</tr>
@endif
@if (!empty($online_sales_kefu_4))
<tr>
<td>
线销四组:
</td>
<td>
<ul>
@foreach ($online_sales_kefu_4 as $vo)
@if ($vo->userId == $order_info['sale_id'])
<li><label><input
type=
"radio"
name=
"sale_id"
value=
"{{$vo->userId}}"
checked
/><span>
{{$vo->name}}
</span></label></li>
@else
<li><label><input
type=
"radio"
name=
"sale_id"
value=
"{{$vo->userId}}"
/><span>
{{$vo->name}}
</span></label></li>
@endif
@endforeach
</ul>
</td>
</tr>
@endif
</table>
</ul>
</td>
</tr>
@endif
@if (!empty($
sale_manager
))
@if (!empty($
offline_sales_chief
))
<tr>
<td
class=
"check-table-title"
></td>
<td>
<ul>
@foreach ($
sale_manager
as $vo)
@foreach ($
offline_sales_chief
as $vo)
@if ($vo->userId == $order_info['sale_id'])
<li><label><input
type=
"radio"
name=
"sale_id"
value=
"{{$vo->userId}}"
checked
/><span>
{{$vo->name}}
</span></label></li>
@else
...
...
@@ -128,12 +154,12 @@
</tr>
@endif
@if (!empty($
sale_list
))
@if (!empty($
offline_sales_all
))
<tr>
<td
class=
"check-table-title"
>
交易员:
</td>
<td>
<ul>
@foreach ($
sale_list
as $vo)
@foreach ($
offline_sales_all
as $vo)
@if ($vo->userId == $order_info['sale_id'])
<li><label><input
type=
"radio"
name=
"sale_id"
value=
"{{$vo->userId}}"
checked
/><span>
{{$vo->name}}
</span></label></li>
@else
...
...
@@ -197,8 +223,8 @@
</tr>
@endif
<!-- 查看权限:当前推送人 或 管理员、
经理、测试、运营助理 或 自营客服主管
-->
@if ($sale_id == $order_info['sale_id'] || in_array($role, [1, 2
, 5, 8, 10, 11, 14, 16, 18
]))
<!-- 查看权限:当前推送人 或 管理员、
查看下级权限
-->
@if ($sale_id == $order_info['sale_id'] || in_array($role, [1, 2]))
<tr>
<td
class=
"check-table-title"
>
备注信息:
</td>
<td>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment