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
e4b73aae
authored
Jun 11, 2019
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
1. 添加物流信息
2. 编辑退货单
parent
68931965
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
320 additions
and
12 deletions
app/Http/Controllers/OrderController.php
app/Http/Controllers/ReturnController.php
app/Http/routes.php
app/Model/OrderReturnModel.php
public/js/refund.js
resources/views/detail/content.blade.php
resources/views/detail/return.blade.php
resources/views/detail/return_edit.blade.php
resources/views/returnDetails/content.blade.php
resources/views/returnlist/content.blade.php
app/Http/Controllers/OrderController.php
View file @
e4b73aae
...
...
@@ -15,6 +15,7 @@ use Excel;
use
App\Model\OrderModel
;
use
App\Model\UserMainModel
;
use
App\Model\OrderActionLogModel
;
use
App\Model\OrderReturnModel
;
// 获取订单优惠券金额
function
getCoupon
(
$order_id
)
...
...
@@ -1024,11 +1025,10 @@ Class OrderController extends Controller
return
view
(
'detail'
,
$info
);
}
// 自营退货
// 自营退货
申请
public
function
orderReturn
(
Request
$request
,
$id
)
{
if
(
$request
->
isMethod
(
'post'
))
{
if
(
$request
->
isMethod
(
'post'
))
{
$data
[
'order_id'
]
=
$id
;
$data
[
'return_info'
]
=
$request
->
input
(
'return_info'
);
$data
[
'return_items_info'
]
=
$request
->
input
(
'return_items_info'
);
...
...
@@ -1063,6 +1063,57 @@ Class OrderController extends Controller
return
view
(
'detail'
,
$info
);
}
// 退货申请编辑
public
function
orderReturnEdit
(
Request
$request
,
$id
)
{
if
(
$request
->
isMethod
(
'post'
))
{
$data
[
'return_id'
]
=
$request
->
input
(
'return_id'
);
$data
[
'return_info'
]
=
$request
->
input
(
'return_info'
);
$data
[
'return_items_info'
]
=
$request
->
input
(
'return_items_info'
);
$data
[
'operator_id'
]
=
$request
->
user
->
userId
;
$data
[
'k1'
]
=
time
();
$data
[
'k2'
]
=
md5
(
md5
(
$data
[
'k1'
])
.
'fh6y5t4rr351d2c3bryi'
);
$url
=
Config
(
'website.api_domain'
)
.
'return/editReturnGoods'
;
$temp
=
json_decode
(
curlApi
(
$url
,
$data
,
'POST'
),
true
);
return
array
(
'errcode'
=>
$temp
[
'err_code'
],
'errmsg'
=>
$temp
[
'err_msg'
]);
}
$info
=
$this
->
orderDetail
(
$request
,
$id
);
$this
->
pageHeader
(
$request
,
$info
,
'编辑退货申请'
,
[
"title"
=>
'编辑退货申请'
,
"href"
=>
'#'
]);
$return_id
=
$request
->
input
(
'return_id'
,
''
);
$redirect_url
=
$info
[
'order_info'
][
'order_goods_type'
]
==
1
?
'/return_list'
:
'/self_return_list'
;
if
(
!
$return_id
)
return
redirect
(
$redirect_url
);
$OrderReturnModel
=
new
OrderReturnModel
();
$info
[
'return'
]
=
$OrderReturnModel
->
find
(
$return_id
);
$info
[
'returnItems'
]
=
$OrderReturnModel
->
find
(
$return_id
)
->
hasManyReturnItems
;
if
(
!
in_array
(
$info
[
'return'
][
'status'
],
[
-
2
,
1
]))
return
redirect
(
'/prompt'
)
->
with
([
'message'
=>
'status为'
.
$info
[
'return'
][
'status'
]
.
',无法编辑退货单'
,
'url'
=>
$redirect_url
,
'jumpTime'
=>
3
,
'status'
=>
false
]);
// 补充退货明细
foreach
(
$info
[
'returnItems'
]
as
$k
=>&
$v
)
{
$map
=
array
();
$map
[
'order_id'
]
=
$v
[
'order_id'
];
$map
[
'rec_id'
]
=
$v
[
'rec_id'
];
$map
[
'goods_id'
]
=
$v
[
'goods_id'
];
// 获取出库数量
$removal
=
DB
::
connection
(
'order'
)
->
table
(
'lie_removal_items'
)
->
where
(
$map
)
->
select
(
'removal_number'
)
->
first
();
$v
[
'removal_number'
]
=
$removal
?
$removal
->
removal_number
:
0
;
// 获取已申请退货数量
$v
[
'already_return_num'
]
=
DB
::
connection
(
'order'
)
->
table
(
'lie_order_return_items'
)
->
where
(
$map
)
->
sum
(
'return_num'
);
}
return
view
(
'detail'
,
$info
);
}
//订单物流信息
public
function
changeShipping
(
Request
$request
,
$id
=
''
)
{
...
...
app/Http/Controllers/ReturnController.php
View file @
e4b73aae
...
...
@@ -129,6 +129,16 @@ class ReturnController extends Controller
$page
->
setConfig
(
'theme'
,
'%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%'
);
$show
=
$page
->
show
();
// 获取配送方式
$shippings
=
DB
::
connection
(
'order'
)
->
table
(
'lie_shipping'
)
->
where
([
'enabled'
=>
1
,
'is_order'
=>
1
])
->
get
();
$ship_type
=
[];
foreach
(
$shippings
as
$k
=>
$v
)
{
$ship_type
[
$v
->
shipping_id
]
=
$v
->
shipping_name
;
}
$info
[
'shippings'
]
=
$ship_type
;
$info
[
'condition'
]
=
$map
;
$info
[
'list'
]
=
$response
[
'data'
][
'data'
];
$info
[
'count'
]
=
$response
[
'data'
][
'count'
];
...
...
@@ -184,4 +194,13 @@ class ReturnController extends Controller
}
}
// 退货物流信息
public
function
returnShipping
(
Request
$request
)
{
if
(
$request
->
isMethod
(
'post'
))
{
$OrderReturnModel
=
new
OrderReturnModel
();
return
$OrderReturnModel
->
shipping
(
$request
);
}
}
}
app/Http/routes.php
View file @
e4b73aae
...
...
@@ -128,7 +128,10 @@ Route::group(['middleware' => 'web'], function () {
Route
::
get
(
'/self_return_list'
,
'ReturnController@selfReturnList'
);
Route
::
get
(
'/return_details/{id}'
,
'ReturnController@returnDetails'
);
Route
::
post
(
'/ajax/returnCheck'
,
'ReturnController@returnCheck'
);
Route
::
post
(
'/ajax/returnShipping'
,
'ReturnController@returnShipping'
);
Route
::
get
(
'/self_return_export'
,
'ReturnController@selfReturnExport'
);
Route
::
match
([
'get'
,
'post'
],
'/return_edit/{id}'
,
'OrderController@orderReturnEdit'
);
});
// 不需要登陆态
...
...
app/Model/OrderReturnModel.php
View file @
e4b73aae
...
...
@@ -202,4 +202,32 @@ class OrderReturnModel extends Model
}
}
// 物流信息
public
function
shipping
(
$request
)
{
$return_id
=
$request
->
input
(
'return_id'
);
$operator_id
=
$request
->
user
->
userId
;
$data
[
'shipping_id'
]
=
$request
->
input
(
'shipping_id'
);
$data
[
'shipping_sn'
]
=
$request
->
input
(
'shipping_sn'
);
$data
[
'status'
]
=
7
;
// 待收货
$data
[
'syn_sign'
]
=
2
;
// 标记同步到财务系统
try
{
DB
::
connection
(
'order'
)
->
beginTransaction
();
// 开启事务
$OrderReturnLogModel
=
new
OrderReturnLogModel
();
$this
->
where
(
'return_id'
,
$return_id
)
->
update
(
$data
);
$OrderReturnLogModel
->
addLog
(
$return_id
,
$operator_id
,
'填写物流信息,快递名称:'
.
$shipping_id
.
',快递单号:'
.
$shipping_sn
);
DB
::
connection
(
'order'
)
->
commit
();
// 提交事务
return
[
'err_code'
=>
0
,
'err_msg'
=>
'操作成功'
];
}
catch
(
Exception
$e
)
{
DB
::
connection
(
'order'
)
->
rollback
();
// 回滚
return
[
'err_code'
=>
1
,
'err_msg'
=>
'操作失败,原因:'
.
$e
->
getMessage
()];
}
}
}
\ No newline at end of file
public/js/refund.js
View file @
e4b73aae
...
...
@@ -298,7 +298,67 @@
}
})
// 填写物流信息
$
(
'.return-shipping'
).
click
(
function
()
{
var
return_id
=
$
(
this
).
data
(
'id'
);
var
shipping_section
=
''
;
shipping_section
+=
'<div class="form-group">'
+
'<select name="shipping_id" class="shipping_id" style="width: 100%;margin-bottom: 20px;">'
+
'<option value="">请选择快递公司</option>'
;
for
(
var
i
in
shippings_info
)
{
shipping_section
+=
'<option value="'
+
i
+
'">'
+
shippings_info
[
i
]
+
'</option>'
;
}
shipping_section
+=
'<input type="text" class="express_no" name="express_no" value="" style="width:100%;" placeholder="请填写快递单号" />'
+
'</select>'
+
'</div>'
;
layer
.
open
({
area
:
[
'400px'
]
,
title
:
'填写物流信息'
,
content
:
shipping_section
,
btn
:[
'确定'
,
'取消'
]
,
yes
:
function
(
index
,
layero
){
var
shipping_id
=
$
(
'.shipping_id'
).
val
();
var
express_no
=
$
(
'.express_no'
).
val
();
if
(
!
shipping_id
){
layer
.
tips
(
'请选择快递公司'
,
$
(
'.shipping_id'
));
return
false
;
}
if
(
!
express_no
){
layer
.
tips
(
'快递单号不能为空'
,
$
(
'.express_no'
));
return
false
;
}
$
.
ajax
({
url
:
'/ajax/returnShipping'
,
type
:
'post'
,
data
:
{
return_id
:
return_id
,
shipping_id
:
shipping_id
,
shipping_sn
:
express_no
},
dataType
:
'json'
,
success
:
function
(
resp
)
{
if
(
resp
.
err_code
===
0
){
layer
.
msg
(
resp
.
err_msg
||
'操作成功'
);
setTimeout
(
function
(){
location
.
reload
();
},
1000
);
}
else
{
layer
.
alert
(
resp
.
err_msg
||
'网络异常'
);
}
},
error
:
function
(
err
)
{
console
.
log
(
err
)
}
})
}
,
btn2
:
function
(
index
,
layero
){
layer
.
close
(
index
);
}
});
})
},
refund
:
function
()
{
...
...
@@ -408,29 +468,41 @@
}
}
var
order_goods_type
=
$
(
'.order_goods_type'
).
val
();
// 判断创建或编辑
var
return_id
=
$
(
'.return_id'
).
val
();
if
(
order_goods_type
==
1
)
{
var
url
=
'/return_list'
;
if
(
return_id
)
{
var
content
=
'确认修改退货申请?'
;
var
url
=
'/return_edit/'
+
order_id
+
'?return_id='
+
return_id
;
}
else
{
var
url
=
'/self_return_list'
;
var
content
=
'确认提交退货申请?'
;
var
url
=
'/return/'
+
order_id
;
}
layer
.
open
({
title
:
'提示信息'
,
content
:
'确认提交退货申请?'
,
content
:
content
,
btn
:
[
'确认'
,
'取消'
],
yes
:
function
(
index
,
layero
){
$
.
ajax
({
url
:
'/return/'
+
order_id
,
url
:
url
,
type
:
'post'
,
data
:
$
(
'#returnForm'
).
serialize
(),
dataType
:
'json'
,
success
:
function
(
resp
)
{
if
(
resp
.
errcode
===
0
){
// 跳转地址
var
order_goods_type
=
$
(
'.order_goods_type'
).
val
();
if
(
order_goods_type
==
1
)
{
var
redirect_url
=
'/return_list'
;
}
else
{
var
redirect_url
=
'/self_return_list'
;
}
layer
.
msg
(
resp
.
errmsg
||
'操作成功'
);
setTimeout
(
function
(){
location
.
href
=
url
;
// 退货列表
location
.
href
=
redirect_
url
;
// 退货列表
},
1000
);
}
else
{
layer
.
alert
(
resp
.
errmsg
||
'网络异常'
);
...
...
resources/views/detail/content.blade.php
View file @
e4b73aae
...
...
@@ -704,6 +704,11 @@
@include('detail.return')
@endif
@if ($action_name == 'orderReturnEdit')
<!--编辑退货申请-->
@include('detail.return_edit')
@endif
<!-- 人工审单时去掉操作按钮 -->
@if (!isset($_REQUEST['tags'])
&&
$action_name != 'changeOrder'
&&
$action_name != 'sendSales')
<p
style=
"padding-left: 5px;"
>
操作
</p>
...
...
resources/views/detail/return.blade.php
View file @
e4b73aae
...
...
@@ -73,7 +73,7 @@
<td>
<span
class=
"single_return_amount"
></span>
</td>
<td><span>
{{ $v['return_num'] }}
</span></td>
<td><span>
{{ $v['
already_
return_num'] }}
</span></td>
</tr>
@endforeach
</tbody>
...
...
resources/views/detail/return_edit.blade.php
0 → 100644
View file @
e4b73aae
<style>
.bank-input
{
width
:
400px
!important
;
}
</style>
<p
style=
"padding-left: 5px;"
>
编辑退货申请
</p>
<div
class=
"tabs-box"
>
<div
class=
"order-change-main"
>
<form
id=
"returnForm"
class=
"form-horizontal table-responsive"
>
<input
type=
"hidden"
class=
"return_id"
name=
"return_id"
value=
"{{$return['return_id']}}"
>
<input
type=
"hidden"
class=
"order_goods_type"
name=
"order_goods_type"
value=
"{{$return['order_goods_type']}}"
>
<input
type=
"hidden"
name=
"pay_id"
value=
"{{$order_pay_log[0]['pay_id']}}"
>
<!-- 退货方式 -->
<table
class=
"table table-bordered table-hover"
>
<tr>
<th
width=
"20%"
>
退货方式
</th>
<td>
<label
style=
"margin-right: 20px;"
><input
type=
"radio"
class=
"return_way"
name=
"return_info[return_way]"
value=
"1"
>
快递寄送
</label>
<label><input
type=
"radio"
class=
"return_way"
name=
"return_info[return_way]"
value=
"2"
>
自送
</label>
</td>
</tr>
</table>
<!-- 退货型号 -->
<p>
退货型号
</p>
<table
class=
"table table-bordered table-hover return-table"
>
<thead>
<th
width=
"20%"
>
供应商
</th>
<th>
型号
</th>
<th>
出库数量
</th>
<th>
均摊后单价
</th>
<th>
退货数量
</th>
<th
width=
"10%"
>
小计
</th>
<th>
已申请数量
</th>
</thead>
<tbody>
@foreach ($returnItems as $v)
<tr>
<td>
<span>
{{$v['supplier_name']}}
</span>
</td>
<td>
<span>
{{$v['goods_name']}}
</span>
</td>
<td>
<input
type=
"hidden"
class=
"removal_number"
name=
"removal_number"
value=
"{{ $v['removal_number'] }}"
>
<span>
{{$v['removal_number']}}
</span>
</td>
<td>
<input
type=
"hidden"
name=
"return_items_info[{{$v['return_items_id']}}][single_price]"
class=
"single_pre_price"
value=
"{{ $v['single_price'] }}"
>
<span>
{{$v['single_price']}}
</span>
</td>
<td>
<input
class=
"only_number int_num return_num"
name=
"return_items_info[{{$v['return_items_id']}}][return_num]"
value=
"{{$v['return_num']}}"
>
</td>
<td>
<span
class=
"single_return_amount"
>
{{ $v['single_price'] * $v['return_num'] }}
</span>
</td>
<td><span>
{{ $v['already_return_num'] }}
</span></td>
</tr>
@endforeach
</tbody>
</table>
<hr/>
<table
class=
"table table-bordered table-hover"
>
<tr>
<th
width=
"20%"
>
支付金额
</th>
<td>
<p
class=
"text-danger"
>
{{$currency}}
<span
class=
"total"
>
{{ $return['pay_amount'] }}
</span></p>
</td>
</tr>
<tr>
<th>
退款总额
</th>
<td>
<input
type=
"hidden"
class=
"return_amount"
name=
"return_info[return_amount]"
value=
"{{ $return['return_amount'] }}"
>
<span
class=
"return_amount_val"
>
{{ $currency.$return['return_amount'] }}
</span>
</td>
</tr>
<tr>
<th>
退货原因
</th>
<td>
<input
type=
"hidden"
class=
"refund_reason"
name=
"return_info[return_reason]"
value=
"{{ $return['return_reason'] }}"
>
<a
href=
"javascript:;"
class=
"btn btn-default input-cancel-reason"
data-oid=
"{{$order_info['order_id']}}"
data-type=
"5"
>
点击选择
</a>
<span
class=
"refund_reason_val"
>
{{ $return['return_reason'] }}
</span>
</td>
</tr>
<tr>
<th>
退款账号(线下转账必填)
</th>
<td><input
type=
"text"
name=
"return_info[bank_account]"
class=
"bank-input bank_account"
value=
"{{ $return['bank_account'] }}"
placeholder=
"请填写银行账号"
></td>
</tr>
<tr>
<th>
退款银行名称(线下转账必填)
</th>
<td><input
type=
"text"
name=
"return_info[bank_name]"
class=
"bank-input bank_name"
value=
"{{ $return['bank_name'] }}"
placeholder=
"请填写银行名称"
></td>
</tr>
<tr>
<th>
退款支行名称(线下转账必填)
</th>
<td><input
type=
"text"
name=
"return_info[bank_sub_name]"
class=
"bank-input bank_sub_name"
value=
"{{ $return['bank_sub_name'] }}"
placeholder=
"请填写支行名称"
></td>
</tr>
<tr>
<th>
开户人名称(线下转账必填)
</th>
<td><input
type=
"text"
name=
"return_info[bank_user]"
class=
"bank-input bank_user"
value=
"{{ $return['bank_user'] }}"
placeholder=
"请填写开户人名称"
></td>
</tr>
</table>
<a
class=
"btn btn-primary returnApply"
>
提交申请
</a>
</form>
</div>
</div>
<script>
var
currency_sign
=
"{{$currency}}"
;
// 选中退货方式
var
return_way
=
"{{$return['return_way']}}"
;
$
(
'.return_way[value='
+
return_way
+
']'
).
prop
(
'checked'
,
true
);
$
.
lie
.
refund
.
refund
();
</script>
\ No newline at end of file
resources/views/returnDetails/content.blade.php
View file @
e4b73aae
...
...
@@ -81,7 +81,7 @@
<div
class=
"layui-row"
>
<div
class=
"layui-col-xs6 layui-col-sm6 layui-col-md6"
>
<label
class=
"layui-form-label"
>
退货原因:
</label>
<span
class=
"layui-text"
>
{{ $return['return_
cancel
'] }}
</span>
<span
class=
"layui-text"
>
{{ $return['return_
reason
'] }}
</span>
</div>
<div
class=
"layui-col-xs6 layui-col-sm6 layui-col-md6"
>
...
...
resources/views/returnlist/content.blade.php
View file @
e4b73aae
...
...
@@ -131,6 +131,10 @@
<a
class=
"btn btn-info"
href=
"/return_edit/{{$v['order_id']}}?return_id={{$v['return_id']}}"
target=
"_blank"
>
编辑
</a>
@endif
<!-- 审核通过后填写物流信息 -->
@if ($v['status'] == 2)
<a
class=
"btn btn-success return-shipping"
href=
"javascript:;"
data-id=
"{{$v['return_id']}}"
>
填写物流
</a>
@endif
</div>
</td>
</tr>
...
...
@@ -146,6 +150,9 @@
</div>
<script>
var
shippings
=
'{!! json_encode($shippings) !!}'
;
var
shippings_info
=
eval
(
'('
+
shippings
+
')'
);
var
apply_status
=
"{{$condition['apply_status']}}"
;
var
order_payment_mode
=
"{{$condition['order_payment_mode']}}"
;
...
...
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