diff --git a/app/admin/controller/finance/Billions.php b/app/admin/controller/finance/Billions.php new file mode 100644 index 00000000..d09995a0 --- /dev/null +++ b/app/admin/controller/finance/Billions.php @@ -0,0 +1,87 @@ +request->isAjax()) { + $get = $this->request->get(); + $result = BillionsLogic::lists($get); + return JsonServer::success('', $result); + + } + $summary = BillionsLogic::summary(); + + return view('',array( + 'summary'=>$summary + ) + ); + + } + + /** + * @notes 用户反补需求列表 + * @return \think\response\Json|\think\response\View + * @author Yzt + * @date 2024/10/29 10:07 上午 + */ + + public function userLists(){ + $get = $this->request->get(); + if ($this->request->isAjax()) { + + $result = BillionsLogic::userList($get); + return JsonServer::success('', $result); + } + $summary = BillionsLogic::summary(); + + + $today = [ + date('Y-m-d H:i:s', strtotime(date("Y-m-d", time()))), + date('Y-m-d H:i:s', strtotime(date("Y-m-d", time())) + 86399) + ]; + + $yesterday = [ + date('Y-m-d H:i:s', strtotime(date("Y-m-d", strtotime("-1 day")))), + date('Y-m-d H:i:s', strtotime(date("Y-m-d", strtotime("-1 day"))) + 86399) + ]; + + + $days_ago7 = [ + date('Y-m-d H:i:s', strtotime(date("Y-m-d", strtotime("-7 day")))), + date('Y-m-d 23:59:59', time()) + ]; + + $days_ago30 = [ + date('Y-m-d 00:00:00', strtotime("-30 day")), + date('Y-m-d 23:59:59', time()) + ]; + + + return view('',array( + 'user_id' => $get['user_id'], + 'summary'=>$summary, + 'today' => $today, + 'yesterday' => $yesterday, + 'days_ago7' => $days_ago7, + 'days_ago30' => $days_ago30, + ) + ); + } + + + + +} \ No newline at end of file diff --git a/app/admin/logic/finance/BillionsLogic.php b/app/admin/logic/finance/BillionsLogic.php new file mode 100644 index 00000000..3242b794 --- /dev/null +++ b/app/admin/logic/finance/BillionsLogic.php @@ -0,0 +1,114 @@ +'未补满', + '1'=>'手动结束', + '2'=>'自动结束', + '3'=>'强制结束' + ]; + + static protected $shop_type = [ + '1'=>'商品订单', + '2'=>'充值订单', + '3'=>'返充', + '4'=>'本地生活支付' + ]; + public static function lists($get) + { + $where = []; + if (!empty($get['nickname'])) { + $where[] = ['u.nickname', 'like', '%' . $get['nickname'] . '%']; + } + + if (isset($get['state']) && $get['state'] != '') { + $where[] = ['b.state', '=', $get['state']]; + } + + $lists = Billions::alias('b') + ->join('user u', 'b.user_id = u.id') + ->where($where) + ->order('billions_id', 'desc') + ->group('user_id') + ->field('b.*, u.id, u.nickname, u.avatar,u.sn') + ->paginate([ + 'page' => $get['page'] ?? 1, + 'list_rows' => $get['limit'] ?? 10, + 'var_page' => 'page' + ])->toArray(); + + + foreach ($lists['data'] as &$v) { + $v['avatar'] = UrlServer::getFileUrl($v['avatar']); + $v['price_all'] = Billions::where('user_id',$v['user_id'])->sum('order_price'); + $v['subsidy_all'] = Billions::where('user_id',$v['user_id'])->sum('subsidy_price'); + } + + return ['count' => $lists['total'],'lists' => $lists['data']]; + } + + + public static function userList($get){ + + $where = []; + if (isset($get['start_time']) && $get['start_time'] && isset($get['end_time']) && $get['end_time']) { + $where[] = ['dtime', 'between', [$get['start_time'], $get['end_time']]]; + } + if (isset($get['order_type']) && $get['order_type'] != '') { + $where[] = ['type', '=', $get['order_type']]; + } + if (isset($get['state']) && $get['state'] != '') { + $where[] = ['state', '=', $get['state']]; + } + + + $lists = Billions::where('user_id',$get['user_id']) + ->field('*') + ->where($where) + ->paginate([ + 'page' => $get['page'] ?? 1, + 'list_rows' => $get['limit'] ?? 10, + 'var_page' => 'page' + ]) + ->toArray(); + + foreach ($lists['data'] as &$item){ + + $item['state'] = self::$status_str[$item['state']]; + $item['type'] = self::$shop_type[$item['type']]; + } + + return ['count' => $lists['total'],'lists' => $lists['data']]; + + + } + + public static function summary(){ + + $un_price = Billions::where('state',1)->sum('subsidy_price'); + $art_price = Billions::where('state',2)->sum('subsidy_price'); + $auto_price = Billions::where('state',3)->sum('subsidy_price'); + + return [ + 'un_price'=>$un_price, + 'art_price'=>$art_price, + 'auto_price'=>$auto_price + ]; + + } + + + +} \ No newline at end of file diff --git a/app/admin/logic/finance/FinanceLogic.php b/app/admin/logic/finance/FinanceLogic.php index 9b06022e..5cf2642a 100755 --- a/app/admin/logic/finance/FinanceLogic.php +++ b/app/admin/logic/finance/FinanceLogic.php @@ -20,6 +20,7 @@ use app\common\model\shop\ShopWithdrawal; use app\common\model\shop\ShopSettlement; use app\common\model\WithdrawApply; use app\common\model\LocalStoreOrder; +use app\common\model\UserBillions; class FinanceLogic extends Logic @@ -30,9 +31,14 @@ class FinanceLogic extends Logic public static function shop($form = []) { $where = $joinWhere = []; + $whereTwo = []; if (!empty($form)) { $where[] = ['create_time', '>=', strtotime($form['start_time'])]; $where[] = ['create_time', '<=', strtotime($form['end_time'])]; + + $whereTwo[] = ['dtime', '>=', strtotime($form['start_time'])]; + $whereTwo[] = ['dtime', '<=', strtotime($form['end_time'])]; + } $model = new Order(); @@ -232,6 +238,17 @@ class FinanceLogic extends Logic ['del', '=', 0] ]) ->sum('earnings'); + $user_billions = new UserBillions(); + + $all_subsidy = $user_billions + ->where($whereTwo) + ->sum('order_price'); + + $complete_subsidy = $user_billions + ->where($whereTwo) + ->sum('subsidy_price'); + + //总积分 @@ -273,6 +290,8 @@ class FinanceLogic extends Logic 'all_integral' => $all_integral, //总积分 'sign_in_integral' => $sign_in_integral, //签到送出积分 'use_integral' => $use_integral, //使用积分 + 'all_subsidy' => $all_subsidy, //应反补总额 + 'complete_subsidy' => $complete_subsidy, //已反补总额 'consume_award_integral' => $consume_award_integral, //下单赠送积分 ]; } diff --git a/app/admin/view/finance/billions/lists.html b/app/admin/view/finance/billions/lists.html new file mode 100644 index 00000000..2cb31abf --- /dev/null +++ b/app/admin/view/finance/billions/lists.html @@ -0,0 +1,297 @@ +{layout name="layout1" /} + + +
+
+
+ + + + + +
+
+ 消费反补明细汇总 +
+
+
+
+
+
+ 未补满金额 +
+
+

¥{$summary.un_price}

+
+
+
+ +
+
+
+ 手动结束 +
+
+

¥{$summary.art_price}

+
+
+
+ +
+
+
+ 自动结束 +
+
+

¥{$summary.auto_price}

+
+
+
+
+ +
+
+ + + +
+
+
+
+ +
+ +
+
+
+ +
+ + + + +
+ + +
+
+
+
+
+
+ +
+
+ + + + + + + + + +
+
+
+
+
+
+ diff --git a/app/admin/view/finance/billions/user_lists.html b/app/admin/view/finance/billions/user_lists.html new file mode 100644 index 00000000..e02b36da --- /dev/null +++ b/app/admin/view/finance/billions/user_lists.html @@ -0,0 +1,311 @@ +{layout name="layout1" /} + + +
+
+
+ + + + + +
+
+ 本地生活订单汇总 +
+
+ +
+
+ + + +
+
+
+ +
+ +
+ +
+
+ + +
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ +
+
+ +
+
+
+
+ + + + +
+
+ +
+ + +
+
+
+
+
+
+
+
+ + + + + + + + +
+
+
+
+
+
+ diff --git a/app/admin/view/finance/finance/center.html b/app/admin/view/finance/finance/center.html index 60df4cce..99e0ee55 100755 --- a/app/admin/view/finance/finance/center.html +++ b/app/admin/view/finance/finance/center.html @@ -374,13 +374,57 @@

- + + +
+
+ 消费反补汇总 +
+
+
+
+
+
+ 应反补总额 +
+
+

{$shop.all_subsidy}

+
+
+
+ +
+
+
+ 已反补总额 +
+
+

{$shop.complete_subsidy}

+
+
+
+ +
+
+
+ 佣金反补明细 +
+ +
+ +
+
+
+
+
积分汇总
+ +
@@ -512,6 +556,14 @@ }); }); + layui.use('jquery', function() { + var $ = layui.jquery; + $('#subsidy-btn').on('click', function() { + window.location.href = '{:url("finance.billions/lists")}'; // 将 'finance.order/userMoneyLists' 替换为你想要跳转的页面地址 + }); + }); + + // 监听搜索 diff --git a/app/admin/view/finance/order/lists.html b/app/admin/view/finance/order/lists.html index 8037ee2f..c84364fe 100644 --- a/app/admin/view/finance/order/lists.html +++ b/app/admin/view/finance/order/lists.html @@ -1,32 +1,37 @@ {layout name="layout1" /} @@ -34,22 +39,23 @@
-