zac3533 1 سال پیش
والد
کامیت
c22c165144

+ 4 - 9
application/admin/controller/trade/Order.php

@@ -67,7 +67,7 @@ class Order extends Backend
      * @throws DbException
      * @throws \think\Exception
      */
-    public function operate($ids = null)
+    public function operate($ids = null, $status = 0)
     {
         $row = $this->model->get($ids);
         if (!$row) {
@@ -77,15 +77,10 @@ class Order extends Backend
         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)) {
+        if (empty($status)) {
             $this->error(__('Parameter %s can not be empty', ''));
         }
-        $params = $this->preExcludeFields($params);
+  
         $result = false;
         Db::startTrans();
         try {
@@ -95,7 +90,7 @@ class Order extends Backend
                 $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
                 $row->validateFailException()->validate($validate);
             }
-            $result = $row->allowField(true)->save($params);
+            $result = $row->allowField(true)->save(['status'=>$status]);
             Db::commit();
         } catch (ValidateException|PDOException|Exception $e) {
             Db::rollback();

+ 3 - 1
application/admin/lang/vn/trade/order.php

@@ -11,12 +11,14 @@ return [
     'Update_time'   => '更新时间',
     'Note'          => '备注',
     'Unpaid'        => '未支付',
-    'Finish'        => '完成',
+    'Success'       => '完成',
     'Freeze'        => '冻结',
     'Cancel'        => '取消',
+    'Fail'          => 'thất bại',
     '用户类型'     => 'loại người dùng',
     '真人'         => 'người thực',
     '假人'         => 'đồ giả',
+    'Account change'=> 'Thay đổi tài khoản',
 
 
 ];

+ 3 - 1
application/admin/lang/zh-cn/trade/order.php

@@ -11,12 +11,14 @@ return [
     'Update_time'   => '更新时间',
     'Note'          => '备注',
     'Unpaid'        => '未支付',
-    'Finish'        => '完成',
+    'Success'       => '完成',
     'Freeze'        => '冻结',
     'Cancel'        => '取消',
     '用户类型'      => '用户类型',
     '真人'          => '真人',
     '假人'          => '假人',
+    'Account change'=> '帐变',
+    'Fail'          => '失败',
 
 
 ];

+ 37 - 7
public/assets/js/backend/trade/order.js

@@ -29,7 +29,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'amount', title: __('Amount'), operate:'BETWEEN'},
                         {field: 'bonus', title: __('Bonus'), operate:'BETWEEN'},
                         {field: 'status', title: __("Status"), 
-                            searchList: {0:__('Unpaid'), 1:__('Finish'), 2:__('Freeze'), 3:__('Cancel')}, 
+                            searchList: {100:__('Unpaid'), 101:__('Freeze'), 200:__('Success'), 400:__('Fail'), 500:__('Cancel')}, 
                             formatter: Table.api.formatter.status
                         },
                         {field: 'user_type', title: __("用户类型"), 
@@ -42,16 +42,46 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {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',
+                                name: "freeze",
+                                text:  __('Freeze'),
+                                classname: 'btn btn-xs btn-danger btn-magic btn-ajax',
+                                url: 'trade/order/operate/status/101',
                                 visible: function (row) {
-                                    if(row.status == 0 && parseFloat(row.users.balance) >= parseFloat(row.amount)){
+                                    if(row.status == 100 && parseFloat(row.users.balance) < parseFloat(row.amount)){
                                         return true;
                                     }
                                     return false;
-                                }
+                                },
+                                refresh: true
+                            },{
+                                name: "cancel",
+                                text:  __('Cancel'),
+                                classname: 'btn btn-xs btn-primary btn-magic btn-ajax',
+                                url: 'trade/order/operate/status/500',
+                                visible: function (row) {
+                                    if(row.status == 100 && parseFloat(row.users.balance) < parseFloat(row.amount)){
+                                        return true;
+                                    }
+                                    return false;
+                                },
+                                refresh: true
+                            },{
+                                name: "success",
+                                text:  __('Success'),
+                                classname: 'btn btn-xs btn-success btn-magic btn-ajax',
+                                url: 'trade/order/operate/status/200',
+                                visible: function (row) {
+                                    if(row.status == 100 && parseFloat(row.users.balance) < parseFloat(row.amount)){
+                                        return true;
+                                    }
+                                    return false;
+                                },
+                                refresh: true
+                            },{
+                                name: "account",
+                                text:  __('Account change'),
+                                classname: 'btn btn-xs btn-info btn-magic btn-dialog',
+                                url: 'trade/money_log/index/ids/{user_id}',
                             }],
                             events: Table.api.events.operate, formatter: Table.api.formatter.operate
                         }