Commit 2ad65e60 authored by zhuwei's avatar zhuwei

后台罚款账单表

parent 86538976
......@@ -53,7 +53,7 @@ class Amercement extends Basic
}
public function getAmercementList(){
public function getAmercementListPc(){
$params = $this->params;
// $params = array(
......
......@@ -115,6 +115,23 @@ class AmercementService
return $str;
}
public function getStatusName($status)
{
switch ($status) {
case 0 :
$str = '待支付';
break;
case 1 :
$str = '已支付';
break;
case 2 :
$str = '已取消';
break;
default :
$str = '暂无';
}
return $str;
}
/**
* 新增
*
......@@ -222,41 +239,74 @@ class AmercementService
}
/**
* 后台罚款账单表
* @param $params
* @param $page_no
* @param $page_size
* @return false|\PDOStatement|string|\think\Collection
*/
public function getAmercementListPc($params,$page_no, $page_size)
{
$conditions=$this->buildConditions($params);
$field = "id,status,type,money,submit_agent_id,agent_id,remarks,create_time";
$condition = [];
if($amercement_type == 0){
$condition ['agent_id']= $agent_id;
}else{
$condition ['submit_agent_id']= $agent_id;
}
$condition ['status']= $status;
$result = $this->m_amercement->getAmercementList($condition, $field, $page_no, $page_size);
$result = $this->m_amercement->getAmercementList($conditions, $field, $page_no, $page_size);
$redis_cache = new RedisCacheService();
foreach ($result as $key => $val) {
$result[$key]['type_name'] = $this->getTypeName($val['type']);
$result[$key]['status_name'] = $this->getStatusName($val['status']);
$agent_data = $redis_cache->getRedisCache(2, $val['submit_agent_id']);
$result[$key]['submit_agent_name'] = $agent_data['name'];
$result[$key]['submit_agent_phone'] = $agent_data['phone'];
if($status == 0){//待支付
$forfeit_penalty = 100;
$result[$key]['forfeit_penalty'] = $forfeit_penalty;//滞纳金
$result[$key]['money_sum'] = $forfeit_penalty + $result[$key]['money'];//罚款总金额
}elseif($status == 1){//已支付
$forfeit_penalty = 100;
$result[$key]['forfeit_penalty'] = $forfeit_penalty;
$result[$key]['money_sum'] = $forfeit_penalty + $result[$key]['money'];
$result[$key]['pay_time'] = '';
}
$result[$key]['img'] = $this->getAmercementImage($val['id']);
$agent_data = $redis_cache->getRedisCache(2, $val['agent_id']);
$result[$key]['agent_name'] = $agent_data['name'];
}
return $result;
}
/**
* 构建搜索条件
* @param $params
* @return array
*/
public function buildConditions($params)
{
$conditions = [];
//时间
if (!empty($params['start_time']) && !empty($params['end_time'])) {
$conditions['create_time'] = ['between', [$params['start_time'] . ' 00:00:00', $params['end_time'] . ' 23:59:59']];
}
//状态
if (!empty($params['status'])) {
$conditions["status"] = $params["status"];
}
//项目
if (!empty($params['type'])) {
$conditions["type"] = $params["type"];
}
//罚款ID
if (!empty($params['id'])) {
$conditions["id"] = $params["id"];
}
//提交人姓名
if (!empty($params['submit_name'])) {
$conditions["id"] = $params["id"];
}
//被罚款人姓名
if (!empty($params['name'])) {
$conditions["id"] = $params["id"];
}
return $conditions;
}
}
\ No newline at end of file
......@@ -586,6 +586,7 @@ Route::group('index', [
'recoverCheckRefund' => ['index/Refund/recoverCheckRefund', ['method' => 'POST|get']], //已审核退款-转审核状态
'addAmercement' => ['index/Amercement/addAmercement', ['method' => 'GET|POST']],
'getAmercementListPc' => ['index/Amercement/getAmercementListPc', ['method' => 'GET|POST']],
]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment