From 266f7aef98a0683bc54a1bec382e1c3db44e9da2 Mon Sep 17 00:00:00 2001 From: zengchaoxin Date: Fri, 27 Sep 2019 15:40:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=95=8C=E9=9D=A2=E9=A3=8E?= =?UTF-8?q?=E6=A0=BC=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/AppointmentController.php | 71 ++--- frontend/controllers/FixCarController.php | 2 + frontend/controllers/InsurerController.php | 48 ++-- frontend/controllers/RenewalController.php | 2 + frontend/controllers/StatisticsController.php | 3 + frontend/views/appointment/first.php | 250 +++++++----------- frontend/views/insurer/my-list.php | 170 ++++++------ 7 files changed, 265 insertions(+), 281 deletions(-) diff --git a/frontend/controllers/AppointmentController.php b/frontend/controllers/AppointmentController.php index 6f0261c..d436bec 100644 --- a/frontend/controllers/AppointmentController.php +++ b/frontend/controllers/AppointmentController.php @@ -21,6 +21,9 @@ use yii\web\Response; class AppointmentController extends BaseController { + public $enableCsrfValidation = false; + public $layout = 'blue-main'; + public function actionIndex() { $request = Yii::$app->request; @@ -237,8 +240,18 @@ class AppointmentController extends BaseController } //首拨 - public function actionFirst() + public function actionFirst() { + $invalid_items = InvalidT::getTree(); + $user_items = $this->my->getChildren(); + + return $this->render('first',[ + 'invalid_items' => $invalid_items, + 'user_items' => $user_items + ]); + } + public function actionFirstJson() { + Yii::$app->response->format = Response::FORMAT_JSON; $session = Yii::$app->session; $request = Yii::$app->request; $car_man = $request->get('car_man'); @@ -249,6 +262,8 @@ class AppointmentController extends BaseController $sort_key = $request->get('sort_key','appointment_t.pdate'); $sort_value = $request->get('sort_value','ASC'); $user_id = $request->get('user_id'); + $offset = $request->get('offset',0); + $limit = $request->get('limit', 10); $query = AppointmentT::find() ->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`') @@ -256,17 +271,17 @@ class AppointmentController extends BaseController if($username == '') { $user_ids = $this->getChildrenUserIDs(); - $query = $query->andWhere(['in','appointment_t.user_id',$user_ids]); + $query->andWhere(['in','appointment_t.user_id',$user_ids]); } if($car_man != '') { - $query = $query->andWhere('car_t.car_man like "'.$car_man.'"'); + $query->andWhere('car_t.car_man like "'.$car_man.'"'); } if($phone != '') { - $query = $query->andWhere('car_t.phone like "'.$phone.'"'); + $query->andWhere('car_t.phone like "'.$phone.'"'); } if($car_no != '') { - $query = $query->andWhere('car_t.car_no like "'.$car_no.'"'); + $query->andWhere('car_t.car_no like "'.$car_no.'"'); } if($username != '') { $user_query = UserT::find() @@ -276,10 +291,10 @@ class AppointmentController extends BaseController $user_ids[] = $user_info->id; } if(count($user_ids) > 0) - $query = $query->andWhere(['in','appointment_t.user_id',$user_ids]); + $query->andWhere(['in','appointment_t.user_id',$user_ids]); } if($sort_key != '') { - $query = $query->orderBy($sort_key.' '.$sort_value.',appointment_t.id '.$sort_value); + $query->orderBy($sort_key.' '.$sort_value.',appointment_t.id '.$sort_value); } $sql = $query->createCommand()->rawSql; // echo $query->createCommand()->rawSql; @@ -287,33 +302,25 @@ class AppointmentController extends BaseController $session->remove('appointment_first'); $session->set('appointment_first',$sql); - $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]); - $pagination->setPage($page-1); - - $current_index = $pagination->offset; - $query = $query->offset($pagination->offset)->limit($pagination->limit); + $query = $query->offset($offset)->limit($limit); $items = $query->all(); - $page_info = MyLib::getPageInfo($pagination); - - $invalid_items = InvalidT::getTree(); - $user_items = $this->my->getChildren(); - - return $this->render('first',[ - 'items' => $items, - 'page_info' => $page_info, - 'car_man' => $car_man, - 'phone' => $phone, - 'car_no' => $car_no, - 'page' => $page, - 'sort_key' => $sort_key, - 'sort_value' => $sort_value, - 'type' => 1, - 'invalid_items' => $invalid_items, - 'username' => $username, - 'user_items' => $user_items, - 'user_id' => $user_id - ]); + $data = []; + $data['total'] = $total; + $data['rows'] = []; + foreach($items as $item) { + $car_info = $item->car; + $row = $item->toArray(); + $row['car_id'] = $car_info->id; + $row['car_no'] = $car_info->car_no; + $row['car_man'] = $car_info->car_man; + $row['register_date'] = $car_info->register_date; + $row['insurer1_date'] = $car_info->insurer1_date; + $row['insurer2_date'] = $car_info->insurer2_date; + $row['user_name'] = $item->user ? $item->user->getShowName():''; + $data['rows'][] = $row; + } + return $data; } //今日预约 diff --git a/frontend/controllers/FixCarController.php b/frontend/controllers/FixCarController.php index 0198bb4..e60e6a7 100644 --- a/frontend/controllers/FixCarController.php +++ b/frontend/controllers/FixCarController.php @@ -22,6 +22,8 @@ use yii\web\Response; class FixCarController extends BaseController { public $my = null; + public $enableCsrfValidation = false; + public $layout = 'blue-main'; public function init() { diff --git a/frontend/controllers/InsurerController.php b/frontend/controllers/InsurerController.php index dfacf89..fde57f7 100644 --- a/frontend/controllers/InsurerController.php +++ b/frontend/controllers/InsurerController.php @@ -59,6 +59,8 @@ use common\models\NonAutoInsurance; class InsurerController extends BaseController { public $my = null; + public $enableCsrfValidation = false; + public $layout = 'blue-main'; public function init() { @@ -406,15 +408,20 @@ class InsurerController extends BaseController return $result; } - public function actionMyList() + public function actionMyList() { + return $this->render('my-list'); + } + + public function actionMyListJson() { + Yii::$app->response->format = Response::FORMAT_JSON; $request = Yii::$app->request; $car_man = $request->get('car_man'); $phone = $request->get('phone'); $car_no = $request->get('car_no'); $id_man = $request->get('id_man'); - $page = $request->get('page',1); - if($page < 1) $page = 1; + $offset = $request->get('offset',0); + $limit = $request->get('limit', 10); $query = OrderT::find() ->where('status_id>1') @@ -427,39 +434,34 @@ class InsurerController extends BaseController $user_ids[] = $user_item->id; } } - $query = $query->andWhere(['in','user_id',$user_ids]); + $query->andWhere(['in','user_id',$user_ids]); if($car_man != '') { - $query = $query->andWhere('car_man="'.$car_man.'"'); + $query->andWhere('car_man="'.$car_man.'"'); } if($id_man != '') { - $query = $query->andWhere('id_man="'.$id_man.'"'); + $query->andWhere('id_man="'.$id_man.'"'); } if($phone != '') { - $query = $query->andWhere('link_phone="'.$phone.'"'); + $query->andWhere('link_phone="'.$phone.'"'); } if($car_no != '') { - $query = $query->andWhere('car_no="'.$car_no.'"'); + $query->andWhere('car_no="'.$car_no.'"'); } // echo $query->createCommand()->rawSql; +// exit; $total = $query->count(); - $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]); - $pagination->setPage($page-1); - - $query = $query->offset($pagination->offset)->limit($pagination->limit); + $query->offset($offset)->limit($limit); $items = $query->all(); - $page_info = MyLib::getPageInfo($pagination); - - return $this->render('my-list',[ - 'items' => $items, - 'car_man' => $car_man, - 'id_man' => $id_man, - 'phone' => $phone, - 'car_no' => $car_no, - 'page' => $page, - 'page_info' => $page_info - ]); + $data = []; + $data['total'] = $total; + $data['rows'] = []; + foreach($items as $item) { + $row = $item->toArray(); + $data['rows'][] = $row; + } + return $data; } // public function actionMyListInfo() diff --git a/frontend/controllers/RenewalController.php b/frontend/controllers/RenewalController.php index 7fff3f2..f5b0008 100644 --- a/frontend/controllers/RenewalController.php +++ b/frontend/controllers/RenewalController.php @@ -27,6 +27,8 @@ use yii\web\Response; class RenewalController extends BaseController { public $my = null; + public $enableCsrfValidation = false; + public $layout = 'blue-main'; public function init() { diff --git a/frontend/controllers/StatisticsController.php b/frontend/controllers/StatisticsController.php index f0ab914..e4cb4f6 100644 --- a/frontend/controllers/StatisticsController.php +++ b/frontend/controllers/StatisticsController.php @@ -18,6 +18,9 @@ use yii\web\Response; class StatisticsController extends BaseController { + public $enableCsrfValidation = false; + public $layout = 'blue-main'; + public function actionWork() { $request = Yii::$app->request; diff --git a/frontend/views/appointment/first.php b/frontend/views/appointment/first.php index ac7cea8..690f7d3 100644 --- a/frontend/views/appointment/first.php +++ b/frontend/views/appointment/first.php @@ -1,161 +1,107 @@ - - - - + + + - - - - - - - - - - -
- 车主: - 电话: - 车牌: - context->my->role_id != 5) { - ?> - 工号: - - 排序: - - -
- context->my->role_id != 5) { - ?> - - - 业务员: - -
- - - - - - - - - - - - - - - - $item) { - $start_index = ($page-1) * 20 + $index; - $car_info = $item->car; - ?> - - - - - - - - - - - - - - - - - - -
context->my->role_id==5) - echo '序号'; - else - echo ''; - ?>预约日期预约时间车牌号车主初登日期商业起保日期交强起保日期预约备注业务员操作
context->my->role_id == 5) - echo $start_index + 1; - else - echo ''; - ?>pdate?>ptime?>car_no?>car_man?>register_date?>insurer1_date?>insurer2_date?>remark,40)?>user?$item->user->getShowName():''?> - [详情] -
+endBlock(); ?> diff --git a/frontend/views/insurer/my-list.php b/frontend/views/insurer/my-list.php index dd3ae44..ea715d2 100644 --- a/frontend/views/insurer/my-list.php +++ b/frontend/views/insurer/my-list.php @@ -1,83 +1,105 @@ - - - - + + + - - - - - - - -
- 车主: - 电话: - 车牌: - 被保险人: -
- - - - - - - - - - - - - - - - $item) { - $start_index = ($page - 1) * 20 + $index; - ?> - - - - - - - - - - - - - - - - - - -
序号车主提单日期送单日期车牌号品牌共计签单应收状态业务员当前操作操作
car_man,15)?>submit_date?>send_date?>car_no?>car?MyLib::substr_cut($item->car->factory_model,15):''?>total_all?>total_real?> status->name?>user?$item->user->getShowName():''?>lock?$item->lock->getShowName():''?> - insurance_status==1 || $item->insurance_status==3):?> - [详情] - insurance_status==2):?> - [非车险详情] - -
+endBlock(); ?>