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
e8ab2327
authored
Nov 10, 2018
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
1. 列表响应式调整;
2. 权限调整;
parent
70b73aed
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
89 additions
and
220 deletions
app/Http/Controllers/OrderController.php
app/Http/Controllers/PermController.php
config/perm.php
public/css/detail.css
resources/views/detail/content.blade.php
resources/views/erpOrder/content.blade.php
resources/views/orderlist/content.blade.php
resources/views/selfOrder/content.blade.php
app/Http/Controllers/OrderController.php
View file @
e8ab2327
...
...
@@ -355,16 +355,16 @@ Class OrderController extends Controller
$perm
=
new
PermController
;
// 获取权限菜单
if
(
$request
->
user
->
email
!=
'admin@ichunt.com'
&&
$request
->
user
->
userId
!=
1000
)
$menus
=
$perm
->
getPermMenu
(
$request
,
$menus
);
// 用户权限
$userPerms
=
$perm
->
handlePerms
(
$request
,
$request
->
user
->
userId
);
// 用户角色
$role
=
$perm
->
getUserRole
(
$request
);
// 获取权限菜单
if
(
$role
!=
1
)
{
$menus
=
$perm
->
getPermMenu
(
$menus
,
$request
->
user
->
userId
);
}
$userPerms
=
$perm
->
getUserAllPerms
(
$request
->
user
->
userId
,
$role
);
// 用户权限
$data
=
[
'header'
=>
$request
->
user
->
header
,
'uri'
=>
$uri
,
...
...
@@ -382,6 +382,7 @@ Class OrderController extends Controller
public
function
orderList
(
Request
$request
)
{
$info
=
$this
->
getOrderInfo
(
$request
,
1
);
$info
[
'title'
]
=
'平台订单'
;
// 若为京东自营、自营客服角色,则跳转到自营列表
if
(
in_array
(
$info
[
'role'
],
[
6
,
7
]))
{
...
...
app/Http/Controllers/PermController.php
View file @
e8ab2327
...
...
@@ -113,207 +113,92 @@
return
$roleUsers
;
}
// 获取权限系统用户的所有权限
public
function
getUserPerms
(
Request
$request
,
$uid
)
// 获取权限菜单
public
function
getPermMenu
(
$menus
,
$user_id
)
{
$userPerms
=
$this
->
getUserAllPerms
(
$user_id
);
if
(
$userPerms
)
{
return
$this
->
handleMenus
(
$menus
,
$userPerms
);
}
return
false
;
}
// 获取用户所有权限
public
function
getUserAllPerms
(
$user_id
,
$role
=
0
)
{
// 根据域名查询系统业务ID
$domain
=
Config
(
'website.order_url'
);
$business
=
DB
::
table
(
't_business_config'
)
->
where
(
'url'
,
$domain
)
->
first
();
if
(
$
business
)
{
if
(
$
role
!=
1
)
{
$bid
=
$business
->
bid
;
// 权限系统配置的管理帐号
$adminAccount
=
json_decode
(
$business
->
admin
,
true
);
$configs
=
Config
(
'perm'
);
// 若是管理员,则返回Config所有权限
if
(
in_array
(
$request
->
user
->
email
,
$adminAccount
))
{
return
$configs
;
}
// 获取用户权限
$perms
=
json_decode
(
$this
->
curlPermApi
(
$uid
,
$bid
),
true
);
if
(
$perms
[
'retcode'
]
==
0
)
{
$userPerms
=
$perms
[
'data'
][
'perms'
];
$url
=
Config
(
'website.perm_api'
)
.
$user_id
.
'/'
.
$bid
;
$matchPerms
=
$this
->
matchUserPerms
(
$configs
,
$userPerms
);
$userPerms
=
json_decode
(
curlApi
(
$url
),
true
);
return
$matchPerms
;
if
(
$userPerms
&&
$userPerms
[
'retcode'
]
==
0
)
{
return
$userPerms
[
'data'
][
'perms'
];
}
}
else
{
// 获取管理员所有权限
return
$this
->
getAllPerms
(
json_decode
(
$business
->
configs
,
true
));
}
return
false
;
}
//
处理用户权限值
public
function
handlePerms
(
Request
$request
,
$uid
)
//
获取系统配置权限
public
function
getAllPerms
(
$configs
)
{
$perms
=
$this
->
getUserPerms
(
$request
,
$uid
)
;
$perms
=
[]
;
$userPerms
=
array
();
foreach
(
$configs
as
$k
=>
$v
)
{
$perm_a
=
[];
$perm_b
=
[];
foreach
(
$perms
as
$perm
)
{
if
(
is_array
(
$perm
))
{
foreach
(
$perm
as
$val
)
{
if
(
is_array
(
$val
))
{
foreach
(
$val
as
$v
)
{
$userPerms
[]
=
$v
;
}
}
}
}
}
return
$userPerms
;
}
/**
* 请求权限系统接口
* @param [Integer] $uid [用户ID]
* @param [Integer] $bid [业务ID]
* @return [Json] 返回权限数据
*/
public
function
curlPermApi
(
$uid
,
$bid
)
{
$url
=
Config
(
'website.perm_api'
)
.
$uid
.
'/'
.
$bid
;
$ch
=
curl_init
();
curl_setopt
(
$ch
,
CURLOPT_URL
,
$url
);
curl_setopt
(
$ch
,
CURLOPT_RETURNTRANSFER
,
1
);
curl_setopt
(
$ch
,
CURLOPT_HEADER
,
0
);
$result
=
curl_exec
(
$ch
);
curl_close
(
$ch
);
return
$result
;
}
/**
* 匹配用户在菜单的权限
* @param [Array] $config [配置菜单权限]
* @param [Array] $perms [用户所有权限]
* @return [Json]
*/
public
function
matchUserPerms
(
$configs
,
$perms
)
{
foreach
(
$configs
as
$key
=>
$config
)
{
if
(
is_array
(
$config
))
{
foreach
(
$config
as
$k
=>
$v
)
{
if
(
is_array
(
$v
))
{
$menu
[
$key
][
$k
]
=
array_intersect
(
$v
,
$perms
);
continue
;
if
(
isset
(
$v
[
'childs'
])
&&
count
(
$v
[
'childs'
])
>
0
)
{
$perm_b
=
$this
->
getAllPerms
(
$v
[
'childs'
]);
}
else
{
if
(
in_array
(
$v
,
$perms
))
{
$menu
[
$key
][
$k
]
=
$v
;
}
continue
;
}
}
$perm_a
[]
=
$v
[
'permId'
];
}
continue
;
$perms
=
array_merge
(
$perms
,
array_merge
(
$perm_a
,
$perm_b
))
;
}
return
$
menu
;
return
$
perms
;
}
/**
* 获取权限菜单
* @param [Array] $menus [数据表菜单]
* @return [Array] 返回处理后的菜单
*/
public
function
getPermMenu
(
Request
$request
,
$menus
)
// 处理菜单
public
function
handleMenus
(
$menus
,
$perms
)
{
$menuPerm
=
$this
->
getUserPerms
(
$request
,
$request
->
user
->
userId
);
$menuData
=
array
();
$newMenu
=
array
();
$matchMenu
=
array
();
if
(
$menuPerm
)
{
// 处理返回的菜单---简化
foreach
(
$menuPerm
as
$key
=>
$val
)
{
if
(
is_array
(
$val
))
{
// 处理二级菜单内容
foreach
(
$val
as
$k
=>
$v
)
{
if
(
is_array
(
$v
))
{
foreach
(
$v
as
$k1
=>
$v1
)
{
if
(
preg_match
(
'/_check$/'
,
$v1
))
{
$menuData
[
$key
][]
=
$k
;
continue
;
}
}
foreach
(
$menus
as
$k
=>
$v
)
{
if
(
strlen
(
$v
->
href
)
>
2
)
{
if
(
preg_match
(
'/\/web\//'
,
$v
->
href
))
{
$permId
=
str_replace
(
'/web/'
,
''
,
$v
->
href
);
}
else
{
if
(
strpos
(
$v
,
'_check'
)
!==
false
)
{
$menuData
[
$key
][]
=
$k
;
continue
;
}
}
}
}
$permId
=
str_replace
(
'/'
,
''
,
$v
->
href
);
}
// 匹配菜单
if
(
$menus
)
{
foreach
(
$menus
as
$k
=>
$v
)
{
// 遍历简化过的菜单
foreach
(
$menuData
as
$pk
=>
$pv
)
{
// 匹配标题
if
(
$pk
==
$v
->
title
)
{
// 遍历对应标题下的子项
foreach
(
$pv
as
$pk1
=>
$pv1
)
{
if
(
is_array
(
$v
->
childs
)
&&
!
empty
(
$v
->
childs
))
{
foreach
(
$v
->
childs
as
$k1
=>
$v1
)
{
if
(
$pv1
==
$v1
->
title
)
{
$childs
[]
=
$v1
;
$object
=
(
object
)[
'title'
=>
$v
->
title
,
'href'
=>
$v
->
href
,
'class'
=>
$v
->
class
,
'childs'
=>
$childs
,
];
$matchMenu
[
$k
]
=
$object
;
// 查看菜单权限
$permId
=
$permId
.
'_check'
;
continue
;
}
}
}
else
{
$object
=
(
object
)[
'title'
=>
$v
->
title
,
'href'
=>
$v
->
href
,
'class'
=>
$v
->
class
,
'childs'
=>
$v
->
childs
,
];
$matchMenu
[
$k
]
=
$object
;
continue
;
if
(
!
in_array
(
$permId
,
$perms
))
{
unset
(
$menus
[
$k
]);
}
}
unset
(
$childs
);
// 清除内容
}
}
}
}
if
(
count
(
$v
->
childs
)
>
0
)
{
$menus
[
$k
]
->
childs
=
array_values
(
$this
->
handleMenus
(
$v
->
childs
,
$perms
));
// 重新组合数组
if
(
$matchMenu
)
{
foreach
(
$matchMenu
as
$v
)
{
$newMenu
[]
=
$v
;
if
(
empty
(
$menus
[
$k
]
->
childs
))
{
unset
(
$menus
[
$k
]);
}
}
}
return
$newMenu
;
return
array_values
(
$menus
)
;
}
}
\ No newline at end of file
config/perm.php
deleted
100644 → 0
View file @
70b73aed
<?php
return
[
// 菜单权限
'联营订单'
=>
[
'平台订单'
=>
[
'orderlist_check'
,
'export'
,
'cancel_order'
,
'check_account'
,
'order_send'
,
'update_address'
,
'update_invoice'
,
'check_test_order'
,
'check_order'
,
'download_contract'
,
'send_salesman'
],
'ERP订单'
=>
[
'erp_order_check'
],
'线上用户下单'
=>
[
'add_order_check'
],
],
'自营订单'
=>
[
'订单列表'
=>
[
'self_order_check'
,
'self_order_export'
,
'self_order_cancel'
,
'self_order_express'
,
'self_order_invoice_express'
,
'self_order_update_address'
,
'self_order_update_invoice'
,
'self_check_test_order'
,
'self_order_download_contract'
,
'self_check_pay'
,
'self_check_order'
],
'快递配置'
=>
[
'self_order_express_set_check'
],
'线上用户下单'
=>
[
'add_online_check'
],
'内部采购下单'
=>
[
'add_offline_check'
,
'add_offline_audit'
],
],
'订单统计'
=>
[
'联营订单统计'
=>
[
'order_count_check'
],
'自营订单统计'
=>
[
'self_order_count_check'
],
],
'账期管理'
=>
[
'申请列表'
=>
[
'order_account_apply_check'
],
],
];
\ No newline at end of file
public/css/detail.css
View file @
e8ab2327
...
...
@@ -197,3 +197,19 @@ li {
cursor
:
pointer
;
}
.show-list-info
{
float
:
left
;
width
:
55%
;
}
/* 响应式 */
@media
screen
and
(
max-width
:
500px
)
{
.Wdate
{
width
:
110px
!important
;
}
.btn-group
{
width
:
220px
;
}
.search-btn
{
margin-bottom
:
20px
!important
;
}
.show-list-info
{
display
:
none
;
}
}
resources/views/detail/content.blade.php
View file @
e8ab2327
...
...
@@ -17,7 +17,7 @@
$action_name
=
explode
(
'@'
,
$route
)[
1
];
?>
<input
type=
"hidden"
class=
"action_type"
value=
"{{$action_name}}"
>
<div
class=
"tabs-box"
>
<div
class=
"tabs-box
table-responsive
"
>
<table
class=
"table table-bordered order-express"
>
<?php
$currency
=
$order_info
[
'currency'
]
==
2
?
'$'
:
'¥'
;
...
...
@@ -397,7 +397,7 @@
@endif
</div>
<div
class=
"tabs-box goods-price"
>
<div
class=
"tabs-box goods-price
table-responsive
"
>
<table
class=
"table"
>
<thead>
<tr
class=
"caption"
>
...
...
@@ -465,7 +465,7 @@
</table>
</div>
<div
class=
"tabs-box order-total"
>
<div
class=
"tabs-box order-total
table-responsive
"
>
<div>
<table>
<tr>
...
...
@@ -515,7 +515,7 @@
<?php
$client_source
=
App\Http\Controllers\clientSource
(
$order_info
[
'user_id'
]);
?>
@if (!empty($client_source) || $order_info['status'] == -1)
<div
class=
"tabs-box"
>
<div
class=
"tabs-box
table-responsive
"
>
<table
class=
"table table-bordered table-hover"
>
@if (!empty($client_source))
<tr>
...
...
@@ -650,7 +650,7 @@
@if (!empty($order_shipping_info['info']) || !empty($order_shipping_inside))
<p>
物流信息
</p>
<div
class=
"tabs-box"
>
<div
class=
"tabs-box
table-responsive
"
>
<table
class=
"table table-bordered table-hover"
>
<thead>
<tr>
...
...
@@ -711,7 +711,7 @@
@if (!empty($actionLog))
<p>
操作记录
</p>
<div
class=
"tabs-box"
>
<div
class=
"tabs-box
table-responsive
"
>
<table
class=
"table table-bordered table-hover"
>
<thead>
<tr>
...
...
resources/views/erpOrder/content.blade.php
View file @
e8ab2327
...
...
@@ -25,7 +25,7 @@
</dl>
<dl>
<dt>
创建日期:
</dt>
<dd>
<dd
style=
"width:auto !important;"
>
<input
type=
"text"
name=
"time_start"
value=
"{{ !empty($condition['time_start']) ? date('Y/m/d', $condition['time_start']) : '' }}"
class=
"Wdate "
onfocus=
"WdatePicker({dateFmt:'yyyy/MM/dd'})"
placeholder=
"开始时间"
autocomplete=
"off"
/>
</dd>
<dd>
...
...
@@ -110,7 +110,7 @@
</div>
</div>
<div
class=
"row-fluid"
>
<div
class=
"row-fluid
table-responsive
"
>
<table
class=
"table table-hover"
>
<thead>
<tr>
...
...
@@ -295,7 +295,7 @@
</div>
<div
class=
"row-fluid pagination"
>
@if ($username != 'vpadmin@ichunt.com')
<span>
<span
class=
"show-list-info"
>
共{{$count ? $count : 0}}单,
应付金额 ¥{{$pay_count['rmb_count'] ? $pay_count['rmb_count'] : 0}}, ${{$pay_count['usd_count'] ? $pay_count['usd_count'] : 0}},
实收金额 ¥{{$pay_count['rmb_pay'] ? $pay_count['rmb_pay'] : 0}},
...
...
resources/views/orderlist/content.blade.php
View file @
e8ab2327
...
...
@@ -25,7 +25,7 @@
</dl>
<dl>
<dt>
创建日期:
</dt>
<dd>
<dd
style=
"width:auto !important;"
>
<input
type=
"text"
name=
"time_start"
value=
"{{ !empty($condition['time_start']) ? date('Y/m/d', $condition['time_start']) : '' }}"
class=
"Wdate "
onfocus=
"WdatePicker({dateFmt:'yyyy/MM/dd'})"
placeholder=
"开始时间"
autocomplete=
"off"
/>
</dd>
<dd>
...
...
@@ -177,7 +177,7 @@
<td
width=
"15%"
>
<dl>
<dt>
<dt
class=
"search-btn"
>
<button
class=
"nbtn searchOrder"
>
搜索
</button>
</dt>
...
...
@@ -195,7 +195,7 @@
</div>
</div>
<div
class=
"row-fluid"
>
<div
class=
"row-fluid
table-responsive
"
>
<table
class=
"table table-hover"
>
<thead>
<tr>
...
...
@@ -418,7 +418,7 @@
</div>
<div
class=
"row-fluid pagination"
>
@if ($username != 'vpadmin@ichunt.com')
<span
style=
"float: left; width: 55%;
"
>
<span
class=
"show-list-info
"
>
共{{$count ? $count : 0}}单,
{{$paid_order_count}}单已付款(包含预付款),
下单用户数为{{$user_count}}人,
...
...
resources/views/selfOrder/content.blade.php
View file @
e8ab2327
...
...
@@ -26,7 +26,7 @@
</dl>
<dl>
<dt>
创建日期:
</dt>
<dd>
<dd
style=
"width:auto !important;"
>
<input
type=
"text"
name=
"time_start"
value=
"{{ !empty($condition['time_start']) ? date('Y/m/d', $condition['time_start']) : '' }}"
class=
"Wdate "
onfocus=
"WdatePicker({dateFmt:'yyyy/MM/dd'})"
placeholder=
"开始时间"
autocomplete=
"off"
/>
</dd>
<dd>
...
...
@@ -158,7 +158,7 @@
<td
width=
"15%"
>
<dl>
<dt>
<dt
class=
"search-btn"
>
<button
class=
"nbtn search_self_order"
>
搜索
</button>
</dt>
...
...
@@ -175,7 +175,7 @@
</div>
</div>
<div
class=
"row-fluid"
>
<div
class=
"row-fluid
table-responsive
"
>
<table
class=
"table table-hover"
>
<thead>
<tr>
...
...
@@ -348,7 +348,7 @@
</table>
</div>
<div
class=
"row-fluid pagination"
>
<span
style=
"float: left; width: 55%;
"
>
<span
class=
"show-list-info
"
>
共{{$count ? $count : 0}}单,
{{$paid_order_count}}单已付款(包含预付款),
下单用户数为{{$user_count}}人,
...
...
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