Commit a03bf303 authored by zhuwei's avatar zhuwei

1

parent 79bd9095
...@@ -2,11 +2,13 @@ ...@@ -2,11 +2,13 @@
namespace app\index\controller; namespace app\index\controller;
use app\api_broker\service\RedisCacheService;
use app\index\extend\Basic; use app\index\extend\Basic;
use app\api\service\ActivityService; use app\api\service\ActivityService;
use app\index\untils\ExportExcelUntil; use app\index\untils\ExportExcelUntil;
use app\model\AStore; use app\model\AStore;
use app\model\CActivity; use app\model\CActivity;
use app\model\FApplyForFeeCheck;
use app\model\FStoreCostExt; use app\model\FStoreCostExt;
use think\Request; use think\Request;
...@@ -20,11 +22,13 @@ use think\Request; ...@@ -20,11 +22,13 @@ use think\Request;
class CostDetail extends Basic class CostDetail extends Basic
{ {
private $storeCostExt; private $storeCostExt;
private $m_check;
public function __construct(Request $request = null) public function __construct(Request $request = null)
{ {
parent::__construct($request); parent::__construct($request);
$this->storeCostExt = new FStoreCostExt(); $this->storeCostExt = new FStoreCostExt();
$this->m_check = new FApplyForFeeCheck();
} }
...@@ -261,7 +265,7 @@ class CostDetail extends Basic ...@@ -261,7 +265,7 @@ class CostDetail extends Basic
$store_params['id'] = $store_id; $store_params['id'] = $store_id;
$store_field = 'store_name'; $store_field = 'store_name';
$store_result = $m_store->getStore($store_params, $store_field); $store_result = $m_store->getStore($store_params, $store_field);
return $store_result; return $store_result['store_name'];
} }
...@@ -286,9 +290,10 @@ class CostDetail extends Basic ...@@ -286,9 +290,10 @@ class CostDetail extends Basic
switch ($type) { switch ($type) {
case 0 : case 0 :
//办公室成本'; //办公室成本';
$field = 'c.id as apply_id,b.operator_name,a.create_time,a.total_fee,a.type,a.fee_item, $field = 'c.id as apply_id,b.operator_name,a.create_time,a.total_fee,
a.purpose,c.source,c.status,c.card_no,c.card_name,c.bank,b.setting_date,a.store_attendance_num, a.type,a.fee_item,a.purpose,c.source,c.status,c.card_no,c.card_name,
a.id,b.operator_id,a.assume_fee'; c.bank,b.setting_date,a.store_attendance_num,a.id,b.operator_id,a.assume_fee,
a.apply_for_id';
break; break;
case 1 : case 1 :
...@@ -323,17 +328,106 @@ class CostDetail extends Basic ...@@ -323,17 +328,106 @@ class CostDetail extends Basic
$list['type_name'] = $this->getTypeName($list['type']); $list['type_name'] = $this->getTypeName($list['type']);
$list['fee_item_name'] = $this->getFeeItemName($list['fee_item']); $list['fee_item_name'] = $this->getFeeItemName($list['fee_item']);
$list['store_name'] = $this->getStoreName($list['store_id']); $list['store_name'] = $this->getStoreName($list['store_id']);
$list['store_name'] = $this->getStoreName($list['store_id']);
$list['status_str'] = $this->getApplyForFeeStatus($list['status']);
$list['source_str'] = $list['source'] == 0 ? 'app申请' : 'excel导入';
$list['history_list'] = $this->getHistoryList($list['store_id']); $list['history_list'] = $this->getHistoryList($list['apply_for_id']);
$result["list"] = $list; $result["list"] = $list;
return $this->response("200", "success", $result); return $this->response("200", "success", $result);
} }
public function getHistoryList($apply_id) /**
* 获取审核记录
* @param $apply_for_id
* @return array
*/
public function getHistoryList($apply_for_id)
{
$field = 'id,type,agent_id,remark,create_time';
$params['apply_for_id']= $apply_for_id;
$res = $this->m_check->selectData($field,$params);
if(!$res)
return [];
foreach ($res as $k => $v) {
$res[$k]['agent_name'] = $this->getAgentName($v['agent_id']);
$res[$k]['type_str'] = $this->getCheckType($v['type']);
}
return $res;
}
/**
* 获取经纪人姓名
* @param $agent_id
* @return mixed|string
*/
public function getAgentName($agent_id){
if(!$agent_id)
return '';
$redis_cache = new RedisCacheService();
$agent_data = $redis_cache->getRedisCache(2, $agent_id);
$agent_name = $agent_data['name'];
return $agent_name;
}
/**
* 审核状态
* @param $type
* @return string
*/
public function getCheckType($type)
{ {
//审核状态 1总监审核 2一审审核 3二审审核 4三审审核
switch ($type) {
case 1 :
$str = '总监审核';
break;
case 2 :
$str = '一审审核';
break;
case 3 :
$str = '二审审核';
break;
case 4 :
$str = '三审审核';
break;
default :
$str = '';
}
return $str;
}
/**
* 报销申请记录类型
* @param $status
* @return string
*/
public function getApplyForFeeStatus($status)
{
//0申请中 1总监通过 2一审通过 3二审通过 4三审通过
switch ($status) {
case 0 :
$str = '申请中';
break;
case 1 :
$str = '总监通过';
break;
case 2 :
$str = '一审通过';
break;
case 3 :
$str = '二审通过';
break;
case 4 :
$str = '三审通过';
break;
default :
$str = '';
}
return $str;
} }
} }
\ No newline at end of file
...@@ -70,4 +70,20 @@ class FApplyForFeeCheck extends BaseModel ...@@ -70,4 +70,20 @@ class FApplyForFeeCheck extends BaseModel
->order($order) ->order($order)
->find(); ->find();
} }
/**
* 查询多条数据
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function selectData($field,$params) {
$params['is_del'] = 0;
$result = $this->db_
->field($field)
->where($params)
->select();
return $result;
}
} }
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