Commit d11ff3941c285377cc4a935b377aadc6f45a5375
1 parent
6bece648
Exists in
master
app-ht(v0.0.1 build 2)
1. A后台订单管理 2. A维修厂管理
Showing
36 changed files
with
1248 additions
and
258 deletions
Show diff stats
app-ht/config/main.php
@@ -19,7 +19,12 @@ $config = [ | @@ -19,7 +19,12 @@ $config = [ | ||
19 | 'runtimePath' => Yii::getAlias('@rootRuntime').'/app-ht/', | 19 | 'runtimePath' => Yii::getAlias('@rootRuntime').'/app-ht/', |
20 | 'bootstrap' => ['log'], | 20 | 'bootstrap' => ['log'], |
21 | 'modules' => [ | 21 | 'modules' => [ |
22 | - | 22 | + 'order' => [ |
23 | + 'class' => 'app\ht\modules\order\Module', | ||
24 | + ], | ||
25 | + 'maintainer' => [ | ||
26 | + 'class' => 'app\ht\modules\maintainer\Module', | ||
27 | + ], | ||
23 | 'system'=>[ | 28 | 'system'=>[ |
24 | 'class' => 'app\ht\modules\system\Module', | 29 | 'class' => 'app\ht\modules\system\Module', |
25 | ], | 30 | ], |
app-ht/config/params.php
app-ht/controllers/SiteController.php
@@ -183,104 +183,6 @@ class SiteController extends BaseController | @@ -183,104 +183,6 @@ class SiteController extends BaseController | ||
183 | { | 183 | { |
184 | $maxSize = 1048576; // 1024 * 1024 = 1MB | 184 | $maxSize = 1048576; // 1024 * 1024 = 1MB |
185 | 185 | ||
186 | - //定义允许上传的文件扩展名 | ||
187 | - $extArr = array('gif', 'jpg', 'jpeg', 'png', 'bmp'); | ||
188 | - | ||
189 | - //PHP上传失败 | ||
190 | - if (!empty($_FILES['imgFile']['error'])) { | ||
191 | - switch ($_FILES['imgFile']['error']) { | ||
192 | - case '1': | ||
193 | - $error = '图片超过系统允许的大小。'; // php.ini允许的大小(默认2MB) | ||
194 | - break; | ||
195 | - case '2': | ||
196 | - $error = '图片超过表单允许的大小。'; | ||
197 | - break; | ||
198 | - case '3': | ||
199 | - $error = '图片只有部分被上传。'; | ||
200 | - break; | ||
201 | - case '4': | ||
202 | - $error = '请选择图片。'; | ||
203 | - break; | ||
204 | - case '6': | ||
205 | - $error = '找不到临时目录。'; | ||
206 | - break; | ||
207 | - case '7': | ||
208 | - $error = '写文件到硬盘出错。'; | ||
209 | - break; | ||
210 | - case '8': | ||
211 | - $error = 'File upload stopped by extension。'; | ||
212 | - break; | ||
213 | - case '999': | ||
214 | - default: | ||
215 | - $error = '未知错误。'; | ||
216 | - } | ||
217 | - $this->editorAlert($error); | ||
218 | - } | ||
219 | - | ||
220 | - // 确保临时文件夹是否已经创建 | ||
221 | - //if (!file_exists($savePath)) { | ||
222 | - // mkdir($savePath, 0777, true); | ||
223 | - //} | ||
224 | - | ||
225 | - //有上传文件时 | ||
226 | - if (empty($_FILES) === false) { | ||
227 | - //原文件名 | ||
228 | - $fileName = $_FILES['imgFile']['name']; | ||
229 | - //服务器上临时文件名 | ||
230 | - $tmpName = $_FILES['imgFile']['tmp_name']; | ||
231 | - //文件大小 | ||
232 | - $fileSize = $_FILES['imgFile']['size']; | ||
233 | - //检查文件名 | ||
234 | - if (!$fileName) { | ||
235 | - $this->editorAlert("请选择文件。"); | ||
236 | - } | ||
237 | - | ||
238 | - /* | ||
239 | - //检查目录 | ||
240 | - if (@is_dir($savePath) === false) { | ||
241 | - $this->editorAlert("上传目录不存在。"); | ||
242 | - } | ||
243 | - //检查目录写权限 | ||
244 | - if (@is_writable($savePath) === false) { | ||
245 | - $this->editorAlert("上传目录没有写权限。"); | ||
246 | - } | ||
247 | - //检查是否已上传 | ||
248 | - if (@is_uploaded_file($tmpName) === false) { | ||
249 | - $this->editorAlert("上传失败。"); | ||
250 | - } | ||
251 | - */ | ||
252 | - | ||
253 | - //检查文件大小 | ||
254 | - if ($fileSize > $maxSize) { | ||
255 | - $this->editorAlert("图片大小不能超过" . Utils::formatBytes($maxSize)); | ||
256 | - } | ||
257 | - | ||
258 | - //获得文件扩展名 | ||
259 | -// $tempArr = explode(".", $fileName); | ||
260 | -// $fileExt = array_pop($tempArr); | ||
261 | -// $fileExt = trim($fileExt); | ||
262 | -// $fileExt = strtolower($fileExt); | ||
263 | - $tmp = explode('.', $fileName); | ||
264 | - $fileExt = end($tmp); | ||
265 | - | ||
266 | - //检查扩展名 | ||
267 | - if (in_array($fileExt, $extArr) === false) { | ||
268 | - $this->editorAlert("上传文件扩展名是不允许的扩展名。\n只允许" . implode(",", $extArr) . "格式。"); | ||
269 | - } | ||
270 | - | ||
271 | - //新文件名 | ||
272 | - $newFileName = date("YmdHis") . '_' . rand(10000, 99999) . '.' . $fileExt; | ||
273 | - | ||
274 | - $savePath = ImageManager::getTempImgPath($fileExt); | ||
275 | - //移动文件 | ||
276 | - $filePath = $savePath . '/' . $newFileName; | ||
277 | - ImageManager::add($tmpName, $filePath); | ||
278 | - | ||
279 | - $fileUrl = ImageManager::getUrl($filePath); | ||
280 | - | ||
281 | - echo json_encode(array('error' => 0, 'url' => $fileUrl)); | ||
282 | - exit; | ||
283 | - } | ||
284 | } | 186 | } |
285 | 187 | ||
286 | /** | 188 | /** |
@@ -0,0 +1,17 @@ | @@ -0,0 +1,17 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace app\ht\modules; | ||
4 | + | ||
5 | +use yii\base\Module; | ||
6 | + | ||
7 | +/** | ||
8 | + * Class BaseModule | ||
9 | + * @package app\ht\modules | ||
10 | + */ | ||
11 | +class BaseModule extends Module | ||
12 | +{ | ||
13 | + public function init() | ||
14 | + { | ||
15 | + parent::init(); | ||
16 | + } | ||
17 | +} | ||
0 | \ No newline at end of file | 18 | \ No newline at end of file |
@@ -0,0 +1,18 @@ | @@ -0,0 +1,18 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace app\ht\modules\maintainer; | ||
4 | + | ||
5 | +use app\ht\modules\BaseModule; | ||
6 | + | ||
7 | +/** | ||
8 | + * @author ScottShun <838386548@qq.com> | ||
9 | + */ | ||
10 | +class Module extends BaseModule | ||
11 | +{ | ||
12 | + public function init() | ||
13 | + { | ||
14 | + parent::init(); | ||
15 | + | ||
16 | + //$this->params['perm'] = require(__DIR__ . '/config/perm.php'); | ||
17 | + } | ||
18 | +} | ||
0 | \ No newline at end of file | 19 | \ No newline at end of file |
app-ht/modules/maintainer/controllers/UserController.php
0 → 100644
@@ -0,0 +1,123 @@ | @@ -0,0 +1,123 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace app\ht\modules\maintainer\controllers; | ||
4 | + | ||
5 | +use common\helpers\ImageManager; | ||
6 | +use Yii; | ||
7 | +use yii\data\Pagination; | ||
8 | +use app\ht\controllers\BaseController; | ||
9 | + | ||
10 | +use domain\user\UserRepository; | ||
11 | +use stdClass; | ||
12 | +use function strtotime; | ||
13 | + | ||
14 | +/** | ||
15 | + * 维修厂管理 | ||
16 | + */ | ||
17 | +class UserController extends BaseController | ||
18 | +{ | ||
19 | + | ||
20 | + /** | ||
21 | + * @return string | ||
22 | + */ | ||
23 | + public function actionIndex() | ||
24 | + { | ||
25 | + $params = $this->dataList(1); | ||
26 | + /** | ||
27 | + * 渲染模板 | ||
28 | + */ | ||
29 | + return $this->render('index', $params); | ||
30 | + } | ||
31 | + | ||
32 | + /** | ||
33 | + * 查询数据列表 | ||
34 | + */ | ||
35 | + protected function dataList($type = '') | ||
36 | + { | ||
37 | + $request = Yii::$app->request; | ||
38 | + $createTime = $request->get('createTime'); | ||
39 | + $endTime = $request->get('endTime'); | ||
40 | + $mobile = $request->get('mobile'); | ||
41 | + $name = $request->get('name'); | ||
42 | + | ||
43 | + $gets = [ | ||
44 | + 'createTime' => $createTime, | ||
45 | + 'endTime' => $endTime, | ||
46 | + 'mobile' => $mobile, | ||
47 | + 'name' => $name, | ||
48 | + ]; | ||
49 | + | ||
50 | + $where = ['and']; | ||
51 | + if ($createTime) { | ||
52 | + $createTime = strtotime($createTime); | ||
53 | + $where[] = ['>=', 'user.created_at', $createTime]; | ||
54 | + } | ||
55 | + if ($endTime) { | ||
56 | + $endTime = strtotime($endTime) + 86400; | ||
57 | + $where[] = ['<=', 'user.created_at', $endTime]; | ||
58 | + } | ||
59 | + if ($mobile) { | ||
60 | + $where[] = ['like', 'user.mobile', $mobile]; | ||
61 | + } | ||
62 | + if ($name) { | ||
63 | + $where[] = ['like', 'user.name', $name]; | ||
64 | + } | ||
65 | + | ||
66 | + | ||
67 | + if ($type == 0) { | ||
68 | + $pageList = UserRepository::getAdminUserList(0, 0, $where); | ||
69 | + $pages = null; | ||
70 | + } else { | ||
71 | + $pageSize = 20; | ||
72 | + $pages = new Pagination(['totalCount' => UserRepository::getAdminUserListCount($where), 'pageSize' => $pageSize]); | ||
73 | + $pageList = UserRepository::getAdminUserList($pages->offset, $pages->limit, $where); | ||
74 | + } | ||
75 | + | ||
76 | + /** | ||
77 | + * 数据整理 | ||
78 | + */ | ||
79 | + return [ | ||
80 | + 'listdata' => $pageList, | ||
81 | + 'pages' => $pages, | ||
82 | + 'gets' => $gets | ||
83 | + ]; | ||
84 | + } | ||
85 | + /** | ||
86 | + * 导出订单数据 | ||
87 | + * @return string | ||
88 | + */ | ||
89 | + public function actionExportDa() | ||
90 | + { | ||
91 | + $data = $this->dataList(0); | ||
92 | + | ||
93 | + return $this->renderPartial("exportDa", $data); | ||
94 | + } | ||
95 | + | ||
96 | + /** | ||
97 | + * @return string | ||
98 | + */ | ||
99 | + public function actionInfo() | ||
100 | + { | ||
101 | + $id = $this->request->get('id'); | ||
102 | + | ||
103 | + $userModel = UserRepository::findOne(['id' => $id]); | ||
104 | + if (empty($userModel)) { | ||
105 | + $params = []; | ||
106 | + return $this->render('info', $params); | ||
107 | + } | ||
108 | + | ||
109 | + $user = [ | ||
110 | + 'id' => $userModel->id, | ||
111 | + 'uuid' => $userModel->uuid, | ||
112 | + 'mobile' => $userModel->mobile, | ||
113 | + 'username' => $userModel->user_name, | ||
114 | + 'name' => $userModel->name, | ||
115 | + 'licensePic' => ImageManager::getUrl($userModel->license_pic), | ||
116 | + 'licensePicMin' => ImageManager::getUrl($userModel->license_pic, 'min'), | ||
117 | + 'created_at' => $userModel->created_at | ||
118 | + ]; | ||
119 | + $params['user'] = $user; | ||
120 | + | ||
121 | + return $this->render('info', $params); | ||
122 | + } | ||
123 | +} | ||
0 | \ No newline at end of file | 124 | \ No newline at end of file |
@@ -0,0 +1,55 @@ | @@ -0,0 +1,55 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | + header('Content-Type: application/vnd.ms-excel;charset=utf-8'); | ||
4 | + $title = date('Y-m-d') . '_维修厂'; | ||
5 | + $name = $title . ".xls"; | ||
6 | + header('Content-Disposition: attachment;filename=' . $name . ''); | ||
7 | + header('Cache-Control: max-age=0'); | ||
8 | + $fp = fopen('php://output', 'a'); | ||
9 | + $limit = 10000; | ||
10 | + $cnt = 0; | ||
11 | +?> | ||
12 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | ||
13 | + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
14 | +<html xmlns:o="urn:schemas-microsoft-com:office:office" | ||
15 | + xmlns:x="urn:schemas-microsoft-com:office:excel" | ||
16 | + xmlns="http://www.w3.org/TR/REC-html40"> | ||
17 | + | ||
18 | +<head> | ||
19 | + <meta http-equiv=Content-Type content="text/html; charset=utf-8"> | ||
20 | + | ||
21 | +</head> | ||
22 | +<body> | ||
23 | +<div id="Classeur1_16681" align='center' x:publishsource="Excel"> | ||
24 | + <table border='1' cellpadding='0' cellspacing='0' width='100%' style="border-collapse: collapse"> | ||
25 | + <thead> | ||
26 | + <tr> | ||
27 | + <th style="width:60px">ID</th> | ||
28 | + <th style="width:120px">维修厂名称</th> | ||
29 | + <th style="width:100px">维修厂电话</th> | ||
30 | + <th style="width:100px">注册时间</th> | ||
31 | + </tr> | ||
32 | + </thead> | ||
33 | + <tbody> | ||
34 | + <?php foreach ($listdata as $user) : ?> | ||
35 | + <tr> | ||
36 | + <td class="text-center align-middle hqy-row-select"><?=$user['id'] ?></td> | ||
37 | + <td><?=$user['name']?></td> | ||
38 | + <td><?=$user['mobile']?></td> | ||
39 | + <td><?=date('Y-m-d H:i', $user['created_at'])?></td> | ||
40 | + | ||
41 | + </tr> | ||
42 | + <?php | ||
43 | + $cnt++; | ||
44 | + if (1000 == $cnt) { //刷新一下输出buffer,防止由于数据过多造成问题 | ||
45 | + ob_flush(); | ||
46 | + flush(); | ||
47 | + $cnt = 0; | ||
48 | + } | ||
49 | + ?> | ||
50 | + <?php endforeach; ?> | ||
51 | + </tbody> | ||
52 | + </table> | ||
53 | +</div> | ||
54 | +</body> | ||
55 | +</html> | ||
0 | \ No newline at end of file | 56 | \ No newline at end of file |
@@ -0,0 +1,123 @@ | @@ -0,0 +1,123 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Url; | ||
4 | +use app\ht\widgets\LinkPager; | ||
5 | +use domain\order\RepairOrderRate; | ||
6 | + | ||
7 | +$this->title = '维修厂列表'; | ||
8 | +$this->params['breadcrumbs'][] = '维修厂管理'; | ||
9 | +$this->params['breadcrumbs'][] = $this->title; | ||
10 | + | ||
11 | +?> | ||
12 | + | ||
13 | +<style> | ||
14 | + .btncls{margin:0 10px!important;} | ||
15 | + .combo-select{margin-bottom: 0; width: 100%; text-align: left} | ||
16 | +</style> | ||
17 | +<div class="panel panel-default"> | ||
18 | + <div class="panel-body" style="overflow-y: auto"> | ||
19 | + <form action="" method="get" id="search-form" class="filter-form"> | ||
20 | + <table width="100%" class="table table-bordered"> | ||
21 | + <tbody> | ||
22 | + <tr > | ||
23 | + <td width="10%" class="text-right">维修厂名称:</td> | ||
24 | + <td width="10%" class="text-left"><input type="text" class="form-control" name="name" id="name" value="<?php if (!empty($gets['name'])){ echo $gets['name']; } ?>"></td> | ||
25 | + | ||
26 | + <td width="10%" class="text-right">维修厂电话:</td> | ||
27 | + <td width="10%" class="text-left"><input type="text" class="form-control" name="mobile" id="mobile" value="<?php if (!empty($gets['mobile'])){ echo $gets['mobile']; } ?>"></td> | ||
28 | + | ||
29 | + | ||
30 | + <td width="10%" class="text-right">注册时间(起):</td> | ||
31 | + <td width="10%" class="text-left"><input type="date" class="form-control" name="createTime" id="createTime" value="<?php if (!empty($gets['createTime'])){ echo $gets['createTime']; } ?>"></td> | ||
32 | + | ||
33 | + <td width="10%" class="text-right">注册时间(止):</td> | ||
34 | + <td width="10%" class="text-left"><input type="date" class="form-control" name="endTime" id="endTime" value="<?php if (!empty($gets['endTime'])){ echo $gets['endTime']; } ?>"></td> | ||
35 | + </tr> | ||
36 | + | ||
37 | + <tr class="search"> | ||
38 | + <td colspan="8" class="text-center"> | ||
39 | + <button type="submit" class="btn btn-primary btncls" id="search"><i class="glyphicon glyphicon-search"></i> 查 询 </button> | ||
40 | + <a class="btn btn-default btncls" href="<?=Url::toRoute(["/maintainer/user/index"])?>">重 置</a> | ||
41 | + <a class="btn btn-success btncls" id="exportBtn" href="javascript:void(0)">导出维修厂名单</a> | ||
42 | + | ||
43 | + </td> | ||
44 | + </tr> | ||
45 | + </tbody> | ||
46 | + </table> | ||
47 | + </form> | ||
48 | + </div> | ||
49 | +</div> | ||
50 | + | ||
51 | +<div class="panel panel-default"> | ||
52 | + <div class="panel-body"> | ||
53 | + | ||
54 | + <div style="overflow-y: auto"> | ||
55 | + <?php if (!empty($listdata)) : ?> | ||
56 | + <table class="table table-striped table-bordered" id="brand-table"> | ||
57 | + <thead> | ||
58 | + <tr> | ||
59 | + <th style="width:4%;">ID</th> | ||
60 | + <th style="width:10%;">维修厂名称</th> | ||
61 | + <th style="width:10%;">维修厂电话</th> | ||
62 | + <th style="width:10%;">注册时间</th> | ||
63 | + | ||
64 | + <th style="width:7%;">操作</th> | ||
65 | + </tr> | ||
66 | + </thead> | ||
67 | + <tbody> | ||
68 | + <?php foreach ($listdata as $user) : ?> | ||
69 | + <tr> | ||
70 | + <td class="hqy-row-select"><?=$user['id'] ?></td> | ||
71 | + <td><?=$user['name']?></td> | ||
72 | + <td><?=$user['mobile']?></td> | ||
73 | + <td><?=date('Y-m-d H:i', $user['created_at'])?></td> | ||
74 | + | ||
75 | + <td > | ||
76 | + <a class="btn btn-primary" style="margin: 4px;" href="<?php echo Url::toRoute(['/maintainer/user/info', 'id' => $user['id']]) ?>">查看详情</a> | ||
77 | + | ||
78 | + </td> | ||
79 | + </tr> | ||
80 | + <?php endforeach; ?> | ||
81 | + </tbody> | ||
82 | + </table> | ||
83 | + </div> | ||
84 | + <?php else : ?> | ||
85 | + <p class="text-center"> | ||
86 | + 没有找到数据 | ||
87 | + </p> | ||
88 | + <?php endif; ?> | ||
89 | + </div> | ||
90 | + | ||
91 | + <div class="panel-footer"> | ||
92 | + <div class="hqy-panel-pager"> | ||
93 | + <?= LinkPager::widget([ | ||
94 | + 'pagination' => $pages, | ||
95 | + ]); ?> | ||
96 | + <div class="clearfix"></div> | ||
97 | + </div> | ||
98 | + </div> | ||
99 | +</div> | ||
100 | + | ||
101 | +<script> | ||
102 | + | ||
103 | + $(function(){ | ||
104 | + | ||
105 | + var getUrl ='<?=Url::toRoute("/maintainer/user/export-da")?>'; | ||
106 | + var filterUrl ='<?=Url::toRoute("/maintainer/user/index")?>'; | ||
107 | + $(function(){ | ||
108 | + $('#exportBtn').click(function(e){ | ||
109 | + $('#search-form').attr('action',getUrl); | ||
110 | + $('#search-form').submit(); | ||
111 | + return false; | ||
112 | + }) | ||
113 | + // | ||
114 | + $('#search').click(function(e){ | ||
115 | + $('#search-form').attr('action',filterUrl); | ||
116 | + $('#search-form').submit(); | ||
117 | + return false; | ||
118 | + }) | ||
119 | + }) | ||
120 | + | ||
121 | + | ||
122 | + }) | ||
123 | +</script> | ||
0 | \ No newline at end of file | 124 | \ No newline at end of file |
@@ -0,0 +1,54 @@ | @@ -0,0 +1,54 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Url; | ||
4 | +$this->title = '维修厂详情'; | ||
5 | +$this->params['breadcrumbs'][] = '维修厂管理'; | ||
6 | +$this->params['breadcrumbs'][] = ['label' => '维修厂列表', 'url' => ['/maintainer/user/index']]; | ||
7 | +$this->params['breadcrumbs'][] = $this->title; | ||
8 | + | ||
9 | + | ||
10 | +?> | ||
11 | +<style> | ||
12 | + .imgs-class{margin:0;padding:0;list-style: none} | ||
13 | + .imgs-class li{margin:0;padding:0;width:150px;list-style: none;float:left;padding-right:1rem;box-sizing: border-box} | ||
14 | + .imgs-class li img{width:100%;} | ||
15 | + textarea {border-radius: 4px;} | ||
16 | + | ||
17 | +</style> | ||
18 | +<div class="panel panel-default"> | ||
19 | + <div id="warning"></div> | ||
20 | + | ||
21 | + <input type="hidden" value="<?=$user['uuid'] ?>" name="uuid" id="uuid" > | ||
22 | + | ||
23 | + <div class="panel-body"> | ||
24 | + <table class="table table-bordered"> | ||
25 | + <tr> | ||
26 | + <td colspan="4" class="bg-info">维修厂信息</td> | ||
27 | + </tr> | ||
28 | + <tr> | ||
29 | + <th width="100">维修厂ID</th> | ||
30 | + <td width="350"><?=$user['id']; ?></td> | ||
31 | + | ||
32 | + <th width="100">维修厂名称</th> | ||
33 | + <td ><?=$user['name']; ?></td> | ||
34 | + </tr> | ||
35 | + <tr> | ||
36 | + <th>维修厂电话</th> | ||
37 | + <td><?=$user['mobile']; ?></td> | ||
38 | + | ||
39 | + <th>注册时间</th> | ||
40 | + <td><?=date('Y-m-d H:i:s', $user['created_at']); ?></td> | ||
41 | + </tr> | ||
42 | + | ||
43 | + <tr> | ||
44 | + <th>营业执照</th> | ||
45 | + <td><a target="_blank" href="<?=$user['licensePic']; ?>"><img width="150" src='<?=$user["licensePicMin"]?>' /></a></td> | ||
46 | + | ||
47 | + <th></th> | ||
48 | + <td></td> | ||
49 | + </tr> | ||
50 | + </table> | ||
51 | + </div> | ||
52 | + | ||
53 | + | ||
54 | +</div> |
@@ -0,0 +1,17 @@ | @@ -0,0 +1,17 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace app\ht\modules; | ||
4 | + | ||
5 | +use yii\base\Module; | ||
6 | + | ||
7 | +/** | ||
8 | + * Class BaseModule | ||
9 | + * @package app\ht\modules | ||
10 | + */ | ||
11 | +class BaseModule extends Module | ||
12 | +{ | ||
13 | + public function init() | ||
14 | + { | ||
15 | + parent::init(); | ||
16 | + } | ||
17 | +} | ||
0 | \ No newline at end of file | 18 | \ No newline at end of file |
@@ -0,0 +1,18 @@ | @@ -0,0 +1,18 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace app\ht\modules\order; | ||
4 | + | ||
5 | +use app\ht\modules\BaseModule; | ||
6 | + | ||
7 | +/** | ||
8 | + * @author ScottShun <838386548@qq.com> | ||
9 | + */ | ||
10 | +class Module extends BaseModule | ||
11 | +{ | ||
12 | + public function init() | ||
13 | + { | ||
14 | + parent::init(); | ||
15 | + | ||
16 | + //$this->params['perm'] = require(__DIR__ . '/config/perm.php'); | ||
17 | + } | ||
18 | +} | ||
0 | \ No newline at end of file | 19 | \ No newline at end of file |
app-ht/modules/order/controllers/RepairOrderController.php
0 → 100644
@@ -0,0 +1,178 @@ | @@ -0,0 +1,178 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace app\ht\modules\order\controllers; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use yii\data\Pagination; | ||
7 | +use app\ht\controllers\BaseController; | ||
8 | +use domain\order\RepairOrderRepository; | ||
9 | +use common\helpers\ImageManager; | ||
10 | +use domain\order\RepairOrderRate; | ||
11 | +use domain\order\RepairOrderRateRepository; | ||
12 | +use domain\order\RepairOrderStatus; | ||
13 | +use domain\user\UserRepository; | ||
14 | +use stdClass; | ||
15 | +use function strtotime; | ||
16 | + | ||
17 | +/** | ||
18 | + * 订单管理 | ||
19 | + */ | ||
20 | +class RepairOrderController extends BaseController | ||
21 | +{ | ||
22 | + | ||
23 | + /** | ||
24 | + * @return string | ||
25 | + */ | ||
26 | + public function actionIndex() | ||
27 | + { | ||
28 | + $params = $this->dataList(1); | ||
29 | + /** | ||
30 | + * 渲染模板 | ||
31 | + */ | ||
32 | + return $this->render('index', $params); | ||
33 | + } | ||
34 | + | ||
35 | + /** | ||
36 | + * 查询数据列表 | ||
37 | + */ | ||
38 | + protected function dataList($type = '') | ||
39 | + { | ||
40 | + $request = Yii::$app->request; | ||
41 | + $createTime = $request->get('createTime'); | ||
42 | + $endTime = $request->get('endTime'); | ||
43 | + $contactMobile = $request->get('contactMobile'); | ||
44 | + $customer = $request->get('customer'); | ||
45 | + $carNo = $request->get('carNo'); | ||
46 | + $maintainerMobile = $request->get('maintainerMobile'); | ||
47 | + $status = $request->get('status'); | ||
48 | + | ||
49 | + $gets = [ | ||
50 | + 'createTime' => $createTime, | ||
51 | + 'endTime' => $endTime, | ||
52 | + 'contactMobile' => $contactMobile, | ||
53 | + 'customer' => $customer, | ||
54 | + 'carNo' => $carNo, | ||
55 | + 'maintainerMobile' => $maintainerMobile, | ||
56 | + 'status' => $status, | ||
57 | + 'statusList' => RepairOrderStatus::getLabels() | ||
58 | + ]; | ||
59 | + | ||
60 | + $where = ['and']; | ||
61 | + if ($createTime) { | ||
62 | + $createTime = strtotime($createTime); | ||
63 | + $where[] = ['>=', 'ord.created_at', $createTime]; | ||
64 | + } | ||
65 | + if ($endTime) { | ||
66 | + $endTime = strtotime($endTime) + 86400; | ||
67 | + $where[] = ['<=', 'ord.created_at', $endTime]; | ||
68 | + } | ||
69 | + if ($contactMobile) { | ||
70 | + $where[] = ['like', 'ord.contact_mobile', $contactMobile]; | ||
71 | + } | ||
72 | + if ($customer) { | ||
73 | + $where[] = ['like', 'ord.customer', $customer]; | ||
74 | + } | ||
75 | + if ($carNo) { | ||
76 | + $where[] = ['like', 'ord.car_no', $carNo]; | ||
77 | + } | ||
78 | + if ($maintainerMobile) { | ||
79 | + $where[] = ['like', 'u.mobile', $maintainerMobile]; | ||
80 | + } | ||
81 | + if ($status) { | ||
82 | + $where[] = ['=', 'ord.status', $status]; | ||
83 | + } | ||
84 | + if ($type == 0) { | ||
85 | + $pageList = RepairOrderRepository::getAdminOrderList(0, 0, $where); | ||
86 | + $pages = null; | ||
87 | + } else { | ||
88 | + $pageSize = 20; | ||
89 | + $pages = new Pagination(['totalCount' => RepairOrderRepository::getAdminOrderListCount($where), 'pageSize' => $pageSize]); | ||
90 | + $pageList = RepairOrderRepository::getAdminOrderList($pages->offset, $pages->limit, $where); | ||
91 | + } | ||
92 | + | ||
93 | + /** | ||
94 | + * 数据整理 | ||
95 | + */ | ||
96 | + return [ | ||
97 | + 'listdata' => $pageList, | ||
98 | + 'pages' => $pages, | ||
99 | + 'gets' => $gets | ||
100 | + ]; | ||
101 | + } | ||
102 | + /** | ||
103 | + * 导出订单数据 | ||
104 | + * @return string | ||
105 | + */ | ||
106 | + public function actionExportDa() | ||
107 | + { | ||
108 | + $data = $this->dataList(0); | ||
109 | + | ||
110 | + return $this->renderPartial("exportDa", $data); | ||
111 | + } | ||
112 | + | ||
113 | + /** | ||
114 | + * @return string | ||
115 | + */ | ||
116 | + public function actionInfo() | ||
117 | + { | ||
118 | + $id = $this->request->get('id'); | ||
119 | + | ||
120 | + $orderModel = RepairOrderRepository::findOne(['id' => $id]); | ||
121 | + if (empty($orderModel)) { | ||
122 | + $params = []; | ||
123 | + return $this->render('info', $params); | ||
124 | + } | ||
125 | + $orderId = $orderModel->id; | ||
126 | + $brokenImageModels = RepairOrderRepository::findOrderImageAll(['repair_order_id' => $orderId]); | ||
127 | + $brokenImages = []; | ||
128 | + | ||
129 | + foreach($brokenImageModels as $k => $v) { | ||
130 | + $brokenImages[] = ImageManager::getUrl($v->image_path); | ||
131 | + } | ||
132 | + $totalPrice = $orderModel->order_price; | ||
133 | + $rPlans = RepairOrderRepository::findOrderPlansAll(['repair_order_id' => $orderId]); | ||
134 | + $repairPlans = []; | ||
135 | + foreach($rPlans as $k => $plan) { | ||
136 | + $repairPlans[] = ['plan' => $plan['repair_plan'] ,'price' => $plan['price']]; | ||
137 | + } | ||
138 | + $fImages = RepairOrderRepository::findOrderFinishImageAll(['repair_order_id' => $orderId]); | ||
139 | + $finishImages = []; | ||
140 | + foreach($fImages as $k => $image) { | ||
141 | + $finishImages[] = ImageManager::getUrl($image['image_path']);; | ||
142 | + } | ||
143 | + $hasComment = false; | ||
144 | + $comments = []; | ||
145 | + $rateModel = RepairOrderRateRepository::findOne(['repair_order_id' => $orderId]); | ||
146 | + if ($rateModel) { | ||
147 | + $hasComment = true; | ||
148 | + $comments = ['starTxt' => RepairOrderRate::starLabel($rateModel->star_count), 'comment' => $rateModel->comment]; | ||
149 | + } | ||
150 | + $user = UserRepository::findOne(['id' => $orderModel->user_id]); | ||
151 | + $order = [ | ||
152 | + 'id' => $orderId, | ||
153 | + 'uuid' => $orderModel->uuid, | ||
154 | + 'userId' => $orderModel->user_id, | ||
155 | + 'userName' => $user->name, | ||
156 | + 'userMobile' => $user->mobile, | ||
157 | + 'carNo' => $orderModel->car_no, | ||
158 | + 'carModel' => $orderModel->car_model, | ||
159 | + 'customer' => $orderModel->customer, | ||
160 | + 'contact_mobile'=> $orderModel->contact_mobile, | ||
161 | + 'preRepair' => $orderModel->predict_fault, | ||
162 | + 'prePrice' => $orderModel->predict_price.'元', | ||
163 | + 'preFinishDate' => $orderModel->predict_finish_time? date('Y-m-d H:00', $orderModel->predict_finish_time):'暂无', | ||
164 | + 'orderDateTime' => date('Y-m-d H:00', $orderModel->created_at), | ||
165 | + 'finishDateTime'=> $orderModel->finish_at? date('Y-m-d H:00', $orderModel->finish_at):'暂无', | ||
166 | + 'status' => RepairOrderStatus::getLabels($orderModel->status), | ||
167 | + 'hasComment' => $hasComment, | ||
168 | + 'comments' => $comments, | ||
169 | + 'brokenImages' => $brokenImages, | ||
170 | + 'repairPlans' => $repairPlans, | ||
171 | + 'totalPrice' => $totalPrice, | ||
172 | + 'finishImages' => $finishImages | ||
173 | + ]; | ||
174 | + $params['order'] = $order; | ||
175 | + | ||
176 | + return $this->render('info', $params); | ||
177 | + } | ||
178 | +} | ||
0 | \ No newline at end of file | 179 | \ No newline at end of file |
@@ -0,0 +1,113 @@ | @@ -0,0 +1,113 @@ | ||
1 | +<?php | ||
2 | +use domain\order\RepairOrderRate; | ||
3 | + header('Content-Type: application/vnd.ms-excel;charset=utf-8'); | ||
4 | + $title = date('Y-m-d') . '_维修单'; | ||
5 | + $name = $title . ".xls"; | ||
6 | + header('Content-Disposition: attachment;filename=' . $name . ''); | ||
7 | + header('Cache-Control: max-age=0'); | ||
8 | + $fp = fopen('php://output', 'a'); | ||
9 | + $limit = 10000; | ||
10 | + $cnt = 0; | ||
11 | +?> | ||
12 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | ||
13 | + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
14 | +<html xmlns:o="urn:schemas-microsoft-com:office:office" | ||
15 | + xmlns:x="urn:schemas-microsoft-com:office:excel" | ||
16 | + xmlns="http://www.w3.org/TR/REC-html40"> | ||
17 | + | ||
18 | +<head> | ||
19 | + <meta http-equiv=Content-Type content="text/html; charset=utf-8"> | ||
20 | + | ||
21 | +</head> | ||
22 | +<body> | ||
23 | +<div id="Classeur1_16681" align='center' x:publishsource="Excel"> | ||
24 | + <table border='1' cellpadding='0' cellspacing='0' width='100%' style="border-collapse: collapse"> | ||
25 | + <thead> | ||
26 | + <tr> | ||
27 | + <th style="width:60px;">维修单ID</th> | ||
28 | + <th style="width:70px;">车牌号</th> | ||
29 | + <th style="width:70px;">车型号</th> | ||
30 | + <th style="width:70px">顾客名</th> | ||
31 | + <th style="width:90px">顾客手机</th> | ||
32 | + <th style="width:80px">预修故障</th> | ||
33 | + <th style="width:80px">预修金额</th> | ||
34 | + <th style="width:80px">预完成维修时间</th> | ||
35 | + <th style="width:90px">报修时间</th> | ||
36 | + <th style="width:90px">维修金额</th> | ||
37 | + <th style="width:90px">订单状态</th> | ||
38 | + <th style="width:120px">维修厂名</th> | ||
39 | + <th style="width:90px">维修厂电话</th> | ||
40 | + <th style="width:60px">顾客星评</th> | ||
41 | + <th style="width:80px">顾客评论</th> | ||
42 | + </tr> | ||
43 | + </thead> | ||
44 | + <tbody> | ||
45 | + <?php foreach ($listdata as $order) : ?> | ||
46 | + <tr> | ||
47 | + <td class="text-center align-middle"><?=$order['id'] ?></td> | ||
48 | + <td><?=$order['car_no']?></td> | ||
49 | + <td><?=$order['car_model']?></td> | ||
50 | + <td><?=$order['customer']?></td> | ||
51 | + <td><?=$order['contact_mobile']?></td> | ||
52 | + <td><?php | ||
53 | + if ($order['predict_fault']) { | ||
54 | + echo $order['predict_fault']; | ||
55 | + } else { | ||
56 | + echo "-"; | ||
57 | + } | ||
58 | + ?> | ||
59 | + </td><td> | ||
60 | + <?php | ||
61 | + if ($order['predict_price']) { | ||
62 | + echo $order['predict_price']; | ||
63 | + } else { | ||
64 | + echo "-"; | ||
65 | + } | ||
66 | + ?> | ||
67 | + </td><td> | ||
68 | + <?php | ||
69 | + if ($order['predict_finish_time']) { | ||
70 | + echo date('Y年m月d日 H时',$order['predict_finish_time']) ; | ||
71 | + } else { | ||
72 | + echo "-"; | ||
73 | + } | ||
74 | + ?> | ||
75 | + </td> | ||
76 | + <td><?=date('Y-m-d H:i', $order['created_at'])?></td> | ||
77 | + <td><?= $order['order_price']?$order['order_price']:'-'?></td> | ||
78 | + <td><?= $gets['statusList'][$order['status']]?></td> | ||
79 | + <td><?= $order['maintainer']?></td> | ||
80 | + <td><?= $order['maintainer_mobile']?></td> | ||
81 | + <td><?php | ||
82 | + if ($order['star_count']) { | ||
83 | + echo RepairOrderRate::starLabel($order['star_count']); | ||
84 | + } else { | ||
85 | + echo "-"; | ||
86 | + } | ||
87 | + ?> | ||
88 | + </td> | ||
89 | + <td> | ||
90 | + <?php | ||
91 | + if ($order['comment']) { | ||
92 | + echo $order['comment']; | ||
93 | + } else { | ||
94 | + echo "-"; | ||
95 | + } | ||
96 | + ?> | ||
97 | + </td> | ||
98 | + | ||
99 | + </tr> | ||
100 | + <?php | ||
101 | + $cnt++; | ||
102 | + if (1000 == $cnt) { //刷新一下输出buffer,防止由于数据过多造成问题 | ||
103 | + ob_flush(); | ||
104 | + flush(); | ||
105 | + $cnt = 0; | ||
106 | + } | ||
107 | + ?> | ||
108 | + <?php endforeach; ?> | ||
109 | + </tbody> | ||
110 | + </table> | ||
111 | +</div> | ||
112 | +</body> | ||
113 | +</html> | ||
0 | \ No newline at end of file | 114 | \ No newline at end of file |
@@ -0,0 +1,164 @@ | @@ -0,0 +1,164 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Url; | ||
4 | +use app\ht\widgets\LinkPager; | ||
5 | +use domain\order\RepairOrderRate; | ||
6 | + | ||
7 | +$this->title = '订单列表'; | ||
8 | +$this->params['breadcrumbs'][] = '平台订单管理'; | ||
9 | +$this->params['breadcrumbs'][] = $this->title; | ||
10 | + | ||
11 | +?> | ||
12 | + | ||
13 | +<style> | ||
14 | + .btncls{margin:0 10px!important;} | ||
15 | + .combo-select{margin-bottom: 0; width: 100%; text-align: left} | ||
16 | +</style> | ||
17 | +<div class="panel panel-default"> | ||
18 | + <div class="panel-body" style="overflow-y: auto"> | ||
19 | + <form action="" method="get" id="search-form" class="filter-form"> | ||
20 | + <table width="100%" class="table table-bordered"> | ||
21 | + <tbody> | ||
22 | + <tr > | ||
23 | + <td width="10%" class="text-right">维修厂手机:</td> | ||
24 | + <td width="10%" class="text-left"><input type="text" class="form-control" name="maintainerMobile" id="maintainerMobile" value="<?php if (!empty($gets['maintainerMobile'])){ echo $gets['maintainerMobile']; } ?>"></td> | ||
25 | + <td width="10%" class="text-right">下单时间(起):</td> | ||
26 | + <td width="20%" class="text-left"><input type="date" class="form-control" name="createTime" id="createTime" value="<?php if (!empty($gets['createTime'])){ echo $gets['createTime']; } ?>"></td> | ||
27 | + <td width="10%" class="text-right">下单时间(止):</td> | ||
28 | + <td width="20%" class="text-left"><input type="date" class="form-control" name="endTime" id="endTime" value="<?php if (!empty($gets['endTime'])){ echo $gets['endTime']; } ?>"></td> | ||
29 | + </tr> | ||
30 | + <tr > | ||
31 | + <td class="text-right">客户姓名:</td> | ||
32 | + <td class="text-left"><input type="text" class="form-control" name="customer" id="customer" value="<?php if (!empty($gets['customer'])){ echo $gets['customer']; } ?>"></td> | ||
33 | + <td class="text-right">客户电话:</td> | ||
34 | + <td class="text-left"><input type="text" class="form-control" name="contactMobile" id="contactMobile" value="<?php if (!empty($gets['contactMobile'])){ echo $gets['contactMobile']; } ?>"></td> | ||
35 | + <td class="text-right">车牌号:</td> | ||
36 | + <td class="text-left"><input type="text" class="form-control" name="carNo" id="carNo" value="<?php if (!empty($gets['carNo'])){ echo $gets['carNo']; } ?>"></td> | ||
37 | + </tr> | ||
38 | + | ||
39 | + <tr class="search"> | ||
40 | + <td colspan="6" class="text-center"> | ||
41 | + <button type="submit" class="btn btn-primary btncls" id="search"><i class="glyphicon glyphicon-search"></i> 查 询 </button> | ||
42 | + <a class="btn btn-default btncls" href="<?=Url::toRoute(["/order/repair-order/index"])?>">重 置</a> | ||
43 | + <a class="btn btn-success btncls" id="exportBtn" href="javascript:void(0)">导出订单报表</a> | ||
44 | + | ||
45 | + </td> | ||
46 | + </tr> | ||
47 | + </tbody> | ||
48 | + </table> | ||
49 | + </form> | ||
50 | + </div> | ||
51 | +</div> | ||
52 | + | ||
53 | +<div class="panel panel-default"> | ||
54 | + <div class="panel-body"> | ||
55 | + | ||
56 | + <div style="overflow-y: auto"> | ||
57 | + <?php if (!empty($listdata)) : ?> | ||
58 | + <table class="table table-striped table-bordered" id="brand-table"> | ||
59 | + <thead> | ||
60 | + <tr> | ||
61 | + <th style="width:4%;">维修单ID</th> | ||
62 | + <th style="width:6%;">车牌号</th> | ||
63 | + <th style="width:7%;">车型号</th> | ||
64 | + <th style="width:6%;">顾客名</th> | ||
65 | + <th style="width:6%;">顾客手机</th> | ||
66 | + <th style="width:8%;">预修信息</th> | ||
67 | + <th style="width:7%;">报修时间</th> | ||
68 | + <th style="width:5%;">维修金额</th> | ||
69 | + <th style="width:6%;">订单状态</th> | ||
70 | + <th style="width:8%;">维修厂名</th> | ||
71 | + <th style="width:7%;">维修厂电话</th> | ||
72 | + <th style="width:8%;">顾客评论</th> | ||
73 | + <th style="width:7%;">操作</th> | ||
74 | + </tr> | ||
75 | + </thead> | ||
76 | + <tbody> | ||
77 | + <?php foreach ($listdata as $order) : ?> | ||
78 | + <tr> | ||
79 | + <td class="text-center align-middle hqy-row-select"><?=$order['id'] ?></td> | ||
80 | + <td><?=$order['car_no']?></td> | ||
81 | + <td><?=$order['car_model']?></td> | ||
82 | + <td><?=$order['customer']?></td> | ||
83 | + <td><?=$order['contact_mobile']?></td> | ||
84 | + <td><?php | ||
85 | + if ($order['predict_fault']) { | ||
86 | + echo "预维故障:".$order['predict_fault']."<br/>"; | ||
87 | + } else { | ||
88 | + echo "预维故障:未填<br/>"; | ||
89 | + } | ||
90 | + if ($order['predict_price']) { | ||
91 | + echo "预维修金额:".$order['predict_price']."<br/>"; | ||
92 | + } else { | ||
93 | + echo "预维修金额:未填<br/>"; | ||
94 | + } | ||
95 | + if ($order['predict_finish_time']) { | ||
96 | + echo "预修完成日期:". date('Y年m月d日 H时',$order['predict_finish_time'])."<br/>"; | ||
97 | + } else { | ||
98 | + echo "预修完成日期:未填<br/>"; | ||
99 | + } | ||
100 | + ?></td> | ||
101 | + <td><?=date('Y-m-d H:i', $order['created_at'])?></td> | ||
102 | + <td><?= $order['order_price']?$order['order_price']:'未录入'?></td> | ||
103 | + <td><?= $gets['statusList'][$order['status']]?></td> | ||
104 | + <td><?= $order['maintainer']?></td> | ||
105 | + <td><?= $order['maintainer_mobile']?></td> | ||
106 | + <td><?php | ||
107 | + if ($order['star_count']) { | ||
108 | + echo "综合:".RepairOrderRate::starLabel($order['star_count'])."<br>"; | ||
109 | + } else { | ||
110 | + echo "车主暂未评价"; | ||
111 | + } | ||
112 | + if ($order['comment']) { | ||
113 | + echo '内容:'.$order['comment']; | ||
114 | + } | ||
115 | + ?></td> | ||
116 | + <td > | ||
117 | + <a class="btn btn-primary" style="margin: 4px;" href="<?php echo Url::toRoute(['/order/repair-order/info', 'id' => $order['id']]) ?>">查看详情</a> | ||
118 | + | ||
119 | + </td> | ||
120 | + </tr> | ||
121 | + <?php endforeach; ?> | ||
122 | + </tbody> | ||
123 | + </table> | ||
124 | + </div> | ||
125 | + <?php else : ?> | ||
126 | + <p class="text-center"> | ||
127 | + 没有找到数据 | ||
128 | + </p> | ||
129 | + <?php endif; ?> | ||
130 | + </div> | ||
131 | + | ||
132 | + <div class="panel-footer"> | ||
133 | + <div class="hqy-panel-pager"> | ||
134 | + <?= LinkPager::widget([ | ||
135 | + 'pagination' => $pages, | ||
136 | + ]); ?> | ||
137 | + <div class="clearfix"></div> | ||
138 | + </div> | ||
139 | + </div> | ||
140 | +</div> | ||
141 | + | ||
142 | +<script> | ||
143 | + | ||
144 | + $(function(){ | ||
145 | + | ||
146 | + var getUrl ='<?=Url::toRoute("/order/repair-order/export-da")?>'; | ||
147 | + var filterUrl ='<?=Url::toRoute("/order/repair-order/index")?>'; | ||
148 | + $(function(){ | ||
149 | + $('#exportBtn').click(function(e){ | ||
150 | + $('#search-form').attr('action',getUrl); | ||
151 | + $('#search-form').submit(); | ||
152 | + return false; | ||
153 | + }) | ||
154 | + // | ||
155 | + $('#search').click(function(e){ | ||
156 | + $('#search-form').attr('action',filterUrl); | ||
157 | + $('#search-form').submit(); | ||
158 | + return false; | ||
159 | + }) | ||
160 | + }) | ||
161 | + | ||
162 | + | ||
163 | + }) | ||
164 | +</script> | ||
0 | \ No newline at end of file | 165 | \ No newline at end of file |
@@ -0,0 +1,154 @@ | @@ -0,0 +1,154 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Url; | ||
4 | + | ||
5 | + | ||
6 | +$this->title = '维修单详情'; | ||
7 | +$this->params['breadcrumbs'][] = '维修单管理'; | ||
8 | +$this->params['breadcrumbs'][] = ['label' => '维修单列表', 'url' => ['/order/repair-order/index']]; | ||
9 | +$this->params['breadcrumbs'][] = $this->title; | ||
10 | + | ||
11 | + | ||
12 | +?> | ||
13 | +<style> | ||
14 | + .imgs-class{margin:0;padding:0;list-style: none} | ||
15 | + .imgs-class li{margin:0;padding:0;width:150px;list-style: none;float:left;padding-right:1rem;box-sizing: border-box} | ||
16 | + .imgs-class li img{width:100%;} | ||
17 | + textarea {border-radius: 4px;} | ||
18 | + | ||
19 | +</style> | ||
20 | +<div class="panel panel-default"> | ||
21 | + <div id="warning"></div> | ||
22 | + <input type="hidden" value="<?=$order['id'] ?>" name="order_id" id="order_id" > | ||
23 | + <input type="hidden" value="<?=$order['uuid'] ?>" name="order_uuid" id="order_uuid" > | ||
24 | + <input type="hidden" value="<?=$order['userId'] ?>" name="userId" id="userId" > | ||
25 | + <div class="panel-body"> | ||
26 | + <table class="table table-bordered"> | ||
27 | + <tr> | ||
28 | + <td colspan="8" class="bg-info">订单信息</td> | ||
29 | + </tr> | ||
30 | + <tr> | ||
31 | + <th width="110">维修单ID</th> | ||
32 | + <td width="250"><?=$order['id']; ?></td> | ||
33 | + | ||
34 | + <th width="110">订单状态</th> | ||
35 | + <td width="200"><?=$order['status']; ?></td> | ||
36 | + | ||
37 | + <th width="110">下单时间</th> | ||
38 | + <td width="220" ><?=$order['orderDateTime']; ?></td> | ||
39 | + | ||
40 | + <th width="110">维修完成时间</th> | ||
41 | + <td><?=$order['finishDateTime']; ?> | ||
42 | + </tr> | ||
43 | + <tr> | ||
44 | + <th>车牌号</th> | ||
45 | + <td><?=$order['carNo']?></td> | ||
46 | + | ||
47 | + <th>车型</th> | ||
48 | + <td><?=$order['carModel']?></td> | ||
49 | + | ||
50 | + <th>车主名称</th> | ||
51 | + <td><?=$order['customer']?></td> | ||
52 | + | ||
53 | + <th>车主电话</th> | ||
54 | + <td><?=$order['contact_mobile']?></td> | ||
55 | + </tr> | ||
56 | + <tr> | ||
57 | + <th>预修故障</th> | ||
58 | + <td> <?=$order['preRepair']?></td> | ||
59 | + <th>预修金额</th> | ||
60 | + <td> <?=$order['prePrice']?></td> | ||
61 | + <th>预修完成时间</th> | ||
62 | + <td><?=$order['preFinishDate']; ?></td> | ||
63 | + <th></th> | ||
64 | + <td></td> | ||
65 | + </tr> | ||
66 | + <tr> | ||
67 | + <th>维修厂名</th> | ||
68 | + <td> <?=$order['userName']?></td> | ||
69 | + <th>维修厂电话</th> | ||
70 | + <td> <?=$order['userMobile']?></td> | ||
71 | + <th>车主评星</th> | ||
72 | + <td><?=isset($order['comments']['starTxt'])?$order['comments']['starTxt']:'暂无'?></td> | ||
73 | + <th>车主评论内容</th> | ||
74 | + <td><?=isset($order['comments']['comment'])?$order['comments']['comment']:'暂无'?></td> | ||
75 | + </tr> | ||
76 | + <tr> | ||
77 | + <th>车损图片</th> | ||
78 | + <td colspan="7"> | ||
79 | + <?php | ||
80 | + if($order['brokenImages']) { | ||
81 | + echo "<ul class='imgs-class'>"; | ||
82 | + foreach ($order['brokenImages'] as $k => $image) { | ||
83 | + echo "<li class='img-li'><a href='{$image}' target='_black'><img src='{$image}' /></a></li>"; | ||
84 | + } | ||
85 | + echo "</ul>"; | ||
86 | + } else { | ||
87 | + echo "暂无图片"; | ||
88 | + } | ||
89 | + ?> | ||
90 | + </td> | ||
91 | + </tr> | ||
92 | + </table> | ||
93 | + </div> | ||
94 | + | ||
95 | + | ||
96 | + <div class="panel-body"> | ||
97 | + <table class="table table-bordered text-center"> | ||
98 | + <tr> | ||
99 | + <td colspan="2" class="bg-info text-left">维修故障明细</td> | ||
100 | + </tr> | ||
101 | + <tr> | ||
102 | + <th class="text-center" width="50%">维修故障</th> | ||
103 | + <th class="text-center" width="50%">维修完成图片</th> | ||
104 | + | ||
105 | + </tr> | ||
106 | + <tr> | ||
107 | + <td style="padding:0;vertical-align: top;"> | ||
108 | + <?php | ||
109 | + if ($order['repairPlans']) { | ||
110 | + ?> | ||
111 | + <table class="table table-bordered" style="border-top:0;border-bottom: 0"> | ||
112 | + <th class="text-center" width="50%">故障</th> | ||
113 | + <th class="text-center" width="50%">金额</th> | ||
114 | + <?php | ||
115 | + foreach($order['repairPlans'] as $plan): ?> | ||
116 | + <tr> | ||
117 | + <td class="text-center"><?=$plan['plan'] ?></td> | ||
118 | + <td class="text-center" ><?=$plan['price'] ?>元</td> | ||
119 | + </tr> | ||
120 | + <?php endforeach; ?> | ||
121 | + <tr><td><span style="font-weight: bold">维修总金额<span></td><td><span style="font-weight: bold"><?=$order['totalPrice']?>元<span></td></tr> | ||
122 | + </table> | ||
123 | + <?php } else{ ?> | ||
124 | + <p>还未维修完,没有故障明细</p> | ||
125 | + <?php | ||
126 | + } | ||
127 | + ?> | ||
128 | + </td> | ||
129 | + <td style="padding:0;vertical-align: top;"> | ||
130 | + <?php | ||
131 | + if($order['finishImages']) { | ||
132 | + echo "<ul class='imgs-class'>"; | ||
133 | + foreach ($order['finishImages'] as $k => $image) { | ||
134 | + echo "<li class='img-li'><a href='{$image}' target='_black'><img src='{$image}' /></a></li>"; | ||
135 | + } | ||
136 | + echo "</ul>"; | ||
137 | + } else { | ||
138 | + echo "暂无图片"; | ||
139 | + } | ||
140 | + ?> | ||
141 | + </td> | ||
142 | + </tr> | ||
143 | + </table> | ||
144 | + </div> | ||
145 | + | ||
146 | + | ||
147 | + | ||
148 | +</div> | ||
149 | + | ||
150 | +<script> | ||
151 | + $(function(){ | ||
152 | + | ||
153 | + }) | ||
154 | +</script> |
app-ht/views/dashboard/index.php
@@ -31,14 +31,7 @@ $this->params['breadcrumbs'][] = '欢迎'; | @@ -31,14 +31,7 @@ $this->params['breadcrumbs'][] = '欢迎'; | ||
31 | <div class="welcome-text"><h1>欢迎 <?php | 31 | <div class="welcome-text"><h1>欢迎 <?php |
32 | $user = Yii::$app->user->identity; | 32 | $user = Yii::$app->user->identity; |
33 | $username = $user->username; | 33 | $username = $user->username; |
34 | - if ($user->is_manufacture) { | ||
35 | - $manufacturer = ManufacturerRepository::findOne(['sys_user_id' => $user->id]); | ||
36 | - if ($manufacturer) { | ||
37 | - $username = $manufacturer->name; | ||
38 | - } | ||
39 | - | ||
40 | - } | ||
41 | echo $username; | 34 | echo $username; |
42 | - ?> 使用OTA管理后台</h1></div> | 35 | + ?> 使用GK车管家管理后台</h1></div> |
43 | </div> | 36 | </div> |
44 | </div> | 37 | </div> |
app-ht/views/layouts/_main-header.php
@@ -6,7 +6,7 @@ use yii\helpers\Url; | @@ -6,7 +6,7 @@ use yii\helpers\Url; | ||
6 | <header class="main-header"> | 6 | <header class="main-header"> |
7 | <a class="logo" > | 7 | <a class="logo" > |
8 | <img src="<?=Yii::$app->request->baseUrl . "/images/error-logo.png"?>" width="3rem" style="position: absolute;top:6px;left: 15px; width: 3.3rem" id="navList"> | 8 | <img src="<?=Yii::$app->request->baseUrl . "/images/error-logo.png"?>" width="3rem" style="position: absolute;top:6px;left: 15px; width: 3.3rem" id="navList"> |
9 | - <span style="margin-left: 70px;">OTA</span> | 9 | + <span style="margin-left: 70px;">GK车管家</span> |
10 | </a> | 10 | </a> |
11 | <nav class="navbar navbar-static-top" role="navigation"> | 11 | <nav class="navbar navbar-static-top" role="navigation"> |
12 | <img src="<?=Yii::$app->request->baseUrl . "/images/error-logo.png"?>" width="3rem" style="position: absolute;top:6px;right: 15px; width: 3.3rem; display: none" id="navMenu"> | 12 | <img src="<?=Yii::$app->request->baseUrl . "/images/error-logo.png"?>" width="3rem" style="position: absolute;top:6px;right: 15px; width: 3.3rem; display: none" id="navMenu"> |
app-ht/views/layouts/routes.php
1 | <?php | 1 | <?php |
2 | -use domain\upgrade\UpgradeStatus; | ||
3 | $user = Yii::$app->user->identity; | 2 | $user = Yii::$app->user->identity; |
4 | -if (isset($user->is_manufacture) && $user->is_manufacture == 1) { | ||
5 | - return [ | ||
6 | - [ | ||
7 | - 'path' => '/dashboard', | ||
8 | - 'label' => '欢迎', | ||
9 | - ], | ||
10 | - [ | ||
11 | - 'path' => '/upgrade', | ||
12 | - 'label' => '版本', | ||
13 | - 'routes' => [ | ||
14 | - [ | ||
15 | - 'path' => '/upgrade', | ||
16 | - 'redirect' => '/upgrade/upgrade/index' | ||
17 | - ], | ||
18 | - ['label' => '版本管理', 'path'=> '/upgrade/upgrade/index'], | ||
19 | - ] | ||
20 | - ], | ||
21 | - [ | ||
22 | - 'path' => '/myself', | ||
23 | - 'label' => '账号', | ||
24 | - 'routes' => [ | ||
25 | - [ | ||
26 | - 'path' => '/myself', | ||
27 | - 'redirect' => '/my/default/my-index' | ||
28 | - ], | ||
29 | - ['label' => '账号管理', 'path'=> '/my/default/my-index'], | ||
30 | - ['label' => '修改密码', 'path'=> '/my/default/password'], | ||
31 | - ] | 3 | +return [ |
4 | + [ | ||
5 | + 'path' => '/dashboard', | ||
6 | + 'label' => '欢迎', | ||
7 | + ], | ||
8 | + [ | ||
9 | + 'path' => '/order', | ||
10 | + 'label' => '维修单', | ||
11 | + 'routes' => [ | ||
12 | + [ | ||
13 | + 'path' => '/order', | ||
14 | + 'redirect' => '/order/repair-order/index' | ||
15 | + ], | ||
16 | + ['label' => '维修订单管理', 'path' => '/order/repair-order/index'], | ||
32 | ] | 17 | ] |
33 | - ]; | ||
34 | -} else { | ||
35 | - return [ | ||
36 | - [ | ||
37 | - 'path' => '/dashboard', | ||
38 | - 'label' => '欢迎', | ||
39 | - ], | ||
40 | - [ | ||
41 | - 'path' => '/manufacturer', | ||
42 | - 'label' => '厂商', | ||
43 | - 'routes' => [ | ||
44 | - [ | ||
45 | - 'path' => '/manufacturer', | ||
46 | - 'redirect' => '/manufacturer/manufacturer/index' | ||
47 | - ], | ||
48 | - ['label' => '厂商管理', 'path' => '/manufacturer/manufacturer/index'], | ||
49 | - ] | ||
50 | - ], | ||
51 | - [ | ||
52 | - 'path' => '/project', | ||
53 | - 'label' => '项目', | ||
54 | - 'routes' => [ | ||
55 | - [ | ||
56 | - 'path' => '/project', | ||
57 | - 'redirect' => '/project/project/index' | ||
58 | - ], | ||
59 | - ['label' => '项目管理', 'path'=> '/project/project/index'], | ||
60 | - ] | ||
61 | - ], | ||
62 | - [ | ||
63 | - 'path' => '/model', | ||
64 | - 'label' => '型号', | ||
65 | - 'routes' => [ | ||
66 | - [ | ||
67 | - 'path' => '/model', | ||
68 | - 'redirect' => '/model/model/index' | ||
69 | - ], | ||
70 | - ['label' => '机器型号管理', 'path'=> '/model/model/index'], | ||
71 | - ] | ||
72 | - ], | ||
73 | - [ | ||
74 | - 'path' => '/production', | ||
75 | - 'label' => '生产日期', | ||
76 | - 'routes' => [ | ||
77 | - [ | ||
78 | - 'path' => '/production', | ||
79 | - 'redirect' => '/production/production/index' | ||
80 | - ], | ||
81 | - ['label' => '生产日期管理', 'path' => '/production/production/index'], | ||
82 | - ] | ||
83 | - ], | ||
84 | - [ | ||
85 | - 'path' => '/device', | ||
86 | - 'label' => '序列号', | ||
87 | - 'routes' => [ | ||
88 | - [ | ||
89 | - 'path' => '/device', | ||
90 | - 'redirect' => '/device/device/index' | ||
91 | - ], | ||
92 | - | ||
93 | - ['label' => '序列号管理', 'path' => '/device/device/index'], | ||
94 | - ['label' => '授权失败管理', 'path' => '/device/device/auth-fail-index'], | ||
95 | - ['label' => '创建序列号', 'path' => '/device/device/create-device'], | ||
96 | - ] | ||
97 | - ], | ||
98 | - [ | ||
99 | - 'path' => '/upgrade', | ||
100 | - 'label' => '版本', | ||
101 | - 'routes' => [ | ||
102 | - [ | ||
103 | - 'path' => '/upgrade', | ||
104 | - 'redirect' => '/upgrade/upgrade/index' | ||
105 | - ], | ||
106 | - ['label' => '版本管理', 'path'=> '/upgrade/upgrade/index'], | ||
107 | - ] | ||
108 | - ], | ||
109 | - [ | ||
110 | - 'path' => '/datas', | ||
111 | - 'label' => '数据', | ||
112 | - 'routes' => [ | ||
113 | - [ | ||
114 | - 'path' => '/datas', | ||
115 | - 'redirect' => '/datas/device/index' | ||
116 | - ], | ||
117 | - ['label' => '序列号统计', 'path' => '/datas/device/index'], | ||
118 | - ['label' => 'OTA升级统计', 'path' => '/datas/upgrade-log/index?type=' . UpgradeStatus::TYPE_OTA], | ||
119 | - ['label' => 'APP升级统计', 'path' => '/datas/upgrade-log/index?type=' . UpgradeStatus::TYPE_APP], | ||
120 | - ['label' => '机器状态统计', 'path' => '/datas/device-stats/index'], | ||
121 | - ] | ||
122 | - ], | ||
123 | - [ | ||
124 | - 'path' => '/system', | ||
125 | - 'label' => '系统', | ||
126 | - 'routes' => [ | ||
127 | - [ | ||
128 | - 'path' => '/system', | ||
129 | - 'redirect' => '/system/role/index' | ||
130 | - ], | ||
131 | - ['label' => '角色管理', 'path' => '/system/role/index'], | ||
132 | - ['label' => '账号管理', 'path' => '/system/account/index'], | ||
133 | - ['label' => '系统操作日志', 'path' => '/system/admin-log/index'], | ||
134 | - ] | 18 | + ], |
19 | + [ | ||
20 | + 'path' => '/maintainer', | ||
21 | + 'label' => '维修厂', | ||
22 | + 'routes' => [ | ||
23 | + [ | ||
24 | + 'path' => '/maintainer', | ||
25 | + 'redirect' => '/maintainer/user/index' | ||
26 | + ], | ||
27 | + ['label' => '维修厂管理', 'path'=> '/maintainer/user/index'], | ||
135 | ] | 28 | ] |
136 | - ]; | ||
137 | -} | 29 | + ], |
30 | + [ | ||
31 | + 'path' => '/system', | ||
32 | + 'label' => '系统', | ||
33 | + 'routes' => [ | ||
34 | + [ | ||
35 | + 'path' => '/system', | ||
36 | + 'redirect' => '/system/role/index' | ||
37 | + ], | ||
38 | + ['label' => '角色管理', 'path' => '/system/role/index'], | ||
39 | + ['label' => '账号管理', 'path' => '/system/account/index'], | ||
40 | + ['label' => '系统操作日志', 'path' => '/system/admin-log/index'], | ||
41 | + ] | ||
42 | + ] | ||
43 | +]; |
app-ht/views/site/error/400.php
@@ -19,7 +19,7 @@ use yii\helpers\Url; | @@ -19,7 +19,7 @@ use yii\helpers\Url; | ||
19 | 19 | ||
20 | <p style="margin-bottom:60px">请一定告诉我们,我们深宅多年练就的功力,就是为了化问题为神奇。</p> | 20 | <p style="margin-bottom:60px">请一定告诉我们,我们深宅多年练就的功力,就是为了化问题为神奇。</p> |
21 | 21 | ||
22 | - <p style="margin-bottom: 30px"> 邮箱:tech@hiboard.com</p> | 22 | + <p style="margin-bottom: 30px"> 邮箱:tech@xxx.com</p> |
23 | 23 | ||
24 | ---- 400 OTA技术部(求约) | 24 | ---- 400 OTA技术部(求约) |
25 | </div> | 25 | </div> |
app-ht/views/site/error/403.php
@@ -19,7 +19,7 @@ use yii\helpers\Url; | @@ -19,7 +19,7 @@ use yii\helpers\Url; | ||
19 | 19 | ||
20 | <p style="margin-bottom:60px">请联系管理员。</p> | 20 | <p style="margin-bottom:60px">请联系管理员。</p> |
21 | 21 | ||
22 | - <p style="margin-bottom: 30px"> 邮箱:tech@hiboard.com</p> | 22 | + <p style="margin-bottom: 30px"> 邮箱:tech@xxx.com</p> |
23 | 23 | ||
24 | ---- OTA技术部(求约) | 24 | ---- OTA技术部(求约) |
25 | </div> | 25 | </div> |
app-ht/views/site/error/404.php
@@ -19,7 +19,7 @@ use yii\helpers\Url; | @@ -19,7 +19,7 @@ use yii\helpers\Url; | ||
19 | 19 | ||
20 | <p style="margin-bottom:60px">请一定告诉我们,我们深宅多年练就的功力,就是为了化问题为神奇。</p> | 20 | <p style="margin-bottom:60px">请一定告诉我们,我们深宅多年练就的功力,就是为了化问题为神奇。</p> |
21 | 21 | ||
22 | - <p style="margin-bottom: 30px"> 邮箱:tech@hiboard.com</p> | 22 | + <p style="margin-bottom: 30px"> 邮箱:tech@xxx.com</p> |
23 | 23 | ||
24 | ---- 404(求约) | 24 | ---- 404(求约) |
25 | </div> | 25 | </div> |
app-ht/views/site/login.php
@@ -57,8 +57,7 @@ $this->title = Yii::$app->name; | @@ -57,8 +57,7 @@ $this->title = Yii::$app->name; | ||
57 | <footer class="site-footer"> | 57 | <footer class="site-footer"> |
58 | <div class="copyright"> | 58 | <div class="copyright"> |
59 | <div class="copyright_inner" id="copyright"> | 59 | <div class="copyright_inner" id="copyright"> |
60 | - <p class="copyright_txt"><a href="http://www.jiwork.com/" id="linkIcp" target="_blank">Copyright @2019 深圳市金博德科技有限公司版权所有 </a></p> | ||
61 | - <p class="copyright_txt">粤ICP备19146545号</p> | 60 | + <p class="copyright_txt"><a href="http://www.jiwork.com/" id="linkIcp" target="_blank">Copyright @2019 XXXXXX有限公司版权所有 </a></p> |
62 | </div> | 61 | </div> |
63 | </div> | 62 | </div> |
64 | </footer> | 63 | </footer> |
app-wx/modules/order/controllers/CustomerController.php
@@ -124,11 +124,11 @@ class CustomerController extends CustomerBaseController | @@ -124,11 +124,11 @@ class CustomerController extends CustomerBaseController | ||
124 | } | 124 | } |
125 | if ($userId > 0) { | 125 | if ($userId > 0) { |
126 | $e->message = '维修厂人员不能评论'; | 126 | $e->message = '维修厂人员不能评论'; |
127 | - return $this->renderJson($e); | 127 | + //return $this->renderJson($e); |
128 | } | 128 | } |
129 | $items = [ | 129 | $items = [ |
130 | 'ip_address' => Utils::clientIp(), | 130 | 'ip_address' => Utils::clientIp(), |
131 | - 'user_id' => 0, | 131 | + 'customer_id' => 0, |
132 | 'star_count' => $star, | 132 | 'star_count' => $star, |
133 | 'repair_order_id' => $orderModel->id, | 133 | 'repair_order_id' => $orderModel->id, |
134 | 'comment' => $comment, | 134 | 'comment' => $comment, |
app-wx/modules/order/controllers/DefaultController.php
@@ -194,7 +194,7 @@ class DefaultController extends BaseController | @@ -194,7 +194,7 @@ class DefaultController extends BaseController | ||
194 | $hasComment = true; | 194 | $hasComment = true; |
195 | $comments = ['starTxt' => RepairOrderRate::starLabel($rateModel->star_count), 'comment' => $rateModel->comment]; | 195 | $comments = ['starTxt' => RepairOrderRate::starLabel($rateModel->star_count), 'comment' => $rateModel->comment]; |
196 | } | 196 | } |
197 | - | 197 | + $shortId = $orderModel->short_uuid; |
198 | $e->success = true; | 198 | $e->success = true; |
199 | $e->item = [ | 199 | $e->item = [ |
200 | 'carNo' => $orderModel->car_no, | 200 | 'carNo' => $orderModel->car_no, |
@@ -209,10 +209,12 @@ class DefaultController extends BaseController | @@ -209,10 +209,12 @@ class DefaultController extends BaseController | ||
209 | 'hasComment' => $hasComment, | 209 | 'hasComment' => $hasComment, |
210 | 'comments' => $comments, | 210 | 'comments' => $comments, |
211 | 'brokenImages' => $brokenImages, | 211 | 'brokenImages' => $brokenImages, |
212 | + 'shortId' => $shortId, | ||
212 | 'repairPlans' => $repairPlans, | 213 | 'repairPlans' => $repairPlans, |
213 | 'totalPrice' => $totalPrice, | 214 | 'totalPrice' => $totalPrice, |
214 | 'finishImages' => $finishImages | 215 | 'finishImages' => $finishImages |
215 | ]; | 216 | ]; |
217 | + $e->showCustomerComment = true; | ||
216 | 218 | ||
217 | return $this->renderJson($e); | 219 | return $this->renderJson($e); |
218 | } | 220 | } |
app-wx/modules/order/views/default/pages/order-details-template.php
@@ -178,7 +178,11 @@ $baseUrl = Url::base(true); | @@ -178,7 +178,11 @@ $baseUrl = Url::base(true); | ||
178 | <div class="content-wrapper" style="font-size: 1rem;"> | 178 | <div class="content-wrapper" style="font-size: 1rem;"> |
179 | GK车管家 <span style="color:#FF8728">《质保承诺》</span> | 179 | GK车管家 <span style="color:#FF8728">《质保承诺》</span> |
180 | </div> | 180 | </div> |
181 | - | 181 | + {{#js_compare "true == this.showCustomerComment && false == this.item.hasComment"}} |
182 | + <div class="content-wrapper" style="font-size: 1rem;"> | ||
183 | + <a href="<?=$baseUrl?>/order/customer#customer-order/{{this.item.shortId}}/1">点击进入演示用的客户评价</a> | ||
184 | + </div> | ||
185 | + {{/js_compare}} | ||
182 | <div class="content-wrapper"> | 186 | <div class="content-wrapper"> |
183 | {{#js_compare "true == this.item.hasComment"}} | 187 | {{#js_compare "true == this.item.hasComment"}} |
184 | <div class="content-title" style="padding-bottom: 0.5rem">评价</div> | 188 | <div class="content-title" style="padding-bottom: 0.5rem">评价</div> |
app-wx/modules/user/controllers/LoginController.php
@@ -294,4 +294,10 @@ class LoginController extends BaseController | @@ -294,4 +294,10 @@ class LoginController extends BaseController | ||
294 | } | 294 | } |
295 | return false; | 295 | return false; |
296 | } | 296 | } |
297 | + | ||
298 | + public function actionLogout() | ||
299 | + { | ||
300 | + Yii::$app->user->logout(); | ||
301 | + $this->redirect('/order/'); | ||
302 | + } | ||
297 | } | 303 | } |
298 | \ No newline at end of file | 304 | \ No newline at end of file |
common/helpers/ImageManager.php
@@ -28,12 +28,19 @@ class ImageManager | @@ -28,12 +28,19 @@ class ImageManager | ||
28 | 28 | ||
29 | /** | 29 | /** |
30 | * @param $path 数据库存储的图片相对路径 | 30 | * @param $path 数据库存储的图片相对路径 |
31 | - * @param null $style 不传递此参数或者null表示读取原图, 否则读取指定样式规格的图片 | 31 | + * @param null $style 不传递此参数或者null表示读取原图 |
32 | */ | 32 | */ |
33 | public static function getUrl($path, $style = null) | 33 | public static function getUrl($path, $style = null) |
34 | { | 34 | { |
35 | - | ||
36 | - return $path; | 35 | + $baseUrl = Yii::$app->params['frontEndBaseUrl']; |
36 | + $fullPath = $baseUrl.$path; | ||
37 | + if ('min' == $style) { | ||
38 | + $fileArr = explode('.', $path); | ||
39 | + $end = array_pop($fileArr); | ||
40 | + $newPath = implode('.', $fileArr); | ||
41 | + $fullPath = $baseUrl.$newPath.'_min.'.$end; | ||
42 | + } | ||
43 | + return $fullPath; | ||
37 | } | 44 | } |
38 | 45 | ||
39 | /** | 46 | /** |
domain/order/RepairOrderRepository.php
@@ -7,6 +7,8 @@ use domain\order\models\RepairOrder as RepairOrderModel; | @@ -7,6 +7,8 @@ use domain\order\models\RepairOrder as RepairOrderModel; | ||
7 | use domain\order\models\RepairOrderImages as RepairOrderImagesModel; | 7 | use domain\order\models\RepairOrderImages as RepairOrderImagesModel; |
8 | use domain\order\models\RepairOrderRepairPlan as RepairOrderRepairPlanModel; | 8 | use domain\order\models\RepairOrderRepairPlan as RepairOrderRepairPlanModel; |
9 | use domain\order\models\RepairFinishImages as RepairFinishImagesModel; | 9 | use domain\order\models\RepairFinishImages as RepairFinishImagesModel; |
10 | +use domain\order\models\RepairOrderRate as RepairOrderRateModel; | ||
11 | +use domain\user\models\User as UserModel; | ||
10 | 12 | ||
11 | /** | 13 | /** |
12 | * 维修订单 | 14 | * 维修订单 |
@@ -103,4 +105,54 @@ class RepairOrderRepository | @@ -103,4 +105,54 @@ class RepairOrderRepository | ||
103 | 105 | ||
104 | return $images; | 106 | return $images; |
105 | } | 107 | } |
108 | + | ||
109 | + /** | ||
110 | + * @param $offset | ||
111 | + * @param $limit | ||
112 | + * @param $map | ||
113 | + * @param string $orderDesc | ||
114 | + * @return array|\yii\db\ActiveRecord[] | ||
115 | + */ | ||
116 | + public static function getAdminOrderList($offset, $limit, $map, $orderDesc = '') | ||
117 | + { | ||
118 | + $rateT = RepairOrderRateModel::tableName(); | ||
119 | + $uT = UserModel::tableName(); | ||
120 | + $orderFind = RepairOrderModel::find(); | ||
121 | + | ||
122 | + $orderFind->alias('ord'); | ||
123 | + $orderFind->select(["ord.*", "u.mobile as maintainer_mobile", "u.name as maintainer", 'r.star_count', 'r.comment']); | ||
124 | + $orderFind->leftJoin($uT. ' u', 'u.id = ord.user_id'); | ||
125 | + $orderFind->leftJoin($rateT.' r', "r.repair_order_id = ord.id"); | ||
126 | + $orderFind->where($map); | ||
127 | + if (empty($orderDesc)) { | ||
128 | + $orderDesc = "ord.created_at desc"; | ||
129 | + } | ||
130 | + $orderFind->orderBy($orderDesc); | ||
131 | + $orderFind->offset($offset); | ||
132 | + if ($limit) { | ||
133 | + $orderFind->limit($limit); | ||
134 | + } | ||
135 | + $orderList = $orderFind->asArray()->all(); | ||
136 | + | ||
137 | + return $orderList; | ||
138 | + } | ||
139 | + | ||
140 | + /** | ||
141 | + * 获取总记录数 | ||
142 | + * @param $map | ||
143 | + * @return int|string | ||
144 | + */ | ||
145 | + public static function getAdminOrderListCount($map) | ||
146 | + { | ||
147 | + $rateT = RepairOrderRateModel::tableName(); | ||
148 | + $uT = UserModel::tableName(); | ||
149 | + $orderFind = RepairOrderModel::find(); | ||
150 | + $orderFind->alias('ord'); | ||
151 | + $orderFind->leftJoin($uT. ' u', 'u.id = ord.user_id'); | ||
152 | + $orderFind->leftJoin($rateT.' r', "r.repair_order_id = ord.id"); | ||
153 | + $orderFind->where($map); | ||
154 | + | ||
155 | + return $orderFind->count(); | ||
156 | + } | ||
157 | + | ||
106 | } | 158 | } |
107 | \ No newline at end of file | 159 | \ No newline at end of file |
domain/order/RepairOrderStatus.php
@@ -32,4 +32,25 @@ class RepairOrderStatus | @@ -32,4 +32,25 @@ class RepairOrderStatus | ||
32 | return ''; | 32 | return ''; |
33 | } | 33 | } |
34 | } | 34 | } |
35 | + | ||
36 | + /** | ||
37 | + * @param string $index | ||
38 | + * @return array|string | ||
39 | + */ | ||
40 | + static function getLabels($index = '') | ||
41 | + { | ||
42 | + $arr = [ | ||
43 | + self::WORKING => "维修中", | ||
44 | + self::FINISH => "维修完成", | ||
45 | + ]; | ||
46 | + if ('' === $index) { | ||
47 | + return $arr; | ||
48 | + } | ||
49 | + if (isset($arr[$index])) { | ||
50 | + return $arr[$index]; | ||
51 | + } else { | ||
52 | + return ''; | ||
53 | + } | ||
54 | + } | ||
55 | + | ||
35 | } | 56 | } |
36 | \ No newline at end of file | 57 | \ No newline at end of file |
domain/user/UserRepository.php
@@ -17,4 +17,44 @@ class UserRepository | @@ -17,4 +17,44 @@ class UserRepository | ||
17 | { | 17 | { |
18 | return UserModel::findOne($condition); | 18 | return UserModel::findOne($condition); |
19 | } | 19 | } |
20 | + | ||
21 | + /** | ||
22 | + * @param $offset | ||
23 | + * @param $limit | ||
24 | + * @param $map | ||
25 | + * @param string $orderDesc | ||
26 | + * @return array|\yii\db\ActiveRecord[] | ||
27 | + */ | ||
28 | + public static function getAdminUserList($offset, $limit, $map, $orderDesc = '') | ||
29 | + { | ||
30 | + $userFind = UserModel::find(); | ||
31 | + $userFind->alias('user'); | ||
32 | + $userFind->select(["user.*"]); | ||
33 | + $userFind->where($map); | ||
34 | + if (empty($orderDesc)) { | ||
35 | + $orderDesc = "user.created_at desc"; | ||
36 | + } | ||
37 | + $userFind->orderBy($orderDesc); | ||
38 | + $userFind->offset($offset); | ||
39 | + if ($limit) { | ||
40 | + $userFind->limit($limit); | ||
41 | + } | ||
42 | + $userList = $userFind->asArray()->all(); | ||
43 | + | ||
44 | + return $userList; | ||
45 | + } | ||
46 | + | ||
47 | + /** | ||
48 | + * 获取总记录数 | ||
49 | + * @param $map | ||
50 | + * @return int|string | ||
51 | + */ | ||
52 | + public static function getAdminUserListCount($map) | ||
53 | + { | ||
54 | + $orderFind = UserModel::find(); | ||
55 | + $orderFind->alias('user'); | ||
56 | + $orderFind->where($map); | ||
57 | + | ||
58 | + return $orderFind->count(); | ||
59 | + } | ||
20 | } | 60 | } |
21 | \ No newline at end of file | 61 | \ No newline at end of file |
domain/user/models/User.php
@@ -12,7 +12,7 @@ use yii\web\IdentityInterface; | @@ -12,7 +12,7 @@ use yii\web\IdentityInterface; | ||
12 | * 用户 | 12 | * 用户 |
13 | * This is the model class for table "{{%gk_user}}". | 13 | * This is the model class for table "{{%gk_user}}". |
14 | */ | 14 | */ |
15 | -class User extends ActiveRecord implements IdentityInterface | 15 | +class User extends ActiveRecord |
16 | { | 16 | { |
17 | /** | 17 | /** |
18 | * @inheritdoc | 18 | * @inheritdoc |
web/admin/images/error-logo.png
web/dist/js/order-app.js
1 | -define("order-app",["mk7/app"],function(t){var e=Dom7,i=function(){var t=e(".ui-loading-block");0==t.length&&(e(".view-main").html('<div class="ui-loading-block" id="ui-loading"><div class="ui-loading-cnt"><div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div><div id="loader-inner"><p></p></div> </div> </div>'),window.waitingTime=1e4,window.loaderTimer&&clearTimeout(window.loaderTimer),window.loaderTimer=setTimeout(function(){var t=document.getElementById("loader-inner"),e=document.createElement("p");e.className="notice",t&&(e.innerHTML='加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>',t.appendChild(e))},window.waitingTime))},n=!0;return t.name="order",t.routes={index:function(){return n=!1,i(),t.runController("index")},"index/:tab":function(e){n=!1,i();var r={tab:e};return t.runController("index",r)},submit:function(){return n=!1,i(),t.runController("submit")},"order-details/:id":function(e){n=!1,i();var r={id:e};return t.runController("order-details",r)},"customer-order/:id/:sn":function(e,r){n=!1,i();var a={id:e,sn:r};return t.runController("customer-order",a)},"rate/:id/:sn":function(e,r){n=!1,i();var a={id:e,sn:r};return t.runController("rate",a)},"cost-list/:id":function(e){n=!1,i();var r={id:e};return t.runController("cost-list",r)},"*":function(){return t.runController("index")}},t}),define("order/cost-list-controller",["mk7/controller","mk7/url","mk7/utils","mk7/uploadjs"],function(t,e,i,n){var r=Dom7,t=(Template7,new t),a="/user/default/upload-file",o="/order/default/submit-repair-plans";return t.run=function(){var t=this;t.setPageTitle("费用列表"),t.id=t.params.id,t.imgLimit=9,t.canSubmit=!0,t.render()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.addEvent(),t.uploadImgEvent(),t.delPlanEvent(),t.inputPriceChangeEvent(),t.submitEvent()},t.addEvent=function(){var t=this;r("#cost-list .add-repair-plan").click(function(e){var i=r("#cost-list .cost-list-div"),n=t.planTpl(i.length+1);r(n).insertBefore(r("#cost-list .cost-total-list-div"))})},t.delPlanEvent=function(){var t=this;r("#cost-list").on("click",".del-plan",function(e){console.log("del plan event"),r(this).parents(".cost-list-div").remove(),r("#cost-list .total-plan-price").html(t.computedPrice())})},t.planTpl=function(t){var e='<div class="cost-list-div"><p class="item-title">第'+t+'项</p><div class="repair-item-cls"><input type="text" class="input-left input-cls" placeholder="填写维修内容" value=""><input type="number" class="input-right input-cls" placeholder="填写价格" value="0"><span class="del-plan"></span></div></div>';return e},t.inputPriceChangeEvent=function(){var t=this;r("#cost-list").on("input propertychange",".input-cls",function(){var e=t.computedPrice();r("#cost-list .total-plan-price").html(e)})},t.computedPrice=function(){var t=r("#cost-list .input-right"),e=0;return r.each(t,function(t,i){e+=1*r(i).val()}),Math.round(e,2)},t.uploadImgEvent=function(){var t=this;r("#cost-list #upload-btn").change(function(){if(""!=r(this).val()&&null!=r(this).val()){var o=r(this).parents("li");n.uploadFile({selector:"#upload-btn",url:e.to(a),processAppendTo:"#cost-list",success:function(e,n){try{if(e.success){var a=e.tmpUrl;r('<li class="upload-li up-img"><div data="'+e.tmpFile+'" data-url="'+a+'" class="upload-item" style="background-image:url('+e.tmpMinUrl+')"></div><span class="del-img"></span></li>').insertBefore(o),t.imgLimit==r("#cost-list #image-list").find(".up-img").length&&r("#cost-list .upload-btn-li").hide()}else i.toast({content:e.message,closeDelay:5e3})}catch(s){console.log(s),i.toast({content:"出错",closeDelay:5e3})}}})}}),r("#cost-list #image-list").on("click",".del-img",function(e){r(this).parent().remove(),t.imgLimit>=r("#cost-list #image-list").find(".up-img").length&&r("#cost-list .upload-btn-li").show()})},t.submitEvent=function(){var t=this;r("#cost-list .btn-submit").click(function(n){var a=r("#cost-list .content-div").find(".repair-item-cls"),s=[],l=!0,c=!0;if(r.each(a,function(t,e){var n=i.trim(r(e).find(".input-left").val()),a=i.trim(r(e).find(".input-right").val());""==n&&(l=!1),""!=a&&0!=a||(c=!1),s.push({content:n,price:a})}),!l)return i.toast({content:"维修清单有部分未填内容"}),!1;if(!c)return i.toast({content:"维修清单有部分未填价格"}),!1;var d=r("#cost-list #image-list").find(".upload-item"),u=[];if(r.each(d,function(t,e){u.push(r(e).attr("data"))}),!t.canSubmit)return!1;t.canSubmit=!1;var m=t.csrf({images:u,plans:s,id:t.id});i.httpPost(o,m,function(n){t.canSubmit=!0,n.success?window.location.replace(e.to("order#order-details/"+t.id)):i.toast({content:n.message})},!0)})},t}),define("order/customer-order-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,e,i){var n=Dom7,t=(Template7,new t),r="order/customer/order-details";return t.run=function(){var t=this;t.id=t.params.id,t.sn=t.params.sn,t.success=!0,t.setPageTitle("维修单"),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.goToComment(),t.popupImageLayer()},t.beforeRender=function(){var t=this;console.log("beforeRender"),t.success||(this.view="customer-order-error")},t.loadPage=function(){var t=this,n=t.csrf({id:t.id});i.httpPost(e.to(r),n,function(e){var i=e;t.success=e.success,t.render(i)},!0)},t.goToComment=function(){var t=this;n("#customer-order .rate-btn-cls").click(function(i){window.location.replace(e.to("order/customer#rate/"+t.id+"/"+t.sn))})},t.popupImageLayer=function(){n("#customer-order").on("click",".view-img-cls",function(t){var e=n(this).attr("data-url");n("#img-mask").remove();var i='<div id="img-mask" style="z-index:2;background:#000;justify-content:center;position: absolute;bottom:0;top:0;width:100%;display:flex;flex-direction: column;align-items: center"><div style="width:100%;"> <img width="100%" src="'+e+'" /></div></div>';n("#customer-order").append(i)}),n("#customer-order").on("click","#img-mask, #img-mask img",function(t){t.preventDefault(),t.stopPropagation();var e=document.body.clientHeight,i=n("#img-mask img").height();console.log(e+"dddd"+i);var r=Math.abs(i-e);if(r>=0&&r<=20)n("#img-mask").remove();else{var a=n(t.target).attr("id");"img-mask"==a&&n("#img-mask").remove()}})},t}),define("order/index-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,e,i){var n=Dom7,r=Template7,t=new t,a="order/default/order-list";return t.run=function(){var t=this;t.setPageTitle("订单列表"),t.tab=t.params.tab,t.page=0,t.nodata="",t.loading=!1,t.pageCount=1,t.render({tab:t.tab}),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.tabEvent(),t.bindScrollEvent(),t.addEvent(),t.orderClickEvent()},t.tabEvent=function(){n(".tab-cls").click(function(t){var e=n(this).attr("data-href");window.location.replace(e)})},t.handleNodata=function(){var t=this;t.nodata="没有数据了";var e=n(".nodata");0==e.length&&n("#index .order-list").append('<div class="nodata">'+t.nodata+"</div>"),t.app.detachInfiniteScroll(".infinite-scroll"),n("#index .infinite-scroll-preloader").remove()},t.loadPage=function(){var t=this;if(t.loading=!0,t.page>=t.pageCount)return void t.handleNodata();var r={status:t.tab};r.page=t.page+1,r=t.csrf(r),n.ajax({method:"GET",url:e.to(a),data:r,dataType:"json",beforeSend:function(){t.showIndicator()},success:function(e){if(1==e.success&&(i.isDefined(e.page)&&(t.page=parseInt(e.page)),i.isDefined(e.page_count)&&(t.pageCount=parseInt(e.page_count)),t.renderItems(e.items,!0),t.page>=t.pageCount))return void t.handleNodata()},error:function(t){},complete:function(e){t.hideIndicator(),t.loading=!1}})},t.bindScrollEvent=function(){var t=this;t.app.attachInfiniteScroll("#index .infinite-scroll"),n("#index .infinite-scroll").on("infinite",function(){t.loading||t.nodata||t.loadPage()})},t.renderItems=function(t,e){var i=n("#index .order-list"),a=n("script#order-item-template"),o=r.compile(a.html()),s=o({list:t});0==e&&(i.html(""),i.append(s)),i.append(s)},t.addEvent=function(){n("#index .add-btn-cls").click(function(t){window.location.href=e.to("order/#submit")})},t.orderClickEvent=function(){n("#index").on("click",".order-item",function(t){var i=n(this).attr("data-id");window.location.href=e.to("order#order-details/"+i)})},t}),define("order/order-details-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,e,i){var n=Dom7,t=(Template7,new t),r="order/default/order-details";return t.run=function(){var t=this;t.id=t.params.id,t.success=!0,t.setPageTitle("维修单"),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.finishBtnEvent(),t.popupImageLayer()},t.beforeRender=function(){var t=this;console.log("beforeRender"),t.success||(t.view="order-details-error")},t.loadPage=function(){var t=this,n=t.csrf({id:t.id});i.httpPost(e.to(r),n,function(e){var i=e;t.success=e.success,t.render(i)},!0)},t.finishBtnEvent=function(){var t=this;n("#order-details .finish-submit").click(function(i){window.location.href=e.to("order/#cost-list/"+t.id)})},t.popupImageLayer=function(){n("#order-details").on("click",".view-img-cls",function(t){var e=n(this).attr("data-url");n("#img-mask").remove();var i='<div id="img-mask" style="z-index:2;background:#000;justify-content:center;position: absolute;bottom:0;top:0;width:100%;display:flex;flex-direction: column;align-items: center"><div style="width:100%;"> <img width="100%" src="'+e+'" /></div></div>';n("#order-details").append(i)}),n("#order-details").on("click","#img-mask, #img-mask img",function(t){t.preventDefault(),t.stopPropagation();var e=document.body.clientHeight,i=n("#img-mask img").height();console.log(e+"dddd"+i);var r=Math.abs(i-e);if(r>=0&&r<=20)n("#img-mask").remove(),console.log("dddd");else{var a=n(t.target).attr("id");"img-mask"==a&&n("#img-mask").remove()}})},t}),define("order/rate-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,e,i){var n=Dom7,t=(Template7,new t),r="order/customer/submit-rate";return t.run=function(){var t=this;t.id=t.params.id,t.sn=t.params.sn,t.setPageTitle("评价"),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.starClickEvent(),t.submitEvent()},t.loadPage=function(){var t=this;t.render()},t.starClickEvent=function(){n("#rate").on("click",".quality-box .img-star",function(t){var e=n(this).attr("data-id"),i=n("#rate .quality-box .img-star");n.each(i,function(t,i){var r=n(i).attr("data-id");if(1*r<=e){n(i).addClass("star-on");var a=n("#rate .quality-box").find(".rate-text"),o=n(i).attr("data-txt");a.html(o)}else n(i).removeClass("star-on")})})},t.submitEvent=function(){var t=this;n("#rate .submit-btn").click(function(a){var o=i.trim(n("#rate .text-content").val()),s=n("#rate .img-star"),l=0;n.each(s,function(t,e){n(e).hasClass("star-on")&&l++});var c=t.csrf({star:l,comment:o,id:t.id});i.httpPost(e.to(r),c,function(n){n.success?window.location.replace(e.to("order/customer#customer-order/"+t.id+"/"+t.sn)):i.toast({content:n.message})},!0)})},t}),define("order/submit-controller",["mk7/controller","mk7/url","mk7/utils","mk7/uploadjs","mk7/picker"],function(t,e,n,r,a){var o=Dom7,t=(Template7,new t),s="/user/default/upload-file",l="/order/default/submit",c=!0,d="";return t.run=function(){var t=this;t.setPageTitle("录入维修单"),t.imgLimit=9,t.render()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.uploadImgEvent(),t.submitEvent(),t.selectDateEvent()},t.uploadImgEvent=function(){var t=this;o("#submit #upload-btn").change(function(){if(""!=o(this).val()&&null!=o(this).val()){var i=o(this).parents("li");r.uploadFile({selector:"#upload-btn",url:e.to(s),processAppendTo:"#submit",success:function(e,r){try{if(e.success){var a=e.tmpUrl;o('<li class="upload-li up-img"><div data="'+e.tmpFile+'" data-url="'+a+'" class="upload-item" style="background-image:url('+e.tmpMinUrl+')"></div><span class="del-img"></span></li>').insertBefore(i),t.imgLimit==o("#submit #image-list").find(".up-img").length&&o("#submit .upload-btn-li").hide()}else n.toast({content:e.message,closeDelay:5e3})}catch(s){console.log(s),n.toast({content:"出错",closeDelay:5e3})}}})}}),o("#submit #image-list").on("click",".del-img",function(e){o(this).parent().remove(),t.imgLimit>=o("#submit #image-list").find(".up-img").length&&o("#submit .upload-btn-li").show()})},t.submitEvent=function(){var t=this;o("#submit .submit-btn-cls").click(function(i){var r=n.trim(o("#submit .carNo").val()),a=n.trim(o("#submit .carModel").val()),s=n.trim(o("#submit .customer").val()),d=n.trim(o("#submit .phone").val()),u=n.trim(o("#submit .preRepair").val()),m=n.trim(o("#submit .repairPrice").val()),v=n.trim(o("#submit .finishDate").val());if(0==c)return!1;if(""==r)return n.toast({content:"车牌号必填"}),!1;if(""==a)return n.toast({content:"车辆型号必填"}),!1;if(""==s)return n.toast({content:"客户名称必填"}),!1;if(""==d)return n.toast({content:"客联系电话必填"}),!1;if(!n.isMobile(d)&&!uitls.isTelephone(d))return n.toast({content:"客联系电话有误"}),!1;if(""==u)return n.toast({content:"预估维修内容必填"}),!1;if(""==m)return n.toast({content:"预估维修费用必填"}),!1;if(""==v)return n.toast({content:"预估完成时间必填"}),!1;var p=t.getUploadImgs();if(0==p.length)return n.toast({content:"请上传车损照"}),!1;c=!1;var f=t.csrf({carNo:r,carModel:a,customer:s,phone:d,preRepair:u,repairPrice:m,finishDate:v,images:p});n.httpPost(l,f,function(t){return c=!0,t.success?void window.location.replace(e.to("order#order-details/"+t.orderId)):(n.toast({content:message}),!1)},!0)})},t.getUploadImgs=function(){var t=o("#submit #image-list").find(".up-img"),e=[];return 0==t.length?[]:(o.each(t,function(t,i){var n=o(i).find(".upload-item");e.push(n.attr("data"))}),e)},t.selectDateEvent=function(){var t=this;o("#submit .finish-date-input").click(function(e){var i=o(this).val();console.log(i),t.dateTimeSelector("#submit .finish-date-input",i)})},t.dateTimeSelector=function(t,e){var n=this,r=new Date,a=30,s=r.getFullYear(),l=r.getMonth(),c=r.getDate(),u=r.getHours(),m=s+"-"+(l+1)+"-"+c;if(""!=e&&null!=e&&void 0!==e){var v=e.split(" ");m=v[0],u=v[1]}var p=[];for(i=0;i<=a;i++){var f=new Date;f.setDate(r.getDate()+i);var g=f.getFullYear()+"-"+(f.getMonth()+1)+"-"+f.getDate();p.push(g)}var h=n.app.picker({input:t,toolbarTemplate:'<div class="toolbar"><div class="toolbar-inner"><div class="left">请选择用工时间</div><div class="right"><a href="javascript:void(0);" class="link submit-confirm-picker">确定</a></div></div></div>',value:[m,u],onChange:function(t,e,i){var n,r,a;if(e[0]instanceof Date)n=e[0].getFullYear(),r=e[0].getMonth(),a=e[0].getDate();else{var o=e[0].split("-");n=o[0],r=o[1]-1,a=o[2]}var s=new Date(n,r,a,e[1],0),l=new Date((new Date).getTime()+36e5);if(s<l){if(void 0===t.cols[0])return!1;var c=l.getHours(),d=l.getFullYear()+"-"+(l.getMonth()+1)+"-"+l.getDate(),u=new Date(l.getFullYear(),l.getMonth(),l.getDate(),l.getHours(),0);if(u-new Date<9e5){var m=new Date(u.getTime()+36e5);c=m.getHours(),d=m.getFullYear()+"-"+(m.getMonth()+1)+"-"+m.getDate()}t.cols[0].setValue(d),t.cols[2].setValue(c)}},formatValue:function(t,e,i){var n="";n=e[0]instanceof Date?e[0].getFullYear()+"-"+(e[0].getMonth()+1)+"-"+e[0].getDate():e[0];var r=n+" "+e[1];return r},cols:[{values:p,displayValues:function(){var t=[],e=new Date,i=e.getFullYear(),n=e.getMonth()+1,r=e.getDate();e.setDate(e.getDate()+1);for(var a=0;a<p.length;a++){var o=p[a],s=o.split("-"),l=s[1]+"月"+s[2]+"日";i==s[0]&&1*n==s[1]&&1*r==s[2]&&(l+="(今天)"),1*e.getFullYear()==s[0]&&1*e.getMonth()+1==s[1]&&1*e.getDate()==s[2]&&(l+="(明天)"),t.push(l)}return t}()},{divider:!0,content:" "},{values:function(){for(var t=[],e=0;e<=23;e++)t.push(e);return t}(),displayValues:function(){for(var t=[],e=0;e<=23;e++)t.push(e<10?"0"+e+"时":e+"时");return t}()},{divider:!0,content:" "}],onClose:function(e){if(h){var i=h.value,n=i[1]<10?"0"+i[1]:i[1];d=i[0]+" "+n,o(t).val(d),h.destroy()}}});h.open(),o(".submit-confirm-picker").on("click",function(e){e.preventDefault();var i=h.value,n=i[1]<10?"0"+i[1]:i[1];d=i[0]+" "+n,o(t).val(d),h.destroy()})},t}); | ||
2 | \ No newline at end of file | 1 | \ No newline at end of file |
2 | +define("order-app",["mk7/app"],function(t){var e=Dom7,i=function(){var t=e(".ui-loading-block");0==t.length&&(e(".view-main").html('<div class="ui-loading-block" id="ui-loading"><div class="ui-loading-cnt"><div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div><div id="loader-inner"><p></p></div> </div> </div>'),window.waitingTime=1e4,window.loaderTimer&&clearTimeout(window.loaderTimer),window.loaderTimer=setTimeout(function(){var t=document.getElementById("loader-inner"),e=document.createElement("p");e.className="notice",t&&(e.innerHTML='加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>',t.appendChild(e))},window.waitingTime))},n=!0;return t.name="order",t.routes={index:function(){return n=!1,i(),t.runController("index")},"index/:tab":function(e){n=!1,i();var r={tab:e};return t.runController("index",r)},submit:function(){return n=!1,i(),t.runController("submit")},"order-details/:id":function(e){n=!1,i();var r={id:e};return t.runController("order-details",r)},"customer-order/:id/:sn":function(e,r){n=!1,i();var a={id:e,sn:r};return t.runController("customer-order",a)},"rate/:id/:sn":function(e,r){n=!1,i();var a={id:e,sn:r};return t.runController("rate",a)},"cost-list/:id":function(e){n=!1,i();var r={id:e};return t.runController("cost-list",r)},"*":function(){return t.runController("index")}},t}),define("order/cost-list-controller",["mk7/controller","mk7/url","mk7/utils","mk7/uploadjs"],function(t,e,i,n){var r=Dom7,t=(Template7,new t),a="/user/default/upload-file",o="/order/default/submit-repair-plans";return t.run=function(){var t=this;t.setPageTitle("费用列表"),t.id=t.params.id,t.imgLimit=9,t.canSubmit=!0,t.render()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.addEvent(),t.uploadImgEvent(),t.delPlanEvent(),t.inputPriceChangeEvent(),t.submitEvent()},t.addEvent=function(){var t=this;r("#cost-list .add-repair-plan").click(function(e){var i=r("#cost-list .cost-list-div"),n=t.planTpl(i.length+1);r(n).insertBefore(r("#cost-list .cost-total-list-div"))})},t.delPlanEvent=function(){var t=this;r("#cost-list").on("click",".del-plan",function(e){console.log("del plan event"),r(this).parents(".cost-list-div").remove(),r("#cost-list .total-plan-price").html(t.computedPrice())})},t.planTpl=function(t){var e='<div class="cost-list-div"><p class="item-title">第'+t+'项</p><div class="repair-item-cls"><input type="text" class="input-left input-cls" placeholder="填写维修内容" value=""><input type="number" class="input-right input-cls" placeholder="填写价格" value="0"><span class="del-plan"></span></div></div>';return e},t.inputPriceChangeEvent=function(){var t=this;r("#cost-list").on("input propertychange",".input-cls",function(){var e=t.computedPrice();r("#cost-list .total-plan-price").html(e)})},t.computedPrice=function(){var t=r("#cost-list .input-right"),e=0;return r.each(t,function(t,i){e+=1*r(i).val()}),Math.round(e,2)},t.uploadImgEvent=function(){var t=this;r("#cost-list #upload-btn").change(function(){if(""!=r(this).val()&&null!=r(this).val()){var o=r(this).parents("li");n.uploadFile({selector:"#upload-btn",url:e.to(a),processAppendTo:"#cost-list",success:function(e,n){try{if(e.success){var a=e.tmpUrl;r('<li class="upload-li up-img"><div data="'+e.tmpFile+'" data-url="'+a+'" class="upload-item" style="background-image:url('+e.tmpMinUrl+')"></div><span class="del-img"></span></li>').insertBefore(o),t.imgLimit==r("#cost-list #image-list").find(".up-img").length&&r("#cost-list .upload-btn-li").hide()}else i.toast({content:e.message,closeDelay:5e3})}catch(s){console.log(s),i.toast({content:"出错",closeDelay:5e3})}}})}}),r("#cost-list #image-list").on("click",".del-img",function(e){r(this).parent().remove(),t.imgLimit>=r("#cost-list #image-list").find(".up-img").length&&r("#cost-list .upload-btn-li").show()})},t.submitEvent=function(){var t=this;r("#cost-list .btn-submit").click(function(n){var a=r("#cost-list .content-div").find(".repair-item-cls"),s=[],l=!0,c=!0;if(r.each(a,function(t,e){var n=i.trim(r(e).find(".input-left").val()),a=i.trim(r(e).find(".input-right").val());""==n&&(l=!1),""!=a&&0!=a||(c=!1),s.push({content:n,price:a})}),!l)return i.toast({content:"维修清单有部分未填内容"}),!1;if(!c)return i.toast({content:"维修清单有部分未填价格"}),!1;var d=r("#cost-list #image-list").find(".upload-item"),u=[];if(r.each(d,function(t,e){u.push(r(e).attr("data"))}),!t.canSubmit)return!1;t.canSubmit=!1;var m=t.csrf({images:u,plans:s,id:t.id});i.httpPost(o,m,function(n){t.canSubmit=!0,n.success?window.location.replace(e.to("order#order-details/"+t.id)):i.toast({content:n.message})},!0)})},t}),define("order/customer-order-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,e,i){var n=Dom7,t=(Template7,new t),r="order/customer/order-details";return t.run=function(){var t=this;t.id=t.params.id,t.sn=t.params.sn,t.success=!0,t.setPageTitle("维修单"),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.goToComment(),t.popupImageLayer()},t.beforeRender=function(){var t=this;console.log("beforeRender"),t.success||(this.view="customer-order-error")},t.loadPage=function(){var t=this,n=t.csrf({id:t.id});i.httpPost(e.to(r),n,function(e){var i=e;t.success=e.success,t.render(i)},!0)},t.goToComment=function(){var t=this;n("#customer-order .rate-btn-cls").click(function(i){window.location.replace(e.to("order/customer#rate/"+t.id+"/"+t.sn))})},t.popupImageLayer=function(){n("#customer-order").on("click",".view-img-cls",function(t){var e=n(this).attr("data-url");n("#img-mask").remove();var i='<div id="img-mask" style="z-index:2;background:#000;justify-content:center;position: absolute;bottom:0;top:0;width:100%;display:flex;flex-direction: column;align-items: center"><div style="width:100%;"> <img width="100%" src="'+e+'" /></div></div>';n("#customer-order").append(i)}),n("#customer-order").on("click","#img-mask, #img-mask img",function(t){t.preventDefault(),t.stopPropagation();var e=document.body.clientHeight,i=n("#img-mask img").height();console.log(e+"dddd"+i);var r=Math.abs(i-e);if(r>=0&&r<=20)n("#img-mask").remove();else{var a=n(t.target).attr("id");"img-mask"==a&&n("#img-mask").remove()}})},t}),define("order/index-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,e,i){var n=Dom7,r=Template7,t=new t,a="order/default/order-list";return t.run=function(){var t=this;t.setPageTitle("订单列表"),t.tab=t.params.tab,t.page=0,t.nodata="",t.loading=!1,t.pageCount=1,t.render({tab:t.tab}),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.tabEvent(),t.bindScrollEvent(),t.addEvent(),t.orderClickEvent()},t.tabEvent=function(){n(".tab-cls").click(function(t){var e=n(this).attr("data-href");window.location.replace(e)})},t.handleNodata=function(){var t=this;t.nodata="没有数据了";var e=n(".nodata");0==e.length&&n("#index .order-list").append('<div class="nodata">'+t.nodata+"</div>"),t.app.detachInfiniteScroll(".infinite-scroll"),n("#index .infinite-scroll-preloader").remove()},t.loadPage=function(){var t=this;if(t.loading=!0,t.page>=t.pageCount)return void t.handleNodata();var r={status:t.tab};r.page=t.page+1,r=t.csrf(r),n.ajax({method:"GET",url:e.to(a),data:r,dataType:"json",beforeSend:function(){t.showIndicator()},success:function(e){if(1==e.success&&(i.isDefined(e.page)&&(t.page=parseInt(e.page)),i.isDefined(e.page_count)&&(t.pageCount=parseInt(e.page_count)),t.renderItems(e.items,!0),t.page>=t.pageCount))return void t.handleNodata()},error:function(t){},complete:function(e){t.hideIndicator(),t.loading=!1}})},t.bindScrollEvent=function(){var t=this;t.app.attachInfiniteScroll("#index .infinite-scroll"),n("#index .infinite-scroll").on("infinite",function(){t.loading||t.nodata||t.loadPage()})},t.renderItems=function(t,e){var i=n("#index .order-list"),a=n("script#order-item-template"),o=r.compile(a.html()),s=o({list:t});0==e&&(i.html(""),i.append(s)),i.append(s)},t.addEvent=function(){n("#index .add-btn-cls").click(function(t){window.location.href=e.to("order/#submit")})},t.orderClickEvent=function(){n("#index").on("click",".order-item",function(t){var i=n(this).attr("data-id");window.location.href=e.to("order#order-details/"+i)})},t}),define("order/order-details-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,e,i){var n=Dom7,t=(Template7,new t),r="order/default/order-details";return t.run=function(){var t=this;t.id=t.params.id,t.success=!0,t.setPageTitle("维修单"),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.finishBtnEvent(),t.popupImageLayer()},t.beforeRender=function(){var t=this;console.log("beforeRender"),t.success||(t.view="order-details-error")},t.loadPage=function(){var t=this,n=t.csrf({id:t.id});i.httpPost(e.to(r),n,function(e){var i=e;t.success=e.success,t.render(i)},!0)},t.finishBtnEvent=function(){var t=this;n("#order-details .finish-submit").click(function(i){window.location.href=e.to("order/#cost-list/"+t.id)})},t.popupImageLayer=function(){n("#order-details").on("click",".view-img-cls",function(t){var e=n(this).attr("data-url");n("#img-mask").remove();var i='<div id="img-mask" style="z-index:2;background:#000;justify-content:center;position: absolute;bottom:0;top:0;width:100%;display:flex;flex-direction: column;align-items: center"><div style="width:100%;"> <img width="100%" src="'+e+'" /></div></div>';n("#order-details").append(i)}),n("#order-details").on("click","#img-mask, #img-mask img",function(t){t.preventDefault(),t.stopPropagation();var e=document.body.clientHeight,i=n("#img-mask img").height();console.log(e+"dddd"+i);var r=Math.abs(i-e);if(r>=0&&r<=20)n("#img-mask").remove(),console.log("dddd");else{var a=n(t.target).attr("id");"img-mask"==a&&n("#img-mask").remove()}})},t}),define("order/rate-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,e,i){var n=Dom7,t=(Template7,new t),r="order/customer/submit-rate";return t.run=function(){var t=this;t.id=t.params.id,t.sn=t.params.sn,t.setPageTitle("评价"),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.starClickEvent(),t.submitEvent()},t.loadPage=function(){var t=this;t.render()},t.starClickEvent=function(){n("#rate").on("click",".quality-box .img-star",function(t){var e=n(this).attr("data-id"),i=n("#rate .quality-box .img-star");n.each(i,function(t,i){var r=n(i).attr("data-id");if(1*r<=e){n(i).addClass("star-on");var a=n("#rate .quality-box").find(".rate-text"),o=n(i).attr("data-txt");a.html(o)}else n(i).removeClass("star-on")})})},t.submitEvent=function(){var t=this;n("#rate .submit-btn").click(function(a){var o=i.trim(n("#rate .text-content").val()),s=n("#rate .img-star"),l=0;n.each(s,function(t,e){n(e).hasClass("star-on")&&l++});var c=t.csrf({star:l,comment:o,id:t.id});i.httpPost(e.to(r),c,function(n){n.success?window.location.replace(e.to("order/customer#customer-order/"+t.id+"/"+t.sn)):i.toast({content:n.message})},!0)})},t}),define("order/submit-controller",["mk7/controller","mk7/url","mk7/utils","mk7/uploadjs","mk7/picker"],function(t,e,n,r,a){var o=Dom7,t=(Template7,new t),s="/user/default/upload-file",l="/order/default/submit",c=!0,d="";return t.run=function(){var t=this;t.setPageTitle("录入维修单"),t.imgLimit=9,t.render()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.uploadImgEvent(),t.submitEvent(),t.selectDateEvent()},t.uploadImgEvent=function(){var t=this;o("#submit #upload-btn").change(function(){if(""!=o(this).val()&&null!=o(this).val()){var i=o(this).parents("li");r.uploadFile({selector:"#upload-btn",url:e.to(s),processAppendTo:"#submit",success:function(e,r){try{if(e.success){var a=e.tmpUrl;o('<li class="upload-li up-img"><div data="'+e.tmpFile+'" data-url="'+a+'" class="upload-item" style="background-image:url('+e.tmpMinUrl+')"></div><span class="del-img"></span></li>').insertBefore(i),t.imgLimit==o("#submit #image-list").find(".up-img").length&&o("#submit .upload-btn-li").hide()}else n.toast({content:e.message,closeDelay:5e3})}catch(s){console.log(s),n.toast({content:"出错",closeDelay:5e3})}}})}}),o("#submit #image-list").on("click",".del-img",function(e){o(this).parent().remove(),t.imgLimit>=o("#submit #image-list").find(".up-img").length&&o("#submit .upload-btn-li").show()})},t.submitEvent=function(){var t=this;o("#submit .submit-btn-cls").click(function(i){var r=n.trim(o("#submit .carNo").val()),a=n.trim(o("#submit .carModel").val()),s=n.trim(o("#submit .customer").val()),d=n.trim(o("#submit .phone").val()),u=n.trim(o("#submit .preRepair").val()),m=n.trim(o("#submit .repairPrice").val()),v=n.trim(o("#submit .finishDate").val());if(0==c)return!1;if(""==r)return n.toast({content:"车牌号必填"}),!1;if(""==a)return n.toast({content:"车辆型号必填"}),!1;if(""==s)return n.toast({content:"客户名称必填"}),!1;if(""==d)return n.toast({content:"客联系电话必填"}),!1;if(!n.isMobile(d)&&!n.isTelephone(d))return n.toast({content:"客联系电话有误"}),!1;if(""==u)return n.toast({content:"预估维修内容必填"}),!1;if(""==m)return n.toast({content:"预估维修费用必填"}),!1;if(""==v)return n.toast({content:"预估完成时间必填"}),!1;var p=t.getUploadImgs();if(0==p.length)return n.toast({content:"请上传车损照"}),!1;c=!1;var f=t.csrf({carNo:r,carModel:a,customer:s,phone:d,preRepair:u,repairPrice:m,finishDate:v,images:p});n.httpPost(l,f,function(t){return c=!0,t.success?void window.location.replace(e.to("order#order-details/"+t.orderId)):(n.toast({content:message}),!1)},!0)})},t.getUploadImgs=function(){var t=o("#submit #image-list").find(".up-img"),e=[];return 0==t.length?[]:(o.each(t,function(t,i){var n=o(i).find(".upload-item");e.push(n.attr("data"))}),e)},t.selectDateEvent=function(){var t=this;o("#submit .finish-date-input").click(function(e){var i=o(this).val();console.log(i),t.dateTimeSelector("#submit .finish-date-input",i)})},t.dateTimeSelector=function(t,e){var n=this,r=new Date,a=30,s=r.getFullYear(),l=r.getMonth(),c=r.getDate(),u=r.getHours(),m=s+"-"+(l+1)+"-"+c;if(""!=e&&null!=e&&void 0!==e){var v=e.split(" ");m=v[0],u=v[1]}var p=[];for(i=0;i<=a;i++){var f=new Date;f.setDate(r.getDate()+i);var g=f.getFullYear()+"-"+(f.getMonth()+1)+"-"+f.getDate();p.push(g)}var h=n.app.picker({input:t,toolbarTemplate:'<div class="toolbar"><div class="toolbar-inner"><div class="left">请选择用工时间</div><div class="right"><a href="javascript:void(0);" class="link submit-confirm-picker">确定</a></div></div></div>',value:[m,u],onChange:function(t,e,i){var n,r,a;if(e[0]instanceof Date)n=e[0].getFullYear(),r=e[0].getMonth(),a=e[0].getDate();else{var o=e[0].split("-");n=o[0],r=o[1]-1,a=o[2]}var s=new Date(n,r,a,e[1],0),l=new Date((new Date).getTime()+36e5);if(s<l){if(void 0===t.cols[0])return!1;var c=l.getHours(),d=l.getFullYear()+"-"+(l.getMonth()+1)+"-"+l.getDate(),u=new Date(l.getFullYear(),l.getMonth(),l.getDate(),l.getHours(),0);if(u-new Date<9e5){var m=new Date(u.getTime()+36e5);c=m.getHours(),d=m.getFullYear()+"-"+(m.getMonth()+1)+"-"+m.getDate()}t.cols[0].setValue(d),t.cols[2].setValue(c)}},formatValue:function(t,e,i){var n="";n=e[0]instanceof Date?e[0].getFullYear()+"-"+(e[0].getMonth()+1)+"-"+e[0].getDate():e[0];var r=n+" "+e[1];return r},cols:[{values:p,displayValues:function(){var t=[],e=new Date,i=e.getFullYear(),n=e.getMonth()+1,r=e.getDate();e.setDate(e.getDate()+1);for(var a=0;a<p.length;a++){var o=p[a],s=o.split("-"),l=s[1]+"月"+s[2]+"日";i==s[0]&&1*n==s[1]&&1*r==s[2]&&(l+="(今天)"),1*e.getFullYear()==s[0]&&1*e.getMonth()+1==s[1]&&1*e.getDate()==s[2]&&(l+="(明天)"),t.push(l)}return t}()},{divider:!0,content:" "},{values:function(){for(var t=[],e=0;e<=23;e++)t.push(e);return t}(),displayValues:function(){for(var t=[],e=0;e<=23;e++)t.push(e<10?"0"+e+"时":e+"时");return t}()},{divider:!0,content:" "}],onClose:function(e){if(h){var i=h.value,n=i[1]<10?"0"+i[1]:i[1];d=i[0]+" "+n,o(t).val(d),h.destroy()}}});h.open(),o(".submit-confirm-picker").on("click",function(e){e.preventDefault();var i=h.value,n=i[1]<10?"0"+i[1]:i[1];d=i[0]+" "+n,o(t).val(d),h.destroy()})},t}); | ||
3 | \ No newline at end of file | 3 | \ No newline at end of file |
web/src/js/order/submit-controller.js
@@ -103,7 +103,7 @@ define( | @@ -103,7 +103,7 @@ define( | ||
103 | utils.toast({content:'客联系电话必填'}); | 103 | utils.toast({content:'客联系电话必填'}); |
104 | return false; | 104 | return false; |
105 | } | 105 | } |
106 | - if (!utils.isMobile(phone) && !uitls.isTelephone(phone)) { | 106 | + if (!utils.isMobile(phone) && !utils.isTelephone(phone)) { |
107 | utils.toast({content:'客联系电话有误'}); | 107 | utils.toast({content:'客联系电话有误'}); |
108 | return false; | 108 | return false; |
109 | } | 109 | } |