Commit c7d0c372 by 朱继来

Merge branch 'zjl_commit_20200526'

parents 798d82e6 e946a449
...@@ -2069,10 +2069,13 @@ Class OrderController extends Controller ...@@ -2069,10 +2069,13 @@ Class OrderController extends Controller
{ {
$id = $request->input('id'); $id = $request->input('id');
$cc_email = $request->input('cc_email', ''); // 额外抄送人 $cc_email = $request->input('cc_email', ''); // 额外抄送人
$info = $this->orderDetail($request, $id); $info = $this->orderDetail($request, $id);
//循环订单详情 //循环订单详情
foreach ($info['order_items_info'] as $key => $value) { foreach ($info['order_items_info'] as $key => $value) {
if(empty($value['batch'])) return ['errcode'=>-1,'errmsg'=>'商品:'.$tmp['goods'].'缺少批次<br/>'.'请填写批次后再发送'];
if(empty($value['buyerName'])) return ['errcode'=>-1,'errmsg'=>'商品:'.$tmp['goods'].'缺少采购人员<br/>'.'请填写采购后再发送'];
$tmp['orderNum'] = $info['order_temp_info']['erp_sn']; $tmp['orderNum'] = $info['order_temp_info']['erp_sn'];
$tmp['goods'] = $value['goods_name']; $tmp['goods'] = $value['goods_name'];
$tmp['purchasingPrice'] = $value['goods_price'];//采购价 $tmp['purchasingPrice'] = $value['goods_price'];//采购价
...@@ -2084,23 +2087,9 @@ Class OrderController extends Controller ...@@ -2084,23 +2087,9 @@ Class OrderController extends Controller
$tmp['remarks'] = $value['remarks']; $tmp['remarks'] = $value['remarks'];
$tmp['material'] = $value['erp_rec_id']; $tmp['material'] = $value['erp_rec_id'];
$tmp['purchasing'] = !empty($value['buyerName'])?$value['buyerName']:''; $tmp['purchasing'] = !empty($value['buyerName'])?$value['buyerName']:'';
$tmp['projectId'] = $key+1; $tmp['projectId'] = $key+1;
$tmp['deliveryTime'] = $value['batch']; //批次
if(empty($value['batch'])){ $tmp['send_email'] = !empty($value['send_email'])?$value['send_email']:'';
$msg = '商品:'.$tmp['goods'].'缺少批次<br/>'.'请填写批次后再发送';
echo json_encode(['errcode'=>-1,'errmsg'=>$msg]);
exit;
}
if(empty($value['buyerName'])){
$msg = '商品:'.$tmp['goods'].'缺少采购人员<br/>'.'请填写采购后再发送';
echo json_encode(['errcode'=>-1,'errmsg'=>$msg]);
exit;
}
//批次
$tmp['deliveryTime'] = $value['batch'];
$tmp['send_email'] = !empty($value['send_email'])?$value['send_email']:'';
$data['data'][] = $tmp; $data['data'][] = $tmp;
} }
...@@ -2122,15 +2111,14 @@ Class OrderController extends Controller ...@@ -2122,15 +2111,14 @@ Class OrderController extends Controller
$cc_send_mail_array = Config('config.cc_email'); // 固定抄送人 $cc_send_mail_array = Config('config.cc_email'); // 固定抄送人
$perm = new PermController; $perm = new PermController;
$manager_email = $perm->getManager($request); // 获取上级主管邮箱 $manager_email = $perm->getManager($request->user->userId); // 获取上级主管邮箱
if ($manager_email) { if ($manager_email) {
$cc_send_mail_array = array_merge($cc_send_mail_array, $manager_email); // 合并上级主管邮箱 $cc_send_mail_array = array_merge($cc_send_mail_array, $manager_email); // 合并上级主管邮箱
} }
$cc_send_mail_array[] = $request->user->email; // 默认抄送给自己 $cc_send_mail_array[] = $request->user->email; // 默认抄送给自己
$cc_send_mail_array = array_unique($cc_send_mail_array); // 去重
$cc_send_mail_array = array_unique($cc_send_mail_array); // 去重
$cc_email_arr = []; $cc_email_arr = [];
...@@ -2143,23 +2131,21 @@ Class OrderController extends Controller ...@@ -2143,23 +2131,21 @@ Class OrderController extends Controller
} }
} }
$data['ccUser'] = array_unique(array_merge($cc_send_mail_array, $cc_email_arr)); $data['ccUser'] = array_unique(array_merge($cc_send_mail_array, $cc_email_arr));
$data['combined'] = $info['order_info']['order_amount']; $data['combined'] = $info['order_info']['order_amount'];
$data['order_amount'] = $info['order_info']['order_amount']; $data['order_amount'] = $info['order_info']['order_amount'];
$data['date'] = date('Y-m-d',time()); $data['date'] = date('Y-m-d',time());
$data['kefu_remark'] = $info['order_temp_info']['kefu_remark']; // 客服备注 $data['kefu_remark'] = $info['order_temp_info']['kefu_remark']; // 客服备注
$CmsModel = new CmsModel(); $CmsModel = new CmsModel();
$data['id'] = $CmsModel->getUserName($info['order_info']['sale_id']); //获取业务员 $data['id'] = $CmsModel->getUserName($info['order_info']['sale_id']); //获取业务员
$data['order_id'] = intval($id); $data['order_id'] = intval($id);
$data['operator_id'] = intval($request->user->userId); $data['operator_id'] = intval($request->user->userId);
$data['operator_event'] = '发送邮件成功,收件人邮箱:'.json_encode($send_mail_array).',抄送人邮箱:'.json_encode($data['ccUser']); $data['operator_event'] = '发送邮件成功,收件人邮箱:'.json_encode($send_mail_array).',抄送人邮箱:'.json_encode($data['ccUser']);
// 推入到邮件队列 // 推入到邮件队列
$QueuedModel = new QueuedModel(); $QueuedModel = new QueuedModel();
$queued_name = 'send_buyer_mail'; $queued_name = 'send_buyer_mail';
$QueuedModel->pushAmq('ichunt_order_msg', $queued_name, $queued_name, json_encode($data)); $QueuedModel->pushAmq('ichunt_order_msg', $queued_name, $queued_name, json_encode($data));
return ['errcode'=>0, 'errmsg'=>'推送到邮件队列成功,请稍等...']; return ['errcode'=>0, 'errmsg'=>'推送到邮件队列成功,请稍等...'];
......
...@@ -344,29 +344,52 @@ ...@@ -344,29 +344,52 @@
// } // }
// 获取角色对应的主管邮箱 // 获取角色对应的主管邮箱
public function getManager($request) // public function getManager($request)
{ // {
$role = $this->getUserRole($request); // 当前用户角色 // $role = $this->getUserRole($request); // 当前用户角色
$manager_key = array_search($role, Config('perm_args.manager_to_kefu')); // 获取对应的主管key // $manager_key = array_search($role, Config('perm_args.manager_to_kefu')); // 获取对应的主管key
if (!$manager_key) return false; // if (!$manager_key) return false;
$role_name = array_search($manager_key, Config('perm_args.roles')); // 获取主管对应的角色名称 // $role_name = array_search($manager_key, Config('perm_args.roles')); // 获取主管对应的角色名称
if (!$role_name) return false; // if (!$role_name) return false;
$res = $this->getRoleUsers($request, $role_name); // 获取角色对应的用户 // $res = $this->getRoleUsers($request, $role_name); // 获取角色对应的用户
$email = []; // $email = [];
if ($res) { // if ($res) {
foreach ($res as $v) { // foreach ($res as $v) {
$email[] = $v->email; // $email[] = $v->email;
} // }
// }
// return $email;
// }
// 获取角色对应的主管邮箱
public function getManager($userId)
{
// 获取当前所在部门
$department_id = DB::table('user_info')->where('userId', $userId)->value('department_id');
if (!$department_id) return false;
$map = [];
$map['department_id'] = $department_id;
$map['position_id'] = 63; // 销售经理
$email = DB::table('user_info')->where($map)->select('email')->get();
if (empty($email)) return false;
foreach ($email as $v) {
$data[] = $v->email;
} }
return $email; return $data;
} }
/* 订单系统权限调整 --- 20200511 */ /* 订单系统权限调整 --- 20200511 */
......
...@@ -126,7 +126,7 @@ class ReturnController extends Controller ...@@ -126,7 +126,7 @@ class ReturnController extends Controller
$map['sale_id'] = $request->input('sale_id', ''); $map['sale_id'] = $request->input('sale_id', '');
// 非管理员、查看下级,只能看到自己的退货单 // 非管理员、查看下级,只能看到自己的退货单
if (!in_array($info['role'], [1, 2])) { if ($info['role'] == 3) {
$map['create_uid'] = $request->user->userId; $map['create_uid'] = $request->user->userId;
} }
......
...@@ -143,8 +143,8 @@ ...@@ -143,8 +143,8 @@
</div> </div>
</div> </div>
<!-- 管理员、经理、自营客服主管及助理审核 && 待审核状态 --> <!-- 管理员、经理、自营查看 && 待审核状态 -->
@if (in_array($role, [1, 2, 10, 11]) && $return['status'] == 1) @if (in_array($role, [1, 2, 5]) && $return['status'] == 1)
<div class="text-center" style="margin-bottom: 10px;"> <div class="text-center" style="margin-bottom: 10px;">
<button class="btn btn-info return-check" style="margin-right: 10px;" data-type="2" data-id="{{ $return['return_id'] }}">审核通过</button> <button class="btn btn-info return-check" style="margin-right: 10px;" data-type="2" data-id="{{ $return['return_id'] }}">审核通过</button>
<button class="btn btn-danger return-check" data-type="-2" data-id="{{ $return['return_id'] }}">驳回</button> <button class="btn btn-danger return-check" data-type="-2" data-id="{{ $return['return_id'] }}">驳回</button>
......
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