Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
backend
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
亲子游项目
backend
Commits
4bc09007
Commit
4bc09007
authored
Dec 18, 2018
by
LiuJunYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
订单修改状态
parent
dca5bec1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
41 deletions
+56
-41
application/admin/controller/Order.php
+56
-41
application/admin/view/order/index.html
+0
-0
No files found.
application/admin/controller/Order.php
View file @
4bc09007
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
namespace
app\admin\controller
;
namespace
app\admin\controller
;
use
app\admin\controller\AuthBase
;
use
app\admin\controller\AuthBase
;
use
app\common\model\Orders
;
use
app\common\model\Refund
;
use
app\common\model\Refund
;
use
app\common\utils\WXSendMessage
;
use
app\common\utils\WXSendMessage
;
use
think\Db
;
use
think\Db
;
...
@@ -26,12 +27,12 @@ class Order extends AuthBase
...
@@ -26,12 +27,12 @@ class Order extends AuthBase
public
function
index
()
public
function
index
()
{
{
//搜索筛选
//搜索筛选
$status
=
input
(
'get.status'
,
'-1'
);
$status
=
input
(
'get.status'
,
'-1'
);
$id
=
input
(
'get.id'
);
$id
=
input
(
'get.id'
);
$start_time
=
input
(
'get.start_time'
);
$start_time
=
input
(
'get.start_time'
);
$end_time
=
input
(
'get.end_time'
);
$end_time
=
input
(
'get.end_time'
);
$type
=
input
(
'get.type'
);
$type
=
input
(
'get.type'
);
$condition
=
[];
$condition
=
[];
//判断如果存在筛选字段,将其添加到筛选数组$condition中
//判断如果存在筛选字段,将其添加到筛选数组$condition中
if
(
$status
!=
'-1'
)
{
if
(
$status
!=
'-1'
)
{
...
@@ -52,16 +53,16 @@ class Order extends AuthBase
...
@@ -52,16 +53,16 @@ class Order extends AuthBase
$condition
[
'created_at'
]
=
[
'<'
,
$end_time
.
' 00:00:00'
];
$condition
[
'created_at'
]
=
[
'<'
,
$end_time
.
' 00:00:00'
];
}
}
}
}
if
(
input
(
'get.title'
))
{
if
(
input
(
'get.title'
))
{
$condition
[
'title'
]
=
[
'like'
,
'%'
.
input
(
'get.title'
)
.
'%'
];
$condition
[
'title'
]
=
[
'like'
,
'%'
.
input
(
'get.title'
)
.
'%'
];
}
}
//根据筛选条件查询
//根据筛选条件查询
$order_list
=
$this
->
order_model
->
with
([
'project'
=>
function
(
$query
)
{
$order_list
=
$this
->
order_model
->
with
([
'project'
=>
function
(
$query
)
{
}])
->
where
(
$condition
)
->
order
(
'created_at desc'
)
->
paginate
(
10
,
false
,
[
'query'
=>
[
'status'
=>
$status
,
'start_time'
=>
$start_time
,
'end_time'
=>
$end_time
,
'type'
=>
$type
]])
->
each
(
function
(
$item
)
{
}])
->
where
(
$condition
)
->
order
(
'created_at desc'
)
->
paginate
(
10
,
false
,
[
'query'
=>
[
'status'
=>
$status
,
'start_time'
=>
$start_time
,
'end_time'
=>
$end_time
,
'type'
=>
$type
]])
->
each
(
function
(
$item
)
{
$project
=
\app\common\model\Project
::
withTrashed
()
->
find
(
$item
[
'pid'
]);
$project
=
\app\common\model\Project
::
withTrashed
()
->
find
(
$item
[
'pid'
]);
$item
[
'project_poster'
]
=
$project
[
'poster'
];
$item
[
'project_poster'
]
=
$project
[
'poster'
];
$item
[
'project_title'
]
=
$project
[
'title'
];
$item
[
'project_title'
]
=
$project
[
'title'
];
});
});
$this
->
assign
(
"order_list"
,
$order_list
);
$this
->
assign
(
"order_list"
,
$order_list
);
$this
->
assign
(
"status"
,
$status
);
$this
->
assign
(
"status"
,
$status
);
...
@@ -72,11 +73,11 @@ class Order extends AuthBase
...
@@ -72,11 +73,11 @@ class Order extends AuthBase
public
function
orderOutput
()
public
function
orderOutput
()
{
{
//根据筛选条件查询数据
//根据筛选条件查询数据
$status
=
input
(
'get.status'
,
'-1'
);
$status
=
input
(
'get.status'
,
'-1'
);
$start_time
=
input
(
'get.start_time'
);
$start_time
=
input
(
'get.start_time'
);
$end_time
=
input
(
'get.end_time'
);
$end_time
=
input
(
'get.end_time'
);
$type
=
input
(
'get.type'
);
$type
=
input
(
'get.type'
);
$condition
=
[];
$condition
=
[];
if
(
$status
!=
'-1'
)
{
if
(
$status
!=
'-1'
)
{
$condition
[
'status'
]
=
$status
;
$condition
[
'status'
]
=
$status
;
}
}
...
@@ -95,11 +96,11 @@ class Order extends AuthBase
...
@@ -95,11 +96,11 @@ class Order extends AuthBase
$order_list
=
$this
->
order_model
->
where
(
$condition
)
->
order
(
'created_at desc'
)
->
select
();
$order_list
=
$this
->
order_model
->
where
(
$condition
)
->
order
(
'created_at desc'
)
->
select
();
//导出用户信息、活动信息、订单信息,如:姓名、手机号、活动名称、价格、家庭组数、大人数量、孩子数量、孩子年龄、备注等
//导出用户信息、活动信息、订单信息,如:姓名、手机号、活动名称、价格、家庭组数、大人数量、孩子数量、孩子年龄、备注等
//导出到excel之前数据处理
//导出到excel之前数据处理
$mulit_arr
=
[];
$mulit_arr
=
[];
$mulit_arr
[
'data'
]
=
[];
$mulit_arr
[
'data'
]
=
[];
$cont
=
[[
'订单标题'
,
'订单来源'
,
'用户名'
,
'电话'
,
'vip购买信息'
,
'活动名称'
,
'活动价格'
,
'家庭组数'
,
'大人数量'
,
'孩子数量'
,
'孩子年龄'
,
'订单总价'
,
'下单时间'
,
'订单状态'
]];
$cont
=
[[
'订单标题'
,
'订单来源'
,
'用户名'
,
'电话'
,
'vip购买信息'
,
'活动名称'
,
'活动价格'
,
'家庭组数'
,
'大人数量'
,
'孩子数量'
,
'孩子年龄'
,
'订单总价'
,
'下单时间'
,
'订单状态'
]];
foreach
(
$order_list
as
$vo
)
{
foreach
(
$order_list
as
$vo
)
{
$arr
=
[];
$arr
=
[];
$arr
[]
=
$vo
[
'title'
];
$arr
[]
=
$vo
[
'title'
];
$arr
[]
=
$vo
[
'type'
]
==
1
?
'活动报名'
:
'购买会员卡订单'
;
$arr
[]
=
$vo
[
'type'
]
==
1
?
'活动报名'
:
'购买会员卡订单'
;
$arr
[]
=
$vo
->
user_info
[
'nickname'
];
$arr
[]
=
$vo
->
user_info
[
'nickname'
];
...
@@ -118,14 +119,14 @@ class Order extends AuthBase
...
@@ -118,14 +119,14 @@ class Order extends AuthBase
$cont
[]
=
$arr
;
$cont
[]
=
$arr
;
}
}
$mulit_arr
[
'data'
][]
=
$cont
;
$mulit_arr
[
'data'
][]
=
$cont
;
$mulit_arr
[
'sheet'
]
=
[[
'title'
=>
'用户信息表'
]];
$mulit_arr
[
'sheet'
]
=
[[
'title'
=>
'用户信息表'
]];
$title
=
'订单表'
;
//这是标题
$title
=
'订单表'
;
//这是标题
$Subject
=
''
;
//这是备注
$Subject
=
''
;
//这是备注
$Description
=
'美行者订单导出'
;
//这是描述;
$Description
=
'美行者订单导出'
;
//这是描述;
$Keywords
=
''
;
//这是关键字
$Keywords
=
''
;
//这是关键字
$Category
=
''
;
//这是分类
$Category
=
''
;
//这是分类
$filename
=
'美行者订单导出'
;
//文件名
$filename
=
'美行者订单导出'
;
//文件名
$obj
=
new
OutputExcel
();
$obj
=
new
OutputExcel
();
/*调用excle导出类*/
/*调用excle导出类*/
$obj
->
export
(
$mulit_arr
,
$filename
,
$title
,
$Subject
,
$Description
,
$Keywords
,
$Category
);
$obj
->
export
(
$mulit_arr
,
$filename
,
$title
,
$Subject
,
$Description
,
$Keywords
,
$Category
);
}
}
...
@@ -133,8 +134,8 @@ class Order extends AuthBase
...
@@ -133,8 +134,8 @@ class Order extends AuthBase
//退款审核 未完成
//退款审核 未完成
public
function
refund
()
public
function
refund
()
{
{
$id
=
input
(
'get.id'
);
$id
=
input
(
'get.id'
);
$status
=
input
(
'get.status'
,
'-1'
);
$status
=
input
(
'get.status'
,
'-1'
);
$condition
=
[];
$condition
=
[];
if
(
$status
!=
'-1'
)
{
if
(
$status
!=
'-1'
)
{
$condition
[
'status'
]
=
$status
;
$condition
[
'status'
]
=
$status
;
...
@@ -151,8 +152,8 @@ class Order extends AuthBase
...
@@ -151,8 +152,8 @@ class Order extends AuthBase
//评论审核
//评论审核
public
function
comment
()
public
function
comment
()
{
{
$id
=
input
(
'get.id'
);
$id
=
input
(
'get.id'
);
$status
=
input
(
'get.status'
,
'-1'
);
$status
=
input
(
'get.status'
,
'-1'
);
$condition
=
[];
$condition
=
[];
if
(
$status
!=
'-1'
)
{
if
(
$status
!=
'-1'
)
{
$condition
[
'status'
]
=
$status
;
$condition
[
'status'
]
=
$status
;
...
@@ -169,7 +170,7 @@ class Order extends AuthBase
...
@@ -169,7 +170,7 @@ class Order extends AuthBase
public
function
commentStatus
(
$status
,
$id
)
public
function
commentStatus
(
$status
,
$id
)
{
{
$comment_model
=
model
(
'comment'
);
$comment_model
=
model
(
'comment'
);
$res
=
$comment_model
->
save
([
'status'
=>
$status
],
[
'id'
=>
$id
]);
$res
=
$comment_model
->
save
([
'status'
=>
$status
],
[
'id'
=>
$id
]);
if
(
$status
==
2
)
{
if
(
$status
==
2
)
{
$is_comment
=
3
;
$is_comment
=
3
;
}
elseif
(
$status
==
3
)
{
}
elseif
(
$status
==
3
)
{
...
@@ -182,9 +183,9 @@ class Order extends AuthBase
...
@@ -182,9 +183,9 @@ class Order extends AuthBase
if
(
$res
)
{
if
(
$res
)
{
$comment_info
=
$comment_model
->
get
(
$id
);
$comment_info
=
$comment_model
->
get
(
$id
);
if
(
$comment_info
)
{
if
(
$comment_info
)
{
$save_condition
=
[];
$save_condition
=
[];
$save_condition
[
'is_comment'
]
=
$is_comment
;
$save_condition
[
'is_comment'
]
=
$is_comment
;
$order_info
=
model
(
'order'
)
->
get
(
$comment_info
[
'order_id'
]);
$order_info
=
model
(
'order'
)
->
get
(
$comment_info
[
'order_id'
]);
if
(
$status
==
2
)
{
if
(
$status
==
2
)
{
//评论审核成功
//评论审核成功
//如果订单状态为待评价,则修改状态为已完成
//如果订单状态为待评价,则修改状态为已完成
...
@@ -210,7 +211,7 @@ class Order extends AuthBase
...
@@ -210,7 +211,7 @@ class Order extends AuthBase
public
function
refundStatus
(
$status
,
$id
)
public
function
refundStatus
(
$status
,
$id
)
{
{
$refund_model
=
model
(
'refund'
);
$refund_model
=
model
(
'refund'
);
$res
=
$refund_model
->
save
([
'status'
=>
$status
],
[
'id'
=>
$id
]);
$res
=
$refund_model
->
save
([
'status'
=>
$status
],
[
'id'
=>
$id
]);
if
(
$status
==
2
)
{
if
(
$status
==
2
)
{
$is_refund
=
3
;
$is_refund
=
3
;
}
elseif
(
$status
==
3
)
{
}
elseif
(
$status
==
3
)
{
...
@@ -247,10 +248,10 @@ class Order extends AuthBase
...
@@ -247,10 +248,10 @@ class Order extends AuthBase
Db
::
startTrans
();
Db
::
startTrans
();
try
{
try
{
//修改订单状态
//修改订单状态
$refund
->
status
=
2
;
$refund
->
status
=
2
;
$order
->
is_refund
=
3
;
$order
->
is_refund
=
3
;
$order
->
status
=
3
;
$order
->
status
=
3
;
$project
=
\app\common\model\Project
::
get
(
$order
->
pid
);
$project
=
\app\common\model\Project
::
get
(
$order
->
pid
);
$project
->
sign_num
=
$project
->
sign_num
-
$order
[
'extras'
][
'sign_limits'
];
$project
->
sign_num
=
$project
->
sign_num
-
$order
[
'extras'
][
'sign_limits'
];
$refund
->
save
();
//修改退款列表状态
$refund
->
save
();
//修改退款列表状态
$order
->
save
();
//修改订单状态
$order
->
save
();
//修改订单状态
...
@@ -270,11 +271,11 @@ class Order extends AuthBase
...
@@ -270,11 +271,11 @@ class Order extends AuthBase
Db
::
commit
();
Db
::
commit
();
//发送消息模板
//发送消息模板
$openId
=
\app\common\model\User
::
get
(
$order
->
uid
)[
'openid'
];
$openId
=
\app\common\model\User
::
get
(
$order
->
uid
)[
'openid'
];
$template_id
=
config
(
'wxapp.template_id_refund'
);
$template_id
=
config
(
'wxapp.template_id_refund'
);
$page
=
config
(
'wxapp.page'
);
$page
=
config
(
'wxapp.page'
);
$form_id
=
$order
->
prepay_id
;
$form_id
=
$order
->
prepay_id
;
$param
=
[
$param
=
[
$order
->
out_trade_no
,
$order
->
out_trade_no
,
$order
->
title
,
$order
->
title
,
$order
->
total_fee
,
$order
->
total_fee
,
...
@@ -305,9 +306,23 @@ class Order extends AuthBase
...
@@ -305,9 +306,23 @@ class Order extends AuthBase
}
}
$refund
->
status
=
3
;
$refund
->
status
=
3
;
$refund
->
save
();
$refund
->
save
();
$order
=
\app\common\model\Order
::
get
(
$refund
->
order_id
);
$order
=
\app\common\model\Order
::
get
(
$refund
->
order_id
);
$order
->
is_refund
=
2
;
$order
->
is_refund
=
2
;
$order
->
save
();
$order
->
save
();
return
[
'code'
=>
0
,
'msg'
=>
'驳回成功'
];
return
[
'code'
=>
0
,
'msg'
=>
'驳回成功'
];
}
}
//修改带评论状态
public
function
modiflyComment
()
{
try
{
Orders
::
update
([
'id'
=>
input
(
'id'
),
'status'
=>
2
]);
return
[
'code'
=>
0
,
'msg'
=>
'操作成功'
];
}
catch
(
Exception
$e
)
{
return
[
'code'
=>
1
,
'msg'
=>
'操作失败'
];
}
}
}
}
application/admin/view/order/index.html
View file @
4bc09007
This diff is collapsed.
Click to expand it.
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