Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
semour
/
semour_admin
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
ddba0583
authored
Nov 11, 2022
by
孙龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
订单列表
parent
32ecedd4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
70 additions
and
46 deletions
app/Admin/Controllers/Api/OrderApiController.php
app/Admin/Controllers/OrderController.php
app/Admin/Extensions/InvalidRequestException.php
app/Admin/Service/OrderService.php
app/Admin/routes.php
app/Models/Order.php
app/Admin/Controllers/Api/OrderApiController.php
View file @
ddba0583
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
namespace
App\Admin\Controllers\Api
;
namespace
App\Admin\Controllers\Api
;
use
App\Admin\Service\OrderService
;
use
App\Models\Increasid
;
use
App\Models\OrderAddress
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
use
Illuminate\Routing\Controller
;
use
Illuminate\Routing\Controller
;
use
Maatwebsite\Excel\Facades\Excel
;
use
Maatwebsite\Excel\Facades\Excel
;
...
@@ -11,14 +14,19 @@ class OrderApiController extends Controller
...
@@ -11,14 +14,19 @@ class OrderApiController extends Controller
{
{
public
function
orderDownloadShow
(
Request
$request
){
public
function
orderDownloadShow
(
Request
$request
){
$params
=
$request
->
all
();
$params
=
$request
->
all
();
$type
=
arrayGet
(
$params
,
"type"
);
$type
=
arrayGet
(
$params
,
"type"
);
$order_id
=
1
;
$orderAddressList
=
OrderService
::
getOrderAddress
(
$order_id
);
dump
(
$orderAddressList
);
$sn
=
OrderService
::
getSn
(
$type
);
if
(
empty
(
$sn
)){
abort
(
500
,
'获取编码失败'
);
}
if
(
$type
==
"1"
){
if
(
$type
==
"1"
){
//PI
//PI
return
view
(
'export.order_contract_PI'
);
return
view
(
'export.order_contract_PI'
);
}
elseif
(
$type
==
"2"
){
}
elseif
(
$type
==
"2"
){
//CI
//CI
...
@@ -32,7 +40,8 @@ class OrderApiController extends Controller
...
@@ -32,7 +40,8 @@ class OrderApiController extends Controller
public
function
orderDownload
(
Request
$request
){
public
function
orderDownload
(
Request
$request
){
$params
=
$request
->
all
();
return
Excel
::
download
(
new
\App\Exports\ContractExport
(),
'PI.xlsx'
);
// $params = $request->all();
// return Excel::download(new \App\Exports\ContractExport(),'PI.xlsx');
}
}
}
}
app/Admin/Controllers/OrderController.php
View file @
ddba0583
...
@@ -56,7 +56,7 @@ class OrderController extends AdminController
...
@@ -56,7 +56,7 @@ class OrderController extends AdminController
});
});
$grid
->
column
(
'order_id'
,
"ID"
);
$grid
->
column
(
'order_id'
,
"ID"
);
$grid
->
column
(
'order_sn'
)
->
width
(
'120px'
)
->
link
(
function
()
{
$grid
->
column
(
'order_sn'
)
->
width
(
'120px'
)
->
link
(
function
()
{
return
admin_url
(
'order
_items/
'
.
$this
->
order_id
);
return
admin_url
(
'order
/page?order_id=
'
.
$this
->
order_id
);
});
});
$grid
->
column
(
'status'
)
->
using
(
admin_trans
(
'order.options.status'
))
->
sortable
();
$grid
->
column
(
'status'
)
->
using
(
admin_trans
(
'order.options.status'
))
->
sortable
();
$grid
->
column
(
'company_name'
)
->
display
(
function
(
$company_name
)
{
$grid
->
column
(
'company_name'
)
->
display
(
function
(
$company_name
)
{
...
@@ -223,4 +223,8 @@ JS
...
@@ -223,4 +223,8 @@ JS
$form
->
text
(
'sale_id'
);
$form
->
text
(
'sale_id'
);
});
});
}
}
public
function
page
(){
return
view
(
'admin.order-page'
);
}
}
}
app/Admin/Extensions/InvalidRequestException.php
deleted
100644 → 0
View file @
32ecedd4
<?php
namespace
App\Exceptions
;
use
App\Http\ApiHelper\Response
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Log
;
/*
*无效请求异常
*/
class
InvalidRequestException
extends
\Exception
{
public
function
__construct
(
$message
=
""
,
$code
=
200
)
{
parent
::
__construct
(
$message
,
$code
);
}
public
function
render
(
Request
$request
)
{
$request_uri
=
isset
(
$_SERVER
[
'REQUEST_URI'
])
?
$_SERVER
[
'REQUEST_URI'
]
:
''
;
$path_info
=
parse_url
(
$request_uri
);
$err_info
=
[
'domain'
=>
isset
(
$_SERVER
[
'HTTP_HOST'
])
?
$_SERVER
[
'HTTP_HOST'
]
:
''
,
'interface'
=>
isset
(
$path_info
)
?
$path_info
[
'path'
]
:
''
,
'user_agent'
=>
isset
(
$_SERVER
[
'HTTP_USER_AGENT'
])
?
$_SERVER
[
'HTTP_USER_AGENT'
]
:
''
,
'ip'
=>
request
()
->
getClientIp
(),
'time'
=>
time
(),
'other'
=>
''
,
'request_params'
=>
$_REQUEST
,
'msg'
=>
$this
->
getMessage
(),
"code"
=>
$this
->
getCode
(),
];
Log
::
error
(
json_encode
(
$err_info
,
JSON_UNESCAPED_UNICODE
));
return
response
()
->
json
(
json_decode
(
Response
::
setError
(
$this
->
message
),
true
));
}
}
app/Admin/Service/OrderService.php
View file @
ddba0583
...
@@ -3,14 +3,50 @@
...
@@ -3,14 +3,50 @@
namespace
App\Admin\Service
;
namespace
App\Admin\Service
;
use
App\Models\Cms\CmsUser
;
use
App\Models\Cms\CmsUser
;
use
App\Models\Increasid
;
use
App\Models\Order
;
use
App\Models\Order
;
use
App\Models\OrderAddress
;
use
Dcat\Admin\Grid
;
use
Dcat\Admin\Grid
;
class
OrderService
class
OrderService
{
{
/**
* Notes:下载文件的信息
* User: sl
* Date: 2022-11-10 19:10
* @param $orderId
*/
public
static
function
getOrderList
(
$orderId
=
0
){
public
static
function
getOrderList
(
$orderId
=
0
){
}
/**
* Notes:获取订单地址信息 1收货信息 2账单邮寄信息
* User: sl
* Date: 2022-11-10 19:09
* @param $order_id
* @return mixed
*/
public
static
function
getOrderAddress
(
$order_id
){
return
OrderAddress
::
getOrderAddress
(
$order_id
);
}
}
/**
* Notes:获取下载文件的编码
* User: sl
* Date: 2022-11-10 19:09
* @param $increas_type
* @param $type
* @return string
*/
public
static
function
getSn
(
$increas_type
,
$type
=
1
){
return
Increasid
::
getSn
(
$increas_type
,
$type
);
}
}
}
app/Admin/routes.php
View file @
ddba0583
...
@@ -14,6 +14,8 @@ Route::group([
...
@@ -14,6 +14,8 @@ Route::group([
'middleware'
=>
config
(
'admin.route.middleware'
),
'middleware'
=>
config
(
'admin.route.middleware'
),
],
function
(
Router
$router
)
{
],
function
(
Router
$router
)
{
Route
::
get
(
'/order/page'
,
'OrderController@page'
);
$router
->
get
(
'/index'
,
'HomeController@index'
);
$router
->
get
(
'/index'
,
'HomeController@index'
);
$router
->
resource
(
'userAddress'
,
'UserAddressController'
);
$router
->
resource
(
'userAddress'
,
'UserAddressController'
);
$router
->
resource
(
'inquiry'
,
'InquiryController'
);
$router
->
resource
(
'inquiry'
,
'InquiryController'
);
...
...
app/Models/Order.php
View file @
ddba0583
...
@@ -28,6 +28,11 @@ class Order extends Model
...
@@ -28,6 +28,11 @@ class Order extends Model
return
$this
->
belongsTo
(
ScmUser
::
class
,
'user_id'
,
'id'
);
return
$this
->
belongsTo
(
ScmUser
::
class
,
'user_id'
,
'id'
);
}
}
public
function
order_items
()
{
return
$this
->
hasMany
(
OrderItem
::
class
,
'order_id'
,
'order_id'
);
}
//审核订单
//审核订单
...
@@ -36,4 +41,11 @@ class Order extends Model
...
@@ -36,4 +41,11 @@ class Order extends Model
}
}
public
static
function
getOrderList
(
$orderId
=
0
){
self
::
where
(
"order_id"
,
$orderId
)
->
whereHas
(
"order_items"
,
function
(
$q
){
$q
->
where
(
"status"
,
1
);
})
->
get
()
->
toArray
();
}
}
}
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