This commit is contained in:
xman 2025-03-20 21:39:38 +08:00
parent e73065e9c6
commit 71d5546148
5 changed files with 63 additions and 53 deletions

View File

@ -14,6 +14,7 @@ class OrderLog
$auth = $response['auth']??null; //角色对象
$remark = $response['remark'] ?? ''; //备注
$data = [
'order_id' => $order->id,
'order_status' => $order->status,
@ -23,6 +24,6 @@ class OrderLog
'admin_id' => $auth->id ?? 0,
'admin_user' => $role==1 ? $auth->nickname : $auth->name
];
$Model->save($data);
(new \app\admin\model\OrderLog())->save($data);
}
}

View File

@ -72,7 +72,7 @@ class Dispatch extends Backend
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
foreach ($list as &$row) {
$row->btn_edit = (in_array($row->status, $this->model->btnActiveStatusList('btn_edit'))) ? true : false;
$row->btn_cancel = (in_array($row->status, $this->model->btnActiveStatusList('btn_cancel'))) ? true : false;
$row->btn_abnormal = (in_array($row->status, $this->model->btnActiveStatusList('btn_abnormal'))) ? true : false;
@ -263,11 +263,11 @@ class Dispatch extends Backend
$this->error('订单状态已变更,请刷新后操作');
}
//取消
$item->update(['status' => OrderDispatch::STATUS_CANCEL, 'remark' => $remark]);
$item->save(['status' => OrderDispatch::STATUS_CANCEL, 'remark' => $remark]);
//回退订单状态
$order->update(['status' => Order::STATUS_DISPATCHING]);
$order->allowField(true)->save(['status' => Order::STATUS_DISPATCHING]);
$params['order'] = $order;
$params['order'] = $order->ref;
$params['role'] = 1;
$params['auth'] = $this->auth;
$params['remark'] = '派单被取消[ID' . $item->id . '],订单状态回退';
@ -279,6 +279,7 @@ class Dispatch extends Backend
Db::commit();
} catch (PDOException | Exception $e) {
Db::rollback();
throw $e;
$this->error($e->getMessage());
}
/* if ($count) {

View File

@ -8,7 +8,7 @@ return [
'Status' => '订单状态',
'Status 0' => '草稿',
'Set status to 0' => '设为草稿',
'Status 10' => '派单',
'Status 10' => '派单',
'Set status to 10' => '设为未派单',
'Status 20' => '已派单',
'Set status to 20' => '设为已派单',

View File

@ -38,7 +38,7 @@ class OrderDispatch extends Model
const STATUS_FINISH = 60; //完成
const STATUS_REFUSED = -10; //拒绝
const STATUS_MOVE = -20; //中转
const STATUS_CANCEL = -20; //取消
const STATUS_CANCEL = -30; //取消
public function getTypeList()
@ -107,7 +107,7 @@ class OrderDispatch extends Model
public function btnActiveStatusList($btn){
return [
$btns = [
'btn_edit' => [
self::STATUS_TOGET,
self::STATUS_GOTIT,
@ -134,5 +134,7 @@ class OrderDispatch extends Model
self::STATUS_FINISH
],
];
return $btns[$btn]??[];
}
}

View File

@ -8,7 +8,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
index_url: 'orders/dispatch/index' + location.search,
add_url: 'orders/dispatch/add',
edit_url: 'orders/dispatch/edit',
// del_url: 'orders/dispatch/del',
del_url: 'orders/dispatch/del',
multi_url: 'orders/dispatch/multi',
import_url: 'orders/dispatch/import',
table: 'order_dispatch',
@ -32,6 +32,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
{field: 'order.order_no', title: __('Order.order_no'), operate: 'LIKE'},
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"10":__('Status 10'),"20":__('Status 20'),"25":__('Status 25'),"30":__('Status 30'),"60":__('Status 60'),"-10":__('Status -10'),"-20":__('Status -20'),"-30":__('Status -30')}, formatter: Table.api.formatter.status},
// {field: 'worker_id', title: __('Worker_id')},
{field: 'worker_name', title: __('Worker_name'), operate: 'LIKE'},
{field: 'worker_tel', title: __('Worker_tel'), operate: 'LIKE'},
@ -39,6 +41,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
{field: 'type', title: __('Type'), searchList: {"1":__('Type 1')}, formatter: Table.api.formatter.normal},
{field: 'order.source_shop', title: __('Order.source_shop'), operate: 'LIKE'},
{field: 'order.source', title: __('Order.source')},
{field: 'order.customer', title: __('Order.customer'), operate: 'LIKE'},
@ -50,7 +53,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
{field: 'order.images', title: __('Order.images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"10":__('Status 10'),"20":__('Status 20'),"25":__('Status 25'),"30":__('Status 30'),"60":__('Status 60'),"-10":__('Status -10'),"-20":__('Status -20'),"-30":__('Status -30')}, formatter: Table.api.formatter.status},
{field: 'remark', title: __('Remark'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'plan_time', title: __('Plan_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
@ -61,8 +63,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
formatter: Table.api.formatter.operate,
buttons: [
{
name: 'edit',
@ -79,17 +81,57 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
return false;
}
},
{
name:"income",
text:"新增收款",
title:"新增收款",
classname:"btn-view btn-dialog",
extend: 'data-toggle="tooltip" data-container="body"',
icon:'fa fa-money',
url: function(row){
return 'orders/income/add?order_id='+row.order_id;
},
dropdown:"更多",
visible:function(row){
if(row.btn_income){
return true;
}
return false;
},
refresh:true,
},
{
name:"abnormal",
text:"创建异常",
title:"创建异常",
classname:"btn-add btn-dialog",
extend: 'data-toggle="tooltip" data-container="body"',
icon:'fa fa-question',
url:function(row) {
return "orders/abnormal/add?order_id="+row.order_id
},
dropdown:"更多",
visible:function(row){
if(row.btn_income){
return true;
}
return false;
},
//refresh:true,
},
{
name: 'del',
text:"取消",
title:"取消",
icon: 'fa fa-trash',
text:"取消任务",
title:"取消任务",
icon: 'fa fa-trash red',
//title: __('Del'),
extend: 'data-toggle="tooltip" data-container="body"',
classname: 'btn btn-xs btn-danger btn-delone',
classname: '',
dropdown:"更多",
click: function (data, row) {
layer.prompt({
formType: 2,
formType: 1,
value: '',
title: '请输入备注',
maxlength: 140,
@ -117,42 +159,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
return false;
},
},
{
name:"income",
text:"新增收款",
title:"新增收款",
classname:"btn-view btn-dialog",
icon:'fa fa-money',
url: function(row){
return 'orders/income/add?order_id='+row.order_id;
},
dropdown:"更多",
visible:function(row){
if(row.btn_income){
return true;
}
return false;
},
refresh:true,
},
{
name:"abnormal",
text:"创建异常",
title:"创建异常",
classname:"btn-add btn-dialog",
icon:'fa fa-add',
url:function(row) {
return "orders/abnormal/add?order_id="+row.order_id
},
dropdown:"更多",
visible:function(row){
if(row.btn_income){
return true;
}
return false;
},
//refresh:true,
}
],
}