瀏覽代碼

充值提现

zac3533 1 年之前
父節點
當前提交
ac657c22c3
共有 30 個文件被更改,包括 394 次插入404 次删除
  1. 23 4
      application/admin/controller/trade/Moneylog.php
  2. 35 7
      application/admin/controller/trade/Mongyin.php
  3. 1 1
      application/admin/controller/trade/Mongyout.php
  4. 78 5
      application/admin/controller/trade/Order.php
  5. 11 0
      application/admin/lang/vn/trade/moneylog.php
  6. 19 0
      application/admin/lang/vn/trade/mongyin.php
  7. 17 0
      application/admin/lang/vn/trade/mongyout.php
  8. 20 0
      application/admin/lang/vn/trade/order.php
  9. 2 2
      application/admin/lang/zh-cn/trade/moneylog.php
  10. 7 3
      application/admin/lang/zh-cn/trade/mongyin.php
  11. 16 9
      application/admin/lang/zh-cn/trade/order.php
  12. 0 45
      application/admin/view/trade/moneylog/add.html
  13. 0 45
      application/admin/view/trade/moneylog/edit.html
  14. 0 10
      application/admin/view/trade/moneylog/index.html
  15. 0 69
      application/admin/view/trade/mongyin/add.html
  16. 10 12
      application/admin/view/trade/mongyin/index.html
  17. 9 10
      application/admin/view/trade/mongyout/index.html
  18. 0 63
      application/admin/view/trade/order/add.html
  19. 0 63
      application/admin/view/trade/order/edit.html
  20. 1 10
      application/admin/view/trade/order/index.html
  21. 24 0
      application/admin/view/trade/order/operate.html
  22. 11 3
      application/common/model/Moneylog.php
  23. 13 0
      application/common/model/Mongyin.php
  24. 5 1
      application/common/model/Mongyout.php
  25. 18 2
      application/common/model/Order.php
  26. 2 1
      application/common/model/User.php
  27. 8 11
      public/assets/js/backend/trade/moneylog.js
  28. 41 10
      public/assets/js/backend/trade/mongyin.js
  29. 0 5
      public/assets/js/backend/trade/mongyout.js
  30. 23 13
      public/assets/js/backend/trade/order.js

+ 23 - 4
application/admin/controller/trade/Moneylog.php

@@ -28,10 +28,29 @@ class Moneylog extends Backend
 
 
     /**
-     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
-     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
-     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+     * 查看
+     * @return string|Json
+     * @throws \think\Exception
+     * @throws DbException
      */
-
+    public function index()
+    {
+        //设置过滤方法
+        $this->request->filter(['strip_tags', 'trim']);
+        if (false === $this->request->isAjax()) {
+            return $this->view->fetch();
+        }
+        //如果发送的来源是 Selectpage,则转发到 Selectpage
+        if ($this->request->request('keyField')) {
+            return $this->selectpage();
+        }
+        [$where, $sort, $order, $offset, $limit] = $this->buildparams();
+        $list = $this->model->with('users,fromuser')
+            ->where($where)
+            ->order($sort, $order)
+            ->paginate($limit);
+        $result = ['total' => $list->total(), 'rows' => $list->items()];
+        return json($result);
+    }
 
 }

+ 35 - 7
application/admin/controller/trade/Mongyin.php

@@ -16,22 +16,50 @@ class Mongyin extends Backend
      * Mongyin模型对象
      * @var \app\admin\model\trade\Mongyin
      */
-    protected $model = null;
+    protected $model  = null;
+
+    protected $mapType = null;
 
     public function _initialize()
     {
         parent::_initialize();
-        $this->model = new \app\common\model\Mongyin;
-
+        $this->model    = new \app\common\model\Mongyin;
+        $this->mapType  = array();
+        $this->assign('typeList', $this->model->getTypeList());
     }
 
 
-
     /**
-     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
-     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
-     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+     * 查看
+     * @return string|Json
+     * @throws \think\Exception
+     * @throws DbException
      */
+    public function index()
+    {
+        //设置过滤方法
+        $this->request->filter(['strip_tags', 'trim']);
+        if (false === $this->request->isAjax()) {
+            return $this->view->fetch();
+        }
+        //如果发送的来源是 Selectpage,则转发到 Selectpage
+        if ($this->request->request('keyField')) {
+            return $this->selectpage();
+        }
+        [$where, $sort, $order, $offset, $limit] = $this->buildparams();
+
+        //tab
+        $type = $this->request->param('order_type/d');
+        if($type > 0) $this->mapType['order_type'] = $type;
+        
+        $list = $this->model->with('users,admins')
+            ->where($where)
+            ->where($this->mapType)
+            ->order($sort, $order)
+            ->paginate($limit);
+        $result = ['total' => $list->total(), 'rows' => $list->items()];
+        return json($result);
+    }
 
 
 }

+ 1 - 1
application/admin/controller/trade/Mongyout.php

@@ -22,7 +22,7 @@ class Mongyout extends Backend
     {
         parent::_initialize();
         $this->model = new \app\common\model\Mongyout;
-
+        $this->assign('typeList', $this->model->getTypeList());
     }
 
 

+ 78 - 5
application/admin/controller/trade/Order.php

@@ -2,7 +2,13 @@
 
 namespace app\admin\controller\trade;
 
+use think\Db;
+use Exception;
+use think\exception\DbException;
+use think\exception\PDOException;
 use app\common\controller\Backend;
+use think\exception\ValidateException;
+
 
 /**
  * 充值记录管理
@@ -18,20 +24,87 @@ class Order extends Backend
      */
     protected $model = null;
 
+
     public function _initialize()
     {
         parent::_initialize();
         $this->model = new \app\common\model\Order;
-
+        $this->view->assign("statusList", $this->model->getstatusList());
     }
 
+    /**
+     * 查看
+     *
+     * @return string|Json
+     * @throws \think\Exception
+     * @throws DbException
+     */
+    public function index()
+    {
+        //设置过滤方法
+        $this->request->filter(['strip_tags', 'trim']);
+        if (false === $this->request->isAjax()) {
+            return $this->view->fetch();
+        }
+        //如果发送的来源是 Selectpage,则转发到 Selectpage
+        if ($this->request->request('keyField')) {
+            return $this->selectpage();
+        }
+        [$where, $sort, $order, $offset, $limit] = $this->buildparams();
+        $list = $this->model->with('users')
+            ->where($where)
+            ->order($sort, $order)
+            ->paginate($limit);
+        $result = ['total' => $list->total(), 'rows' => $list->items()];
+        return json($result);
+    }
 
 
     /**
-     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
-     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
-     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+     * 操作
+     * @param $ids
+     * @return string
+     * @throws DbException
+     * @throws \think\Exception
      */
-
+    public function operate($ids = null)
+    {
+        $row = $this->model->get($ids);
+        if (!$row) {
+            $this->error(__('No Results were found'));
+        }
+        $adminIds = $this->getDataLimitAdminIds();
+        if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
+            $this->error(__('You have no permission'));
+        }
+        if (false === $this->request->isPost()) {
+            $this->view->assign('row', $row);
+            return $this->view->fetch();
+        }
+        $params = $this->request->post('row/a');
+        if (empty($params)) {
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        $params = $this->preExcludeFields($params);
+        $result = false;
+        Db::startTrans();
+        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()->validate($validate);
+            }
+            $result = $row->allowField(true)->save($params);
+            Db::commit();
+        } catch (ValidateException|PDOException|Exception $e) {
+            Db::rollback();
+            $this->error($e->getMessage());
+        }
+        if (false === $result) {
+            $this->error(__('No rows were updated'));
+        }
+        $this->success();
+    }
 
 }

+ 11 - 0
application/admin/lang/vn/trade/moneylog.php

@@ -0,0 +1,11 @@
+<?php
+
+return [
+    'Id'          => 'ID',
+    'User_id'     => '用户',
+    'From_id'     => '来源用户',
+    'Amount'      => '变动金额',
+    'Balance'     => '实时余额',
+    'Create_time' => '创建时间',
+    'Action'      => '动作'
+];

+ 19 - 0
application/admin/lang/vn/trade/mongyin.php

@@ -0,0 +1,19 @@
+<?php
+
+return [
+    'Order_type'   => 'Kiểu đơn hàng',
+    'User_id'      => 'người dùng',
+    'Address'      => 'Địa chỉ rút tiền',
+    'Bank_name'    => 'Tên thẻ ngân hàng',
+    'Bank_card'    => 'số thẻ',
+    'Account_name' => 'AA',
+    'Amount'       => 'Số tiền nạp',
+    'Status'       => 'tình trạng',
+    'Admin_id'     => 'nhà điều hành',
+    'Usdt'         => 'USDT',
+    'Bank'         => 'Thẻ ngân hàng',
+    'Review'       => 'Ôn tập', 
+    'Create_time'  => 'thời gian sáng tạo',
+    'Update_time'  => 'Cập nhật thời gian',
+    'Confirm review'=> 'Bạn có chắc chắn muốn làm điều này?',
+];

+ 17 - 0
application/admin/lang/vn/trade/mongyout.php

@@ -0,0 +1,17 @@
+<?php
+
+return [
+    'Order_type'   => '订单类型',
+    'User_id'      => '用户ID',
+    'Address'      => '提币地址',
+    'Bank_name'    => '银行卡名称',
+    'Bank_card'    => '卡号',
+    'Account_name' => '开户名称',
+    'Amount'       => '申请金额',
+    'Fee'          => '手续费比例',
+    'Real_amount'  => '实际打款',
+    'Status'       => '状态',
+    'Admin_id'     => '操作员ID',
+    'Create_time'  => '创建时间',
+    'Update_time'  => '更新时间'
+];

+ 20 - 0
application/admin/lang/vn/trade/order.php

@@ -0,0 +1,20 @@
+<?php
+
+return [
+    'Order_no'      => '订单号',
+    'User_id'       => '用户ID',
+    'Title'         => '产品名称',
+    'Amount'        => '金额',
+    'Bonus'         => '佣金',
+    'Status'        => '状态',
+    'Create_time'   => '创建时间',
+    'Update_time'   => '更新时间',
+    'Note'          => '备注',
+    'Unpaid'        => '未支付',
+    'Finish'        => '完成',
+    'Freeze'        => '冻结',
+    'Cancel'        => '取消',
+
+
+
+];

+ 2 - 2
application/admin/lang/zh-cn/trade/moneylog.php

@@ -2,8 +2,8 @@
 
 return [
     'Id'          => 'ID',
-    'User_id'     => '用户ID',
-    'From_id'     => '来源用户ID',
+    'User_id'     => '用户',
+    'From_id'     => '来源用户',
     'Amount'      => '变动金额',
     'Balance'     => '实时余额',
     'Create_time' => '创建时间',

+ 7 - 3
application/admin/lang/zh-cn/trade/mongyin.php

@@ -2,14 +2,18 @@
 
 return [
     'Order_type'   => '订单类型',
-    'User_id'      => '用户ID',
+    'User_id'      => '用户',
     'Address'      => '提币地址',
     'Bank_name'    => '银行卡名称',
     'Bank_card'    => '卡号',
     'Account_name' => '开户名称',
     'Amount'       => '充值金额',
     'Status'       => '状态',
-    'Admin_id'     => '操作员ID',
+    'Admin_id'     => '操作员',
+    'Usdt'         => 'USDT',
+    'Bank'         => '银行卡',
+    'Review'       => '审核', 
     'Create_time'  => '创建时间',
-    'Update_time'  => '更新时间'
+    'Update_time'  => '更新时间',
+    'Confirm review'=> '确定执行该操作吗?',
 ];

+ 16 - 9
application/admin/lang/zh-cn/trade/order.php

@@ -1,13 +1,20 @@
 <?php
 
 return [
-    'Order_no'    => '订单号',
-    'User_id'     => '用户ID',
-    'Title'       => '产品名称',
-    'Amount'      => '金额',
-    'Bonus'       => '佣金',
-    'Status'      => '状态',
-    'Create_time' => '创建时间',
-    'Update_time' => '更新时间',
-    'Note'        => '备注'
+    'Order_no'      => '订单号',
+    'User_id'       => '用户ID',
+    'Title'         => '产品名称',
+    'Amount'        => '金额',
+    'Bonus'         => '佣金',
+    'Status'        => '状态',
+    'Create_time'   => '创建时间',
+    'Update_time'   => '更新时间',
+    'Note'          => '备注',
+    'Unpaid'        => '未支付',
+    'Finish'        => '完成',
+    'Freeze'        => '冻结',
+    'Cancel'        => '取消',
+
+
+
 ];

+ 0 - 45
application/admin/view/trade/moneylog/add.html

@@ -1,45 +0,0 @@
-<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">{:__('From_id')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-from_id" data-rule="required" data-source="from/index" class="form-control selectpage" name="row[from_id]" type="text" value="">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Amount')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-amount" data-rule="required" class="form-control" step="0.000001" name="row[amount]" type="number" value="0.000000">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Balance')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-balance" data-rule="required" class="form-control" step="0.000001" name="row[balance]" type="number" value="0.000000">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Create_time')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-create_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[create_time]" type="text" value="{:date('Y-m-d H:i:s')}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Action')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-action" data-rule="required" class="form-control" name="row[action]" type="number" value="0">
-        </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-primary btn-embossed disabled">{:__('OK')}</button>
-        </div>
-    </div>
-</form>

+ 0 - 45
application/admin/view/trade/moneylog/edit.html

@@ -1,45 +0,0 @@
-<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">{:__('From_id')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-from_id" data-rule="required" data-source="from/index" class="form-control selectpage" name="row[from_id]" type="text" value="{$row.from_id|htmlentities}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Amount')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-amount" data-rule="required" class="form-control" step="0.000001" name="row[amount]" type="number" value="{$row.amount|htmlentities}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Balance')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-balance" data-rule="required" class="form-control" step="0.000001" name="row[balance]" type="number" value="{$row.balance|htmlentities}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Create_time')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-create_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[create_time]" type="text" value="{:$row.create_time?datetime($row.create_time):''}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Action')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-action" data-rule="required" class="form-control" name="row[action]" type="number" value="{$row.action|htmlentities}">
-        </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-primary btn-embossed disabled">{:__('OK')}</button>
-        </div>
-    </div>
-</form>

+ 0 - 10
application/admin/view/trade/moneylog/index.html

@@ -7,18 +7,8 @@
                 <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('trade/moneylog/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('trade/moneylog/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('trade/moneylog/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
-                        
-
-                        
-
-                        
                     </div>
                     <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
-                           data-operate-edit="{:$auth->check('trade/moneylog/edit')}"
-                           data-operate-del="{:$auth->check('trade/moneylog/del')}"
                            width="100%">
                     </table>
                 </div>

+ 0 - 69
application/admin/view/trade/mongyin/add.html

@@ -1,69 +0,0 @@
-<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">{:__('Order_type')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-order_type" data-rule="required" class="form-control" name="row[order_type]" type="number" value="0">
-        </div>
-    </div>
-    <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">{:__('Address')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-address" class="form-control" name="row[address]" type="text" value="">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Bank_name')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-bank_name" class="form-control" name="row[bank_name]" type="text" value="">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Bank_card')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-bank_card" class="form-control" name="row[bank_card]" type="text">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Account_name')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-account_name" class="form-control" name="row[account_name]" type="text">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Amount')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-amount" data-rule="required" class="form-control" step="0.000001" name="row[amount]" type="number" value="0.000000">
-        </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">
-            <input id="c-status" data-rule="required" class="form-control" name="row[status]" type="number" value="0">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Create_time')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-create_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[create_time]" type="text" value="{:date('Y-m-d H:i:s')}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Update_time')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-update_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[update_time]" 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-primary btn-embossed disabled">{:__('OK')}</button>
-        </div>
-    </div>
-</form>

+ 10 - 12
application/admin/view/trade/mongyin/index.html

@@ -1,24 +1,22 @@
 <div class="panel panel-default panel-intro">
-    {:build_heading()}
+    <div class="panel-heading">
+        {:build_heading(null,FALSE)}
+        <ul class="nav nav-tabs">
+            <li class="active"><a href="#all" data-toggle="tab">{:__('All')}</a></li>
+            {foreach name="typeList" item="vo"}
+                <li><a href="#{$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('trade/mongyin/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('trade/mongyin/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('trade/mongyin/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
-                        
-
-                        
-
-                        
+                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>  
                     </div>
                     <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
-                           data-operate-edit="{:$auth->check('trade/mongyin/edit')}"
-                           data-operate-del="{:$auth->check('trade/mongyin/del')}"
                            width="100%">
                     </table>
                 </div>

+ 9 - 10
application/admin/view/trade/mongyout/index.html

@@ -1,20 +1,19 @@
 <div class="panel panel-default panel-intro">
-    {:build_heading()}
-
+    <div class="panel-heading">
+        {:build_heading(null,FALSE)}
+        <ul class="nav nav-tabs">
+            <li class="active"><a href="#all" data-toggle="tab">{:__('All')}</a></li>
+            {foreach name="typeList" item="vo"}
+                <li><a href="#{$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('trade/mongyout/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('trade/mongyout/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('trade/mongyout/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
-                        
-
-                        
-
-                        
                     </div>
                     <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
                            data-operate-edit="{:$auth->check('trade/mongyout/edit')}"

+ 0 - 63
application/admin/view/trade/order/add.html

@@ -1,63 +0,0 @@
-<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">{:__('Order_no')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-order_no" class="form-control" name="row[order_no]" type="text">
-        </div>
-    </div>
-    <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">{:__('Title')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-title" class="form-control" name="row[title]" type="text">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Amount')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-amount" data-rule="required" class="form-control" step="0.000001" name="row[amount]" type="number" value="0.000000">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Bonus')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-bonus" data-rule="required" class="form-control" step="0.000001" name="row[bonus]" type="number" value="0.000000">
-        </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">
-            <input id="c-status" data-rule="required" class="form-control" name="row[status]" type="number" value="0">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Create_time')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-create_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[create_time]" type="text" value="{:date('Y-m-d H:i:s')}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Update_time')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-update_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[update_time]" type="text" value="{:date('Y-m-d H:i:s')}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Note')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-note" class="form-control" name="row[note]" type="text">
-        </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-primary btn-embossed disabled">{:__('OK')}</button>
-        </div>
-    </div>
-</form>

+ 0 - 63
application/admin/view/trade/order/edit.html

@@ -1,63 +0,0 @@
-<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">{:__('Order_no')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-order_no" class="form-control" name="row[order_no]" type="text" value="{$row.order_no|htmlentities}">
-        </div>
-    </div>
-    <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">{:__('Title')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-title" class="form-control" name="row[title]" type="text" value="{$row.title|htmlentities}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Amount')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-amount" data-rule="required" class="form-control" step="0.000001" name="row[amount]" type="number" value="{$row.amount|htmlentities}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Bonus')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-bonus" data-rule="required" class="form-control" step="0.000001" name="row[bonus]" type="number" value="{$row.bonus|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">
-            <input id="c-status" data-rule="required" class="form-control" name="row[status]" type="number" value="{$row.status|htmlentities}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Create_time')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-create_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[create_time]" type="text" value="{:$row.create_time?datetime($row.create_time):''}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Update_time')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-update_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[update_time]" type="text" value="{:$row.update_time?datetime($row.update_time):''}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Note')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-note" class="form-control" name="row[note]" type="text" value="{$row.note|htmlentities}">
-        </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-primary btn-embossed disabled">{:__('OK')}</button>
-        </div>
-    </div>
-</form>

+ 1 - 10
application/admin/view/trade/order/index.html

@@ -7,18 +7,9 @@
                 <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('trade/order/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('trade/order/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('trade/order/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
-                        
-
-                        
-
-                        
+       
                     </div>
                     <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
-                           data-operate-edit="{:$auth->check('trade/order/edit')}"
-                           data-operate-del="{:$auth->check('trade/order/del')}"
                            width="100%">
                     </table>
                 </div>

+ 24 - 0
application/admin/view/trade/order/operate.html

@@ -0,0 +1,24 @@
+<form id="edit-form" role="form" data-toggle="validator" method="POST" action="">
+
+    <div  class="form-horizontal">
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            {:Form::radios('row[status]', $statusList, 1, ['data-rule'=>'required'])}
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Note')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            {:Form::textarea('row[note]', '', ['data-rule'=>'required'])}
+        </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-primary btn-embossed disabled">{:__('OK')}</button>
+        </div>
+    </div>
+   </div>
+</form>

+ 11 - 3
application/common/model/Moneylog.php

@@ -16,10 +16,10 @@ class Moneylog extends Model
     protected $name = 'money_log';
     
     // 自动写入时间戳字段
-    protected $autoWriteTimestamp = false;
+    protected $autoWriteTimestamp = 'int';
 
     // 定义时间戳字段名
-    protected $createTime = false;
+    protected $createTime = 'create_time';
     protected $updateTime = false;
     protected $deleteTime = false;
 
@@ -28,9 +28,17 @@ class Moneylog extends Model
         'create_time_text'
     ];
     
-
     
+    //
+    public function users()
+    {
+        return $this->hasOne('User','id','user_id',[],'LEFT')->setEagerlyType(0);
+    }
 
+    public function fromuser()
+    {
+        return $this->hasOne('User','id','from_id',[],'LEFT')->setEagerlyType(0);
+    }
 
 
     public function getCreateTimeTextAttr($value, $data)

+ 13 - 0
application/common/model/Mongyin.php

@@ -30,9 +30,22 @@ class Mongyin extends Model
     ];
     
 
+    //操作列表
+    public function getTypeList()
+    {
+        return [1 => __('Usdt'), 2 => __('Bank')];
+    }
     
 
+    public function users()
+    {
+        return $this->hasOne('User','id','user_id',[],'LEFT')->setEagerlyType(0);
+    }
 
+    public function admins()
+    {
+        return $this->hasOne('\app\admin\model\Admin','id','admin_id',[],'LEFT')->setEagerlyType(0);
+    }
 
     public function getCreateTimeTextAttr($value, $data)
     {

+ 5 - 1
application/common/model/Mongyout.php

@@ -31,7 +31,11 @@ class Mongyout extends Model
     
 
     
-
+    //操作列表
+    public function getTypeList()
+    {
+        return [1 => __('Usdt'), 2 => __('Bank')];
+    }
 
 
     public function getCreateTimeTextAttr($value, $data)

+ 18 - 2
application/common/model/Order.php

@@ -20,7 +20,7 @@ class Order extends Model
 
     // 定义时间戳字段名
     protected $createTime = 'create_time';
-    protected $updateTime = 'create_time';
+    protected $updateTime = 'update_time';
     protected $deleteTime = false;
 
     // 追加属性
@@ -29,9 +29,25 @@ class Order extends Model
         'update_time_text'
     ];
     
-
     
+    //订单状态: 0未支付 1完成 2冻结 3取消
+    const STATUSUNPAID = 0;
+    const STATUSFINISH = 1;
+    const STATUSFREEZE = 2;
+    const STATUSCANCEL = 3;
+
 
+    //users
+    public function users()
+    {
+        return $this->hasOne('User','id','user_id',[],'LEFT')->setEagerlyType(0);
+    }
+
+    //操作列表
+    public function getstatusList()
+    {
+        return [1 => __('Finish'), 2 => __('Freeze'), 3 => __('Cancel')];
+    }
 
 
     public function getCreateTimeTextAttr($value, $data)

+ 2 - 1
application/common/model/User.php

@@ -10,7 +10,8 @@ use think\Model;
  */
 class User extends Model
 {
-
+    protected $name = 'users';
+    
     // 开启自动写入时间戳字段
     protected $autoWriteTimestamp = 'int';
     // 定义时间戳字段名

+ 8 - 11
public/assets/js/backend/trade/moneylog.js

@@ -6,11 +6,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             Table.api.init({
                 extend: {
                     index_url: 'trade/moneylog/index' + location.search,
-                    add_url: 'trade/moneylog/add',
-                    edit_url: 'trade/moneylog/edit',
-                    del_url: 'trade/moneylog/del',
-                    multi_url: 'trade/moneylog/multi',
-                    import_url: 'trade/moneylog/import',
                     table: 'money_log',
                 }
             });
@@ -22,17 +17,19 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 url: $.fn.bootstrapTable.defaults.extend.index_url,
                 pk: 'id',
                 sortName: 'id',
+                
+                searchFormVisible: false,
                 columns: [
                     [
                         {checkbox: true},
-                        {field: 'id', title: __('Id')},
-                        {field: 'user_id', title: __('User_id')},
-                        {field: 'from_id', title: __('From_id')},
-                        {field: 'amount', title: __('Amount'), operate:'BETWEEN'},
-                        {field: 'balance', title: __('Balance'), operate:'BETWEEN'},
+                        {field: 'id', title: __('Id'), operate: false},
+                        {field: 'users.mobile', title: __('User_id')},
+                        {field: 'fromuser.mobile', title: __('From_id')},
+                        {field: 'amount', title: __('Amount'), operate: false},
+                        {field: 'balance', title: __('Balance'), operate: false},
                         {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                         {field: 'action', title: __('Action')},
-                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                        //{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                     ]
                 ]
             });

+ 41 - 10
public/assets/js/backend/trade/mongyin.js

@@ -6,11 +6,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             Table.api.init({
                 extend: {
                     index_url: 'trade/mongyin/index' + location.search,
-                    add_url: 'trade/mongyin/add',
-                    edit_url: 'trade/mongyin/edit',
-                    del_url: 'trade/mongyin/del',
-                    multi_url: 'trade/mongyin/multi',
-                    import_url: 'trade/mongyin/import',
                     table: 'mongy_in',
                 }
             });
@@ -28,24 +23,60 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     [
                         {checkbox: true},
                         {field: 'id', title: __('Id')},
-                        {field: 'order_type', title: __('Order_type')},
-                        {field: 'user_id', title: __('User_id')},
+                        {field: 'order_type', title: __("Order_type"), 
+                            searchList: {1:__('Usdt'), 2:__('Bank')}, 
+                            formatter: Table.api.formatter.status
+                        },
+                        {field: 'users.mobile', title: __('User_id')},
                         {field: 'address', title: __('Address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                         {field: 'bank_name', title: __('Bank_name'), operate: 'LIKE'},
                         {field: 'bank_card', title: __('Bank_card'), operate: 'LIKE'},
                         {field: 'account_name', title: __('Account_name'), operate: 'LIKE'},
                         {field: 'amount', title: __('Amount'), operate:'BETWEEN'},
-                        {field: 'status', title: __('Status')},
-                        {field: 'admin_id', title: __('Admin_id')},
+                        {field: 'status', title: __("Status"), 
+                            searchList: {1:__('Usdt'), 2:__('Bank')}, 
+                            formatter: Table.api.formatter.status
+                        },
+                        {field: 'admins.nickname', title: __('Admin_id')},
                         {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                         {field: 'update_time', title: __('Update_time'), 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}
+                        {field: 'operate', title: __('Operate'),
+                            table: table,
+                            buttons: [{
+                                name: "operate",
+                                text:  __('Review'),
+                                classname: 'btn btn-xs btn-danger btn-magic btn-ajax',
+                                confirm: __('Confirm review'),
+                                url: 'trade/mongin/review',
+                                visible: function (row) {
+                                    //if(row.status == 0 && parseFloat(row.users.balance) >= parseFloat(row.amount)){
+                                        return true;
+                           
+                                }
+                            }],
+                            events: Table.api.events.operate, formatter: Table.api.formatter.operate
+                        }
                     ]
                 ]
             });
 
             // 为表格绑定事件
             Table.api.bindevent(table);
+            //绑定TAB事件
+            $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
+                var typeStr = $(this).attr("href").replace('#', '');
+                var options = table.bootstrapTable('getOptions');
+                options.pageNumber = 1;
+                options.queryParams = function (params) {
+                    params.order_type = typeStr;
+                    return params;
+                };
+                table.bootstrapTable('refresh', {});
+                return false;
+
+            });
+
+
         },
         add: function () {
             Controller.api.bindevent();

+ 0 - 5
public/assets/js/backend/trade/mongyout.js

@@ -6,11 +6,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             Table.api.init({
                 extend: {
                     index_url: 'trade/mongyout/index' + location.search,
-                    add_url: 'trade/mongyout/add',
-                    edit_url: 'trade/mongyout/edit',
-                    del_url: 'trade/mongyout/del',
-                    multi_url: 'trade/mongyout/multi',
-                    import_url: 'trade/mongyout/import',
                     table: 'mongy_out',
                 }
             });

+ 23 - 13
public/assets/js/backend/trade/order.js

@@ -6,11 +6,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             Table.api.init({
                 extend: {
                     index_url: 'trade/order/index' + location.search,
-                    add_url: 'trade/order/add',
-                    edit_url: 'trade/order/edit',
-                    del_url: 'trade/order/del',
-                    multi_url: 'trade/order/multi',
-                    import_url: 'trade/order/import',
                     table: 'order',
                 }
             });
@@ -29,15 +24,33 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {checkbox: true},
                         {field: 'id', title: __('Id')},
                         {field: 'order_no', title: __('Order_no'), operate: 'LIKE'},
-                        {field: 'user_id', title: __('User_id')},
+                        {field: 'users.mobile', title: __('User_id')},
                         {field: 'title', title: __('Title'), operate: 'LIKE'},
                         {field: 'amount', title: __('Amount'), operate:'BETWEEN'},
                         {field: 'bonus', title: __('Bonus'), operate:'BETWEEN'},
-                        {field: 'status', title: __('Status')},
+                        {field: 'status', title: __("Status"), 
+                            searchList: {0:__('Unpaid'), 1:__('Finish'), 2:__('Freeze'), 3:__('Cancel')}, 
+                            formatter: Table.api.formatter.status
+                        },
+                        {field: 'note', title: __('Note'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                         {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                         {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
-                        {field: 'note', title: __('Note'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
-                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                        {field: 'operate', title: __('Operate'),
+                            table: table,
+                            buttons: [{
+                                name: "operate",
+                                text:  __('Operate'),
+                                classname: 'btn btn-xs btn-danger btn-magic btn-dialog',
+                                url: 'trade/order/operate',
+                                visible: function (row) {
+                                    if(row.status == 0 && parseFloat(row.users.balance) >= parseFloat(row.amount)){
+                                        return true;
+                                    }
+                                    return false;
+                                }
+                            }],
+                            events: Table.api.events.operate, formatter: Table.api.formatter.operate
+                        }
                     ]
                 ]
             });
@@ -45,10 +58,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             // 为表格绑定事件
             Table.api.bindevent(table);
         },
-        add: function () {
-            Controller.api.bindevent();
-        },
-        edit: function () {
+        operate: function () {
             Controller.api.bindevent();
         },
         api: {