diff --git a/application/plugins/view/wallet/walletadmin/index.html b/application/plugins/view/wallet/walletadmin/index.html index cb7225374..a06a17df6 100644 --- a/application/plugins/view/wallet/walletadmin/index.html +++ b/application/plugins/view/wallet/walletadmin/index.html @@ -5,7 +5,7 @@
{{if !isset($params['is_admin_index']) or $params['is_admin_index'] neq 1}} - 钱包插件 + 钱包 返回 {{/if}} @@ -14,7 +14,15 @@ @@ -36,35 +44,13 @@ {{if !empty($data_list)}} {{foreach $data_list as $v}} - - {{$v.name}} - - {{if !empty($v['images_url'])}} - - - - {{else /}} - 暂无图片 - {{/if}} - - {{$v.rules_min}}~{{$v.rules_max}} - - 满减:{{if $v['order_price'] gt 0 and $v['full_reduction_price'] gt 0}} - 满{{$v.order_price}}元 减{{$v.full_reduction_price}}元 - {{else /}} - 无满减 - {{/if}} -
- 折扣:{{if $v['discount_rate']}} - {{$v.discount_rate}}折 - {{else /}} - 无折扣 - {{/if}} - - - - - {{$v.operation_time_time}} + + {{$v.id}} + {{$v.normal_money}} + {{$v.frozen_money}} + {{$v.give_money}} + {{$v.status_text}} + {{$v.add_time_text}} {{if !isset($params['is_admin_index']) or $params['is_admin_index'] neq 1}} @@ -81,6 +67,11 @@ + + + {{if !empty($data_list)}} + {{$page_html|raw}} + {{/if}}
diff --git a/application/plugins/wallet/Walletadmin.php b/application/plugins/wallet/Walletadmin.php index cb5cefa1c..5ad0161e1 100644 --- a/application/plugins/wallet/Walletadmin.php +++ b/application/plugins/wallet/Walletadmin.php @@ -11,7 +11,7 @@ namespace app\plugins\wallet; use think\Controller; -use app\plugins\wallet\service\BaseService; +use app\plugins\wallet\service\WalletService; use app\service\PluginsService; /** @@ -33,14 +33,41 @@ class Walletadmin extends Controller */ public function index($params = []) { - $ret = PluginsService::PluginsData('wallet', '', false); - if($ret['code'] == 0) - { - $this->assign('data', $ret['data']); - return $this->fetch('../../../plugins/view/wallet/walletadmin/index'); - } else { - return $ret['msg']; - } + // 分页 + $number = MyC('admin_page_number', 10, true); + + // 条件 + $where = WalletService::WalletWhere($params); + + // 获取总数 + $total = WalletService::WalletTotal($where); + + // 分页 + $page_params = array( + 'number' => $number, + 'total' => $total, + 'where' => $params, + 'page' => isset($params['page']) ? intval($params['page']) : 1, + 'url' => PluginsHomeUrl('wallet', 'wallet', 'index'), + ); + $page = new \base\Page($page_params); + $this->assign('page_html', $page->GetPageHtml()); + + // 获取列表 + $data_params = array( + 'm' => $page->GetPageStarNumber(), + 'n' => $number, + 'where' => $where, + ); + $data = WalletService::WalletList($data_params); + $this->assign('data_list', $data['data']); + + // 静态数据 + $this->assign('wallet_status_list', WalletService::$wallet_status_list); + + // 参数 + $this->assign('params', $params); + return $this->fetch('../../../plugins/view/wallet/walletadmin/index'); } } ?> \ No newline at end of file diff --git a/application/plugins/wallet/service/BaseService.php b/application/plugins/wallet/service/BaseService.php index 513a473fd..4061f57d4 100755 --- a/application/plugins/wallet/service/BaseService.php +++ b/application/plugins/wallet/service/BaseService.php @@ -480,5 +480,6 @@ class BaseService return $where; } + } ?> \ No newline at end of file diff --git a/application/plugins/wallet/service/WalletService.php b/application/plugins/wallet/service/WalletService.php index 71aaac6c0..096b72c1a 100644 --- a/application/plugins/wallet/service/WalletService.php +++ b/application/plugins/wallet/service/WalletService.php @@ -49,7 +49,85 @@ class WalletService 0 => ['value' => 0, 'name' => '正常', 'checked' => true], 1 => ['value' => 1, 'name' => '冻结'], ]; - + + /** + * 钱包列表 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @datetime 2019-04-30T00:13:14+0800 + * @param [array] $params [输入参数] + */ + public static function WalletList($params = []) + { + $where = empty($params['where']) ? [] : $params['where']; + $m = isset($params['m']) ? intval($params['m']) : 0; + $n = isset($params['n']) ? intval($params['n']) : 10; + $field = empty($params['field']) ? '*' : $params['field']; + $order_by = empty($params['order_by']) ? 'id desc' : $params['order_by']; + + // 获取数据列表 + $data = Db::name('PluginsWallet')->field($field)->where($where)->limit($m, $n)->order($order_by)->select(); + if(!empty($data)) + { + $wallet_status_list = WalletService::$wallet_status_list; + foreach($data as &$v) + { + // 状态 + $v['status_text'] = (isset($v['status']) && isset($wallet_status_list[$v['status']])) ? $wallet_status_list[$v['status']]['name'] : '未知'; + + // 创建时间 + $v['add_time_text'] = empty($v['add_time']) ? '' : date('Y-m-d H:i:s', $v['add_time']); + } + } + return DataReturn('处理成功', 0, $data); + } + + /** + * 钱包总数 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-09-29 + * @desc description + * @param [array] $where [条件] + */ + public static function WalletTotal($where = []) + { + return (int) Db::name('PluginsWallet')->where($where)->count(); + } + + /** + * 钱包条件 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-09-29 + * @desc description + * @param [array] $params [输入参数] + */ + public static function WalletWhere($params = []) + { + $where = []; + + // 用户 + if(!empty($params['keywords'])) + { + $user_ids = Db::name('User')->where('username|mobile|email', 'like', '%'.$params['keywords'].'%')->column('id'); + if(!empty($user_ids)) + { + $where[] = ['user_id', 'in', $user_ids]; + } + } + + // 状态 + if(isset($params['status']) && $params['status'] > -1) + { + $where[] = ['status', '=', $params['status']]; + } + + return $where; + } /** * 用户钱包 diff --git a/public/static/admin/default/css/common.css b/public/static/admin/default/css/common.css index f432f5c66..70df27f71 100755 --- a/public/static/admin/default/css/common.css +++ b/public/static/admin/default/css/common.css @@ -405,7 +405,6 @@ ul {margin-top:0;} .admin {width:100%;height:100%;display:flex;display:-webkit-flex;padding-top:35px;background:#fff;} .admin .am-g {padding-left:0;padding-right:0;} /*---right Content---*/ -.content-right {overflow:auto;flex:1;-webkit-flex:1;} .content-right .content {padding:10px 10px 0 10px;} .admin-sidebar-list li a {padding:0.6rem;} .common-left-menu a:hover { background:rgba(118, 119, 120, 0.1); } diff --git a/public/static/plugins/css/wallet/admin/walletadmin.css b/public/static/plugins/css/wallet/admin/walletadmin.css index 37fce86d3..f094c969b 100644 --- a/public/static/plugins/css/wallet/admin/walletadmin.css +++ b/public/static/plugins/css/wallet/admin/walletadmin.css @@ -3,11 +3,18 @@ } @media only screen and (min-width: 641px) { .form-search .form-keyword input { - width: 50%; + width: 260px; + } + .form-search .chosen-container, .form-search select { + width: 150px !important; + display: -webkit-inline-box; + } + .form-search .chosen-container-single .chosen-single { + width: 100%; } } @media only screen and (max-width: 641px) { - .form-search .form-keyword input { - width: calc(100% - 54px); + .form-search .form-search-items { + margin-bottom: 10px; } } \ No newline at end of file