Commit b7b5b418 authored by clone's avatar clone

Merge branch 'test-v1.9' into test

# Conflicts: # application/route.php
parents 2fd3d09c b08411be
<?php
namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\model\GHousesFollowUp;
use app\model\UPhoneFollowPp;
use think\Request;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/5/23
* Time : 上午11:34
* Intro: 首页客户跟进和商铺跟进列表
*/
class HomePageLog extends Basic
{
private $uPhoneFollowUpModel;
private $gHouseFollowUpModel;
function __construct(Request $request = null)
{
parent::__construct($request);
$this->uPhoneFollowUpModel = new UPhoneFollowPp();
$this->gHouseFollowUpModel = new GHousesFollowUp();
}
/**
* 首页客户跟进
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function userFollowUpList()
{
$params = $this->params;
/* $params = array(
"start_time" => time(), //开始时间
"end_time" => time() . " 23:59:59", //结束时间
"name_or_phone" => "li",//用户姓名或电话 经纪人
"search_content" => "111",// 搜索跟进内容
"pageNo" => 1,
"pageSize" => 15
);*/
if (empty($params['start_time']) || empty($params['end_time'])) {
return $this->response("101", '请选择时间');
}
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$field = "f.id,f.user_id,f.agent_id,f.type,f.content,f.create_time,f.user_status,a.name,a.img,b.store_name";
if (!empty($params["search_content"])) {
$where_["f.content"] = array( "like", "%" . trim($params['search_content']) . "%" );
}
if (!empty($params["start_time"]) && !empty($params["end_time"])) {
$start_time = date("Y-m-d H:i:s",$params["start_time"]);
$end_time = date("Y-m-d H:i:s",$params["end_time"]);
$where_["f.create_time"] = array( 'between', array( $start_time, $end_time ) );
}
if (!empty($params["name_or_phone"])) {
$where_["a.name|a.phone"] = array( "like", "%" . trim($params["name_or_phone"]) . "%" );
}
$join = [
[ 'a_agents a', 'a.id=f.agent_id', 'left' ],
[ 'u_users u', 'u.id=f.user_id', 'left' ],
[ 'a_store b', 'b.id=a.store_id', 'left' ],
];
$order = "f.id desc";
$result = $this->uPhoneFollowUpModel->getSearch($pageNo, $pageSize, $order, $field, $join, $where_, "");
if (count($result) > 0) {
$list["result"] = $result;
$list["img_path"] = AGENTHEADERIMGURL;
return $this->response("200", "request success", $list);
} else {
return $this->response("200", "request null");
}
}
/**
* 首页商铺跟进
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function houseFollowUpList()
{
$params = $this->params;
/* $params = array(
"start_time" => time(), //开始时间
"end_time" => time() . " 23:59:59", //结束时间
"name_or_phone" => "li",//用户姓名或电话
"search_content" => "111",// 搜索跟进内容
"pageNo" => 1,
"pageSize" => 15
);*/
if (empty($params['start_time']) || empty($params['end_time'])) {
return $this->response("101", '请选择时间');
}
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$field = "f.id,f.house_id,f.agent_id,f.follow_up_info,f.create_time,a.name,a.img,b.store_name";
if (!empty($params["search_content"])) {
$where_["f.follow_up_info"] = array( "like", "%" . trim($params['search_content']) . "%" );
}
if (!empty($params["start_time"]) && !empty($params["end_time"])) {
$start_time = date("Y-m-d H:i:s",$params["start_time"]);
$end_time = date("Y-m-d H:i:s",$params["end_time"]);
$where_["f.create_time"] = array( 'between', array( $start_time, $end_time ) );
}
if (!empty($params["name_or_phone"])) {
$where_["a.phone|a.name"] = array( "like", "%" . trim($params["name_or_phone"]) . "%" );
}
$join = [
[ 'a_agents a', 'a.id=f.agent_id', 'left' ],
[ 'a_store b', 'b.id=a.store_id', 'left' ],
];
$order = "f.id desc";
$result = $this->gHouseFollowUpModel->getSearch($pageNo, $pageSize, $order, $field, $join, $where_, "");
if (count($result) > 0) {
$list["result"] = $result;
$list["img_path"] = AGENTHEADERIMGURL;
return $this->response("200", "request success", $list);
} else {
return $this->response("200", "request null");
}
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: fuju
* User: hu jun
* Date: 2017/12/22
* Time: 14:44
*/
......@@ -11,7 +11,6 @@ namespace app\index\controller;
use app\index\extend\Basic;
use app\model\AAgents;
use app\model\Agents;
use app\model\GHousesToAgents;
class Broker extends Basic
......@@ -187,6 +186,9 @@ class Broker extends Basic
* 获取经纪人和楼盘关系信息
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAgentsTohouses() {
$data['status'] = 200;
......@@ -210,7 +212,19 @@ class Broker extends Basic
return $this->response($data['status'], $data['msg'], $data['data']);
}
/**
* 根据经纪人id获取部门和门店id
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAgentDistrictStore() {
$m_store = new AAgents();
$where['a.id'] = $this->params['id'];
$field = 'b.store_name, c.district_name';
$data = $m_store->getStoreDistrict($field, $where);
return $this->response(200, '', $data);
}
}
\ No newline at end of file
This diff is collapsed.
......@@ -46,7 +46,8 @@ class Basic extends Controller
'index/getLabelsList',
'index/regions',
'index/getAuth2',
'index/getDistrict'
'index/getDistrict',
'index/getAgentDistrictStore'
);
/**
......
<?php
/**
* Created by PhpStorm.
* User: hu jun
* Date: 2018/5/18
* Time: 15:38
*/
namespace app\index\untils;
class ExportExcelUntil
{
/**
* @param $file_name
* @param $data
* @param $row
*/
public function exportTable(string $file_name, array $data, int $row, $table_title = "", array $title = []) {
$filename = $file_name. '-' .date('YmdHis').".xlsx";
//设置 header,用于浏览器下载
header('Content-disposition: attachment; filename="'.$filename.'"');
header("Content-Type: application/vnd.openXmlFormats-officeDocument.spreadSheetMl.sheet");
header('Content-Transfer-Encoding: binary');
header('Cache-Control: must-revaLiDate');
header('Pragma: public');
$class_xls = new \XLSXWriter();
$styles1 = array( 'font'=>'Arial','font-size'=>12,'font-style'=>'bold', 'fill'=>'#eee', 'halign'=>'center', 'border'=>'left,right,top,bottom','border-style'=>'thin','Valign'=>'center','height'=>20);
$class_xls->writeSheetHeader('Sheet1', ['string'],['suppress_row'=>true,'widths'=>[20,25,20,30,30,20,30,20,30]]);
$class_xls->writeSheetRow('Sheet1', [$table_title],['height'=>32,'font-size'=>20,'font-style'=>'bold','halign'=>'center','valign'=>'center']);
$class_xls->writeSheetRow('Sheet1', $title, $styles1);
foreach ($data as $k=>$v) {
$row_data = array_values($v);
$class_xls->writeSheetRow('Sheet1', $row_data);
}
$class_xls->markMergedCell('Sheet1', $start_row = 0, $start_col = 0, $end_row = 0, $end_col = $row);
$class_xls->writeToStdOut();
return ;
}
}
\ No newline at end of file
......@@ -12,7 +12,7 @@
<div class="col-lg-10 col-lg-offset-0">
<div class="panel panel-default">
<div class="panel-heading breadcrumb">
<li><a href="#">铺管理</a></li>
<li><a href="#">圈列表</a></li>
<li class="active">添加商圈</li>
<div class="pull-right">
<ul class="bread_btn">
......
This diff is collapsed.
This diff is collapsed.
......@@ -55,7 +55,7 @@
<div class="col-lg-10 col-lg-offset-0">
<div class="panel panel-default">
<div class="panel-heading breadcrumb">
<li><a href="#">成交报告-已结单</a></li>
<li><a href="#">分佣提成明细表</a></li>
</div>
<div class="panel-body">
......@@ -65,12 +65,15 @@
<tr>
<td colspan="9">
<form id="form_search">
<span class="fore-span ld-Marheight">结单时间:</span>
<span class="fore-span ld-Marheight">收佣日期:</span>
<input class="form-control btn4 ld-Marheight" value="" data-rule-phoneus="false" data-rule-required="false" id="create_time" name="start_date" type="date">
<span class="fore-span ld-Marheight">-</span>
<input class="form-control btn4 ld-Marheight" value="" data-rule-phoneus="false" data-rule-required="false" id="end_time" name="end_date" type="date">
<!--<span class="fore-span ld-Marheight">-</span>-->
<!--<input class="form-control btn4 ld-Marheight" value="" data-rule-phoneus="false" data-rule-required="false" id="end_time" name="end_date" type="date">-->
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="internal_address" placeholder="商铺地址" type="text" value="">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="user_phone" placeholder="客户电话" type="text" value="">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="internal_num" placeholder="商铺号" type="text" value="">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="user_name" placeholder="业务员姓名" type="text" value="">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="user_phone" placeholder="业务员手机号" type="text" value="">
<span class="btn btn-info btn3" id="search">搜索</span>
<span class="btn btn-info btn3" id="reset">重置</span>
<span class="btn btn-info btn3" id="export">导出excel</span>
......@@ -78,11 +81,11 @@
</td>
</tr>
<tr>
<th class="text-center">结单时间</th>
<th class="text-center">收佣日期</th>
<th class="text-center">所属部门/门店</th>
<th class="text-center">业务员</th>
<th class="text-center">商铺地址</th>
<th class="text-center">商铺名称</th>
<th class="text-center">成交客户</th>
<th class="text-center">客户电话</th>
<th class="text-center">商铺号</th>
<th class="text-center">应收佣金(元)</th>
<th class="text-center">实收佣金(元)</th>
<th class="text-center">操作</th>
......
This diff is collapsed.
......@@ -806,4 +806,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
......@@ -195,4 +195,20 @@ class AStore extends BaseModel
return $this->where($where)
->value($field);
}
/**
* 查询门店信息
*
* @param $fields
* @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 findStore($fields, $where) {
return $this->field($fields)
->where($where)
->find();
}
}
\ No newline at end of file
......@@ -45,7 +45,6 @@ class BaseModel extends Model
}
if($kv){//编辑
$res=$this->save($data,[$key=>$kv]);
}else{
......
......@@ -75,4 +75,31 @@ class GHousesFollowUp extends Model
->where($where_)
->select();
}
/**
* 首页商铺跟进搜索
* @param int $p
* @param int $pageSize
* @param string $order_
* @param $field
* @param $join
* @param $where
* @param $group
* @return false|\PDOStatement|string|\think\Collection
*/
public function getSearch($p = 1, $pageSize = 15, $order_ = 'id desc', $field, $join, $where, $group)
{
$data = $this->db_
->field($field)
->alias('f')
->join($join)
->where($where)
->group($group)
->order($order_)
->limit($pageSize)
->page($p)
->select();
// echo $this->getLastSql();
return $data;
}
}
\ No newline at end of file
This diff is collapsed.
<?php
/**
* Created by PhpStorm.
* User: hu jun
* Date: 2018/5/18
* Time: 10:26
*/
namespace app\model;
class OPartialCommission extends BaseModel
{
protected $table = "o_partial_commission";
/**
* 成交报告分佣表
*
* @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')
->join('a_agents e', 'b.agent_id = e.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 (isset($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['district_name'] .'-'.$agent_data['store_name'];
}
if (isset($v['role'])) {
switch ($v['role']) {
case 1 :
$data[$k]['role_name'] = '盘方';break;
case 2 :
$data[$k]['role_name'] = '客方';break;
case 3 :
$data[$k]['role_name'] = '反签';break;
case 4 :
$data[$k]['role_name'] = '独家';break;
case 5 :
$data[$k]['role_name'] = '合作方';break;
default :
$data[$k]['role_name'] = '无';
}
}
}
return $result;
}
/**
* 导出列表
*
* @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 getCommissionBargainColumn($pageNo, $pageSize, $order_ = 'id desc', $fields, $where) {
$data = $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')
->join('a_agents e', 'b.agent_id = e.id','left')
->where($where)
->order($order_)
->limit($pageSize)
->page($pageNo)
->column($fields);
$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]['confirm_date'] = $v['confirm_date'];
if ($v['agent_id']) {
$agent_data = $m_agent->getStoreDistrict($fields_str, ['a.id'=>$v['agent_id']]);
$result[$k]['district_store'] = $agent_data['store_name'] .'-'.$agent_data['store_name'];
$result[$k]['agent'] = $agent_data['name'].'-'.$agent_data['phone'];
}
$result[$k]['practical_fee'] = $v['practical_fee'];
$result[$k]['scale_fee'] = $v['scale_fee'];
$result[$k]['service_charge'] = $v['service_charge'];
$result[$k]['charity_fund'] = $v['charity_fund'];
$result[$k]['practical_fee'] = $v['practical_fee'];
$result[$k]['cash'] = $v['cash'];
$result[$k]['real_fee'] = $v['real_fee'];
}
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')
->join('a_agents e', 'b.agent_id = e.id','left')
->where($where)
->count();
}
/**
* 增加和编辑实收佣金
*
* @param $data
* @param $agent_id
* @return int|string
*/
public function addCommission($data, $agent_id) {
$insert_data['id'] = $data['id'];
$insert_data['bargain_id'] = $data['bargain_id']; //成交报告id
$insert_data['practical_fee'] = $data['practical_fee']; //实收佣金
$insert_data['cash'] = $data['cash']; //现金奖
$insert_data['service_charge'] = $data['service_charge']; //手续费
$insert_data['charity_fund'] = $data['charity_fund']; //慈善基金
$insert_data['real_fee'] = $data['real_fee']; //实分佣金
$insert_data['operation_id'] = $agent_id; //操作人id
$insert_data['should_commission'] = $data['should_commission']; //应分佣金
$insert_data['scale'] = $data['scale']; //分佣比例
$insert_data['role'] = $data['role']; //分佣方 1盘方 2客方 3 反签 4独家 5合作方
$insert_data['agent_id'] = $data['agent_id']; //分佣方经纪人
//确认分佣加时间 否则 只是保存分佣数据
if ($data['confirm_date']) {
$insert_data['confirm_date'] = $data['confirm_date'];
$insert_data['confirm_status'] = 1;
}
if (empty($insert_data['id'])) {
return $this->insert($insert_data);
} else {
return $this->update($insert_data);
}
}
/**
* 获取我的交易的分佣明细
*
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getCommissionListByBargainId($field,$params){
$params["a.is_del"] = 0;
$result = $this->field($field)
->alias("a")
->join("a_agents b","a.agent_id=b.id","left")
->where($params)
->order("a.create_time desc")
->select();
//echo $this->getLastSql();
return $result ;
}
/**
*获取最后一次分佣比例用到新增税费开票
*
* @param int $bargain_id
* @return mixed
* @throws \think\db\exception\BindParamException
* @throws \think\exception\PDOException
*/
public function getBragainScale(int $bargain_id) {
$sql = 'SELECT scale,agent_id,role,substring_index(group_concat(id ORDER BY id DESC),",",1) as id
FROM o_partial_commission WHERE bargain_id = '.$bargain_id.' GROUP BY role';
return $this->query($sql);
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: fuju
* Date: 2018/5/23
* Time: 17:46
*/
namespace app\model;
class ORealIncome extends BaseModel
{
/**
* 增加实收佣金
*
* @param $insert_data
* @return array|false
* @throws \Exception
*/
public function addRealIncome($insert_data) {
return $this->saveAll($insert_data);
}
/**
* @param int $bargain_id
* @param string $field
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getBargainTaxes(int $bargain_id, $field = 'id as fee_id,money,income_time') {
return $this->field($field)
->where('bargain_id', $bargain_id)
->where('is_del', 0)
->select();
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: fuju
* Date: 2018/5/21
* Time: 10:20
*/
namespace app\model;
class OTaxes extends BaseModel
{
/**
* 税费开票 查询
*
* @param int $bargain_id
* @param int $type
* @param string $field
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getBargainTaxes(int $bargain_id, $field = 'id as fee_id,fee,operation_date')
{
return $this->field($field)
->where('bargain_id', $bargain_id)
->where('is_del', 0)
->select();
}
/**
* 税费开票 查询数量
*
* @param int $bargain_id
* @param int $type
* @return int|string
*/
public function getBargainFeeTotal(int $bargain_id, int $type = 0)
{
return $this->where('bargain_id', $bargain_id)
->where('type', $type)
->count();
}
/**
* 新增实收佣金 或 税费开票
*
* @param $data
* @param $bargain_id
* @param int $type
* @param int $agent_id
* @param int $father_id
* @param int $total_fee
* @param string $operation_date
* @return array|false
* @throws \Exception
*/
public function addTaxes($data, $bargain_id, int $agent_id, $father_id = 0, $total_fee = 0, $operation_date = '')
{
$insert_data = [];
foreach ($data as $k => $v) {
$insert_data[$k]['id'] = $v['fee_id'];
$insert_data[$k]['bargain_id'] = $bargain_id;
$insert_data[$k]['fee'] = $v['fee'];
$insert_data[$k]['operation_id'] = $agent_id;
$insert_data[$k]['father_id'] = $father_id;
$insert_data[$k]['total_fee'] = $total_fee;
$insert_data[$k]['operation_date'] = $operation_date;
$insert_data[$k]['agent_id'] = $v['agent_id'];
$insert_data[$k]['agent_name'] = $v['agent_name'];
$insert_data[$k]['role'] = $v['role'];
$insert_data[$k]['scale'] = $v['scale'];
}
return $this->saveAll($insert_data);
}
/**
* 根据成交报告-实收佣金 或 税费开票 查询详情
*
* @param int $bargain_id
* @param string $field
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getBargainFeeDetail(int $bargain_id, string $field)
{
$data = $this->field($field)
->alias('a')
->join('o_bargain b', 'a.bargain_id = b.id', 'left')
->where('bargain_id', $bargain_id)
->where('a.father_id', 0)
->select();
$result = [];
foreach ($data as $k => $v) {
$result[$k] = $v;
if (isset($v['id']) && $v['bargain_id']) {
$result[$k]['fee_list'] = $this->field('a.id as feed_id,a.fee,b.phone,b.name,a.role,a.scale')
->alias('a')
->join('a_agents b', 'a.agent_id = b.id', 'left')
->where('a.father_id', $v['id'])
->where('a.bargain_id', $v['bargain_id'])
->select();
}
}
return $result;
}
/**
* 根据id 查询详情 zw
* @param int $taxesId
* @param string $field
* @return false|\PDOStatement|string|\think\Collection
*/
public function getTaxesId(int $taxesId, string $field)
{
$params["father_id"] = $taxesId;
$params["is_del"] = 0;
$data = $this->field($field)
->where($params)
->select();
$m_agent = new AAgents();
$result = [];
foreach ($data as $k => $v) {
if (isset($v['role'])) {
$agent_name = $m_agent->getAgentInfo('id,name,phone', $v['agent_id']);
$result[$k]['id'] = $v['id'];
$result[$k]['agent_id'] = $agent_name['id'];
$result[$k]['name'] = $agent_name['name'];
$result[$k]['phone'] = $agent_name['phone'];
$result[$k]['role'] = $v['role'];
$result[$k]['scale'] = $v['scale'];
$result[$k]['fee'] = $v['fee'];
$result[$k]['total_fee'] = $v['total_fee'];
$result[$k]['operation_date'] = $v['operation_date'];
switch ($v['role']) {
case 1 :
$result[$k]['role_name'] = '盘方';
break;
case 2 :
$result[$k]['role_name'] = '客方';
break;
case 3 :
$result[$k]['role_name'] = '反签';
break;
case 4 :
$result[$k]['role_name'] = '独家';
break;
case 5 :
$result[$k]['role_name'] = '合作方';
break;
}
}
}
return $result;
}
/**
* 税费承担明细表
*
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param string $field
* @param string $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getTaxesList($pageNo = 1, $pageSize = 15, $order_ = 'a.id desc', $field = '', $params = '')
{
$data = $this->field($field)->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')
->join('a_agents e', 'b.agent_id = e.id', 'left')
->where($params)
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
$m_agent = new AAgents();
foreach ($data as $k => $v) {
if (isset($v['agent_id'])) {
$district_store = $m_agent->getStoreDistrict('store_name,district_name', [ 'a.id' => $v['agent_id'] ]);
$data[$k]['district_store'] = $district_store['district_name'] . '-' . $district_store['store_name'];
}
}
return $data;
}
/**
* 税费承担明细表总数
*
* @param $params
* @return int|string
*/
public function getTaxesListTotal($params)
{
$data = $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')
->join('a_agents e', 'b.agent_id = e.id', 'left')
->where($params)
->count();
return $data;
}
/**
* 税费承担明细表总和
*
* @param $params
* @return int|string
*/
public function getTaxesListTotalFee($params)
{
$data = $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')
->join('a_agents e', 'b.agent_id = e.id', 'left')
->where($params)
->sum("a.fee");
return $data;
}
/**
* 查询分佣或开票
*
* @param string $field
* @param array $where
* @return array
*/
public function getFeeListColumn(string $field, array $where)
{
return $this->where($where)
->column($field);
}
}
\ No newline at end of file
......@@ -52,7 +52,6 @@ class UPhoneFollowPp extends BaseModel
->page($p)
->select();
$data = array();
foreach ($r as $k => $v) {
$data[$k] = $v;
if ($v['agent_id']) {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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