diff --git a/admin/controllers/receiver/Orders.php b/admin/controllers/receiver/Orders.php index ea33c2c2..3ee43f96 100644 --- a/admin/controllers/receiver/Orders.php +++ b/admin/controllers/receiver/Orders.php @@ -25,6 +25,7 @@ class Orders extends HD_Controller $this->load->model('app/liche/app_liche_orders_model'); $this->load->library('receiver/orders_entity'); + $this->load->library('OrdersList'); } public function index() @@ -87,7 +88,6 @@ class Orders extends HD_Controller $status_arr[] = array("id" => $key, "name" => $value['name'], "cate" => $cate, "count" => $count1); } $params['count_all'] = $this->orders_model->count(array("status>=" => 0, "biz_id<>" => 1, "brand_id<>" => 3));//全部 - $this->load->library('OrdersList'); $params['list_type'] = 'all'; $result = $this->orderslist->lists($params['status_pid'], $params); $this->data = $result; @@ -97,7 +97,7 @@ class Orders extends HD_Controller public function get() { - $status_arr = $this->orders_model->statusAry(0); + $status_arr = $this->orders_model->statusAry(); $id = $this->input->get('id'); $row = $this->orders_model->get(['id' => $id]); @@ -106,6 +106,8 @@ class Orders extends HD_Controller if (!$row) { return $this->show_json(SYS_CODE_FAIL, '订单不存在!'); } + $sub_status_cn = $this->orderslist->sub_status_cn($row['id'],$row['status']); + $sub_status_cn && $sub_status_cn = "-".$sub_status_cn; $money_json = json_decode($row['money_json'], true); $deposit = $row['deposit']; $jsondata = $row['jsondata'] ? json_decode($row['jsondata'], true) : array(); @@ -117,7 +119,7 @@ class Orders extends HD_Controller $row['price'] = number_format($row['price'], 2); $row['deposit'] = number_format($deposit, 2); $row['c_time'] = date('Y-m-d', $row['c_time']); - $row['sign_status_name'] = $status_arr['list'][$sign['status']]; + $row['sign_status_name'] = $status_arr[$row['status']]['name'].$sub_status_cn; $row['cf_title'] = $customers['cf_title']; $row['payway'] = intval($row['payway']); $row['item_id'] = intval($row['item_id']); @@ -380,7 +382,6 @@ class Orders extends HD_Controller //导出数据列表 public function export() { - $this->load->library('OrdersList'); $params = $this->input->get(); $params['page'] = 1; $params['size'] = 10000; @@ -830,4 +831,28 @@ class Orders extends HD_Controller $this->data['id'] = $this->input->get('id'); return $this->show_view('receiver/orders/add_paylog'); } + //取消配车 + public function edit_ckcar(){ + $this->load->model('items/items_model'); + $id = $this->input->post('id'); + $row = $this->orders_model->get(['id'=>$id]); + if(!$row || !$row['item_id']){ + return $this->show_json(SYS_CODE_FAIL, '参数错误'); + } + if($row['status']>5){ + return $this->show_json(SYS_CODE_FAIL, '用户已确认车辆不能修改'); + }else if ($row['status']==5){ + $ck_row = $this->order_ckcars_model->get(['o_id'=>$row['id']]); + if($ck_row['status']>=2){ + return $this->show_json(SYS_CODE_FAIL, '用户已确认车辆不能修改'); + } + } + $res = $this->orders_model->update(['item_id'=>0],['id'=>$row['id']]); + if($res){ + $this->items_model->update(['status' => 1,'bill_time'=>'0000-00-00 00:00:00'], ['id' => $row['item_id']]); + return $this->show_json(SYS_CODE_SUCCESS, '保存成功'); + }else{ + return $this->show_json(SYS_CODE_FAIL, '保存失败'); + } + } } diff --git a/admin/libraries/OrdersList.php b/admin/libraries/OrdersList.php index a6f6887d..08067763 100644 --- a/admin/libraries/OrdersList.php +++ b/admin/libraries/OrdersList.php @@ -1636,6 +1636,31 @@ class OrdersList array_unshift($data, $indexs); return ['data'=>$data,'indexs'=>$indexs]; } + + //获取子状态中文 + public function sub_status_cn($oid,$status_pid){ + if ($status_pid == 0) { + $this->ci->load->model('receiver/order/receiver_order_signs_model', 'sub_model'); + } else if ($status_pid == 1) { + $this->ci->load->model('receiver/order/receiver_order_loans_model', 'sub_model'); + } else if ($status_pid == 2) { + $this->ci->load->model('receiver/order/receiver_order_ckcars_model', 'sub_model'); + } else if ($status_pid == 3) { + $this->ci->load->model('receiver/order/receiver_order_bills_model', 'sub_model'); + } else if ($status_pid == 4) { + $this->ci->load->model('receiver/order/receiver_order_agents_model', 'sub_model'); + } else if ($status_pid == 5) { + $this->ci->load->model('receiver/order/receiver_order_deliverys_model', 'sub_model'); + } else{ + return ''; + } + $row = $this->ci->sub_model->get(['o_id'=>$oid],'status'); + if(!$row){ + return ''; + } + $status_arr = $this->ci->mdOrders->statusAry($status_pid); + return $status_arr ? $status_arr['list'][$row['status']] : ''; + } } ?> diff --git a/admin/views/receiver/orders/get.php b/admin/views/receiver/orders/get.php index 031ae53a..9eb01fbc 100644 --- a/admin/views/receiver/orders/get.php +++ b/admin/views/receiver/orders/get.php @@ -17,7 +17,7 @@