Commit a7a702c5 authored by hujun's avatar hujun

获取成交报告详情

parent 488939e2
...@@ -58,7 +58,7 @@ class Finance extends Basic ...@@ -58,7 +58,7 @@ class Finance extends Basic
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo']; $pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize']; $pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize'];
$fields = 'a.id,a.create_time,b.user_phone,b.user_name,d.internal_title,d.internal_address,a.commission,a.practical_fee,a.scale_fee,a.order_no,content'; $fields = 'a.id,a.create_time,b.user_phone,b.user_name,d.internal_title,d.internal_address,a.commission,a.practical_fee,a.scale_fee,a.order_no,content,house_number';
$where['a.father_id'] = 0; $where['a.father_id'] = 0;
$where['c.is_del'] = 0; $where['c.is_del'] = 0;
$where['a.status'] = 10; $where['a.status'] = 10;
...@@ -179,7 +179,8 @@ class Finance extends Basic ...@@ -179,7 +179,8 @@ class Finance extends Basic
$data['msg'] = 'Id is null.'; $data['msg'] = 'Id is null.';
} else { } else {
$bargain = new OBargainModel(); $bargain = new OBargainModel();
$fields = 'a.id,a.create_time,b.user_phone,b.user_name,d.internal_title,d.internal_address,a.commission,a.practical_fee,a.scale_fee'; $fields = 'a.id,a.create_time,b.user_phone,b.user_name,d.internal_title,d.internal_address,a.is_open,';
$fields .= 'a.trade_type,a.house_number,a.commission,a.content,d.shop_type';
$where['a.id'] = $this->params['id']; $where['a.id'] = $this->params['id'];
$data['data'] = $bargain->getBargainInfo($fields, $where); $data['data'] = $bargain->getBargainInfo($fields, $where);
} }
......
...@@ -276,8 +276,8 @@ class OBargainModel extends Model ...@@ -276,8 +276,8 @@ class OBargainModel extends Model
* @param int $id * @param int $id
* @param array $data * @param array $data
* @param int $source 审核来源 1成交报告申请结单 2退款 3申请撤销成交报告 * @param int $source 审核来源 1成交报告申请结单 2退款 3申请撤销成交报告
* @param int $status 成交报告状态 10已提交 11审核成功 20待撤销 21已撤销 30删除 * @param int $status 成交报告状态 10已提交 11审核成功 20待撤销 21已撤销 30删除
* @return array * @return bool
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
...@@ -355,18 +355,28 @@ class OBargainModel extends Model ...@@ -355,18 +355,28 @@ class OBargainModel extends Model
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function getBargainInfo($field,$params) { public function getBargainInfo($field,$params) {
return $this->field($field)->alias('a') $data = $this->field($field)->alias('a')
->join('o_report b','a.report_id = b.id','left') ->join('o_report b','a.report_id = b.id','left')
->join('o_order c','a.order_id = c.id','left') ->join('o_order c','a.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')
->where($params) ->where($params)
->find(); ->find();
if (isset($data['id'])) {
$m_fee = new OFee();
$data['practical_fee'] = $m_fee->getBargainFee($data['id']); //获取实收佣金
}
return $data;
} }
/** /**
* @param $params * @param $params
* @param $type * @param $type
* @return false|\PDOStatement|string|\think\Collection * @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/ */
public function getAddBargainNumGroupTime($params,$type){ public function getAddBargainNumGroupTime($params,$type){
$field = ""; $field = "";
...@@ -398,6 +408,7 @@ class OBargainModel extends Model ...@@ -398,6 +408,7 @@ class OBargainModel extends Model
public function getAddBargainNum($params,$type){ public function getAddBargainNum($params,$type){
$where_ = []; $where_ = [];
$field = "";
if($type == 1){ if($type == 1){
$field = "sum(scale_fee) as num"; $field = "sum(scale_fee) as num";
}elseif($type == 2){ }elseif($type == 2){
...@@ -459,6 +470,14 @@ class OBargainModel extends Model ...@@ -459,6 +470,14 @@ class OBargainModel extends Model
->count(); ->count();
} }
/**
* @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 getBargainDetail($field,$params){ public function getBargainDetail($field,$params){
return Db::table($this->table) return Db::table($this->table)
->field($field) ->field($field)
......
<?php
/**
* Created by PhpStorm.
* User: fuju
* Date: 2018/5/21
* Time: 10:20
*/
namespace app\model;
class OFee 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 getBargainFee(int $bargain_id, $type = 0, string $field = 'id as fee_id,tax_fee,create_time') {
return $this->field($field)
->where('bargain_id', $bargain_id)
->where('type', $type)
->select();
}
}
\ No newline at end of file
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