Bladeren bron

提现驳回/用户详情调整

zhangxiaobin 1 jaar geleden
bovenliggende
commit
9d7d6a82d9

+ 142 - 0
application/admin/controller/Withdraw.php

@@ -0,0 +1,142 @@
+<?php
+
+namespace app\admin\controller;
+
+use app\admin\model\Message;
+use app\common\controller\Backend;
+use think\Exception;
+use think\exception\PDOException;
+use think\exception\ValidateException;
+
+/**
+ * 提现管理
+ *
+ * @icon fa fa-circle-o
+ */
+class Withdraw extends Backend
+{
+    
+    /**
+     * Withdraw模型对象
+     * @var \app\admin\model\Withdraw
+     */
+    protected $model = null;
+
+    public function _initialize()
+    {
+        parent::_initialize();
+        $this->model = new \app\admin\model\Withdraw;
+        $typeList = [
+            'statusList' => $this->model->getStatusList(),
+            'typeList' => $this->model->getTypeList(),
+        ];
+        $this->view->assign($typeList);
+        $this->assignconfig($typeList);
+    }
+
+    public function import()
+    {
+        parent::import();
+    }
+
+    /**
+     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
+     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
+     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+     */
+    
+
+    /**
+     * 查看
+     */
+    public function index()
+    {
+        //当前是否为关联查询
+        $this->relationSearch = true;
+        //设置过滤方法
+        $this->request->filter(['strip_tags', 'trim']);
+        if ($this->request->isAjax()) {
+            //如果发送的来源是Selectpage,则转发到Selectpage
+            if ($this->request->request('keyField')) {
+                return $this->selectpage();
+            }
+            list($where, $sort, $order, $offset, $limit) = $this->buildparams();
+
+            $list = $this->model
+                    ->with(['user'])
+                    ->where($where)
+                    ->order($sort, $order)
+                    ->paginate($limit);
+
+            foreach ($list as $row) {
+                
+                $row->getRelation('user')->visible(['nickname','money']);
+            }
+
+            $result = array("total" => $list->total(), "rows" => $list->items());
+
+            return json($result);
+        }
+        return $this->view->fetch();
+    }
+
+    /**
+     * 编辑
+     */
+    public function edit($ids = null)
+    {
+        $row = $this->model->get($ids);
+        if (!$row) {
+            $this->error(__('No Results were found'));
+        }
+        $adminIds = $this->getDataLimitAdminIds();
+        if (is_array($adminIds)) {
+            if (!in_array($row[$this->dataLimitField], $adminIds)) {
+                $this->error(__('You have no permission'));
+            }
+        }
+        if ($this->request->isPost()) {
+            $params = $this->request->post("row/a");
+            if (!$params) {
+                $this->error(__('Parameter %s can not be empty', ''));
+            }
+            $params = $this->preExcludeFields($params);
+            $result = false;
+            try {
+                //是否采用模型验证
+                if ($this->modelValidate) {
+                    $name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
+                    $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
+                    $row->validateFailException(true)->validate($validate);
+                }
+                //状态:created=申请中,successed=成功,rejected=已拒绝
+                $remark = '';
+                if ($params['status'] == 'rejected') {//返回金额
+                    $user = model('User')->find($row['user_id']);
+                    $before = $user['money'];
+                    $remark = '提现'.$row['money'].'驳回';
+                    $res = model('Wallet')->lockChangeAccountRemain($row['user_id'],$row['money'],'+',$before,$remark,105,'money');
+                    if (!$res['status']) {
+                        throw new Exception($res['status']);
+                    }
+                } elseif ($params['status'] == 'successed') {
+                    $remark = '提现'.$row['money'].'通过';
+                }
+                if (!empty($remark)) {
+                    //审核结果消息通知
+                    $messageModel = new Message();
+                    $messageModel->addMessage($row['user_id'],'提现审核通知',$remark);
+                }
+                $result = $row->allowField(true)->save($params);
+            } catch (ValidateException|PDOException|Exception $e) {
+                $this->error($e->getMessage());
+            }
+            if ($result == false) {
+                $this->error(__('No rows were updated'));
+            }
+            $this->success();
+        }
+        $this->view->assign("row", $row);
+        return $this->view->fetch();
+    }
+}

+ 26 - 0
application/admin/lang/zh-cn/withdraw.php

@@ -0,0 +1,26 @@
+<?php
+
+return [
+    'User_id'          => '会员ID',
+    'Money'            => '金额',
+    'Handingfee'       => '手续费',
+    'Taxes'            => '税费',
+    'Type'             => '类型',
+    'wechat'           => '微信',
+    'alipay'           => '支付宝',
+    'bank'             => '银行',
+    'Account'          => '提现账户',
+    'Name'             => '姓名',
+    'Memo'             => '备注',
+    'Orderid'          => '订单号',
+    'Transactionid'    => '流水号',
+    'Status'           => '状态',
+    'Status created'   => '申请中',
+    'Status successed' => '成功',
+    'Status rejected'  => '已拒绝',
+    'Transfertime'     => '转账时间',
+    'Createtime'       => '创建时间',
+    'Updatetime'       => '更新时间',
+    'User.nickname'    => '昵称',
+    'User.money'       => '可用余额'
+];

+ 34 - 0
application/admin/model/Message.php

@@ -0,0 +1,34 @@
+<?php
+
+namespace app\admin\model;
+
+use think\Model;
+
+/**
+ * 系统消息模型
+ */
+class Message extends Model
+{
+
+    // 开启自动写入时间戳字段
+    protected $autoWriteTimestamp = 'int';
+    // 定义时间戳字段名
+    protected $createTime = 'createtime';
+
+
+    /**
+     * 添加系统消息
+     */
+    public static function addMessage($user_id,$title,$content) {
+        if(!$user_id || !$title || !$content) {
+            return false;
+        }
+        $data = [];
+        $data["user_id"] = $user_id;
+        $data["title"] = $title;
+        $data["content"] = $content;
+        $data["createtime"] = time();
+        return self::insert($data);
+    }
+
+}

+ 75 - 0
application/admin/model/Withdraw.php

@@ -0,0 +1,75 @@
+<?php
+
+namespace app\admin\model;
+
+use think\Model;
+
+
+class Withdraw extends Model
+{
+
+    
+
+    
+
+    // 表名
+    protected $name = 'withdraw';
+    
+    // 自动写入时间戳字段
+    protected $autoWriteTimestamp = 'int';
+
+    // 定义时间戳字段名
+    protected $createTime = 'createtime';
+    protected $updateTime = 'updatetime';
+    protected $deleteTime = false;
+
+    // 追加属性
+    protected $append = [
+        'status_text',
+        'transfertime_text'
+    ];
+    
+
+    
+    public function getStatusList()
+    {
+        return ['created' => __('Status created'), 'successed' => __('Status successed'), 'rejected' => __('Status rejected')];
+    }
+
+
+    public function getStatusTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
+        $list = $this->getStatusList();
+        return isset($list[$value]) ? $list[$value] : '';
+    }
+
+    public function getTypeList()
+    {
+        return ['wechat' => '微信', 'alipay' => '支付宝', 'bank' => '银行'];
+    }
+
+    public function getTypeTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
+        $list = $this->getTypeList();
+        return isset($list[$value]) ? $list[$value] : '';
+    }
+
+    public function getTransfertimeTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['transfertime']) ? $data['transfertime'] : '');
+        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
+    }
+
+    protected function setTransfertimeAttr($value)
+    {
+        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
+    }
+
+
+    public function user()
+    {
+        return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+}

+ 27 - 0
application/admin/validate/Withdraw.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace app\admin\validate;
+
+use think\Validate;
+
+class Withdraw extends Validate
+{
+    /**
+     * 验证规则
+     */
+    protected $rule = [
+    ];
+    /**
+     * 提示消息
+     */
+    protected $message = [
+    ];
+    /**
+     * 验证场景
+     */
+    protected $scene = [
+        'add'  => [],
+        'edit' => [],
+    ];
+    
+}

+ 92 - 0
application/admin/view/withdraw/add.html

@@ -0,0 +1,92 @@
+<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Money')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-money" data-rule="required" class="form-control" step="0.01" name="row[money]" type="number" value="0.00">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Handingfee')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-handingfee" data-rule="required" class="form-control" step="0.01" name="row[handingfee]" type="number" value="0.00">
+        </div>
+    </div>
+    <!--<div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Taxes')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-taxes" data-rule="required" class="form-control" step="0.01" name="row[taxes]" type="number" value="0.00">
+        </div>
+    </div>-->
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <select id="c-type" data-rule="required" class="form-control selectpicker" name="row[type]">
+                {foreach name="typeList" item="vo"}
+                <option value="{$key}" {in name="key" value="1"}selected{/in}>{$vo}</option>
+                {/foreach}
+            </select>
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Account')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-account" class="form-control" name="row[account]" type="text" value="">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-name" class="form-control" name="row[name]" type="text" value="">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Memo')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-memo" class="form-control" name="row[memo]" type="text" value="">
+        </div>
+    </div>
+   <!-- <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Orderid')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-orderid" class="form-control" name="row[orderid]" type="text" value="">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Transactionid')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-transactionid" class="form-control" name="row[transactionid]" type="text" value="">
+        </div>
+    </div>-->
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            
+            <div class="radio">
+            {foreach name="statusList" item="vo"}
+            <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="created"}checked{/in} /> {$vo}</label> 
+            {/foreach}
+            </div>
+
+        </div>
+    </div>
+    <!--<div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Transfertime')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-transfertime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[transfertime]" type="text" value="{:date('Y-m-d H:i:s')}">
+        </div>
+    </div>-->
+    <div class="form-group layer-footer">
+        <label class="control-label col-xs-12 col-sm-2"></label>
+        <div class="col-xs-12 col-sm-8">
+            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 92 - 0
application/admin/view/withdraw/edit.html

@@ -0,0 +1,92 @@
+<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Money')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-money" data-rule="required" class="form-control" step="0.01" name="row[money]" type="number" value="{$row.money|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Handingfee')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-handingfee" data-rule="required" class="form-control" step="0.01" name="row[handingfee]" type="number" value="{$row.handingfee|htmlentities}">
+        </div>
+    </div>
+    <!--<div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Taxes')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-taxes" data-rule="required" class="form-control" step="0.01" name="row[taxes]" type="number" value="{$row.taxes|htmlentities}">
+        </div>
+    </div>-->
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <select id="c-type" data-rule="required" class="form-control selectpicker" name="row[type]">
+                {foreach name="typeList" item="vo"}
+                <option value="{$key}" {in name="key" value="$row.type"}selected{/in}>{$vo}</option>
+                {/foreach}
+            </select>
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Account')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-account" class="form-control" name="row[account]" type="text" value="{$row.account|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-name" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Memo')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-memo" class="form-control" name="row[memo]" type="text" value="{$row.memo|htmlentities}">
+        </div>
+    </div>
+    <!--<div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Orderid')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-orderid" class="form-control" name="row[orderid]" type="text" value="{$row.orderid|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Transactionid')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-transactionid" class="form-control" name="row[transactionid]" type="text" value="{$row.transactionid|htmlentities}">
+        </div>
+    </div>-->
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            
+            <div class="radio">
+            {foreach name="statusList" item="vo"}
+            <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {if $row.status != 0} disabled {/if} {in name="key" value="$row.status"}checked{/in} /> {$vo}</label>
+            {/foreach}
+            </div>
+
+        </div>
+    </div>
+    <!--<div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Transfertime')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-transfertime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[transfertime]" type="text" value="{:$row.transfertime?datetime($row.transfertime):''}">
+        </div>
+    </div>-->
+    <div class="form-group layer-footer">
+        <label class="control-label col-xs-12 col-sm-2"></label>
+        <div class="col-xs-12 col-sm-8">
+            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 45 - 0
application/admin/view/withdraw/index.html

@@ -0,0 +1,45 @@
+<div class="panel panel-default panel-intro">
+    
+    <div class="panel-heading">
+        {:build_heading(null,FALSE)}
+        <ul class="nav nav-tabs" data-field="status">
+            <li class="{:$Think.get.status === null ? 'active' : ''}"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li>
+            {foreach name="statusList" item="vo"}
+            <li class="{:$Think.get.status === (string)$key ? 'active' : ''}"><a href="#t-{$key}" data-value="{$key}" data-toggle="tab">{$vo}</a></li>
+            {/foreach}
+        </ul>
+    </div>
+
+
+    <div class="panel-body">
+        <div id="myTabContent" class="tab-content">
+            <div class="tab-pane fade active in" id="one">
+                <div class="widget-body no-padding">
+                    <div id="toolbar" class="toolbar">
+                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
+                        <!--<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('withdraw/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
+                        <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('withdraw/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
+                        <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('withdraw/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
+                        <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('withdraw/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>
+
+                        <div class="dropdown btn-group {:$auth->check('withdraw/multi')?'':'hide'}">
+                            <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
+                            <ul class="dropdown-menu text-left" role="menu">
+                                <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>
+                                <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>
+                            </ul>
+                        </div>-->
+
+                        
+                    </div>
+                    <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
+                           data-operate-edit="{:$auth->check('withdraw/edit')}" 
+                           data-operate-del="{:$auth->check('withdraw/del')}" 
+                           width="100%">
+                    </table>
+                </div>
+            </div>
+
+        </div>
+    </div>
+</div>

+ 3 - 2
application/api/controller/Usercenter.php

@@ -44,7 +44,8 @@ class UserCenter extends Common
         // 获取基本信息
         $where = [];
         $where["id"] = $user_id;
-        $userInfo = $this->userModel->field("id,nickname,image,mobile,avatar,gender,money,age,u_id,level,jewel,age_id,constellation_id,province_id,city_id,desc,ipaddress")->where($where)->find();
+        $userInfo = $this->userModel->field("id,nickname,image,mobile,avatar,gender,money,age,u_id,level,jewel,
+        age_id,constellation_id,province_id,city_id,desc,ipaddress,is_cool,is_manager")->where($where)->find();
         // 获取技能信息
         $skillList = Model("ViewUserSkill")->getSkillInfo($user_id);
         $userInfo["skill"] = implode("/",$skillList);
@@ -92,7 +93,7 @@ class UserCenter extends Common
         $blackIds = !empty($blackList) ? array_column($blackList,'black_user_id') : [];
         $userInfo['is_black'] = in_array($user_id,$blackIds) ? 1 : 0;
 
-        $memberinfo = Db::name('guild_member')->alias('m')->field('guild.name,guild.image,guild.member,guild.desc')->join('guild','m.guild_id = guild.id','LEFT')->where(['m.user_id'=>$user_id,'m.status'=>1])->find();
+        $memberinfo = Db::name('guild_member')->alias('m')->field('m.id as `member_id`,m.user_id,guild.name,guild.image,guild.member,guild.desc')->join('guild','m.guild_id = guild.id','LEFT')->where(['m.user_id'=>$user_id,'m.status'=>1])->find();
         if ($memberinfo) {
             $userInfo['memberinfo'] = $memberinfo;
         }

+ 3 - 1
application/common/library/Auth.php

@@ -464,7 +464,7 @@ class Auth
                 $v["type"] == 4 && $userandroidpop = $v["android_image"];
             }
         }
-        $userField = 'id,pay_password,openid';
+        $userField = 'id,pay_password,openid,is_cool,is_manager';
         $user = model('User')->field($userField)->where(["id" => $this->_user->id])->with(['useralipay','userbank'])->find();
         // 获取我的推荐人的邀请码
         $preUserField = 'id,invite_no';
@@ -493,6 +493,8 @@ class Auth
         $userinfo['bind_wechat'] = !empty($user['openid']) ? 1 : 0;
         $userinfo['bind_alipay'] = !empty($userAlipay) ? 1 : 0;
         $userinfo['bind_bank'] = !empty($userBank) ? 1 : 0;
+        $userinfo['is_cool'] = isset($user['is_cool']) ? $user['is_cool'] : 0;
+        $userinfo['is_manager'] = isset($user['is_manager']) ? $user['is_manager'] : 0;
         //家族信息
         $guildField = 'id,g_id,user_id,party_id,name,image,desc,member,status';
         $guildWhere['user_id'] = $this->_user->id;

+ 66 - 0
public/assets/js/backend/withdraw.js

@@ -0,0 +1,66 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+    var Controller = {
+        index: function () {
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'withdraw/index' + location.search,
+                    //add_url: 'withdraw/add',
+                    edit_url: 'withdraw/edit',
+                    /*del_url: 'withdraw/del',
+                    multi_url: 'withdraw/multi',
+                    import_url: 'withdraw/import',*/
+                    table: 'withdraw',
+                }
+            });
+
+            var table = $("#table");
+
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                pk: 'id',
+                sortName: 'id',
+                columns: [
+                    [
+                        {checkbox: true},
+                        {field: 'id', title: __('Id')},
+                        {field: 'user_id', title: __('User_id')},
+                        {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
+                        {field: 'user.money', title: __('User.money'), operate:'BETWEEN'},
+                        {field: 'money', title: __('Money'), operate:'BETWEEN'},
+                        {field: 'handingfee', title: __('Handingfee'), operate:'BETWEEN'},
+                        //{field: 'taxes', title: __('Taxes'), operate:'BETWEEN'},
+                        {field: 'type', title: __('Type'), searchList: Config.typeList, formatter: Table.api.formatter.status},
+                        {field: 'account', title: __('Account'), operate: 'LIKE'},
+                        {field: 'name', title: __('Name'), operate: 'LIKE'},
+                        {field: 'memo', title: __('Memo'), operate: 'LIKE'},
+                        /*{field: 'orderid', title: __('Orderid'), operate: 'LIKE'},
+                        {field: 'transactionid', title: __('Transactionid'), operate: 'LIKE'},*/
+                        {field: 'status', title: __('Status'), searchList: Config.statusList, formatter: Table.api.formatter.status},
+                        {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+                        //{field: 'transfertime', title: __('Transfertime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+                        {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                    ]
+                ]
+            });
+
+            // 为表格绑定事件
+            Table.api.bindevent(table);
+        },
+        add: function () {
+            Controller.api.bindevent();
+        },
+        edit: function () {
+            Controller.api.bindevent();
+        },
+        api: {
+            bindevent: function () {
+                Form.api.bindevent($("form[role=form]"));
+            }
+        }
+    };
+    return Controller;
+});