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
dd356d7b
authored
Jun 10, 2019
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
退货单审核
parent
c465c8a1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
110 additions
and
10 deletions
app/Http/Controllers/ReturnController.php
app/Http/routes.php
app/Model/OrderReturnLogModel.php
app/Model/OrderReturnModel.php
public/js/refund.js
resources/views/returnDetails/content.blade.php
app/Http/Controllers/ReturnController.php
View file @
dd356d7b
...
...
@@ -175,5 +175,13 @@ class ReturnController extends Controller
return
view
(
'returnDetails'
,
$info
);
}
// 退货单审核
public
function
returnCheck
(
Request
$request
)
{
if
(
$request
->
isMethod
(
'post'
))
{
$OrderReturnModel
=
new
OrderReturnModel
();
return
$OrderReturnModel
->
check
(
$request
);
}
}
}
app/Http/routes.php
View file @
dd356d7b
...
...
@@ -127,6 +127,7 @@ 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'
);
});
// 不需要登陆态
...
...
app/Model/OrderReturnLogModel.php
View file @
dd356d7b
...
...
@@ -13,4 +13,24 @@ class OrderReturnLogModel extends Model
protected
$primaryKey
=
'return_log_id'
;
public
$timestamps
=
false
;
/**
* 创建退货记录
* @param [type] $return_id [退货单ID]
* @param [type] $operator_id [操作人ID]
* @param [type] $event [操作事件]
*/
public
function
addLog
(
$return_id
,
$operator_id
,
$event
)
{
$operator
=
DB
::
table
(
'user_info'
)
->
where
(
'userId'
,
$operator_id
)
->
select
(
'name'
)
->
first
();
// 操作人名称
$return_log
[
'return_id'
]
=
$return_id
;
$return_log
[
'operator_id'
]
=
$operator_id
;
$return_log
[
'operator_name'
]
=
$operator
->
name
;
$return_log
[
'event'
]
=
$event
;
$return_log
[
'ip'
]
=
get_client_ip
(
0
,
true
);
$return_log
[
'create_time'
]
=
time
();
return
$this
->
insert
(
$return_log
);
}
}
\ No newline at end of file
app/Model/OrderReturnModel.php
View file @
dd356d7b
...
...
@@ -23,7 +23,7 @@ class OrderReturnModel extends Model
// 获取退货单记录
public
function
hasManyReturnLog
()
{
return
$this
->
hasMany
(
'App\Model\OrderReturnLogModel'
,
'return_id'
,
'return_id'
);
return
$this
->
hasMany
(
'App\Model\OrderReturnLogModel'
,
'return_id'
,
'return_id'
)
->
orderBy
(
'create_time'
,
'desc'
)
;
}
// 联营订单导出
...
...
@@ -320,4 +320,41 @@ class OrderReturnModel extends Model
return
$tmp
;
}
// 审核
public
function
check
(
$request
)
{
$return_id
=
$request
->
input
(
'return_id'
);
$type
=
$request
->
input
(
'type'
);
$operator_id
=
$request
->
user
->
userId
;
if
(
$type
==
2
)
{
$update
[
'syn_sign'
]
=
1
;
// 标记wms同步
$event
=
'审核通过退货单'
;
}
else
{
$update
[
'refund_reason'
]
=
$request
->
input
(
'refund_reason'
);
$event
=
'驳回退货单,原因:'
.
$refund_reason
;
}
$update
[
'status'
]
=
$type
;
$update
[
'audit_uid'
]
=
$operator_id
;
$update
[
'audit_time'
]
=
time
();
try
{
DB
::
connection
(
'order'
)
->
beginTransaction
();
// 开启事务
$OrderReturnLogModel
=
new
OrderReturnLogModel
();
$this
->
where
(
'return_id'
,
$return_id
)
->
update
(
$update
);
$OrderReturnLogModel
->
addLog
(
$return_id
,
$operator_id
,
$event
);
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 @
dd356d7b
...
...
@@ -354,21 +354,53 @@
var
type
=
$
(
this
).
data
(
'type'
);
var
title
=
''
;
var
content
=
''
;
var
data
=
{
return_id
:
return_id
,
type
:
type
};
if
(
type
==
1
)
{
// 审核通过
if
(
type
==
2
)
{
// 审核通过
title
=
'审核退货单'
;
content
=
'确定审核通过吗?'
;
}
else
{
}
else
{
// 驳回
title
=
'驳回退货单'
;
content
=
'<div><textarea name="refuse_reason"
id="refuse_reason" cols="30" rows="10
"></textarea></div>'
;
content
=
'<div><textarea name="refuse_reason"
class="form-control" id="refuse_reason" cols="30" rows="5" placeholder="填写驳回原因
"></textarea></div>'
;
}
layer
.
open
({
title
:
title
,
content
:
content
,
btn
s
:
[
'确定'
,
'取消'
],
btn
:
[
'确定'
,
'取消'
],
yes
:
function
()
{
if
(
type
==
-
2
)
{
var
refuse_reason
=
$
(
'#refuse_reason'
).
val
();
if
(
!
refuse_reason
)
{
layer
.
tips
(
'驳回原因不能为空'
,
$
(
'#refuse_reason'
));
return
false
;
}
data
.
refuse_reason
=
refuse_reason
;
}
$
.
ajax
({
url
:
'/ajax/returnCheck'
,
type
:
'post'
,
data
:
data
,
success
:
function
(
resp
){
if
(
resp
.
err_code
==
0
)
{
layer
.
msg
(
resp
.
err_msg
);
setTimeout
(
function
(){
location
.
reload
();
},
1000
);
return
false
;
}
layer
.
alert
(
resp
.
err_msg
);
},
error
:
function
(
err
)
{
console
.
log
(
err
)
}
})
}
})
})
...
...
resources/views/returnDetails/content.blade.php
View file @
dd356d7b
...
...
@@ -143,11 +143,11 @@
</div>
</div>
<!-- 管理员、经理、自营客服主管审核 -->
@if (in_array($role, [1, 2, 10]))
<!-- 管理员、经理、自营客服主管审核
&& 待审核状态
-->
@if (in_array($role, [1, 2, 10])
&&
$return['status'] == 1
)
<div
class=
"text-center"
style=
"margin-bottom: 10px;"
>
<button
class=
"btn btn-info return-check"
style=
"margin-right: 10px;"
data-type=
"
1
"
data-id=
"{{ $return['return_id'] }}"
>
审核通过
</button>
<button
class=
"btn btn-danger return-check"
data-type=
"-
1
"
data-id=
"{{ $return['return_id'] }}"
>
驳回
</button>
<button
class=
"btn btn-info return-check"
style=
"margin-right: 10px;"
data-type=
"
2
"
data-id=
"{{ $return['return_id'] }}"
>
审核通过
</button>
<button
class=
"btn btn-danger return-check"
data-type=
"-
2
"
data-id=
"{{ $return['return_id'] }}"
>
驳回
</button>
</div>
@endif
</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