Commit 47e0a832 by 朱继来

调整自营销售权限

parent 40b20a99
...@@ -397,6 +397,10 @@ Class OrderController extends Controller ...@@ -397,6 +397,10 @@ Class OrderController extends Controller
$info = $this->getOrderInfo($request, 1); $info = $this->getOrderInfo($request, 1);
$info['title'] = '订单列表'; $info['title'] = '订单列表';
if ($info['role'] == 5) { // 自营
return redirect('/self_order');
}
return view('orderlist', $info); return view('orderlist', $info);
} }
...@@ -487,7 +491,7 @@ Class OrderController extends Controller ...@@ -487,7 +491,7 @@ Class OrderController extends Controller
$info = $this->_search($request, $tid); $info = $this->_search($request, $tid);
$perm = new PermController; $perm = new PermController;
$sale_list = $perm->getUserByCondition('', Config('perm_args.sales_position_id')); // 获取所有的销售 $sale_list = $perm->getUserByDepartmentId(Config('perm_args.sales_department_id')); // 获取所有的销售
//获取订单列表 //获取订单列表
$url = Config('website.api_domain').'order/getAllOrder'; $url = Config('website.api_domain').'order/getAllOrder';
...@@ -689,7 +693,7 @@ Class OrderController extends Controller ...@@ -689,7 +693,7 @@ Class OrderController extends Controller
$info['buyers'] = $perm->getUserByCondition('', 39); // 获取采购员, ID - 39 $info['buyers'] = $perm->getUserByCondition('', 39); // 获取采购员, ID - 39
$perm = new PermController; $perm = new PermController;
$sale_list = $perm->getUserByCondition('', Config('perm_args.sales_position_id'), 0); // 获取所有的销售 (过滤已离职的) $sale_list = $perm->getUserByDepartmentId(Config('perm_args.sales_department_id'), 0); // 获取所有的销售
$info['cc_sales'] = $sale_list ? array_merge($info['buyers'], $sale_list) : $info['buyers']; $info['cc_sales'] = $sale_list ? array_merge($info['buyers'], $sale_list) : $info['buyers'];
} }
...@@ -972,8 +976,7 @@ Class OrderController extends Controller ...@@ -972,8 +976,7 @@ Class OrderController extends Controller
$info['offline_sales_chief'] = $perm->getUserByCondition(40, 90, 0); // 线下销售-39 线下销售总监-90 $info['offline_sales_chief'] = $perm->getUserByCondition(40, 90, 0); // 线下销售-39 线下销售总监-90
$info['offline_sales_all'] = $perm->getDepartmentUser(40, 62); // 线下销售各组人员 $info['offline_sales_all'] = $perm->getDepartmentUser(40, 62); // 线下销售各组人员
$info['self_manager'] = $perm->getUserByCondition(38, [63, 66]); // 自营销售部总监、主管 $info['self_kefu'] = $perm->getUserByDepartmentId(38, 0); // 自营销售部
$info['self_kefu'] = $perm->getUserByCondition(38, 62); // 自营销售部客服
$info['test'] = $perm->getUserByCondition('', Config('perm_args.test_position_id'), 0); // 测试 $info['test'] = $perm->getUserByCondition('', Config('perm_args.test_position_id'), 0); // 测试
......
...@@ -370,6 +370,42 @@ ...@@ -370,6 +370,42 @@
} }
/* 订单系统权限调整 --- 20200511 */ /* 订单系统权限调整 --- 20200511 */
// 获取部门人员
public function getUserByDepartmentId($department_id, $status='')
{
$department_ids = [];
$this->getSubDepartmentId($department_id, $department_ids);
$data = DB::table('user_info')->whereIn('department_id', $department_ids)
->where(function($query) use($status) {
if ($status !== '') {
$query->where('status', '=', $status);
}
})
->select('userId', 'name', 'status')
->get();
return $data;
}
// 获取下级部门ID
public function getSubDepartmentId($department_id, &$department_ids)
{
// 获取下级部门
$sub_department = DB::table('user_department')->where('parent_id', $department_id)->select('department_id', 'department_name')->get();
if ($sub_department) {
foreach ($sub_department as $v) {
$this->getSubDepartmentId($v->department_id, $department_ids);
}
}
$department_ids[] = $department_id;
return $department_ids;
}
/** /**
* 根据指定条件获取用户 * 根据指定条件获取用户
* @param string $department_id [description] * @param string $department_id [description]
......
...@@ -171,7 +171,7 @@ class ReturnController extends Controller ...@@ -171,7 +171,7 @@ class ReturnController extends Controller
// $info['sale_list'] = array_merge($joint_kefu, $self_kefu); // $info['sale_list'] = array_merge($joint_kefu, $self_kefu);
$perm = new PermController; $perm = new PermController;
$sale_list = $perm->getUserByCondition('', Config('perm_args.sales_position_id')); // 获取所有的销售 $sale_list = $perm->getUserByDepartmentId(Config('perm_args.sales_department_id')); // 获取所有的销售
$info['sale_list'] = $sale_list; $info['sale_list'] = $sale_list;
......
...@@ -79,10 +79,11 @@ return [ ...@@ -79,10 +79,11 @@ return [
'查看下级' => 2, '查看下级' => 2,
'查看自己' => 3, '查看自己' => 3,
'查看订单' => 4, '查看订单' => 4,
'自营查看全部' => 5,
], ],
// 销售职位ID (62-销售,63-销售经理,64-销售主管,65-销售助理,66-线上销售总监, 90-线下销售总监) // 销售部门ID
'sales_position_id' => [62, 63, 64, 65, 66, 90], 'sales_department_id' => 7,
// 测试人员职位ID // 测试人员职位ID
'test_position_id' => [23, 24, 25], 'test_position_id' => [23, 24, 25],
......
...@@ -170,28 +170,10 @@ ...@@ -170,28 +170,10 @@
</td> </td>
</tr> </tr>
@endif @endif
@if (!empty($self_manager))
<tr>
<td class="check-table-title" width="10%">自营客服主管:</td>
<td>
<ul>
@foreach ($self_manager as $v)
@if ($v->userId == $order_info['sale_id'])
<li><label><input type="radio" name="sale_id" value="{{$v->userId}}" checked /><span>{{$v->name}}</span></label></li>
@else
<li><label><input type="radio" name="sale_id" value="{{$v->userId}}"/><span>{{$v->name}}</span></label></li>
@endif
@endforeach
</ul>
</td>
</tr>
@endif
@if (!empty($self_kefu)) @if (!empty($self_kefu))
<tr> <tr>
<td class="check-table-title">自营客服</td> <td class="check-table-title">自营销售部</td>
<td> <td>
<ul> <ul>
@foreach ($self_kefu as $vo) @foreach ($self_kefu as $vo)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment