Commit 1b8757c2 authored by hujun's avatar hujun

收款

parent fcbe249f
......@@ -626,7 +626,7 @@ class Finance extends Basic
$fields = 'a.id,a.role,a.agent_id,a.scale,a.scale_fee,a.father_id,a.report_id';
$where[0] = [ 'EXP', "a.id = {$this->params['id']} or a.father_id = {$this->params['id']}" ];
$where['a.status'] = [ '<>', 30 ];
$list = $this->m_bargain->getBargainPartial(1, 100, 'a.id desc', $fields, $where);
$list = $this->m_bargain->getBargainPartialV2(1, 100, 'a.id desc', $fields, $where);
$result = [];
$m_agent = new AAgents();
......@@ -3386,6 +3386,88 @@ class Finance extends Basic
return $this->response(200, $msg, $pay_data);
}
/**
* 收款详情
*
* @return \think\Response
*/
public function getCollectionDetailV2() {
if (empty($this->params['pay_id'])) {
// return $this->response(101, '参数错误');
}
$msg = "";
$pay_data = [];
try {
$m_pay = new OPayLogModel();
$pay_fields = 'id,order_id,agent_name,create_time,income_time,house_number,type,real_money,income_time,transfer_name,';
$pay_fields .= 'transaction_fee,is_dividend,receipt_number,source,pay_type,last_transfer_time,money,industry_type,received_money,type_ext';
$pay_data = $m_pay->selectReceiptImgList($pay_fields, ['id'=>$this->params['pay_id']]);
$pay_data = $pay_data[0];
//成交报告id
if (empty($pay_data['order_id'])) {
$pay_data['bargain_id'] = "";
$pay_data['is_open'] = 0;
$pay_data['price'] = 0;
} else {
$bargain_data = $this->m_bargain->getDetail('id,father_id,price,is_open', ['order_id'=>$pay_data['order_id'], 'father_id'=>0]);
$bargain_id = $bargain_data['id'];
if ($bargain_data['father_id'] != 0) {
$bargain_id = $bargain_data['father_id'];
}
$pay_data['bargain_id'] = empty($bargain_id)? '':$bargain_id;
$pay_data['is_open'] = empty($bargain_data['is_open']) ? 0 :$bargain_data['is_open'];
$pay_data['price'] = empty($bargain_data['price'])? 0:$bargain_data['price'];
$m_order = new OrderModel();
$house_data = $m_order->selectOrderByOrderId('b.id,b.internal_address,a.f_id', ['order_id'=>$pay_data['order_id']]);
$pay_data['house_id'] = empty($house_data[0]['id']) ? '':$house_data[0]['id'];
$pay_data['address'] = empty($house_data[0]['internal_address']) ? '':$house_data[0]['internal_address'];
}
$m_pay_adjustment = new OPayLogAdjustment();
$source_id = $m_pay_adjustment->getFieldColumn('id', ['paylog_id'=> $pay_data['id']]);
$pay_data['source_id'] = empty($source_id) ? 0 : implode(',', $source_id);
$m_refund = new ORefundModel();
$num = $m_refund->getFind('id',['pay_log_id'=>$pay_data['id'],'is_del'=>0]);
if ($num['id'] > 0) {
$pay_data['is_refund'] = 1;
} else {
$pay_data['is_refund'] = 0;
}
$m_report = new OReportModel();
$pay_data['current_agent_name'] = '';
$pay_data['current_agent_name'] = $pay_data['store_name'] = "";
if ($pay_data['type'] == 92 || $pay_data['type'] == 91) {
$where['a.order_id'] = $pay_data['order_id'];
$where['a.status'] = ['in','10,11,13'];
$bargain_data = $this->m_bargain->agentBargainAll('a.role,a.scale,b.name', $where);
$role_arr = [1=>'盘方', 2=>'客方',3=>'反签',4=>'独家',5=>'合作方',6=>'APP盘下载方',7=>'APP客下载方'];
$name = '';
foreach ($bargain_data as $k=>$v) {
$name .= $v['name'] . '('.$role_arr[$v['role']].$v['scale'].'%),';
}
$pay_data['current_agent_name'] = rtrim($name,',');
}
if ($pay_data['type'] == 10 || $pay_data['type'] == 30) {
if (isset($house_data[0]['f_id'])) {
$current_agent_name = $m_report->selectReportById('report_agent_name,report_store_id', ['id'=>$house_data[0]['f_id']]);
$pay_data['current_agent_name'] = empty($current_agent_name[0]['report_agent_name']) ? "" : $current_agent_name[0]['report_agent_name'];
}
}
} catch (\Exception $e) {
$msg = '内部错误:'.$e->getMessage();
}
return $this->response(200, $msg, $pay_data);
}
/**
* 编辑收款详情
*
......@@ -3399,7 +3481,7 @@ class Finance extends Basic
$code = 200;
try {
$m_pay = new OPayLogModel();
$id = $m_pay->selectReceiptImgList('id,source', ['id'=>$this->params['pay_id']]);
$id = $m_pay->selectReceiptImgList('id,source,type', ['id'=>$this->params['pay_id']]);
if (empty($id[0]['id'])) {
return $this->response(101, '没有该记录');
......@@ -3407,7 +3489,6 @@ class Finance extends Basic
if ($id[0]['source'] == 2) {
unset($this->params['receipt_number']);
unset($this->params['pay_type']);
unset($this->params['transfer_name']);
unset($this->params['money']);
// return $this->response(101, '调整后收款不能修改');
......@@ -3415,7 +3496,6 @@ class Finance extends Basic
$save_data['transfer_name'] = isset($this->params['transfer_name']) ? $this->params['transfer_name']:'';
$save_data['money'] = $this->params['money'];
$save_data['receipt_number'] = isset($this->params['receipt_number'])? $this->params['receipt_number']:'';
$save_data['pay_type'] = $this->params['pay_type'];
}
$m_pay_log = new OPayLogAdjustment();
......@@ -3424,6 +3504,14 @@ class Finance extends Basic
return $this->response(101, '收款存在调整不能修改');
}
if (($id[0]['type'] == 10 && $this->params['type'] == 30) || ($id[0]['type'] == 30 && $this->params['type'] == 10)) {
$save_data['pay_type'] = $this->params['pay_type'];
}
if (($id[0]['type'] == 91 && $this->params['type'] == 92) || ($id[0]['type'] == 92 && $this->params['type'] == 91)) {
$save_data['pay_type'] = $this->params['pay_type'];
}
$save_data['id'] = $this->params['pay_id'];
$save_data['income_time'] = $this->params['income_time'];
$save_data['real_money'] = $this->params['real_money'];
......
......@@ -1149,17 +1149,6 @@ class OBargainModel extends Model
/**
* 成交报告详情-分佣提成
*
* @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
*/
/**
* @param $pageNo
* @param $pageSize
* @param string $order_
......
......@@ -273,7 +273,7 @@ Route::group('index', [
'addReceiptImg' => ['index/Finance/addReceiptImg', ['method' => 'post|get']],//收款图片信息保存
'deleteReceiptImg' => ['index/Finance/deleteReceiptImg', ['method' => 'post|get']],//删除收款图片
'receiptImgList' => ['index/Finance/receiptImgList', ['method' => 'post|get']],//收款列表-收款图片列表
'getCollectionDetail' => ['index/Finance/getCollectionDetail', ['method' => 'post|get']],//收款详情
'getCollectionDetail' => ['index/Finance/getCollectionDetailV2', ['method' => 'post|get']],//收款详情
'getCollectionEdit' => ['index/Finance/getCollectionEdit', ['method' => 'post']],//收款修改保存
'collectingBill' => ['index/Finance/collectingBill', ['method' => 'post']],//收款
'getBeForNum' => ['index/Finance/getBeForNum', ['method' => 'get']],//getBeForNum
......
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