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
4ed9c66c
authored
Jan 27, 2021
by
朱继来
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'zjl_order_refund_20201208'
parents
2a75500e
b5c973f7
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
43 additions
and
33 deletions
app/Http/Controllers/ApiController.php
app/Http/Controllers/WebController.php
app/Model/OrderServiceItemsModel.php
app/Model/OrderServiceModel.php
public/js/web/orderServiceDetails.js
public/js/web/orderServiceList.js
resources/views/detail/content.blade.php
resources/views/web/orderServiceDetails.blade.php
app/Http/Controllers/ApiController.php
View file @
4ed9c66c
...
...
@@ -476,36 +476,17 @@ class ApiController extends Controller
if
(
!
$id
)
$this
->
Export
(
-
1
,
'参数缺失'
);
$OrderServiceModel
=
new
OrderServiceModel
;
$order_service
=
$OrderServiceModel
->
find
(
$id
);
$OrderRefundModel
=
new
OrderRefundModel
;
$OrderRefundLogModel
=
new
OrderRefundLogModel
;
$update_service
=
[];
$update_service
[
'refund_status'
]
=
3
;
$update_service
[
'update_time'
]
=
time
();
$res
=
$OrderServiceModel
->
where
(
'id'
,
$id
)
->
update
(
$update_service
);
if
(
$res
===
false
)
$this
->
Export
(
-
1
,
'更新售后退款状态失败'
);
$update
=
[];
$update
[
'is_refund'
]
=
1
;
$update
[
'status'
]
=
10
;
$update
[
'is_sys'
]
=
2
;
// 同步财务
$update
[
'refund_time'
]
=
time
();
$data
[
'id'
]
=
$id
;
$data
[
'operator_id'
]
=
$request
->
user
->
userId
;
$res
=
$OrderRefundModel
->
where
(
'refund_id'
,
$order_service
->
refund_id
)
->
update
(
$update
);
if
(
$res
===
false
)
$this
->
Export
(
-
1
,
'更新退款表失败'
);
$url
=
Config
(
'website.api_domain'
)
.
'refund/confirmrefund'
;
$update_log
=
[];
$update_log
[
'refund_status'
]
=
10
;
$update_log
[
'refund_time'
]
=
time
();
$data
[
'k1'
]
=
time
();
$data
[
'k2'
]
=
md5
(
md5
(
$data
[
'k1'
])
.
'fh6y5t4rr351d2c3bryi'
);
$res
=
$OrderRefundLogModel
->
where
(
'refund_id'
,
$order_service
->
refund_id
)
->
update
(
$update_log
);
if
(
$res
===
false
)
$this
->
Export
(
-
1
,
'更新退款日志失败'
);
$temp
=
json_decode
(
curlApi
(
$url
,
$data
,
"POST"
),
true
);
// 连接API
$this
->
Export
(
0
,
'成功'
);
$this
->
Export
(
$temp
[
'err_code'
],
$temp
[
'err_msg'
]
);
}
...
...
app/Http/Controllers/WebController.php
View file @
4ed9c66c
...
...
@@ -24,6 +24,7 @@ use DB;
use
App\Model\UserMainModel
;
use
App\Model\UserInfoModel
;
use
App\Model\UserCompanyModel
;
use
App\Model\OrderModel
;
use
App\Model\OrderServiceModel
;
use
App\Model\OrderServiceItemsModel
;
use
App\Model\OrderServiceLogModel
;
...
...
@@ -403,10 +404,16 @@ class WebController extends Controller
$data
[
'title'
]
=
'售后单详情'
;
$OrderServiceModel
=
new
OrderServiceModel
;
$OrderServiceLogModel
=
new
OrderServiceLogModel
;
$OrderModel
=
new
OrderModel
;
$OrderServiceModel
=
new
OrderServiceModel
;
$OrderServiceItemsModel
=
new
OrderServiceItemsModel
;
$OrderServiceLogModel
=
new
OrderServiceLogModel
;
$order_service
=
$OrderServiceModel
->
find
(
$service_id
);
$data
[
'service_amount'
]
=
$OrderServiceItemsModel
->
getServiceAmount
(
$service_id
);
// 售后金额
$currency
=
$OrderModel
->
where
(
'order_id'
,
$order_service
[
'order_id'
])
->
value
(
'currency'
);
$data
[
'currency_sign'
]
=
$currency
==
1
?
'¥'
:
'$'
;
// 用户账号
$UserMainModel
=
new
UserMainModel
;
...
...
app/Model/OrderServiceItemsModel.php
View file @
4ed9c66c
...
...
@@ -36,11 +36,24 @@ class OrderServiceItemsModel extends Model
}
$v
[
'amount'
]
=
number_format
(
$v
[
'adjust_number'
]
*
$v
[
'adjust_price'
],
2
);
$v
[
'refund_amount'
]
=
number_format
(
$v
[
'goods_number'
]
*
$v
[
'single_pre_price'
],
2
);
//
$v['refund_amount'] = number_format($v['goods_number'] * $v['single_pre_price'], 2);
$v
[
'apply_reason_val'
]
=
array_get
(
Config
(
'order_service.apply_reason'
),
$v
[
'apply_reason'
],
''
);
}
return
$data
;
}
// 获取售后金额
public
function
getServiceAmount
(
$service_id
)
{
$data
=
$this
->
where
(
'service_id'
,
$service_id
)
->
select
(
'adjust_number'
,
'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
app/Model/OrderServiceModel.php
View file @
4ed9c66c
...
...
@@ -133,9 +133,15 @@ class OrderServiceModel extends Model
$v
[
'return_status_val'
]
=
array_get
(
Config
(
'order_service.return_status'
),
$v
[
'return_status'
],
''
);
$v
[
'auditor_time'
]
=
$v
[
'auditor_time'
]
?
date
(
'Y-m-d H:i:s'
,
$v
[
'auditor_time'
])
:
''
;
if
(
$v
[
'service_status'
]
==
1
)
{
$v
[
'items'
]
=
$OrderServiceItemsModel
->
where
(
'service_id'
,
$v
[
'id'
])
->
get
()
->
toArray
();
$service_items
=
$OrderServiceItemsModel
->
where
(
'service_id'
,
$v
[
'id'
])
->
get
()
->
toArray
();
$goods_amount
=
0
;
foreach
(
$service_items
as
$item
)
{
$goods_amount
+=
$item
[
'adjust_price'
]
*
$item
[
'adjust_number'
];
}
$v
[
'items'
]
=
$service_items
;
$v
[
'service_amount'
]
=
number_format
(
$goods_amount
,
2
,
'.'
,
''
);
}
return
$data
;
...
...
public/js/web/orderServiceDetails.js
View file @
4ed9c66c
...
...
@@ -22,7 +22,7 @@ layui.use(['form', 'table', 'element'], function(){
,{
field
:
'adjust_number'
,
title
:
'申请数量'
,
width
:
120
}
,{
field
:
'adjust_price'
,
title
:
'售后单价'
,
width
:
120
}
,{
field
:
'amount'
,
title
:
'小计'
,
width
:
120
}
,{
field
:
'refund_amount'
,
title
:
'可退款金额'
,
width
:
120
}
//
,{field: 'refund_amount', title: '可退款金额', width: 120}
,{
field
:
'removal_number'
,
title
:
'已出库数量'
,
width
:
120
}
,{
field
:
'put_warehouse_number'
,
title
:
'退货入库数量'
,
width
:
120
}
,{
field
:
'apply_reason_val'
,
title
:
'申请原因'
,
width
:
120
}
...
...
public/js/web/orderServiceList.js
View file @
4ed9c66c
...
...
@@ -26,6 +26,7 @@ layui.use(['form', 'table', 'laydate'], function(){
,{
field
:
'user_account'
,
title
:
'用户账号'
,
width
:
150
}
,{
field
:
'apply_name'
,
title
:
'申请人'
,
width
:
120
}
,{
field
:
'auditor_name'
,
title
:
'审核人'
,
width
:
120
}
,{
field
:
'service_amount'
,
title
:
'售后金额'
,
width
:
120
}
,{
field
:
'service_status_val'
,
title
:
'售后状态'
,
templet
:
'#status'
,
width
:
120
}
,{
field
:
'refund_status_val'
,
title
:
'退款状态'
,
width
:
120
}
,{
field
:
'return_status_val'
,
title
:
'退货状态'
,
width
:
120
}
...
...
resources/views/detail/content.blade.php
View file @
4ed9c66c
...
...
@@ -211,7 +211,7 @@
@endif
<!-- 售后申请 -->
@if ($order_info['status'] > 2
&&
$order_info['status']
<
10
)
@if ($order_info['status'] > 2)
<a
class=
"btn btn-info order_service"
data-id=
"{{$order_info['order_id']}}"
data-pay_type=
"{{$order_info['order_pay_type']}}"
>
售后申请
</a>
@endif
...
...
resources/views/web/orderServiceDetails.blade.php
View file @
4ed9c66c
...
...
@@ -137,6 +137,7 @@
<h2
class=
"layui-colla-title"
>
售后明细
</h2>
<div
class=
"layui-colla-content layui-show"
>
<table
id=
"order-service-items"
lay-filter=
"order-service-items"
></table>
<div
style=
"margin: 20px; font-size: 20px;"
>
售后合计: {{ $currency_sign.$service_amount }}
</div>
</div>
</div>
...
...
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