Jelajahi Sumber

订单后台修改

lizhen_gitee 2 tahun lalu
induk
melakukan
f4f1eec8da

+ 44 - 1
application/admin/controller/Order.php

@@ -3,7 +3,7 @@
 namespace app\admin\controller;
 
 use app\common\controller\Backend;
-
+use think\Db;
 /**
  * 报名记录
  *
@@ -75,4 +75,47 @@ class Order extends Backend
         return $this->view->fetch();
     }
 
+    /**
+     * 审核
+     */
+    public function audit($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();
+    }
+
 }

+ 118 - 0
application/admin/view/order/audit.html

@@ -0,0 +1,118 @@
+<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" data-rule="required" disabled 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">{:__('Active_id')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-active_id" data-rule="required" disabled data-source="active/index" class="form-control selectpage" name="row[active_id]" type="text" value="{$row.active_id|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" disabled 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">{:__('Student_id')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-student_id" data-rule="required" disabled data-source="userstudent/index" data-field="realname" class="form-control selectpage" name="row[student_id]" type="text" value="{$row.student_id|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Pay_fee')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-pay_fee" data-rule="required" disabled class="form-control" step="0.01" name="row[pay_fee]" type="number" value="{$row.pay_fee|htmlentities}">
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Pay_type')}:</label>
+        <div class="col-xs-12 col-sm-8">
+
+            <select  id="c-pay_type" data-rule="required" disabled class="form-control selectpicker" name="row[pay_type]">
+                {foreach name="payTypeList" item="vo"}
+                <option value="{$key}" {in name="key" value="$row.pay_type"}selected{/in}>{$vo}</option>
+                {/foreach}
+            </select>
+
+        </div>
+    </div>
+    <!--<div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Paytime')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-paytime" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[paytime]" type="text" value="{:$row.paytime?datetime($row.paytime):''}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Pay_out_trade_no')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-pay_out_trade_no" data-rule="required" class="form-control" name="row[pay_out_trade_no]" type="text" value="{$row.pay_out_trade_no|htmlentities}">
+        </div>
+    </div>-->
+    <!--<div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Offline_images')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <div class="input-group">
+                <input id="c-offline_images" class="form-control" size="50" name="row[offline_images]" type="textarea" value="{$row.offline_images|htmlentities}">
+                <div class="input-group-addon no-border no-padding">
+                    <span><button type="button" id="faupload-offline_images" class="btn btn-danger faupload" data-input-id="c-offline_images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-offline_images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
+                    <span><button type="button" id="fachoose-offline_images" class="btn btn-primary fachoose" data-input-id="c-offline_images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
+                </div>
+                <span class="msg-box n-right" for="c-offline_images"></span>
+            </div>
+            <ul class="row list-inline faupload-preview" id="p-offline_images"></ul>
+        </div>
+    </div>-->
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Offline_images')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <ul class="row list-inline faupload-preview" data-listidx="0">
+                <?php
+                        $offline_images = explode(',',$row['offline_images']);
+                        foreach($offline_images as $key => $val){
+                ?>
+                <li class="col-xs-3">
+                    <a href="{$val}" data-url="{$val}" target="_blank" class="thumbnail">
+                        <img src="{$val}" onerror="this.src='/admin.php/ajax/icon?suffix=jpg';this.onerror=null;" class="img-responsive"></a>
+                </li>
+
+                <?php } ?>
+            </ul>
+            <font color="red">点击图片可在另一页打开放大</font>
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Remark')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-remark" data-rule="required" disabled class="form-control" name="row[remark]" type="text" value="{$row.remark|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}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label>
+                {/foreach}
+            </div>
+            <font color="red">确认支付凭证截图为本次报名费用后,可改为已支付</font>
+
+        </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>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 1 - 0
application/admin/view/order/index.html

@@ -33,6 +33,7 @@
                         
                     </div>
                     <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
+                           data-operate-audit="{:$auth->check('order/audit')}"
                            data-operate-edit="{:$auth->check('order/edit')}"
                            data-operate-del="{:$auth->check('order/del')}"
                            width="100%">

+ 18 - 1
public/assets/js/backend/order.js

@@ -48,7 +48,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'offline_images', title: __('Offline_images'), operate: false,events: Table.api.events.image, formatter: Table.api.formatter.images},
                         {field: 'remark', title: __('Remark'), operate: 'LIKE'},
                         {field: 'operate', title: __('Operate'), table: table,
-                            
+                            buttons:[
+                                {
+                                    name:'audit',
+                                    text:'支付审核',
+                                    title:'支付审核',
+                                    icon:'fa fa-exclamation-circle',
+                                    classname:'btn btn-xs btn-info btn-dialog',
+                                    url:'order/audit/ids/{ids}?dialog=1',
+                                    target:'_self',
+                                    extend: 'data-area=["80%","80%"]',
+                                    hidden:function(row){
+                                       return row.pay_type == 2 ? false : true;
+                                    }
+                                }
+                            ],
                             events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                     ]
                 ]
@@ -63,6 +77,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
         edit: function () {
             Controller.api.bindevent();
         },
+        audit: function () {
+            Controller.api.bindevent();
+        },
         api: {
             bindevent: function () {
                 Form.api.bindevent($("form[role=form]"));