Commit f57b8d50 authored by zw's avatar zw

订单详情-时间轴

parent 747c44e3
...@@ -188,9 +188,9 @@ class OrderLog extends Basic ...@@ -188,9 +188,9 @@ class OrderLog extends Basic
*/ */
public function orderDetail(){ public function orderDetail(){
$params = $this->params; $params = $this->params;
$params = array( /*$params = array(
"order_id" => 1, "order_id" => 1,
); );*/
if(!isset($params["order_id"])){ if(!isset($params["order_id"])){
return $this->response("101", "order_id不能为空"); return $this->response("101", "order_id不能为空");
} }
...@@ -215,14 +215,15 @@ class OrderLog extends Basic ...@@ -215,14 +215,15 @@ class OrderLog extends Basic
*/ */
public function selectReportAll() public function selectReportAll()
{ {
$params = $this->params; /* $params = $this->params;
if (!isset($params["order_no"])) { if (!isset($params["order_no"])) {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
} }*/
$params = array( $params = array(
"order_no" => "1212312312", "order_id" => 1,
); );
$data = $this->service_->selectListByOrderNo($params["order_no"]); $data = $this->service_->selectListByOrderNo($params["order_id"]);
return $this->response("200","request success",$data);
} }
......
...@@ -147,12 +147,13 @@ class OrderLogService ...@@ -147,12 +147,13 @@ class OrderLogService
/** /**
* 查询流程 * 查询流程
* @param $order_no * @param $order_id
* @return array * @return array
*/ */
public function selectListByOrderNo($order_no) public function selectListByOrderNo($order_id)
{ {
$result = []; $result = [];
$sort = 0;
//todo 1.验证订单是否存在 //todo 1.验证订单是否存在
$orderModel = new OrderModel(); $orderModel = new OrderModel();
...@@ -164,7 +165,7 @@ class OrderLogService ...@@ -164,7 +165,7 @@ class OrderLogService
$oBargainModel = new OBargainModel(); $oBargainModel = new OBargainModel();
$orderData = $orderModel->selectOrderByOrderNO("f_id,house_title", [ "order_no" => $order_no ]); $orderData = $orderModel->selectOrderByOrderId("f_id,house_title", [ "id" => $order_id ]);
if (count($orderData) == 0) { if (count($orderData) == 0) {
return [ "101", "找不到此订单编号" ]; return [ "101", "找不到此订单编号" ];
} }
...@@ -177,52 +178,82 @@ class OrderLogService ...@@ -177,52 +178,82 @@ class OrderLogService
return [ "101", "报备记录未找到" ]; return [ "101", "报备记录未找到" ];
} }
//报备 //报备
$result["report"] = $reportData[0]; $reportData[0]["step_name"] = "report";
$result["report"]["house_title"] = $orderData[0]["house_title"]; $reportData[0]["house_title"] = $orderData[0]["house_title"];
$result[$sort++] = $reportData[0];
//进场 march in //进场 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"; $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 ]); $marchInData = $oMarchInModel->selectMarchInByOrderNo($field_march_in, [ "order_id" => $order_id ]);
if (count($marchInData) > 0) { if (count($marchInData) > 0) {
$result["march_in"] = $reportData; foreach ($marchInData as $k=>$v){
$v["step_name"] = "march_in";
$result[$sort++] = $v;
}
} }
//跟进 //跟进
$field_follow_up = ""; $field_follow_up = "id,user_type,decision_maker,industry_type,area_requirement,price_requirement,province,city,
$followUpLogData = $followUpLogModel->selectFollowUpListByReportId($field_follow_up, [ "order_no" => $order_no ]); district,business_area,explain,explain_img,create_time";
if (count($marchInData) > 0) { $followUpLogData = $followUpLogModel->selectFollowUpListByReportId($field_follow_up, [ "report_id" => $report_id ]);
$result["follow_up_log"] = $reportData; if (count($followUpLogData) > 0) {
foreach ($followUpLogData as $k=>$v){
$v["step_name"] = "follow_up_log";
$result[$sort++] = $v;
}
} }
//收款 //收款
$field_pay_log = ""; $field_pay_log = "id,order_no,order_id,agent_id,agent_name,type,pay_type,money,house_number,industry_type,
$payLogData = $oPayLogModel->selectPayLogByOrderNo($field_pay_log, [ "order_no" => $order_no ]); remark,transfer_img,create_time";
$payLogData = $oPayLogModel->selectPayLogByOrderNo($field_pay_log, [ "order_id" => $order_id ]);
if (count($payLogData) > 0) { if (count($payLogData) > 0) {
$result["pay_log"] = $payLogData; foreach ($payLogData as $k=>$v){
$v["step_name"] = "pay_log";
$result[$sort++] = $v;
}
} }
//退款
$field_refund = ""; //退款
$refundData = $oRefundModel->selectRefundByOrderNo($field_refund, [ "order_no" => $order_no ]); $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) { if (count($refundData) > 0) {
$result["refund"] = $refundData; foreach ($refundData as $k=>$v){
$v["step_name"] = "refund";
$result[$sort++] = $v;
}
} }
//成交报告 //成交报告
$field_bargain = ""; $field_bargain = "id,report_id,order_id,trade_type,submit_agent_id,price,commission,role,agent_id,scale,
$bargainData = $oBargainModel->selectBargainByOrderNo($field_bargain, [ "order_no" => $order_no ]); scale_fee,create_time";
$bargainData = $oBargainModel->selectBargainByOrderNo($field_bargain, [ "order_id" => $order_id ]);
if (count($bargainData) > 0) { if (count($bargainData) > 0) {
$result["bargain"] = $bargainData; foreach ($bargainData as $k=>$v){
$v["step_name"] = "bargain";
$result[$sort++] = $v;
}
} }
//todo 财务审核
return $this->sortByTime($result); return $this->sortByTime($result);
} }
/**
* 排序时间
* @param $result
* @return mixed
*/
private function sortByTime($result) private function sortByTime($result)
{ {
//todo 根据时间排序 for($i=0;$i<count($result);$i++){
return array(); for($j = $i+1; $j<count($result) ; $j++){
if(strtotime($result[$j]["create_time"]) - strtotime($result[$i]["create_time"]) > 0){
$temp = $result[$j];
$result[$j] = $result[$i];
$result[$i] = $temp;
}
}
}
return $result;
} }
......
...@@ -88,6 +88,7 @@ class FollowUpLogModel extends Model ...@@ -88,6 +88,7 @@ class FollowUpLogModel extends Model
$where_["agent_id"] = $params["agent_id"]; $where_["agent_id"] = $params["agent_id"];
} }
return $this->db_ return $this->db_
->field($field) ->field($field)
->where($where_) ->where($where_)
......
...@@ -70,11 +70,14 @@ class OBargainModel extends Model ...@@ -70,11 +70,14 @@ class OBargainModel extends Model
if (isset($params["order_no"])) { if (isset($params["order_no"])) {
$where_["order_no"] = $params["order_no"]; $where_["order_no"] = $params["order_no"];
} }
if (isset($params["order_id"])) {
$where_["order_id"] = $params["order_id"];
}
if (isset($params["agent_id"])) { if (isset($params["agent_id"])) {
$where_["agent_id"] = $params["agent_id"]; $where_["agent_id"] = $params["agent_id"];
} }
return $this->db return $this->db_
->field($filed) ->field($filed)
->where($where_) ->where($where_)
->select(); ->select();
......
...@@ -65,8 +65,11 @@ class OMarchInModel extends Model ...@@ -65,8 +65,11 @@ class OMarchInModel extends Model
if (isset($params["order_no"])) { if (isset($params["order_no"])) {
$where_["order_no"] = $params["order_no"]; $where_["order_no"] = $params["order_no"];
} }
if (isset($params["order_id"])) {
$where_["order_id"] = $params["order_id"];
}
return $this->db return $this->db_model
->field($filed) ->field($filed)
->where($where_) ->where($where_)
->select(); ->select();
......
...@@ -50,11 +50,14 @@ class OPayLogModel extends Model ...@@ -50,11 +50,14 @@ class OPayLogModel extends Model
if (isset($params["order_no"])) { if (isset($params["order_no"])) {
$where_["order_no"] = $params["order_no"]; $where_["order_no"] = $params["order_no"];
} }
if (isset($params["order_id"])) {
$where_["order_id"] = $params["order_id"];
}
if (isset($params["agent_id"])) { if (isset($params["agent_id"])) {
$where_["agent_id"] = $params["agent_id"]; $where_["agent_id"] = $params["agent_id"];
} }
return $this->db return $this->db_
->field($filed) ->field($filed)
->where($where_) ->where($where_)
->select(); ->select();
......
...@@ -89,11 +89,14 @@ class ORefundModel extends Model{ ...@@ -89,11 +89,14 @@ class ORefundModel extends Model{
if (isset($params["order_no"])) { if (isset($params["order_no"])) {
$where_["order_no"] = $params["order_no"]; $where_["order_no"] = $params["order_no"];
} }
if (isset($params["order_id"])) {
$where_["order_id"] = $params["order_id"];
}
if (isset($params["agent_id"])) { if (isset($params["agent_id"])) {
$where_["agent_id"] = $params["agent_id"]; $where_["agent_id"] = $params["agent_id"];
} }
return $this->db return $this->db_
->field($filed) ->field($filed)
->where($where_) ->where($where_)
->select(); ->select();
......
...@@ -36,11 +36,11 @@ class OrderModel extends Model ...@@ -36,11 +36,11 @@ class OrderModel extends Model
} }
public function selectOrderByOrderNO($filed, $params) public function selectOrderByOrderId($filed, $params)
{ {
$where_ = []; $where_ = [];
if (isset($params["order_no"])) { if (isset($params["order_id"])) {
$where_["order_no"] = $params["order_no"]; $where_["order_id"] = $params["order_id"];
} }
if (isset($params["f_id"])) { if (isset($params["f_id"])) {
$where_["f_id"] = $params["f_id"]; $where_["f_id"] = $params["f_id"];
......
...@@ -271,6 +271,7 @@ Route::group('broker', [ ...@@ -271,6 +271,7 @@ Route::group('broker', [
'reportList' => ['api_broker/Report/reportList', [ 'method' => 'get' ] ], 'reportList' => ['api_broker/Report/reportList', [ 'method' => 'get' ] ],
'orderDetail' => ['api_broker/OrderLog/orderDetail', [ 'method' => 'get|post' ] ], 'orderDetail' => ['api_broker/OrderLog/orderDetail', [ 'method' => 'get|post' ] ],
'selectReportAll' => ['api_broker/OrderLog/selectReportAll', [ 'method' => 'get|post' ] ],
'token' => ['api_broker/broker/token', [ 'method' => 'get' ] ], 'token' => ['api_broker/broker/token', [ 'method' => 'get' ] ],
......
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