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
afd24318
authored
Nov 16, 2022
by
孙龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
订单详情
parent
093dbba3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
107 additions
and
2 deletions
app/Admin/Controllers/OrderController.php
app/Models/Order.php
app/helpers.php
resources/lang/en/order.php
resources/lang/zh_CN/order.php
app/Admin/Controllers/OrderController.php
View file @
afd24318
...
...
@@ -9,6 +9,7 @@ use App\Admin\Actions\OrderReverseAuditAction;
use
App\Admin\Pages\OrderDetailPage
;
use
App\Models\Cms\CmsUser
;
use
App\Models\Order
;
use
App\Models\OrderPrice
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Grid
;
use
Dcat\Admin\Show
;
...
...
@@ -16,6 +17,7 @@ use Dcat\Admin\Http\Controllers\AdminController;
use
Dcat\Admin\Layout\Content
;
use
Dcat\Admin\Widgets\Box
;
use
Dcat\Admin\Widgets\Dropdown
;
use
Illuminate\Support\Arr
;
class
OrderController
extends
AdminController
...
...
@@ -58,7 +60,7 @@ class OrderController extends AdminController
});
$grid
->
column
(
'order_id'
,
"ID"
);
$grid
->
column
(
'order_sn'
)
->
width
(
'120px'
)
->
display
(
function
()
{
return
'<a target="_blank" iframe-extends=true iframe-tab=true href="/admin/order/page?order_id=
"'
.
$this
->
user_id
.
'
>'
.
$this
->
order_sn
.
'</a>'
;
return
'<a target="_blank" iframe-extends=true iframe-tab=true href="/admin/order/page?order_id=
'
.
$this
->
order_id
.
'"
>'
.
$this
->
order_sn
.
'</a>'
;
});
$grid
->
column
(
'status'
)
->
using
(
admin_trans
(
'order.options.status'
))
->
sortable
();
$grid
->
column
(
'company_name'
)
->
display
(
function
(
$company_name
)
{
...
...
@@ -239,7 +241,77 @@ JS
}
public
function
page
(
Content
$content
){
return
view
(
'admin.pages.order-page'
);
$params
=
request
()
->
all
();
$order_id
=
arrayGet
(
$params
,
"order_id"
,
0
,
"intval"
);
$orderInfo
=
Order
::
getOneAndRelationList
(
$order_id
);
$orderItems
=
$orderInfo
[
"orderItems"
]
??
[];
dump
(
$orderInfo
);
$info
=
[];
// $info["orderInfo"] = $orderInfo;
//基本信息
$info
[
"baseInfo"
][
"order_sn"
]
=
$orderInfo
[
"order_sn"
];
$info
[
"baseInfo"
][
"status"
]
=
$orderInfo
[
"status"
];
$info
[
"baseInfo"
][
"status_cn"
]
=
Arr
::
get
(
array_flip
(
Order
::
$STATUS_FORAMT
),
$orderInfo
[
"status"
],
""
);
$info
[
"baseInfo"
][
"company_name"
]
=
$orderInfo
[
"company_name"
];
$info
[
"baseInfo"
][
"user_sn"
]
=
$orderInfo
[
"scm_user"
][
"user_sn"
]
??
""
;
$info
[
"baseInfo"
][
"name"
]
=
$orderInfo
[
"scm_user"
][
"name"
]
??
""
;
$info
[
"receiveInfo"
]
=
[];
//收货信息
$info
[
"billingInfo"
]
=
[];
//账单信息
$addressList
=
$orderInfo
[
"order_address"
]
??
[];
foreach
(
$addressList
as
$addressItem
){
if
(
$addressItem
[
"order_address_type"
]
==
"1"
){
$info
[
"receiveInfo"
]
=
$addressItem
;
}
elseif
(
$addressItem
[
"order_address_type"
]
==
"2"
){
$info
[
"billingInfo"
]
=
$addressItem
;
}
}
$orderInfo
[
"orderItemList"
]
=
$orderItems
;
foreach
(
$orderInfo
[
"orderItemList"
]
as
$k
=>
$item
){
$orderInfo
[
"orderItemList"
][
$k
][
"goods_price_format"
]
=
decimal_number_format_usd
(
$item
[
"goods_price"
]);
$orderInfo
[
"orderItemList"
][
$k
][
"total_amount"
]
=
decimal_number_format
(
$item
[
"goods_price"
]
*
$item
[
"goods_number"
]);
$orderInfo
[
"orderItemList"
][
$k
][
"total_amount_format"
]
=
decimal_number_format_usd
(
$item
[
"goods_price"
]
*
$item
[
"goods_number"
]);
}
//结算信息
$info
[
"settlementInfo"
]
=
[];
$orderPrice
=
$orderInfo
[
"order_price"
]
??
[];
$info
[
"settlementInfo"
][
"order_amount"
]
=
$orderInfo
[
"order_amount"
];
$info
[
"settlementInfo"
][
"order_amount_format"
]
=
decimal_number_format_usd
(
$orderInfo
[
"order_amount"
]);
$info
[
"settlementInfo"
][
"order_freight_amount"
]
=
0
;
//运费
$info
[
"settlementInfo"
][
"order_freight_amount_format"
]
=
""
;
$info
[
"settlementInfo"
][
"order_pay_commission_amount"
]
=
0
;
//手续费
$info
[
"settlementInfo"
][
"order_pay_commission_amount_format"
]
=
""
;
$orderItemsId
=
Arr
::
pluck
(
$orderItems
,
"rec_id"
);
foreach
(
$orderPrice
as
$orderPriceItem
){
switch
(
$orderPriceItem
[
"price_type"
]){
case
OrderPrice
::
$PRICE_TYPE_LIST
[
"运费"
]
:
$info
[
"settlementInfo"
][
"order_freight_amount"
]
=
$orderPriceItem
[
"price"
];
$info
[
"settlementInfo"
][
"order_freight_amount_format"
]
=
decimal_number_format_usd
(
$orderPriceItem
[
"price"
]);
case
OrderPrice
::
$PRICE_TYPE_LIST
[
"支付手续费"
]
:
$info
[
"settlementInfo"
][
"order_pay_commission_amount"
]
=
$orderPriceItem
[
"price"
];
$info
[
"settlementInfo"
][
"order_pay_commission_amount_format"
]
=
decimal_number_format_usd
(
$orderPriceItem
[
"price"
]);
}
}
$info
[
"settlementInfo"
][
"order_total_amount"
]
=
$info
[
"settlementInfo"
][
"order_amount"
]
+
$info
[
"settlementInfo"
][
"order_freight_amount"
]
+
$info
[
"settlementInfo"
][
"order_pay_commission_amount"
];
$info
[
"settlementInfo"
][
"order_total_amount_format"
]
=
decimal_number_format_usd
(
$info
[
"settlementInfo"
][
"order_total_amount"
]);
dump
(
$info
);
return
view
(
'admin.pages.order-page'
,[
"info"
=>
$info
]);
// return $content->body(new OrderDetailPage());
}
...
...
app/Models/Order.php
View file @
afd24318
...
...
@@ -51,6 +51,10 @@ class Order extends Model
return
$this
->
hasMany
(
OrderPrice
::
class
,
'order_id'
,
'order_id'
);
}
public
function
order_address
()
{
return
$this
->
hasMany
(
OrderAddress
::
class
,
'order_id'
,
'order_id'
);
}
//审核订单
...
...
@@ -80,6 +84,11 @@ class Order extends Model
return
$orderInfo
?
$orderInfo
->
toArray
()
:
[];
}
public
static
function
getOneAndRelationList
(
$orderId
=
0
){
$orderInfo
=
self
::
where
(
"order_id"
,
$orderId
)
->
with
(
"scmUser"
)
->
with
(
"order_price"
)
->
with
(
"order_items"
)
->
with
(
"order_address"
)
->
first
();
return
$orderInfo
?
$orderInfo
->
toArray
()
:
[];
}
//取消
public
static
function
canelOrder
(
$orderId
=
0
){
return
self
::
where
(
"order_id"
,
$orderId
)
->
update
([
...
...
@@ -87,4 +96,10 @@ class Order extends Model
]);
}
//修改订单
public
static
function
updateOrder
(
$where
,
$update
){
$update
[
"update_time"
]
=
time
();
return
self
::
where
(
$where
)
->
update
(
$update
);
}
}
app/helpers.php
View file @
afd24318
...
...
@@ -5,6 +5,7 @@ use Illuminate\Support\Arr;
define
(
"DIGITS_TWO"
,
2
);
define
(
"DIGITS_FOUR"
,
4
);
define
(
"DIGITS_SIX"
,
6
);
define
(
"CURRENCY_USD"
,
2
);
if
(
!
function_exists
(
'user_admin_config'
))
{
function
user_admin_config
(
$key
=
null
,
$value
=
null
)
...
...
@@ -110,6 +111,14 @@ if (!function_exists('decimal_number_format')) {
}
}
if
(
!
function_exists
(
'decimal_number_format_usd'
))
{
function
decimal_number_format_usd
(
$amount
){
return
decimal_number_format
(
$amount
,
DIGITS_TWO
,
CURRENCY_USD
);
}
}
if
(
!
function_exists
(
'printJson'
))
{
function
printJson
(
$data
)
{
...
...
resources/lang/en/order.php
View file @
afd24318
...
...
@@ -4,6 +4,7 @@ return [
'Order'
=>
'Order'
,
'order'
=>
'Order'
,
'edit_status_handle'
=>
'修改状态'
,
'将该订单状态置为'
=>
'将该订单状态置为'
,
],
'fields'
=>
[
'order_sn'
=>
'订单编号号'
,
...
...
@@ -22,6 +23,10 @@ return [
'sale_id'
=>
'业务员id'
,
'sale_name'
=>
'业务员'
,
],
"return_msg"
=>
[
"50000"
=>
"操作成功"
,
"50001"
=>
"只能修改不是待审核的订单状态"
],
'options'
=>
[
"status"
=>
[
"-1"
=>
"已取消"
,
...
...
resources/lang/zh_CN/order.php
View file @
afd24318
...
...
@@ -23,6 +23,10 @@ return [
'sale_id'
=>
'业务员id'
,
'sale_name'
=>
'业务员'
,
],
"return_msg"
=>
[
"50000"
=>
"操作成功"
,
"50001"
=>
"只能修改不是待审核的订单状态"
],
'options'
=>
[
"status"
=>
[
"-1"
=>
"已取消"
,
...
...
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