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
6e12e0c3
authored
Jun 19, 2020
by
朱继来
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'zjl_commit_20200526'
parents
456a5a2c
067b1512
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
179 additions
and
60 deletions
app/Http/Controllers/OrderController.php
app/Http/Controllers/PermController.php
app/Http/routes.php
config/config.php
public/js/order_audit.js
resources/views/changeOrder/content.blade.php
resources/views/detail/content.blade.php
resources/views/detail/detail_base_info.blade.php
resources/views/detail/detail_items_info.php
resources/views/detail/js.blade.php
resources/views/orderlist/content.blade.php
resources/views/orderlist/js.blade.php
app/Http/Controllers/OrderController.php
View file @
6e12e0c3
...
...
@@ -898,7 +898,8 @@ Class OrderController extends Controller
$order_goods_type
=
$request
->
input
(
'order_goods_type'
,
1
);
if
(
$order_goods_type
==
1
)
{
$resData
[
'status'
]
=
$auditor_role
==
3
?
1
:
2
;
// 角色为‘查看自己’时,状态为待审核,否则为待付款
// $resData['status'] = $auditor_role == 3 ? 1 : 2; // 角色为‘查看自己’时,状态为待审核,否则为待付款
$resData
[
'is_manager'
]
=
$auditor_role
==
3
?
0
:
1
;
// 角色为‘查看自己’时,is_manager = 0
}
$url
=
Config
(
'website.api_domain'
)
.
'order/changeOrder'
;
...
...
@@ -910,6 +911,23 @@ Class OrderController extends Controller
}
}
// 申请主管审核
public
function
ajaxApplyManagerAudit
(
Request
$request
)
{
if
(
$request
->
isMethod
(
'post'
))
{
$data
[
'order_id'
]
=
$request
->
input
(
'order_id'
,
''
);
$data
[
'operator_id'
]
=
$request
->
user
->
userId
;
$data
[
'k1'
]
=
time
();
$data
[
'k2'
]
=
md5
(
md5
(
$data
[
'k1'
])
.
'fh6y5t4rr351d2c3bryi'
);
$url
=
Config
(
'website.api_domain'
)
.
'order/applyManagerAudit'
;
$temp
=
json_decode
(
curlApi
(
$url
,
$data
,
"POST"
),
true
);
return
array
(
'errcode'
=>
$temp
[
'err_code'
],
'errmsg'
=>
$temp
[
'err_msg'
]);
}
}
// 主管审核
public
function
ajaxAuditPass
(
Request
$request
)
{
...
...
@@ -2075,6 +2093,8 @@ Class OrderController extends Controller
$CmsModel
=
new
CmsModel
();
$sale_name
=
$CmsModel
->
getUserName
(
$info
[
'order_info'
][
'sale_id'
]);
//获取业务员
$to_user_array
=
[];
//循环订单详情
foreach
(
$info
[
'order_items_info'
]
as
$key
=>
$value
)
{
if
(
$value
[
'status'
]
==
-
1
)
continue
;
...
...
@@ -2092,53 +2112,29 @@ Class OrderController extends Controller
$tmp
[
'currency'
]
=
$info
[
'order_info'
][
'currency'
]
==
1
?
'人民币'
:
'美元'
;
$tmp
[
'totalPrice'
]
=
number_format
(
$value
[
'goods_number'
]
*
$value
[
'single_pre_price'
],
2
,
'.'
,
''
);
$tmp
[
'remarks'
]
=
$value
[
'remarks'
];
$tmp
[
'material'
]
=
$value
[
'
erp_rec_id
'
];
$tmp
[
'material'
]
=
$value
[
'
material_number
'
];
$tmp
[
'purchasing'
]
=
!
empty
(
$value
[
'buyerName'
])
?
$value
[
'buyerName'
]
:
''
;
$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
;
$send_buyers
[
$value
[
'buyer_id'
]][
'data'
][]
=
$tmp
;
$send_buyers
[
$value
[
'buyer_id'
]][
'toUser'
]
=
$value
[
'send_email'
];
$send_buyers
[
$value
[
'buyer_id'
]][
'date'
]
=
date
(
'Y-m-d'
,
time
());
$send_buyers
[
$value
[
'buyer_id'
]][
'date'
]
=
intval
(
$id
);
$send_buyers
[
$value
[
'buyer_id'
]][
'id'
]
=
$sale_name
;
$tmp
[
'projectId'
]
=
$key
+
1
;
$data
[
'data'
][]
=
$tmp
;
}
$to_user_array
[]
=
$value
[
'send_email'
];
// 各个采购邮件推入队列
foreach
(
$send_buyers
as
&
$v
)
{
$v
[
'combined'
]
=
0
;
foreach
(
$v
[
'data'
]
as
$item
)
{
$v
[
'combined'
]
+=
$item
[
'totalPrice'
];
}
$this
->
pushQueue
(
$v
);
// $tmp['projectId'] = $key+1;
// $data['data'][] = $tmp;
}
$data
[
'toUser'
]
=
$request
->
user
->
email
;
// 收件人
$cc_send_mail_array
=
Config
(
'config.cc_email'
);
// 固定抄送人
$perm
=
new
PermController
;
$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-采购经理
$buyer_manager_email
&&
$cc_send_mail_array
=
array_merge
(
$cc_send_mail_array
,
$buyer_manager_email
);
}
$cc_send_mail_array
=
array_unique
(
$cc_send_mail_array
);
// 去重
$cc_email_arr
=
[];
if
(
$cc_email
)
{
// 后台选择的额外抄送人
...
...
@@ -2150,17 +2146,58 @@ Class OrderController extends Controller
}
}
$data
[
'ccUser'
]
=
array_unique
(
array_merge
(
$cc_send_mail_array
,
$cc_email_arr
));
$data
[
'combined'
]
=
$info
[
'order_info'
][
'order_amount'
];
$data
[
'order_amount'
]
=
$info
[
'order_info'
][
'order_amount'
];
$data
[
'date'
]
=
date
(
'Y-m-d'
,
time
());
$data
[
'kefu_remark'
]
=
$info
[
'order_temp_info'
][
'kefu_remark'
];
// 客服备注
$data
[
'id'
]
=
$sale_name
;
$data
[
'order_id'
]
=
intval
(
$id
);
$data
[
'operator_id'
]
=
intval
(
$request
->
user
->
userId
);
$data
[
'operator_event'
]
=
'发送邮件成功,收件人邮箱:'
.
json_encode
(
$data
[
'toUser'
])
.
',抄送人邮箱:'
.
json_encode
(
$data
[
'ccUser'
]);
$cc_send_mail_array
=
array_unique
(
array_merge
(
$cc_send_mail_array
,
$cc_email_arr
));
// 各个采购邮件推入队列
foreach
(
$send_buyers
as
$k
=>
&
$v
)
{
$v
[
'combined'
]
=
0
;
foreach
(
$v
[
'data'
]
as
$item
)
{
$v
[
'combined'
]
+=
$item
[
'totalPrice'
];
}
// 若不属于自营采购部,则添加联营采购管理人员
if
(
!
$perm
->
checkUserDepartment
(
$k
,
51
))
{
$joint_purchase_manager
=
Config
(
'config.joint_purchase_manager'
);
$cc_send_mail_array
=
array_merge
(
$cc_send_mail_array
,
$joint_purchase_manager
);
}
array_push
(
$cc_send_mail_array
,
$request
->
user
->
email
);
// 默认抄送给当前客服
$cc_send_mail_array
=
array_unique
(
$cc_send_mail_array
);
$v
[
'ccUser'
]
=
$cc_send_mail_array
;
$this
->
pushQueue
(
$v
);
}
// $data['toUser'] = $request->user->email; // 收件人
// $data['ccUser'] = $cc_send_mail_array;
// $data['combined'] = $info['order_info']['order_amount'];
// $data['order_amount'] = $info['order_info']['order_amount'];
// $data['date'] = date('Y-m-d',time());
// $data['id'] = $sale_name;
// $data['order_id'] = intval($id);
// $data['operator_id'] = intval($request->user->userId);
// $data['operator_event'] = '发送邮件成功,收件人邮箱:'.json_encode($data['toUser']).',抄送人邮箱:'.json_encode($data['ccUser']);
// $this->pushQueue($data);
$event
=
'发送邮件成功,收件人邮箱:'
.
json_encode
(
$to_user_array
)
.
',抄送人邮箱:'
.
json_encode
(
$cc_send_mail_array
);
// 添加操作日志
$OrderActionLogModel
=
new
OrderActionLogModel
;
$OrderActionLogModel
->
addLog
(
$id
,
$request
->
user
->
userId
,
2
,
$event
);
// 同步到ERP
$url
=
Config
(
'website.api_domain'
)
.
'order/sysiteminfo'
;
$resData
[
'order_id'
]
=
$id
;
$resData
[
'k1'
]
=
time
();
$resData
[
'k2'
]
=
md5
(
md5
(
$resData
[
'k1'
])
.
'fh6y5t4rr351d2c3bryi'
);
$temp
=
json_decode
(
curlApi
(
$url
,
$resData
,
"POST"
),
true
);
// 连接API
$this
->
pushQueue
(
$data
)
;
if
(
$temp
[
'err_code'
]
!=
0
)
return
[
'errcode'
=>
$temp
[
'err_code'
],
'errmsg'
=>
$temp
[
'err_msg'
]]
;
return
[
'errcode'
=>
0
,
'errmsg'
=>
'推送到邮件队列成功,请稍等...'
];
}
...
...
app/Http/Controllers/PermController.php
View file @
6e12e0c3
...
...
@@ -518,5 +518,15 @@
return
$user
;
}
// 检查用户是否属于某部门
public
function
checkUserDepartment
(
$userId
,
$department_id
)
{
$map
=
[];
$map
[
'userId'
]
=
$userId
;
$map
[
'department_id'
]
=
$department_id
;
return
DB
::
table
(
'user_info'
)
->
where
(
$map
)
->
select
(
'userId'
)
->
first
();
}
}
\ No newline at end of file
app/Http/routes.php
View file @
6e12e0c3
...
...
@@ -43,6 +43,7 @@ Route::group(['middleware' => 'web'], function () {
Route
::
match
([
'get'
,
'post'
],
'/sendSales/{id?}'
,
'OrderController@sendSales'
);
Route
::
post
(
'/ajaxdeletegoods'
,
'OrderController@ajaxdeletegoods'
);
Route
::
post
(
'/ajaxSaveChange'
,
'OrderController@ajaxSaveChange'
);
Route
::
post
(
'/ajaxApplyManagerAudit'
,
'OrderController@ajaxApplyManagerAudit'
);
Route
::
post
(
'/ajaxAuditPass'
,
'OrderController@ajaxAuditPass'
);
Route
::
post
(
'/ajaxReAudit'
,
'OrderController@ajaxReAudit'
);
Route
::
get
(
'/check/{id}'
,
'OrderController@check'
);
...
...
config/config.php
View file @
6e12e0c3
...
...
@@ -23,4 +23,9 @@ return [
// 'zoe@ichunt.com',
],
// 联营采购负责人
'joint_purchase_manager'
=>
[
'zty@ichunt.com'
,
],
];
public/js/order_audit.js
View file @
6e12e0c3
...
...
@@ -4,6 +4,48 @@
$
.
extend
(
$
.
lie
,
{
audit
:
{
index
:
function
()
{
// 申请主管审核
$
(
'.apply-manager-audit'
).
click
(
function
()
{
var
order_id
=
$
(
this
).
data
(
'id'
);
// 弹出提示
layer
.
open
({
area
:
[
'360px'
],
title
:
'提示信息'
,
content
:
'确定申请主管审核吗?'
,
btn
:[
'确定'
,
'取消'
],
yes
:
function
(
index
,
layero
){
$
.
ajax
({
url
:
'/ajaxApplyManagerAudit'
,
type
:
'post'
,
data
:
{
order_id
:
order_id
},
dataType
:
'json'
,
success
:
function
(
resp
)
{
if
(
resp
.
errcode
===
0
){
layer
.
msg
(
resp
.
errmsg
||
'操作成功'
);
setTimeout
(
function
(){
location
.
reload
();
},
1000
);
return
false
;
}
layer
.
alert
(
resp
.
errmsg
);
return
false
;
},
error
:
function
(
res
)
{
console
.
log
(
res
);
}
})
layer
.
msg
(
'申请中...'
,
{
icon
:
16
,
time
:
0
,
shade
:
0.3
});
// 阻止重复提交
},
btn2
:
function
(
index
,
layero
){
layer
.
close
(
index
);
}
});
})
// 主管审核
$
(
'.manager-audit'
).
click
(
function
()
{
var
order_id
=
$
(
this
).
data
(
'id'
);
...
...
resources/views/changeOrder/content.blade.php
View file @
6e12e0c3
...
...
@@ -15,7 +15,7 @@
<div
class=
"tabs-box"
>
<div
class=
"order-change-main"
>
@if (($order_info['order_goods_type'] == 1
&&
$order_info['status'] == 1
) || ($order_info['order_goods_type'] == 2
&&
$order_info['adjust_count']
<
2
))
@if (($order_info['order_goods_type'] == 1
&&
in_array($order_info['status'], [1, 2])
&&
$order_temp_info['is_manager_audit'] != 3
) || ($order_info['order_goods_type'] == 2
&&
$order_info['adjust_count']
<
2
))
<
form
id=
"checkOrderForm"
class=
"form-horizontal table-responsive"
>
<input
type=
"hidden"
name=
"auditor_role"
value=
"{{ $role }}"
>
<input
type=
"hidden"
name=
"order_sn"
value=
"{{$order_info['order_sn']}}"
>
...
...
@@ -396,7 +396,7 @@
</form>
@endif
@if (($order_info['order_goods_type'] == 1
&&
$order_info['status'] == 2
) || ($order_info['order_goods_type'] != 1
&&
$order_info['adjust_count'] == 2))
@if (($order_info['order_goods_type'] == 1
&&
$order_info['status'] == 2
&&
$order_temp_info['is_manager_audit'] == 3) || ($order_info['order_goods_type'] == 2
&&
$order_info['status'] == 2
&&
$order_info['adjust_count'] == 2))
<div
class=
"checked_section"
>
<div
class=
"checked_left"
>
<p>
交易状态:
审核通过,请联系客户及时付款!
...
...
resources/views/detail/content.blade.php
View file @
6e12e0c3
...
...
@@ -157,13 +157,18 @@
@endif
@if (in_array('check_order', $userPerms)
&&
$order_info['sale_id'])
@if (
$order_info['status'] == 1
)
@if (
isset($order_temp_info['is_manager_audit'])
&&
$order_temp_info['is_manager_audit'] != 1
&&
in_array($order_info['status'], [1, 2])
)
<a
class=
"btn btn-success"
href=
"{{URL('change', ['order_id'=>$order_info['order_id']])}}"
target=
"_blank"
>
人工审单
</a>
@elseif ($order_info['status'] == 2
&&
in_array($role, [1, 2]))
@elseif ($order_info['status'] == 2
&&
$order_temp_info['is_manager_audit'] == 3
&&
in_array($role, [1, 2]))
<a
class=
"btn btn-success re-audit"
data-id=
"{{$order_info['order_id']}}"
>
反审
</a>
@endif
@endif
<!-- 申请主管审核 -->
@if (isset($order_temp_info['is_manager_audit'])
&&
$order_temp_info['is_manager_audit'] == 1)
<a
class=
"btn btn-info apply-manager-audit"
data-id=
"{{$order_info['order_id']}}"
>
申请主管审核
</a>
@endif
<!-- 主管审核 -->
@if ($order_temp_info['is_manager_audit']
&&
in_array($role, [1, 2])
&&
$order_info['status'] == 1)
<a
class=
"btn btn-danger manager-audit"
data-id=
"{{$order_info['order_id']}}"
>
主管审核
</a>
...
...
resources/views/detail/detail_base_info.blade.php
View file @
6e12e0c3
...
...
@@ -30,12 +30,12 @@
<th>
发货状态
</th>
<th>
物流单号
</th>
<th>
京东订单编号
</th>
<th
width=
"8%"
>
自动确认收货时间
</th>
<th>
自动确认收货时间
</th>
</tr>
<tr>
<td>
{{ $order_info['order_sn'] }}
</td>
<td>
{{
$order_temp_info['is_manager_audit'] ? '待主管审核' :
Config('params.order_status')[$order_info['status']] }}
</td>
<td>
{{ Config('params.order_status')[$order_info['status']] }}
</td>
<td>
{{ $user_info['mobile'] ? $user_info['mobile'] : $user_info['email'] }}
</td>
<td>
<?php
...
...
resources/views/detail/detail_items_info.php
View file @
6e12e0c3
...
...
@@ -143,7 +143,7 @@
<td>
<!-- <button type="button" class="btn btn-success btn-xs remarks">编辑</button> -->
<?php
if
(
in_array
(
$order_info
[
'status'
],
[
1
,
2
,
3
])
&&
$v
[
'status'
]
==
1
)
{
?>
<?php
if
(
in_array
(
$order_info
[
'status'
],
[
1
,
2
,
3
,
4
])
&&
$v
[
'status'
]
==
1
)
{
?>
<button
type=
"button"
class=
"btn btn-success btn-xs edit-item"
data-id=
"
<?=
$v
[
'rec_id'
]
?>
"
data-batch=
"
<?=
$v
[
'batch'
]
?>
"
data-bid=
"
<?=
$v
[
'buyer_id'
]
?>
"
data-remarks=
"
<?=
$v
[
'remarks'
]
?>
"
>
编辑
</button>
<?php
}
?>
</td>
...
...
resources/views/detail/js.blade.php
View file @
6e12e0c3
...
...
@@ -12,7 +12,7 @@
<script
src=
"/js/md5.js"
></script>
<script
src=
"/js/layui/layui.js"
></script>
<script
src=
"/js/details.js?v=
<?=
time
()
?>
"
></script>
<script
src=
"/js/order_audit.js"
></script>
<script
src=
"/js/order_audit.js
?v=
<?=
time
()
?>
"
></script>
<script
src=
"/js/order_track.js"
></script>
<script
src=
"/js/order_cancel.js"
></script>
<script
src=
"/js/order_send_email.js"
></script>
...
...
resources/views/orderlist/content.blade.php
View file @
6e12e0c3
...
...
@@ -250,6 +250,7 @@
<th
class=
"pl30"
>
ERP单号
</th>
<th
class=
"pl30"
>
应付金额
</th>
<th
class=
"pl30"
>
订单状态
</th>
<th
class=
"pl30"
>
主管审核
</th>
<th
class=
"pl30"
>
付款类型
</th>
<th
class=
"pl30"
>
支付方式
</th>
<th
class=
"pl30"
>
业务员
</th>
...
...
@@ -289,9 +290,6 @@
</td>
<td
class=
"show-list"
>
<?php
if
(
!
empty
(
$order_extend
->
is_manager_audit
)
&&
$v
[
'status'
]
==
1
)
{
echo
'<span class="list-text-checking"><b>待主管审核</b></span>'
;
}
else
{
switch
(
$v
[
'status'
])
{
case
-
2
:
echo
'<span class="list-text-no-check"><b>审核未通过</b></span>'
;
break
;
case
-
1
:
echo
'<span class="list-text-cancel"><b>已取消</b></span>'
;
break
;
...
...
@@ -303,6 +301,21 @@
case
8
:
echo
'<span class="list-text-confirm"><b>待收货</b></span>'
;
break
;
case
10
:
echo
'<span class="list-text-success"><b>交易成功</b></span>'
;
break
;
}
?>
</td>
<td
class=
"show-list"
>
<?php
if
(
$v
[
'status'
]
>=
1
&&
$v
[
'status'
]
<
4
&&
isset
(
$order_extend
->
is_manager_audit
))
{
switch
(
$order_extend
->
is_manager_audit
)
{
case
1
:
echo
'<span class="list-text-checking"><b>未申请</b></span>'
;
break
;
case
2
:
echo
'<span class="list-text-checking"><b>待审核</b></span>'
;
break
;
case
3
:
echo
'<span class="list-text-success"><b>已审核</b></span>'
;
break
;
default
:
echo
''
;
break
;
}
}
?>
</td>
...
...
@@ -331,15 +344,20 @@
<td>
<div
class=
"btn-group btn-group-xs"
style=
"min-width: 200px;"
>
@if (in_array('check_order', $userPerms)
&&
$v['sale_id'])
@if (
$v['status'] == 1
)
@if (
isset($order_extend->is_manager_audit)
&&
$order_extend->is_manager_audit != 3
&&
in_array($v['status'], [1, 2])
)
<a
class=
"btn btn-success"
href=
"{{URL('change', ['order_id'=>$v['order_id']])}}"
target=
"_blank"
>
人工审单
</a>
@elseif ($v['status'] == 2
&&
in_array($role, [1, 2]))
@elseif ($v['status'] == 2
&&
$order_extend->is_manager_audit == 3
&&
in_array($role, [1, 2]))
<a
class=
"btn btn-success re-audit"
data-id=
"{{$v['order_id']}}"
>
反审
</a>
@endif
@endif
<!-- 主管审核 -->
@if (isset($order_extend->is_manager_audit)
&&
in_array($role, [1, 2])
&&
$v['status'] == 1)
<!-- 申请主管审核 -->
@if (isset($order_extend->is_manager_audit)
&&
$order_extend->is_manager_audit == 1)
<a
class=
"btn btn-info apply-manager-audit"
data-id=
"{{$v['order_id']}}"
>
申请主管审核
</a>
@endif
<!-- 主管审核 (待付款且待主管审核 || 已付款且主管未审核) && 主管角色 && 未同步 -->
@if (isset($order_extend->is_manager_audit)
&&
(($v['status'] == 2
&&
$order_extend->is_manager_audit == 2) || ($v['status'] > 2
&&
$order_extend->is_manager_audit != 3))
&&
in_array($role, [1, 2])
&&
empty($order_extend->erp_sn))
<a
class=
"btn btn-danger manager-audit"
data-id=
"{{$v['order_id']}}"
>
主管审核
</a>
@endif
...
...
resources/views/orderlist/js.blade.php
View file @
6e12e0c3
...
...
@@ -11,7 +11,7 @@
<script
src=
"/js/common.js"
></script>
<script
src=
"/js/layui/layui.js"
></script>
<script
src=
"/js/list.js?v=
<?=
time
()
?>
"
></script>
<script
src=
"/js/order_audit.js"
></script>
<script
src=
"/js/order_audit.js
?v=
<?=
time
()
?>
"
></script>
<script
src=
"/js/order_track.js"
></script>
<script
src=
"/js/order_cancel.js"
></script>
<script
src=
"/js/order_send_email.js"
></script>
...
...
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