diff --git a/app/Http/Controllers/Admin/OrderController.php b/app/Http/Controllers/Admin/OrderController.php new file mode 100644 index 0000000..bd4d798 --- /dev/null +++ b/app/Http/Controllers/Admin/OrderController.php @@ -0,0 +1,129 @@ +where('order_sn', 'like', '%'.$_REQUEST['keyword'].'%')->orWhere("name", "like", '%'.$_REQUEST['keyword'].'%'); + } + + //0或者不传表示全部,1待付款,2待发货,3待收货,4待评价(确认收货,交易成功),5退款/售后 + if(isset($_REQUEST["status"])) + { + if($_REQUEST["status"] == 1) + { + $query->where(array('order_status'=>0,'pay_status'=>0)); + } + elseif($_REQUEST["status"] == 2) + { + $query->where(array('order_status'=>0,'shipping_status'=>0,'pay_status'=>1)); + } + elseif($_REQUEST["status"] == 3) + { + $query->where(array('order_status'=>0,'refund_status'=>0,'shipping_status'=>1,'pay_status'=>1)); + } + elseif($_REQUEST["status"] == 4) + { + $query->where(array('order_status'=>3,'refund_status'=>0,'shipping_status'=>2,'is_comment'=>0)); + } + elseif($_REQUEST["status"] == 5) + { + $query->where(array('order_status'=>3,'refund_status'=>1)); + } + } + + $query->where('is_delete', 0); //未删除 + }; + + $posts = parent::pageList('order', $where); + foreach($posts as $key=>$value) + { + $order_status_arr = Order::getOrderStatusText(object_to_array($value, 1)); + $posts[$key]->order_status_text = $order_status_arr?$order_status_arr['text']:''; + $posts[$key]->order_status_num = $order_status_arr?$order_status_arr['num']:''; + } + + $data['posts'] = $posts; + + return view('admin.order.index', $data); + } + + public function doadd() + { + $_POST['add_time'] = time();//更新时间 + $_POST['click'] = rand(200,500);//点击 + + unset($_POST["_token"]); + if(isset($_POST['editorValue'])){unset($_POST['editorValue']);} + + if(Order::insert($_POST)) + { + success_jump('添加成功!', route('admin_order')); + } + else + { + error_jump('添加失败!请修改后重新添加'); + } + } + + public function add() + { + return view('admin.order.add'); + } + + 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'] = Order::where('id', $id)->first(); + + return view('admin.order.edit', $data); + } + + public function doedit() + { + if(!empty($_POST["id"])){$id = $_POST["id"];unset($_POST["id"]);}else {$id="";exit;} + + unset($_POST["_token"]); + if(isset($_POST['editorValue'])){unset($_POST['editorValue']);} + + if(Order::where('id', $id)->update($_POST)) + { + success_jump('修改成功!', route('admin_order')); + } + else + { + error_jump('修改失败!请修改后重新添加'); + } + } + + public function del() + { + if(!empty($_GET["id"])){$id = $_GET["id"];}else{error_jump("删除失败!请重新提交");} //if(preg_match('/[0-9]*/',$id)){}else{exit;} + + if(Order::whereIn("id", explode(',', $id))->update(array('is_delete'=>1))) + { + success_jump('删除成功'); + } + else + { + error_jump("删除失败!请重新提交"); + } + } +} \ No newline at end of file diff --git a/app/Http/Model/Order.php b/app/Http/Model/Order.php index b0c633c..5cf3634 100644 --- a/app/Http/Model/Order.php +++ b/app/Http/Model/Order.php @@ -149,7 +149,7 @@ class Order extends BaseModel //构造订单字段 $order_info = array( - 'order_sn' => date('YmdHis'.rand(1000,9999)), + 'order_sn' => date('YmdHis').rand(1000,9999), 'add_time' => time(), 'pay_status' => $pay_status, 'user_id' => $user_id, diff --git a/app/Http/Model/UserRecharge.php b/app/Http/Model/UserRecharge.php index 9815449..e2452d7 100644 --- a/app/Http/Model/UserRecharge.php +++ b/app/Http/Model/UserRecharge.php @@ -52,7 +52,7 @@ class UserRecharge extends BaseModel public static function add(array $data) { - $data['recharge_sn'] = date('YmdHis'.rand(1000,9999)); + $data['recharge_sn'] = date('YmdHis').rand(1000,9999); if ($id = self::insertGetId($data)) { diff --git a/resources/views/admin/order/add.blade.php b/resources/views/admin/order/add.blade.php new file mode 100644 index 0000000..6f4c749 --- /dev/null +++ b/resources/views/admin/order/add.blade.php @@ -0,0 +1,133 @@ +@extends('admin.layouts.app') +@section('title', '品牌添加') + +@section('content') +
品牌列表 > 品牌添加
+ +
{{ csrf_field() }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
名称:
是否显示: +  是   +  否 +
排序: + +
缩略图:
封面:
页面内容:
+ + + +
  
+ +@endsection \ No newline at end of file diff --git a/resources/views/admin/order/edit.blade.php b/resources/views/admin/order/edit.blade.php new file mode 100644 index 0000000..0c15bd4 --- /dev/null +++ b/resources/views/admin/order/edit.blade.php @@ -0,0 +1,133 @@ +@extends('admin.layouts.app') +@section('title', '品牌修改') + +@section('content') +
品牌列表 > 品牌修改
+ +
{{ csrf_field() }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
名称:" class="required" style="width:60%" placeholder="在此输入标题">
是否显示: + /> 是   + /> 否 +
排序: + +
缩略图: " style="width:40%"> " src="" width="120" height="80" id="picview" name="picview">
封面: " style="width:40%"> " src="" width="120" height="80" id="picview2">
页面内容:
+ + + +
  
+ +@endsection \ No newline at end of file diff --git a/resources/views/admin/order/index.blade.php b/resources/views/admin/order/index.blade.php new file mode 100644 index 0000000..db5d858 --- /dev/null +++ b/resources/views/admin/order/index.blade.php @@ -0,0 +1,29 @@ +@extends('admin.layouts.app') +@section('title', '订单列表') + +@section('content') +

订单管理

+ +
+ + + + + + + + + + + + + + + + + + + + +
编号-SN名称是否显示更新时间管理
id.'-'.$row->order_sn; ?>add_time; ?>否";} ?>add_time); ?>修改 删除
+@endsection \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index b4482fe..cbff2fb 100644 --- a/routes/web.php +++ b/routes/web.php @@ -295,6 +295,11 @@ Route::group(['prefix' => 'fladmin', 'namespace' => 'Admin', 'middleware' => ['w Route::get('/goodstype/edit', 'GoodsTypeController@edit')->name('admin_goodstype_edit'); Route::post('/goodstype/doedit', 'GoodsTypeController@doedit')->name('admin_goodstype_doedit'); Route::get('/goodstype/del', 'GoodsTypeController@del')->name('admin_goodstype_del'); + //订单 + Route::get('/order', 'OrderController@index')->name('admin_order'); + Route::get('/order/edit', 'OrderController@edit')->name('admin_order_edit'); + Route::post('/order/doedit', 'OrderController@doedit')->name('admin_order_doedit'); + Route::get('/order/del', 'OrderController@del')->name('admin_order_del'); //商品品牌 Route::get('/goodsbrand', 'GoodsBrandController@index')->name('admin_goodsbrand'); Route::get('/goodsbrand/add', 'GoodsBrandController@add')->name('admin_goodsbrand_add');