取消订单日志

This commit is contained in:
todaywindy 2025-06-24 14:53:07 +08:00
parent 99782e9764
commit c39e3c01da
2 changed files with 43 additions and 2 deletions

View File

@ -9,6 +9,8 @@ use app\admin\model\Item;
use app\admin\model\Message;
use app\admin\model\order\Invoice;
use app\admin\model\OrderDispatch;
use app\admin\model\OrderLog;
use app\admin\model\orders\Dispatchlog;
use app\admin\model\Worker;
use app\admin\model\WorkerItem;
use app\common\controller\Backend;
@ -679,11 +681,11 @@ class Order extends Backend
if (!empty($order->dispatch->id)) {
$orderLogic = new OrderLogic();
$orderLogic->cancelOrderDispatch($order->dispatch, null, '订单被取消', false);
$orderLogic->cancelOrderDispatch($order->dispatch, $this->auth, '订单被取消', false);
//日志
$hookparams['order'] = $order;
$hookparams['role'] = 1;
$hookparams['auth'] = null;
$hookparams['auth'] = $this->auth;
$hookparams['remark'] = $params['remark'] ?? '取消订单';
Hook::listen('order_change', $hookparams);
}
@ -1001,4 +1003,33 @@ class Order extends Backend
return [$where, $sort, $order, $offset, $limit, $page, $alias, $bind];
}
public function log($ids)
{
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
$dispatch_id = $this->request->get('dispatch_id');
if (false === $this->request->isAjax()) {
//page2变更日志
$orderLogs = OrderLog::where('order_id',$ids)->order('id','desc')->select();
$this->view->assign('logs',json_encode($orderLogs));
$this->view->assign('cdnurl',config('upload.cdnurl'));
return $this->fetch('orders/dispatchlog/index');
}
//如果发送的来源是 Selectpage则转发到 Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$list = $this->model
->where($where)
->where('dispatch_id',$dispatch_id)
->order($sort, $order)
->paginate($limit);
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
}

View File

@ -413,6 +413,16 @@ ${data.receive_type == 1 ? '已收定金' : '已收全款'}
return false;
},
},
{
name: "log",
text: "订单记录",
title: "订单记录",
extend: 'data-toggle="tooltip" data-container="body"',
classname: 'btn btn-xs btn-dialog',
// icon: 'fa fa-bolt',
url: 'order/log',
dropdown: "更多",
},
{
name: 'invoice',
text: '申请开票',