This commit is contained in:
xman 2025-06-02 20:45:29 +08:00
parent 68f629d74b
commit 1e13c81f16
5 changed files with 24 additions and 9 deletions

View File

@ -187,8 +187,6 @@ class Aftersale extends Backend
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {
Db::rollback();
throw $e;
// $this->error($e->getMessage());
}
if ($result === false) {
$this->error(__('No rows were inserted'));
@ -239,7 +237,7 @@ class Aftersale extends Backend
}
$params['handle_admin_id'] = $this->auth->id;
$params['handle_admin_user'] = $this->auth->nickname;
if($params['handle_type'] == 1){
if($row->type == 1){
$params['refund_amount'] = bcadd($params['company_refund_amount'],$params['worker_refund_amount'],2);
}else{
unset($params['company_refund_amount']);

View File

@ -243,7 +243,7 @@ class Aftersale2 extends Backend
$row->validateFailException()->validate($validate);
}
$params['refund_admin_id'] = $this->auth->id;
if($params['handle_type'] == 1){
if($params['type'] == 1){
$params['refund_amount'] = bcadd($params['company_refund_amount'],$params['worker_refund_amount'],2);
}else{
unset($params['company_refund_amount']);
@ -258,6 +258,7 @@ class Aftersale2 extends Backend
}
$params['status'] = 4;
$params['handle_type'] = 1;
$params['refund_time'] = date('Y-m-d H:i:s');
$result = $row->allowField(true)->save($params);

View File

@ -14,6 +14,7 @@ use think\Exception;
use think\exception\DbException;
use think\Loader;
use think\response\Json;
use function Symfony\Component\Clock\now;
/**
* 师傅列管理
@ -65,6 +66,9 @@ class Worker extends Backend
*/
public function index()
{
$today = now()->format('Y-m-01');
$today_end = now()->format('Y-m-d');
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if (false === $this->request->isAjax()) {
@ -109,6 +113,8 @@ class Worker extends Backend
];
}
$this->assign('locationData',json_encode($arr));
$this->assignconfig('default_daterange',now()->format('Y-m-01 00:00:00').' - '.now()->format('Y-m-d 23:59:59'));
return $this->view->fetch();
}
//如果发送的来源是 Selectpage则转发到 Selectpage
@ -141,6 +147,7 @@ class Worker extends Backend
->field([
'fa_worker.*',
'IFNULL(a.dispatch_count, 0) AS dispatch_count',
'IFNULL(a.get_js_count, 0) AS get_js_count',
'IFNULL(a.get_count, 0) AS get_count',
'IFNULL(a.refuse_count, 0) AS refuse_count',
'IFNULL(a.arrive_count, 0) AS arrive_count',
@ -195,6 +202,8 @@ class Worker extends Backend
// 使用 IFNULL 确保结果为 null 时返回 0
"IFNULL(COUNT(*), 0) AS dispatch_count", //分配数
"IFNULL(COUNT(CASE WHEN status NOT IN (0, -10) THEN 1 END), 0) AS get_count", //接单数
"IFNULL(COUNT(CASE WHEN status IN (30, 60) THEN 1 END), 0) AS get_js_count", //接单数
//"COUNT(CASE WHEN status IN (60) THEN 1 END) AS finish_count", //完成数
"IFNULL(COUNT(CASE WHEN status NOT IN (-10) THEN 1 END), 0) AS refuse_count", //拒绝数
"IFNULL(COUNT(arrive_time), 0) AS arrive_count", //上门数
@ -293,6 +302,10 @@ class Worker extends Backend
//好评率
$datum->good_rate = $this->_calc($datum->good_count,$datum->finish_num,4,true);
//及时联系率
$datum->get_time_rate = $this->_calc($datum->get_js_count,$datum->get_count,4,true);
$datum->avg_time_diff = $this->_calc($datum->avg_time_diff,3600,2);
}
}

View File

@ -46,6 +46,7 @@
</div>
<!--
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Handle_type')}:</label>
@ -59,6 +60,7 @@
</div>
</div>
-->
<div class="form-group">
@ -170,16 +172,15 @@
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</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}
<label for="row[status]-4">
<input id="row[status]-4" data-rule="required" name="row[status]" type="radio" value="4"/> 确认退款
</label>
</div>
</div>
</div>

View File

@ -43,6 +43,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts', 'echarts-t
{field: 'cash_value', title: __('变现值'), operate: false},
{field: 'refuse_rate', title: __('拒单率(%)'), operate: false},
{field: 'arrive_rate', title: __('上门率(%)'), operate: false},
{field: 'get_time_rate', title: __('接单及时率(%)'), operate: false},
{field: 'good_rate', title: __('好评率(%)'), operate: false},
//{field: 'refund_total', title: __('退款金额(¥)'), operate: false},