1. 在业务车辆界面添加无效数据功能

2. 修复业务车辆信息页无法拨打电话BUG.
dev
曾超新 5 years ago
parent 77d82331a3
commit 99e3b3db1e
  1. 62
      frontend/controllers/CarController.php
  2. 13
      frontend/views/car/info.php
  3. 67
      frontend/views/car/invalid-car.php

@ -65,6 +65,7 @@ use common\models\InvalidRenewal;
use common\models\ZhongjiGiftT;
use Yii;
use yii\data\Pagination;
use yii\db\Exception;
use yii\web\Response;
class CarController extends BaseController
@ -724,12 +725,8 @@ class CarController extends BaseController
$failure_items = InvalidT::getTreeXinbaoNew(2);
$list = MeetT::getAllData(1);
$business_group = BusinessGroupT::find()->all();
$order_ad=OrderAddress::findOne(['id'=>$order_info->addr_id]);
//非车险方案表
$province = Region::find()->asArray()->where(['parent_id'=>0])->andWhere(['level'=>1])->all();
$c=[];
@ -741,6 +738,7 @@ class CarController extends BaseController
->all();
return $this->render('info',[
'user_id' => $my->id,
'car_info' => $car_info,
'link_men' => $linkMan_items,
'insurer_type_items' => $insurer_type_items,
@ -765,7 +763,7 @@ class CarController extends BaseController
'city' =>$c,
'district' =>$d,
'twon' =>isset($e)?$e:[],
'order_ad' =>isset($order_ad)?$order_ad:[],
'order_ad' =>isset($order_ad)?$order_ad:[]
]);
}
/*
@ -4872,4 +4870,58 @@ class CarController extends BaseController
'district_items' => $district_items
]);
}
public function actionInvalidCar() {
$request = Yii::$app->request;
$car_id = $request->get('car_id');
$invalid_items = InvalidT::getTree();
return $this->render('invalid-car', [
'car_id' => $car_id,
'invalid_items' => $invalid_items
]);
}
public function actionInvalidSave() {
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$car_id = $request->post('car_id');
$invalid_id = $request->post('invalid_id');
if($invalid_id == 0) {
$result['msg'] = '请选择无效理由';
return $result;
}
$tran = CarT::getDb()->beginTransaction();
try {
$car_info = CarT::findOne(['id'=>$car_id]);
$car_info->location = 5;
if(!$car_info->save(false)) {
throw new Exception(print_r($car_info->getFirstErrors(),true));
}
$invalid_info = CarInvalidT::findOne(['id'=>$car_info->id]);
if(!$invalid_info) {
$invalid_info = new CarInvalidT(false);
$invalid_info->id = $car_info->id;
$invalid_info->user_id = $this->my->id;
$invalid_info->invalid_id = $invalid_id;
if(!$invalid_info->save(false)) {
throw new Exception(print_r($invalid_info->getFirstErrors(),true));
}
}
$this->addLog($car_info->id,'从业务员无效车辆信息',1);
$result['success'] = true;
$result['msg'] = '操作成功';
$tran->commit();
} catch (\Exception $e) {
$tran->rollBack();
$result['msg'] = $e->getMessage();
}
return $result;
}
}

@ -22,7 +22,7 @@ use \common\libs\MyLib;
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="opDlg()">
<i class="fa fa-history"></i> 操作记录
</a>
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="history.go(-1)">
<a class="btn btn-primary btn-xs history-btn" data-id="0" href="javascript:void(0);" onclick="history.go(-1)">
<i class="fa fa-backward"></i> 返回
</a>
</div>
@ -195,6 +195,9 @@ use \common\libs\MyLib;
<div class="ibox-title">
<h5>预约记录</h5>
<div class="ibox-tools">
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="invalidDlg()">
<i class="fa fa-ban"></i> 无效数据
</a>
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="appointmentDlg()">
<i class="fa fa-calendar"></i> 预约
</a>
@ -259,6 +262,10 @@ use \common\libs\MyLib;
title = '投保';
layer_show(title, '/car/order-add?car_id=<?=$car_info->id?>');
}
function invalidDlg() {
title = '无效数据';
layer_show(title, '/car/invalid-car?car_id=<?=$car_info->id?>');
}
function appointmentDlg() {
title = '添加预约';
layer_show(title, '/appointment/add?car_id=<?=$car_info->id?>');
@ -416,7 +423,7 @@ use \common\libs\MyLib;
var number_one = phone;
$.get('/phone/ax-out',{'phone':number_one,'user_id':'<?=$my->id?>'},function(obj){
$.get('/phone/ax-out',{'phone':number_one,'user_id':'<?=$user_id?>'},function(obj){
if(obj.success) {
@ -565,7 +572,5 @@ use \common\libs\MyLib;
ws.send(val);
console.log("数据已发送");
}
</script>
<?php $this->endBlock(); ?>

@ -0,0 +1,67 @@
<?php
use \common\libs\MyLib;
?>
<?php $this->beginBlock('header_css'); ?>
<link href="/assets/css/plugins/iCheck/custom.css" rel="stylesheet">
<?php $this->endBlock(); ?>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-content">
<div class="row">
<div class="col-sm-12">
<form role="form" class="form-horizontal data-from" id="theFrm">
<input type="hidden" name="car_id" value="<?=intval($car_id)?>">
<div class="form-group">
<label class="col-sm-2 control-label">无效理由</label>
<div class="col-sm-7">
<select name="invalid_id" class="form-control">
<option value="0">---请选择---</option>
<?php
foreach($invalid_items as $item) {
echo '<option value="'.$item->id.'">'.$item->name.'</option>';
}
?>
</select>
</div>
</div>
<div>
<div class="row">
<div class="col-sm-5 col-sm-offset-5">
<button class="btn btn-primary btn-save" type="button">
<strong>提 交</strong>
</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<?php $this->beginBlock('footer_js'); ?>
<script type="text/javascript" language="javascript">
$(function () {
//提交按钮
$(".btn-save").click(function(){
parent.layer.confirm('是否确认提交?', {
btn: ['确认','取消'], //按钮
shade: false //不显示遮罩
}, function(){
var params = $("#theFrm").serialize();
$.post('/car/invalid-save',params,function(obj){
parent.layer.msg(obj.msg);
if(obj.success) {
parent.history.go(-1);
layer_close();
}
},'json');
}, function(){
//
});
});
})
</script>
<?php $this->endBlock('footer_js'); ?>
Loading…
Cancel
Save