From 04102f7237efefa744090ed7c25f7b5d0807b679 Mon Sep 17 00:00:00 2001
From: quanwei <419654421@qq.com>
Date: Thu, 05 Feb 2026 18:11:57 +0800
Subject: [PATCH] 完成运营中心提现和运营中心权限管理

---
 admin/app/shop/service/order/ExportService.php |  127 ++++++++++++++++++++++++++++++++++++------
 1 files changed, 108 insertions(+), 19 deletions(-)

diff --git a/admin/app/shop/service/order/ExportService.php b/admin/app/shop/service/order/ExportService.php
index bdc51a1..4b4fdb2 100644
--- a/admin/app/shop/service/order/ExportService.php
+++ b/admin/app/shop/service/order/ExportService.php
@@ -181,6 +181,80 @@
     }
 
     /**
+     * 运营中心订单导出
+     */
+    public function operationsOrderList($list)
+    {
+        $spreadsheet = new Spreadsheet();
+        $sheet = $spreadsheet->getActiveSheet();
+
+        //列宽
+        $sheet->getColumnDimension('B')->setWidth(30);
+
+        //设置工作表标题名称
+        $sheet->setTitle('运营中心订单明细');
+
+        $sheet->setCellValue('A1', '订单号');
+        $sheet->setCellValue('B1', '商品信息');
+        $sheet->setCellValue('C1', '订单总额');
+        $sheet->setCellValue('D1', '实付款金额');
+        $sheet->setCellValue('E1', '支付方式');
+        $sheet->setCellValue('F1', '下单时间');
+        $sheet->setCellValue('G1', '省级运营中心');
+        $sheet->setCellValue('H1', '省级佣金');
+        $sheet->setCellValue('I1', '市级运营中心');
+        $sheet->setCellValue('J1', '市级佣金');
+        $sheet->setCellValue('K1', '区级运营中心');
+        $sheet->setCellValue('L1', '区级佣金');
+        $sheet->setCellValue('M1', '买家');
+        $sheet->setCellValue('N1', '付款状态');
+        $sheet->setCellValue('O1', '付款时间');
+        $sheet->setCellValue('P1', '发货状态');
+        $sheet->setCellValue('Q1', '发货时间');
+        $sheet->setCellValue('R1', '收货状态');
+        $sheet->setCellValue('S1', '收货时间');
+        $sheet->setCellValue('T1', '订单状态');
+        $sheet->setCellValue('U1', '佣金结算');
+        $sheet->setCellValue('V1', '结算时间');
+        //填充数据
+        $index = 0;
+        foreach ($list as $operations) {
+            $order = $operations['order_master'];
+            $sheet->setCellValue('A' . ($index + 2), "\t" . $order['order_no'] . "\t");
+            $sheet->setCellValue('B' . ($index + 2), $this->filterProductInfo($order));
+            $sheet->setCellValue('C' . ($index + 2), $order['total_price']);
+            $sheet->setCellValue('D' . ($index + 2), $order['pay_price']);
+            $sheet->setCellValue('E' . ($index + 2), $order['pay_type']['text']);
+            $sheet->setCellValue('F' . ($index + 2), $order['create_time']);
+            $sheet->setCellValue('G' . ($index + 2), isset($operations['agent_first'])?$operations['agent_first']['nickName']:'');
+            $sheet->setCellValue('H' . ($index + 2), $operations['first_money']);
+            $sheet->setCellValue('I' . ($index + 2), isset($operations['agent_second'])?$operations['agent_second']['nickName']:'');
+            $sheet->setCellValue('J' . ($index + 2), $operations['second_money']);
+            $sheet->setCellValue('K' . ($index + 2), isset($operations['agent_third'])?$operations['agent_third']['nickName']:'');
+            $sheet->setCellValue('L' . ($index + 2), $operations['third_money']);
+            $sheet->setCellValue('M' . ($index + 2), $order['user']['nickName']);
+            $sheet->setCellValue('N' . ($index + 2), $order['pay_status']['text']);
+            $sheet->setCellValue('O' . ($index + 2), $this->filterTime($order['pay_time']));
+            $sheet->setCellValue('P' . ($index + 2), $order['delivery_status']['text']);
+            $sheet->setCellValue('Q' . ($index + 2), $this->filterTime($order['delivery_time']));
+            $sheet->setCellValue('R' . ($index + 2), $order['receipt_status']['text']);
+            $sheet->setCellValue('S' . ($index + 2), $this->filterTime($order['receipt_time']));
+            $sheet->setCellValue('T' . ($index + 2), $order['order_status']['text']);
+            $sheet->setCellValue('U' . ($index + 2), $operations['is_settled'] == 1 ? '已结算' : '未结算');
+            $sheet->setCellValue('V' . ($index + 2), $this->filterTime($operations['settle_time']));
+            $index++;
+        }
+
+        //保存文件
+        $filename = iconv("UTF-8", "GB2312//IGNORE", '运营中心订单') . '-' . date('YmdHis') . '.xlsx';
+        header('Content-Type: application/vnd.ms-excel');
+        header('Content-Disposition: attachment;filename="' . $filename . '"');
+        header('Cache-Control: max-age=0');
+        $writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
+        $writer->save('php://output');
+    }
+
+    /**
      * 提现订单导出
      */
     public function cashList($list)
@@ -576,36 +650,51 @@
     {
         $spreadsheet = new Spreadsheet();
         $sheet = $spreadsheet->getActiveSheet();
-
+        $title = $list[0]['activity']['branch']['name'] . '-' . $list[0]['activity']['name'] . '-' . '活动报名记录表';
         //设置工作表标题名称
         $sheet->setTitle('活动报名记录表');
 
-        $sheet->setCellValue('A1', '用户id');
-        $sheet->setCellValue('B1', '昵称');
-        $sheet->setCellValue('C1', '姓名');
-        $sheet->setCellValue('D1', '手机号');
-        $sheet->setCellValue('E1', '报名状态');
-        $sheet->setCellValue('F1', '报名时间');
-        $sheet->setCellValue('G1', '活动ID');
-        $sheet->setCellValue('H1', '活动标题');
-
+        /*$sheet->setCellValue('A1', '用户id');
+        $sheet->setCellValue('B1', '昵称');*/
+        $sheet->setCellValue('A1', '姓名');
+        $sheet->setCellValue('B1', '手机号');
+        $sheet->setCellValue('C1', '邀请人');
+        $sheet->setCellValue('D1', '邀请人手机号');
+        $sheet->setCellValue('E1', '所属分会');
+        /*$sheet->setCellValue('F1', '微信支付交易号');
+        $sheet->setCellValue('G1', '积分抵扣金额');
+        $sheet->setCellValue('H1', '余额抵扣金额');
+        $sheet->setCellValue('I1', '在线支付金额');*//*
+        $sheet->setCellValue('F1', '报名状态');
+        $sheet->setCellValue('G1', '报名时间');
+        $sheet->setCellValue('H1', '活动ID');
+        $sheet->setCellValue('I1', '活动标题');*/
+        foreach(range('A','E') as $columnID) {
+            $sheet->getColumnDimension($columnID)->setAutoSize(true);
+        }
         //填充数据
         $index = 0;
         foreach ($list as $item) {
-            $sheet->setCellValue('A' . ($index + 2), $item['user_id']);
-            $sheet->setCellValue('B' . ($index + 2), $nickName);
-            $sheet->setCellValue('C' . ($index + 2), $item['real_name']);
-            $sheet->setCellValue('D' . ($index + 2), $item['mobile']);
-            $sheet->setCellValue('E' . ($index + 2), $item['status_text']);
-            $sheet->setCellValue('F' . ($index + 2), $item['create_time']);
-            $sheet->setCellValue('G' . ($index + 2), $item['activity_id']);
-            $sheet->setCellValue('H' . ($index + 2), $item['activity']['name']);
+            $sheet->setCellValue('A' . ($index + 2), $item['real_name']);
+            $sheet->setCellValueExplicit('B' . ($index + 2), $item['mobile'] , \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);
+            $sheet->setCellValue('C' . ($index + 2), $item['recommend_name']);
+            $sheet->setCellValueExplicit('D' . ($index + 2), $item['recommend_mobile'] , \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);
+
+            $sheet->setCellValue('E' . ($index + 2), empty($item['branch']) ? '无' : $item['branch']['name']);
+           /* $sheet->setCellValue('F' . ($index + 2), $item['transaction_id']);
+            $sheet->setCellValue('G' . ($index + 2), $item['points_money']);
+            $sheet->setCellValue('H' . ($index + 2), $item['balance']);
+            $sheet->setCellValue('I' . ($index + 2), $item['online_money']);*//*
+            $sheet->setCellValue('F' . ($index + 2), $item['status_text']);
+            $sheet->setCellValue('G' . ($index + 2), $item['create_time']);
+            $sheet->setCellValue('H' . ($index + 2), $item['activity_id']);
+            $sheet->setCellValue('I' . ($index + 2), $item['activity']['name']);*/
             $index++;
         }
 
         //保存文件
         $writer = new Xlsx($spreadsheet);
-        $filename = iconv("UTF-8", "GB2312//IGNORE", '活动报名记录表') . '-' . date('YmdHis') . '.xlsx';
+        $filename = iconv("UTF-8", "GB2312//IGNORE", $title) . '-' . date('YmdHis') . '.xlsx';
 
 
         header('Content-Type: application/vnd.ms-excel');

--
Gitblit v1.9.2