Commit bc5f4a70 authored by hujun's avatar hujun

收款开业审核

parent 3174a59d
......@@ -27,6 +27,8 @@ use app\model\ODaily;
use app\model\OImg;
use app\model\OMarchInModel;
use app\model\OPayLogAdjustment;
use app\model\OPayOpen;
use app\model\OPayOpenLog;
use app\model\OrderModel;
use app\model\ORealIncome;
use app\model\ORefundLogModel;
......@@ -4957,13 +4959,103 @@ class Finance extends Basic
/**
* 收款开业审核
*
* @return \think\response\View
* @return \think\Response|\think\response\View
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* User HuJun
* Date 19-5-16 下午2:00
* Date 19-5-16 下午3:51
*/
public function payCheckList() {
if (!$this->request->isAjax()) {
if (!$this->request->isAjax() && $this->params['excel'] == 0) {
return view("finance/pay_check_list");
}
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
if ($this->params['excel'] == 0) {
$pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize'];
} else {
$pageSize = 40000;
}
$status_string = '全部';
//0财务一审
switch ($this->params['check_status']) {
case 1 :
//财务一审
$where['a.status'] = 2;
$where['b.status'] = 2;
$status_string = '总监审核';
break;
case 2 :
//财务二审
$where['a.status'] = 3;
$where['b.status'] = 3;
$status_string = '财务二审';
break;
case 3 :
//未审核
$where['a.status'] = 0;
$status_string = '未审核';break;
case 4 :
//总监
$where['a.status'] = 1;
$where['b.status'] = 1;
break;
}
$where['a.is_del'] = 0;
$fields = 'a.id,a.create_time,a.agent_name,a.pay_log_id,a.bargain_id,a.order_id,a.house_id,a.house_address,a.status,b.create_time as disc_time,max(b.id) as two_id';
$m_pay_open = new OPayOpen();
$m_pay_open_log = new OPayOpenLog();
$list = $m_pay_open->getListCheck($pageNo, $pageSize, 'a.id desc', $fields, $where);
if ($this->params['excel'] == 0) {
foreach ($list as $k=>$v) {
if ($v['status'] == 3) {
$log_where['open_id'] = $v['id'];
$log_where['is_del'] = 0;
$list[$k]['check_time'] = $m_pay_open_log->getFieldOneValue('create_time', $log_where);
} else {
$list[$k]['check_time'] = '';
}
unset($list[$k]['two_id']);
}
$data['list'] = $list;
$data['total'] = $m_pay_open->getListCheckTotal($where);
return $this->response(200, '', $data);
}
$excel_data = [];
foreach ($list as $k=>$v) {
if ($v['status'] == 3) {
$log_where['open_id'] = $v['id'];
$log_where['is_del'] = 0;
$check_time = $m_pay_open_log->getFieldOneValue('create_time', $log_where);
} else {
$check_time = '';
}
$excel_data[$k] = [
'id' => $v['id'],
'create_time' => $v['create_time'],
'agent_name' => $v['agent_name'],
'pay_log_id' => $v['pay_log_id'],
'bargain_id' => $v['bargain_id'],
'order_id' => $v['order_id'],
'house_id' => $v['house_id'],
'house_address' => $v['house_address'],
'status_string' => $status_string,
'disc_time' => $v['disc_time'],
'check_time' => $check_time
];
}
$export = new ExportExcelUntil();
$title = [ '申请ID', '提交时间', '提交人', '收款ID', '成交报告ID', '带看订单ID', '成交商铺ID', '成交商铺地址', '状态', '总监通过时间', '开业确定时间'];
$file_name = '收款开业审核-'.$status_string;
$export->exportTable($file_name, $excel_data, 11, '开业审核-'.$status_string, $title);
}
}
<?php
namespace app\index\service;
use app\model\OPayOpen;
use app\model\OPayOpenLog;
class PayOpenService
{
private $m_open;
private $m_open_log;
public function __construct()
{
$this->m_open = new OPayOpen();
$this->m_open_log = new OPayOpenLog();
}
public function getList() {
}
}
\ No newline at end of file
......@@ -1128,7 +1128,7 @@ class AAgents extends BaseModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAgentClient(string $field = '*', array $params = [])
public function getAgentClient(string $field, array $params = [])
{
return $this->field($field)->alias('a')
->join('u_evaluate b', 'a.id = b.agents_id', 'left')
......
......@@ -79,4 +79,15 @@ class BaseModel extends Model
->select();
}
/**
* @param $field
* @param $where
* @return mixed
* User HuJun
* Date 19-5-16 下午2:50
*/
public function getFieldOneValue($field, $where)
{
return $this->where($where)->value($field);
}
}
\ No newline at end of file
<?php
namespace app\model;
use think\Db;
class OPayOpen extends BaseModel
{
protected $table = "o_paylog_open";
private $db_;
public function __construct($data = [])
{
parent::__construct($data);
$this->db_ = Db::name($this->table);
}
/**
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param string $field
* @param string $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* User HuJun
* Date 19-5-16 下午2:45
*/
public function getListCheck($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $params = '')
{
return $this->db_->field($field)->alias('a')
->join('o_paylog_open_log b', 'a.id=b.open_id', 'left')
->where($params)
->limit($pageSize)
->page($pageNo)
->order($order_)
->group('a.id')
->select();
}
/**
* @param string $field
* @param $params
* @return int|string
* User HuJun
* Date 19-5-16 下午2:47]
*/
public function getListCheckTotal($params, $field = 'a.id')
{
return $this->db_->alias('a')
->join('o_paylog_open_log b', 'a.id=b.open_id', 'left')
->where($params)
->group('a.id')
->count($field);
}
}
\ No newline at end of file
<?php
namespace app\model;
use think\Db;
class OPayOpenLog extends BaseModel
{
protected $table = "o_paylog_open_log";
private $db_;
public function __construct($data = [])
{
parent::__construct($data);
$this->db_ = Db::name($this->table);
}
}
\ No newline at end of file
......@@ -291,7 +291,12 @@ Route::group('index', [
'refundDetail' => ['index/Finance/refundDetail', ['method' => 'GET']],//退款详情
'delRefund' => ['index/Finance/delRefund', ['method' => 'POST']],//删除退款
'recoveryBargain' => ['index/Finance/recoveryBargain', ['method' => 'POST']],//撤销列表-恢复成交报告
'payCheckList' => ['index/Finance/payCheckList', ['method' => 'GET']],//收款开业审核
'payCheckList' => ['index/Finance/payCheckList', ['method' => 'GET']],//收款开业审核-视图
'payCheckListOne/:check_status' => ['index/Finance/payCheckList', ['method' => 'GET'], ['check_status' => 0]],//收款开业审核-财务一审
'payCheckListTwo/:check_status' => ['index/Finance/payCheckList', ['method' => 'GET'], ['check_status' => 1]],//收款开业审核-财务二审
'payCheckListNo/:check_status' => ['index/Finance/payCheckList', ['method' => 'GET'], ['check_status' => 2]],//收款开业审核-未审核
'payCheckListAll' => ['index/Finance/payCheckList', ['method' => 'GET']],//收款开业审核-全部
'payCheckListDisc/:check_status' => ['index/Finance/payCheckList', ['method' => 'GET'], ['check_status' => 4]],//收款开业审核-总监
'performanceInfo' => ['index/PerformanceInfo/performanceInfo', ['method' => 'post|get']],//业绩明细
'getPerformanceInfoExcel' => ['index/PerformanceInfo/getPerformanceInfoExcel', ['method' => 'post|get']],//业绩明细
......
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