Merge remote-tracking branch 'origin/feature/hant' into feature/hant

This commit is contained in:
hant 2025-06-05 20:23:29 +08:00
commit bdc0ff111e
4 changed files with 44 additions and 5 deletions

View File

@ -4,11 +4,13 @@ namespace app\admin\controller\orders;
use app\admin\model\Order;
use app\common\controller\Backend;
use app\common\Logic\OrderLogic;
use think\Db;
use think\Exception;
use think\exception\DbException;
use think\exception\PDOException;
use think\exception\ValidateException;
use think\Hook;
/**
* 订单异常记录
@ -114,7 +116,7 @@ class Abnormal extends Backend
$this->model->validateFailException()->validate($validate);
}
$order = Order::where('id',$params['order_id'])->find();
$order = Order::where('id',$params['order_id'])->find()->with('dispatch');
if(empty($order)){
throw new Exception('请选择订单');
}
@ -124,6 +126,30 @@ class Abnormal extends Backend
$params['abnormal_title'] = $abnormal_title;
$params['admin_id'] = $this->auth->id;
$params['admin_user'] = $this->auth->username;
if ($params['abnormal_id'] == 2 || $params['abnormal_id'] == 3){
$order->status = Order::STATUS_CANCEL;
$order->abnormal_id = $params['abnormal_id'];
$order->abnormal_title = $abnormal_title;
$order->save();
if (!empty($order->dispatch->id)) {
$orderLogic = new OrderLogic();
$orderLogic->cancelOrderDispatch($order->dispatch, $this->auth, '订单被取消', false);
//日志
$hookparams['order'] = $order;
$hookparams['role'] = 1;
$hookparams['auth'] = $this->auth;
$hookparams['remark'] = $params['remark'] ?? '';
Hook::listen('order_change', $hookparams);
}
}
$result = $this->model->allowField(true)->save($params);
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {

View File

@ -10,9 +10,9 @@ return [
'Set status to 1' => '设为已处理',
'Status -1' => '不予处理',
'Set status to -1' => '设为不予处理',
'Abnormal_id' => '异常类型',
'Abnormal_title' => '异常类型',
'Detail' => '异常详情',
'Abnormal_id' => '报错类型',
'Abnormal_title' => '报错类型',
'Detail' => '报错详情',
'Handle_detail' => '处理详情',
'Handle_admin_user' => '处理人',
'Handle_time' => '处理时间',

View File

@ -30,7 +30,17 @@
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Source')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-source" data-live-search="true" title="请选择" data-rule="required" name="row[source]" class="form-control show-tick">
<option value="0"></option>
<option value="1" selected> 修改订单</option>
<option value="2"> 取消订单</option>
<option value="3"> 重新派单</option>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Handle_detail')}:</label>

View File

@ -74,6 +74,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
//title: __('Edit'),
extend: 'data-toggle="tooltip" data-container="body"',
classname: 'btn btn-xs btn-success btn-editone',
visible: function (item) {
return item.abnormal_id == 1 || item.abnormal_id == 4;
}
}
],