修改派单

This commit is contained in:
xman 2025-03-29 20:54:18 +08:00
parent 38c553e6f8
commit d3d63f4872
18 changed files with 127 additions and 87 deletions

View File

@ -14,8 +14,6 @@ use think\exception\DbException;
use think\exception\PDOException;
use think\exception\ValidateException;
use think\Hook;
use think\Lang;
use think\Loader;
/**
* 派单列管理
@ -188,12 +186,20 @@ class Dispatch2 extends Backend
if (!$row) {
$this->error(__('No Results were found'));
}
$order = Order::where('id',$row->id)->with(['area'])->find();
if(empty($order)){
$this->error(__('未找到关联订单'));
}
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
$this->error(__('You have no permission'));
}
if (false === $this->request->isPost()) {
$this->view->assign('row', $row);
$this->view->assign('order', $order);
return $this->view->fetch();
}
@ -207,6 +213,10 @@ class Dispatch2 extends Backend
if (empty($params)) {
$this->error(__('Parameter %s can not be empty', ''));
}
if(!in_array($row->status ,$this->model->btnActiveStatusList('btn_edit'))){
$this->error(__('任务状态已变更,请刷新后再操作'));
}
$params = $this->preExcludeFields($params);
$result = false;
Db::startTrans();
@ -216,8 +226,13 @@ class Dispatch2 extends Backend
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException()->validate($validate);
}
if($row->worker_id != $params['worker_id']){ //更换了师傅
}
$result = $row->allowField(true)->save($params);
Db::commit();
} catch (ValidateException | PDOException | Exception $e) {
Db::rollback();

View File

@ -3,7 +3,7 @@
return [
'Id' => 'ID',
'Order_id' => '订单ID',
'Order_no' => '订单号',
'Order_no' => '订单号',
'Tel' => '客户手机',
'Item_type' => '收款事项',
'Item_type 1' => '定金',

View File

@ -45,7 +45,7 @@ return [
'Handle_admin_user' => '处理人',
'Star' => '评分',
'Order.id' => 'ID',
'Order.order_no' => '订单号',
'Order.order_no' => '订单号',
'Order.customer' => '客户姓名',
'Order.tel' => '客户电话',
'Order.status' => '订单状态',

View File

@ -2,7 +2,7 @@
return [
'Id' => 'ID',
'Order_no' => '订单号',
'Order_no' => '订单号',
'Customer' => '客户姓名',
'Tel' => '客户电话',
'Status' => '订单状态',

View File

@ -21,7 +21,7 @@ return [
'Create_time' => '创建时间',
'Update_time' => '编辑时间',
'Order.id' => 'ID',
'Order.order_no' => '订单号',
'Order.order_no' => '订单号',
'Order.customer' => '客户姓名',
'Order.tel' => '客户电话',
'Order.status' => '订单状态',

View File

@ -3,7 +3,7 @@
return [
'Id' => 'ID',
'User_id' => '用户ID',
'Order_no' => '订单号',
'Order_no' => '订单号',
'Customer' => '客户姓名',
'Tel' => '客户电话',
'Status' => '订单状态',
@ -36,7 +36,7 @@ return [
'Detail' => '订单详情',
'Remark' => '订单备注',
'Images' => '图片',
'Plan_time' => '客户预约时间',
'Plan_time' => '预约时间',
'Admin_id' => '录单员ID',
'Total' => '总收款',
'Online_amount' => '线上收款',

View File

@ -2,7 +2,7 @@
return [
'Id' => 'ID',
'Order_no' => '订单号',
'Order_no' => '订单号',
'Customer' => '客户姓名',
'Tel' => '客户电话',
'Status' => '订单状态',
@ -35,7 +35,7 @@ return [
'Detail' => '订单详情',
'Remark' => '订单备注',
'Images' => '图片',
'Plan_time' => '客户预约时间',
'Plan_time' => '预约时间',
'Admin_id' => '录单员ID',
'Coupon_id' => '优惠码id',
'Total' => '总收款',

View File

@ -36,7 +36,7 @@ return [
'Create_time' => '派单时间',
'Update_time' => '编辑时间',
'Order.id' => 'ID',
'Order.order_no' => '订单号',
'Order.order_no' => '订单号',
'Order.customer' => '客户姓名',
'Order.tel' => '客户电话',
'Order.status' => '订单状态',
@ -61,7 +61,7 @@ return [
'Order.detail' => '订单详情',
'Order.remark' => '订单备注',
'Order.images' => '图片',
'Order.plan_time' => '客户预约时间',
'Order.plan_time' => '预约时间',
'Order.admin_id' => '录单员ID',
'Order.coupon_id' => '优惠码id',
'Order.total' => '总收款',

View File

@ -34,9 +34,9 @@ return [
'Admin_id' => '派单人ID',
'Admin_user' => '派单人',
'Create_time' => '派单时间',
'Update_time' => '编辑时间',
'Update_time' => '更新时间',
'Order.id' => 'ID',
'Order.order_no' => '订单号',
'Order.order_no' => '订单号',
'Order.customer' => '客户姓名',
'Order.tel' => '客户电话',
'Order.status' => '订单状态',
@ -61,7 +61,7 @@ return [
'Order.detail' => '订单详情',
'Order.remark' => '订单备注',
'Order.images' => '图片',
'Order.plan_time' => '客户预约时间',
'Order.plan_time' => '预约时间',
'Order.admin_id' => '录单员ID',
'Order.coupon_id' => '优惠码id',
'Order.total' => '总收款',

View File

@ -3,7 +3,7 @@
return [
'Id' => 'ID',
'Order_id' => '订单ID',
'Order_no' => '订单号',
'Order_no' => '订单号',
'Tel' => '客户手机',
'Item_type' => '收款事项',
'Item_type 1' => '定金',

View File

@ -12,7 +12,7 @@ return [
'Remark' => '备注',
'Create_time' => '创建时间',
'Order.id' => 'ID',
'Order.order_no' => '订单号',
'Order.order_no' => '订单号',
'Order.customer' => '客户姓名',
'Order.tel' => '客户电话',
'Order.status' => '订单状态',

View File

@ -2,7 +2,7 @@
return [
'Id' => 'ID',
'Order_no' => '订单号',
'Order_no' => '订单号',
'Customer' => '客户姓名',
'Tel' => '客户电话',
'Status' => '订单状态',
@ -35,7 +35,7 @@ return [
'Detail' => '订单详情',
'Remark' => '订单备注',
'Images' => '图片',
'Plan_time' => '客户预约时间',
'Plan_time' => '预约时间',
'Admin_id' => '录单员ID',
'Total' => '总收款',
'Cost' => '师傅成本',

View File

@ -38,7 +38,7 @@ class OrderDispatch extends Model
const STATUS_CLOCK = 30; //已打卡
const STATUS_FINISH = 60; //完成
const STATUS_REFUSED = -10; //拒绝
const STATUS_MOVE = -20; //中转
const STATUS_MOVE = -20; //中转(状态废弃)
const STATUS_CANCEL = -30; //取消
@ -49,7 +49,9 @@ class OrderDispatch extends Model
public function getStatusList()
{
return ['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')];
return ['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')];
}
public function getIsNoticeList()

View File

@ -3,7 +3,7 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Order_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input placeholder="选择订单号" id="c-order_id" data-field="order_no" data-rule="required" data-source="order/index" class="form-control selectpage" name="row[order_id]" type="text" value="{$row.order_id|htmlentities}">
<input placeholder="选择订单号" id="c-order_id" data-field="order_no" data-rule="required" data-source="order/index" class="form-control selectpage" name="row[order_id]" type="text" value="{$row.order_id|htmlentities}">
</div>
</div>

View File

@ -8,23 +8,13 @@
<!-- </div>-->
{notempty name ='action'}
<input name="row[action]" type="hidden" value="{$action|htmlentities}">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('订单号')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('订单编号')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-order_no" readonly class="form-control" data-field="order_no" type="text" value="{$order.order_no|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('服务')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-item_title" readonly class="form-control" type="text" value="{$order.item_title|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('客户姓名')}:</label>
@ -33,20 +23,37 @@
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('客户电话')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-tel" readonly class="form-control" type="text" value="{$order.tel|htmlentities}">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('客户电话')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-tel" readonly class="form-control" type="text" value="{$order.tel|htmlentities}">
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('客户地址')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-address" readonly class="form-control" type="text" value="{$order.address|htmlentities}">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('客户地址')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-address" readonly class="form-control" type="text" value="{$order.area.short_merge_name|htmlentities} {$order.address|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('服务类目')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-item_title" readonly class="form-control" type="text" value="{$order.item_title|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Order.detail')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-detail" readonly class="form-control" type="text" value="{$order.detail|htmlentities}">
</div>
</div>
{notempty name ='action'}
<input name="row[action]" type="hidden" value="{$action|htmlentities}">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('当前师傅')}:</label>
@ -78,7 +85,18 @@
</div>
</div>
{if $row['is_receipt'] }
{if $row['is_receipt']==0 }
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('线下收款')}:</label>
<div class="col-xs-12 col-sm-8">
<input readonly class="form-control" name="row[total]" type="text" value="无需收款">
</div>
</div>
{/if}
{if $row['is_receipt']==1 }
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('线下收款')}:</label>
<div class="col-xs-12 col-sm-8">
@ -124,7 +142,7 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Remark')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea class="form-control" placeholder="备注" name="row[remark]" >{$row.remark|htmlentities}</textarea>
<textarea class="form-control" data-rule="required" placeholder="备注" name="row[remark]" >{$row.remark|htmlentities}</textarea>
</div>
</div>
@ -142,43 +160,40 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Order_id')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('当前进度')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-order_id" data-field="order_no" data-rule="required" data-source="order/index" class="form-control selectpage" name="row[order_id]" type="text" value="{$row.order_id|htmlentities}">
<input readonly type="text" class="form-control" value="{$row.status_text|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Worker_id')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('当前师傅')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-worker_id" data-rule="required" data-field="name" data-source="workers/worker/index" class="form-control selectpage" name="row[worker_id]" type="text" value="{$row.worker_id|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Worker_name')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-worker_name" data-rule="required" class="form-control" name="row[worker_name]" type="text" value="{$row.worker_name|htmlentities}">
<input id="c-worker_id" placeholder="输入师傅名称,可手动选择更换" data-rule="required" data-field="name" data-source="workers/worker/index" class="form-control selectpage" name="row[worker_id]" type="text" value="{$row.worker_id|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Worker_tel')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-worker_tel" data-rule="required" class="form-control" name="row[worker_tel]" type="text" value="{$row.worker_tel|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<label class="control-label col-xs-12 col-sm-2 text-left">{:__('预约时间')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="statusList" item="vo"}
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
<input id="c-plan_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm" value="{$row.plan_time|htmlentities}" data-use-current="true" name="row[plan_time]" type="text" >
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
@ -187,8 +202,4 @@
</div>
{/notempty}
</form>

View File

@ -98,7 +98,7 @@ return [
'Home' => '首页',
'Store' => '插件市场',
'Wxapp' => '小程序',
'Services' => '服务',
'Services' => '服务类目',
'Download' => '下载',
'Demo' => '演示',
'Donation' => '捐赠',

View File

@ -24,7 +24,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
Form.events.selectpage(form);
});
$.fn.bootstrapTable.locales[Table.defaults.locale]['formatSearch'] = function(){return "订单号/客户电话/客户姓名";};
$.fn.bootstrapTable.locales[Table.defaults.locale]['formatSearch'] = function(){return "订单号/客户电话/客户姓名";};
// 初始化表格
table.bootstrapTable({
@ -56,17 +56,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
formatter: Table.api.formatter.operate,
buttons:[
{
name:"detail",
text:"",
title:"详情",
classname:"btn btn-xs btn-info btn-view btn-dialog",
icon:'fa fa-eye',
url: 'orders/abnormal/edit/'
}
]
// buttons:[
// {
// name:"detail",
// text:"",
// title:"详情",
// classname:"btn btn-xs btn-info btn-view btn-dialog",
// icon:'fa fa-eye',
// url: 'orders/abnormal/edit/'
//
// }
// ]
}
]
]

View File

@ -43,19 +43,31 @@ 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'},
{field: 'type', title: __('Type'), searchList: {"1":__('Type 1')}, formatter: Table.api.formatter.normal},
{field: 'plan_time', title: __('Plan_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{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,
custom:{25:"red"}
},
{field: 'plan_time', title: __('Plan_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false,
formatter:function(value,row,index){
if(row.status == 25){
return' <span style="color:red;font-weight: bold">'+value+'</span>';
}else{
return value;
}
}},
{field: 'order.source_shop', title: __('Order.source_shop'), operate: 'LIKE'},
{field: 'order.source', title: __('Order.source')},
// {field: 'order.source', title: __('Order.source')},
{field: 'order.customer', title: __('Order.customer'), operate: 'LIKE'},
{field: 'order.tel', title: __('Order.tel'), operate: 'LIKE'},
{field: 'order.address', title: __('Order.address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
@ -68,11 +80,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
{field: 'remark', title: __('Remark'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
// {field: 'is_notice', title: __('Is_notice'), searchList: {"0":__('Is_notice 0'),"1":__('Is_notice 1')}, formatter: Table.api.formatter.normal},
{field: 'finish_time', title: __('Finish_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
// {field: 'admin_id', title: __('Admin_id')},
{field: 'admin_user', title: __('Admin_user'), operate: 'LIKE'},
{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: 'finish_time', title: __('Finish_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,