From 0ed0b0928a29aa623dcdf8f9c117f5ab682c2ef5 Mon Sep 17 00:00:00 2001 From: wuhui_zzw <1760308791@qq.com> Date: Sat, 23 Mar 2024 10:50:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E6=B6=88=E8=B4=B9?= =?UTF-8?q?=E8=BF=94=E5=88=A9=20-=20=E8=BF=94=E5=88=A9=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E8=B0=83=E6=95=B4=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=EF=BC=9A=E6=94=AF=E6=8C=81=E4=BF=AE=E6=94=B9=E7=AC=AC7?= =?UTF-8?q?=E4=B8=AA=E6=9C=88=E7=9A=84=E8=BF=94=E5=88=A9=E9=87=91=E9=A2=9D?= =?UTF-8?q?=EF=BC=8C=E6=94=AF=E6=8C=81=E6=97=B6=E9=97=B4=E7=AD=9B=E9=80=89?= =?UTF-8?q?=E4=B8=B4=E6=9C=9F=E5=85=85=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/rebate/src/admin/IndexController.php | 69 ++- plugins/rebate/src/models/Rebate.php | 50 +- plugins/rebate/views/index/index.blade.php | 602 +++++++++++++++---- 3 files changed, 596 insertions(+), 125 deletions(-) diff --git a/plugins/rebate/src/admin/IndexController.php b/plugins/rebate/src/admin/IndexController.php index adb15daa..ff28a548 100644 --- a/plugins/rebate/src/admin/IndexController.php +++ b/plugins/rebate/src/admin/IndexController.php @@ -5,6 +5,7 @@ namespace Yunshop\Rebate\admin; use app\common\components\BaseController; use app\common\facades\Setting; use app\common\helpers\PaginationHelper; +use Illuminate\Support\Facades\DB; use Yunshop\CollectionRoom\models\CollectionRoomModel; use Yunshop\NewPoster\models\Poster; use Yunshop\Rebate\models\Rebate; @@ -18,19 +19,73 @@ class IndexController extends BaseController{ * @throws \Throwable */ public function index(){ + if(request()->isMethod('post')){ + //参数获取 + $pageSize = request()->input('page_size',10); + $search = request()->input('search'); + // 获取列表信息 + $field = [ + 'id', + 'uid', + 'order_id', + 'goods_id', + 'created_at', + DB::raw('sum(money) as total_money'), + DB::raw('max(status) as max_status'), + ]; + $result = Rebate::getGroupList($pageSize,$search,$field); + + return $this->successJson('success',[ + 'current_page' => $result['current_page'], + 'data' => $result['data'], + 'last_page' => $result['last_page'], + ]); + } + + return view('Yunshop\Rebate::index.index')->render(); + } + /** + * Common: 查看某期的返利明细 + * Author: wu-hui + * Time: 2024/03/22 17:07 + * @return array|\Illuminate\Http\JsonResponse|string + * @throws \Throwable + */ + public function detail(){ //参数获取 $pageSize = request()->input('page_size',10); - $search = request()->input('search'); + $search = request()->input('search'); // 获取列表信息 $result = Rebate::getList($pageSize,$search); - $data = [ - 'list' => $result['data'], - 'pager' => PaginationHelper::show($result['total'],$result['current_page'],$result['per_page']), - 'search' => $search - ]; - return view('Yunshop\Rebate::index.index',$data)->render(); + return $this->successJson('success',[ + 'current_page' => $result['current_page'], + 'data' => $result['data'], + 'last_page' => $result['last_page'], + ]); } + /** + * Common: 修改入账金额 + * Author: wu-hui + * Time: 2024/03/22 18:32 + * @return \Illuminate\Http\JsonResponse + */ + public function updateMoney(){ + //参数获取 + $id = request()->input('id'); + $money = request()->input('new_money'); + Rebate::uniacid() + ->where('id',$id) + ->where('month', 7) + ->update(['money' => $money]); + + return $this->successJson('success'); + } + + + + + /** * Common: 基本设置 * Author: wu-hui diff --git a/plugins/rebate/src/models/Rebate.php b/plugins/rebate/src/models/Rebate.php index d395dd85..b1c0dcb7 100644 --- a/plugins/rebate/src/models/Rebate.php +++ b/plugins/rebate/src/models/Rebate.php @@ -30,14 +30,53 @@ class Rebate extends BaseModel{ * @param string[] $field * @return array */ - public function getList($pageSize,$search,$field = ['*']){ + public static function getList($pageSize,$search,$field = ['*']){ + $model = self::getSearch($search, $field)->orderBy('id','asc'); + $list = $model->paginate($pageSize); + + return $list ? $list->toArray() : []; + } + /** + * Common: 获取分组内容 + * Author: wu-hui + * Time: 2024/03/22 17:09 + * @param $pageSize + * @param $search + * @param string[] $field + * @return array + */ + public function getGroupList($pageSize,$search,$field = ['*']){ + $model = self::getSearch($search, $field) + ->groupBy('order_id','goods_id') + ->orderBy('id','desc'); + $list = $model->paginate($pageSize); + + return $list ? $list->toArray() : []; + } + /** + * Common: 公共搜索内容 + * Author: wu-hui + * Time: 2024/03/22 16:13 + * @param $search + * @param string[] $field + * @return mixed + */ + public static function getSearch($search,array $field = ['*']){ // 条件生成 $where = []; if($search['uid'] > 0) $where[] = ['uid','=',$search['uid']]; if($search['order_id'] > 0) $where[] = ['order_id','=',$search['order_id']]; if($search['goods_id'] > 0) $where[] = ['goods_id','=',$search['goods_id']]; + if($search['quarter'] > 0) $where[] = ['quarter','=',$search['quarter']]; + if($search['month'] > 0) $where[] = ['month','=',$search['month']]; + if(!empty($search['time']) && is_array($search['time'])){ + $start = $search['time'][0]; + $end = $search['time'][1]; + $where[] = ['expect_thaw_time','>=',$start]; + $where[] = ['expect_thaw_time','<=',$end]; + } // 列表获取 - $model = self::uniacid() + return self::uniacid() ->select($field) ->where($where) ->when(!empty($search['nickname']),function($query) use ($search){ @@ -61,12 +100,7 @@ class Rebate extends BaseModel{ 'goods' => function($query){ $query->select(['id','title']); } - ]) - // ->orderBy('expect_thaw_time','DESC') - ->orderBy('id','DESC'); - $list = $model->paginate($pageSize); - - return $list ? $list->toArray() : []; + ]); } diff --git a/plugins/rebate/views/index/index.blade.php b/plugins/rebate/views/index/index.blade.php index 7a33f289..796506fb 100644 --- a/plugins/rebate/views/index/index.blade.php +++ b/plugins/rebate/views/index/index.blade.php @@ -1,4 +1,3 @@ - @extends('layouts.base') @section('content') -
- {{--顶部搜索--}} -
-
-
-
-
-
-
- -
-
- -
-
- -
-
- -
-
-
-
-
-
-
-
- {{--状态:0=冻结中,1=待结算,2=已结算,3=已失效,4=已退款(失效)--}} - -
-
-
-
-
-
- -
-
-
-
-
- {{--信息列表--}} +
+ {{--列表信息--}}
-
- - - - - - - - - - - - - - - - @foreach ($list as $item) - - -
ID用户信息订单商品阶段时间状态预计解冻时间
实际解冻时间
返利金额解冻后是否需要复购下单时间
{{ $item['id'] }} -
-
- +
+ {{--选项卡&基础内容--}} + + + {{--搜索--}} + + + + + + + + + + + + + + + 查询 + + + {{--表格--}} + + + + + + + + + + + + + + + + + + {{--分页--}} + + + + + + + {{----}} + {{-- --}} + {{----}} + {{----}} + {{-- --}} + {{----}} + {{----}} + {{-- --}} + {{----}} + {{----}} + {{-- --}} + {{----}} + + + + + + 查询 + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ {{--明细弹框--}} + + +
+ @endsection