Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
data-collect
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
汪伟伟
data-collect
Commits
bba7cb61
Commit
bba7cb61
authored
Jan 15, 2024
by
汪伟伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
bb38f148
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
178 additions
and
49 deletions
+178
-49
app/Admin/Controllers/TaskReceiveController.php
+5
-5
app/Admin/Controllers/TasksApproveController.php
+1
-10
app/Admin/Controllers/TasksOrderController.php
+57
-34
app/Admin/Extensions/Tools/ReturnBack.php
+51
-0
app/Admin/Extensions/Tools/UserConfirmOrder.php
+64
-0
No files found.
app/Admin/Controllers/TaskReceiveController.php
View file @
bba7cb61
...
...
@@ -28,12 +28,12 @@ class TaskReceiveController extends AdminController
// $tab->add('选项卡1', view('...'));
$user
=
Admin
::
user
();
if
(
$user
->
is_admin
){
$tab
->
add
(
'全部任务'
,
$this
->
getData
(
-
1
),
true
,
'
a
'
);
}
;
$tab
->
add
(
'待完成任务'
,
$this
->
getData
(
0
),
true
,
'
b
'
);
$tab
->
add
(
'已完成任务'
,
$this
->
getData
(
1
),
true
,
'
c
'
);
$tab
->
add
(
'全部任务'
,
$this
->
getData
(
-
1
),
true
,
'
1
'
);
}
$tab
->
add
(
'待完成任务'
,
$this
->
getData
(
0
),
true
,
'
2
'
);
$tab
->
add
(
'已完成任务'
,
$this
->
getData
(
1
),
true
,
'
3
'
);
if
(
$user
->
is_admin
==
0
)
{
//用户
$tab
->
add
(
'已经结算任务'
,
$this
->
getOrderData
(),
true
,
'
d
'
);
$tab
->
add
(
'已经结算任务'
,
$this
->
getOrderData
(),
true
,
'
4
'
);
}
return
$tab
;
}
...
...
app/Admin/Controllers/TasksApproveController.php
View file @
bba7cb61
...
...
@@ -4,21 +4,12 @@ namespace App\Admin\Controllers;
use
App\Admin\Extensions\Tools\NotPassAction
;
use
App\Admin\Extensions\Tools\PassAction
;
use
App\Admin\Forms\MsgSetting
;
use
App\Admin\Repositories\Task
;
use
App\Admin\Repositories\TasksApprove
;
use
App\Models\TasksReceive
;
use
Dcat\Admin\Actions\Action
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Grid
;
use
Dcat\Admin\Layout\Content
;
use
Dcat\Admin\Repositories\EloquentRepository
;
use
Dcat\Admin\Show
;
use
Dcat\Admin\Http\Controllers\AdminController
;
use
Dcat\Admin\Widgets\Card
;
use
Dcat\Admin\Widgets\Modal
;
use
Dcat\Admin\Widgets\Tab
;
use
Illuminate\Support\Facades\DB
;
class
TasksApproveController
extends
AdminController
{
...
...
@@ -34,7 +25,7 @@ class TasksApproveController extends AdminController
$tab
->
add
(
'未审核'
,
$this
->
getData
(
0
),
true
,
'a'
);
$tab
->
add
(
'已审核'
,
$this
->
getData
(
1
),
true
,
'b'
);
return
$tab
;
return
$tab
->
withCard
()
;
}
/**
...
...
app/Admin/Controllers/TasksOrderController.php
View file @
bba7cb61
...
...
@@ -3,11 +3,11 @@
namespace
App\Admin\Controllers
;
use
App\Admin\Extensions\Tools\CreateSettlementOrder
;
use
App\Admin\Extensions\Tools\NotPassAction
;
use
App\Admin\Extensions\Tools\ReturnBack
;
use
App\Admin\Extensions\Tools\UserConfirmOrder
;
use
App\Admin\Repositories\TasksReceive
;
use
App\Models\AdminUser
;
use
App\Models\TasksOrder
;
use
Dcat\Admin\Actions\Action
;
use
Dcat\Admin\Admin
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Grid
;
...
...
@@ -20,12 +20,12 @@ class TasksOrderController extends AdminController
{
/**
* 领取任务页
*
* @param Content $content
*
* @param Content $content
* @return Content
*/
public
function
orderReceive
(
$id
,
Content
$content
)
public
function
orderReceive
(
$id
,
Content
$content
)
{
return
$content
// ->translation($this->translation())
...
...
@@ -34,15 +34,15 @@ class TasksOrderController extends AdminController
->
body
(
$this
->
getOderDetail
(
$id
));
}
public
function
getOderDetail
(
$id
)
public
function
getOderDetail
(
$id
,
$type
=
1
)
{
return
Grid
::
make
(
\App\Admin\Repositories\TasksReceive
::
with
([
'task'
,
'collects'
,
'user'
]),
function
(
Grid
$grid
)
use
(
$id
)
{
return
Grid
::
make
(
\App\Admin\Repositories\TasksReceive
::
with
([
'task'
,
'collects'
,
'user'
]),
function
(
Grid
$grid
)
use
(
$id
,
$type
)
{
$user
=
Admin
::
user
();
// dd(trans('admin.view'));//查看
$grid
->
title
(
'结算单详情'
);
$grid
->
header
(
function
(
$collection
)
use
(
$grid
,
$id
)
{
$grid
->
header
(
function
(
$collection
)
use
(
$grid
,
$id
)
{
$data
=
$collection
->
toArray
();
$count
=
count
(
$data
);
$order
=
TasksOrder
::
query
()
->
find
(
$id
);
...
...
@@ -56,7 +56,7 @@ class TasksOrderController extends AdminController
});
$grid
->
model
()
->
where
(
'order_id'
,
$id
);
$grid
->
model
()
->
where
(
'order_id'
,
$id
);
// 在 display 回调中使用
$grid
->
column
(
'序号'
)
->
display
(
function
()
{
...
...
@@ -78,11 +78,35 @@ class TasksOrderController extends AdminController
// $grid->column('collects.net_img', '网页截图');
if
(
$user
->
is_admin
==
0
){
$grid
->
tools
(
new
CreateSettlementOrder
(
'<button class="btn btn-primary ">确认结账</button>'
));
$grid
->
tools
(
new
CreateSettlementOrder
(
'<button class="btn btn-primary ">确认收款</button>'
));
$order
=
TasksOrder
::
query
()
->
find
(
$id
);
if
(
$user
->
is_admin
==
0
)
{
if
(
$order
->
status
==
0
){
$grid
->
tools
(
new
UserConfirmOrder
(
'<button class="btn btn-primary btn-outline">确认结账</button>'
,
$id
,
1
));
$grid
->
tools
(
new
UserConfirmOrder
(
'<button class="btn btn-primary btn-outline">确认收款</button>'
,
$id
,
2
));
}
if
(
$order
->
status
==
1
)
{
$grid
->
tools
(
'<button class="btn btn-primary ">已确认结账</button>'
);
$grid
->
tools
(
new
UserConfirmOrder
(
'<button class="btn btn-primary btn-outline">确认收款</button>'
,
$id
,
2
));
}
if
(
$order
->
status
==
2
)
{
$grid
->
tools
(
'<button class="btn btn-primary ">已确认结账</button>'
);
$grid
->
tools
(
'<button class="btn btn-primary ">已确认收款</button>'
);
}
}
else
{
if
(
$order
->
status
==
0
){
$grid
->
tools
(
'<button class="btn btn-primary ">未确认结账</button>'
);
$grid
->
tools
(
'<button class="btn btn-primary ">未确认收款</button>'
);
}
if
(
$order
->
status
==
1
)
{
$grid
->
tools
(
'<button class="btn btn-primary ">已确认结账</button>'
);
$grid
->
tools
(
'<button class="btn btn-primary ">未确认收款</button>'
);
}
if
(
$order
->
status
==
2
)
{
$grid
->
tools
(
'<button class="btn btn-primary ">已确认结账</button>'
);
$grid
->
tools
(
'<button class="btn btn-primary ">已确认收款</button>'
);
}
}
$grid
->
tools
(
new
ReturnBack
(
'<button class="btn btn-primary btn-outline">返回上一级</button>'
,
$type
))
->
toolsWithOutline
(
false
);
$grid
->
disableRowSelector
();
//禁用行选择器
$grid
->
disableRefreshButton
();
// 禁用刷新功能
...
...
@@ -102,8 +126,8 @@ class TasksOrderController extends AdminController
// $tab->add('选项卡1', view('...'));
// $user = Admin::user();
$tab
->
add
(
'结算列表'
,
$this
->
getData
(),
true
,
'a
'
);
$tab
->
add
(
'生成结算单'
,
$this
->
getReceiveData
(),
true
,
'b
'
);
$tab
->
add
(
'结算列表'
,
$this
->
getData
(),
true
,
'11111
'
);
$tab
->
add
(
'生成结算单'
,
$this
->
getReceiveData
(),
true
,
'22222
'
);
return
$tab
;
}
...
...
@@ -143,23 +167,23 @@ class TasksOrderController extends AdminController
// $grid->actions([new NotPassAction()]);//不通过按钮
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
$filter
->
expand
();
//展开过滤器
// 更改为 panel 布局
$filter
->
panel
();
$filter
->
expand
();
//展开过滤器
// 更改为 panel 布局
$filter
->
panel
();
// 注意切换为panel布局方式时需要重新调整表单字段的宽度
$filter
->
equal
(
'user.id'
,
'用户'
)
->
width
(
2
)
->
select
(
function
()
{
$userIds
=
\App\Models\TasksReceive
::
query
()
->
where
(
'status'
,
3
)
->
pluck
(
'user_id'
)
->
toArray
();
$userArr
=
AdminUser
::
query
()
->
whereIn
(
'id'
,
$userIds
)
->
get
()
->
toArray
();
// 注意切换为panel布局方式时需要重新调整表单字段的宽度
$filter
->
equal
(
'user.id'
,
'用户'
)
->
width
(
2
)
->
select
(
function
()
{
$userIds
=
\App\Models\TasksReceive
::
query
()
->
where
(
'status'
,
3
)
->
pluck
(
'user_id'
)
->
toArray
();
$userArr
=
AdminUser
::
query
()
->
whereIn
(
'id'
,
$userIds
)
->
get
()
->
toArray
();
return
array_column
(
$userArr
,
'name'
,
'id'
);
});
$filter
->
equal
(
'status'
,
'状态'
)
->
width
(
2
)
->
select
([
'3'
=>
'未结算'
])
->
default
(
3
);
return
array_column
(
$userArr
,
'name'
,
'id'
);
});
$filter
->
equal
(
'status'
,
'状态'
)
->
width
(
2
)
->
select
([
'3'
=>
'未结算'
])
->
default
(
3
);
});
$grid
->
disableFilterButton
();
$grid
->
disableFilterButton
();
$grid
->
disableDeleteButton
()
->
disableCreateButton
()
->
disableEditButton
()
->
disableViewButton
()
->
disableActions
()
->
disableBatchDelete
();
...
...
@@ -186,8 +210,8 @@ class TasksOrderController extends AdminController
$grid
->
column
(
'num'
);
$grid
->
column
(
'amount'
);
$grid
->
column
(
'pay_img'
);
$grid
->
column
(
'status'
,
'状态'
)
->
display
(
function
(
$val
)
use
(
$grid
){
if
(
$val
==
3
){
$grid
->
column
(
'status'
,
'状态'
)
->
display
(
function
(
$val
)
use
(
$grid
)
{
if
(
$val
==
3
)
{
$grid
->
disableEditButton
();
}
return
TasksOrder
::
ORDER_STATUS_DESC
[
$val
];
...
...
@@ -197,7 +221,6 @@ class TasksOrderController extends AdminController
// $grid->column('updated_at')->sortable();
$grid
->
disableCreateButton
()
->
disableDeleteButton
();
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
// $filter->equal('id');
...
...
@@ -215,10 +238,10 @@ class TasksOrderController extends AdminController
protected
function
detail
(
$id
)
{
return
Content
::
make
()
// ->translation($this->translation())
// ->title($this->title())
// ->description($this->description()['index'] ?? trans('admin.list'))
->
body
(
$this
->
getOderDetail
(
$id
));
// ->translation($this->translation())
// ->title($this->title())
// ->description($this->description()['index'] ?? trans('admin.list'))
->
body
(
$this
->
getOderDetail
(
$id
,
2
));
}
...
...
app/Admin/Extensions/Tools/ReturnBack.php
0 → 100644
View file @
bba7cb61
<?php
namespace
App\Admin\Extensions\Tools
;
use
App\Models\Task
;
use
App\Models\TasksApprove
;
use
App\Models\TasksOrder
;
use
App\Models\TasksReceive
;
use
Dcat\Admin\Actions\Action
;
use
Dcat\Admin\Grid\BatchAction
;
use
Illuminate\Http\Request
;
class
ReturnBack
extends
Action
{
protected
$type
;
// 注意action的构造方法参数一定要给默认值
public
function
__construct
(
$title
=
null
,
$type
=
1
)
{
$this
->
title
=
$title
;
$this
->
type
=
$type
;
}
// 处理请求
public
function
handle
(
Request
$request
)
{
// 获取请求参数
$type
=
$request
->
get
(
'type'
);
if
(
$type
==
1
){
$url
=
'/receives'
;
}
if
(
$type
==
2
){
$url
=
'/orders'
;
}
return
$this
->
response
()
->
redirect
(
$url
);
}
// 设置请求参数
public
function
parameters
()
{
return
[
'type'
=>
$this
->
type
,
];
}
}
app/Admin/Extensions/Tools/UserConfirmOrder.php
0 → 100644
View file @
bba7cb61
<?php
namespace
App\Admin\Extensions\Tools
;
use
App\Models\Task
;
use
App\Models\TasksApprove
;
use
App\Models\TasksOrder
;
use
App\Models\TasksReceive
;
use
Dcat\Admin\Actions\Action
;
use
Dcat\Admin\Grid\BatchAction
;
use
Illuminate\Http\Request
;
class
UserConfirmOrder
extends
Action
{
protected
$status
;
protected
$orderId
;
// 注意action的构造方法参数一定要给默认值
public
function
__construct
(
$title
=
null
,
$orderId
=
0
,
$status
=
1
)
{
$this
->
title
=
$title
;
$this
->
orderId
=
$orderId
;
$this
->
status
=
$status
;
}
// 确认弹窗信息
public
function
confirm
()
{
return
$this
->
status
==
1
?
'您确定结账吗?'
:
'您确定收款吗?'
;
}
// 处理请求
public
function
handle
(
Request
$request
)
{
// 获取请求参数
$status
=
$request
->
get
(
'status'
);
$orderId
=
$request
->
get
(
'order_id'
);
$order
=
TasksOrder
::
query
()
->
find
(
$orderId
);
if
(
$order
){
if
(
$order
->
status
==
0
&&
$status
==
1
){
$order
->
status
=
$status
;
$order
->
save
();
}
if
(
$order
->
status
==
1
&&
$status
==
2
){
$order
->
status
=
$status
;
$order
->
save
();
}
}
return
$this
->
response
()
->
success
(
'操作成功'
)
->
refresh
();
}
// 设置请求参数
public
function
parameters
()
{
return
[
'status'
=>
$this
->
status
,
'order_id'
=>
$this
->
orderId
,
];
}
}
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