diff --git a/home/controllers/h5/Toole.php b/home/controllers/h5/Toole.php new file mode 100644 index 00000000..a8b100bf --- /dev/null +++ b/home/controllers/h5/Toole.php @@ -0,0 +1,177 @@ +load->model('receiver/order/receiver_orders_model','orders_model'); + $this->load->model('receiver/order/receiver_order_signs_model','order_signs_model'); + $this->load->model('receiver/order/receiver_order_loans_model','order_loans_model'); + $this->load->model('receiver/order/receiver_order_ckcars_model','order_ckcars_model'); + $this->load->model('receiver/order/receiver_order_bills_model','order_bills_model'); + $this->load->model('receiver/order/receiver_order_agents_model','order_agents_model'); + $this->load->model('receiver/order/receiver_order_deliverys_model','order_deliverys_model'); + $this->load->model('receiver/order/receiver_order_contracts_model','order_contracts_model'); + } + + public function index(){ + $data['mobile'] = $mobile = $this->input->get('mobile'); + if($mobile){ + $data['status_name'] = $this->orders_model->get_status(); + $data['lists'] = $this->orders_model->select(['mobile'=>$mobile],'id desc',0,0,'id,name,mobile,status'); + } + $this->load->view('/h5/toole/index',$data); + } + public function detail(){ + $id = $this->input->get('id'); + $row = $this->orders_model->get(['id'=>$id]); + if($row['status']>=2){ + $ckcar = $this->order_ckcars_model->get(['o_id'=>$id],'status'); + $row['ckcar_status'] = $ckcar['status']; + } + if($row['status']>=3){ + $bill = $this->order_bills_model->get(['o_id'=>$id],'status'); + $row['bill_status'] = $bill['status']; + } + if($row['status']>=4){ + $agent = $this->order_agents_model->get(['o_id'=>$id],'status'); + $row['agent_status'] = $agent['status']; + } + $data['row'] = $row; + $this->load->view('/h5/toole/detail',$data); + } + + //一键完成分期 + public function fh_loan(){ + $id = $this->input->post('id'); + $row = $this->orders_model->get(['id'=>$id]); + if(!$row){ + $this->show_json(0,'参数错误'); + } + if($row['status']!=1){ + $this->show_json(0,'该订单未到分期状态'); + } + $result = $this->order_loans_model->update(['status'=>1],['o_id'=>$row['id']]); + if($result){ + $this->orders_model->update(['status'=>2],['id'=>$row['id']]); + $ckcar = $this->order_ckcars_model->get(['o_id'=>$row['id']]); + $replace = [ + 'o_id' => $row['id'], + 'status' => 0, + 'c_time' => time() + ]; + $ckcar && $replace['id'] = $ckcar['id']; + $this->order_ckcars_model->replace($replace); + $this->show_json(1,'修改成功'); + }else{ + $this->show_json(0,'修改失败'); + } + } + //一键完成配车 + public function fh_ckcar(){ + $this->load->model("items/items_model"); + $id = $this->input->post('id'); + $row = $this->orders_model->get(['id'=>$id]); + if(!$row){ + $this->show_json(0,'参数错误'); + } + if($row['status']>=3){ + $this->show_json(0,'用户确认,不能修改'); + } + $where = [ + 's_id' => $row['s_id'], + 'v_id' => $row['v_id'], + 'cor_id' => $row['cor_id'], + 'incor_id' => $row['incor_id'], + ]; + $item = $this->items_model->get($where); + if(!$item){ + unset($where['incor_id']); + $item = $this->items_model->get($where); + if(!$item){ + unset($where['cor_id']); + $item = $this->items_model->get($where); + if(!$item){ + unset($where['v_id']); + $item = $this->items_model->get($where); + } + } + } + if(!$item){ + $this->show_json(0,'未找到车辆信息'); + } + $item_id = $item['id']; + $this->orders_model->update(['item_id'=>$item_id],['id'=>$id]); + $ckcars = $this->order_ckcars_model->get(['o_id'=>$id]); + if(!$ckcars){ + $add_data = [ + 'o_id' => $id, + 'status' => 1, + 'c_time' => time() + ]; + $result = $this->order_ckcars_model->add($add_data); + }else{ + $result = $this->order_ckcars_model->update(['status'=>1],['id'=>$ckcars['id']]); + } + if($result){ + $this->show_json(1,'修改成功'); + }else{ + $this->show_json(0,'修改失败'); + } + } + //一键完成开票信息 + public function fh_bill(){ + $id = $this->input->post('id'); + $row = $this->orders_model->get(['id'=>$id]); + if(!$row){ + $this->show_json(0,'参数错误'); + } + if($row['status']!=3){ + $this->show_json(0,'修改失败,该订单不处于开票阶段'); + } + $result = $this->order_bills_model->update(['status'=>1,'file'=>'liche/2021/08/1337ff6686152d45/f30b803379255919.jpeg'],['o_id'=>$id]); + $this->orders_model->update(['status'=>4],['id'=>$row['id']]); + if(!$this->order_agents_model->get(['o_id'=>$id])){ + $this->order_agents_model->add(['o_id'=>$id,'c_time'=>time]); + } + $this->show_json(1,'修改成功'); + + } + //一键完成代办信息 + public function fh_agent(){ + $id = $this->input->post('id'); + $row = $this->orders_model->get(['id'=>$id]); + if(!$row){ + $this->show_json(0,'参数错误'); + } + if($row['status']!=4){ + $this->show_json(0,'修改失败,该订单不处于代办阶段'); + } + $agent = $this->order_agents_model->get(['o_id'=>$id]); + $up_data = [ + 'car_num' => '闽DXXXXXX', + 'car_img' => 'liche/2021/08/4e3bbf015016a9be/6ae15d0a363cc527.jpeg', + 'ins_img' => json_encode(['liche/2021/08/538fbf6c419d5958/5e4b8a5af1fbd4b6.jpeg']), + 'ins_time' => '2022-12-12', + 'status' => 1, + ]; + if($agent){ + $this->order_agents_model->update($up_data,['o_id'=>$id]); + }else{ + $up_data['o_id'] = $row['id']; + $up_data['c_time'] = time(); + $this->order_agents_model->add($add_data); + } + $this->orders_model->update(['status'=>5],['id'=>$id]); + if(!$this->order_deliverys_model->count(['o_id'=>$id])){ + $this->order_deliverys_model->add(['o_id'=>$id,'c_time'=>time]); + } + $this->show_json(1,'修改成功'); + } + private function show_json($code,$msg){ + $data['code'] = $code; + $data['msg'] = $msg; + die(json_encode($data,JSON_UNESCAPED_UNICODE)); + } +} diff --git a/home/views/h5/toole/detail.php b/home/views/h5/toole/detail.php new file mode 100644 index 00000000..82f5723a --- /dev/null +++ b/home/views/h5/toole/detail.php @@ -0,0 +1,119 @@ + + + + + + + 订单详情 + + + + + + + + + +
+
+ 姓名:
+ 手机号: +
+
+ =1 && !$row['payway']){?> + + + + + + + =2){?> + 0){?> + + + + + + =3){?> + 0){?> + + + + + + =4){?> + 0){?> + + + + + +
+
+ 返回首页 +
+
+ + + diff --git a/home/views/h5/toole/index.php b/home/views/h5/toole/index.php new file mode 100644 index 00000000..b90e2de3 --- /dev/null +++ b/home/views/h5/toole/index.php @@ -0,0 +1,56 @@ + + + + + + + 首页 + + + + + + +
+
+
+ +
+
+
+ +
+ + + + + + + + + + + + + + $val){?> + + + + + + + + + +
未搜索到相关订单数据
用户名手机号订单状态操作
+ 修改 +
+
+ + + diff --git a/www/home/index.php b/www/home/index.php index bb6303a8..a8bf5127 100755 --- a/www/home/index.php +++ b/www/home/index.php @@ -316,4 +316,4 @@ switch (ENVIRONMENT) * * And away we go... */ -require_once BASEPATH.'core/CodeIgniter.php'; \ No newline at end of file +require_once BASEPATH.'core/CodeIgniter.php';