跟进重构
This commit is contained in:
parent
62dbe6a876
commit
21dbd1d5a5
|
|
@ -82,6 +82,28 @@ class Dispatch2 extends Backend
|
|||
$row->btn_finished = in_array($row->status, $this->model->btnActiveStatusList('btn_finished')) && $this->auth->check('orders/dispatch2/finish');
|
||||
$row->is_disabled = in_array($row->status, $this->model->btnActiveStatusList('disabled_status'));
|
||||
$row->btn_record = in_array($row->status, $this->model->btnActiveStatusList('btn_record')) && $this->auth->check('orders/dispatchrecord/add');
|
||||
|
||||
if($row->btn_record){
|
||||
if($row->type == 2)
|
||||
{
|
||||
$row->btn_record = false;
|
||||
$now = date('Y-m-d H:i:s');
|
||||
//未上门
|
||||
if(empty($row->arrive_time) ){
|
||||
if($row->plan_time < $now){
|
||||
$row->btn_record = true;
|
||||
}
|
||||
}else{
|
||||
//已上门 完成时间超了
|
||||
if($row->estimated_finish_time > $now)
|
||||
{ //预估完成时间过了
|
||||
if($row->notice_num>0 ){
|
||||
$row->btn_record = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// $row->btn_income = (in_array($row->status, $this->model->btnActiveStatusList('btn_income')) && in_array($row->order->status, $orderModel->incomeBtnStatus())) ? true : false;
|
||||
|
||||
if($row->status == -10){ //拒绝
|
||||
|
|
|
|||
|
|
@ -90,12 +90,8 @@ class Dispatchrecord extends Backend
|
|||
if(empty($dispatch)){
|
||||
$this->error('没有关联派单');
|
||||
}
|
||||
// $list = $this->model->where('dispatch_id',$ids)->order('id','desc')->select();
|
||||
|
||||
$this->assign('dispatch',$dispatch);
|
||||
|
||||
// $this->assign('records',$list);
|
||||
|
||||
return $this->view->fetch();
|
||||
}
|
||||
$params = $this->request->post('row/a');
|
||||
|
|
@ -117,13 +113,19 @@ class Dispatchrecord extends Backend
|
|||
$this->model->validateFailException()->validate($validate);
|
||||
}
|
||||
|
||||
$params['admin_id'] = $this->auth->id;
|
||||
$result = $this->model->allowField(true)->save($params);
|
||||
$dispatch = OrderDispatch::get($params['dispatch_id']);
|
||||
|
||||
if(empty($dispatch)){
|
||||
$this->error('任务不存在');
|
||||
}
|
||||
|
||||
if($dispatch->type == 1){
|
||||
$timestamp = strtotime('+'.$params['notice_time'].' day'); // 获取明天同一时间的时间戳
|
||||
$params['notice_time'] = date('Y-m-d', $timestamp) . ' 09:00:00'; // 拼接为明天的 9 点
|
||||
$dispatch->work_progress = $params['rate'];
|
||||
}
|
||||
$params['admin_id'] = $this->auth->id;
|
||||
$result = $this->model->allowField(true)->save($params);
|
||||
|
||||
$dispatch->follow = 1;
|
||||
$dispatch->record_count ++;
|
||||
$dispatch->save();
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
<input type="hidden" name="row[dispatch_id]" value="{$dispatch.id|htmlentities}">
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Remark')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
|
@ -28,26 +29,45 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
{if condition='$dispatch.type eq 2'}
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Notice_time')}:</label>
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('联系师傅')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-notice_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[notice_time]" type="text" value="{:date('Y-m-d H:i:s')}">
|
||||
<input class="form-control" readonly type="text" value="{$dispatch.worker_name|htmlentities} - {$dispatch.worker_tel|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/if}
|
||||
|
||||
{if condition='$dispatch.type eq 1'}
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('进度')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input type="range" id="rateRange" name="row[rate]" min="{$dispatch.work_progress}" max="100" value="0" oninput="document.getElementById('rateValue').innerText = this.value + '%'">
|
||||
<span id="rateValue">0%</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Need_notice')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
||||
<select id="c-need_notice" data-rule="required" class="form-control selectpicker" name="row[need_notice]">
|
||||
{foreach name="needNoticeList" item="vo"}
|
||||
<option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Notice_time')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<div class="radio">
|
||||
<label><input type="radio" name="row[notice_time]" value="1"> 1天后</label>
|
||||
<label><input type="radio" name="row[notice_time]" value="2"> 2天后</label>
|
||||
<label><input type="radio" name="row[notice_time]" value="3"> 3天后</label>
|
||||
<label><input type="radio" name="row[notice_time]" value="4"> 4天后</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
{/if}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user