Commit 08ca4cd0 authored by clone's avatar clone

跟进报备

parent 43fd6fb9
......@@ -122,6 +122,7 @@ class OrderLog extends Basic
"remark" => "没什么备注",
"remark_img" => "12312312312"
);*/
//todo 判断此单是否有付款
$is_ok = $this->o_refund_model->addRefund($params);
if ($is_ok > 0) {
return $this->response("200", "request success", []);
......@@ -171,4 +172,16 @@ class OrderLog extends Basic
return $this->response("101", "request faild");
}
public function selectReportAll(){
$params = $this->params;
if(!isset($params["order_no"])){
return $this->response("101", "请求参数错误");
}
$params = array(
"order_no" =>"1212312312",
);
$data = $this->service_->selectListByOrderNo($params["order_no"]);
}
}
\ No newline at end of file
......@@ -2,8 +2,13 @@
namespace app\api_broker\service;
use app\model\FollowUpLogModel;
use app\model\OBargainModel;
use app\model\OMarchInModel;
use app\model\OPayLogModel;
use app\model\OrderModel;
use app\model\ORefundModel;
use app\model\OReportModel;
/**
......@@ -20,7 +25,7 @@ class OrderLogService
function __construct()
{
$this->payLogModel = new OPayLogModel();
$this->payLogModel = new OPayLogModel();
$this->bargainModel = new OBargainModel();
}
......@@ -121,4 +126,84 @@ class OrderLogService
return $arr;
}
/**
* 查询流程
* @param $order_no
* @return array
*/
public function selectListByOrderNo($order_no)
{
$result = [];
//todo 1.验证订单是否存在
$orderModel = new OrderModel();
$oReportModel = new OReportModel();
$oMarchInModel = new OMarchInModel();
$followUpLogModel = new FollowUpLogModel();
$oPayLogModel = new OPayLogModel();
$oRefundModel = new ORefundModel();
$oBargainModel = new OBargainModel();
$orderData = $orderModel->selectOrderByOrderNO("f_id,house_title", [ "order_no" => $order_no ]);
if (count($orderData) == 0) {
return [ "101", "找不到此订单编号" ];
}
$report_id = $orderData[0]["f_id"];
$field_report = "id,report_agent_id,report_agent_name,report_store_id,user_id,user_phone,user_name,vehicle,intro,predict_see_time,create_time";
$reportData = $oReportModel->selectReportById($field_report, [ "id" => $report_id ]);
if (count($reportData) == 0) {
return [ "101", "报备记录未找到" ];
}
//报备
$result["report"] = $reportData[0];
$result["report"]["house_title"] = $orderData[0]["house_title"];
//进场 march in
$field_march_in = "id,reception_id,reception_name,report_id,order_no,march_in_remark,march_in_img,march_in_area,create_time";
$marchInData = $oMarchInModel->selectMarchInByOrderNo($field_march_in, [ "order_no" => $order_no ]);
if (count($marchInData) > 0) {
$result["march_in"] = $reportData;
}
//跟进
$field_follow_up = "";
$followUpLogData = $followUpLogModel->selectFollowUpListByReportId($field_follow_up, [ "order_no" => $order_no ]);
if (count($marchInData) > 0) {
$result["follow_up_log"] = $reportData;
}
//收款
$field_pay_log = "";
$payLogData = $oPayLogModel->selectPayLogByOrderNo($field_pay_log, [ "order_no" => $order_no ]);
if (count($payLogData) > 0) {
$result["pay_log"] = $payLogData;
}
//退款
$field_refund = "";
$refundData = $oRefundModel->selectRefundByOrderNo($field_refund, [ "order_no" => $order_no ]);
if (count($refundData) > 0) {
$result["refund"] = $refundData;
}
//成交报告
$field_bargain = "";
$bargainData = $oBargainModel->selectBargainByOrderNo($field_bargain, [ "order_no" => $order_no ]);
if (count($bargainData) > 0) {
$result["bargain"] = $bargainData;
}
//todo 财务审核
return $this->sortByTime($result);
}
private function sortByTime($result)
{
//todo 根据时间排序
return array();
}
}
\ No newline at end of file
......@@ -3,7 +3,7 @@
namespace app\api_broker\service;
use app\model\OrderModel;
use app\model\reportModel;
use app\model\OReportModel;
/**
* Created by PhpStorm.
......@@ -20,8 +20,8 @@ class ReportService
function __construct()
{
$this->reportModel = new ReportModel();
$this->orderModel = new OrderModel();
$this->reportModel = new OReportModel();
$this->orderModel = new OrderModel();
}
/**
......
......@@ -72,4 +72,26 @@ class FollowUpLogModel extends Model
}
/**
* 查询跟进记录
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function selectFollowUpListByReportId($field, $params)
{
$where_ = [];
if (isset($params["report_id"])) {
$where_["report_id"] = $params["report_id"];
}
if (isset($params["agent_id"])) {
$where_["agent_id"] = $params["agent_id"];
}
return $this->db_
->field($field)
->where($where_)
->select();
}
}
\ No newline at end of file
......@@ -34,4 +34,29 @@ class OBargainModel extends Model
return 0;
}
}
/**
* 查询成交报告记录
* @param string $filed
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function selectBargainByOrderNo($filed , $params)
{
$where_ = [];
if (isset($params["report_id"])) {
$where_["report_id"] = $params["report_id"];
}
if (isset($params["order_no"])) {
$where_["order_no"] = $params["order_no"];
}
if (isset($params["agent_id"])) {
$where_["agent_id"] = $params["agent_id"];
}
return $this->db
->field($filed)
->where($where_)
->select();
}
}
\ No newline at end of file
......@@ -42,4 +42,34 @@ class OMarchInModel extends Model
}
}
/**
* @param $filed
* @param $params
* @return mixed
*/
public function selectMarchInByOrderNo($filed, $params)
{
$where_ = [];
if (isset($params["id"])) {
$where_["id"] = $params["id"];
}
if (isset($params["reception_id"])) {
$where_["reception_id"] = $params["reception_id"];
}
if (isset($params["reception_name"])) {
$where_["reception_name"] = $params["reception_name"];
}
if (isset($params["report_id"])) {
$where_["report_id"] = $params["report_id"];
}
if (isset($params["order_no"])) {
$where_["order_no"] = $params["order_no"];
}
return $this->db
->field($filed)
->where($where_)
->select();
}
}
\ No newline at end of file
......@@ -33,6 +33,30 @@ class OPayLogModel extends Model
Db::rollback();
return 0;
}
}
/**
* 查询付款记录
* @param string $filed
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function selectPayLogByOrderNo($filed , $params)
{
$where_ = [];
if (isset($params["report_id"])) {
$where_["report_id"] = $params["report_id"];
}
if (isset($params["order_no"])) {
$where_["order_no"] = $params["order_no"];
}
if (isset($params["agent_id"])) {
$where_["agent_id"] = $params["agent_id"];
}
return $this->db
->field($filed)
->where($where_)
->select();
}
}
\ No newline at end of file
......@@ -73,4 +73,29 @@ class ORefundModel extends Model{
return 0;
}
}
/**
* 查询退款记录
* @param string $filed
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function selectRefundByOrderNo($filed , $params)
{
$where_ = [];
if (isset($params["report_id"])) {
$where_["report_id"] = $params["report_id"];
}
if (isset($params["order_no"])) {
$where_["order_no"] = $params["order_no"];
}
if (isset($params["agent_id"])) {
$where_["agent_id"] = $params["agent_id"];
}
return $this->db
->field($filed)
->where($where_)
->select();
}
}
\ No newline at end of file
......@@ -14,7 +14,7 @@ use think\Model;
use think\helper\Time;
use think\Db;
class reportModel extends Model
class OReportModel extends Model
{
// 设置当前模型对应的完整数据表名称
protected $table = 'o_report';
......@@ -35,12 +35,41 @@ class reportModel extends Model
Db::startTrans();
try {
$this->db->insert($params);
$id = $this->id;
$id = $this->id;
Db::commit();
return $id ;
return $id;
} catch (\Exception $e) {
Db::rollback();
return 0;
}
}
/**
* 查询报备信息
* @param string $filed
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function selectReportById($filed = "id", $params)
{
$where_ = [];
if (isset($params["id"])) {
$where_["id"] = $params["id"];
}
if (isset($params["report_agent_id"])) {
$where_["report_agent_id"] = $params["report_agent_id"];
}
if (isset($params["report_store_id"])) {
$where_["report_store_id"] = $params["report_store_id"];
}
if (isset($params["user_id"])) {
$where_["user_id"] = $params["user_id"];
}
$where_["status"] = 0;
return $this->db
->field($filed)
->where($where_)
->select();
}
}
\ No newline at end of file
<?php
namespace app\model;
use think\Db;
......@@ -10,18 +11,19 @@ use think\Model;
* Date: 2018/1/29
* Time: 下午5:47
*/
class OrderModel extends Model{
class OrderModel extends Model
{
// 设置当前模型对应的完整数据表名称
protected $table = 'o_order';
protected $db_;
public function __construct()
{
$this->db_ = Db::name($this->table);
$this->db_ = Db::name($this->table);
}
public function insertOrderByAll($params){
public function insertOrderByAll($params)
{
Db::startTrans();
try {
$this->db->inserAll($params);
......@@ -33,4 +35,23 @@ class OrderModel extends Model{
}
}
public function selectOrderByOrderNO($filed, $params)
{
$where_ = [];
if (isset($params["order_no"])) {
$where_["order_no"] = $params["order_no"];
}
if (isset($params["f_id"])) {
$where_["f_id"] = $params["f_id"];
}
if (isset($params["house_id"])) {
$where_["house_id"] = $params["house_id"];
}
return $this->db_
->field($filed)
->where($where_)
->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