Commit 47a0d497 authored by hujun's avatar hujun

成交报告详情

parent bec8db81
......@@ -34,16 +34,22 @@ class Finance extends Basic
$pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize'];
$fields = 'a.id,a.create_time,b.user_phone,b.user_name,d.internal_title,d.internal_address,a.commission,a.practical_fee';
$where['a.father_id'] = 0;
$where['c.is_del'] = 0;
$where['a.father_id'] = 0;
$where['c.is_del'] = 0;
$where['a.check_status'] = 0;
$where['a.status'] = 10;
if (!empty($this->params['check_status'])) {
$where['a.check_status'] = $this->params['check_status'];
}
if (!empty($this->params['status'])) {
$where['a.status'] = 20;
}
$bargain = new OBargainModel();
$data['data'] = $bargain->getBargain($pageNo, $pageSize, 'a.id DESC', $fields, $where);
$data['data'] = $bargain->getBargainTotal($pageNo, $pageSize, 'a.id DESC', $fields, $where);
}
$result = $this->response($data['code'], $data['msg'], $data['data']);
} else {
......@@ -121,4 +127,60 @@ class Finance extends Basic
return $result;
}
/**
* 通过id获取成交报告详情
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function bargainInfo() {
$data['code'] = 200;
$data['msg'] = "";
$data['data'] = [];
if (empty($this->params['id'])) {
$data['code'] = 101;
$data['msg'] = 'Id is null.';
} else {
$bargain = new OBargainModel();
$fields = 'a.id,a.create_time,b.user_phone,b.user_name,d.internal_title,d.internal_address,a.commission,a.practical_fee';
$where['a.father_id'] = 0;
$where['c.is_del'] = 0;
$where['a.check_status'] = 0;
$where['a.status'] = 10;
$data['data'] = $bargain->getBargainInfo($fields, $where);
}
return $this->response($data['code'], $data['msg'], $data['data']);
}
/**
* 修改成交报告中佣金
*
* @return \think\Response
*/
public function editBargainInfo() {
$data['code'] = 200;
$data['msg'] = "";
$data['data'] = [];
if (empty($this->params['id'])) {
$data['code'] = 101;
$data['msg'] = 'Id is null.';
} else {
$bargain = new OBargainModel();
$update_data['commission'] = empty($this->params['commission']) ? 0 : $this->params['commission'];
$update_data['practical_fee'] = empty($this->params['practical_fee']) ? 0 : $this->params['practical_fee'];
$data['data'] = $bargain->updateBargainById($this->params['id'], $update_data);
if ($data['data'] != 1) {
$data['code'] = 101;
$data['msg'] = 'Modify the failure.';
}
}
return $this->response($data['code'], $data['msg'], $data['data']);
}
}
\ No newline at end of file
......@@ -166,6 +166,8 @@ class OBargainModel extends Model
}
/**
* 成交报告
*
* @param int $pageNo
* @param int $pageSize
* @param string $order_
......@@ -179,7 +181,7 @@ class OBargainModel extends Model
public function getBargain($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $params = '') {
return $this->field($field)->alias('a')
->join('o_report b','a.report_id = b.id','left')
->join('o_order c','c.f_id = b.id','left')
->join('o_order c','a.order_id = c.id','left')
->join('g_houses d','c.house_id = d.id','left')
->where($params)
->order($order_)
......@@ -188,6 +190,24 @@ class OBargainModel extends Model
->select();
}
/**
* 成交报告总数
*
* @param string $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getBargainTotal($params = '') {
return $this->alias('a')
->join('o_report b','a.report_id = b.id','left')
->join('o_order c','a.order_id = c.id','left')
->join('g_houses d','c.house_id = d.id','left')
->where($params)
->select();
}
/**
* 成交报告审核
*
......@@ -244,4 +264,22 @@ class OBargainModel extends Model
return $result;
}
/**
* 获取成交报告详情
*
* @param $field
* @param $params
* @return array|false|\PDOStatement|string|Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getBargainInfo($field,$params) {
return $this->field($field)->alias('a')
->join('o_report b','a.report_id = b.id','left')
->join('o_order c','a.order_id = c.id','left')
->join('g_houses d','c.house_id = d.id','left')
->where($params)
->find();
}
}
\ No newline at end of file
......@@ -166,10 +166,18 @@ Route::group('index', [
'setting_index' => ['index/Setting/index', [ 'method' => 'get' ] ], //全局参数设置页面
'getSetting' => ['index/Setting/getSetting', [ 'method' => 'get|post' ] ], //新增和修改全局参数设置
'getMenu' => ['index/Auth/getMenu', [ 'method' => 'get|post' ] ], //新增和修改全局参数设置
'reportList' => ['index/Finance/reportList', [ 'method' => 'get|post' ] ], //财务 成交报告
'reportListAttache/:check_status' => ['index/Finance/reportList', [ 'method' => 'get' ] ,['check_status'=>0]], //财务 成交报告-未结单-专员审核
'reportListManager/:check_status' => ['index/Finance/reportList', [ 'method' => 'get' ] ,['check_status'=>10]], //财务 成交报告-未结单-经理审核
'reportListMajordomo/:check_status' => ['index/Finance/reportList', [ 'method' => 'get' ] ,['check_status'=>20]], //财务 成交报告-未结单-总监审核
'reportListCashier/:check_status' => ['index/Finance/reportList', [ 'method' => 'get' ] ,['check_status'=>30]], //财务 成交报告-未结单-出纳审核
'reportListStatement/:check_status' => ['index/Finance/reportList', [ 'method' => 'get' ] ,['check_status'=>40]], //财务 成交报告-已结单
'reportListBackout/:status' => ['index/Finance/reportList', [ 'method' => 'get' ] ,['status'=>20]], //财务 成交报告-待撤销
'reportListUndone/:status' => ['index/Finance/reportList', [ 'method' => 'get' ] ,['status'=>21]], //财务 成交报告-已撤销
'refundList' => ['index/Finance/refundList', [ 'method' => 'get|post' ] ], //财务 退款
'accountList' => ['index/Finance/accountList', [ 'method' => 'get|post' ] ], //财务 账户列表
'checkReport' => ['index/Finance/checkReport', [ 'method' => 'post' ] ], //财务审核成交报告
'bargainInfo' => ['index/Finance/bargainInfo', [ 'method' => 'get' ] ], //获取成交报告详情
'editBargainInfo' => ['index/Finance/editBargainInfo', [ 'method' => '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