ZLW-PC\Administrator
7 years ago
23 changed files with 701 additions and 102 deletions
-
113app/Http/Controllers/Admin/AdminController.php
-
26app/Http/Controllers/Admin/AdminRoleController.php
-
2app/Http/Controllers/Admin/GoodsController.php
-
10app/Http/Controllers/Admin/LoginController.php
-
60app/Http/Controllers/Admin/OrderController.php
-
51app/Http/Controllers/Admin/UserController.php
-
50app/Http/Model/Order.php
-
24app/Http/Model/OrderGoods.php
-
64resources/views/admin/admin/add.blade.php
-
67resources/views/admin/admin/edit.blade.php
-
58resources/views/admin/admin/edit222.blade.php
-
26resources/views/admin/admin/index.blade.php
-
0resources/views/admin/admin/register.blade.php
-
4resources/views/admin/adminrole/add.blade.php
-
4resources/views/admin/adminrole/edit.blade.php
-
4resources/views/admin/adminrole/index.blade.php
-
4resources/views/admin/adminrole/permissions.blade.php
-
138resources/views/admin/order/detail.blade.php
-
60resources/views/admin/order/index.blade.php
-
4resources/views/admin/user/add.blade.php
-
4resources/views/admin/user/edit.blade.php
-
4resources/views/admin/user/index.blade.php
-
26routes/web.php
@ -0,0 +1,113 @@ |
|||
<?php |
|||
namespace App\Http\Controllers\Admin; |
|||
|
|||
use App\Http\Controllers\Admin\CommonController; |
|||
use DB; |
|||
|
|||
class AdminController extends CommonController |
|||
{ |
|||
public function __construct() |
|||
{ |
|||
parent::__construct(); |
|||
} |
|||
|
|||
public function index() |
|||
{ |
|||
$posts = parent::pageList('admin'); |
|||
|
|||
$data['posts'] = $posts; |
|||
|
|||
return view('admin.admin.index', $data); |
|||
} |
|||
|
|||
public function add() |
|||
{ |
|||
$data['rolelist'] = object_to_array(DB::table('admin_role')->orderBy('listorder','desc')->get()); |
|||
|
|||
return view('admin.admin.add', $data); |
|||
} |
|||
|
|||
public function doadd() |
|||
{ |
|||
unset($_POST["_token"]); |
|||
$_POST['pwd'] = md5($_POST['pwd']); |
|||
if(DB::table('admin')->insert($_POST)) |
|||
{ |
|||
success_jump('添加成功!', route('admin_admin')); |
|||
} |
|||
else |
|||
{ |
|||
error_jump('添加失败!请修改后重新添加'); |
|||
} |
|||
} |
|||
|
|||
public function edit() |
|||
{ |
|||
if(!empty($_GET["id"])){$id = $_GET["id"];}else{$id="";} |
|||
if(preg_match('/[0-9]*/',$id)){}else{exit;} |
|||
|
|||
$data['id'] = $id; |
|||
$data['post'] = object_to_array(DB::table('admin')->where('id', $id)->first(), 1); |
|||
$data['rolelist'] = object_to_array(DB::table('admin_role')->orderBy('listorder','desc')->get()); |
|||
|
|||
return view('admin.admin.edit', $data); |
|||
} |
|||
|
|||
public function doedit() |
|||
{ |
|||
if(!empty($_POST["id"])){$id = $_POST["id"];unset($_POST["id"]);}else {$id="";exit;} |
|||
|
|||
unset($_POST["_token"]); |
|||
$_POST['pwd'] = md5($_POST['pwd']); |
|||
if(DB::table('admin')->where('id', $id)->update($_POST)) |
|||
{ |
|||
success_jump('修改成功!', route('admin_admin')); |
|||
} |
|||
else |
|||
{ |
|||
error_jump('修改失败!'); |
|||
} |
|||
} |
|||
|
|||
//修改密码
|
|||
/* public function doedit() |
|||
{ |
|||
if(!empty($_POST["id"])){$id = $_POST["id"];unset($_POST["id"]);}else {$id="";exit;} |
|||
unset($_POST["_token"]); |
|||
|
|||
if(!empty($_POST["username"])){$data['username'] = $map['username'] = $_POST["username"];}else{error_jump('用户名不能为空');exit;}//用户名
|
|||
if(!empty($_POST["oldpwd"])){$map['pwd'] = md5($_POST["oldpwd"]);}else{error_jump('旧密码错误');exit;} |
|||
if($_POST["newpwd"]==$_POST["newpwd2"]){$data['pwd'] = md5($_POST["newpwd"]);}else{error_jump('密码错误');exit;} |
|||
if($_POST["oldpwd"]==$_POST["newpwd"]){error_jump('新旧密码不能一致!');exit;} |
|||
|
|||
$User = object_to_array(DB::table("admin")->where($map)->first(), 1); |
|||
|
|||
if($User) |
|||
{ |
|||
if(DB::table('admin')->where('id', $id)->update($data)) |
|||
{ |
|||
session_unset(); |
|||
session_destroy(); |
|||
success_jump('修改成功,请重新登录', route('admin_login'), 3); |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
error_jump('修改失败!旧用户名或密码错误'); |
|||
} |
|||
} */ |
|||
|
|||
public function del() |
|||
{ |
|||
if(!empty($_GET["id"])){$id = $_GET["id"];}else{error_jump('删除失败!请重新提交');} |
|||
|
|||
if(DB::table('admin')->whereIn("id", explode(',', $id))->delete()) |
|||
{ |
|||
success_jump('删除成功'); |
|||
} |
|||
else |
|||
{ |
|||
error_jump('删除失败!请重新提交'); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,64 @@ |
|||
@extends('admin.layouts.app') |
|||
@section('title', '管理员添加') |
|||
|
|||
@section('content') |
|||
<h5 class="sub-header"><a href="<?php echo route('admin_admin'); ?>">管理员列表</a> > 管理员添加</h5> |
|||
|
|||
<form id="addarc" method="post" action="<?php echo route('admin_admin_doadd'); ?>" role="form" enctype="multipart/form-data" class="table-responsive">{{ csrf_field() }} |
|||
<table class="table table-striped table-bordered"> |
|||
<tbody> |
|||
<tr> |
|||
<td align="right">用户名:</td> |
|||
<td><input name="username" type="text" id="username" value="" class="required" style="width:30%" placeholder="在此输入用户名"></td> |
|||
</tr> |
|||
<tr> |
|||
<td align="right">密码:</td> |
|||
<td><input name="pwd" type="password" id="pwd" value="" class="required" style="width:60%"></td> |
|||
</tr> |
|||
<tr> |
|||
<td align="right">邮箱:</td> |
|||
<td><input name="email" type="text" id="email" value="" style="width:60%"></td> |
|||
</tr> |
|||
<tr> |
|||
<td align="right">角色:</td> |
|||
<td> |
|||
<select name="role_id" id="role_id"> |
|||
<?php if($rolelist){foreach($rolelist as $row){ ?>
|
|||
<option value="<?php echo $row["id"]; ?>"><?php echo $row["name"]; ?></option>
|
|||
<?php }} ?>
|
|||
</select> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td colspan="2"><button type="submit" class="btn btn-success" value="Submit">保存(Submit)</button> <button type="reset" class="btn btn-default" value="Reset">重置(Reset)</button><input type="hidden"></input></td> |
|||
</tr> |
|||
</tbody></table></form><!-- 表单结束 --> |
|||
<script> |
|||
$(function(){ |
|||
$(".required").blur(function(){ |
|||
var $parent = $(this).parent(); |
|||
$parent.find(".formtips").remove(); |
|||
if(this.value=="") |
|||
{ |
|||
$parent.append(' <small class="formtips onError"><font color="red">不能为空!</font></small>'); |
|||
} |
|||
else |
|||
{ |
|||
$parent.append(' <small class="formtips onSuccess"><font color="green">OK</font></small>'); |
|||
} |
|||
}); |
|||
|
|||
//重置
|
|||
$('#addarc input[type="reset"]').click(function(){ |
|||
$(".formtips").remove(); |
|||
}); |
|||
|
|||
$("#addarc").submit(function(){ |
|||
$(".required").trigger('blur'); |
|||
var numError = $('#addarc .onError').length; |
|||
|
|||
if(numError){return false;} |
|||
}); |
|||
}); |
|||
</script> |
|||
@endsection |
@ -0,0 +1,67 @@ |
|||
@extends('admin.layouts.app') |
|||
@section('title', '管理员修改') |
|||
|
|||
@section('content') |
|||
<h5 class="sub-header"><a href="<?php echo route('admin_admin'); ?>">管理员列表</a> > 管理员修改</h5> |
|||
|
|||
<form id="addarc" method="post" action="<?php echo route('admin_admin_doedit'); ?>" role="form" enctype="multipart/form-data" class="table-responsive">{{ csrf_field() }} |
|||
<table class="table table-striped table-bordered"> |
|||
<tbody> |
|||
<tr> |
|||
<td align="right">用户名:</td> |
|||
<td><input name="username" type="text" id="username" value="<?php echo $post["username"]; ?>" class="required" style="width:30%" placeholder="在此输入用户名"><input style="display:none;" type="text" name="id" id="id" value="<?php echo $id; ?>"></td> |
|||
</tr> |
|||
<tr> |
|||
<td align="right">密码:</td> |
|||
<td><input name="pwd" type="password" id="pwd" value="" class="required" style="width:30%"></td> |
|||
</tr> |
|||
<tr> |
|||
<td align="right">邮箱:</td> |
|||
<td><input name="email" type="text" id="email" value="<?php echo $post["email"]; ?>" style="width:30%"></td> |
|||
</tr> |
|||
<tr> |
|||
<td align="right">角色:</td> |
|||
<td> |
|||
<select name="role_id" id="role_id"> |
|||
<?php if($rolelist){foreach($rolelist as $row){ ?>
|
|||
<?php if($post["role_id"]==$row["id"]){ ?>
|
|||
<option selected value="<?php echo $row["id"]; ?>"><?php echo $row["name"]; ?></option>
|
|||
<?php }else{ ?>
|
|||
<option value="<?php echo $row["id"]; ?>"><?php echo $row["name"]; ?></option>
|
|||
<?php }}} ?>
|
|||
</select> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td colspan="2"><button type="submit" class="btn btn-success" value="Submit">保存(Submit)</button> <button type="reset" class="btn btn-default" value="Reset">重置(Reset)</button></td> |
|||
</tr> |
|||
</tbody></table></form><!-- 表单结束 --> |
|||
<script> |
|||
$(function(){ |
|||
$(".required").blur(function(){ |
|||
var $parent = $(this).parent(); |
|||
$parent.find(".formtips").remove(); |
|||
if(this.value=="") |
|||
{ |
|||
$parent.append(' <small class="formtips onError"><font color="red">不能为空!</font></small>'); |
|||
} |
|||
else |
|||
{ |
|||
$parent.append(' <small class="formtips onSuccess"><font color="green">OK</font></small>'); |
|||
} |
|||
}); |
|||
|
|||
//重置
|
|||
$('#addarc input[type="reset"]').click(function(){ |
|||
$(".formtips").remove(); |
|||
}); |
|||
|
|||
$("#addarc").submit(function(){ |
|||
$(".required").trigger('blur'); |
|||
var numError = $('#addarc .onError').length; |
|||
|
|||
if(numError){return false;} |
|||
}); |
|||
}); |
|||
</script> |
|||
@endsection |
@ -0,0 +1,58 @@ |
|||
<!DOCTYPE html><html><head><title>密码修改_后台管理</title>@include('admin.common.header') |
|||
<div class="container-fluid"> |
|||
<div class="row"> |
|||
<!-- 左边开始 --><div class="col-sm-3 col-md-2 sidebar">@include('admin.common.leftmenu')</div><!-- 左边结束 --> |
|||
<style>.input-error{background-color:#ffe7e7;}</style>
|
|||
<!-- 右边开始 --><div class="col-sm-9 col-md-10 rightbox"><div id="mainbox"> |
|||
<h2 class="sub-header">密码修改</h2> |
|||
<form id="addarc" method="post" action="/fladmin/user/doedit" class="table-responsive" role="form">{{ csrf_field() }} |
|||
<table class="table table-striped table-bordered"> |
|||
<tbody> |
|||
<tr> |
|||
<td align="right">用户名:</td> |
|||
<td><input name="username" type="text" class="" id="username" value="<?php echo $post["username"]; ?>" style="width:30%"></td> |
|||
</tr> |
|||
<tr> |
|||
<td align="right">旧密码:</td> |
|||
<td><input name="oldpwd" type="password" class="" id="oldpwd" value="" style="width:30%"></td> |
|||
</tr> |
|||
<tr> |
|||
<td align="right">新密码:</td> |
|||
<td><input name="newpwd" type="password" class="" id="newpwd" value="" style="width:30%"></td> |
|||
</tr> |
|||
<tr> |
|||
<td align="right">确认密码:</td> |
|||
<td><input name="newpwd2" type="password" class="" id="newpwd2" value="" style="width:30%"></td> |
|||
</tr> |
|||
<tr> |
|||
<td colspan="2"><button type="submit" class="btn btn-success" value="Submit">保存(Submit)</button> <button type="reset" class="btn btn-default" value="Reset">重置(Reset)</button><input type="hidden"></input></td> |
|||
</tr> |
|||
</tbody></table></form><!-- 表单结束 --> |
|||
</div></div><!-- 右边结束 --></div></div> |
|||
<script> |
|||
$('#addarc input[type="text"], #addarc input[type="password"]').on('focus', function() { |
|||
$(this).removeClass('input-error'); |
|||
}); |
|||
$('#addarc').on('submit', function(e) { |
|||
$(this).find('input[type="text"], input[type="password"]').each(function(){ |
|||
if( $(this).val() == "" ) { |
|||
e.preventDefault(); |
|||
$(this).addClass('input-error'); |
|||
} |
|||
else { |
|||
$(this).removeClass('input-error'); |
|||
} |
|||
}); |
|||
if($('#newpwd').val()!=$('#newpwd2').val() || $('#newpwd').val()=='') |
|||
{ |
|||
e.preventDefault(); |
|||
$('#newpwd').addClass('input-error'); |
|||
$('#newpwd2').addClass('input-error'); |
|||
} |
|||
else { |
|||
$('#newpwd').removeClass('input-error'); |
|||
$('#newpwd2').removeClass('input-error'); |
|||
} |
|||
}); |
|||
</script> |
|||
</body></html> |
@ -0,0 +1,26 @@ |
|||
@extends('admin.layouts.app') |
|||
@section('title', '管理员列表') |
|||
|
|||
@section('content') |
|||
<h2 class="sub-header">管理员列表</h2>[ <a href="<?php echo route('admin_admin_add'); ?>">添加管理员</a> ]<br><br> |
|||
|
|||
<form name="listarc"><div class="table-responsive"><table class="table table-striped table-hover"> |
|||
<thead><tr> |
|||
<th>ID</th> |
|||
<th>用户名</th> |
|||
<th>邮箱</th> |
|||
<th>状态</th> |
|||
<th>管理</th> |
|||
</tr></thead> |
|||
<tbody> |
|||
<?php foreach($posts as $row){ ?><tr>
|
|||
<td><?php echo $row->id; ?></td>
|
|||
<td><?php echo $row->username; ?></td>
|
|||
<td><?php echo $row->email; ?></td>
|
|||
<td><?php if($row->status==0){echo '正常';}elseif($row->status==1){echo '禁用';}elseif($row->status==2){echo '禁用';} ?></td>
|
|||
<td><a href="<?php echo route('admin_admin_edit'); ?>?id=<?php echo $row->id; ?>">修改</a><?php if($row->id<>1){ ?> | <a onclick="delconfirm('<?php echo route('admin_admin_del'); ?>?id=<?php echo $row->id; ?>')" href="javascript:;">删除</a><?php } ?></td>
|
|||
</tr><?php } ?>
|
|||
</tbody></table></div><!-- 表格结束 --></form><!-- 表单结束 --> |
|||
|
|||
<nav aria-label="Page navigation">{{ $posts->links() }}</nav> |
|||
@endsection |
@ -0,0 +1,138 @@ |
|||
@extends('admin.layouts.app') |
|||
@section('title', '订单列表') |
|||
|
|||
@section('content') |
|||
<script language="javascript" type="text/javascript" src="http://<?php echo env('APP_DOMAIN'); ?>/js/My97DatePicker/WdatePicker.js"></script> |
|||
|
|||
<div class="bg-info" style="margin:10px 0;padding:10px;"> |
|||
<div class="form-inline"> |
|||
<div class="form-group"> |
|||
当前可执行操作: |
|||
</div> |
|||
<button class="btn btn-info" onclick="show_search()">发货</button> |
|||
<button class="btn btn-success">设为付款</button> |
|||
<button class="btn btn-danger" onclick="show_search()">设为无效</button> |
|||
</div> |
|||
<div style="clear:both;"></div> |
|||
</div> |
|||
|
|||
<h3 class="sub-header">基本信息</h3> |
|||
<!-- 表格开始 --> |
|||
<div class="table-responsive"><table class="table table-hover table-bordered"> |
|||
<thead><tr class="info"> |
|||
<th>订单编号</th> |
|||
<th>订单状态</th> |
|||
<th>下单人</th> |
|||
<th>下单时间</th> |
|||
<th>支付方式</th> |
|||
<th>支付时间</th> |
|||
<th>配送方式</th> |
|||
<th>快递单号</th> |
|||
<th>发货时间</th> |
|||
</tr></thead> |
|||
<tbody> |
|||
<tr> |
|||
<td><?php echo $post['order_sn']; ?></td>
|
|||
<td><font color="red"><?php echo $post['order_status_text']; ?></font></td>
|
|||
<td><?php if($post['user']['mobile']){echo $post['user']['mobile'];}else{echo $post['user']['user_name'];} ?></td>
|
|||
<td><?php echo date('Y-m-d H:i:s',$post['add_time']); ?></td>
|
|||
<td><?php echo $post['pay_name']; ?></td>
|
|||
<td><?php if($post['pay_time']){echo date('Y-m-d H:i:s',$post['pay_time']);} ?></td>
|
|||
<td><?php echo $post['shipping_name']; ?></td>
|
|||
<td><?php echo $post['shipping_sn']; ?></td>
|
|||
<td><?php if($post['shipping_time']){echo date('Y-m-d H:i:s',$post['shipping_time']);} ?></td>
|
|||
</tr> |
|||
<tr> |
|||
<td colspan="1">订单来源:<?php echo $post['place_type_text']; ?></td>
|
|||
<td colspan="8">客户留言:<?php echo $post['message']; ?></td>
|
|||
</tr> |
|||
</tbody> |
|||
</table></div><!-- 表格结束 --> |
|||
|
|||
<h3 class="sub-header">收货人信息</h3> |
|||
<!-- 表格开始 --> |
|||
<div class="table-responsive"><table class="table table-hover table-bordered"> |
|||
<thead><tr class="info"> |
|||
<th>收货人姓名</th> |
|||
<th>电话</th> |
|||
<th>详细地址</th> |
|||
</tr></thead> |
|||
<tbody> |
|||
<tr> |
|||
<td><?php echo $post['name']; ?></td>
|
|||
<td><?php echo $post['mobile']; ?></td>
|
|||
<td><?php echo $post['province_name'].$post['city_name'].$post['district_name'].' '.$post['address']; ?></td>
|
|||
</tr> |
|||
</tbody> |
|||
</table></div><!-- 表格结束 --> |
|||
|
|||
<h3 class="sub-header">商品信息</h3> |
|||
<!-- 表格开始 --> |
|||
<div class="table-responsive"><table class="table table-striped table-hover table-bordered"> |
|||
<thead><tr class="info"> |
|||
<th>商品缩略图</th> |
|||
<th>商品名称</th> |
|||
<th>商品价格</th> |
|||
<th>数量</th> |
|||
<th>合计</th> |
|||
<th>退货/退款</th> |
|||
<th>退货退款理由</th> |
|||
</tr></thead> |
|||
<tbody> |
|||
<?php if($post['goodslist']){foreach($post['goodslist'] as $k=>$v){ ?>
|
|||
<tr> |
|||
<td width="98px"><img src="<?php echo $v['goods_img']; ?>" style="width:80px;height:60px;"></td> |
|||
<td><?php echo $v['goods_name']; ?></td>
|
|||
<td><?php echo $v['goods_price']; ?></td>
|
|||
<td><?php echo $v['goods_number']; ?></td>
|
|||
<td><font color="red"><?php echo $v['goods_price']*$v['goods_number']; ?></font></td>
|
|||
<td><?php echo $v['refund_status_text']; ?></td>
|
|||
<td><?php echo $v['refund_reason']; ?></td>
|
|||
</tr> |
|||
<?php }} ?>
|
|||
</tbody> |
|||
</table></div><!-- 表格结束 --> |
|||
|
|||
<?php if(empty($post['invoice']) || $post['invoice']!=0){ ?>
|
|||
<h3 class="sub-header">发票信息</h3> |
|||
<!-- 表格开始 --> |
|||
<div class="table-responsive"><table class="table table-hover table-bordered"> |
|||
<thead><tr class="info"> |
|||
<th>发票类型</th> |
|||
<th>发票抬头</th> |
|||
<th>纳税人识别号</th> |
|||
</tr></thead> |
|||
<tbody> |
|||
<tr> |
|||
<td><?php echo $post['invoice_text']; ?></td>
|
|||
<td><?php echo $post['invoice_title']; ?></td>
|
|||
<td><?php echo $post['invoice_taxpayer_number']; ?></td>
|
|||
</tr> |
|||
</tbody> |
|||
</table></div><!-- 表格结束 --> |
|||
<?php } ?>
|
|||
|
|||
<h3 class="sub-header">费用结算</h3> |
|||
<!-- 表格开始 --> |
|||
<div class="table-responsive"><table class="table table-hover table-bordered"> |
|||
<thead><tr class="info"> |
|||
<th>商品总金额</th> |
|||
<th>邮费</th> |
|||
<th>优惠券</th> |
|||
<th>积分</th> |
|||
<th>其它费用</th> |
|||
<th>应付金额</th> |
|||
</tr></thead> |
|||
<tbody> |
|||
<tr> |
|||
<td><?php echo $post['goods_amount']; ?></td>
|
|||
<td>+<?php echo $post['shipping_fee']; ?></td>
|
|||
<td>-<?php echo $post['bonus_money']; ?></td>
|
|||
<td>-<?php echo $post['integral_money']; ?></td>
|
|||
<td>-<?php echo $post['discount']; ?></td>
|
|||
<td><font color="red"><?php echo $post['order_amount']; ?></font></td>
|
|||
</tr> |
|||
</tbody> |
|||
</table></div><!-- 表格结束 --> |
|||
|
|||
@endsection |
Write
Preview
Loading…
Cancel
Save
Reference in new issue