Commit dc20c35e authored by hujun's avatar hujun

收款

parent cf43ae77
......@@ -4001,4 +4001,122 @@ class Finance extends Basic
}
return $this->response($code, $msg);
}
/**
* 收款列表状态详情
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getPayLogData() {
if (empty($this->params['pay_id'])) {
return $this->response(101, '参数错误');
}
$m_paylog = new OPayLogModel();
$field = 'a.id,a.create_time,a.order_id,a.father_id,a.money,a.real_money,a.pay_type,a.type,a.source,a.transaction_fee,a.source,b.f_id,a.transfer_name,a.receipt_number,';
$field .= 'e.name,a.income_time,e.store_id,b.house_id,b.order_no,a.report_id,a.house_number,a.is_dividend,a.last_transfer_time,a.industry_type,a.agent_id,d.internal_address as address,e.name as agent_name';
$where['a.is_del'] = $where_2['a.is_del'] = $where_3['a.is_del'] = 0;
$where_2['a.paylog_id'] = $where['a.id'] = $where_3['a.pay_log_id'] = $this->params['pay_id'];
$list = $m_paylog->getAddPayLogOrderListLimit(1, 1000, '', $field, $where);
$m_store = new AStore();
$m_pay_adjustment = new OPayLogAdjustment();
$m_report = new OReportModel();
$m_agent_house = new GHousesToAgents();
$m_house = new GHouses();
$m_refund = new ORefundModel();
foreach ($list as $k=>$v) {
if ($v['source'] == 2) {
$source_id = $m_pay_adjustment->getFieldColumn('id', ['new_paylog_id'=> $v['id']]);
$list[$k]['source_id'] = empty($source_id) ? 0 : implode(',', $source_id);
} else {
$list[$k]['source_id'] = '';
}
$num = $m_refund->getFind('id',['pay_log_id'=>$v['id'],'is_del'=>0]);
if ($num['id'] > 0) {
$list[$k]['is_refund'] = 1;
} else {
$list[$k]['is_refund'] = 0;
}
if ($v['type'] != 10 && $v['type'] != 30) {
$bargain_data = $this->m_bargain->getDetail('id,father_id', ['order_id'=>$v['order_id']]);
$bargain_id = $bargain_data['id'];
if ($bargain_data['father_id'] != 0) {
$bargain_id = $bargain_data['father_id'];
}
$list[$k]['bargain_id'] = empty($bargain_id)? '':$bargain_id;
} else {
$list[$k]['bargain_id'] = '';
}
$list[$k]['current_agent_name'] = $list[$k]['store_name'] = "";
if ($v['type'] == 92) {
$is_exclusive_type = $m_house->getHouseValue('is_exclusive_type', ['id'=>$v['house_id']]);
//案场费 对应业务员:盘方
$current_where['a.is_del'] = 0;
if ($is_exclusive_type) {
$current_where['a.type'] = 3;
} else {
$current_where['a.type'] = 2;
}
$current_agent_name = $m_agent_house->getHousesAgents($v['house_id'], 'b.name,b.store_id', $current_where);
$list[$k]['current_agent_name'] = empty($current_agent_name[0]['name']) ? '':$current_agent_name[0]['name'];
$store_name = $m_store->getStoreKeyById('store_name', ['id'=>$current_agent_name[0]['store_id']]);
$list[$k]['store_name'] = empty($store_name)? '' : $store_name;
}
if ($v['type'] == 10 || $v['type'] == 30 || $v['type'] == 91) {
//意向金/保管金 10/30 对应业务员:约带看的人 即 反签方
//中介费 对应业务员:约带看的人 即 反签方
$current_agent_name = $m_report->selectReportById('report_agent_name,report_store_id', ['id'=>$v['f_id']]);
if (!empty($current_agent_name[0]['report_store_id'])) {
$store_name = $m_store->getStoreKeyById('store_name', ['id'=>$current_agent_name[0]['report_store_id']]);
$list[$k]['store_name'] = empty($store_name)? '' : $store_name;
}
$list[$k]['current_agent_name'] = empty($current_agent_name[0]['report_agent_name']) ? '' : $current_agent_name[0]['report_agent_name'];
}
if (!empty($v['income_time'])) {
$income_time = date('Y-m-d H:i:s', strtotime($v['income_time']));
if ($income_time == $v['income_time']) {
$list[$k]['income_time'] = $income_time;
} else {
$list[$k]['income_time'] = '';
}
}
$list[$k]['pay_type_num'] = $v['pay_type'];
$list[$k]['type_num'] = $v['type'];
}
$m_paylog_adjustment = new OPayLogAdjustment();
$field = 'a.create_time,a.id,b.order_id,a.paylog_id,a.money,b.income_time,a.type,a.new_paylog_id,a.operation_id,b.order_id,e.house_id';
$list_2 = $m_paylog_adjustment->getAdjustmentListLimit(1, 1000, '', $field, $where_2);
$fields = 'a.create_time,a.id,a.order_id,a.pay_log_id,a.refund_money,a.type,a.agent_id,a.agent_name,b.house_id,a.status,';
$fields .= 'd.income_time,a.type,c.store_id';
$list_3 = $m_refund->getCheckRefundList(1, 1000, '', $fields, $where_3);
foreach ($list_3 as $k=>$v) {
if (empty($v['house_id'])) {
$list_3[$k]['address'] = '';
} else {
$list_3[$k]['address'] = $m_house->getHouseValue('internal_address', ['id'=>$v['house_id']]);
}
if (empty($v['store_id'])) {
$list_3[$k]['store_name'] = '';
} else {
$list_3[$k]['store_name'] = $m_store->getStoreKeyById('store_name', ['id'=> $v['store_id']]);
}
}
$data['pay_log'] = $list;
$data['pay_log_adjustment'] = $list_2;
$data['pay_log_refund'] = $list_3;
return $this->response(200, '', $data);
}
}
......@@ -303,6 +303,7 @@ Route::group('index', [
'yindaoIos' => [ 'index/ShareShop/yindaoIos', [ 'method' => 'POST|GET' ] ],
'receivables' => ['index/Finance/receivables', ['method' => 'GET']], //获取实收日期
'adjustment' => ['index/Finance/adjustment', ['method' => 'GET']], //获取实收日期
'getPayLogData' => ['index/Finance/getPayLogData', ['method' => 'GET']], //收款各种详情
'evaluationList' => ['index/Evaluation/evaluationList', ['method' => 'POST|GET']], //评价列表 朱伟 2018-06-13
'marchInList' => ['index/MarchIn/marchInList', ['method' => 'POST|GET']], //进场记录列表 朱伟 2018-06-13
......
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