Commit b2845d47 authored by hujun's avatar hujun

收款记录

parent 1cb7eb0b
...@@ -10,7 +10,10 @@ namespace app\index\controller; ...@@ -10,7 +10,10 @@ namespace app\index\controller;
use app\index\extend\Basic; use app\index\extend\Basic;
use app\model\AAgents;
use app\model\AAgentsPhone;
use app\model\OBargainModel; use app\model\OBargainModel;
use app\model\OPayLogModel;
class Finance extends Basic class Finance extends Basic
{ {
...@@ -157,7 +160,7 @@ class Finance extends Basic ...@@ -157,7 +160,7 @@ class Finance extends Basic
} }
/** /**
* 修改成交报告中佣金 * 修改成交报告中佣金和备注
* *
* @return \think\Response * @return \think\Response
*/ */
...@@ -171,8 +174,19 @@ class Finance extends Basic ...@@ -171,8 +174,19 @@ class Finance extends Basic
$data['msg'] = 'Id is null.'; $data['msg'] = 'Id is null.';
} else { } else {
$bargain = new OBargainModel(); $bargain = new OBargainModel();
$update_data['scale_fee'] = empty($this->params['scale_fee']) ? 0 : $this->params['scale_fee'];
$update_data['practical_fee'] = empty($this->params['practical_fee']) ? 0 : $this->params['practical_fee']; if (!empty($this->params['scale_fee'])) {
$update_data['scale_fee'] = $this->params['scale_fee'];
}
if (!empty($this->params['practical_fee'])) {
$update_data['practical_fee'] = $this->params['practical_fee'];
}
if (!empty($this->params['content'])) {
$update_data['content'] = $this->params['content'];
}
$data['data'] = $bargain->updateBargainById($this->params['id'], $update_data); $data['data'] = $bargain->updateBargainById($this->params['id'], $update_data);
if ($data['data'] != 1) { if ($data['data'] != 1) {
...@@ -226,4 +240,64 @@ class Finance extends Basic ...@@ -226,4 +240,64 @@ class Finance extends Basic
return $this->response($data['code'], $data['msg'], $data['data']); return $this->response($data['code'], $data['msg'], $data['data']);
} }
/**
* 分佣提成
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function commissionList() {
$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 = 'role,agent_id,scale,scale_fee,practical_fee,content';
$where = "id = {$this->params['id']} or father_id = {$this->params['id']}";
$data['data'] = $bargain->selectBargainByOrderNo($fields, $where);
$agent = new AAgents();
$fields_a = 'name,store_name';
foreach ($data['data'] as $k=>$v) {
$agent_store = $agent->getAgentsStoreById(['a.id'=>$v['agent_id']], $fields_a);
$data['data'][$k]['agent_name'] = $agent_store['name'];
$data['data'][$k]['store_name'] = $agent_store['store_name'];
}
}
return $this->response($data['code'], $data['msg'], $data['data']);
}
/**
* 收款记录
*
* @return \think\Response
*/
public function payLogList() {
$data['code'] = 200;
$data['msg'] = "";
$data['data'] = [];
if (empty($this->params['id'])) {
$data['code'] = 101;
$data['msg'] = 'Id is null.';
} else {
$bargain = new OPayLogModel();
$fields = 'create_time,money,type,pay_type,agent_id';
$where = "report_id = {$this->params['id']}";
$data['data'] = $bargain->selectPayLogByOrderNo($fields, $where);
$agent = new AAgents();
foreach ($data['data'] as $k => $v) {
$data['data'][$k]['agent_name'] = $agent->getAgentsById($v['agent_id'],'name');
}
}
return $this->response($data['code'], $data['msg'], $data['data']);
}
} }
\ No newline at end of file
...@@ -74,7 +74,7 @@ class AAgents extends BaseModel ...@@ -74,7 +74,7 @@ class AAgents extends BaseModel
*/ */
public function getListJoin($p = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $join = '', $where = '') public function getListJoin($p = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $join = '', $where = '')
{ {
$data = $this->field($field) return $this->field($field)
->alias('a') ->alias('a')
->join($join) ->join($join)
->where($where) ->where($where)
...@@ -82,8 +82,6 @@ class AAgents extends BaseModel ...@@ -82,8 +82,6 @@ class AAgents extends BaseModel
->limit($pageSize) ->limit($pageSize)
->page($p) ->page($p)
->select(); ->select();
//echo $this->getLastSql();
return $data;
} }
...@@ -384,6 +382,7 @@ class AAgents extends BaseModel ...@@ -384,6 +382,7 @@ class AAgents extends BaseModel
->find(); ->find();
} }
public function searchAgentsByKeyword($field, $params) public function searchAgentsByKeyword($field, $params)
{ {
...@@ -396,4 +395,32 @@ class AAgents extends BaseModel ...@@ -396,4 +395,32 @@ class AAgents extends BaseModel
return $result; return $result;
} }
/**
* 根据id获取单个字段值
*
* @param $id
* @param $fields
* @return mixed
*/
public function getAgentsById($id, $fields) {
return $this->where('id',$id)->value($fields);
}
/**
* @param $where
* @param $fields
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAgentsStoreById($where, $fields) {
return $this->alias('a')
->field($fields)
->join('a_store b','a.store_id=b.id','left')
->where($where)
->find();
}
} }
\ No newline at end of file
...@@ -178,6 +178,9 @@ Route::group('index', [ ...@@ -178,6 +178,9 @@ Route::group('index', [
'checkReport' => ['index/Finance/checkReport', [ 'method' => 'post' ] ], //财务审核成交报告 'checkReport' => ['index/Finance/checkReport', [ 'method' => 'post' ] ], //财务审核成交报告
'bargainInfo' => ['index/Finance/bargainInfo', [ 'method' => 'get' ] ], //获取成交报告详情 'bargainInfo' => ['index/Finance/bargainInfo', [ 'method' => 'get' ] ], //获取成交报告详情
'editBargainInfo' => ['index/Finance/editBargainInfo', [ 'method' => 'post' ] ], //修改成交报告佣金 'editBargainInfo' => ['index/Finance/editBargainInfo', [ 'method' => 'post' ] ], //修改成交报告佣金
'addBargain' => ['index/Finance/addBargain', [ 'method' => 'post' ] ], //新增成交报告佣金
'commissionList' => ['index/Finance/commissionList', [ 'method' => 'get' ] ], //分佣提成
'payLogList' => ['index/Finance/payLogList', [ 'method' => '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