From 1fdd48ee2758689917f11bd2137709c96c7f65d1 Mon Sep 17 00:00:00 2001 From: zengchaoxin Date: Sat, 28 Sep 2019 03:03:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=B8=9A=E5=8A=A1=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E8=AE=BE=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + common/models/CarT.php | 4 + common/models/LinkmanT.php | 3 +- .../controllers/AppointmentController.php | 56 +- frontend/controllers/CarController.php | 483 +---- frontend/controllers/DatabaseController.php | 2 +- frontend/controllers/FinanceController.php | 47 +- frontend/views/appointment/add.php | 129 +- frontend/views/car/history.php | 55 + frontend/views/car/info.php | 1867 ++--------------- frontend/views/car/linkman-add.php | 89 + frontend/views/database/a-index.php | 2 +- frontend/views/database/b-index.php | 2 +- frontend/views/finance/car-update-frame.php | 179 +- frontend/views/user/edit.php | 36 +- 15 files changed, 694 insertions(+), 2261 deletions(-) create mode 100644 frontend/views/car/history.php create mode 100644 frontend/views/car/linkman-add.php diff --git a/.gitignore b/.gitignore index 346d3b2..9cbd357 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ composer.phar phpunit.phar # local phpunit config /phpunit.xml +frontend/web/upload diff --git a/common/models/CarT.php b/common/models/CarT.php index aa830ca..ae9159e 100644 --- a/common/models/CarT.php +++ b/common/models/CarT.php @@ -121,6 +121,10 @@ class CarT extends \common\models\Base ]; } + public function getLinkmen() { + return $this->hasMany(LinkmanT::className(),['car_id'=>'id']); + } + public function getUser() { return $this->hasOne(UserT::className(),['id'=>'user_id']); diff --git a/common/models/LinkmanT.php b/common/models/LinkmanT.php index 44c2d66..9fd4c06 100644 --- a/common/models/LinkmanT.php +++ b/common/models/LinkmanT.php @@ -36,7 +36,7 @@ class LinkmanT extends \common\models\Base [['car_id'], 'integer'], [['created_at', 'updated_at'], 'safe'], [['name'], 'string', 'max' => 100], - [['phone', 'type', 'id_number'], 'string', 'max' => 50], + [['phone', 'type', 'id_type', 'id_number'], 'string', 'max' => 50], ]; } @@ -51,6 +51,7 @@ class LinkmanT extends \common\models\Base 'name' => 'Name', 'phone' => 'Phone', 'type' => 'Type', + 'id_type' => 'Id Type', 'id_number' => 'Id Number', 'created_at' => 'Created At', 'updated_at' => 'Updated At', diff --git a/frontend/controllers/AppointmentController.php b/frontend/controllers/AppointmentController.php index d436bec..08660a8 100644 --- a/frontend/controllers/AppointmentController.php +++ b/frontend/controllers/AppointmentController.php @@ -88,12 +88,43 @@ class AppointmentController extends BaseController return $result; } + public function actionHistoryJson() + { + Yii::$app->response->format = Response::FORMAT_JSON; + $request = Yii::$app->request; + $car_id = $request->get('car_id'); + $offset = $request->get('offset', 0); + $limit = $request->get('limit', 10); + + $pdate = date("Y-m-d",strtotime("-6 months")); + $query = AppointmentHistoryT::find() + ->where(['car_id'=>$car_id]) + ->andWhere('pdate>"'.$pdate.'"') + ->orderBy('pdate DESC,id DESC'); +//echo $query->createCommand()->rawSql; + $total = $query->count(); + + $query = $query->offset($offset)->limit($limit); + $items = $query->all(); + + $data = []; + $data['total'] = count($items); + $data['rows'] = []; + foreach($items as $item) { + $row = $item->toArray(); + $row['user'] = $item->user?$item->user->getShowName():''; + $data['rows'][] = $row; + } + + return $data; + } + public function actionAdd() { $request = Yii::$app->request; $car_id = $request->get('car_id',0); - return $this->renderPartial('add',[ + return $this->render('add', [ 'car_id' => $car_id ]); } @@ -111,16 +142,15 @@ class AppointmentController extends BaseController $pdate = $request->post('pdate'); $ptime = $request->post('ptime'); $remark = $request->post('remark'); - $ptype = $request->post('ptype'); + $ptype = $request->post('ptype',0); $business_group_id = $request->post('business_group_id', 0); if($pdate == '') { - $result['msg'] = '请选择预约时间!'; + $result['msg'] = '请选择预约日期!'; return $result; } - - if($ptype == '0') { - $result['msg'] = '请选择预约类型!'; + if($ptime == '') { + $result['msg'] = '请选择预约时间!'; return $result; } @@ -175,7 +205,9 @@ class AppointmentController extends BaseController $row->remark = $remark; $row->business_group_id = $business_group_id; $row->is_first = 0; - $row->save(); + if(!$row->save()) { + throw new \Exception(print_r($row->getErrors(), true)); + } $h_row = new AppointmentHistoryT(); $h_row->car_id = $car_id; @@ -185,7 +217,9 @@ class AppointmentController extends BaseController $h_row->ptype = $ptype; $h_row->remark = $remark; $h_row->business_group_id = $business_group_id; - $h_row->save(); + if(!$h_row->save()) { + throw new \Exception(print_r($h_row->getErrors(), true)); + } $log_txt = ''; if($old_user_id > 0) { @@ -195,13 +229,13 @@ class AppointmentController extends BaseController $tran->commit(); + $result['success'] = true; + $result['msg'] = '保存成功'; } catch(\Exception $e) { $tran->rollBack(); - throw $e; + $result['msg'] = $e->getMessage(); } - $result['success'] = true; - $result['msg'] = '保存成功'; } return $result; } diff --git a/frontend/controllers/CarController.php b/frontend/controllers/CarController.php index bd19666..a38e449 100644 --- a/frontend/controllers/CarController.php +++ b/frontend/controllers/CarController.php @@ -89,14 +89,6 @@ class CarController extends BaseController // set_time_limit(0); // $begin_time = time(); // $file_path = \Yii::getAlias('@console').'/controllers/'; - - - - - - - - // var_dump($row); //加上级别筛选 @@ -718,260 +710,10 @@ class CarController extends BaseController } -// public function actionInfo() -// { -// $request = Yii::$app->request; -// $id = $request->get('id',0); -// $type = $request->get('type',0); -// $car_man = $request->get('car_man'); -// $phone = $request->get('phone'); -// $car_no = $request->get('car_no'); -// $page = $request->get('page',1); -// $sort_key = $request->get('sort_key','appointment_t.pdate'); -// $sort_value = $request->get('sort_value','ASC'); -// $next_index = $request->get('next_index',0); -// $back_params = $request->get('back_params'); -// $my_path = $this->my->group?$this->my->group->getPath():''; -// -// $car_info = CarT::findOne(['id'=>$id]); -// $order_info = $car_info->getOrders()->orderBy('id DESC')->one(); -// if(!$order_info) { -// $user_id = 0; -// if($car_info->location == 2) { -// $b_info = CarBT::findOne(['id'=>$car_info->id]); -// $user_id = $b_info->user_id; -// } -// if($car_info->location == 3) { -// $c_info = CarCT::findOne(['id'=>$car_info->id]); -// $user_id = $c_info->user_id; -// } -// if($car_info->location == 4) { -// $d_info = CarDT::findOne(['id'=>$car_info->id]); -// $user_id = $d_info->user_id; -// } -// $order_info = new OrderT(); -// $order_info->car_id = $car_info->id; -// $order_info->car_no = $car_info->car_no; -// $order_info->engine_no = $car_info->engine_no; -// $order_info->car_frame_no = $car_info->car_frame_no; -// $order_info->car_man = $car_info->car_man; -// $order_info->user_id = $user_id; -// $order_info->status_id = 1; -// $order_info->id_man = $car_info->car_man; -// $order_info->link_man = $car_info->car_man; -// $order_info->link_phone = $car_info->phone; -// $order_info->save(); -// } -// $insurer_type_items = InsurerTypeT::find()->all(); -// $insurer_company_items = InsurerCompanyT::find()->all(); -// $insurer_company2_items = InsurerCompany2T::find()->all(); -// $pay_type_items = PayTypeT::find()->all(); -// $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(); -// $direction_items = DirectionT::find() -// ->all(); -// $range_items = RangeT::find() -// ->all(); -// $city_items = CityT::find() -// ->all(); -// $district_items = DistrictT::find() -// ->orderBy('order_id ASC') -// ->all(); -// $gift_items = GiftT::find() -// ->where('type_id=1') -// ->all(); -// $success_items = InvalidT::getTree(1); -// $failure_items = InvalidT::getTreeXinbaoNew(2); -// -// //下一辆 -// $next_id = 0; -// 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=0') -// ->andWhere('appointment_t.pdate<="'.date('Y-m-d').'"'); -// -// $user_ids = $this->getChildrenUserIDs(); -// $query = $query->andWhere(['in','appointment_t.user_id',$user_ids]); -// -// if($car_man != '') { -// $query = $query->andWhere('car_t.car_man like "'.$car_man.'"'); -// } -// if($phone != '') { -// $query = $query->andWhere('car_t.phone="'.$phone.'"'); -// } -// if($car_no != '') { -// $query = $query->andWhere('car_t.car_no like "'.$car_no.'"'); -// } -// if($sort_key != '') { -// $query = $query->orderBy($sort_key.' '.$sort_value); -// } -// $next_item = $query->offset($next_index)->one(); -// if($next_item) { -// $next_id = $next_item->car_id; -// } -// $next_index++; -// } -// 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=0') -// ->andWhere('appointment_t.pdate<="'.date('Y-m-d').'"'); -// -// $user_ids = $this->getChildrenUserIDs(); -// $query = $query->andWhere(['in','appointment_t.user_id',$user_ids]); -// -// if($car_man != '') { -// $query = $query->andWhere('car_t.car_man like "'.$car_man.'"'); -// } -// if($phone != '') { -// $query = $query->andWhere('car_t.phone="'.$phone.'"'); -// } -// if($car_no != '') { -// $query = $query->andWhere('car_t.car_no like "'.$car_no.'"'); -// } -// if($sort_key != '') { -// $query = $query->orderBy($sort_key.' '.$sort_value); -// } -// $next_item = $query->offset($next_index)->one(); -// if($next_item) { -// $next_id = $next_item->car_id; -// } -// $next_index++; -// } -// 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=0'); -// -// $user_ids = $this->getChildrenUserIDs(); -// $query = $query->andWhere(['in','appointment_t.user_id',$user_ids]); -// -// if($car_man != '') { -// $query = $query->andWhere('car_t.car_man like "'.$car_man.'"'); -// } -// if($phone != '') { -// $query = $query->andWhere('car_t.phone="'.$phone.'"'); -// } -// if($car_no != '') { -// $query = $query->andWhere('car_t.car_no like "'.$car_no.'"'); -// } -// if($sort_key != '') { -// $query = $query->orderBy($sort_key.' '.$sort_value); -// } -// $next_item = $query->offset($next_index)->one(); -// if($next_item) { -// $next_id = $next_item->car_id; -// } -// $next_index++; -// } -// if($type == 4) { -// $query = OrderT::find() -// ->where('status_id=1 and return_status_id>0') -// ->orderBy('submit_date DESC, id DESC'); -// $user_items = $this->my->getChildren(); -// $user_ids[] = $this->my->id; -// if($user_items) { -// foreach($user_items as $user_item) { -// $user_ids[] = $user_item->id; -// } -// } -// $query = $query->andWhere(['in','user_id',$user_ids]); -// if($car_man != '') { -// $query = $query->andWhere('car_man="'.$car_man.'"'); -// } -// if($phone != '') { -// $query = $query->andWhere('link_phone="'.$phone.'"'); -// } -// if($car_no != '') { -// $query = $query->andWhere('car_no="'.$car_no.'"'); -// } -// $next_item = $query->offset($next_index)->one(); -// if($next_item) { -// $next_id = $next_item->car_id; -// } -// $next_index++; -// } -// -//// $gift_type_items = GiftType2T::find()->all(); -// $gift_group_items = GiftGroupT::find() -// ->where('is_free=0') -// ->all(); -// $gift_free_group_items = GiftGroupT::find() -// ->where('is_free=1') -// ->all(); -// //获取礼品数据 -// $sel_gifts = array(); -// $tmp_items = OrderGiftT::find() -// ->where('order_id='.$order_info->id) -// ->all(); -// foreach($tmp_items as $item) { -// $sel_gifts[$item->group_id] = $item; -// } -// -// $list = MeetT::getAllData(1); -// -// $business_group = BusinessGroupT::find()->all(); -// -// return $this->render('info',[ -// 'type' => $type, -// 'car_info' => $car_info, -// 'insurer_type_items' => $insurer_type_items, -// 'order_info' => $order_info, -// 'insurer_company_items' => $insurer_company_items, -// 'insurer_company2_items' => $insurer_company2_items, -// 'list' => $list, -// 'pay_type_items' => $pay_type_items, -// 'car_use_items' => $car_use_items, -// 'car_type_items' => $car_type_items, -// 'brand_items' => $brand_items, -// 'series_items' => $series_items, -// 'displacement_items' => $displacement_items, -// 'direction_items' => $direction_items, -// 'range_items' => $range_items, -// 'city_items' => $city_items, -// 'district_items' => $district_items, -// 'gift_items' => $gift_items, -// 'success_items' => $success_items, -// 'failure_items' => $failure_items, -// 'next_id' => $next_id, -// 'next_index' => $next_index, -// 'car_man' => $car_man, -// 'car_no' => $car_no, -// 'phone' => $phone, -// 'page' => $page, -// 'sort_key' => $sort_key, -// 'sort_value' => $sort_value, -// 'back_params' => $back_params, -//// 'gift_type_items' => $gift_type_items, -// 'gift_group_items' => $gift_group_items, -// 'gift_free_group_items' => $gift_free_group_items, -// 'sel_gifts' => $sel_gifts, -// 'business_group' => $business_group, -// 'business_group_id' => $this->my->business_group_id, -// ]); -// } public function actionInfo() { $request = Yii::$app->request; $id = $request->get('id',0); - $type = $request->get('type',0); - $car_man = $request->get('car_man'); - $phone = $request->get('phone'); - $car_no = $request->get('car_no'); - $page = $request->get('page',1); - $sort_key = $request->get('sort_key','appointment_t.pdate'); - $sort_value = $request->get('sort_value','ASC'); - $next_index = $request->get('next_index',0); - $back_params = $request->get('back_params'); - $my_path = $this->my->group?$this->my->group->getPath():''; $car_info = CarT::findOne(['id'=>$id]); $order_info = $car_info->getOrders()->orderBy('id DESC')->one(); @@ -1030,132 +772,6 @@ class CarController extends BaseController $success_items = InvalidT::getTree(1); $failure_items = InvalidT::getTreeXinbaoNew(2); - //下一辆 - $next_id = 0; - 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=0') - ->andWhere('appointment_t.pdate<="'.date('Y-m-d').'"'); - - $user_ids = $this->getChildrenUserIDs(); - $query = $query->andWhere(['in','appointment_t.user_id',$user_ids]); - - if($car_man != '') { - $query = $query->andWhere('car_t.car_man like "'.$car_man.'"'); - } - if($phone != '') { - $query = $query->andWhere('car_t.phone="'.$phone.'"'); - } - if($car_no != '') { - $query = $query->andWhere('car_t.car_no like "'.$car_no.'"'); - } - if($sort_key != '') { - $query = $query->orderBy($sort_key.' '.$sort_value); - } - $next_item = $query->offset($next_index)->one(); - if($next_item) { - $next_id = $next_item->car_id; - } - $next_index++; - } - 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=0') - ->andWhere('appointment_t.pdate<="'.date('Y-m-d').'"'); - - $user_ids = $this->getChildrenUserIDs(); - $query = $query->andWhere(['in','appointment_t.user_id',$user_ids]); - - if($car_man != '') { - $query = $query->andWhere('car_t.car_man like "'.$car_man.'"'); - } - if($phone != '') { - $query = $query->andWhere('car_t.phone="'.$phone.'"'); - } - if($car_no != '') { - $query = $query->andWhere('car_t.car_no like "'.$car_no.'"'); - } - if($sort_key != '') { - $query = $query->orderBy($sort_key.' '.$sort_value); - } - $next_item = $query->offset($next_index)->one(); - if($next_item) { - $next_id = $next_item->car_id; - } - $next_index++; - } - 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=0'); - - $user_ids = $this->getChildrenUserIDs(); - $query = $query->andWhere(['in','appointment_t.user_id',$user_ids]); - - if($car_man != '') { - $query = $query->andWhere('car_t.car_man like "'.$car_man.'"'); - } - if($phone != '') { - $query = $query->andWhere('car_t.phone="'.$phone.'"'); - } - if($car_no != '') { - $query = $query->andWhere('car_t.car_no like "'.$car_no.'"'); - } - if($sort_key != '') { - $query = $query->orderBy($sort_key.' '.$sort_value); - } - $next_item = $query->offset($next_index)->one(); - if($next_item) { - $next_id = $next_item->car_id; - } - $next_index++; - } - if($type == 4) { - $query = OrderT::find() - ->where('status_id=1 and return_status_id>0') - ->orderBy('submit_date DESC, id DESC'); - $user_items = $this->my->getChildren(); - $user_ids[] = $this->my->id; - if($user_items) { - foreach($user_items as $user_item) { - $user_ids[] = $user_item->id; - } - } - $query = $query->andWhere(['in','user_id',$user_ids]); - if($car_man != '') { - $query = $query->andWhere('car_man="'.$car_man.'"'); - } - if($phone != '') { - $query = $query->andWhere('link_phone="'.$phone.'"'); - } - if($car_no != '') { - $query = $query->andWhere('car_no="'.$car_no.'"'); - } - $next_item = $query->offset($next_index)->one(); - if($next_item) { - $next_id = $next_item->car_id; - } - $next_index++; - } - -// $gift_type_items = GiftType2T::find()->all(); - $gift_group_items = GiftGroupT::find() - ->where('is_free=0') - ->all(); - $gift_free_group_items = GiftGroupT::find() - ->where('is_free=1') - ->all(); - //获取礼品数据 - $sel_gifts = array(); - $tmp_items = OrderGiftT::find() - ->where('order_id='.$order_info->id) - ->all(); - foreach($tmp_items as $item) { - $sel_gifts[$item->group_id] = $item; - } - $list = MeetT::getAllData(1); $business_group = BusinessGroupT::find()->all(); @@ -1163,37 +779,19 @@ class CarController extends BaseController $order_ad=OrderAddress::findOne(['id'=>$order_info->addr_id]); //非车险方案表 -// $scheme_items=Scheme::find()->all(); $province = Region::find()->asArray()->where(['parent_id'=>0])->andWhere(['level'=>1])->all(); -// if($order_ad){ -// $c = Region::find()->asArray()->where(['parent_id'=>$order_ad->province])->andWhere(['level'=>2])->all(); -// $d = Region::find()->asArray()->where(['parent_id'=>$order_ad->city,'level'=>3])->all(); -// $e = Region::find()->asArray()->where(['parent_id'=>$order_ad->district,'level'=>4])->all(); -// -// }else{ -// $c = Region::find()->asArray()->andWhere(['level'=>2])->all(); -// $d = Region::find()->asArray()->where(['level'=>3])->all(); -// $e = Region::find()->asArray()->where(['level'=>4])->all(); -// } $c=[]; $d=[]; $e=[]; -// if($order_ad){ -// $c = Region::find()->asArray()->where(['parent_id'=>$order_ad->province])->andWhere(['level'=>2])->all(); -// $d = Region::find()->asArray()->where(['parent_id'=>$order_ad->city,'level'=>3])->all(); -// $e = Region::find()->asArray()->where(['parent_id'=>$order_ad->district,'level'=>4])->all(); -// -// }else{ -// $c = Region::find()->asArray()->andWhere(['level'=>2])->all(); -// $d = Region::find()->asArray()->where(['level'=>3])->all(); -// $e = Region::find()->asArray()->where(['level'=>4])->all(); -// } + $linkMan_items = $car_info->getLinkmen() + ->orderBy('created_at desc') + ->all(); return $this->render('info',[ - 'type' => $type, 'car_info' => $car_info, + 'link_men' => $linkMan_items, 'insurer_type_items' => $insurer_type_items, 'order_info' => $order_info, 'insurer_company_items' => $insurer_company_items, @@ -1212,21 +810,6 @@ class CarController extends BaseController 'gift_items' => $gift_items, 'success_items' => $success_items, 'failure_items' => $failure_items, - 'next_id' => $next_id, - 'next_index' => $next_index, - 'car_man' => $car_man, - 'car_no' => $car_no, - 'phone' => $phone, - 'page' => $page, - 'sort_key' => $sort_key, - 'sort_value' => $sort_value, - 'back_params' => $back_params, -// 'gift_type_items' => $gift_type_items, - 'gift_group_items' => $gift_group_items, - 'gift_free_group_items' => $gift_free_group_items, - 'sel_gifts' => $sel_gifts, - 'business_group' => $business_group, - 'business_group_id' => $this->my->business_group_id, 'province' => $province, 'city' =>$c, 'district' =>$d, @@ -6160,6 +5743,15 @@ class CarController extends BaseController return $result; } + public function actionLinkmanAdd() + { + $request = Yii::$app->request; + $car_id = $request->get('car_id',0); + return $this->render('linkman-add',[ + 'car_id' => $car_id + ]); + } + public function actionLinkmanSave() { Yii::$app->response->format = Response::FORMAT_JSON; @@ -6173,6 +5765,7 @@ class CarController extends BaseController $name = $request->post('name'); $phone = $request->post('phone'); $id_number = $request->post('id_number'); + $id_type = $request->post('id_type'); $type = $request->post('type'); if($name == '' || $phone == '') { @@ -6186,13 +5779,14 @@ class CarController extends BaseController $linkman_info->name = $name; $linkman_info->phone = $phone; $linkman_info->type = $type; + $linkman_info->id_type = $id_type; $linkman_info->id_number = $id_number; if(!$linkman_info->save()) { - var_dump($linkman_info->errors); + $result['msg'] = print_r($linkman_info->getErrors(),true); + } else { + $result['success'] = true; + $result['msg'] = '保存成功'; } - - $result['success'] = true; - $result['msg'] = '保存成功'; } return $result; } @@ -6220,4 +5814,43 @@ class CarController extends BaseController $result['html'] = $html; return $result; } + + public function actionHistory() { + $request = Yii::$app->request; + $car_id = $request->get('car_id'); + + return $this->render('history',[ + 'car_id' => $car_id + ]); + } + + public function actionHistoryJson() + { + Yii::$app->response->format = Response::FORMAT_JSON; + $request = Yii::$app->request; + $car_id = $request->get('car_id'); + $offset = $request->get('offset', 0); + $limit = $request->get('limit', 10); + + $query = CarLogT::find() + ->where(['car_id'=>$car_id,'type'=>1]) + ->andWhere('op_time>='.strtotime("-6 months")) + ->orderBy('op_time DESC'); +//echo $query->createCommand()->rawSql; + $total = $query->count(); + + $query = $query->offset($offset)->limit($limit); + $items = $query->all(); + + $data = []; + $data['total'] = count($items); + $data['rows'] = []; + foreach($items as $item) { + $row = $item->toArray(); + $row['op_time'] = date('Y-m-d H:i:s', $item->op_time); + $data['rows'][] = $row; + } + + return $data; + } } diff --git a/frontend/controllers/DatabaseController.php b/frontend/controllers/DatabaseController.php index a3c6e46..09ae8a4 100644 --- a/frontend/controllers/DatabaseController.php +++ b/frontend/controllers/DatabaseController.php @@ -254,7 +254,7 @@ class DatabaseController extends BaseController $row = $item->toArray(); $row['factory_model'] = MyLib::substr_cut($item->factory_model, 8); $row['car_man'] = MyLib::substr_cut($item->car_man, 8); - $row['location'] = $item->getLocation(); + $row['location_name'] = $item->getLocation(); $data['rows'][] = $row; } return $data; diff --git a/frontend/controllers/FinanceController.php b/frontend/controllers/FinanceController.php index a9884af..ab505fe 100644 --- a/frontend/controllers/FinanceController.php +++ b/frontend/controllers/FinanceController.php @@ -6361,7 +6361,7 @@ class FinanceController extends \frontend\controllers\UserBaseController public function actionCarUpdateFrame() { - return $this->render('car-update-frame', []); + return $this->render('car-update-frame'); } public function actionCarUpdateFrameInfo() @@ -6371,24 +6371,11 @@ class FinanceController extends \frontend\controllers\UserBaseController $result = array(); $result['success'] = false; $result['msg'] = '操作失败'; -// $company = $request->post('company', ''); $web_path = Yii::$app->getBasePath() . '/../frontend/web'; $filename = $web_path . $request->post('urlfile'); - $base_filename=$request->post('urlfile'); -// -// $file_path = \Yii::getAlias('@console').'/controllers/'; -// $yearname='wash12.xlsx'; -// $filename = $file_path.$yearname; -// $basename=$yearname; -// $company = $request->post('company', ''); -// -// $web_path = Yii::$app->getBasePath() . '/../frontend/web'; -// -// $urlfile = $web_path . $request->post('urlfile'); -// if(file_exists($filename)) { -// echo 'OK'."\r\n"; -// } + $base_filename=$request->post('file'); + //读取Excel 2007 $PHPReader = new \PHPExcel_Reader_Excel2007(); if (!$PHPReader->canRead($filename)) { @@ -6403,22 +6390,8 @@ class FinanceController extends \frontend\controllers\UserBaseController $currentSheet = $PHPExcel->getSheet(0); $rowCount = $currentSheet->getHighestRow(); - //$data = $currentSheet->toArray('', true, true); //创建新的xlsx表 -// $objectPHPExcel = new \PHPExcel(); -// $index = 1; $insert_total = 0; -// $objectPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$index,'车牌号'); -// $objectPHPExcel->setActiveSheetIndex(0)->setCellValue('B'.$index,'车架号'); -// $objectPHPExcel->setActiveSheetIndex(0)->setCellValue('C'.$index,'发动机号'); -// $objectPHPExcel->setActiveSheetIndex(0)->setCellValue('D'.$index,'品牌车型'); -// $objectPHPExcel->setActiveSheetIndex(0)->setCellValue('E'.$index,'车主'); -// $objectPHPExcel->setActiveSheetIndex(0)->setCellValue('F'.$index,'证件号'); -// $objectPHPExcel->setActiveSheetIndex(0)->setCellValue('G'.$index,'联系方式'); -// $objectPHPExcel->setActiveSheetIndex(0)->setCellValue('H'.$index,'保险到期日'); -// $objectPHPExcel->setActiveSheetIndex(0)->setCellValue('I'.$index,'初登日期'); -// $objectPHPExcel->setActiveSheetIndex(0)->setCellValue('J'.$index,'标准初登日期'); -// $objectPHPExcel->setActiveSheetIndex(0)->setCellValue('K'.$index,'车牌号不匹配'); for ($i = 2; $i <= $rowCount; $i++) { // echo $i.'/'.$rowCount."..."; @@ -6462,16 +6435,6 @@ class FinanceController extends \frontend\controllers\UserBaseController if ($car_info) { -// -// $car_c_info = CarCT::findOne(['id' => $car_info->id]); -// $car_d_info = CarDT::findOne(['id' => $car_info->id]); -// $car_e_info = CarET::findOne(['id' => $car_info->id]); -// -// if ($car_c_info || $car_d_info || $car_e_info) { -// continue; -// } - - if($car_no != ''){ $car_info->car_no = $car_no; } @@ -6525,7 +6488,7 @@ class FinanceController extends \frontend\controllers\UserBaseController // $car_info->save(); - if(!$car_info->save(false)) { + if(!$car_info->save(false)) { var_dump($car_info->errors); exit; } @@ -6585,7 +6548,7 @@ class FinanceController extends \frontend\controllers\UserBaseController // $car_info->save(); - if(!$car_info->save(false)) { + if(!$car_info->save(false)) { var_dump($car_info->errors); exit; } diff --git a/frontend/views/appointment/add.php b/frontend/views/appointment/add.php index 30a8d50..2debc09 100644 --- a/frontend/views/appointment/add.php +++ b/frontend/views/appointment/add.php @@ -1,42 +1,87 @@ -
- - - - - - - - - - - - - - - - - -
预约日期 - -
预约时间 - -
备注 - -
-
+ +beginBlock('header_css'); ?> + +endBlock(); ?> + +
+
+
+
+
+
+ +
+ +
+
+ + +
+
+ +
+
+ + +
+
+
+
+ +
+ +
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+ +beginBlock('footer_js'); ?> + + +endBlock('footer_js'); ?> diff --git a/frontend/views/car/history.php b/frontend/views/car/history.php new file mode 100644 index 0000000..5aedbc8 --- /dev/null +++ b/frontend/views/car/history.php @@ -0,0 +1,55 @@ + +beginBlock('header_css'); ?> + +endBlock(); ?> + +
+
+
+ + + + + + + + +
操作者操作时间操作内容
+
+
+
+ +beginBlock('footer_js'); ?> + + + + +endBlock('footer_js'); ?> diff --git a/frontend/views/car/info.php b/frontend/views/car/info.php index e722ba3..1618217 100644 --- a/frontend/views/car/info.php +++ b/frontend/views/car/info.php @@ -1,1671 +1,228 @@ context->my; ?> - - - - - - - - - - - - - - -
- - - - -
- - - - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
车牌号car_no?>厂牌型号factory_model?>品牌brand?$car_info->brand->name:''?>
发动机号engine_no?>车架号car_frame_no?>初登日期register_date?>
车辆类型carType?$car_info->carType->name:''?>运营性质carUse?$car_info->carUse->name:''?>座位数 - seats?> -
车系series?$car_info->series->name:''?>排量displacement?$car_info->displacement->name:''?>年份car_year?>
车主car_man?>联系电话phone?> - - - 车主证件号码 - car_man_number?> -
商业止保日期交强止保日期保险公司
备注remark?>
- -
- - -

联系人

- -
-
- - - - - - - - - - - - - - -
姓名: -
- -
-
联系电话: -
- -
-
证件号码: -
- -
-
关系: -
- -
-
-
- -
-
-

预约

- - - - - - - - - - - - - - - - - - - - - - - -
预约日期: -
- -
-
预约时间: -
- -
-
预约类型: -
- -
-
当天预约人数: -
- 0 -
-
预约备注: -
- -
-
业务分组: - -
- - - - - -
-
-
-
- 商业起保日期: -
- -
- 交强起保日期: -
- - - - - name.'"'; - // - // echo '>'.$item->name.''; - // } - // ?> - - -
- - -
-
-
-
- - -
- - - - - - - - -
- - - - - - - -
-
- - - - - - -
- - - - - - - id; - if(!$order_id) - $order_id = 0; - $tmp_row = PriceT::find() - ->where('order_id='.$order_id.' and type_id='.$item->id) - ->one(); - ?> - - - - - - -
险种内容不计免赔
name?>(code?>)content != '') { - $tmp_items = explode(',',$item->content); - echo ''; - } else { - echo ''; - } - ?> - has_nopay) { - echo 'is_nopay == 1) - echo ' checked '; - echo '>'; - } - ?> -
-
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* 商业总净保费商业含税总保费
* 交强总净保费交强含税总保费
* 折扣后商业净保费* 车船税
减免金额共计签单
商业折扣率应收
备注
- - - - - - - - -link_phone==''?$car_info->phone:$order_info->link_phone?> - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - shoufei_id==2):?>style="display: table-row;"> - - - - - - - - - - - - - - - -
车牌号 - - 初登日期 - - 电子邮件 - - * 成功理由 - -
车主 - - 证件号码 - - 微信号 - - *座位数 - -
被保险人 - - 证件号码 - - 联系人 - - 联系电话 - -
* 商业起保日期 - - * 交强起保日期 - - *支付方式 - - - *保险公司 - -
送单范围 - - - - - 送单日期 - -
送单地址 - - 正本送单地址 - - - 省份
- 城市
- 区县
- 详细地址 - - -
领款人开户行银行账号
备注 - -
业务分组 - -
-

免费礼品

- - - getGroups(); - $continue_flag = false; - if(count($groups) > 0) $continue_flag = true; - foreach($groups as $group) { - if($group->id == $my->group_id) - $continue_flag = false; - } - if($continue_flag) continue; - if($index > 0 && $index%4==0) { - echo ''; - } - $index++; - $sel_gift = isset($sel_gifts[$item->id])?$sel_gifts[$item->id]->gift:null; - echo ''; - echo ''; - } - while($index%4!=0) { - echo ''; - echo ''; - $index++; - } - ?> - -
'.$item->name.''; - echo ''; - echo '
-

收费礼品

- - - getGroups(); - $continue_flag = false; - if(count($groups) > 0) $continue_flag = true; - foreach($groups as $group) { - if($group->id == $my->group_id) - $continue_flag = false; - } - if($continue_flag) continue; - if($index > 0 && $index%4==0) { - echo ''; - } - $index++; - $sel_gift = isset($sel_gifts[$item->id])?$sel_gifts[$item->id]->gift:null; - echo ''; - echo ''; - } - while($index%4!=0) { - echo ''; - echo ''; - $index++; - } - ?> - -
'.$item->name.''; - echo ''; - echo '
- -
-
- - return_status_id > 0) { - ?> - - - - - -
- - - - - - - - - -
- - - - - - - -
-
-
- - -
- - - +beginBlock('header_css'); ?> + +endBlock(); ?> + +
+
+
+
车辆信息
+ +
+
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+
+ +
+
+
+
+
联系人
+ +
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+ + +
+
+
+
+
保险业务
+ +
+
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+
+ +
+
+
+
+
预约记录
+ +
+
+
+
+
+ - + + + + + - +
预约日期预约时间预约备注业务员操作时间
- - - - - - - -
- - - - - - - - - - - - - getOrders() - ->where('status_id=10 and id<>'.$order_info->id) - ->orderBy('print_date DESC, id DESC') - ->all(); - foreach($order_items as $index => $item) { - ?> - - - - - - - - - - - - -
序号被保险人商业起保日期交强起保日期出单日期共计签单业务员状态操作
id_man?>insurer1_begin_date?>insurer2_begin_date?>print_date?>total_all?>user?$item->user->getShowName():''?>status?$item->status->name:''?>[详情]
-
- - -
-
-
- - + + + \ No newline at end of file + +endBlock(); ?> \ No newline at end of file diff --git a/frontend/views/car/linkman-add.php b/frontend/views/car/linkman-add.php new file mode 100644 index 0000000..b62c249 --- /dev/null +++ b/frontend/views/car/linkman-add.php @@ -0,0 +1,89 @@ + +beginBlock('header_css'); ?> + +endBlock(); ?> + +
+
+
+
+
+
+ +
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+ +beginBlock('footer_js'); ?> + + +endBlock('footer_js'); ?> diff --git a/frontend/views/database/a-index.php b/frontend/views/database/a-index.php index 6dcbb7c..4802729 100644 --- a/frontend/views/database/a-index.php +++ b/frontend/views/database/a-index.php @@ -62,7 +62,7 @@ use \common\libs\MyLib; 保险公司 发动机号 车架号 - 位置 + 位置 操作 diff --git a/frontend/views/database/b-index.php b/frontend/views/database/b-index.php index cf610c9..6386ebf 100644 --- a/frontend/views/database/b-index.php +++ b/frontend/views/database/b-index.php @@ -38,7 +38,7 @@ use \common\libs\MyLib; - id.'">'.$item->name.''; diff --git a/frontend/views/finance/car-update-frame.php b/frontend/views/finance/car-update-frame.php index ddb6d24..7216965 100644 --- a/frontend/views/finance/car-update-frame.php +++ b/frontend/views/finance/car-update-frame.php @@ -1,70 +1,51 @@ - - - - - - - +beginBlock('header_css'); ?> + +endBlock(); ?> - - - - - - - - -
导入类型数据导入
批对日期 - - -
- -    - -
+
+
+
+
批量导入
+
+
+
+
+
+
+ +
+
+ +
+
+
选择文件
+
开始上传
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
- - - - - - - - +beginBlock('footer_js'); ?> + - + }); + // 文件上传失败,显示上传出错。 + uploader.on( 'uploadError', function( file ) { + var $li = $( '#'+file.id ), + $error = $li.find('div.error'); + + // 避免重复创建 + if ( !$error.length ) { + $error = $('
').appendTo( $li ); + } + + $error.text('上传失败'); + }); + +endBlock('footer_js'); ?> diff --git a/frontend/views/user/edit.php b/frontend/views/user/edit.php index 5ae04a3..d662f4a 100644 --- a/frontend/views/user/edit.php +++ b/frontend/views/user/edit.php @@ -67,22 +67,25 @@ use \common\libs\MyLib;
-
- +
+
+ is_login==1?'checked':''?>> + +
-
- +
+
+ is_outer==1?'checked':''?>> + +
-
- +
+
+ is_leave==1?'checked':''?>> + +
@@ -139,10 +142,11 @@ use \common\libs\MyLib;
-
- +
+
+ is_double==1?'checked':''?>> + +