diff --git a/common/models/CarGiftT.php b/common/models/CarGiftT.php index 34bd6aa..1253160 100644 --- a/common/models/CarGiftT.php +++ b/common/models/CarGiftT.php @@ -72,6 +72,19 @@ class CarGiftT extends \common\models\Base return $this->hasOne(UserT::className(),['id'=>'user_id']); } + public function getStatus() { + switch($this->status) { + case 0: + return '未出库'; + case 1: + return '已出库'; + case 2: + return '正在退换'; + default: + return '状态错误'; + } + } + public function getOrder() { return $this->hasOne(OrderT::className(),['id'=>'order_id']); diff --git a/frontend/controllers/AppointmentController.php b/frontend/controllers/AppointmentController.php index fced2ae..61e9b7d 100644 --- a/frontend/controllers/AppointmentController.php +++ b/frontend/controllers/AppointmentController.php @@ -88,6 +88,43 @@ class AppointmentController extends BaseController return $result; } + public function actionIndexJson() + { + 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); + + $map = [ + 'and', + ['=', 'car_id', $car_id], + ['>', 'pdate', date("Y-m-d",strtotime("-6 months"))], + ]; + $order = [ + 'pdate' => SORT_DESC, + 'id' => SORT_DESC, + ]; + + $query = AppointmentHistoryT::find() + ->where($map) + ->orderBy($order); + $total = $query->count(); + $query = $query->offset($offset)->limit($limit); + $items = $query->all(); + + $data = []; + $data['total'] = $total; + $data['rows'] = []; + foreach($items as $item) { + $row = $item->toArray(); + $row['show_name'] = $item->user ? $item->user->getShowName() : ''; + $row['business_group_txt'] = $item->businessGroup ? $item->businessGroup->name : ''; + $data['rows'][] = $row; + } + return $data; + } + public function actionHistoryJson() { Yii::$app->response->format = Response::FORMAT_JSON; diff --git a/frontend/controllers/CarController.php b/frontend/controllers/CarController.php index 603fe3c..347841b 100644 --- a/frontend/controllers/CarController.php +++ b/frontend/controllers/CarController.php @@ -978,7 +978,10 @@ class CarController extends BaseController } public function actionInfoTrack() { - return $this->render('info-track'); + //登陆用户ID + $uid = $this->my->role_id; // 职务ID + $aid = $this->my->id; // 用户ID + return $this->render('info-track-edit'); } public function actionInfoTrackJson() @@ -1016,17 +1019,6 @@ class CarController extends BaseController // 无效数据 $failure_items = InvalidT::getTrees(); - //新礼品 - $query = GiftTicketT::find() - ->orderBy('id DESC'); - $items = $query->andWhere('car_no like "'.$car_info->car_no.'"')->all(); - - //旧礼品 - $gift_items = CarGiftT::find() - ->where('car_id='.$car_info->id) - ->orderBy('strategy_id DESC') - ->all(); - //下一辆 $next_id = 0; if($type == 1) { // 首发 预约时间小于当前 @@ -1113,40 +1105,132 @@ class CarController extends BaseController $list = MeetT::getAllData(2); - //登陆用户ID - $uid = $this->my->role_id; - $aid = $this->my->id; - //获取业务分组 $business_group = BusinessGroupT::find()->all(); + // 处理车辆信息 + $car_info_arr = $car_info->toArray(); + $car_info_arr['brand_txt'] = $car_info->brand ? $car_info->brand->name : ''; + $car_info_arr['car_type_txt'] = $car_info->carType ? $car_info->carType->name : ''; + $car_info_arr['car_use_txt'] = $car_info->carUse ? $car_info->carUse->name : ''; + $car_info_arr['car_use_txt'] = $car_info->carUse ? $car_info->carUse->name : ''; + $car_info_arr['series_txt'] = $car_info->series ? $car_info->series->name : ''; + $car_info_arr['displacement_txt'] = $car_info->displacement ? $car_info->displacement->name : ''; + $car_info_arr['location_txt'] = $car_info->location == 3 ? '本区' : ($car_info->location == 6 ? '外区' : '未知'); + + // 操作记录 + return MyLib::ok3([ - 'type' => $type, - 'car_info' => $car_info, - 'failure_info' => $failure_items, - 'next_id' => $next_id, - 'appointment_type' => $list, - 'new_gift_info' => $items, - 'old_gift_info' => $gift_items, - 'uid' => $uid, - 'next_index' => $next_index, - 'car_man' => $car_man, - 'car_no' => $car_no, - 'phone' => $phone, + 'type' => $type, // 预约类型(首发,预约时间) + 'can_cancel' => $this->canCancelAppointment($car_info->insurer1_date,$car_info->insurer2_date), + 'car_man' => $car_man, // 车主 + 'car_no' => $car_no, // 车牌号 + 'phone' => $phone, // 电话 + + 'car_info' => $car_info_arr, // 车辆信息 + 'car_use_info' => $car_use_items, // 运营性质 + 'car_type_info' => $car_type_items, // 车辆类型 + 'brand_info' => $brand_items, // 品牌信息 + 'series_info' => $series_items, // 车系信息 + 'displacement_info' => $displacement_items, // 排量信息 + + 'invalid_info' => $failure_items, // 无效数据 + 'appointment_type_info' => $list, // 预约类型 + 'business_group_info' => $business_group, // 业务分组 + + 'next_id' => $next_id, // 下一条信息ID + 'next_index' => $next_index, // 下一条偏移 'page' => $page, 'sort_key' => $sort_key, 'sort_value' => $sort_value, - 'car_use_items' => $car_use_items, - 'car_type_items' => $car_type_items, - 'brand_items' => $brand_items, - 'series_items' => $series_items, - 'displacement_items' => $displacement_items, + 'back_params' => $back_params, - 'business_group' => $business_group, - 'adid' => $aid, ]); } + public function actionInfoTrackTableJson(){ + Yii::$app->response->format = Response::FORMAT_JSON; + $request = Yii::$app->request; + $car_id = $request->get('car_id',0); + $car_no = $request->get('car_no',''); + $name = $request->get('name',0); + $offset = $request->get('offset',0); + $limit = $request->get('limit', 10); + switch ($name){ + case 'insurer_order': + $query = OrderT::find(); + $map = ['=', 'car_id', $car_id]; + $order = [ + 'print_date' => SORT_DESC, + 'id' => SORT_DESC, + ]; + break; + case 'new_gift': + $query = GiftTicketT::find(); + $map = ['like', 'car_no', $car_no]; + $order = [ + 'id' => SORT_DESC, + ]; + break; + case 'old_gift': + $query = CarGiftT::find(); + $map = ['=', 'car_id', $car_id]; + $order = [ + 'strategy_id' => SORT_DESC, + ]; + break; + case 'car_history': + $query = CarLogT::find(); + $map = ['and',['=', 'car_id', $car_id]]; + if($this->my->id <= 2){ + $map[] = ['>=', 'op_time', strtotime("-6 months")]; + } + $order = [ + 'op_time' => SORT_DESC, + ]; + break; + default: + return MyLib::error3('name参数错误'); + } + + $query = $query->where($map)->orderBy($order); + $total = $query->count(); + $query = $query->offset($offset)->limit($limit); + $items = $query->all(); + + $data = []; + $data['total'] = $total; + $data['rows'] = []; + foreach($items as $item) { + $row = $item->toArray(); + switch ($name){ + case 'insurer_order': + $row['show_name'] = $item->user ? $item->user->getShowName() : ''; + $row['status_txt'] = $item->status ? $item->status->name : ''; + break; + case 'new_gift': + $row['type_txt'] = $item->type ? $item->type->name : ''; + $row['show_name'] = $item->user ? $item->user->getShowName() : ''; + $row['status_txt'] = $item->status ? $item->getStatus() : ''; + break; + case 'old_gift': + $row['name'] = $item->gift->name; + $row['type_txt'] = $item->gift->getShowType(); + $row['remark'] = $item->gift->remark; + $row['strategy_txt'] = $item->strategy_id > 0 ? '公司礼品' : '自费礼品'; + $row['show_name'] = $item->user ? $item->user->getShowName() : ''; + $row['status_txt'] = $item->status ? $item->getStatus() : ''; + $row['submit_time_txt'] = date('Y-m-d H:i:s', $item->submit_time); + break; + case 'car_history': + $row['op_time_txt'] = date('Y-m-d H:i:s', $item->op_time); + break; + } + $data['rows'][] = $row; + } + return $data; + } + public function actionInfoTrackFix() { $request = Yii::$app->request; @@ -5095,4 +5179,16 @@ class CarController extends BaseController 'district_items' => $district_items ]); } + + public function canCancelAppointment($date1,$date2){ + $insurer_date = $date1; + if ($insurer_date == '') { + $insurer_date = $date2; + } + $begin_zhi_date = date('Y-m-d', strtotime('-3 month', strtotime($insurer_date . ' 00:00:00'))); + $cur_date = date('Y-m-d'); + $d1 = strtotime($cur_date); + $d2 = strtotime($begin_zhi_date); + return (int)round(($d2 - $d1) / 3600 / 24) <= 0; + } } diff --git a/frontend/views/car/info-track-edit.php b/frontend/views/car/info-track-edit.php new file mode 100644 index 0000000..6c186ce --- /dev/null +++ b/frontend/views/car/info-track-edit.php @@ -0,0 +1,690 @@ + +beginBlock('header_css'); ?> + + +endBlock(); ?> + +
+
+ +
+
+
+
+ +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+
+
+
+
预约信息
+
+
+
+
+
+
车牌号:
+
+
厂牌型号:
+
+
品牌:
+
+
+
+
+
+
发动机号:
+
+
车架号:
+
+
初登日期:
+
+
+
+
+
+
车辆类型:
+
+
运营性质:
+
+
座位数:
+
+
+
+
+
+
+
+
车系:
+
+
排量:
+
+
年份:
+
+
+
+
+
+
新保座席:
+
+
客服代表:
+
+
续保座席:
+
+
+
+
+
+
区域:
+
+
备注:
+
+
+
+
+
+
+
+
+
车主:
+
+
车主证件号码:
+
+
联系电话:
+
+ +
+
+
+
+
+ +
+
商业止保日期:
+
+
交强止保日期:
+
+
保险公司:
+
+
+
+
+
+ +
+
+ + +
+ +
+
+
+
+
+
+
+
+ +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + + +
+
+
+ + +
+
+ +
+
+
+ + + + + + + + + + + + + +
ID预约日期预约时间预约类型预约备注业务员业务分组操作时间
+
+
+
+
+
+
+
保单信息
+ +
+
+
+
+ + + + + + + + + + + + + + +
ID被保险人商业起保日期交强起保日期出单日期共计签单业务员状态操作
+
+
+
+
+
+
+
礼品列表
+ +
+
+
+
+ + + + + + + + + + +
礼品编号礼品名称操作时间操作员状态
+
+
+
+ + + + + + + + + + + + + +
ID礼品名称类型描述分类添加者操作时间状态
+
+
+
+
+
+
+
操作记录
+ +
+
+
+
+ + + + + + + + + + +
ID操作者操作时间操作内容
+
+
+
+
+
+ +beginBlock('footer_js'); ?> + + + + +endBlock('footer_js'); ?> \ No newline at end of file diff --git a/frontend/views/car/info-track.php b/frontend/views/car/info-track.php index 2b061ea..d0f8b82 100644 --- a/frontend/views/car/info-track.php +++ b/frontend/views/car/info-track.php @@ -19,12 +19,10 @@ use \common\libs\MyLib;
车辆信息
- - - 保存 - - + + 保存 + 下一个 @@ -48,7 +46,7 @@ use \common\libs\MyLib;
-
-
-
-
-