add-home-toole
This commit is contained in:
@@ -0,0 +1,177 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Toole extends CI_Controller {
|
||||
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->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));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="">
|
||||
<title>订单详情</title>
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
|
||||
<link src="https://cdn.bootcss.com/layer/3.1.0/mobile/need/layer.css">
|
||||
|
||||
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.bootcss.com/layer/3.1.0/mobile/layer.js"></script>
|
||||
</head>
|
||||
<style>
|
||||
.m10{
|
||||
margin:10px;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div style="margin-top:30px;">
|
||||
<div style="padding-left:10px;line-height:30px">
|
||||
姓名:<?=$row['name']?><br>
|
||||
手机号:<?=$row['mobile']?>
|
||||
</div>
|
||||
<div>
|
||||
<?if($row['status']>=1 && !$row['payway']){?>
|
||||
<?if($row['status']==1){?>
|
||||
<button type="button" class="btn btn-default m10" id="fh_loan">一键完成分期</button>
|
||||
<?}else{?>
|
||||
<button type="button" class="btn btn-success m10">已完成分期</button>
|
||||
<?}?>
|
||||
<?}?>
|
||||
<?if($row['status']>=2){?>
|
||||
<?if($row['ckcar_status']>0){?>
|
||||
<button type="button" class="btn btn-success m10">已完成匹配车辆</button>
|
||||
<?}else{?>
|
||||
<button type="button" class="btn btn-default m10" id="fh_ckcar">一键匹配车辆</button>
|
||||
<?}?>
|
||||
<?}?>
|
||||
<?if($row['status']>=3){?>
|
||||
<?if($row['bill_status']>0){?>
|
||||
<button type="button" class="btn btn-success m10">已完开票确认</button>
|
||||
<?}else{?>
|
||||
<button type="button" class="btn btn-default m10" id="fh_bill">一键确认开票</button>
|
||||
<?}?>
|
||||
<?}?>
|
||||
<?if($row['status']>=4){?>
|
||||
<?if($row['agent_status']>0){?>
|
||||
<button type="button" class="btn btn-success m10">已完代办信息</button>
|
||||
<?}else{?>
|
||||
<button type="button" class="btn btn-default m10" id="fh_agent">一键确认代办</button>
|
||||
<?}?>
|
||||
<?}?>
|
||||
</div>
|
||||
<div style="text-align:center">
|
||||
<a href="/h5/toole?mobile=<?=$row['mobile']?>" class="btn btn-link">返回首页</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
$("#fh_loan").click(function(){
|
||||
$.post("/h5/toole/fh_loan",{'id':<?=$row['id']?>},function(result){
|
||||
layer.open({
|
||||
content: result.msg,
|
||||
skin:'msg',
|
||||
time: 3,
|
||||
end:function(){
|
||||
if(result.code){
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
},'json');
|
||||
});
|
||||
$("#fh_ckcar").click(function(){
|
||||
$.post("/h5/toole/fh_ckcar",{'id':<?=$row['id']?>},function(result){
|
||||
layer.open({
|
||||
content: result.msg,
|
||||
skin:'msg',
|
||||
time: 3,
|
||||
end:function(){
|
||||
if(result.code){
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
},'json');
|
||||
});
|
||||
$("#fh_bill").click(function(){
|
||||
$.post("/h5/toole/fh_bill",{'id':<?=$row['id']?>},function(result){
|
||||
layer.open({
|
||||
content: result.msg,
|
||||
skin:'msg',
|
||||
time: 3,
|
||||
end:function(){
|
||||
if(result.code){
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
},'json');
|
||||
});
|
||||
$("#fh_agent").click(function(){
|
||||
$.post("/h5/toole/fh_agent",{'id':<?=$row['id']?>},function(result){
|
||||
layer.open({
|
||||
content: result.msg,
|
||||
skin:'msg',
|
||||
time: 3,
|
||||
end:function(){
|
||||
if(result.code){
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
},'json');
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
@@ -0,0 +1,56 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="">
|
||||
<title>首页</title>
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
|
||||
|
||||
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div style="margin-top:50px;">
|
||||
<form class="form-horizontal" methods="get" action="/h5/toole">
|
||||
<div class="form-group">
|
||||
<label for="inputEmail3" class="col-sm-10 control-label" style="width:100%;text-align:center">
|
||||
手机号:
|
||||
<input type="text" class="form-control" style="width:60%;display:inline" placeholder="输入手机号" name="mobile" value="<?=$mobile?>">
|
||||
<button type="submit" class="btn btn-default">搜索</button>
|
||||
</label>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?if(isset($mobile)){?>
|
||||
<div class="bs-example" data-example-id="simple-table">
|
||||
<table class="table">
|
||||
<?if(!$lists){?>
|
||||
<caption>未搜索到相关订单数据</caption>
|
||||
<?}else{?>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>用户名</th>
|
||||
<th>手机号</th>
|
||||
<th>订单状态</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?foreach($lists as $key => $val){?>
|
||||
<tr>
|
||||
<th scope="row"><?=$val['name']?></th>
|
||||
<td><?=$val['mobile']?></td>
|
||||
<td><?=$status_name[$val['status']]?></td>
|
||||
<td>
|
||||
<a href="/h5/toole/detail?id=<?=$val['id']?>">修改</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?}?>
|
||||
</tbody>
|
||||
<?}?>
|
||||
</table>
|
||||
</div>
|
||||
<?}?>
|
||||
</body>
|
||||
</html>
|
||||
+1
-1
@@ -316,4 +316,4 @@ switch (ENVIRONMENT)
|
||||
*
|
||||
* And away we go...
|
||||
*/
|
||||
require_once BASEPATH.'core/CodeIgniter.php';
|
||||
require_once BASEPATH.'core/CodeIgniter.php';
|
||||
|
||||
Reference in New Issue
Block a user