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
9975570c
authored
Jun 28, 2021
by
朱继来
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' of
http://119.23.72.7/zhujilai/Order
into zjl_erp_address_20210622
parents
6e4d47fa
5fc278d2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
165 additions
and
8 deletions
app/Http/Controllers/ApiController.php
app/Http/Controllers/OrderController.php
app/Http/Controllers/PermController.php
public/js/list.js
resources/views/detail/detail_items_info.php
resources/views/orderlist/content.blade.php
app/Http/Controllers/ApiController.php
View file @
9975570c
...
@@ -722,4 +722,15 @@ class ApiController extends Controller
...
@@ -722,4 +722,15 @@ class ApiController extends Controller
$this
->
Export
(
$temp
[
'err_code'
],
$temp
[
'err_msg'
],
$delivery_place
);
$this
->
Export
(
$temp
[
'err_code'
],
$temp
[
'err_msg'
],
$delivery_place
);
}
}
// 解锁审单
public
function
unlock_check
(
$request
)
{
$order_id
=
$request
->
input
(
'order_id'
);
$key
=
'changeOrder_'
.
$order_id
;
Redis
::
del
(
$key
);
$this
->
Export
(
0
,
'成功'
);
}
}
}
app/Http/Controllers/OrderController.php
View file @
9975570c
...
@@ -355,6 +355,14 @@ function getOrderServiceNum($order_id, $erp_rec_id, $status=1, $field='adjust_nu
...
@@ -355,6 +355,14 @@ function getOrderServiceNum($order_id, $erp_rec_id, $status=1, $field='adjust_nu
->
sum
(
'i.'
.
$field
);
->
sum
(
'i.'
.
$field
);
}
}
// 检查是否锁定审单
function
isLockCheck
(
$order_id
)
{
$key
=
'changeOrder_'
.
$order_id
;
$redis
=
Redis
::
connection
(
'read'
);
return
$redis
->
get
(
$key
);
}
Class
OrderController
extends
Controller
Class
OrderController
extends
Controller
{
{
...
@@ -819,6 +827,22 @@ Class OrderController extends Controller
...
@@ -819,6 +827,22 @@ Class OrderController extends Controller
{
{
$info
=
$this
->
orderDetail
(
$request
,
$id
);
$info
=
$this
->
orderDetail
(
$request
,
$id
);
// 设置页面缓存,只允许单人操作审单
$key
=
'changeOrder_'
.
$id
;
$redis
=
Redis
::
connection
(
'read'
);
$val
=
$redis
->
get
(
$key
);
if
(
!
$val
)
{
Redis
::
set
(
$key
,
$request
->
user
->
userId
);
}
// 校验页面缓存用户与当前登录用户是否一致,不一致则阻止进入
if
(
$val
&&
$val
!=
$request
->
user
->
userId
)
{
$CmsModel
=
new
CmsModel
;
$name
=
$CmsModel
->
getUserName
(
$val
);
return
redirect
(
'/prompt'
)
->
with
([
'message'
=>
'此订单已被'
.
$name
.
'锁定,不能编辑审单!'
,
'url'
=>
'/list'
,
'jumpTime'
=>
3
,
'status'
=>
false
]);
}
$this
->
pageHeader
(
$request
,
$info
,
'人工审单'
,
[
"title"
=>
'人工审单'
,
"href"
=>
'#'
]);
$this
->
pageHeader
(
$request
,
$info
,
'人工审单'
,
[
"title"
=>
'人工审单'
,
"href"
=>
'#'
]);
if
(
$info
[
'order_info'
][
'order_goods_type'
]
==
2
&&
in_array
(
$info
[
'order_info'
][
'order_type'
],
[
1
,
3
]))
{
// 平台自营订单
if
(
$info
[
'order_info'
][
'order_goods_type'
]
==
2
&&
in_array
(
$info
[
'order_info'
][
'order_type'
],
[
1
,
3
]))
{
// 平台自营订单
...
@@ -884,10 +908,43 @@ Class OrderController extends Controller
...
@@ -884,10 +908,43 @@ Class OrderController extends Controller
public
function
ajaxSaveChange
(
Request
$request
)
public
function
ajaxSaveChange
(
Request
$request
)
{
{
if
(
$request
->
isMethod
(
'post'
)){
if
(
$request
->
isMethod
(
'post'
)){
$order_id
=
$request
->
input
(
'order_id'
,
''
);
$order_id
=
$request
->
input
(
'order_id'
,
''
);
if
(
!
$order_id
)
return
array
(
'errcode'
=>
Error
::
E_PARAM
,
'errmsg'
=>
'订单参数有误!'
);
if
(
!
$order_id
)
return
array
(
'errcode'
=>
Error
::
E_PARAM
,
'errmsg'
=>
'订单参数有误!'
);
$key
=
'changeOrder_'
.
$order_id
;
$redis
=
Redis
::
connection
(
'read'
);
$val
=
$redis
->
get
(
$key
);
// 校验页面缓存用户与当前登录用户是否一致,不一致则阻止进入
if
(
$val
&&
$val
!=
$request
->
user
->
userId
)
{
$CmsModel
=
new
CmsModel
;
$name
=
$CmsModel
->
getUserName
(
$val
);
return
[
'errcode'
=>-
1
,
'errmsg'
=>
'此订单已被'
.
$name
.
'锁定,不能提交审单!'
];
}
$perm
=
new
PermController
;
$OrderModel
=
new
OrderModel
;
$relation_id
=
[];
$order_sale_id
=
$OrderModel
->
where
(
'order_id'
,
$order_id
)
->
value
(
'sale_id'
);
// 获取当前订单销售
array_push
(
$relation_id
,
$order_sale_id
);
$manager
=
$perm
->
getSuperiorManager
(
$order_sale_id
,
'销售经理'
);
// 获取销售主管
if
(
$manager
)
{
$manager_id
=
array_column
(
$manager
,
'userId'
);
$relation_id
=
array_merge
(
$relation_id
,
$manager_id
);
}
$director
=
$perm
->
getSuperiorDirector
(
$order_sale_id
,
'销售总监'
);
// 获取销售总监
if
(
$director
)
{
$director_id
=
array_column
(
$director
,
'userId'
);
$relation_id
=
array_merge
(
$relation_id
,
$director_id
);
}
// 校验此是否为此订单销售或者对应主管,总监
if
(
!
in_array
(
$request
->
user
->
userId
,
$relation_id
))
return
[
'errcode'
=>-
1
,
'errmsg'
=>
'你没有权限操作此销售订单!'
];
if
(
!
$request
->
input
(
'pay_time_limit'
))
{
if
(
!
$request
->
input
(
'pay_time_limit'
))
{
$payTime
=
$request
->
input
(
'payTime'
,
''
);
$payTime
=
$request
->
input
(
'payTime'
,
''
);
$payTimeOther
=
$request
->
input
(
'payTimeOther'
,
''
);
$payTimeOther
=
$request
->
input
(
'payTimeOther'
,
''
);
...
...
app/Http/Controllers/PermController.php
View file @
9975570c
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
use
App\Http\Controllers\Controller
;
use
App\Http\Controllers\Controller
;
use
DB
;
use
DB
;
use
Illuminate\Support\Facades\Redis
;
use
Illuminate\Support\Facades\Redis
;
use
App\Model\CmsModel
;
class
PermController
extends
Controller
class
PermController
extends
Controller
{
{
...
@@ -393,6 +394,47 @@
...
@@ -393,6 +394,47 @@
return
$data
;
return
$data
;
}
}
// 通过职位名称获取指定销售对应的上级主管 (本地和外网的职位ID不一致,最好使用职位名称)
public
function
getSuperiorManager
(
$userId
,
$position_name
,
$field
=
'userId'
)
{
$CmsModel
=
new
CmsModel
;
$department_id
=
$CmsModel
->
where
(
'userId'
,
$userId
)
->
value
(
'department_id'
);
// 获取当前所在部门
if
(
!
$department_id
)
return
false
;
$data
=
$CmsModel
->
where
(
'department_id'
,
$department_id
)
->
where
(
'position_name'
,
'like'
,
'%'
.
$position_name
)
->
select
(
$field
)
->
get
()
->
toArray
();
if
(
empty
(
$data
))
return
false
;
return
$data
;
}
// 通过职位名称获取指定销售对应的上级总监
public
function
getSuperiorDirector
(
$userId
,
$position_name
,
$field
=
'userId'
)
{
$CmsModel
=
new
CmsModel
;
$department_id
=
$CmsModel
->
where
(
'userId'
,
$userId
)
->
value
(
'department_id'
);
// 获取当前所在部门
if
(
!
$department_id
)
return
false
;
// 获取上级部门ID
$parent_id
=
DB
::
table
(
'user_department'
)
->
where
(
'department_id'
,
$department_id
)
->
value
(
'parent_id'
);
$data
=
$CmsModel
->
where
(
'department_id'
,
$parent_id
)
->
where
(
'position_name'
,
'like'
,
'%'
.
$position_name
)
->
select
(
$field
)
->
get
()
->
toArray
();
if
(
empty
(
$data
))
return
false
;
return
$data
;
}
/* 订单系统权限调整 --- 20200511 */
/* 订单系统权限调整 --- 20200511 */
// 获取部门人员
// 获取部门人员
public
function
getUserByDepartmentId
(
$department_id
,
$status
=
''
,
$filter
=
''
)
public
function
getUserByDepartmentId
(
$department_id
,
$status
=
''
,
$filter
=
''
)
...
...
public/js/list.js
View file @
9975570c
...
@@ -613,7 +613,7 @@
...
@@ -613,7 +613,7 @@
var
order_id
=
$
(
this
).
data
(
'oid'
);
var
order_id
=
$
(
this
).
data
(
'oid'
);
layer
.
open
({
layer
.
open
({
area
:
[
'300px'
],
area
:
[
'300px'
],
title
:
'同步ERP'
,
title
:
'同步ERP'
,
content
:
'确定同步到ERP吗?'
,
content
:
'确定同步到ERP吗?'
,
btn
:[
'确认'
,
'取消'
],
btn
:[
'确认'
,
'取消'
],
...
@@ -641,6 +641,43 @@
...
@@ -641,6 +641,43 @@
})
})
})
})
// 解锁审单
$
(
'.unlock_check'
).
click
(
function
()
{
var
order_id
=
$
(
this
).
data
(
'oid'
);
layer
.
open
({
area
:
[
'300px'
],
title
:
'解锁审单'
,
content
:
'确定解锁该审单吗?'
,
btn
:[
'确认'
,
'取消'
],
btn1
:
function
(
index
)
{
$
.
ajax
({
url
:
'/api/unlock_check'
,
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
.
msg
(
resp
.
errmsg
);
}
})
layer
.
msg
(
'提交中...'
,
{
icon
:
16
,
time
:
0
,
shade
:
0.3
});
},
btn2
:
function
(
index
)
{
layer
.
close
(
index
)
}
})
})
},
},
}
}
...
...
resources/views/detail/detail_items_info.php
View file @
9975570c
...
@@ -60,6 +60,8 @@
...
@@ -60,6 +60,8 @@
<?php
if
(
$order_info
[
'order_goods_type'
]
==
1
)
{
?>
<?php
if
(
$order_info
[
'order_goods_type'
]
==
1
)
{
?>
<th>
生产跟踪
</th>
<th>
生产跟踪
</th>
<th>
包装
</th>
<th>
内部编码
</th>
<?php
}
?>
<?php
}
?>
<th>
商品备注
</th>
<th>
商品备注
</th>
...
@@ -142,6 +144,8 @@
...
@@ -142,6 +144,8 @@
<?php
if
(
$order_info
[
'order_goods_type'
]
==
1
)
{
?>
<?php
if
(
$order_info
[
'order_goods_type'
]
==
1
)
{
?>
<td><a
class=
"order-track"
data-rid=
"
<?=
$v
[
'rec_id'
]
?>
"
>
<?=
App\Http\Controllers\getLastTrack
(
$v
[
'rec_id'
])
?>
</a></td>
<td><a
class=
"order-track"
data-rid=
"
<?=
$v
[
'rec_id'
]
?>
"
>
<?=
App\Http\Controllers\getLastTrack
(
$v
[
'rec_id'
])
?>
</a></td>
<td>
<?=
$v
[
'goods_packing'
]
?>
</td>
<td>
<?=
$v
[
'material_number'
]
?>
</td>
<?php
}
?>
<?php
}
?>
<td>
<?=
!
empty
(
$v
[
'remarks'
])
?
$v
[
'remarks'
]
:
''
?>
</td>
<td>
<?=
!
empty
(
$v
[
'remarks'
])
?
$v
[
'remarks'
]
:
''
?>
</td>
...
@@ -177,36 +181,36 @@
...
@@ -177,36 +181,36 @@
<?php
if
(
$order_info
[
'order_remark'
])
{
?>
<?php
if
(
$order_info
[
'order_remark'
])
{
?>
<tr>
<tr>
<td>
订单备注信息:
</td>
<td>
订单备注信息:
</td>
<td
colspan=
"2
0
"
>
<?=
$order_info
[
'order_remark'
]
?>
</td>
<td
colspan=
"2
4
"
>
<?=
$order_info
[
'order_remark'
]
?>
</td>
</tr>
</tr>
<?php
}
?>
<?php
}
?>
<?php
if
(
$order_temp_info
[
'kefu_remark'
])
{
?>
<?php
if
(
$order_temp_info
[
'kefu_remark'
])
{
?>
<tr>
<tr>
<td>
客服备注信息:
</td>
<td>
客服备注信息:
</td>
<td
colspan=
"2
0
"
>
<?=
$order_temp_info
[
'kefu_remark'
]
?>
</td>
<td
colspan=
"2
4
"
>
<?=
$order_temp_info
[
'kefu_remark'
]
?>
</td>
</tr>
</tr>
<?php
}
?>
<?php
}
?>
<?php
if
(
$order_info
[
'order_goods_type'
]
==
2
&&
$order_temp_info
[
'business_type'
]
==
1
)
{
?>
<?php
if
(
$order_info
[
'order_goods_type'
]
==
2
&&
$order_temp_info
[
'business_type'
]
==
1
)
{
?>
<tr>
<tr>
<td>
项目需求描述:
</td>
<td>
项目需求描述:
</td>
<td
colspan=
"2
0
"
>
<?=
$order_temp_info
[
'sample_demand_desc'
]
?>
</td>
<td
colspan=
"2
4
"
>
<?=
$order_temp_info
[
'sample_demand_desc'
]
?>
</td>
</tr>
</tr>
<?php
}
?>
<?php
}
?>
<?php
if
(
$order_info
[
'order_goods_type'
]
==
1
&&
$order_temp_info
[
'business_type'
]
==
1
)
{
?>
<?php
if
(
$order_info
[
'order_goods_type'
]
==
1
&&
$order_temp_info
[
'business_type'
]
==
1
)
{
?>
<tr>
<tr>
<td>
项目名称:
</td>
<td>
项目名称:
</td>
<td
colspan=
"2
0
"
>
<?=
$order_temp_info
[
'sample_project_name'
]
?>
</td>
<td
colspan=
"2
4
"
>
<?=
$order_temp_info
[
'sample_project_name'
]
?>
</td>
</tr>
</tr>
<tr>
<tr>
<td>
项目阶段:
</td>
<td>
项目阶段:
</td>
<td
colspan=
"2
0
"
>
<?=
$order_temp_info
[
'sample_project_stage'
]
?>
</td>
<td
colspan=
"2
4
"
>
<?=
$order_temp_info
[
'sample_project_stage'
]
?>
</td>
</tr>
</tr>
<tr>
<tr>
<td>
申请理由:
</td>
<td>
申请理由:
</td>
<td
colspan=
"2
0
"
>
<?=
$order_temp_info
[
'sample_project_reason'
]
?>
</td>
<td
colspan=
"2
4
"
>
<?=
$order_temp_info
[
'sample_project_reason'
]
?>
</td>
</tr>
</tr>
<?php
}
?>
<?php
}
?>
</tfoot>
</tfoot>
...
...
resources/views/orderlist/content.blade.php
View file @
9975570c
...
@@ -452,6 +452,12 @@
...
@@ -452,6 +452,12 @@
@if (isset($order_extend)
&&
empty($order_extend->erp_sn)
&&
$order_extend->is_manager_audit == 3)
@if (isset($order_extend)
&&
empty($order_extend->erp_sn)
&&
$order_extend->is_manager_audit == 3)
<a
class=
"btn btn-info syn_erp"
data-oid=
"{{$v['order_id']}}"
>
同步ERP
</a>
<a
class=
"btn btn-info syn_erp"
data-oid=
"{{$v['order_id']}}"
>
同步ERP
</a>
@endif
@endif
<!-- 解锁审单 -->
<?php
$is_lock_check
=
App\Http\Controllers\isLockCheck
(
$v
[
'order_id'
]);
?>
@if (in_array($role, [1, 2])
&&
$is_lock_check
&&
in_array($v['status'], [1, 2])
&&
$order_extend->is_manager_audit != 3)
<a
class=
"btn btn-danger unlock_check"
data-oid=
"{{$v['order_id']}}"
>
解锁审单
</a>
@endif
</div>
</div>
</td>
</td>
</tr>
</tr>
...
...
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