Selaa lähdekoodia

总后台给维保订单指派师傅

lizhen_gitee 7 kuukautta sitten
vanhempi
commit
65fdd0653e

+ 58 - 0
application/admin/controller/Maintain.php

@@ -121,4 +121,62 @@ class Maintain extends Backend
         $this->success();
     }
 
+    /**
+     * 总部指派
+     * 复制pc端的指派,稍作调整
+     */
+    public function zhipai()
+    {
+        $id = input('id',0);
+        $row = Db::name('maintain')->where('id',$id)->find();
+        if(!$this->request->isPost()){
+            $this->view->assign('row', $row);
+            return $this->view->fetch();
+        }
+
+        //检查师傅
+        $worker_id   = input('worker_id',0);
+
+        $worker = Db::name('worker')->where('id',$worker_id)->where('status',1)->where('company_id',1)->find();
+        if(empty($worker)){
+            $this->error('没找到该师傅');
+        }
+
+        //检查订单
+        $id   = input('id',0);
+
+        Db::startTrans();
+        $info = Db::name('maintain')->where('id',$id)->lock(true)->find();
+        if(empty($info)){
+            Db::rollback();
+            $this->error('没找到该信息,请刷新重试');
+        }
+
+        if(!in_array($info['status'],[0,20,22,30,40])){
+            Db::rollback();
+            $this->error('当前订单状态,不能指派师傅');
+        }
+
+        if(!empty($info['worker_id'])){
+            Db::rollback();
+            $this->error('已经指派了师傅');
+        }
+
+        //
+        $update = [
+            'worker_id'  => $worker_id,
+            'status'     => 50,
+            'updatetime' => time(),
+        ];
+        $rs_update = Db::name('maintain')->where('id',$id)->update($update);
+        if($rs_update === false){
+            Db::rollback();
+            $this->error('指派失败,请重试');
+        }
+
+        //
+        Db::commit();
+        $this->success();
+    }
+
 }

+ 1 - 0
application/admin/controller/Worker.php

@@ -17,6 +17,7 @@ class Worker extends Backend
      * @var \app\admin\model\Worker
      */
     protected $model = null;
+    protected $selectpageFields = 'id,truename,mobile';
 
     public function _initialize()
     {

+ 30 - 0
application/admin/view/maintain/zhipai.html

@@ -0,0 +1,30 @@
+<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">{:__('Orderno')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-orderno" disabled class="form-control"  type="text" value="{$row.orderno|htmlentities}">
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Info')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-info" disabled class="form-control"  type="text" value="{$row.info|htmlentities}">
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Worker_id')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-worker_id" data-rule="required" data-source="worker/index" data-field="truename" data-params='{"custom[company_id]":"1","custom[status]":"1"}' data-format-item="{truename}-{mobile}" class="form-control selectpage" name="worker_id" type="text" value="{$row.worker_id|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 - 1
application/company/controller/Maintain.php

@@ -143,7 +143,7 @@ class Maintain extends Apic
             20 => '评估报价',
             22 => '评估报价',
 
-            30 => '报价审核',
+            30 => '用户待确认',
             40 => '待处理',
             50 => '待处理',
             60 => '待处理',

+ 19 - 0
public/assets/js/backend/maintain.js

@@ -94,6 +94,22 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                                     url:'maintainbaojia/index/order_id/{ids}?dialog=1',
                                     target:'_self',
                                 },
+                                {
+                                    name:'zhipai',
+                                    text:'总部指派',
+                                    title:'总部指派',
+                                    icon:'fa fa-exclamation-circle',
+                                    classname:'btn btn-xs btn-info btn-dialog btn-baojia',
+                                    url:'maintain/zhipai/id/{ids}?dialog=1',
+                                    target:'_self',
+                                    hidden:function(row){
+                                        //0,20,22,30,40
+                                        if(row.status == 0 || row.status == 20 || row.status == 22 || row.status == 30 || row.status == 40){
+                                            return false;
+                                        }
+                                        return true;
+                                    }
+                                },
                             ],
                             events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                     ]
@@ -117,6 +133,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
         edit: function () {
             Controller.api.bindevent();
         },
+        zhipai: function () {
+            Controller.api.bindevent();
+        },
         api: {
             bindevent: function () {
                 Form.api.bindevent($("form[role=form]"));