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
fa2ac2b8
authored
Jun 12, 2020
by
朱继来
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' of
http://119.23.72.7/zhujilai/Order
into zjl_brand_20200608
parents
5d723e3b
cc90ed8d
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
70 additions
and
66 deletions
app/Http/Controllers/OrderController.php
app/Http/Controllers/PermController.php
public/js/order_send_email.js
resources/views/changeOrder/content.blade.php
resources/views/orderlist/content.blade.php
app/Http/Controllers/OrderController.php
View file @
fa2ac2b8
...
...
@@ -699,7 +699,7 @@ Class OrderController extends Controller
}
}
else
{
$perm
=
new
PermController
;
$info
[
'buyers'
]
=
$perm
->
getUserBy
Condition
(
''
,
39
);
// 获取采购员, ID - 39
$info
[
'buyers'
]
=
$perm
->
getUserBy
DepartmentId
(
8
,
0
);
// 获取采购部人员
$perm
=
new
PermController
;
$sale_list
=
$perm
->
getUserByDepartmentId
(
Config
(
'perm_args.sales_department_id'
),
0
);
// 获取所有的销售
...
...
@@ -1017,10 +1017,10 @@ Class OrderController extends Controller
$info
[
'online_sales_chief'
]
=
$perm
->
getUserByCondition
(
33
,
66
,
0
);
// 线上销售-33 线上销售总监-66
$info
[
'online_sales_mgr'
]
=
$perm
->
getDepartmentUser
(
33
,
63
);
// 线上销售-33 销售经理-63
$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
[
'online_sales_kefu_1'
]
=
$perm
->
getUserByCondition
(
34
,
62
,
0
);
// 线上一组销售
$info
[
'online_sales_kefu_2'
]
=
$perm
->
getUserByCondition
(
35
,
62
,
0
);
// 线上二组销售
$info
[
'online_sales_kefu_3'
]
=
$perm
->
getUserByCondition
(
36
,
62
,
0
);
// 线上三组销售
$info
[
'online_sales_kefu_4'
]
=
$perm
->
getUserByCondition
(
37
,
62
,
0
);
// 线上四组销售
$info
[
'offline_sales_chief'
]
=
$perm
->
getUserByCondition
(
40
,
90
,
0
);
// 线下销售-39 线下销售总监-90
$info
[
'offline_sales_all'
]
=
$perm
->
getDepartmentUser
(
40
,
62
);
// 线下销售各组人员
...
...
@@ -2071,11 +2071,16 @@ Class OrderController extends Controller
$cc_email
=
$request
->
input
(
'cc_email'
,
''
);
// 额外抄送人
$info
=
$this
->
orderDetail
(
$request
,
$id
);
$send_buyers
=
[];
// 发送采购邮件数据
$CmsModel
=
new
CmsModel
();
$sale_name
=
$CmsModel
->
getUserName
(
$info
[
'order_info'
][
'sale_id'
]);
//获取业务员
//循环订单详情
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/>'
.
'请填写采购后再发送'
];
if
(
empty
(
$value
[
'batch'
]))
return
[
'errcode'
=>-
1
,
'errmsg'
=>
'商品:'
.
$
value
[
'goods_name
'
]
.
'缺少批次<br/>'
.
'请填写批次后再发送'
];
if
(
empty
(
$value
[
'buyerName'
]))
return
[
'errcode'
=>-
1
,
'errmsg'
=>
'商品:'
.
$
value
[
'goods_name
'
]
.
'缺少采购人员<br/>'
.
'请填写采购后再发送'
];
$tmp
=
[];
$tmp
[
'orderNum'
]
=
$info
[
'order_temp_info'
][
'erp_sn'
];
$tmp
[
'goods'
]
=
$value
[
'goods_name'
];
$tmp
[
'purchasingPrice'
]
=
$value
[
'goods_price'
];
//采购价
...
...
@@ -2087,37 +2092,49 @@ Class OrderController extends Controller
$tmp
[
'remarks'
]
=
$value
[
'remarks'
];
$tmp
[
'material'
]
=
$value
[
'erp_rec_id'
];
$tmp
[
'purchasing'
]
=
!
empty
(
$value
[
'buyerName'
])
?
$value
[
'buyerName'
]
:
''
;
$tmp
[
'projectId'
]
=
$key
+
1
;
$tmp
[
'deliveryTime'
]
=
$value
[
'batch'
];
//批次
$tmp
[
'send_email'
]
=
!
empty
(
$value
[
'send_email'
])
?
$value
[
'send_email'
]
:
''
;
$send_buyers
[
$value
[
'send_email'
]][
'data'
][]
=
$tmp
;
$send_buyers
[
$value
[
'send_email'
]][
'toUser'
]
=
$value
[
'send_email'
];
$send_buyers
[
$value
[
'send_email'
]][
'ccUser'
]
=
[];
$send_buyers
[
$value
[
'send_email'
]][
'date'
]
=
date
(
'Y-m-d'
,
time
());
$send_buyers
[
$value
[
'send_email'
]][
'date'
]
=
intval
(
$id
);
$send_buyers
[
$value
[
'send_email'
]][
'id'
]
=
$sale_name
;
$tmp
[
'projectId'
]
=
$key
+
1
;
$data
[
'data'
][]
=
$tmp
;
}
//循环出邮件接收人
foreach
(
$data
[
'data'
]
as
$key
=>
$value
)
{
$send_mail_array
[]
=
$value
[
'send_email'
];
}
// 各个采购邮件推入队列
foreach
(
$send_buyers
as
&
$v
)
{
$v
[
'combined'
]
=
0
;
$send_mail_array
=
array_unique
(
$send_mail_array
);
foreach
(
$v
[
'data'
]
as
$item
)
{
$v
[
'combined'
]
+=
$item
[
'totalPrice'
];
}
if
(
empty
(
$send_mail_array
[
0
])){
echo
json_encode
([
'errcode'
=>-
1
,
'errmsg'
=>
'没有填写采购人员,请至少填写一个采购人员'
]);
exit
;
$this
->
pushQueue
(
$v
);
}
$data
[
'toUser'
]
=
$
send_mail_array
;
// 收件人
$data
[
'toUser'
]
=
$
request
->
user
->
email
;
// 收件人
$cc_send_mail_array
=
Config
(
'config.cc_email'
);
// 固定抄送人
$perm
=
new
PermController
;
$manager_email
=
$perm
->
getManager
(
$request
->
user
->
userId
);
// 获取上级主管邮箱
$kefu_manager_email
=
$perm
->
getManager
(
$request
->
user
->
userId
,
63
);
// 获取当前客服的上级主管邮箱,63-销售经理
$kefu_manager_email
&&
$cc_send_mail_array
=
array_merge
(
$cc_send_mail_array
,
$kefu_manager_email
);
// 合并上级主管邮箱
// 获取采购经理
$buyer_ids
=
array_unique
(
array_column
(
$info
[
'order_items_info'
],
'buyer_id'
));
foreach
(
$buyer_ids
as
$v
)
{
$buyer_manager_email
=
$perm
->
getManager
(
$v
,
41
);
// 获取当前采购的上级主管邮箱,41-采购经理
if
(
$manager_email
)
{
$cc_send_mail_array
=
array_merge
(
$cc_send_mail_array
,
$manager_email
);
// 合并上级主管邮箱
$buyer_manager_email
&&
$cc_send_mail_array
=
array_merge
(
$cc_send_mail_array
,
$buyer_manager_email
);
}
$cc_send_mail_array
[]
=
$request
->
user
->
email
;
// 默认抄送给自己
$cc_send_mail_array
=
array_unique
(
$cc_send_mail_array
);
// 去重
$cc_email_arr
=
[];
...
...
@@ -2136,41 +2153,22 @@ Class OrderController extends Controller
$data
[
'order_amount'
]
=
$info
[
'order_info'
][
'order_amount'
];
$data
[
'date'
]
=
date
(
'Y-m-d'
,
time
());
$data
[
'kefu_remark'
]
=
$info
[
'order_temp_info'
][
'kefu_remark'
];
// 客服备注
$CmsModel
=
new
CmsModel
();
$data
[
'id'
]
=
$CmsModel
->
getUserName
(
$info
[
'order_info'
][
'sale_id'
]);
//获取业务员
$data
[
'id'
]
=
$sale_name
;
$data
[
'order_id'
]
=
intval
(
$id
);
$data
[
'operator_id'
]
=
intval
(
$request
->
user
->
userId
);
$data
[
'operator_event'
]
=
'发送邮件成功,收件人邮箱:'
.
json_encode
(
$send_mail_array
)
.
',抄送人邮箱:'
.
json_encode
(
$data
[
'ccUser'
]);
$data
[
'operator_event'
]
=
'发送邮件成功,收件人邮箱:'
.
json_encode
(
$data
[
'toUser'
])
.
',抄送人邮箱:'
.
json_encode
(
$data
[
'ccUser'
]);
$this
->
pushQueue
(
$data
);
return
[
'errcode'
=>
0
,
'errmsg'
=>
'推送到邮件队列成功,请稍等...'
];
}
public
function
pushQueue
(
$data
)
{
// 推入到邮件队列
$QueuedModel
=
new
QueuedModel
();
$queued_name
=
'send_buyer_mail'
;
$QueuedModel
->
pushAmq
(
'ichunt_order_msg'
,
$queued_name
,
$queued_name
,
json_encode
(
$data
));
return
[
'errcode'
=>
0
,
'errmsg'
=>
'推送到邮件队列成功,请稍等...'
];
// $crm_url = Config('website.crm_domain').'/api/sendCaiGouEmailByOrderAdmin';
// $data = json_encode($data);
// $crm_header = array('api-key: crm a1b2c3d4e5f6g7h8i9jk');
// $res = json_decode(post_curl($crm_url, $data,$crm_header));
// if(!empty($res->err_code) && $res->err_code == 0){
// // 操作日志
// $OrderActionLogModel = new OrderActionLogModel();
// $event = '发送邮件成功,收件人邮箱:'.json_encode($send_mail_array).',抄送人邮箱:'.json_encode($data['ccUser']);
// $actionLog = $OrderActionLogModel->addLog($id, $request->user->userId, 2, $event);
// echo json_encode(['errcode'=>1,'errmsg'=>'发送成功']);
// exit;
// }else{
// echo json_encode(['errcode'=>-1,'errmsg'=>'邮件发送接口错误,邮件发送失败']);
// exit;
// }
}
}
\ No newline at end of file
app/Http/Controllers/PermController.php
View file @
fa2ac2b8
...
...
@@ -369,8 +369,13 @@
// return $email;
// }
// 获取角色对应的主管邮箱
public
function
getManager
(
$userId
)
/**
* 获取角色对应的主管邮箱
* @param [type] $userId [description]
* @param [type] $position_id [主管ID]
* @return [type] [description]
*/
public
function
getManager
(
$userId
,
$position_id
)
{
// 获取当前所在部门
$department_id
=
DB
::
table
(
'user_info'
)
->
where
(
'userId'
,
$userId
)
->
value
(
'department_id'
);
...
...
@@ -379,7 +384,7 @@
$map
=
[];
$map
[
'department_id'
]
=
$department_id
;
$map
[
'position_id'
]
=
63
;
// 销售经理
$map
[
'position_id'
]
=
$position_id
;
$email
=
DB
::
table
(
'user_info'
)
->
where
(
$map
)
->
select
(
'email'
)
->
get
();
...
...
@@ -457,7 +462,7 @@
return
DB
::
table
(
'user_info'
)
->
where
(
$map
)
->
select
(
'userId'
,
'name'
,
'position_id'
,
'position_name'
,
'department_id'
,
'department_name'
,
'status'
)
->
get
();
}
// 获取下级所有人员
// 获取
指定用户
下级所有人员
public
function
getSubSaleId
(
$userId
)
{
$sale_ids
=
[];
...
...
public/js/order_send_email.js
View file @
fa2ac2b8
...
...
@@ -52,6 +52,8 @@
layer
.
alert
(
'网络异常'
);
}
});
layer
.
msg
(
'推送中...'
,
{
icon
:
16
,
time
:
0
,
shade
:
0.3
});
},
btn2
:
function
(
index
){
layer
.
close
(
index
);
...
...
resources/views/changeOrder/content.blade.php
View file @
fa2ac2b8
...
...
@@ -416,7 +416,7 @@
@if ($order_info['order_goods_type'] == 2
&&
$order_info['adjust_count']
<
2
)
<
a
class=
"btn btn-default"
href=
"{{$adjustPriceUrl}}"
>
再次调价
</a><span
class=
"warn-tip"
>
每笔订单仅有一次“再次调价”机会
</span>
@elseif ($order_info['order_goods_type'] == 1)
<
a
class=
"btn btn-default"
href=
"{{$adjustPriceUrl}}"
>
再次调价
</a
>
<
!-- <a class="btn btn-default" href="{{$adjustPriceUrl}}">再次调价</a> --
>
@endif
</div>
...
...
resources/views/orderlist/content.blade.php
View file @
fa2ac2b8
...
...
@@ -255,7 +255,7 @@
<th
class=
"pl30"
>
业务员
</th>
@if ($username != 'vpadmin@ichunt.com')
<th
class=
"pl30"
>
订单来源
</th>
<
th
class=
"pl30"
>
同步状态
</th
>
<
!-- <th class="pl30">同步状态</th> --
>
<th
class=
"pl30"
>
收货人
</th>
@endif
<th
class=
"pl30"
>
下单时间
</th>
...
...
@@ -289,7 +289,7 @@
</td>
<td
class=
"show-list"
>
<?php
if
(
$order_extend
->
is_manager_audit
)
{
if
(
!
empty
(
$order_extend
->
is_manager_audit
)
&&
$v
[
'status'
]
==
1
)
{
echo
'<span class="list-text-checking"><b>待主管审核</b></span>'
;
}
else
{
switch
(
$v
[
'status'
])
{
...
...
@@ -314,22 +314,22 @@
@if ($username != 'vpadmin@ichunt.com')
<td
class=
"show-list"
>
<?php
echo
App\Http\Controllers\getOrderSource
(
$v
[
'order_id'
],
$v
[
'order_type'
]);
?>
</td>
<td
class=
"show-list"
>
<
!-- <
td class="show-list">
<?php
if
(
in_array
(
$v
[
'status'
],
[
-
1
,
1
]))
{
echo
'不需同步'
;
}
else
{
echo
$v
[
'erp_order_id'
]
!=
''
&&
$v
[
'erp_order_id'
]
!=
'-'
?
'<span class="list-text-success"><b>已同步</b></span>'
:
'<span class="list-text-checking"><b>未同步</b></span>'
;
}
//
if (in_array($v['status'], [-1, 1])) {
//
echo '不需同步';
//
} else {
//
echo $v['erp_order_id'] != '' && $v['erp_order_id'] != '-' ? '<span class="list-text-success"><b>已同步</b></span>' : '<span class="list-text-checking"><b>未同步</b></span>';
//
}
?>
</td>
</td>
-->
<td
class=
"show-list"
>
<?php
echo
App\Http\Controllers\getOrderAddress
(
$v
[
'order_id'
]);
?>
</td>
@endif
<td
class=
"show-list"
>
{{$username != 'vpadmin@ichunt.com' ? date('Y-m-d H:i:s', $v['create_time']) : date('Y-m-d', $v['create_time'])}}
</td>
<td>
<div
class=
"btn-group btn-group-xs"
style=
"
width: 26
0px;"
>
<div
class=
"btn-group btn-group-xs"
style=
"
min-width: 20
0px;"
>
@if (in_array('check_order', $userPerms)
&&
$v['sale_id'])
@if ($v['status'] == 1)
<a
class=
"btn btn-success"
href=
"{{URL('change', ['order_id'=>$v['order_id']])}}"
target=
"_blank"
>
人工审单
</a>
...
...
@@ -344,7 +344,7 @@
@endif
@if (!empty($order_extend->erp_sn))
<a
class=
"btn btn-
primary
send_mail"
data-id=
"{{ $v['order_id'] }}"
>
发送邮件
</a>
<a
class=
"btn btn-
warning
send_mail"
data-id=
"{{ $v['order_id'] }}"
>
发送邮件
</a>
@endif
<a
class=
"btn btn-primary"
href=
"{{URL('details', ['order_id'=>$v['order_id']])}}"
target=
"_blank"
>
详情
</a>
...
...
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