diff --git a/application/admin/behavior/OrderDispatchLog.php b/application/admin/behavior/OrderDispatchLog.php index 110b5fc..26c103e 100644 --- a/application/admin/behavior/OrderDispatchLog.php +++ b/application/admin/behavior/OrderDispatchLog.php @@ -30,6 +30,7 @@ class OrderDispatchLog 'status' => $dispatch->status, 'status_text' => $statusList[$dispatch->status], 'remark' => $remark, + 'images' => $dispatch->record_images??'', 'admin_user' => $dispatch->admin_user??'系统', ]; \app\admin\model\OrderDispatchLog::create($data); diff --git a/application/admin/controller/AutoDispatchLogic.php b/application/admin/controller/AutoDispatchLogic.php index e769791..9bbf842 100644 --- a/application/admin/controller/AutoDispatchLogic.php +++ b/application/admin/controller/AutoDispatchLogic.php @@ -41,6 +41,7 @@ class AutoDispatchLogic $worker = (new Worker())->where('id', $worker_id)->find(); $insert ['worker_name'] = $worker['name']; $insert ['worker_tel'] = $worker['tel']; + $insert['follow'] = 1; $orderDispatch = new OrderDispatch(); $res = $orderDispatch->allowField(true)->save($insert); $order->status = \app\admin\model\Order::STATUS_DISPATCHED; diff --git a/application/admin/controller/orders/Dispatch2.php b/application/admin/controller/orders/Dispatch2.php index 36198f9..bf197f3 100644 --- a/application/admin/controller/orders/Dispatch2.php +++ b/application/admin/controller/orders/Dispatch2.php @@ -85,16 +85,23 @@ class Dispatch2 extends Backend $row->btn_record = in_array($row->status, $this->model->btnActiveStatusList('btn_record')) && $this->auth->check('orders/dispatchrecord/add'); if(!in_array($row->status, $this->model->btnActiveStatusList('btn_record')) ){ + //正常情况,执行不到这里来,不用担心循环执行问题 $row->follow = 2; OrderDispatch::where('id',$row->id)->update(['follow'=>2]); } if($row->btn_record){ - if($row->follow == 0 ){ + if($row->btn_record != 2){ + return true; + }else{ + return false; + } + + /*if($row->follow == 0 ){ $row->btn_record = true; }else{ $row->btn_record = false; - } + }*/ // if($row->type == 2) // { diff --git a/application/admin/controller/orders/Dispatchrecord.php b/application/admin/controller/orders/Dispatchrecord.php index bd60cb5..e9ec383 100644 --- a/application/admin/controller/orders/Dispatchrecord.php +++ b/application/admin/controller/orders/Dispatchrecord.php @@ -126,10 +126,10 @@ class Dispatchrecord extends Backend $params['need_notice'] = 0; $params['status'] = 1; - if(!empty($params['rate'])){ //修改任务的状态 + /* if(!empty($params['rate'])){ //修改任务的状态 if($dispatch->status != $params['rate']){ $dispatch->status = $params['rate']; - $dispatch->save(); + $dispatch->save();*/ $groups = $this->auth->getGroups($this->auth->id); $groupName = ''; @@ -139,17 +139,18 @@ class Dispatchrecord extends Backend } $dispatch->admin_user = $groupName.':'. $this->auth->nickname; + $dispatch->record_images = $params['images']; $hookParams = [ 'dispatch' => $dispatch, - 'remark' => '人工跟进,备注内容:'.$params['remark'], + 'remark' => '跟进订单,跟进内容:'.$params['remark'], ]; Hook::listen('order_dispatch_change', $hookParams); - if($params['rate'] == 10){ + /* if($params['rate'] == 10){ $dispatch->got_time = date('Y-m-d H:i:s', time()); - } - } - } + }*/ + /* } + }*/ $dispatch->follow = 1; } $dispatch->record_count ++; diff --git a/application/admin/view/orders/dispatchlog/index.html b/application/admin/view/orders/dispatchlog/index.html index 32df1da..de686b7 100644 --- a/application/admin/view/orders/dispatchlog/index.html +++ b/application/admin/view/orders/dispatchlog/index.html @@ -98,6 +98,18 @@ + + + + + diff --git a/application/admin/view/orders/dispatchrecord/add.html b/application/admin/view/orders/dispatchrecord/add.html index 18f98b4..95b4fd1 100644 --- a/application/admin/view/orders/dispatchrecord/add.html +++ b/application/admin/view/orders/dispatchrecord/add.html @@ -17,7 +17,7 @@
- +
@@ -44,6 +44,7 @@ {if condition='$dispatch.type eq 1'} + - - - +<!– const STATUS_GOTIT = 10; //已接–> +<!– const STATUS_PLANIT = 20; //已预约–> +<!– const STATUS_OVERTIME = 25; //超时(过了预约时间)–> +<!– const STATUS_CLOCK = 30; //已打卡–>
+-->
@@ -70,6 +72,9 @@ + + +
diff --git a/application/common/command/CheckOrderDispatchGotCommand.php b/application/common/command/CheckOrderDispatchGotCommand.php index 16b97e0..482d83b 100644 --- a/application/common/command/CheckOrderDispatchGotCommand.php +++ b/application/common/command/CheckOrderDispatchGotCommand.php @@ -16,6 +16,7 @@ use think\Hook; class CheckOrderDispatchGotCommand extends Command { protected $title = '【自动派单未接单检测,五分钟未接单,重派派单】/【自动派接单五分钟未预约,重新派单】/【自动派单上门时间已到,未完成上门】,每分钟执行一次'; + protected function configure() { $this->setName('check:dispatch-toget') @@ -27,6 +28,8 @@ class CheckOrderDispatchGotCommand extends Command $this->_toget(); $this->_toplan(); $this->_toarrive(); + $this->_tofinished(); + $output->info('OVER'); } @@ -127,4 +130,23 @@ class CheckOrderDispatchGotCommand extends Command } } + + private function _tofinished(): void + { + + //https://f1jo9ghdket.feishu.cn/wiki/PCK8wtWnSihQrukCRq1c3nCynyd + //5.自动订单派单完之后不需要进入待跟进状态,当师傅确认上门之后10分钟之内没有更新进度(首次更新进度),则需要进入待跟进状态,需要人为跟进。 + + $Model = new OrderDispatch(); + $now = date('Y-m-d H:i:s', time() -600); //创建三十分名以 + $count = $Model->where('status', OrderDispatch::STATUS_CLOCK) + ->where('type', 2) + ->where('follow', 1) + ->whereNull('estimated_finish_time') + ->where('arrive_time', '<=', $now) + ->update(['follow'=>0]); + + echo '已上门未更新:'. $count. PHP_EOL; + } + } \ No newline at end of file diff --git a/public/assets/js/backend/orders/dispatch2.js b/public/assets/js/backend/orders/dispatch2.js index 1532d5f..2c606bd 100644 --- a/public/assets/js/backend/orders/dispatch2.js +++ b/public/assets/js/backend/orders/dispatch2.js @@ -123,11 +123,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($, //{field: 'order.source_shop', title: __('Order.source_shop'), operate: '='}, // {field: 'order.source', title: __('Order.source')}, - {field: 'orderb.customer', title: __('Order.customer'), operate: false}, + {field: 'orderb.customer', title: __('Order.customer'), operate: 'like'}, {field: 'orderb.tel', title: __('Order.tel'), operate: 'like'}, {field: 'orderb.address', title: __('Order.address'), operate: false, table: table, class: 'autocontent', formatter: Table.api.formatter.content}, - {field: 'orderb.item_title', title: __('Order.item_title'), operate: false}, + {field: 'orderb.item_title', title: __('Order.item_title'), operate: 'like'}, {field: 'orderb.detail', title: __('Order.detail'), operate: false, table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'order.images', title: __('Order.images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},