Commit bec8db81 authored by hujun's avatar hujun

财务成交报告审核

parent 5da837b5
......@@ -30,16 +30,20 @@ class Finance extends Basic
$data['data'] = [];
if ($this->request->isGet()) {
$pageNo = empty($_POST['pageNo']) ? 1 : $_POST['pageNo'];
$pageSize = empty($_POST['pageSize']) ? 15 : $_POST['pageSize'];
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$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.check_status'] = 0;
if (!empty($this->params['check_status'])) {
$where['a.check_status'] = $this->params['check_status'];
}
$bargain = new OBargainModel();
$data['data'] = $bargain->getBargain($pageNo, $pageSize, 'a.id DESC', $fields, $where);
} else {
}
$result = $this->response($data['code'], $data['msg'], $data['data']);
} else {
......@@ -49,6 +53,34 @@ class Finance extends Basic
return $result;
}
/**
* 成交报告审核
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function checkReport() {
$data['code'] = 200;
$data['msg'] = "";
$data['data'] = [];
$bargain = new OBargainModel();
if (empty($this->params['id']) || empty($this->params['check_status'])) {
$data['code'] = 101;
$data['msg'] = 'id is null';
} else {
$status = $bargain->addCheckBargain($this->params['id'], $this->params['check_status']);
if (empty($status)) {
$data['code'] = 101;
$data['msg'] = '审核失败';
}
}
return $this->response($data['code'], $data['msg'], $data['data']);
}
/**
* 退款审核
*
......
......@@ -188,4 +188,60 @@ class OBargainModel extends Model
->select();
}
/**
* 成交报告审核
*
* @param $id
* @param $check_status
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function addCheckBargain($id, $check_status) {
$bargain_data = $this->field('id,report_id,agent_id,order_no,order_id')->where([
'id' => $id,
'status' => 10
])->lock(true)->find();
if ($bargain_data != '') {
$bargain_data['check_status'] = $check_status;
$this->save(['check_status'=>$check_status], ['id'=>$bargain_data['id']]);
$check_data = [];
switch ($check_status) {
case 20 :
$check_data['rule'] = '经理';break;
case 30 :
$check_data['rule'] = '总监';break;
case 40 :
$check_data['rule'] = '出纳';break;
default :
$check_data['rule'] = '专员';
}
$check_data['bargain_id'] = $bargain_data['id'];
$check_data['order_no'] = $bargain_data['order_no'];
$check_data['agent_id'] = $bargain_data['agent_id'];
$check_data['order_id'] = $bargain_data['order_id'];
$check_data['report_id'] = $bargain_data['report_id'];
Db::table('o_check_bargain')->insert($check_data);
$check_bargain_id = Db::table('o_check_bargain')->getLastInsID();
if ($check_bargain_id) {
$this->commit();
$result = true;
} else {
$this->rollback();
$result = false;
}
} else {
$result = false;
}
return $result;
}
}
\ No newline at end of file
......@@ -169,6 +169,7 @@ Route::group('index', [
'reportList' => ['index/Finance/reportList', [ 'method' => 'get|post' ] ], //财务 成交报告
'refundList' => ['index/Finance/refundList', [ 'method' => 'get|post' ] ], //财务 退款
'accountList' => ['index/Finance/accountList', [ 'method' => 'get|post' ] ], //财务 账户列表
'checkReport' => ['index/Finance/checkReport', [ '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