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
201205df
authored
Jan 28, 2021
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
调整
parent
a1930e00
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
8 deletions
app/Http/Controllers/OrderController.php
app/Model/OrderServiceItemsModel.php
app/Model/OrderServiceModel.php
app/Http/Controllers/OrderController.php
View file @
201205df
...
@@ -1751,8 +1751,8 @@ Class OrderController extends Controller
...
@@ -1751,8 +1751,8 @@ Class OrderController extends Controller
$this
->
getBuyerName
(
$response
);
$this
->
getBuyerName
(
$response
);
// 获取售后金额
// 获取售后金额
$OrderService
ItemsModel
=
new
OrderServiceItems
Model
;
$OrderService
Model
=
new
OrderService
Model
;
$response
[
'service_amount'
]
=
$OrderService
ItemsModel
->
getServiceAmount
(
''
,
$id
);
$response
[
'service_amount'
]
=
$OrderService
Model
->
getRefundedAmount
(
$id
);
return
$response
;
return
$response
;
}
}
...
...
app/Model/OrderServiceItemsModel.php
View file @
201205df
...
@@ -44,13 +44,9 @@ class OrderServiceItemsModel extends Model
...
@@ -44,13 +44,9 @@ class OrderServiceItemsModel extends Model
}
}
// 获取售后金额
// 获取售后金额
public
function
getServiceAmount
(
$service_id
=
''
,
$order_id
=
''
)
public
function
getServiceAmount
(
$service_id
)
{
{
$map
=
[];
$data
=
$this
->
where
(
'service_id'
,
$service_id
)
->
select
(
'adjust_number'
,
'adjust_price'
)
->
get
()
->
toArray
();
$service_id
&&
$map
[
'service_id'
]
=
$service_id
;
$order_id
&&
$map
[
'order_id'
]
=
$order_id
;
$data
=
$this
->
where
(
$map
)
->
select
(
'adjust_number'
,
'adjust_price'
)
->
get
()
->
toArray
();
$amount
=
0
;
$amount
=
0
;
foreach
(
$data
as
$v
)
{
foreach
(
$data
as
$v
)
{
...
...
app/Model/OrderServiceModel.php
View file @
201205df
...
@@ -271,4 +271,23 @@ class OrderServiceModel extends Model
...
@@ -271,4 +271,23 @@ class OrderServiceModel extends Model
return
[
0
,
''
,
$goods
];
return
[
0
,
''
,
$goods
];
}
}
// 获取已退款的售后金额
public
function
getRefundedAmount
(
$order_id
)
{
$data
=
$this
->
from
(
'lie_order_service as s'
)
->
leftJoin
(
'lie_order_service_items as i'
,
's.id'
,
'='
,
'i.service_id'
)
->
where
(
's.refund_status'
,
3
)
->
where
(
'i.order_id'
,
$order_id
)
->
select
(
'i.adjust_number'
,
'i.adjust_price'
)
->
get
()
->
toArray
();
$amount
=
0
;
foreach
(
$data
as
$v
)
{
$amount
+=
$v
[
'adjust_price'
]
*
$v
[
'adjust_number'
];
}
return
number_format
(
$amount
,
2
,
'.'
,
''
);
}
}
}
\ No newline at end of file
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