diff --git a/frontend/controllers/CarController.php b/frontend/controllers/CarController.php
index 1ea872b..86b0e05 100644
--- a/frontend/controllers/CarController.php
+++ b/frontend/controllers/CarController.php
@@ -976,8 +976,13 @@ class CarController extends BaseController
]);
}
- public function actionInfoTrack()
+ public function actionInfoTrack() {
+ return $this->render('info-track');
+ }
+
+ public function actionInfoTrackJson()
{
+ Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$id = $request->get('id',0);
$type = $request->get('type',0);
@@ -990,18 +995,24 @@ class CarController extends BaseController
$next_index = $request->get('next_index',0);
$back_params = $request->get('back_params');
+ // 车辆信息
$car_info = CarT::findOne(['id'=>$id]);
-
+ // 运营性质
$car_use_items = CarUseT::find()->all();
+ // 车辆类型
$car_type_items = CarTypeT::find()->all();
+ // 品牌信息
$brand_items = BrandT::find()->all();
+ // 车系信息
$series_items = SeriesT::find()
->where('brand_id='.intval($car_info->brand_id))
->all();
+ // 排量信息
$displacement_items = DisplacementT::find()
->where('series_id='.intval($car_info->series_id))
->all();
// $failure_items = InvalidT::getTree(2);
+ // 无效数据
$failure_items = InvalidT::getTrees();
//新礼品
@@ -1017,7 +1028,7 @@ class CarController extends BaseController
//下一辆
$next_id = 0;
- if($type == 1) {
+ if($type == 1) { // 首发 预约时间小于当前
$query = AppointmentT::find()
->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`')
->where('appointment_t.is_first=1 and car_t.is_track=1')
@@ -1044,7 +1055,7 @@ class CarController extends BaseController
}
$next_index++;
}
- if($type == 2) {
+ if($type == 2) { // 历史 预约时间小于当前
$query = AppointmentT::find()
->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`')
->where('appointment_t.is_first=0 and car_t.is_track=1')
@@ -1071,7 +1082,8 @@ class CarController extends BaseController
}
$next_index++;
}
- if($type == 3) {
+
+ if($type == 3) { // 历史 预约时间不限
$query = AppointmentT::find()
->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`')
->where('appointment_t.is_first=0 and car_t.is_track=1');
@@ -1107,14 +1119,14 @@ class CarController extends BaseController
//获取业务分组
$business_group = BusinessGroupT::find()->all();
- return $this->render('info-track',[
+ return MyLib::ok3([
'type' => $type,
'car_info' => $car_info,
- 'failure_items' => $failure_items,
+ 'failure_info' => $failure_items,
'next_id' => $next_id,
- 'list' => $list,
- 'items' => $items,
- 'gift_items' => $gift_items,
+ 'appointment_type' => $list,
+ 'new_gift_info' => $items,
+ 'old_gift_info' => $gift_items,
'uid' => $uid,
'next_index' => $next_index,
'car_man' => $car_man,
@@ -1130,10 +1142,10 @@ class CarController extends BaseController
'displacement_items' => $displacement_items,
'back_params' => $back_params,
'business_group' => $business_group,
- 'business_group_id' => $business_group_id,
'adid' => $aid,
]);
}
+
public function actionInfoTrackFix()
{
$request = Yii::$app->request;
@@ -4185,17 +4197,13 @@ class CarController extends BaseController
return $result;
}
+ public function actionSearch() {
+ return $this->render('search');
+ }
-
-
-
-
-
-
-
-
- public function actionSearch()
+ public function actionSearchJson()
{
+ Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$car_man = $request->get('car_man');
$phone = $request->get('phone');
@@ -4205,8 +4213,8 @@ class CarController extends BaseController
$insurer_date = $request->get('insurer_date');
$id_man = $request->get('id_man');
$op = $request->get('op',1);
- $page = $request->get('page',1);
- if($page < 1) $page = 1;
+ $offset = $request->get('offset',0);
+ $limit = $request->get('limit', 10);
$query = CarT::find()
->leftJoin('order_t','`order_t`.`car_id`=`car_t`.`id`');
@@ -4246,29 +4254,23 @@ class CarController extends BaseController
if($id_man != '') {
$query = $query->andWhere('order_t.id_man="'.$id_man.'"');
}
- $total = $query->count();
- $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
- $pagination->setPage($page-1);
-
- $query = $query->offset($pagination->offset)->limit($pagination->limit);
+ $total = $query->count();
+ $query = $query->offset($offset)->limit($limit);
$items = $query->all();
- $page_info = MyLib::getPageInfo($pagination);
-
- return $this->render('search',[
- 'items' => $items,
- 'car_man' => $car_man,
- 'phone' => $phone,
- 'car_no' => $car_no,
- 'car_model' => $car_model,
- 'register_date' => $register_date,
- 'insurer_date' => $insurer_date,
- 'id_man' => $id_man,
- 'page' => $page,
- 'page_info' => $page_info
- ]);
+ $data = [];
+ $data['total'] = $total;
+ $data['rows'] = [];
+ foreach($items as $item) {
+ $row = $item->toArray();
+ $row['show_name'] = $item->lib&&$item->lib->user?$item->lib->user->getShowName():'';
+ $row['location_txt'] = $item->location?$item->getLocation():'';
+ $data['rows'][] = $row;
+ }
+ return $data;
}
+
public function actionNonSearch()
{
$request = Yii::$app->request;
diff --git a/frontend/controllers/FixCarController.php b/frontend/controllers/FixCarController.php
index d34cf3b..053683f 100644
--- a/frontend/controllers/FixCarController.php
+++ b/frontend/controllers/FixCarController.php
@@ -86,6 +86,8 @@ class FixCarController extends BaseController
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$car_no = $request->get('car_no');
+ $offset = $request->get('offset',0);
+ $limit = $request->get('limit', 10);
$query = FixCarT::find()
->where('status=0');
@@ -97,7 +99,7 @@ class FixCarController extends BaseController
}
$total = $query->count();
- $query = $query->orderBy('id DESC');
+ $query = $query->orderBy('id DESC')->offset($offset)->limit($limit);
$items = $query->all();
$data = [];
@@ -121,6 +123,8 @@ class FixCarController extends BaseController
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$car_no = $request->get('car_no');
+ $offset = $request->get('offset',0);
+ $limit = $request->get('limit', 10);
$query = FixCarT::find()
->where('status>0');
@@ -133,7 +137,7 @@ class FixCarController extends BaseController
$total = $query->count();
- $query = $query->orderBy('status ASC');
+ $query = $query->orderBy('status ASC')->offset($offset)->limit($limit);
$items = $query->all();
$data = [];
@@ -598,6 +602,8 @@ class FixCarController extends BaseController
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$car_no = $request->get('car_no');
+ $offset = $request->get('offset',0);
+ $limit = $request->get('limit', 10);
$query = FixCarT::find();
$query = $query->where('status=1');
@@ -605,7 +611,7 @@ class FixCarController extends BaseController
$query = $query->andWhere(['like','car_no',$car_no]);
}
$total = $query->count();
- $query = $query->orderBy('status ASC,receive_date ASC');
+ $query = $query->orderBy('status ASC,receive_date ASC')->offset($offset)->limit($limit);
$items = $query->all();
$data = [];
@@ -632,6 +638,8 @@ class FixCarController extends BaseController
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$car_no = $request->get('car_no');
+ $offset = $request->get('offset',0);
+ $limit = $request->get('limit', 10);
$query = FixCarT::find();
$query = $query->where('status>1');
@@ -639,7 +647,7 @@ class FixCarController extends BaseController
$query = $query->andWhere(['like','car_no',$car_no]);
}
$total = $query->count();
- $query = $query->orderBy('status ASC,updated_at DESC');
+ $query = $query->orderBy('status ASC,updated_at DESC')->offset($offset)->limit($limit);
$items = $query->all();
$data = [];
@@ -686,6 +694,8 @@ class FixCarController extends BaseController
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$car_no = $request->get('car_no');
+ $offset = $request->get('offset',0);
+ $limit = $request->get('limit', 10);
$query = FixCarT::find();
$query = $query->where('status=2');
@@ -694,7 +704,7 @@ class FixCarController extends BaseController
}
$total = $query->count();
- $query = $query->orderBy('status ASC');
+ $query = $query->orderBy('status ASC')->offset($offset)->limit($limit);
$items = $query->all();
$data = [];
@@ -715,6 +725,8 @@ class FixCarController extends BaseController
{
$request = Yii::$app->request;
$car_no = $request->get('car_no');
+ $offset = $request->get('offset',0);
+ $limit = $request->get('limit', 10);
$query = FixCarT::find();
$query = $query->where('status>2');
@@ -740,6 +752,8 @@ class FixCarController extends BaseController
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$car_no = $request->get('car_no');
+ $offset = $request->get('offset',0);
+ $limit = $request->get('limit', 10);
$query = FixCarT::find();
$query = $query->where('status>2');
@@ -748,7 +762,7 @@ class FixCarController extends BaseController
}
$total = $query->count();
- $query = $query->orderBy('status ASC,updated_at DESC');
+ $query = $query->orderBy('status ASC,updated_at DESC')->offset($offset)->limit($limit);
$items = $query->all();
$data = [];
@@ -775,6 +789,8 @@ class FixCarController extends BaseController
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$car_no = $request->get('car_no');
+ $offset = $request->get('offset',0);
+ $limit = $request->get('limit', 10);
$query = FixCarT::find();
$query = $query->where('status>3');
@@ -782,7 +798,7 @@ class FixCarController extends BaseController
$query = $query->andWhere(['like','car_no',$car_no]);
}
$total = $query->count();
- $query = $query->orderBy('status ASC');
+ $query = $query->orderBy('status ASC')->offset($offset)->limit($limit);
$items = $query->all();
$lists = array();
diff --git a/frontend/views/car/info-track.php b/frontend/views/car/info-track.php
index 478eaab..2b061ea 100644
--- a/frontend/views/car/info-track.php
+++ b/frontend/views/car/info-track.php
@@ -1,859 +1,894 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
\ No newline at end of file
+ }, 'json');
+ } else {
+ alert('不填写原因,无法退回');
+ }
+ }
+
+ // 维修明细
+ function addInfo() {
+ var id = $('#id').val();
+ if (id > 0) {
+ layer_show('维修明细', '/fix-car/add-item?fix_id=' + id);
+ } else {
+ alert('请先保存维修信息');
+ }
+ }
+
+ // 打印接车单
+ function printInfo() {
+ window.open('/fix-car/print-receive?id==$info->id?>');
+ }
+
+ //返回
+ function goBack() {
+
+ }
+
+ function showNameFormatter(value) {
+ return value.username + '(' + value.name + ')';
+ }
+
+ function typeFormatter(value) {
+ switch (+value) {
+ case 1:
+ return '实名礼品';
+ case 2:
+ return '礼券';
+ }
+ }
+
+ function strategyFormatter(value) {
+ return value == 0 ? '公司礼品' : '自费礼品';
+ }
+
+ function dateFormatter(value) {
+ var datetime = new Date(value * 1000);
+ var year = datetime.getFullYear(),
+ month = ("0" + (datetime.getMonth() + 1)).slice(-2),
+ date = ("0" + datetime.getDate()).slice(-2),
+ hour = ("0" + datetime.getHours()).slice(-2),
+ minute = ("0" + datetime.getMinutes()).slice(-2),
+ second = ("0" + datetime.getSeconds()).slice(-2);
+ return year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second;
+ }
+
+ function statusFormatter(value) {
+ var statusTxt = '';
+ switch (+value) {
+ case 0:
+ statusTxt = "未出库";
+ break;
+ case 1:
+ statusTxt = "已出库";
+ break;
+ case 2:
+ statusTxt = "正在退换";
+ break;
+ case 3:
+ statusTxt = "已使用";
+ break;
+ default:
+ statusTxt = "未知状态";
+ break;
+ }
+ return statusTxt;
+ }
+
+
+
+endBlock('footer_js'); ?>
\ No newline at end of file
diff --git a/frontend/views/car/search.php b/frontend/views/car/search.php
index 728007f..8b5fc6e 100644
--- a/frontend/views/car/search.php
+++ b/frontend/views/car/search.php
@@ -1,81 +1,120 @@
-
-
-
-
-
+
+
+
-
-
-
- 序号
- 车主
- 车牌号
- 发动机号
- 车架号
- 初登日期
- 保险日期
- 位置
- 业务员
- 操作
-
- $item) {
- $start_index = ($page - 1) * 20 + $index;
- $order_info = $item->getOrders()->orderBy('id DESC')->one();
- ?>
-
- =$start_index + 1?>
- =$item->car_man?>
- =$item->car_no?>
- =$item->engine_no?>
- =$item->car_frame_no?>
- =$item->register_date?>
- =$item->insurer1_date?>
- =$item->getLocation()?>
- =$item->lib&&$item->lib->user?$item->lib->user->getShowName():''?>
-
- [详情 ]
-
-
-
-
- =$page_info?>
-
-
+endBlock(); ?>
\ No newline at end of file
diff --git a/frontend/views/fix-car/my-list-edit.php b/frontend/views/fix-car/my-list-edit.php
index ead2187..a1e9859 100644
--- a/frontend/views/fix-car/my-list-edit.php
+++ b/frontend/views/fix-car/my-list-edit.php
@@ -141,7 +141,7 @@ use \common\libs\MyLib;
年份
-
+
商业保单号
diff --git a/frontend/views/fix-car/my-list-finish.php b/frontend/views/fix-car/my-list-finish.php
index 0c3febc..ced3681 100644
--- a/frontend/views/fix-car/my-list-finish.php
+++ b/frontend/views/fix-car/my-list-finish.php
@@ -19,7 +19,7 @@ use \common\libs\MyLib;