This commit is contained in:
xman 2025-04-16 10:27:30 +08:00
parent 9796c6ba53
commit 5bce8cf36c
5 changed files with 12 additions and 4 deletions

View File

@ -243,8 +243,8 @@ class Dispatch2 extends Backend
$params['status'] = OrderDispatch::STATUS_FINISH; $params['status'] = OrderDispatch::STATUS_FINISH;
$params['finish_time'] = date('Y-m-d H:i:s'); $params['finish_time'] = date('Y-m-d H:i:s');
$params['follow'] = 2;
$result = $row->allowField(true)->save($params); $result = $row->allowField(true)->save($params);
//修改订单状态 //修改订单状态
$OrderLogic = new OrderLogic(); $OrderLogic = new OrderLogic();
$OrderLogic -> dispachFinishAfter($row,['role'=>1,'auth'=>$this->auth,'remark'=>'后台操作完成任务,操作人:'.$this->auth->nickname]); $OrderLogic -> dispachFinishAfter($row,['role'=>1,'auth'=>$this->auth,'remark'=>'后台操作完成任务,操作人:'.$this->auth->nickname]);

View File

@ -55,11 +55,11 @@ class Dispatchrecord extends Backend
if(empty($dispatch)){ if(empty($dispatch)){
$this->error('没有关联派单'); $this->error('没有关联派单');
} }
$list = $this->model->where('dispatch_id',$ids)->order('id','desc')->select(); // $list = $this->model->where('dispatch_id',$ids)->order('id','desc')->select();
$this->assign('dispatch',$dispatch); $this->assign('dispatch',$dispatch);
$this->assign('records',$list); // $this->assign('records',$list);
return $this->view->fetch(); return $this->view->fetch();
} }
@ -83,8 +83,8 @@ class Dispatchrecord extends Backend
} }
$params['admin_id'] = $this->auth->id; $params['admin_id'] = $this->auth->id;
$result = $this->model->allowField(true)->save($params); $result = $this->model->allowField(true)->save($params);
OrderDispatch::where('id',$params['dispatch_id'])->where('follow',0)->update(['follow'=>1]);
Db::commit(); Db::commit();
} catch (ValidateException|PDOException|Exception $e) { } catch (ValidateException|PDOException|Exception $e) {
Db::rollback(); Db::rollback();

View File

@ -46,6 +46,9 @@ class OrderLogic
$orderUpdate = [ $orderUpdate = [
'status' => Order::STATUS_CHECKING 'status' => Order::STATUS_CHECKING
]; ];
$orderDispatch->follow = 2;
$orderDispatch->save();
if($orderDispatch->is_receipt == 1){ //要收款,计算确认尾款 if($orderDispatch->is_receipt == 1){ //要收款,计算确认尾款
$offline_amount = $orderDispatch->total; $offline_amount = $orderDispatch->total;
$total = bcadd($order->online_amount,$offline_amount,2); $total = bcadd($order->online_amount,$offline_amount,2);

View File

@ -2,6 +2,7 @@
namespace app\common\command; namespace app\common\command;
use app\admin\model\OrderDispatch;
use app\admin\model\OrderDispatchRecord; use app\admin\model\OrderDispatchRecord;
use think\console\Command; use think\console\Command;
@ -26,12 +27,15 @@ class CheckOrdeRecordCommand extends Command
->where('status',0) ->where('status',0)
->chunk(100, function ($list) { ->chunk(100, function ($list) {
$ids = []; $ids = [];
$dispatchIds = [];
foreach ($list as $item) { foreach ($list as $item) {
//todo...通知逻辑 //todo...通知逻辑
$ids[] = $item->id; $ids[] = $item->id;
$dispatchIds = $item->dispatch_id;
//修改状态 //修改状态
} }
OrderDispatchRecord::whereIn('id',$ids)->update(['status'=>1]); OrderDispatchRecord::whereIn('id',$ids)->update(['status'=>1]);
OrderDispatch::where('id',$dispatchIds)->where('follow',1)->update(['follow'=>0]);
}); });
} }

View File

@ -65,6 +65,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
} }
}}, }},
{field: 'follow', title: __('跟进状态'), searchList: {"0":__('待跟进'),"1":__('已跟进'),"2":__('已结束')}, formatter: Table.api.formatter.normal},
{field: 'order.source_shop', title: __('Order.source_shop'), operate: 'LIKE'}, {field: 'order.source_shop', title: __('Order.source_shop'), operate: 'LIKE'},
// {field: 'order.source', title: __('Order.source')}, // {field: 'order.source', title: __('Order.source')},