Commit f73c9071 authored by hujun's avatar hujun

分佣提成明细表

parent 8b52e7be
......@@ -495,6 +495,12 @@ class Finance extends Basic
return $this->response("200", "request success", $data);
}
/**
* @return \think\Response|\think\response\View
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function partialCommissionList() {
if (!$this->request->isAjax()) {
return view('commission');
......@@ -503,11 +509,11 @@ class Finance extends Basic
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize'];
$where = [];
$field = 'a.create_time,a.practical_fee,b.scale_fee,d.internal_address,b.agent_id';
$field = 'a.id,a.create_time,a.practical_fee,b.scale_fee,d.internal_address,b.agent_id,b.house_number';
$m_commission = new OPartialCommission();
$data['data']['list'] = $m_commission->getCommissionBargainList($pageNo, $pageSize, 'id desc', $field, $where);
$data['data']['total'] = $m_commission->selectRefundByOrderNoPageTotal($where);
$data['data']['list'] = $m_commission->getCommissionBargainList($pageNo, $pageSize, 'a.id desc', $field, $where);
$data['data']['total'] = $m_commission->getCommissionBargainListTotal($where);
return $this->response("200", "request success", $data);
}
}
{layout name="global/frame_tpl" /}
分佣提成明细表
\ No newline at end of file
......@@ -805,4 +805,24 @@ class AAgents extends BaseModel
->where($params)
->find();
}
/**
* 经纪人与部门和门店数据
*
* @param $field
* @param $where
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getStoreDistrict($field, $where)
{
return $this->field($field)
->alias('a')
->join('a_store b', 'a.store_id = b.id', 'left')
->join('a_district c', 'a.district_id = c.id', 'left')
->where($where)
->find();
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: hu jun
* Date: 2018/5/18
* Time: 10:26
*/
namespace app\model;
class OPartialCommission extends BaseModel
{
/**
* 成交报告分佣表
*
* @param $pageNo
* @param $pageSize
* @param string $order_
* @param $fields
* @param $where
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getCommissionBargainList($pageNo, $pageSize, $order_ = 'id desc', $fields, $where) {
$data = $this->field($fields)
->alias('a')
->join('o_bargain b', 'a.bargain_id = b.id', 'left')
->join('o_order c', 'b.order_id = c.id', 'left')
->join('g_houses d', 'c.house_id = d.id', 'left')
->where($where)
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
$result = [];
$m_agent = new AAgents();
$fields_str = 'a.id,a.name,a.phone,b.store_name,c.district_name';
foreach ($data as $k => $v) {
$result[$k] = $v;
if ($v['agent_id']) {
$agent_data = $m_agent->getStoreDistrict($fields_str, ['a.id'=>$v['agent_id']]);
$result[$k]['agent'] = $agent_data['name'].'-'.$agent_data['phone'];
$result[$k]['district_store'] = $agent_data['store_name'] .'-'.$agent_data['store_name'];
}
}
return $result;
}
/**
* @param $where
* @return int|string
*/
public function getCommissionBargainListTotal($where) {
return $this->alias('a')
->join('o_bargain b', 'a.bargain_id = b.id', 'left')
->join('o_order c', 'b.order_id = c.id', 'left')
->join('g_houses d', 'c.house_id = d.id', 'left')
->where($where)
->count();
}
}
\ No newline at end of file
......@@ -214,6 +214,7 @@ Route::group('index', [
'payLogList' => ['index/Finance/payLogList', [ 'method' => 'get' ] ], //收款记录
'phone_up_list' => ['index/remark/phone_up_list', [ 'method' => 'get|post' ] ], //电话跟进列表
'selectReportAll' => ['index/Finance/selectReportAll', [ 'method' => 'get|post' ] ], //时间轴
'partialCommissionList' => ['index/Finance/partialCommissionList', [ 'method' => 'get' ] ], //分佣提成明细表
'test123' => ['index/WatchShop/test123', [ 'method' => 'get|post' ] ], //时间轴
'agent_zhuan_aagent' => [ 'index/agent/agent_zhuan_aagent', [ 'method' => 'post|get' ] ],//经纪人
'shop_a_store' => [ 'index/agent/shop_a_store', [ 'method' => 'post|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