Commit 270f36b6 authored by hujun's avatar hujun

分佣列表

parent 2be64939
...@@ -701,38 +701,15 @@ class Finance extends Basic ...@@ -701,38 +701,15 @@ class Finance extends Basic
$where['a.is_del'] = 0; $where['a.is_del'] = 0;
if (!empty($this->params['create_time']) && empty($this->params['end_time'])) { if (!empty($this->params['create_time']) && empty($this->params['end_time'])) {
$income_where['income_time'] = [ '>= time', $this->params['create_time'] . ' 00:00:00' ]; $where['f.income_time'] = [ '>= time', $this->params['create_time'] . ' 00:00:00' ];
} }
if (!empty($this->params['end_time']) && empty($this->params['create_time'])) { if (!empty($this->params['end_time']) && empty($this->params['create_time'])) {
$income_where['income_time'] = [ '<= time', $this->params['end_time'] . ' 23:59:59' ]; $where['f.income_time'] = [ '<= time', $this->params['end_time'] . ' 23:59:59' ];
} }
if (!empty($this->params['end_time']) && !empty($this->params['create_time'])) { if (!empty($this->params['end_time']) && !empty($this->params['create_time'])) {
$income_where['income_time'] = [ 'between time', [ $this->params['create_time'] . ' 00:00:00', $this->params['end_time'] . ' 23:59:59' ] ]; $where['f.income_time'] = [ 'between time', [ $this->params['create_time'] . ' 00:00:00', $this->params['end_time'] . ' 23:59:59' ] ];
}
if (!empty($income_where)) {
$m_real = new ORealIncome();
$bargain_arr = $m_real->getRealIncomeBargain('bargain_id', $income_where);
if ($bargain_arr['status'] == 'successful') {
if (empty($bargain_arr['data'])) {
return $this->response(200, '');
}
foreach ($bargain_arr['data'] as $v) {
$bargain_id[] = $v['bargain_id'];
}
if (!empty($bargain_id)) {
$bargain_id_string = implode(',', $bargain_id);
$where[] = ['EXP', 'b.id in ('.$bargain_id_string.') or b.father_id in ('.$bargain_id_string.')'];
}
} else {
return $this->response(101, '内部错误:'.$bargain_arr['msg']);
}
} }
if (!empty($this->params['internal_address'])) { if (!empty($this->params['internal_address'])) {
...@@ -755,7 +732,7 @@ class Finance extends Basic ...@@ -755,7 +732,7 @@ class Finance extends Basic
$where[] = [ 'EXP', 'b.id =' . $this->params['bargain_id'] . ' or father_id=' . $this->params['bargain_id'] ]; $where[] = [ 'EXP', 'b.id =' . $this->params['bargain_id'] . ' or father_id=' . $this->params['bargain_id'] ];
} }
$field = 'a.id,b.id as bargain_id,a.confirm_date,a.practical_fee,b.scale_fee,d.internal_address,b.agent_id,b.house_number,b.father_id,b.order_id,a.real_income_id'; $field = 'a.id,b.id as bargain_id,f.income_time,a.practical_fee,b.scale_fee,d.internal_address,b.agent_id,b.house_number,b.father_id,b.order_id,a.real_income_id';
$m_commission = new OPartialCommission(); $m_commission = new OPartialCommission();
try { try {
......
...@@ -36,6 +36,7 @@ class OPartialCommission extends BaseModel ...@@ -36,6 +36,7 @@ class OPartialCommission extends BaseModel
->join('o_order c', 'b.order_id = c.id', 'left') ->join('o_order c', 'b.order_id = c.id', 'left')
->join('g_houses d', 'c.house_id = d.id', 'left') ->join('g_houses d', 'c.house_id = d.id', 'left')
->join('a_agents e', 'b.agent_id = e.id', 'left') ->join('a_agents e', 'b.agent_id = e.id', 'left')
->join('o_real_income f', 'b.id = f.bargain_id', 'left')
->where($where) ->where($where)
->order($order_) ->order($order_)
->limit($pageSize) ->limit($pageSize)
...@@ -76,9 +77,6 @@ class OPartialCommission extends BaseModel ...@@ -76,9 +77,6 @@ class OPartialCommission extends BaseModel
$data[$k]['role_name'] = '无'; $data[$k]['role_name'] = '无';
} }
} }
$result[$k]['income_time'] = $m_real->where('id', $v['real_income_id'])->value('income_time');
if ($v['father_id'] != 0) { if ($v['father_id'] != 0) {
$result[$k]['bargain_id'] = $v['father_id']; $result[$k]['bargain_id'] = $v['father_id'];
} }
...@@ -146,6 +144,7 @@ class OPartialCommission extends BaseModel ...@@ -146,6 +144,7 @@ class OPartialCommission extends BaseModel
->join('o_order c', 'b.order_id = c.id', 'left') ->join('o_order c', 'b.order_id = c.id', 'left')
->join('g_houses d', 'c.house_id = d.id', 'left') ->join('g_houses d', 'c.house_id = d.id', 'left')
->join('a_agents e', 'b.agent_id = e.id', 'left') ->join('a_agents e', 'b.agent_id = e.id', 'left')
->join('o_real_income f', 'f.bargain_id = f.id', 'left')
->where($where) ->where($where)
->count(); ->count();
} }
......
...@@ -1068,13 +1068,17 @@ define(['doT', 'text!temp/commission_template_tpl.html', 'text!temp/reportList_n ...@@ -1068,13 +1068,17 @@ define(['doT', 'text!temp/commission_template_tpl.html', 'text!temp/reportList_n
data: params, data: params,
dataType: 'json', dataType: 'json',
success: function(data) { success: function(data) {
console.log(data); if (data.code == 200) {
var temp = document.getElementById('commission_list_tpl').innerHTML; var temp = document.getElementById('commission_list_tpl').innerHTML;
var doTtmpl = doT.template(temp); var doTtmpl = doT.template(temp);
$("#business_list").html(doTtmpl(data.data.data.list)); $("#business_list").html(doTtmpl(data.data.data.list));
/*分页代码*/
add_page(data.data.data.total, pageNo, bargain.pageSize, bargain.getList);
} else {
alert(data.msg);
}
/*分页代码*/
add_page(data.data.data.total, pageNo, bargain.pageSize, bargain.getList);
} }
}); });
}, },
......
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