正在显示
4 个修改的文件
包含
196 行增加
和
6 行删除
application/admin/controller/Toporder.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | +use think\Db; | ||
7 | + | ||
8 | +/** | ||
9 | + * 充值订单管理 | ||
10 | + * | ||
11 | + * @icon fa fa-circle-o | ||
12 | + */ | ||
13 | +class Toporder extends Backend | ||
14 | +{ | ||
15 | + | ||
16 | + /** | ||
17 | + * Order模型对象 | ||
18 | + * @var \app\admin\model\Order | ||
19 | + */ | ||
20 | + protected $model = null; | ||
21 | + | ||
22 | + public function _initialize() | ||
23 | + { | ||
24 | + parent::_initialize(); | ||
25 | +// $this->model = new \app\admin\model\Order; | ||
26 | + | ||
27 | + } | ||
28 | + | ||
29 | + /** | ||
30 | + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 | ||
31 | + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 | ||
32 | + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 | ||
33 | + */ | ||
34 | + | ||
35 | + | ||
36 | + /** | ||
37 | + * 查看 | ||
38 | + */ | ||
39 | + public function index($ids = null) | ||
40 | + { | ||
41 | + //当前是否为关联查询 | ||
42 | + $this->relationSearch = true; | ||
43 | + //设置过滤方法 | ||
44 | + $this->request->filter(['strip_tags']); | ||
45 | + if ($this->request->isAjax()) | ||
46 | + { | ||
47 | + //如果发送的来源是Selectpage,则转发到Selectpage | ||
48 | + if ($this->request->request('keyField')) | ||
49 | + { | ||
50 | + return $this->selectpage(); | ||
51 | + } | ||
52 | + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); | ||
53 | + | ||
54 | + $user = Db::name('user')->where('id',$ids)->find(); | ||
55 | + if($user['type'] == 1){ | ||
56 | + //以往的充值订单 | ||
57 | + $one = Db::name('toporder') | ||
58 | + ->where('user_id',$ids) | ||
59 | + ->where('status',2) | ||
60 | + ->count(); | ||
61 | + $one_info = Db::name('toporder') | ||
62 | + ->where('user_id',$ids) | ||
63 | + ->where('status',2) | ||
64 | + ->field('id,money,num,createtime') | ||
65 | + ->select(); | ||
66 | + //苹果充值订单 | ||
67 | + $two = Db::name('iphoneorder') | ||
68 | + ->where('user_id',$ids) | ||
69 | + ->where('status',2) | ||
70 | + ->count(); | ||
71 | + $two_info = Db::name('iphoneorder') | ||
72 | + ->where('user_id',$ids) | ||
73 | + ->where('status',2) | ||
74 | + ->field('id,money,num,createtime') | ||
75 | + ->select(); | ||
76 | + $total = $one + $two; //总条数 | ||
77 | + $list = array_merge($one_info,$two_info); | ||
78 | + $result = array("total" => $total, "rows" => $list); | ||
79 | + return json($result); | ||
80 | + }else{ | ||
81 | + $total = Db::name('toporder') | ||
82 | + ->where('user_id',$ids) | ||
83 | + ->where('status',2) | ||
84 | + ->order($sort, $order) | ||
85 | + ->count(); | ||
86 | + | ||
87 | + $list = Db::name('toporder') | ||
88 | + ->where('user_id',$ids) | ||
89 | + ->where('status',2) | ||
90 | + ->order($sort, $order) | ||
91 | + ->limit($offset, $limit) | ||
92 | + ->select(); | ||
93 | + $list = collection($list)->toArray(); | ||
94 | + $result = array("total" => $total, "rows" => $list); | ||
95 | + return json($result); | ||
96 | + } | ||
97 | + } | ||
98 | + $this->assignconfig('ids',$ids); | ||
99 | + return $this->view->fetch(); | ||
100 | + } | ||
101 | +} |
application/admin/view/toporder/index.html
0 → 100644
1 | +<div class="panel panel-default panel-intro"> | ||
2 | + {:build_heading()} | ||
3 | + | ||
4 | + <div class="panel-body"> | ||
5 | + <div id="myTabContent" class="tab-content"> | ||
6 | + <div class="tab-pane fade active in" id="one"> | ||
7 | + <div class="widget-body no-padding"> | ||
8 | + <div id="toolbar" class="toolbar"> | ||
9 | + <!--<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>--> | ||
10 | + <!--<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('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('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>--> | ||
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 | + | ||
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>--> | ||
17 | + <!--<ul class="dropdown-menu text-left" role="menu">--> | ||
18 | + <!--<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>--> | ||
19 | + <!--<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>--> | ||
20 | + <!--</ul>--> | ||
21 | + <!--</div>--> | ||
22 | + | ||
23 | + | ||
24 | + </div> | ||
25 | + <table id="table" class="table table-striped table-bordered table-hover table-nowrap" | ||
26 | + data-operate-edit="{:$auth->check('toporder/edit')}" | ||
27 | + data-operate-del="{:$auth->check('toporder/del')}" | ||
28 | + width="100%"> | ||
29 | + </table> | ||
30 | + </div> | ||
31 | + </div> | ||
32 | + | ||
33 | + </div> | ||
34 | + </div> | ||
35 | +</div> |
public/assets/js/backend/toporder.js
0 → 100644
1 | +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { | ||
2 | + | ||
3 | + var Controller = { | ||
4 | + index: function () { | ||
5 | + // 初始化表格参数配置 | ||
6 | + Table.api.init({ | ||
7 | + extend: { | ||
8 | + index_url: 'toporder/index' +'/ids/' + Config.ids + location.search, | ||
9 | + table: 'toporder', | ||
10 | + } | ||
11 | + }); | ||
12 | + | ||
13 | + var table = $("#table"); | ||
14 | + | ||
15 | + // 初始化表格 | ||
16 | + table.bootstrapTable({ | ||
17 | + url: $.fn.bootstrapTable.defaults.extend.index_url, | ||
18 | + pk: 'id', | ||
19 | + sortName: 'id', | ||
20 | + columns: [ | ||
21 | + [ | ||
22 | + {field: 'id', title: __('Id'), operate:false}, | ||
23 | + {field: 'money', title: __('充值金额')}, | ||
24 | + {field: 'num', title: __('订单号'), operate:false}, | ||
25 | + {field: 'createtime', title: __('充值时间'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
26 | + ] | ||
27 | + ] | ||
28 | + }); | ||
29 | + | ||
30 | + // 为表格绑定事件 | ||
31 | + Table.api.bindevent(table); | ||
32 | + }, | ||
33 | + add: function () { | ||
34 | + Controller.api.bindevent(); | ||
35 | + }, | ||
36 | + edit: function () { | ||
37 | + Controller.api.bindevent(); | ||
38 | + }, | ||
39 | + api: { | ||
40 | + bindevent: function () { | ||
41 | + Form.api.bindevent($("form[role=form]")); | ||
42 | + } | ||
43 | + } | ||
44 | + }; | ||
45 | + return Controller; | ||
46 | +}); |
@@ -29,28 +29,36 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -29,28 +29,36 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
29 | // {field: 'username', title: __('Username'), operate: 'LIKE'}, | 29 | // {field: 'username', title: __('Username'), operate: 'LIKE'}, |
30 | {field: 'nickname', title: __('Nickname'), operate: 'LIKE'}, | 30 | {field: 'nickname', title: __('Nickname'), operate: 'LIKE'}, |
31 | // {field: 'email', title: __('Email'), operate: 'LIKE'}, | 31 | // {field: 'email', title: __('Email'), operate: 'LIKE'}, |
32 | - // {field: 'mobile', title: __('Mobile'), operate: 'LIKE'}, | 32 | + {field: 'mobile', title: __('Mobile'), operate: 'LIKE'}, |
33 | {field: 'avatar', title: __('Avatar'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false}, | 33 | {field: 'avatar', title: __('Avatar'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false}, |
34 | // {field: 'level', title: __('Level'), operate: 'BETWEEN', sortable: true}, | 34 | // {field: 'level', title: __('Level'), operate: 'BETWEEN', sortable: true}, |
35 | {field: 'gender', title: __('Gender'), visible: false, searchList: {1: __('Male'), 0: __('Female')}}, | 35 | {field: 'gender', title: __('Gender'), visible: false, searchList: {1: __('Male'), 0: __('Female')}}, |
36 | // {field: 'score', title: __('Score'), operate: 'BETWEEN', sortable: true}, | 36 | // {field: 'score', title: __('Score'), operate: 'BETWEEN', sortable: true}, |
37 | {field: 'successions', title: __('Successions'), visible: false, operate: 'BETWEEN', sortable: true}, | 37 | {field: 'successions', title: __('Successions'), visible: false, operate: 'BETWEEN', sortable: true}, |
38 | {field: 'maxsuccessions', title: __('Maxsuccessions'), visible: false, operate: 'BETWEEN', sortable: true}, | 38 | {field: 'maxsuccessions', title: __('Maxsuccessions'), visible: false, operate: 'BETWEEN', sortable: true}, |
39 | - {field: 'logintime', title: __('Logintime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true}, | ||
40 | - {field: 'loginip', title: __('Loginip'), formatter: Table.api.formatter.search}, | ||
41 | - {field: 'jointime', title: __('Jointime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true}, | ||
42 | - {field: 'joinip', title: __('Joinip'), formatter: Table.api.formatter.search}, | 39 | + // {field: 'logintime', title: __('Logintime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true}, |
40 | + // {field: 'loginip', title: __('Loginip'), formatter: Table.api.formatter.search}, | ||
41 | + // {field: 'jointime', title: __('Jointime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true}, | ||
42 | + // {field: 'joinip', title: __('Joinip'), formatter: Table.api.formatter.search}, | ||
43 | {field: 'status', title: __('Status'), formatter: Table.api.formatter.status, searchList: {normal: __('Normal'), hidden: __('Hidden')}}, | 43 | {field: 'status', title: __('Status'), formatter: Table.api.formatter.status, searchList: {normal: __('Normal'), hidden: __('Hidden')}}, |
44 | {field: 'money', title: __('账号余额')}, | 44 | {field: 'money', title: __('账号余额')}, |
45 | {field: 'id', title: __('按钮组'), table: table, events: Table.api.events.operate, buttons: | 45 | {field: 'id', title: __('按钮组'), table: table, events: Table.api.events.operate, buttons: |
46 | [ | 46 | [ |
47 | { | 47 | { |
48 | + text: '充值信息列表', | ||
49 | + title: '充值信息列表', | ||
50 | + icon: 'fa fa-list', | ||
51 | + classname: 'btn btn-xs btn-primary btn-dialog', | ||
52 | + url: 'toporder/index', | ||
53 | + extend: 'data-area=\'["80%","80%"]\'' | ||
54 | + }, | ||
55 | + { | ||
48 | text: '购买信息列表', | 56 | text: '购买信息列表', |
49 | title: '购买信息列表', | 57 | title: '购买信息列表', |
50 | icon: 'fa fa-list', | 58 | icon: 'fa fa-list', |
51 | classname: 'btn btn-xs btn-primary btn-dialog', | 59 | classname: 'btn btn-xs btn-primary btn-dialog', |
52 | url: 'order_detail/index', | 60 | url: 'order_detail/index', |
53 | - extend: 'data-area=\'["80%","80%"]\'', | 61 | + extend: 'data-area=\'["80%","80%"]\'' |
54 | } | 62 | } |
55 | ], operate:false, formatter: Table.api.formatter.buttons | 63 | ], operate:false, formatter: Table.api.formatter.buttons |
56 | }, | 64 | }, |
-
请 注册 或 登录 后发表评论