正在显示
8 个修改的文件
包含
136 行增加
和
59 行删除
@@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
2 | 2 | ||
3 | namespace app\admin\controller; | 3 | namespace app\admin\controller; |
4 | 4 | ||
5 | +use app\api\controller\Common; | ||
5 | use app\common\controller\Backend; | 6 | use app\common\controller\Backend; |
6 | use PhpOffice\PhpSpreadsheet\IOFactory; | 7 | use PhpOffice\PhpSpreadsheet\IOFactory; |
7 | use PhpOffice\PhpSpreadsheet\Spreadsheet; | 8 | use PhpOffice\PhpSpreadsheet\Spreadsheet; |
@@ -88,4 +89,70 @@ class AdminCommon extends Backend | @@ -88,4 +89,70 @@ class AdminCommon extends Backend | ||
88 | 89 | ||
89 | return $returnValue-3600*8;// 返回时间戳 | 90 | return $returnValue-3600*8;// 返回时间戳 |
90 | } | 91 | } |
92 | + | ||
93 | + //导出套餐订单列表 | ||
94 | + public static function exportOrderList($where){ | ||
95 | + $expTableData = Common::selectWhereData('order',$where,'r_id,order_sn,price,content,total_num,use_num,not_use_num,advice,address,organization,pin_user,mark','id asc'); | ||
96 | + //查询手机号 | ||
97 | + $r_ids = array_unique(array_column($expTableData,'r_id')); | ||
98 | + $res_mobile = Common::selectWhereData('registers',['id'=>['in',$r_ids]],'id,mobile'); | ||
99 | + $expCellName = [ | ||
100 | + ['order_sn','订单编号',15], | ||
101 | + ['price','订单金额',15], | ||
102 | + ['content','购买服务内容',20], | ||
103 | + ['total_num','购买次数',15], | ||
104 | + ['use_num','已用服务次数',15], | ||
105 | + ['not_use_num','剩余服务次数',15], | ||
106 | + ['advice','所属顾问',10], | ||
107 | + ['mobile','VIP手机号',20], | ||
108 | + ['address','详细地址',30], | ||
109 | + ['organization','归属机构',30], | ||
110 | + ['pin_user','品拓人员',15], | ||
111 | + ['mark','备注',40], | ||
112 | + ]; | ||
113 | + | ||
114 | + foreach ($expTableData as &$v) { | ||
115 | + $v['mobile'] = ''; | ||
116 | + foreach ($res_mobile as $value){ | ||
117 | + if($v['r_id'] == $value['id']){ | ||
118 | + $v['mobile'] = $value['mobile']; | ||
119 | + } | ||
120 | + } | ||
121 | + } | ||
122 | + $expTitle = "套餐订单列表"; | ||
123 | + $fileName = "套餐订单列表";//文件名 | ||
124 | + self::exportExcel($expTitle,$expCellName,$expTableData,$fileName); | ||
125 | + } | ||
126 | + | ||
127 | + //导出服务订单列表 | ||
128 | + public static function exportServiceList($where){ | ||
129 | + $expTableData = Common::selectWhereData('service_order',$where,'r_id,order_sn,customer_name,service_time,service_content,service_name,assess,mark','id asc'); | ||
130 | + //查询手机号 | ||
131 | + $r_ids = array_unique(array_column($expTableData,'r_id')); | ||
132 | + $res_mobile = Common::selectWhereData('registers',['id'=>['in',$r_ids]],'id,mobile'); | ||
133 | + $expCellName = [ | ||
134 | + ['order_sn','服务订单编号',20], | ||
135 | + ['customer_name','客户姓名',10], | ||
136 | + ['service_time','服务时间',20], | ||
137 | + ['service_content','服务项目',30], | ||
138 | + ['service_name','服务员',10], | ||
139 | + ['mobile','VIP手机号',20], | ||
140 | + ['assess','评价',30], | ||
141 | + ['mark','备注',40], | ||
142 | + ]; | ||
143 | + | ||
144 | + foreach ($expTableData as &$v) { | ||
145 | + $v['mobile'] = ''; | ||
146 | + foreach ($res_mobile as $value){ | ||
147 | + if($v['r_id'] == $value['id']){ | ||
148 | + $v['mobile'] = $value['mobile']; | ||
149 | + } | ||
150 | + } | ||
151 | + $v['service_time'] = date('Y-m-d H:i:s',$v['service_time']); | ||
152 | + } | ||
153 | + $expTitle = "服务订单列表"; | ||
154 | + $fileName = "服务订单列表";//文件名 | ||
155 | + self::exportExcel($expTitle,$expCellName,$expTableData,$fileName); | ||
156 | + } | ||
157 | + | ||
91 | } | 158 | } |
@@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
2 | 2 | ||
3 | namespace app\admin\controller; | 3 | namespace app\admin\controller; |
4 | 4 | ||
5 | +use app\api\controller\Common; | ||
5 | use app\common\controller\Backend; | 6 | use app\common\controller\Backend; |
6 | /** | 7 | /** |
7 | * 导入订单管理 | 8 | * 导入订单管理 |
@@ -63,4 +64,14 @@ class Order extends Backend | @@ -63,4 +64,14 @@ class Order extends Backend | ||
63 | return $this->view->fetch(); | 64 | return $this->view->fetch(); |
64 | } | 65 | } |
65 | 66 | ||
67 | + //导出excel | ||
68 | + public function export(){ | ||
69 | + $ids = $this->request->param('ids'); | ||
70 | + if(!$ids){ | ||
71 | + return; | ||
72 | + } | ||
73 | + $ids = explode(',',$ids); | ||
74 | + AdminCommon::exportOrderList(['id'=>['in',$ids]]); | ||
75 | + } | ||
76 | + | ||
66 | } | 77 | } |
@@ -298,43 +298,14 @@ class Registers extends Backend | @@ -298,43 +298,14 @@ class Registers extends Backend | ||
298 | $this->success(); | 298 | $this->success(); |
299 | } | 299 | } |
300 | 300 | ||
301 | - //导出excel | 301 | + //导出套餐订单列表excel |
302 | public function export(){//导出Excel | 302 | public function export(){//导出Excel |
303 | $ids = $this->request->param('ids'); | 303 | $ids = $this->request->param('ids'); |
304 | if(!$ids){ | 304 | if(!$ids){ |
305 | return; | 305 | return; |
306 | } | 306 | } |
307 | $ids = explode(',',$ids); | 307 | $ids = explode(',',$ids); |
308 | - $expTableData = Common::selectWhereData('order',['r_id'=>['in',$ids]],'r_id,order_sn,price,content,total_num,use_num,not_use_num,advice,address,organization,pin_user,mark','id asc'); | ||
309 | - //查询手机号 | ||
310 | - $r_ids = array_unique(array_column($expTableData,'r_id')); | ||
311 | - $res_mobile = Common::selectWhereData('registers',['id'=>['in',$r_ids]],'id,mobile'); | ||
312 | - $expCellName = [ | ||
313 | - ['order_sn','订单编号',15], | ||
314 | - ['price','订单金额',15], | ||
315 | - ['content','购买服务内容',20], | ||
316 | - ['total_num','购买次数',15], | ||
317 | - ['use_num','已用服务次数',15], | ||
318 | - ['not_use_num','剩余服务次数',15], | ||
319 | - ['advice','所属顾问',10], | ||
320 | - ['mobile','VIP手机号',20], | ||
321 | - ['address','详细地址',30], | ||
322 | - ['organization','归属机构',30], | ||
323 | - ['pin_user','品拓人员',15], | ||
324 | - ['mark','备注',40], | ||
325 | - ]; | ||
326 | - | ||
327 | - foreach ($expTableData as &$v) { | ||
328 | - $v['mobile'] = ''; | ||
329 | - foreach ($res_mobile as $value){ | ||
330 | - if($v['r_id'] == $value['id']){ | ||
331 | - $v['mobile'] = $value['mobile']; | ||
332 | - } | ||
333 | - } | ||
334 | - } | ||
335 | - $expTitle = "套餐订单列表"; | ||
336 | - $fileName = "套餐订单列表";//文件名 | ||
337 | - AdminCommon::exportExcel($expTitle,$expCellName,$expTableData,$fileName); | 308 | + AdminCommon::exportOrderList(['r_id'=>['in',$ids]]); |
338 | } | 309 | } |
339 | 310 | ||
340 | //导出服务列表excel | 311 | //导出服务列表excel |
@@ -344,32 +315,6 @@ class Registers extends Backend | @@ -344,32 +315,6 @@ class Registers extends Backend | ||
344 | return; | 315 | return; |
345 | } | 316 | } |
346 | $ids = explode(',',$ids); | 317 | $ids = explode(',',$ids); |
347 | - $expTableData = Common::selectWhereData('service_order',['r_id'=>['in',$ids]],'r_id,order_sn,customer_name,service_time,service_content,service_name,assess,mark','id asc'); | ||
348 | - //查询手机号 | ||
349 | - $r_ids = array_unique(array_column($expTableData,'r_id')); | ||
350 | - $res_mobile = Common::selectWhereData('registers',['id'=>['in',$r_ids]],'id,mobile'); | ||
351 | - $expCellName = [ | ||
352 | - ['order_sn','服务订单编号',20], | ||
353 | - ['customer_name','客户姓名',10], | ||
354 | - ['service_time','服务时间',20], | ||
355 | - ['service_content','服务项目',30], | ||
356 | - ['service_name','服务员',10], | ||
357 | - ['mobile','VIP手机号',20], | ||
358 | - ['assess','评价',30], | ||
359 | - ['mark','备注',40], | ||
360 | - ]; | ||
361 | - | ||
362 | - foreach ($expTableData as &$v) { | ||
363 | - $v['mobile'] = ''; | ||
364 | - foreach ($res_mobile as $value){ | ||
365 | - if($v['r_id'] == $value['id']){ | ||
366 | - $v['mobile'] = $value['mobile']; | ||
367 | - } | ||
368 | - } | ||
369 | - $v['service_time'] = date('Y-m-d H:i:s',$v['service_time']); | ||
370 | - } | ||
371 | - $expTitle = "服务订单列表"; | ||
372 | - $fileName = "服务订单列表";//文件名 | ||
373 | - AdminCommon::exportExcel($expTitle,$expCellName,$expTableData,$fileName); | 318 | + AdminCommon::exportServiceList(['r_id'=>['in',$ids]]); |
374 | } | 319 | } |
375 | } | 320 | } |
@@ -62,4 +62,14 @@ class ServiceOrder extends Backend | @@ -62,4 +62,14 @@ class ServiceOrder extends Backend | ||
62 | $this->assignconfig("r_id",$ids); | 62 | $this->assignconfig("r_id",$ids); |
63 | return $this->view->fetch(); | 63 | return $this->view->fetch(); |
64 | } | 64 | } |
65 | + | ||
66 | + //导出服务列表excel | ||
67 | + public function export(){//导出Excel | ||
68 | + $ids = $this->request->param('ids'); | ||
69 | + if(!$ids){ | ||
70 | + return; | ||
71 | + } | ||
72 | + $ids = explode(',',$ids); | ||
73 | + AdminCommon::exportServiceList(['id'=>['in',$ids]]); | ||
74 | + } | ||
65 | } | 75 | } |
@@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
11 | <!--<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('order/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>--> | 11 | <!--<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('order/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>--> |
12 | <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('order/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a> | 12 | <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('order/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a> |
13 | <!--<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('order/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>--> | 13 | <!--<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('order/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>--> |
14 | - | 14 | + <a href="javascript:;" class="btn btn-success btn-export {:$auth->check('order/export')?'':'hide'}" title="{:__('Export')}" id="btn-export-file"><i class="fa fa-download"></i>导出</a> |
15 | <!--<div class="dropdown btn-group {:$auth->check('order/multi')?'':'hide'}">--> | 15 | <!--<div class="dropdown btn-group {:$auth->check('order/multi')?'':'hide'}">--> |
16 | <!--<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>--> | 16 | <!--<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>--> |
17 | <!--<ul class="dropdown-menu text-left" role="menu">--> | 17 | <!--<ul class="dropdown-menu text-left" role="menu">--> |
@@ -10,6 +10,7 @@ | @@ -10,6 +10,7 @@ | ||
10 | <!--<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('service_order/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>--> | 10 | <!--<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('service_order/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>--> |
11 | <!--<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('service_order/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>--> | 11 | <!--<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('service_order/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>--> |
12 | <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('service_order/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a> | 12 | <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('service_order/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a> |
13 | + <a href="javascript:;" class="btn btn-success btn-export {:$auth->check('service_order/export')?'':'hide'}" title="{:__('Export')}" id="btn-export-file"><i class="fa fa-download"></i>导出</a> | ||
13 | <!--<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('service_order/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>--> | 14 | <!--<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('service_order/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>--> |
14 | 15 | ||
15 | <!--<div class="dropdown btn-group {:$auth->check('service_order/multi')?'':'hide'}">--> | 16 | <!--<div class="dropdown btn-group {:$auth->check('service_order/multi')?'':'hide'}">--> |
@@ -20,6 +20,28 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -20,6 +20,28 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
20 | }); | 20 | }); |
21 | 21 | ||
22 | var table = $("#table"); | 22 | var table = $("#table"); |
23 | + var submitForm = function (ids, layero) { | ||
24 | + if(!ids){ | ||
25 | + return false; | ||
26 | + } | ||
27 | + $("input[name=ids]", layero).val(ids); | ||
28 | + | ||
29 | + $("form", layero).submit(); | ||
30 | + Layer.closeAll(); | ||
31 | + }; | ||
32 | + $(document).on("click", ".btn-export", function () { | ||
33 | + var ids = Table.api.selectedids(table); | ||
34 | + Layer.confirm("选择导出的选项<form action='" + Fast.api.fixurl("order/export") + "' method='post'><input type='hidden' name='ids' value=''/></form>", { | ||
35 | + title: '导出数据', | ||
36 | + btn: ["选中项(" + ids.length + "条)"], | ||
37 | + success: function (layero, index) { | ||
38 | + $(".layui-layer-btn a", layero).addClass("layui-layer-btn0"); | ||
39 | + }, yes: function (index, layero) { | ||
40 | + submitForm(ids.join(","), layero); | ||
41 | + return false; | ||
42 | + } | ||
43 | + }); | ||
44 | + }); | ||
23 | 45 | ||
24 | // 初始化表格 | 46 | // 初始化表格 |
25 | table.bootstrapTable({ | 47 | table.bootstrapTable({ |
@@ -19,7 +19,28 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -19,7 +19,28 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
19 | }); | 19 | }); |
20 | 20 | ||
21 | var table = $("#table"); | 21 | var table = $("#table"); |
22 | + var submitForm = function (ids, layero) { | ||
23 | + if(!ids){ | ||
24 | + return false; | ||
25 | + } | ||
26 | + $("input[name=ids]", layero).val(ids); | ||
22 | 27 | ||
28 | + $("form", layero).submit(); | ||
29 | + Layer.closeAll(); | ||
30 | + }; | ||
31 | + $(document).on("click", ".btn-export", function () { | ||
32 | + var ids = Table.api.selectedids(table); | ||
33 | + Layer.confirm("选择导出的选项<form action='" + Fast.api.fixurl("service_order/export") + "' method='post'><input type='hidden' name='ids' value=''/></form>", { | ||
34 | + title: '导出数据', | ||
35 | + btn: ["选中项(" + ids.length + "条)"], | ||
36 | + success: function (layero, index) { | ||
37 | + $(".layui-layer-btn a", layero).addClass("layui-layer-btn0"); | ||
38 | + }, yes: function (index, layero) { | ||
39 | + submitForm(ids.join(","), layero); | ||
40 | + return false; | ||
41 | + } | ||
42 | + }); | ||
43 | + }); | ||
23 | // 初始化表格 | 44 | // 初始化表格 |
24 | table.bootstrapTable({ | 45 | table.bootstrapTable({ |
25 | url: $.fn.bootstrapTable.defaults.extend.index_url, | 46 | url: $.fn.bootstrapTable.defaults.extend.index_url, |
-
请 注册 或 登录 后发表评论