render('index'); } /** * @return string */ public function actionSubmit() { $e = new stdClass(); $e->success = false; $e->message = 'ok'; $userId = 0; $req = Yii::$app->request; $carNo = HtmlPurifier::process($req->post('carNo'), ['HTML.Allowed' => '']); $carModel = HtmlPurifier::process($req->post('carModel'), ['HTML.Allowed' => '']); $customer = HtmlPurifier::process($req->post('customer'), ['HTML.Allowed' => '']); $phone = HtmlPurifier::process($req->post('phone'), ['HTML.Allowed' => '']); $preRepair = HtmlPurifier::process($req->post('preRepair'), ['HTML.Allowed' => '']); $repairPrice = HtmlPurifier::process($req->post('repairPrice'), ['HTML.Allowed' => '']); $finishDate = HtmlPurifier::process($req->post('finishDate'), ['HTML.Allowed' => '']); $images = $req->post('images'); //echo $carNo.'_'.$carModel.'_'.$customer.'_'.$phone.'_'.$preRepair.'_'.$repairPrice.'_'.$finishDate.'_'.json_encode($images); $e->success = true; return $this->renderJson($e); } /** * @return string */ public function actionOrderList() { $e = new stdClass(); $e->success = false; $e->page = null; $e->page_count = null; $e->items = []; $page = $this->request->get('page'); $status = $this->request->get('status'); if (empty($page)) { $page = 1; } $allItemList = [0, 0, 0]; if ('working' == $status || '' == $status) { $allItemList = $this->getOrderList($page, 1); } else { $allItemList = $this->getOrderList($page, 0); } $e->page_count = $allItemList[1]; $e->page = $page ; $e->items = $allItemList[2]; $e->success = true; return $this->renderJson($e); } /** * @param $page * @param $status */ private function getOrderList($page, $status) { $pageSize = 5 ; $pager_offset = ($page -1) * $pageSize; $limitPage = $pageSize; $count = 15; $items = []; $pageCount = ceil(($count*1) / $pageSize); $carModelList = ['宝马X3','宝马X4','宝马X5','宝马X6','奔驰c200l','奔驰E260','奔驰E260','奔驰E300']; $customerList = ['张先生','李先生','王先生','赵先生','刘先生','宝先生','好先生','费先生']; for ($i = $pager_offset; $i < ($pager_offset+$limitPage); $i++ ) { $carModel = $carModelList[mt_rand(0,7)]; $customer = $customerList[mt_rand(0,7)]; $items[] = ['id'=> $i ,'carNo' => 'XA'.mt_rand(10000,99999), 'carModel' => $carModel, 'status' => $status, 'customer' => $customer ,'createdTime' => date('Y-m-d H:i')]; } return [$count, $pageCount, $items]; } /** * @return string */ public function actionOrderDetails() { $e = new stdClass(); $e->success = false; $e->message = 'ok'; $e->success = true; $e->item = [ 'carNo' => 'XX12345', 'carModel' => '宝马X3', 'customer' => '李先生', 'mobile' => '13900139001', 'preRepair' => '更换轮胎', 'repairPrice' => '300元', 'preFinishDate' => '2019-12-15 15:00', 'orderDateTime' => '2019-12-14 15:00', 'status' => 'finish', 'hasComment' => false, 'brokenImages' => [ Yii::$app->request->baseUrl.'/i/order/demo.jpg', Yii::$app->request->baseUrl.'/i/order/demo.jpg', Yii::$app->request->baseUrl.'/i/order/demo.jpg' ], 'repairPlans' => [ ['content' => '更换车胎', 'price' => 450], ['content' => '更换车胎', 'price' => 450], ['content' => '更换车胎', 'price' => 450], ], 'totalPrice' => 1350, 'finishImages' => [ Yii::$app->request->baseUrl.'/i/order/demo.jpg', Yii::$app->request->baseUrl.'/i/order/demo.jpg', Yii::$app->request->baseUrl.'/i/order/demo.jpg' ] ]; return $this->renderJson($e); } /** * @return string */ public function actionSubmitRepairPlans() { $e = new stdClass(); $e->success = false; $e->message = 'ok'; $repairPlans = $this->request->post('plans'); $images = $this->request->post('images'); //print_r($images); //print_r($repairPlans); $e->success = true; return $this->renderJson($e); } public function actionSubmitRate() { $e = new stdClass(); $e->success = false; $e->message = 'ok'; $star = $this->request->post('star'); $comment = $this->request->post('comment'); echo $star.'_'.$comment; $e->success = true; return $this->renderJson($e); } }