Commit 7ce0c3b9 authored by hujun's avatar hujun

时间轴

parent fbc7394e
...@@ -373,7 +373,11 @@ class OrderLog extends Basic ...@@ -373,7 +373,11 @@ class OrderLog extends Basic
/** /**
* 报备时间轴 * 报备时间轴
*
* @return \think\Response * @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/ */
public function selectReportAll() public function selectReportAll()
{ {
...@@ -390,7 +394,11 @@ class OrderLog extends Basic ...@@ -390,7 +394,11 @@ class OrderLog extends Basic
/** /**
* 报备时间轴 * 报备时间轴
*
* @return \think\Response * @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/ */
public function selectReportAllV2() public function selectReportAllV2()
{ {
...@@ -405,6 +413,27 @@ class OrderLog extends Basic ...@@ -405,6 +413,27 @@ class OrderLog extends Basic
return $this->response("200", "request success", $data); return $this->response("200", "request success", $data);
} }
/**
* 报备时间轴
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function selectReportAllV3()
{
$params = $this->params;
/* $params = array(
"order_id" => 38002,
);*/
if (!isset($params["order_id"])) {
return $this->response("101", "请求参数错误");
}
$data = $this->service_->selectListByOrderNoV3($params["order_id"]);
return $this->response("200", "request success", $data);
}
/** /**
* 修改成单状态 * 修改成单状态
* @return \think\Response * @return \think\Response
......
...@@ -366,7 +366,13 @@ class OrderLogService ...@@ -366,7 +366,13 @@ class OrderLogService
return $this->sortByTime($result); return $this->sortByTime($result);
} }
/**
* @param $order_id
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function selectListByOrderNoV2($order_id) public function selectListByOrderNoV2($order_id)
{ {
$result = []; $result = [];
...@@ -464,6 +470,112 @@ class OrderLogService ...@@ -464,6 +470,112 @@ class OrderLogService
return $this->sortByTime($result); return $this->sortByTime($result);
} }
/**
* @param $order_id
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function selectListByOrderNoV3($order_id)
{
$result = [];
$sort = 0;
//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->selectOrderByOrderId("f_id,house_title", [ "order_id" => $order_id ]);
//dump($orderData);
if (count($orderData) <= 0) {
return [ "101", "找不到此订单编号" ];
}
$report_id = $orderData[0]["f_id"];
$field_report = "a.id,a.report_agent_id,a.report_agent_phone,a.report_agent_name,a.report_store_id,
a.user_id,a.user_phone,a.user_name,a.vehicle,a.intro,a.predict_see_time,a.create_time,b.store_name,c.district_name";
$reportData = $oReportModel->selectReportInfoById($field_report, [ "id" => $report_id ]);
if (count($reportData) == 0) {
return [ "101", "报备记录未找到" ];
}
//报备
$reportData[0]["step_name"] = "report";
$reportData[0]["house_title"] = $orderData[0]["house_title"];
$result[$sort++] = $reportData[0];
//进场 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_id" => $order_id ]);
if (count($marchInData) > 0) {
foreach ($marchInData as $k => $v) {
$v["step_name"] = "march_in";
$v["img_path"] = CHAT_IMG_URL;
$result[$sort++] = $v;
}
}
//跟进
$field_follow_up = "id,agent_id,agent_name,user_type,decision_maker,industry_type,area_requirement,price_requirement,province,city,
district,business_area,explain,explain_img,create_time";
$followUpLogData = $followUpLogModel->selectFollowUpListByReportId($field_follow_up, [ "report_id" => $report_id ]);
if (count($followUpLogData) > 0) {
foreach ($followUpLogData as $k => $v) {
$v["step_name"] = "follow_up_log";
$v = $this->convertFollowUp($v);
$v["img_path"] = CHAT_IMG_URL;
$result[$sort++] = $v;
}
}
//收款
$field_pay_log = "id,order_no,father_id,order_id,agent_id,agent_name,type,pay_type,money,house_number,industry_type,
remark,transfer_img,real_money,source,create_time";
$payLogData = $oPayLogModel->selectPayLogByOrderNo($field_pay_log, [ "order_id" => $order_id ]);
if (count($payLogData) > 0) {
$sortPayLogData = $this->arr2tree($payLogData);
foreach ($sortPayLogData as $k => $v) {
$v["step_name"] = "pay_log";
$v["img_path"] = CHAT_IMG_URL;
$result[$sort++] = $v;
}
}
//退款
$field_refund = "id,report_id,agent_id,agent_name,order_no,order_id,refund_money,status,name,bank,card_no,
remark,remark_img,create_time";
$refundData = $oRefundModel->selectRefundByOrderNo($field_refund, [ "order_id" => $order_id ]);
if (count($refundData) > 0) {
foreach ($refundData as $k => $v) {
$v["step_name"] = "refund";
$v["img_path"] = CHAT_IMG_URL;
$result[$sort++] = $v;
}
}
//成交报告
$field_bargain = "a.id,a.father_id,a.house_number,a.is_open,a.report_id,a.order_id,a.trade_type,a.submit_agent_id,a.industry_type,
a.estimated_receipt_date,a.submit_agent_name, a.price,a.commission,a.role,a.agent_id,a.scale,a.scale_fee,a.create_time,b.name,b.phone";
$bargainData = $oBargainModel->selectBargainListByOrderNo($field_bargain, [ "order_id" => $order_id ]);
if (count($bargainData) > 0) {
$bargain_data_arr = $this->arr2TreeBargain($bargainData);
foreach ($bargain_data_arr as $k => $v) {
$sort++;
$result[$sort]['step_name'] = "bargain";
$result[$sort]['list'] = $v;
}
}
return $this->sortByTime($result);
}
public function arr2tree($list) public function arr2tree($list)
{ {
$tree = $trees = []; $tree = $trees = [];
...@@ -493,11 +605,36 @@ class OrderLogService ...@@ -493,11 +605,36 @@ class OrderLogService
return $trees; return $trees;
} }
/**
* @param $list
* @return array
*/
public function arr2TreeBargain($list) {
$tree = $trees = [];
foreach ($list as $key => $item) {
if ($item["father_id"] == 0) {
$list[$key]["father_id"] = $item["id"];
}
}
foreach ($list as $k => $v) {
$tree[$v["father_id"]][] = $v;
}
return $tree;
}
/** /**
* 查询流程 客户动态 * 查询流程 客户动态
*
* @param $user_id * @param $user_id
* @param $search | null * @param string $search
* @return array * @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/ */
public function selectListByUserId($user_id, $search = "") public function selectListByUserId($user_id, $search = "")
{ {
......
...@@ -439,6 +439,7 @@ Route::group('broker', [ ...@@ -439,6 +439,7 @@ Route::group('broker', [
'dayStatement' => [ 'api_broker/Statement/dayStatement', [ 'method' => 'get|post' ] ], 'dayStatement' => [ 'api_broker/Statement/dayStatement', [ 'method' => 'get|post' ] ],
'selectReportAll' => [ 'api_broker/OrderLog/selectReportAll', [ 'method' => 'get|post' ] ], 'selectReportAll' => [ 'api_broker/OrderLog/selectReportAll', [ 'method' => 'get|post' ] ],
'selectReportAllV2' => [ 'api_broker/OrderLog/selectReportAllV2', [ 'method' => 'get|post' ] ], 'selectReportAllV2' => [ 'api_broker/OrderLog/selectReportAllV2', [ 'method' => 'get|post' ] ],
'selectReportAllV3' => [ 'api_broker/OrderLog/selectReportAllV3', [ 'method' => 'get|post' ] ],
'searchOrder' => [ 'api_broker/OrderLog/searchOrder', [ 'method' => 'get|post' ] ], 'searchOrder' => [ 'api_broker/OrderLog/searchOrder', [ 'method' => 'get|post' ] ],
'bargainList' => [ 'api_broker/OrderLog/bargainList', [ 'method' => 'get|post' ] ], 'bargainList' => [ 'api_broker/OrderLog/bargainList', [ 'method' => 'get|post' ] ],
'bargainDetail' => [ 'api_broker/OrderLog/bargainDetail', [ 'method' => 'get|post' ] ], 'bargainDetail' => [ 'api_broker/OrderLog/bargainDetail', [ 'method' => 'get|post' ] ],
......
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