Commit ef5b4d11 authored by hujun's avatar hujun

成交报告 约带看 搜索

parent 91f93865
......@@ -102,61 +102,6 @@ class Finance extends Basic
$where['d.shop_type'] = $this->params['shop_type'];
}
if (!empty($this->params['district_id'])) {
$agent_where['a.district_id'] = $this->params['district_id'];
}
if (!empty($this->params['store_id'])) {
$agent_where['a.store_id'] = $this->params['store_id'];
}
if (!empty($this->params['agent_phone'])) {
$agent_where['a.phone'] = [ 'LIKE', '%' . $this->params['agent_phone'] . '%' ];
}
if (!empty($this->params['agent_name'])) {
$agent_where['a.name'] = [ 'LIKE', '%' . $this->params['agent_name'] . '%' ];
}
if (!empty($agent_where)) {
$m_agent = new AAgents();
$where_bargain_id = $m_agent->agentBargainAll('b.id,b.father_id', $agent_where);
if (empty($where_bargain_id)) {
return $this->response(200, '');
} else {
$where_id = [];
foreach ($where_bargain_id as $k => $v) {
if ($v['father_id'] == 0) {
$where_id[] = $v['id'];
} else {
$where_id[] = $v['father_id'];
}
}
$where['a.id'] = [ 'in', $where_id ];
}
}
//分佣方姓名
if (!empty($this->params['partial_id'])) {
$m_agent = new AAgents();
$where_bargain_id = $m_agent->agentBargainAll('b.id,b.father_id', [ 'a.id' => $this->params['partial_id'] ]);
if (empty($where_bargain_id)) {
return $this->response(200, '');
} else {
$where_id = [];
foreach ($where_bargain_id as $k => $v) {
if ($v['father_id'] == 0) {
$where_id[] = $v['id'];
} else {
$where_id[] = $v['father_id'];
}
}
$where['a.id'] = [ 'in', $where_id ];
}
}
if (!empty($this->params['bargain_id'])) {
$where['a.id'] = $this->params['bargain_id'];
}
......@@ -213,8 +158,64 @@ class Finance extends Basic
$where['a.status'] = 20;
}
$bargain = new OBargainModel();
try {
$bargain = new OBargainModel();
if (!empty($this->params['district_id'])) {
$agent_where['a.district_id'] = $this->params['district_id'];
}
if (!empty($this->params['store_id'])) {
$agent_where['a.store_id'] = $this->params['store_id'];
}
if (!empty($this->params['agent_phone'])) {
$agent_where['a.phone'] = [ 'LIKE', '%' . $this->params['agent_phone'] . '%' ];
}
if (!empty($this->params['agent_name'])) {
$agent_where['a.name'] = [ 'LIKE', '%' . $this->params['agent_name'] . '%' ];
}
if (!empty($agent_where)) {
$m_agent = new AAgents();
$where_bargain_id = $m_agent->getAgentReportBargain('a.id,c.father_id', $agent_where);
if (empty($where_bargain_id)) {
return $this->response(200, '');
} else {
$where_id = [];
foreach ($where_bargain_id as $k => $v) {
if ($v['father_id'] == 0) {
$where_id[] = $v['id'];
} else {
$where_id[] = $v['father_id'];
}
}
$where['a.id'] = [ 'in', $where_id ];
}
}
//分佣方姓名
if (!empty($this->params['partial_id'])) {
$m_agent = new AAgents();
$where_bargain_id = $m_agent->agentBargainAll('b.id,b.father_id', [ 'a.id' => $this->params['partial_id'] ]);
if (empty($where_bargain_id)) {
return $this->response(200, '');
} else {
$where_id = [];
foreach ($where_bargain_id as $k => $v) {
if ($v['father_id'] == 0) {
$where_id[] = $v['id'];
} else {
$where_id[] = $v['father_id'];
}
}
$where['a.id'] = [ 'in', $where_id ];
}
}
$data['data']['list'] = $bargain->getBargainList($pageNo, $pageSize, $order, $fields, $where);
$data['data']['total'] = $bargain->getBargainTotal($where);
$data['data']['step'] = $check_status;
......
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