Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
semour
/
semour_web
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
3e5f4002
authored
Nov 23, 2022
by
SUDPTDUBLXEROFX\Administrator
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
深茂订单详情
parent
c3180025
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
73 additions
and
2 deletions
app/Http/Controllers/Api/OrderApiController.php
app/Http/Services/OrderService.php
app/Models/OrderReturnItemsModel.php
app/helpers.php
routes/api.php
app/Http/Controllers/Api/OrderApiController.php
View file @
3e5f4002
...
...
@@ -63,5 +63,10 @@ class OrderApiController extends Controller
return
$this
->
setSuccessData
(
$result
);
}
//单个订单售后列表
public
function
orderServiceDetail
(
Request
$request
){
$result
=
OrderService
::
orderServiceDetail
(
$request
->
user
->
id
,
$request
->
input
(
"order_id"
));
return
$this
->
setSuccessData
(
$result
);
}
}
app/Http/Services/OrderService.php
View file @
3e5f4002
...
...
@@ -8,6 +8,7 @@ use App\Models\OrderAddressModel;
use
App\Models\OrderItemsModel
;
use
App\Models\OrderModel
;
use
App\Models\OrderPriceModel
;
use
App\Models\OrderReturnItemsModel
;
use
App\Models\UserAddressModel
;
use
App\Models\UserModel
;
use
Illuminate\Support\Facades\DB
;
...
...
@@ -373,7 +374,7 @@ class OrderService
$goods_id
=
$v
[
"goods_id"
];
$oneInfo
=
\Arr
::
get
(
$goodsInfoArr
,
$goods_id
,[]);
$ext_price
=
round
(
$v
[
"goods_number"
]
*
$v
[
"goods_price"
],
2
);
$itemsTemp
=
[
$itemsTemp
[]
=
[
"id"
=>
$k
+
1
,
"goods_id"
=>
$v
[
"goods_id"
],
"goods_name"
=>
$v
[
"goods_name"
],
...
...
@@ -397,7 +398,12 @@ class OrderService
"order_id"
=>
$order_id
,
"order_sn"
=>
$orderInfo
[
"order_sn"
],
"order_amount"
=>
$orderInfo
[
"order_amount"
],
"sub_total "
=>
$orderInfo
[
"order_amount"
],
//小计
"sub_total"
=>
$orderInfo
[
"order_amount"
],
//小计
"created_time"
=>
timeToDate
(
$orderInfo
[
"create_time"
]),
//创建时间
"reviewed_time"
=>
timeToDate
(
$orderInfo
[
"confirm_time"
]),
//审核时间
"paid_time"
=>
timeToDate
(
$orderInfo
[
"pay_time"
]),
//支付时间
"delivered_time"
=>
timeToDate
(
$orderInfo
[
"shipping_time"
]),
//发货时间
"received_time"
=>
""
,
//收货时间
"shipping"
=>
\Arr
::
get
(
$priceArr
,
3
,
0
),
//运费
"payment_surcharge"
=>
\Arr
::
get
(
$priceArr
,
5
,
0
),
//支付手续费
"merchandise_total"
=>
$merchandise_total
,
//商品总额
...
...
@@ -411,6 +417,37 @@ class OrderService
return
$temp
;
}
//订单售后详情
public
static
function
orderServiceDetail
(
$user_id
,
$order_id
){
$returnItems
=
OrderReturnItemsModel
::
where
(
"order_id"
,
$order_id
)
->
get
()
->
toArray
();
if
(
!
$returnItems
){
return
false
;
}
$orderItemsArr
=
OrderItemsModel
::
where
([
"order_id"
=>
$order_id
])
->
wherein
(
"rec_id"
,
array_column
(
$returnItems
,
"rec_id"
))
->
get
()
->
keyby
(
"rec_id"
)
->
toArray
();
$temp
=
[];
foreach
(
$returnItems
as
$k
=>
$v
){
$orderGoodsInfo
=
\Arr
::
get
(
$orderItemsArr
,
$v
[
"rec_id"
]);
$temp
[]
=
[
"no"
=>
$k
+
1
,
"part_no"
=>
$orderGoodsInfo
[
"goods_name"
],
// 型号名称
"manufacturer"
=>
$orderGoodsInfo
[
"brand_name"
],
// 品牌名称
"price_per_unit"
=>
$orderGoodsInfo
[
"goods_price"
],
// 单价
"quantity"
=>
$orderGoodsInfo
[
"goods_number"
],
// 购买数量
"subtotal"
=>
round
(
$orderGoodsInfo
[
"goods_price"
]
*
$orderGoodsInfo
[
"goods_number"
],
2
),
// 金额
"type"
=>
OrderReturnItemsModel
::
$types
[
$v
[
"type"
]],
// 售后类型
"after_sale_quantity"
=>
$v
[
"return_num"
],
// 售后数量
"after_sale_price"
=>
$v
[
"return_price"
],
// 售后单价
"return_amount"
=>
$v
[
"return_amount"
],
// 售后金额
];
}
return
$temp
;
}
}
app/Models/OrderReturnItemsModel.php
0 → 100644
View file @
3e5f4002
<?php
namespace
App\Models
;
use
Illuminate\Database\Eloquent\Model
;
class
OrderReturnItemsModel
extends
Model
{
protected
$table
=
'order_return_items'
;
protected
$primaryKey
=
'return_items_id'
;
public
$timestamps
=
false
;
//`type` '1退货退款 2仅退款',
const
types_return_refund
=
1
;
const
types_refund
=
2
;
static
$types
=
[
self
::
types_refund
=>
"Refund"
,
self
::
types_return_refund
=>
"Return And Refund"
];
}
app/helpers.php
View file @
3e5f4002
...
...
@@ -109,3 +109,10 @@ function getRate($k = "美元")
$redis
=
Redis
::
connection
();
return
$redis
->
hget
(
'erp_rate'
,
$k
);
}
/*
* 时间传换
*/
function
timeToDate
(
$timestr
){
return
$timestr
>
0
?
date
(
"Y-m-d H:i:s"
,
$timestr
)
:
""
;
}
routes/api.php
View file @
3e5f4002
...
...
@@ -55,6 +55,7 @@ Route::middleware(['api', 'api.check'])->namespace('Api')->group(function () {
Route
::
POST
(
'order/updateOrder'
,
'OrderApiController@updateOrder'
);
//更新订单状态
Route
::
POST
(
'order/cancelOrder'
,
'OrderApiController@cancelOrder'
);
//取消订单
Route
::
POST
(
'order/orderDetail'
,
'OrderApiController@orderDetail'
);
//订单详情
Route
::
POST
(
'order/orderServiceDetail'
,
'OrderApiController@orderServiceDetail'
);
//订单售后详情
});
...
...
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