Commit 30bb9869 authored by hujun's avatar hujun

获取盘方,客方,反签,独家,合作方

parent 8ddcdb73
...@@ -648,33 +648,23 @@ class Finance extends Basic ...@@ -648,33 +648,23 @@ class Finance extends Basic
} }
/** /**
* 成交报告经纪人搜索 * 成交报告经纪人查询
* 1盘方,2客方,3反签,4独家,5合作方
* *
* @return \think\Response * @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/ */
public function searchBargainAgents() public function searchBargainAgents()
{ {
$service_ = new OrderLogService(); if (empty($this->params['bargain_id'])) {
return $this->response(101, '请求参数错误!');
$params = $this->params;
/* $params = array(
"type" => 1,//1盘方,2客方,3反签,4独家,5合作方
"order_id" => 36,
);*/
if (!isset($params["type"]) || !isset($params["order_id"])) {
return $this->response("101", "请求参数错误");
} }
$bargain = new OBargainModel();
$data = $bargain->getAgentTypeByBargainId($this->params['bargain_id']);
try { return $this->response(200, "", $data);
$list = $service_->searchBargainAgents($params["type"], $params["order_id"]);
if (count($list) > 0) {
return $this->response("200", "request success", $list);
} else {
return $this->response("200", "request null");
}
} catch (Exception $e) {
return $this->response("101", "request error,msg:" . $e);
}
} }
/** /**
......
...@@ -660,4 +660,77 @@ class OBargainModel extends Model ...@@ -660,4 +660,77 @@ class OBargainModel extends Model
->group('d.id') ->group('d.id')
->count(); ->count();
} }
/**
* //1盘方,2客方,3反签,4独家,5合作方
*
* @param $bargain_id
* @param string $field
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAgentTypeByBargainId($bargain_id, $field = '') {
$field= 'b.house_id,c.user_id,c.report_agent_id,d.name,d.phone';
$bargain_data = $this->alias('a')
->field($field)
->join('o_order b', 'a.order_id = b.id', 'left')
->join('o_report c', 'a.report_id = c.id', 'left')
->join('a_agents d', 'c.report_agent_id = d.id', 'left')
->where('a.id', $bargain_id)
->find();
$m_house_agent = new GHousesToAgents();
$m_user = new Users();
$agent_arr = [];
$key = 0;
if (isset($bargain_data['phone'])) {
$agent_arr[$key]['id'] = $bargain_data['report_agent_id'];
$agent_arr[$key]['name'] = $bargain_data['name'];
$agent_arr[$key]['phone'] = $bargain_data['phone'];
$agent_arr[$key]['type_str'] = '反签方';
$agent_arr[$key]['type'] = 3;
$key++;
}
if (!empty($bargain_data['user_id'])) {
$agent_user = $m_user->getAgentByUserId('b.id,b.phone,b.name', ['a.id'=>$bargain_data['user_id']]);
if (isset($agent_user[0]['phone'])) {
$agent_arr[$key]['id'] = $agent_user[0]['id'];
$agent_arr[$key]['name'] = $agent_user[0]['name'];
$agent_arr[$key]['phone'] = $agent_user[0]['phone'];
$agent_arr[$key]['type_str'] = '客方';
$agent_arr[$key]['type'] = 2;
$key++;
}
}
if (!empty($bargain_data['house_id'])) {
//盘方和独家
$where['a.houses_id'] = $bargain_data['house_id'];
$where['a.type'] = ['in','2,3'];
$agent_house = $m_house_agent->getAgentsByHouseId('b.id,b.name,b.phone,a.type', $where);
foreach ($agent_house as $k=>$v) {
if (isset($v['phone'])) {
$agent_arr[$key]['id'] = $v['id'];
$agent_arr[$key]['name'] = $v['name'];
$agent_arr[$key]['phone'] = $v['phone'];
if ($v['type'] == 2) {
$agent_arr[$key]['type_str'] = '盘方';
$agent_arr[$key]['type'] = 1;
} else {
$agent_arr[$key]['type_str'] = '独家方';
$agent_arr[$key]['type'] = 4;
}
$key++;
}
}
}
return $agent_arr;
}
} }
\ No newline at end of file
...@@ -220,7 +220,7 @@ Route::group('index', [ ...@@ -220,7 +220,7 @@ Route::group('index', [
'addRealIncome' => ['index/Finance/addRealIncome', [ 'method' => 'POST' ] ], //增加和编辑实收佣金 'addRealIncome' => ['index/Finance/addRealIncome', [ 'method' => 'POST' ] ], //增加和编辑实收佣金
'getTallAge' => ['index/Finance/getTallAge', [ 'method' => 'GET' ] ], //开票税费查询 'getTallAge' => ['index/Finance/getTallAge', [ 'method' => 'GET' ] ], //开票税费查询
'addTallAge' => ['index/Finance/addTallAge', [ 'method' => 'POST' ] ], //新增和编辑开票税费 'addTallAge' => ['index/Finance/addTallAge', [ 'method' => 'POST' ] ], //新增和编辑开票税费
'searchBargainAgents' => ['index/Finance/searchBargainAgents', [ 'method' => 'GET' ] ], //新增和编辑开票税费 'searchBargainAgents' => ['index/Finance/searchBargainAgents', [ 'method' => 'GET' ] ], //获取盘方,客方,反签,独家,合作方
'getTallAgeList' => ['index/Finance/getTallAgeList', [ 'method' => 'GET' ] ], //税费承担明细表 'getTallAgeList' => ['index/Finance/getTallAgeList', [ 'method' => 'GET' ] ], //税费承担明细表
'getCommissionTotalList' => ['index/Finance/getCommissionTotalList', [ 'method' => 'GET' ] ], //分佣提成汇总表 'getCommissionTotalList' => ['index/Finance/getCommissionTotalList', [ 'method' => 'GET' ] ], //分佣提成汇总表
'test123' => ['index/WatchShop/test123', [ 'method' => 'get|post' ] ], //时间轴 'test123' => ['index/WatchShop/test123', [ 'method' => 'get|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