Commit afd2f743f6cccb9a7805b2ef07280e25e375085f

Authored by xu
1 parent f0d6cde5
Exists in master

app-ht(v0.0.1 build 3)

1. A 维修厂添加审核步骤和状态
app-wx(v0.1.0 build 13)
1. F 调整登录注册所用的手机验证码
common(v1.0.0 build 3)
1. A 添加车辆的型号
2. A 添加注册用户的附加信息表
Showing 38 changed files with 1346 additions and 353 deletions   Show diff stats
app-ht/config/params.php
1 1 <?php
2 2 return [
3   - 'VERSION' => 'v0.0.1 build 2',
  3 + 'VERSION' => 'v0.0.1 build 3',
4 4 ];
5 5 \ No newline at end of file
... ...
app-ht/modules/maintainer/controllers/UserController.php
... ... @@ -2,11 +2,12 @@
2 2  
3 3 namespace app\ht\modules\maintainer\controllers;
4 4  
5   -use common\helpers\ImageManager;
6 5 use Yii;
  6 +use yii\base\Exception;
7 7 use yii\data\Pagination;
8 8 use app\ht\controllers\BaseController;
9   -
  9 +use common\helpers\ImageManager;
  10 +use domain\user\User;
10 11 use domain\user\UserRepository;
11 12 use stdClass;
12 13 use function strtotime;
... ... @@ -39,12 +40,14 @@ class UserController extends BaseController
39 40 $endTime = $request->get('endTime');
40 41 $mobile = $request->get('mobile');
41 42 $name = $request->get('name');
  43 + $status = $request->get('status');
42 44  
43 45 $gets = [
44 46 'createTime' => $createTime,
45 47 'endTime' => $endTime,
46 48 'mobile' => $mobile,
47 49 'name' => $name,
  50 + 'status' => $status,
48 51 ];
49 52  
50 53 $where = ['and'];
... ... @@ -62,7 +65,9 @@ class UserController extends BaseController
62 65 if ($name) {
63 66 $where[] = ['like', 'user.name', $name];
64 67 }
65   -
  68 + if ($status) {
  69 + $where[] = ['=', 'user.status', $status];
  70 + }
66 71  
67 72 if ($type == 0) {
68 73 $pageList = UserRepository::getAdminUserList(0, 0, $where);
... ... @@ -79,7 +84,8 @@ class UserController extends BaseController
79 84 return [
80 85 'listdata' => $pageList,
81 86 'pages' => $pages,
82   - 'gets' => $gets
  87 + 'gets' => $gets,
  88 + 'statusList' => User::getStatusLabels(),
83 89 ];
84 90 }
85 91 /**
... ... @@ -106,18 +112,67 @@ class UserController extends BaseController
106 112 return $this->render('info', $params);
107 113 }
108 114  
  115 + $userProfile = $userModel->profile;
109 116 $user = [
110 117 'id' => $userModel->id,
111 118 'uuid' => $userModel->uuid,
112 119 'mobile' => $userModel->mobile,
113 120 'username' => $userModel->user_name,
114 121 'name' => $userModel->name,
115   - 'licensePic' => ImageManager::getUrl($userModel->license_pic),
116   - 'licensePicMin' => ImageManager::getUrl($userModel->license_pic, 'min'),
  122 + 'status' => $userModel->status,
  123 + 'status_label' => User::getStatusLabels($userModel->status),
  124 + 'emergencyContact' => $userProfile->emergency_contact,
  125 + 'emergencyPerson' => $userProfile->emergency_person,
  126 + 'licensePic' => ImageManager::getUrl($userProfile->license_pic),
  127 + 'licensePicMin' => ImageManager::getUrl($userProfile->license_pic, 'min'),
  128 + 'factoryHeadPic' => ImageManager::getUrl($userProfile->factory_head_pic),
  129 + 'factoryHeadPicMin' => ImageManager::getUrl($userProfile->factory_head_pic, 'min'),
  130 + 'techChargePic' => ImageManager::getUrl($userProfile->tech_charge_pic),
  131 + 'techChargePicMin' => ImageManager::getUrl($userProfile->tech_charge_pic, 'min'),
  132 + 'qaChargePic' => ImageManager::getUrl($userProfile->qa_charge_pic),
  133 + 'qaChargePicMin' => ImageManager::getUrl($userProfile->qa_charge_pic, 'min'),
117 134 'created_at' => $userModel->created_at
118 135 ];
119 136 $params['user'] = $user;
120 137  
121 138 return $this->render('info', $params);
122 139 }
  140 +
  141 + /**
  142 + * @return string
  143 + * @throws \yii\db\Exception
  144 + */
  145 + public function actionApprove()
  146 + {
  147 + $e = new stdClass();
  148 + $e->success = false;
  149 + $e->message = '';
  150 + $uuid = $this->request->post('id');
  151 + $userModel = UserRepository::findOne(['uuid' => $uuid]);
  152 + if (empty($userModel)) {
  153 + $e->message = '找不到该维修厂';
  154 + return $this->renderJson($e);
  155 + }
  156 + if (User::STATUS_APPROVE == $userModel->status) {
  157 + $e->message = '改维修厂已经审核通过了,无需再次审核';
  158 + return $this->renderJson($e);
  159 + }
  160 + $tran = Yii::$app->db->beginTransaction();
  161 + try {
  162 + $userModel->status = User::STATUS_APPROVE;
  163 + $userModel->save();
  164 + $userProfile = $userModel->profile;
  165 + $userProfile->approve_at = time();
  166 + $userProfile->save();
  167 + $tran->commit();
  168 + $e->success = true;
  169 + $e->message = '审核成功';
  170 + } catch(Exception $ex) {
  171 + $tran->rollBack();
  172 + $e->message = '审核失败';
  173 + }
  174 +
  175 +
  176 + return $this->renderJson($e);
  177 + }
123 178 }
124 179 \ No newline at end of file
... ...
app-ht/modules/maintainer/views/user/exportDa.php
1 1 <?php
2   -
  2 +use domain\user\User;
3 3 header('Content-Type: application/vnd.ms-excel;charset=utf-8');
4 4 $title = date('Y-m-d') . '_维修厂';
5 5 $name = $title . ".xls";
... ... @@ -27,7 +27,10 @@
27 27 <th style="width:60px">ID</th>
28 28 <th style="width:120px">维修厂名称</th>
29 29 <th style="width:100px">维修厂电话</th>
  30 + <th style="width:100px;">紧急联系人</th>
  31 + <th style="width:100px;">紧急联系电话</th>
30 32 <th style="width:100px">注册时间</th>
  33 + <th style="width:100px;">状态</th>
31 34 </tr>
32 35 </thead>
33 36 <tbody>
... ... @@ -36,8 +39,10 @@
36 39 <td class="text-center align-middle hqy-row-select"><?=$user['id'] ?></td>
37 40 <td><?=$user['name']?></td>
38 41 <td><?=$user['mobile']?></td>
  42 + <td><?=$user['emergency_person']?></td>
  43 + <td><?=$user['emergency_contact']?></td>
39 44 <td><?=date('Y-m-d H:i', $user['created_at'])?></td>
40   -
  45 + <td><?=User::getStatusLabels($user['status'])?></td>
41 46 </tr>
42 47 <?php
43 48 $cnt++;
... ...
app-ht/modules/maintainer/views/user/index.php
... ... @@ -2,8 +2,7 @@
2 2  
3 3 use yii\helpers\Url;
4 4 use app\ht\widgets\LinkPager;
5   -use domain\order\RepairOrderRate;
6   -
  5 +use domain\user\User;
7 6 $this->title = '维修厂列表';
8 7 $this->params['breadcrumbs'][] = '维修厂管理';
9 8 $this->params['breadcrumbs'][] = $this->title;
... ... @@ -33,7 +32,28 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
33 32 <td width="10%" class="text-right">注册时间(止):</td>
34 33 <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 34 </tr>
  35 + <tr >
  36 + <td width="10%" class="text-right">状态:</td>
  37 + <td width="10%" class="text-left">
  38 + <select name="status">
  39 + <option value="">全部</option>
  40 + <?php foreach($statusList as $k => $status):?>
  41 + <option value="<?=$k?>" <?php if($k == $gets['status']) echo "selected = 'selected'"?>><?=$status?></option>
  42 + <?php endforeach;?>
  43 + </select>
  44 +
  45 + </td>
  46 +
  47 + <td width="10%" class="text-right"></td>
  48 + <td width="10%" class="text-left"> </td>
36 49  
  50 +
  51 + <td width="10%" class="text-right"> </td>
  52 + <td width="10%" class="text-left"> </td>
  53 +
  54 + <td width="10%" class="text-right"> </td>
  55 + <td width="10%" class="text-left"> </td>
  56 + </tr>
37 57 <tr class="search">
38 58 <td colspan="8" class="text-center">
39 59 <button type="submit" class="btn btn-primary btncls" id="search"><i class="glyphicon glyphicon-search"></i> 查 询 </button>
... ... @@ -59,8 +79,10 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
59 79 <th style="width:4%;">ID</th>
60 80 <th style="width:10%;">维修厂名称</th>
61 81 <th style="width:10%;">维修厂电话</th>
  82 + <th style="width:10%;">紧急联系人</th>
  83 + <th style="width:10%;">紧急联系电话</th>
62 84 <th style="width:10%;">注册时间</th>
63   -
  85 + <th style="width:10%;">状态</th>
64 86 <th style="width:7%;">操作</th>
65 87 </tr>
66 88 </thead>
... ... @@ -70,8 +92,10 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
70 92 <td class="hqy-row-select"><?=$user['id'] ?></td>
71 93 <td><?=$user['name']?></td>
72 94 <td><?=$user['mobile']?></td>
  95 + <td><?=$user['emergency_person']?$user['emergency_person']: '暂无';?></td>
  96 + <td><?=$user['emergency_contact']?$user['emergency_contact']: '暂无';?></td>
73 97 <td><?=date('Y-m-d H:i', $user['created_at'])?></td>
74   -
  98 + <td><?=User::getStatusLabels($user['status'])?></td>
75 99 <td >
76 100 <a class="btn btn-primary" style="margin: 4px;" href="<?php echo Url::toRoute(['/maintainer/user/info', 'id' => $user['id']]) ?>">查看详情</a>
77 101  
... ...
app-ht/modules/maintainer/views/user/info.php
1 1 <?php
2 2  
3 3 use yii\helpers\Url;
  4 +use domain\user\User as UserStatus;
4 5 $this->title = '维修厂详情';
5 6 $this->params['breadcrumbs'][] = '维修厂管理';
6 7 $this->params['breadcrumbs'][] = ['label' => '维修厂列表', 'url' => ['/maintainer/user/index']];
... ... @@ -26,11 +27,19 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
26 27 <td colspan="4" class="bg-info">维修厂信息</td>
27 28 </tr>
28 29 <tr>
29   - <th width="100">维修厂ID</th>
30   - <td width="350"><?=$user['id']; ?></td>
31   -
32 30 <th width="100">维修厂名称</th>
33   - <td ><?=$user['name']; ?></td>
  31 + <td width="350">
  32 + <?=$user['name']; ?>
  33 + </td>
  34 +
  35 + <th width="100">状态</th>
  36 + <td >
  37 + <?=$user['status_label']?>
  38 + <?php
  39 + if (UserStatus::STATUS_APPROVE != $user['status']): ?>
  40 + <a href="javascript:void(0)" class="btn btn-primary approve-btn">审核通过</a>
  41 + <?php endif;?>
  42 + </td>
34 43 </tr>
35 44 <tr>
36 45 <th>维修厂电话</th>
... ... @@ -39,16 +48,46 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
39 48 <th>注册时间</th>
40 49 <td><?=date('Y-m-d H:i:s', $user['created_at']); ?></td>
41 50 </tr>
  51 + <tr>
  52 + <th>紧急联系人</th>
  53 + <td><?=$user['emergencyContact']; ?></td>
42 54  
  55 + <th>紧急联系电话</th>
  56 + <td><?=$user['emergencyPerson']; ?></td>
  57 + </tr>
43 58 <tr>
44 59 <th>营业执照</th>
45 60 <td><a target="_blank" href="<?=$user['licensePic']; ?>"><img width="150" src='<?=$user["licensePicMin"]?>' /></a></td>
46 61  
47   - <th></th>
48   - <td></td>
  62 + <th>门头照</th>
  63 + <td><a target="_blank" href="<?=$user['factoryHeadPic']; ?>"><img width="150" src='<?=$user["factoryHeadPic"]?>' /></a></td>
  64 + </tr>
  65 +
  66 + <tr>
  67 + <th>维修技术负责人证书</th>
  68 + <td><a target="_blank" href="<?=$user['techChargePic']; ?>"><img width="150" src='<?=$user["techChargePic"]?>' /></a></td>
  69 +
  70 + <th>质检负责人证书</th>
  71 + <td><a target="_blank" href="<?=$user['qaChargePic']; ?>"><img width="150" src='<?=$user["qaChargePic"]?>' /></a></td>
49 72 </tr>
50 73 </table>
51 74 </div>
52 75  
53   -
54 76 </div>
  77 +<script>
  78 + var approveURL = '<?=Url::to("approve") ?>';
  79 + $(function() {
  80 + $('.approve-btn').click(function(e) {
  81 + var uuid = $('#uuid').val();
  82 + if(!confirm('确定审核通过该维修厂')) {
  83 + return false;
  84 + }
  85 + $.post(approveURL,{id:uuid}, function(res) {
  86 + if (res.success) {
  87 + alert(res.message);
  88 + window.parent.document.getElementById('x-iframe').contentWindow.location.reload(true);
  89 + }
  90 + }, 'json')
  91 + })
  92 + })
  93 +</script>
... ...
app-ht/modules/order/controllers/RepairOrderController.php
... ... @@ -96,7 +96,8 @@ class RepairOrderController extends BaseController
96 96 return [
97 97 'listdata' => $pageList,
98 98 'pages' => $pages,
99   - 'gets' => $gets
  99 + 'gets' => $gets,
  100 + 'finishStatus' => RepairOrderStatus::getFinishLabels(),
100 101 ];
101 102 }
102 103 /**
... ... @@ -145,7 +146,24 @@ class RepairOrderController extends BaseController
145 146 $rateModel = RepairOrderRateRepository::findOne(['repair_order_id' => $orderId]);
146 147 if ($rateModel) {
147 148 $hasComment = true;
148   - $comments = ['starTxt' => RepairOrderRate::starLabel($rateModel->star_count), 'comment' => $rateModel->comment];
  149 + $images = [];
  150 + $imageTs = $rateModel->images;
  151 + if ($imageTs) {
  152 + $imageTs = explode(',', $imageTs);
  153 + foreach ($imageTs as $k => $image) {
  154 + $images[] = ImageManager::getUrl($image);
  155 + }
  156 + }
  157 +
  158 +
  159 + $comments = [
  160 + 'starTxt' => RepairOrderRate::starLabel($rateModel->star_count),
  161 + 'qualityStarTxt' => RepairOrderRate::starLabel($rateModel->quality_star),
  162 + 'effectStarTxt' => RepairOrderRate::starLabel($rateModel->effect_star),
  163 + 'serviceStarTxt' => RepairOrderRate::starLabel($rateModel->service_star),
  164 + 'images' => $images,
  165 + 'comment' => $rateModel->comment
  166 + ];
149 167 }
150 168 $user = UserRepository::findOne(['id' => $orderModel->user_id]);
151 169 $order = [
... ... @@ -162,8 +180,9 @@ class RepairOrderController extends BaseController
162 180 'prePrice' => $orderModel->predict_price.'元',
163 181 'preFinishDate' => $orderModel->predict_finish_time? date('Y-m-d H:00', $orderModel->predict_finish_time):'暂无',
164 182 'orderDateTime' => date('Y-m-d H:00', $orderModel->created_at),
165   - 'finishDateTime'=> $orderModel->finish_at? date('Y-m-d H:00', $orderModel->finish_at):'暂无',
  183 + 'finishDateTime'=> $orderModel->finish_at? date('Y-m-d H:00', $orderModel->finish_at): '暂无',
166 184 'status' => RepairOrderStatus::getLabels($orderModel->status),
  185 + 'repairFinishStatus' => RepairOrderStatus::getFinishLabels($orderModel->repair_finish_status),
167 186 'hasComment' => $hasComment,
168 187 'comments' => $comments,
169 188 'brokenImages' => $brokenImages,
... ...
app-ht/modules/order/views/repair-order/exportDa.php
... ... @@ -35,6 +35,7 @@ use domain\order\RepairOrderRate;
35 35 <th style="width:90px">报修时间</th>
36 36 <th style="width:90px">维修金额</th>
37 37 <th style="width:90px">订单状态</th>
  38 + <th style="width:90px">交车状态</th>
38 39 <th style="width:120px">维修厂名</th>
39 40 <th style="width:90px">维修厂电话</th>
40 41 <th style="width:60px">顾客星评</th>
... ... @@ -76,6 +77,7 @@ use domain\order\RepairOrderRate;
76 77 <td><?=date('Y-m-d H:i', $order['created_at'])?></td>
77 78 <td><?= $order['order_price']?$order['order_price']:'-'?></td>
78 79 <td><?= $gets['statusList'][$order['status']]?></td>
  80 + <td><?= $finishStatus[$order['repair_finish_status']]?></td>
79 81 <td><?= $order['maintainer']?></td>
80 82 <td><?= $order['maintainer_mobile']?></td>
81 83 <td><?php
... ...
app-ht/modules/order/views/repair-order/info.php
1 1 <?php
2 2  
3 3 use yii\helpers\Url;
4   -
  4 +use domain\order\RepairOrderStatus;
5 5  
6 6 $this->title = '维修单详情';
7 7 $this->params['breadcrumbs'][] = '维修单管理';
... ... @@ -29,13 +29,13 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
29 29 </tr>
30 30 <tr>
31 31 <th width="110">维修单ID</th>
32   - <td width="250"><?=$order['id']; ?></td>
  32 + <td width="200"><?=$order['id']; ?></td>
33 33  
34 34 <th width="110">订单状态</th>
35 35 <td width="200"><?=$order['status']; ?></td>
36 36  
37 37 <th width="110">下单时间</th>
38   - <td width="220" ><?=$order['orderDateTime']; ?></td>
  38 + <td width="200" ><?=$order['orderDateTime']; ?></td>
39 39  
40 40 <th width="110">维修完成时间</th>
41 41 <td><?=$order['finishDateTime']; ?>
... ... @@ -60,18 +60,20 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
60 60 <td> <?=$order['prePrice']?></td>
61 61 <th>预修完成时间</th>
62 62 <td><?=$order['preFinishDate']; ?></td>
63   - <th></th>
64   - <td></td>
  63 + <th>完成交车</th>
  64 + <td>
  65 + <?=$order['repairFinishStatus'];?>
  66 + </td>
65 67 </tr>
66 68 <tr>
67 69 <th>维修厂名</th>
68 70 <td> <?=$order['userName']?></td>
69 71 <th>维修厂电话</th>
70 72 <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>
  73 + <th></th>
  74 + <td></td>
  75 + <th></th>
  76 + <td></td>
75 77 </tr>
76 78 <tr>
77 79 <th>车损图片</th>
... ... @@ -89,6 +91,32 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
89 91 ?>
90 92 </td>
91 93 </tr>
  94 + <tr>
  95 + <th>评价</th>
  96 + <td>
  97 +
  98 + 质量评价:<?=isset($order['comments']['qualityStarTxt'])?$order['comments']['qualityStarTxt']:'暂无';?> <br/>
  99 + 时效评价:<?=isset($order['comments']['effectStarTxt'])?$order['comments']['effectStarTxt']:'暂无';?> <br/>
  100 + 服务评价:<?=isset($order['comments']['serviceStarTxt'])?$order['comments']['serviceStarTxt']:'暂无';?> <br/>
  101 + </td>
  102 + <th>评论内容</th>
  103 + <td> <?=isset($order['comments']['comment'])?$order['comments']['comment']:'';?></td>
  104 + <th>评价图片</th>
  105 + <td colspan="3">
  106 + <?php
  107 + if(isset($order['comments']['images']) && !empty($order['comments']['images'])) {
  108 + echo "<ul class='imgs-class'>";
  109 + foreach ($order['comments']['images'] as $k => $image) {
  110 + echo "<li class='img-li'><a href='{$image}' target='_black'><img src='{$image}' /></a></li>";
  111 + }
  112 + echo "</ul>";
  113 + } else {
  114 + echo "暂无图片";
  115 + }
  116 + ?>
  117 + </td>
  118 +
  119 + </tr>
92 120 </table>
93 121 </div>
94 122  
... ... @@ -143,8 +171,6 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
143 171 </table>
144 172 </div>
145 173  
146   -
147   -
148 174 </div>
149 175  
150 176 <script>
... ...
app-wx/config/params.php
1 1 <?php
2 2 return [
3 3 'adminEmail' => 'admin@example.com',
4   - 'VERSION' => 'v0.1.0 build 12', // 当前发布版本号: v0.1.0 是版本号 | build 1 是编译次数
  4 + 'VERSION' => 'v0.1.0 build 13', // 当前发布版本号: v0.1.0 是版本号 | build 1 是编译次数
5 5 ];
... ...
app-wx/models/UserIdentity.php
1 1 <?php namespace app\wx\models;
2 2  
3 3 use Yii;
  4 +use yii\base\Exception;
  5 +use yii\log\Logger;
4 6 use yii\web\IdentityInterface;
5 7 use app\wx\models\User as UserModel;
  8 +use common\helpers\ImageManager;
  9 +use domain\user\UserProfile;
  10 +use domain\user\User;
  11 +use domain\PhoneCodeHelper;
  12 +use domain\system\SmsMessage;
  13 +use stdClass;
6 14  
7 15 /**
8 16 * Class User
... ... @@ -101,4 +109,167 @@ class UserIdentity extends UserModel
101 109  
102 110 return self::$id;
103 111 }
  112 +
  113 + /* ----------- 以下用于登录和 ------------*/
  114 + /**
  115 + * @param $mobile
  116 + * @return stdClass
  117 + */
  118 + public static function login($mobile)
  119 + {
  120 + $e = new stdClass();
  121 + $e->success = false;
  122 + $e->message = '';
  123 + $where = ['mobile' => $mobile];
  124 + $userEntity = UserModel::findOne($where);
  125 + if (empty($userEntity)) {
  126 + $e->message = '该手机未注册, 请先注册了再来登录';
  127 + return $e;
  128 + }
  129 + if (User::STATUS_APPROVE != $userEntity->status) {
  130 + $phone = Yii::$app->params['SERVICE_PHONE'];
  131 + $e->message = '该账号还在审核中,请联系'.$phone;
  132 + return $e;
  133 + }
  134 + //$userEntity 必须是 app\wx\models\User
  135 + if(Yii::$app->getUser()->login($userEntity, 7000)) {
  136 + PhoneCodeHelper::removeLoginCode($mobile);
  137 + $e->message = '登录成功';
  138 + $e->success = true;
  139 + } else {
  140 + $e->message = '登录失败';
  141 + }
  142 +
  143 + return $e;
  144 + }
  145 +
  146 + /**
  147 + * 获取登录验证码
  148 + * @param $mobile
  149 + * @return stdClass
  150 + */
  151 + public static function getLoginVCode($mobile)
  152 + {
  153 + $e = new stdClass();
  154 + $e->success = false;
  155 + $e->code = '';
  156 + $userInfo = UserModel::findOne(['mobile' => $mobile]);
  157 + if (empty($userInfo)) {
  158 + $e->message = '登录失败,该手机未注册';
  159 + return $e;
  160 + }
  161 + $code = PhoneCodeHelper::getLoginCode($mobile);
  162 + $sms = new SmsMessage();
  163 + if ($code) {
  164 + // 发送短信
  165 + $sms->sendLoginCode($mobile, $code);
  166 + $e->message = '您的登录码已经发送,请注意查收短信!';
  167 + } else {
  168 + $code = PhoneCodeHelper::setLoginCode($mobile);
  169 + // 发送短信
  170 + $sms->sendLoginCode($mobile, $code);
  171 + $e->message = '您的登录码已经发送,请注意查收短信!';
  172 + }
  173 + $e->success = true;
  174 + $e->code = $code;
  175 +
  176 + return $e;
  177 + }
  178 +
  179 + /**
  180 + * @param $mobile
  181 + * @param $rData
  182 + * @return stdClass
  183 + */
  184 + public static function register($mobile, $rData)
  185 + {
  186 + $e = new stdClass();
  187 + $e->success = false;
  188 + // 检查车厂名称是否注册了
  189 + // 检查手机号码是否注册了
  190 + $userMobile = UserModel::findOne(['mobile' => $mobile]);
  191 +
  192 + if ($userMobile) {
  193 + if (User::STATUS_APPROVE != $userMobile->status) {
  194 + $phone = Yii::$app->params['SERVICE_PHONE'];
  195 + $e->message = '该账号还在审核中,请联系'.$phone;
  196 + } else {
  197 + $e->message = '该手机号已经注册过维修厂,请更换其他手机号';
  198 + }
  199 +
  200 + return $e;
  201 + }
  202 + $name = $rData['name'];
  203 + $licensePic = $rData['licensePic'];
  204 + $uData = [
  205 + 'mobile' => $mobile,
  206 + 'name' => $name,
  207 + 'user_name' => $mobile
  208 + ];
  209 + $tran = Yii::$app->db->beginTransaction();
  210 + try {
  211 + $userEntity = User::create($uData);
  212 + $pData = [
  213 + 'user_id' => $userEntity->id,
  214 + 'emergency_contact' => $rData['emergencyContact'],
  215 + 'emergency_person' => $rData['emergencyPerson'],
  216 + ];
  217 + $userProfile = UserProfile::create($pData);
  218 + PhoneCodeHelper::removeRegisterCode($mobile);
  219 + $userUUId = $userEntity->uuid;
  220 + $licensePicImage = ImageManager::mvUploadImage($licensePic, $userUUId);
  221 + $headPicImage = ImageManager::mvUploadImage($rData['headPic'], $userUUId);
  222 + $techChargePicImage = ImageManager::mvUploadImage($rData['techChargePic'], $userUUId);
  223 + $QAChargePicImage = ImageManager::mvUploadImage($rData['QAChargePic'], $userUUId);
  224 +
  225 + $userProfile->license_pic = $licensePicImage[0].$licensePicImage[1];
  226 + $userProfile->factory_head_pic = $headPicImage[0].$headPicImage[1];
  227 + $userProfile->tech_charge_pic = $techChargePicImage[0].$techChargePicImage[1];
  228 + $userProfile->qa_charge_pic = $QAChargePicImage[0].$QAChargePicImage[1];
  229 + $userProfile->save();
  230 + $tran->commit();
  231 + $e->success = true;
  232 + $e->message = '注册完成,账号审核通过后即可使用';
  233 + } catch (Exception $ex) {
  234 + $tran->rollBack();
  235 + Yii::getLogger()->log($ex->getMessage(), Logger::LEVEL_ERROR);
  236 + $e->message = '注册失败'.$ex->getMessage();
  237 + }
  238 +
  239 + return $e;
  240 + }
  241 +
  242 + /**
  243 + * @param $mobile
  244 + * @return stdClass
  245 + */
  246 + public static function getRegisterVCode($mobile)
  247 + {
  248 + $e = new stdClass();
  249 + $e->success = false;
  250 + $e->message = '';
  251 + $userModel = UserModel::findOne(['mobile' => $mobile]);
  252 + $sms = new SmsMessage();
  253 + if ($userModel) {
  254 + $e->message = '该手机号已注册过';
  255 + return $e;
  256 + }
  257 +
  258 + $phoneCode = PhoneCodeHelper::getRegisterCode($mobile);
  259 + if ($phoneCode) {
  260 + $code = $phoneCode;
  261 + //发送短信
  262 + $sms->sendRegCode($mobile, $code);
  263 + $e->message = '您的注册码已经发送,请注意查收短信!';
  264 + $e->code = $code;
  265 + } else {
  266 + $code = PhoneCodeHelper::setRegisterCode($mobile);
  267 + //发送短信
  268 + $sms->sendRegCode($mobile, $code);
  269 + $e->message = '您的注册码已经发送,请注意查收短信!';
  270 + $e->code = $code;
  271 + }
  272 +
  273 + return $e;
  274 + }
104 275 }
105 276 \ No newline at end of file
... ...
app-wx/modules/order/controllers/CustomerController.php
... ... @@ -66,7 +66,13 @@ class CustomerController extends CustomerBaseController
66 66 $rateModel = RepairOrderRateRepository::findOne(['repair_order_id' => $orderId]);
67 67 if ($rateModel) {
68 68 $hasComment = true;
69   - $comments = ['starTxt' => RepairOrderRate::starLabel($rateModel->star_count), 'comment' => $rateModel->comment];
  69 + $comments = [
  70 + 'starTxt' => RepairOrderRate::starLabel($rateModel->star_count),
  71 + 'qualityStarTxt' => RepairOrderRate::starLabel($rateModel->quality_star),
  72 + 'effectStarTxt' => RepairOrderRate::starLabel($rateModel->effect_star),
  73 + 'serviceStarTxt' => RepairOrderRate::starLabel($rateModel->service_star),
  74 + 'comment' => $rateModel->comment,
  75 + ];
70 76 }
71 77 $preFinishDate = '暂无';
72 78 $predictPrice = '暂无';
... ... @@ -106,9 +112,13 @@ class CustomerController extends CustomerBaseController
106 112 $e = new stdClass();
107 113 $e->success = false;
108 114 $e->message = 'ok';
109   - $star = $this->request->post('star');
  115 +
  116 + $qualityStar = $this->request->post('qualityStar');
  117 + $effectStar = $this->request->post('effectStar');
  118 + $serviceStar = $this->request->post('serviceStar');
110 119 $orderUUId = $this->request->post('id');
111 120 $comment = $this->request->post('comment');
  121 + $images = $this->request->post('images');
112 122 $userId = $this->getUserId();
113 123 $orderModel = RepairOrderRepository::findOne(['short_uuid' => $orderUUId]);
114 124 if (empty($orderModel)) {
... ... @@ -136,12 +146,22 @@ class CustomerController extends CustomerBaseController
136 146 $items = [
137 147 'ip_address' => Utils::clientIp(),
138 148 'customer_id' => 0,
139   - 'star_count' => $star,
  149 + 'quality_star' => $qualityStar,
  150 + 'effect_star' => $effectStar,
  151 + 'service_star' => $serviceStar,
140 152 'repair_order_id' => $orderModel->id,
141 153 'comment' => $comment,
  154 +
142 155 ];
143 156 $rateModel = RepairOrderRate::create($items);
144   - if($rateModel) {
  157 + $commentImages = RepairOrderRate::mvImages($orderModel->uuid, $images);
  158 + $images = [];
  159 + foreach($commentImages as $k => $v) {
  160 + $images[] = $v[0].$v[1];
  161 + }
  162 + $rateModel->images = implode(',', $images);
  163 + //$rateModel->save();
  164 + if ($rateModel && $rateModel->save()) {
145 165 $e->success = true;
146 166 $e->message = '提交成功';
147 167 } else {
... ...
app-wx/modules/order/controllers/DefaultController.php
... ... @@ -2,8 +2,6 @@
2 2  
3 3 namespace app\wx\modules\order\controllers;
4 4  
5   -use domain\order\RepairOrderRate;
6   -use domain\order\RepairOrderRateRepository;
7 5 use Yii;
8 6 use yii\helpers\HtmlPurifier;
9 7 use yii\base\Exception;
... ... @@ -14,6 +12,10 @@ use domain\order\RepairOrderRepository;
14 12 use domain\order\RepairOrderStatus;
15 13 use domain\order\RepairFinishImages;
16 14 use domain\order\RepairOrderRepairPlan;
  15 +use domain\order\RepairOrderRate;
  16 +use domain\order\RepairOrderRateRepository;
  17 +use domain\order\CarModelRepository;
  18 +use domain\system\SmsMessage;
17 19  
18 20 use stdClass;
19 21  
... ... @@ -69,7 +71,6 @@ class DefaultController extends BaseController
69 71 $predict_finish_time = strtotime($finishDate.':00:00');
70 72 }
71 73  
72   -
73 74 $data = [
74 75 'user_id' => $userId,
75 76 'car_no' => $carNo,
... ... @@ -88,6 +89,8 @@ class DefaultController extends BaseController
88 89 RepairOrderImages::createBrokenImages($repairOrder->id, $uuid, $images);
89 90 $tran->commit();
90 91 RepairOrderImages::mvBrokenImages($uuid, $images);
  92 + //$sms = new SmsMessage();
  93 + //$sms->sendSubmitInfo($phone, $finishDate);
91 94 $e->orderId = $uuid;
92 95 $e->success = true;
93 96 } catch(Exception $ex) {
... ... @@ -198,7 +201,13 @@ class DefaultController extends BaseController
198 201 $rateModel = RepairOrderRateRepository::findOne(['repair_order_id' => $orderId]);
199 202 if ($rateModel) {
200 203 $hasComment = true;
201   - $comments = ['starTxt' => RepairOrderRate::starLabel($rateModel->star_count), 'comment' => $rateModel->comment];
  204 + $comments = [
  205 + 'starTxt' => RepairOrderRate::starLabel($rateModel->star_count),
  206 + 'qualityStarTxt' => RepairOrderRate::starLabel($rateModel->quality_star),
  207 + 'effectStarTxt' => RepairOrderRate::starLabel($rateModel->effect_star),
  208 + 'serviceStarTxt' => RepairOrderRate::starLabel($rateModel->service_star),
  209 + 'comment' => $rateModel->comment,
  210 + ];
202 211 }
203 212 $shortId = $orderModel->short_uuid;
204 213 $preFinishDate = '暂无';
... ... @@ -259,14 +268,21 @@ class DefaultController extends BaseController
259 268 $orderId = $orderModel->id;
260 269 $tran = Yii::$app->db->beginTransaction();
261 270 try {
  271 + $tt = time();
  272 + $predictFinishTime = $orderModel->predict_finish_time;
  273 +
262 274 $totalPrice = RepairOrderRepairPlan::batchCreate($orderId, $repairPlans);
263 275 RepairFinishImages::createFinishImages($orderId, $orderModel->uuid, $images);
264 276 $orderModel->status = RepairOrderStatus::FINISH;
265   - $orderModel->finish_at = time();
  277 + $orderModel->finish_at = $tt;
  278 + $orderModel->repair_finish_status = RepairOrderStatus::getFinishStatus($predictFinishTime, $tt);
  279 + $orderModel->order_price = $totalPrice;
266 280 $orderModel->order_price = $totalPrice;
267 281 $orderModel->save();
268 282 $tran->commit();
269 283 RepairFinishImages::mvFinishImages($orderModel->uuid, $images);
  284 + //$sms = new SmsMessage();
  285 + //$sms->sendFinishInfo($phone, $finishDate);
270 286 $e->success = true;
271 287 } catch (Exception $ex) {
272 288 $tran->rollBack();
... ... @@ -293,25 +309,29 @@ class DefaultController extends BaseController
293 309 return $this->renderJson($e);
294 310 }
295 311 $items = [];
296   - $models = [
297   - ['name' => '宝马X1'],
298   - ['name' => '宝马X2'],
299   - ['name' => '宝马X3'],
300   - ['name' => '宝马X4'],
301   - ['name' => '宝马X5'],
302   - ['name' => '宝马X6'],
303   - ['name' => '宝马X7'],
304   - ['name' => '奔驰C200K'],
305   - ['name' => '奔驰C280'],
306   - ['name' => '奔驰E200K'],
307   - ['name' => '奔驰E230'],
308   - ['name' => '奔驰E280'],
  312 +
  313 + $where = ['and'];
  314 + $where[] = [
  315 + 'or',
  316 + ['like', 'serial', $keyword],
  317 + ['like', 'brand', $keyword],
309 318 ];
  319 + $models = CarModelRepository::findAll($where);
  320 +
310 321 foreach ($models as $k => $v) {
311   - if (false !== strpos(strtoupper($v['name']), strtoupper($keyword))) {
312   - $items[] = $v;
  322 + if (empty( $v['brand'])) {
  323 + $item = ['name' => $v['serial']];
  324 + } else {
  325 + if (false !== strpos($v['serial'], $v['brand'])) {
  326 + $item = ['name' => $v['serial']];
  327 + } else {
  328 + $item = ['name' => $v['brand'].'-'.$v['serial']];
  329 + }
313 330 }
  331 +
  332 + $items[] = $item;
314 333 }
  334 +
315 335 $e->items = $items;
316 336 $e->success = true;
317 337 return $this->renderJson($e);
... ...
app-wx/modules/order/views/default/pages/customer-order-template.php
... ... @@ -64,7 +64,16 @@ $baseUrl = Url::base(true);
64 64 position: relative;}
65 65 #customer-order .content-wrapper .comment-box{width:100%;display: flex;color:#000;align-items: center;justify-content: space-between;font-size: 1rem;}
66 66 #customer-order .content-wrapper .rate-btn-cls{color:#fff;border-radius: 1.5rem;padding:0.6rem 0.8rem;text-align: center;background:#FF8728;width:4rem;}
67   - #customer-order .content-wrapper .comment-txt-cls{color:#000;font-size: 1rem;line-height: 1.5rem }
  67 + #customer-order .content-wrapper .comment-txt-cls{color:#000;font-size: 1rem;line-height: 1.5rem}
  68 +
  69 + #customer-order #warranty-wrapper{position: absolute;top: 0;bottom: 0;width: 100%;z-index: 2;padding:3rem 2rem;box-sizing: border-box;background: rgba(0,0,0,0.3);}
  70 + #customer-order #warranty-wrapper .warranty-wrapper-inner{width:100%;background: #fff;height:100%;position: relative}
  71 + #customer-order #warranty-wrapper .paragraph-cls{width:100%;padding:0.5rem 1rem;box-sizing: border-box;margin:0.25rem 0 ;}
  72 +
  73 + #customer-order #warranty-wrapper .agree-btn{position: absolute;bottom:0;right:0;width:100%;color:#FF8728;background: #fff;padding:0.8rem 0.5rem;box-sizing: border-box;text-align: center}
  74 +
  75 + #customer-order #warranty-wrapper h2{font-size: 1.0rem;font-weight: bold;}
  76 + #customer-order #warranty-wrapper p{line-height: 1.5rem;padding:0;margin: 0;}
68 77 </style>
69 78 <script id="customer-order-template" type="text/template">
70 79 <div class="pages">
... ... @@ -131,6 +140,7 @@ $baseUrl = Url::base(true);
131 140 <div class="pic-div">
132 141 <div class="left-title-div"><span class="padding-left-1rem">车损照片</span></div>
133 142 </div>
  143 +
134 144 <div class="pic-image-div">
135 145 <div class="pic-image-list">
136 146 {{#each item.brokenImages}}
... ... @@ -143,56 +153,57 @@ $baseUrl = Url::base(true);
143 153 </div>
144 154  
145 155 {{#js_compare "'finish' == this.item.status"}}
146   - <div class="content-wrapper">
147   - <div class="content-title">维修费用清单</div>
148   - <ul class="repair-plan-list">
149   - {{#each this.item.repairPlans}}
150   - <li style="width:100%;display: flex;">
151   - <div class="bullet-point">{{@index+1}}</div>
152   - <div class="plan-right-cls">
153   - <p style="color:#000;font-size: 1rem;">{{plan}}</p>
154   - <p class="plan-price-cls">金额: ¥{{price}}</p>
155   - </div>
156   - </li>
157   - {{/each}}
158   - </ul>
159   - <div class="total-price-cls">总金额: ¥{{this.item.totalPrice}}</div>
160   - </div>
  156 + <div class="content-wrapper">
  157 + <div class="content-title">维修费用清单</div>
  158 + <ul class="repair-plan-list">
  159 + {{#each this.item.repairPlans}}
  160 + <li style="width:100%;display: flex;">
  161 + <div class="bullet-point">{{@index+1}}</div>
  162 + <div class="plan-right-cls">
  163 + <p style="color:#000;font-size: 1rem;">{{plan}}</p>
  164 + <p class="plan-price-cls">金额: ¥{{price}}</p>
  165 + </div>
  166 + </li>
  167 + {{/each}}
  168 + </ul>
  169 + <div class="total-price-cls">总金额: ¥{{this.item.totalPrice}}</div>
  170 + </div>
161 171  
162   - {{#js_compare "this.item.finishImages.length > 0"}}
163   - <div class="content-wrapper">
164   - <div class="content-title">维修完成照片</div>
165   - <div class="finish-image-list">
166   - <ul class="finish-image-ul">
167   - {{#each this.item.finishImages}}
168   - <li class="finish-image-li">
169   - <div class="finishImage view-img-cls" data-url="{{this}}" style="background-image:url('{{this}}')"> </div></li>
170   - {{/each}}
171   - </ul>
172   - </div>
173   - </div>
174   - {{/js_compare}}
  172 + {{#js_compare "this.item.finishImages.length > 0"}}
  173 + <div class="content-wrapper">
  174 + <div class="content-title">维修完成照片</div>
  175 + <div class="finish-image-list">
  176 + <ul class="finish-image-ul">
  177 + {{#each this.item.finishImages}}
  178 + <li class="finish-image-li">
  179 + <div class="finishImage view-img-cls" data-url="{{this}}" style="background-image:url('{{this}}')"> </div></li>
  180 + {{/each}}
  181 + </ul>
  182 + </div>
  183 + </div>
  184 + {{/js_compare}}
175 185  
176   - <div class="content-wrapper" style="font-size: 1rem;">
177   - GK车管家 <span style="color:#FF8728">《质保承诺》</span>
178   - </div>
  186 + <div class="content-wrapper" style="font-size: 1rem;">
  187 + GK车管家 <span style="color:#FF8728" class="warranty-btn">《质保承诺》</span>
  188 + </div>
179 189  
180   - {{#js_compare "'finish' == this.item.status"}}
181   - <div class="content-wrapper">
182   - {{#js_compare "true == this.item.hasComment"}}
183   - <div class="content-title" style="padding-bottom: 0.5rem">评价</div>
184   - <div class="comment-txt-cls">服务评价:{{this.item.comments.starTxt}}</div>
185   - <div class="comment-txt-cls">{{this.item.comments.comment}}</div>
186   - {{else}}
187   - <div class="comment-box"><div>您对此次维修服务体验如何?</div>
188   - <div class="rate-btn-cls">去评价</div>
189   - </div>
190   - {{/js_compare}}
191   - </div>
192   - {{/js_compare}}
  190 + {{#js_compare "'finish' == this.item.status"}}
  191 + <div class="content-wrapper">
  192 + {{#js_compare "true == this.item.hasComment"}}
  193 + <div class="content-title" style="padding-bottom: 0.5rem">评价</div>
  194 + <div class="comment-txt-cls">质量评价:{{this.item.comments.qualityStarTxt}}</div>
  195 + <div class="comment-txt-cls">时效评价:{{this.item.comments.effectStarTxt}}</div>
  196 + <div class="comment-txt-cls">服务评价:{{this.item.comments.serviceStarTxt}}</div>
  197 + <div class="comment-txt-cls">{{this.item.comments.comment}}</div>
  198 + {{else}}
  199 + <div class="comment-box"><div>您对此次维修服务体验如何?</div>
  200 + <div class="rate-btn-cls">去评价</div>
  201 + </div>
  202 + {{/js_compare}}
  203 + </div>
  204 + {{/js_compare}}
193 205 {{/js_compare}}
194 206  
195   -
196 207 </div>
197 208 </div>
198 209 </div>
... ... @@ -201,8 +212,31 @@ $baseUrl = Url::base(true);
201 212 <div class="pages">
202 213 <div class="page" id="customer-order" style="background: #fff">
203 214 <div class="page-content">
204   - <div style="width:100%;line-height:2.5rem;text-align: center;background:#fff;">{{this.message}}</div>
  215 + <div style="width:100%;line-height:2.5rem;text-align: center;background:#fff;">{{this.message}}</div>
205 216 </div>
206 217 </div>
207 218 </div>
  219 +</script>
  220 +<script id="warranty-template" type="text/template">
  221 + <div class="warranty-wrapper" id="warranty-wrapper">
  222 + <div class="warranty-wrapper-inner">
  223 + <div class="agree-btn">确定</div>
  224 + <div class="warranty-list-div" style="width:100%;height:calc(100% - 50px);;overflow-y: scroll">
  225 + <div class="paragraph-cls">
  226 + <h2>维修厂质量保修承诺书</h2>
  227 + <p>一、更换的配件保证期为6个月或两万公里(超出其中一项即为超出保证期)。</p>
  228 + <p>二、在保证期内,凡属于更换的配件质量,维修工艺,装配调整等质量缺陷而引起车辆(或零部件)损坏,本店应予以免费保修。</p>
  229 + <p>三、特殊零部件的保修承诺<br/>
  230 + 1、玻璃及外观装饰件的质量问题,自客户维修出厂之日起,本店三个月内予以保修;<br/>
  231 + 2、蓄电池、喇叭自用户出厂之日起,保修半年;<br/>
  232 + 3、橡胶件、密封条、塑料制品、外观装饰件,内饰板等自出厂之日起,保修一年;<br/>
  233 + 4、正常损耗和易损件不于保修,灯泡(大灯、雾灯除外)、保险丝、制动蹄、雨刷片等;<br/>
  234 + 5、机油滤清器、汽油滤清器、空气滤芯、火花塞、辅料等,只对其第一更换周期内的质量予以保修。</p>
  235 + <p>四、钣金喷漆质保期终身(腻子开裂,漆面失光,变色)本店予以免费维修。如有外力导致脱漆或开裂,本店不予以保修!</p>
  236 +
  237 + </div>
  238 +
  239 + </div>
  240 + </div>
  241 + </div>
208 242 </script>
209 243 \ No newline at end of file
... ...
app-wx/modules/order/views/default/pages/order-details-template.php
... ... @@ -175,8 +175,8 @@ $baseUrl = Url::base(true);
175 175 </div>
176 176 {{/js_compare}}
177 177  
178   - <div class="content-wrapper" style="font-size: 1rem;">
179   - GK车管家 <span style="color:#FF8728">《质保承诺》</span>
  178 + <div class="content-wrapper" style="font-size: 1rem;display:none">
  179 + GK车管家 <span style="color:#FF8728" class="agreement-btn">《平台车管家服务条款》</span>
180 180 </div>
181 181 {{#js_compare "true == this.showCustomerComment && false == this.item.hasComment"}}
182 182 <div class="content-wrapper" style="font-size: 1rem;">
... ... @@ -186,7 +186,9 @@ $baseUrl = Url::base(true);
186 186 <div class="content-wrapper">
187 187 {{#js_compare "true == this.item.hasComment"}}
188 188 <div class="content-title" style="padding-bottom: 0.5rem">评价</div>
189   - <div class="comment-txt-cls">服务评价:{{this.item.comments.starTxt}}</div>
  189 + <div class="comment-txt-cls">质量评价:{{this.item.comments.qualityStarTxt}}</div>
  190 + <div class="comment-txt-cls">时效评价:{{this.item.comments.effectStarTxt}}</div>
  191 + <div class="comment-txt-cls">服务评价:{{this.item.comments.serviceStarTxt}}</div>
190 192 <div class="comment-txt-cls">{{this.item.comments.comment}}</div>
191 193 {{else}}
192 194 <div class="comment-box">车主暂未评价</div>
... ...
app-wx/modules/order/views/default/pages/rate-template.php
... ... @@ -6,17 +6,39 @@ $baseUrl = Url::base(true);
6 6 body,div,p,span,input{padding: 0;margin: 0}
7 7 input{-webkit-appearance: none;}
8 8 #rate .content-div { background: #fff; height: auto;padding: 1rem}
9   - #rate .page-content{ background-color: #ECF0F2 }
10   - #rate .rate-title { height:1.06rem; font-size:1.06rem; font-weight:400; color:rgba(9,9,9,1); line-height:0.75rem;margin-bottom:0.5rem;}
11   - #rate .rate-title-two { height:1.06rem; font-size:1.06rem; font-weight:400; color:rgba(9,9,9,1); line-height:0.75rem; padding-top: 2rem;}
12   - #rate .comment-div {margin-top: 0.3rem;display: flex;border:1px solid #DDD;line-height: 1.25rem}
13   - #rate .star-row{margin-bottom: 0.6rem;}
14   - #rate .img-star {width: 1.47rem; height: 1.47rem; float: left; vertical-align: middle; margin-right: 1rem;background-image:url(<?= $baseUrl . "/i/order/rate/rate_no_select.png"?>);background-repeat: no-repeat;background-size: 1.47rem auto;}
  9 + #rate .page-content{ background-color: #ECF0F2 }#rate .upload-box .upload-title
  10 +
  11 + #rate .rate-title { height:1.06rem; font-size:1.06rem; font-weight:400; color:rgba(9,9,9,1); line-height:0.75rem;margin-right:1rem;}
  12 + #rate .rate-title-two { height:1.06rem; font-size:1.06rem; font-weight:400; color:rgba(9,9,9,1); line-height:0.75rem; padding-top: 1rem;}
  13 + #rate .comment-div {margin-top: 0.3rem;display: flex;border:1px solid #DDD;line-height: 1.06rem}
  14 + #rate .star-row{display:flex;align-items: center;margin-bottom:0.4rem}
  15 + #rate .img-star {width: 1.4rem; height: 1.4rem; float: left; vertical-align: middle; margin-right: 0.8rem;background-image:url(<?= $baseUrl . "/i/order/rate/rate_no_select.png"?>);background-repeat: no-repeat;background-size: 1.4rem auto;}
15 16 #rate .star-on{background-image:url(<?= $baseUrl . "/i/order/rate/rate_star.png"?>);}
16 17 #rate .text-content {width: 100%;height: 7.5rem; resize: none;line-height:inherit;padding: 0.5rem;font-size: 1rem}
17 18 #rate .btn-box{width:100%;display: block;padding:1rem;box-sizing: border-box;margin-top:2rem;}
18 19 #rate .rate-text { font-size:0.94rem; font-weight:400; color:rgba(0,0,0,1); line-height:1.75rem;}
  20 +
  21 +
  22 + #rate .upload-box{padding: 1rem 0 ;box-sizing: border-box;background:#fff;}
  23 + #rate .upload-box .upload-title{line-height: 1.5rem;color:#000000;margin-bottom: 0;font-size:1rem;}
  24 + #rate .upload-box .note-cls{color:#555555;font-size:0.75rem}
  25 + #rate .img-box-cls{width:100%;}
  26 + #rate .img-box-cls .upload-li{width:25%;display:block;padding-right:0.2rem;padding-bottom: 0.2rem;float:left;box-sizing: border-box;position:relative}
  27 + #rate .upload-box .upload-item{width:100%;height:0;padding-bottom: 100%;overflow:hidden;
  28 + background-position: center center;
  29 + background-repeat: no-repeat;
  30 + -webkit-background-size:cover;
  31 + -moz-background-size:cover;background-size:cover;position: relative}
  32 + #rate .upload-box .upload-item{background-image:url('<?=$baseUrl?>/i/order/upload-convert.png?v=1');background-repeat: no-repeat;}
  33 + #rate .upload-box .upload-input-cls{width: 100%;display: block;background: rgba(0,0,0,0);opacity: 0;height: 0;padding-bottom: 100%;}
  34 + #rate .upload-box .upload-btn-cls{border: 1px dashed #b4b4b4;box-sizing: border-box}
  35 + #rate .upload-box .del-img{position: absolute;top: 0;left: 0;width: 0.8rem;height: 0.9rem;background-image:url('<?=$baseUrl?>/i/order/trash.png');background-repeat: no-repeat;background-size: 0.8rem auto;background-color:#fff;border-radius: 0.2rem;}
  36 +
  37 +
19 38 #rate .submit-cls{background:#FF8728;color:#fff;border-radius: 1.2rem;box-sizing: border-box;padding:0.8rem 1rem;width:80%;margin: 0 auto;text-align: center}
  39 +
  40 +
  41 +
20 42 </style>
21 43 <script id="rate-template" type="text/template">
22 44 <div class="pages">
... ... @@ -24,7 +46,7 @@ $baseUrl = Url::base(true);
24 46 <div class="page-content">
25 47 <div class="content-div">
26 48 <div class="star-row quality-row">
27   - <div class="rate-title">服务评价</div>
  49 + <div class="rate-title">质量</div>
28 50 <div class="star-div quality-box">
29 51 <div class="img-star star-on" data-id="1" data-txt="很差"></div>
30 52 <div class="img-star star-on" data-id="2" data-txt="差"></div>
... ... @@ -35,11 +57,46 @@ $baseUrl = Url::base(true);
35 57 </div>
36 58 </div>
37 59  
  60 + <div class="star-row effect-row">
  61 + <div class="rate-title">时效</div>
  62 + <div class="star-div effect-box">
  63 + <div class="img-star star-on" data-id="1" data-txt="很差"></div>
  64 + <div class="img-star star-on" data-id="2" data-txt="差"></div>
  65 + <div class="img-star star-on" data-id="3" data-txt="一般"></div>
  66 + <div class="img-star" data-id="4" data-txt="满意"></div>
  67 + <div class="img-star" data-id="5" data-txt="很满意"></div>
  68 + <span class="rate-text">一般</span>
  69 + </div>
  70 + </div>
  71 +
  72 + <div class="star-row service-row">
  73 + <div class="rate-title">服务</div>
  74 + <div class="star-div service-box">
  75 + <div class="img-star star-on" data-id="1" data-txt="很差"></div>
  76 + <div class="img-star star-on" data-id="2" data-txt="差"></div>
  77 + <div class="img-star star-on" data-id="3" data-txt="一般"></div>
  78 + <div class="img-star" data-id="4" data-txt="满意"></div>
  79 + <div class="img-star" data-id="5" data-txt="很满意"></div>
  80 + <span class="rate-text">一般</span>
  81 + </div>
  82 + </div>
38 83  
39 84 <div class="rate-title-two">说说你的感受</div>
40 85 <div class="comment-div">
41 86 <textarea class="text-content" placeholder="说说此次服务的优点和不足的地方吧"></textarea>
42 87 </div>
  88 + <div class="upload-box">
  89 + <div class="upload-title">上传图片 <span class="note-cls">(选传,最多4张)</span></div>
  90 + <div class="img-box-cls">
  91 + <ul id ="image-list" style="overflow: hidden;margin-top:0.1rem">
  92 + <li class="upload-li upload-btn-li">
  93 + <div class="upload-item upload-btn-cls">
  94 + <input type="file" id="upload-btn" class="upload-input-cls" name="file" accept="image/*"/>
  95 + </div>
  96 + </li>
  97 + </ul>
  98 + </div>
  99 + </div>
43 100 </div>
44 101  
45 102 <div class="btn-box">
... ...
app-wx/modules/order/views/default/pages/submit-template.php
... ... @@ -54,7 +54,7 @@ $baseUrl = Url::base(true);
54 54 .pages #search-wrapper .model-list{padding: 0 0.8rem;width: 100%;box-sizing: border-box;}
55 55 .pages #search-wrapper .model-list .model-div-cls{padding-bottom: 0.3rem;border-bottom: 1px solid #ccc;line-height: 1.5rem}
56 56 .pages #search-wrapper .model-list .model-item-cls{padding:0.5rem 0;padding-top:0;width: 100%;}
57   -
  57 + .pages #search-wrapper .model-list>.model-item-cls:last-child .model-div-cls{border-bottom:0}
58 58 #search-wrapper .search-form{display:flex;width:100%;}
59 59 #search-wrapper .model-search-cls{background:#EFEFEF;color:#2c2a2a;width: 5rem;text-align: center;padding: 0.3rem;box-sizing: border-box;margin-left: 0.2rem;}
60 60 #search-wrapper .search-input-box{width:100%;background:#EFEFEF;padding: 0.3rem;box-sizing: border-box;}
... ... @@ -116,7 +116,7 @@ $baseUrl = Url::base(true);
116 116 </li>
117 117 <li class="s-li-item">
118 118 <div class="s-li-div">
119   - <label class="s-li-label">预估完成时间</label>
  119 + <label class="s-li-label">预估完成时间<span class="require-cls">*</span></label>
120 120 <div class="s-li-div-input-box finish-date-btn" style="position: relative">
121 121 <input class="s-li-div-input finishDate finish-date-input" type="text" value="" readonly placeholder="请填写预估完成时间" />
122 122 <span class="down-arrow date-arrow"></span>
... ... @@ -146,7 +146,7 @@ $baseUrl = Url::base(true);
146 146 </div>
147 147 </div>
148 148 </script>
149   -<script id="search-carr-model-template" type="text/template">
  149 +<script id="search-car-model-template" type="text/template">
150 150 <div class="search-wrapper" id="search-wrapper">
151 151 <div class="search-wrapper-inner">
152 152 <div class="search-box-cls" style="display:flex;"><span class="closeBtn"></span>
... ...
app-wx/modules/user/controllers/LoginController.php
... ... @@ -3,14 +3,9 @@
3 3 namespace app\wx\modules\user\controllers;
4 4  
5 5 use Yii;
6   -use app\wx\models\User as ClientUserModel;
7   -use domain\user\User;
8 6 use common\helpers\Utils;
9   -use common\helpers\Log as AppLog;
10   -use domain\user\UserRepository;
11   -use common\helpers\ImageManager;
12   -use domain\user\PhoneCode;
13   -use domain\system\SmsMessage;
  7 +use app\wx\models\UserIdentity;
  8 +use domain\PhoneCodeHelper;
14 9 use stdClass;
15 10  
16 11 /**
... ... @@ -18,7 +13,6 @@ use stdClass;
18 13 */
19 14 class LoginController extends BaseController
20 15 {
21   - const CODE_EXPIRE = 120;
22 16 /**
23 17 * @return string
24 18 */
... ... @@ -27,7 +21,7 @@ class LoginController extends BaseController
27 21 $e = new stdClass();
28 22 $e->success = false;
29 23 $e->message = 'ok';
30   - $e->codeDuration = self::CODE_EXPIRE;
  24 + $e->codeDuration = PhoneCodeHelper::CODE_EXPIRE;
31 25 $action = $this->request->get('action');
32 26 $mobile = $this->request->get('mobile');
33 27 if (!Utils::isPhone($mobile)) {
... ... @@ -36,144 +30,25 @@ class LoginController extends BaseController
36 30 }
37 31  
38 32 if ('login' == $action) {
39   - $userInfo = ClientUserModel::findOne(['mobile' => $mobile]);
40   - if (empty($userInfo)) {
41   - $e->message = '登录失败,该手机未注册';
42   - return $this->renderJson($e);
43   - }
44   - $code = $this->getLoginCode($mobile);
45   - $sms = new SmsMessage();
46   - if ($code) {
47   - // 发送短信
48   - $sms->sendLoginCode($mobile, $code);
49   - $e->message = '您的登录码已经发送,请注意查收短信!';
50   - } else {
51   - $code = $this->setLoginCode($mobile);
52   - // 发送短信
53   - $sms->sendLoginCode($mobile, $code);
54   - $e->message = '您的登录码已经发送,请注意查收短信!';
55   - }
56   -
  33 + $codeRe = UserIdentity::getLoginVCode($mobile);
  34 + $e->success = $codeRe->success;
  35 + $e->message = $codeRe->message;
  36 + $code = $codeRe->code;
57 37 } else {
58   - $userModel = ClientUserModel::findOne(['mobile' => $mobile]);
59   - $sms = new SmsMessage();
60   - if ($userModel) {
61   - $e->message = '该手机号码已经注册过';
62   - return $this->renderJson($e);
63   - }
64   -
65   - $phoneCode = $this->getRegisterCode($mobile);
66   - if ($phoneCode) {
67   - $code = $phoneCode;
68   - //发送短信
69   - $sms->sendRegCode($mobile, $code);
70   - $e->message = '您的注册码已经发送,请注意查收短信!';
71   - } else {
72   - $code = $this->setRegisterCode($mobile);
73   - //发送短信
74   - $sms->sendRegCode($mobile, $code);
75   - $e->message = '您的注册码已经发送,请注意查收短信!';
76   - }
  38 + $codeRe = UserIdentity::getRegisterVCode($mobile);
  39 + $e->success = $codeRe->success;
  40 + $e->message = $codeRe->message;
  41 + $code = $codeRe->code;
77 42 }
78 43  
79 44 $e->success = true;
  45 + // 测试用
80 46 $e->testCode = $code;
81 47  
82 48 return $this->renderJson($e);
83 49 }
84 50  
85 51 /**
86   - * @param $mobile
87   - * @return string
88   - */
89   - private function setRegisterCode($mobile)
90   - {
91   - $session = Yii::$app->session;
92   - $code = Utils::randRegCode(6);
93   - $codeKey = $mobile."_".PhoneCode::REGISTER_TYPE;
94   - $sessionStr = json_encode(['content' => $code, 'expire_at' => time() + self::CODE_EXPIRE]);
95   - $session->set($codeKey, $sessionStr);
96   -
97   - return $code;
98   - }
99   -
100   - /**
101   - * @param $mobile
102   - * @return bool
103   - */
104   - private function removeRegisterCode($mobile)
105   - {
106   - $session = Yii::$app->session;
107   - $codeKey = $mobile."_".PhoneCode::REGISTER_TYPE;
108   - return $session->remove($codeKey);
109   - }
110   -
111   - /**
112   - * @param $mobile
113   - * @return mixed
114   - */
115   - private function getRegisterCode($mobile)
116   - {
117   - $session = Yii::$app->session;
118   - $codeKey = $mobile."_".PhoneCode::REGISTER_TYPE;
119   - $sessionContent = $session->get($codeKey);
120   - if (!$sessionContent) {
121   - return null;
122   - }
123   -
124   - $sessionContent = json_decode($sessionContent, true);
125   - if ($sessionContent && isset($sessionContent['expire_at']) && $sessionContent['expire_at'] > time()) {
126   - return $sessionContent['content'];
127   - } else {
128   - $session->remove($codeKey);
129   - return null;
130   - }
131   - }
132   -
133   - /**
134   - * @param $mobile
135   - * @return mixed
136   - */
137   - private function getLoginCode($mobile)
138   - {
139   - $session = Yii::$app->session;
140   - $codeKey = $mobile."_".PhoneCode::LOGIN_TYPE;
141   - $sessionContent = $session->get($codeKey);
142   - if (!$sessionContent) {
143   - return null;
144   - }
145   - $sessionContent = json_decode($sessionContent, true);
146   - if ($sessionContent && isset($sessionContent['expire_at']) && $sessionContent['expire_at'] > time()) {
147   - return $sessionContent['content'];
148   - } else {
149   - $session->remove($codeKey);
150   - return null;
151   - }
152   - }
153   -
154   - /**
155   - * @param $mobile
156   - * @return string
157   - */
158   - private function setLoginCode($mobile)
159   - {
160   - $session = Yii::$app->session;
161   - $code = Utils::randRegCode(6);
162   - $codeKey = $mobile."_".PhoneCode::LOGIN_TYPE;
163   - $sessionStr = json_encode(['content' => $code, 'expire_at' => time() + self::CODE_EXPIRE]);
164   - $session->set($codeKey, $sessionStr);
165   -
166   - return $code;
167   - }
168   -
169   - private function removeLoginCode($mobile)
170   - {
171   - $session = Yii::$app->session;
172   - $codeKey = $mobile."_".PhoneCode::LOGIN_TYPE;
173   - $session->remove($codeKey);
174   - }
175   -
176   - /**
177 52 * 注册界面
178 53 * @return string
179 54 */
... ... @@ -186,6 +61,12 @@ class LoginController extends BaseController
186 61 $mobile = $this->request->post('mobile');
187 62 $code = $this->request->post('code');
188 63 $licensePic = $this->request->post('licensePic');
  64 + $headPic = $this->request->post('headPic');
  65 + $techChargePic = $this->request->post('techChargePic');
  66 + $QAChargePic = $this->request->post('QAChargePic');
  67 + $emergencyContact = $this->request->post('emergencyContact');
  68 + $emergencyPerson = $this->request->post('emergencyPerson');
  69 +
189 70 if (empty($name)) {
190 71 $e->message = '车厂名称必填';
191 72 return $this->renderJson($e);
... ... @@ -200,12 +81,36 @@ class LoginController extends BaseController
200 81 $e->message = '验证码必填';
201 82 return $this->renderJson($e);
202 83 }
  84 +
  85 + if (empty($emergencyPerson)) {
  86 + $e->message = '紧急联系人必填';
  87 + return $this->renderJson($e);
  88 + }
  89 + if (empty($emergencyContact)) {
  90 + $e->message = '紧急联系电话必填';
  91 + return $this->renderJson($e);
  92 + }
  93 +
203 94 if (empty($licensePic)) {
204 95 $e->message = '请上传营业执照';
205 96 return $this->renderJson($e);
206 97 }
  98 +
  99 + if (empty($headPic)) {
  100 + $e->message = '请上传维修厂门头照';
  101 + return $this->renderJson($e);
  102 + }
  103 +
  104 + if (empty($techChargePic)) {
  105 + $e->message = '请上传维修技术负责人证书';
  106 + return $this->renderJson($e);
  107 + }
  108 + if (empty($QAChargePic)) {
  109 + $e->message = '请上传质检负责人证书';
  110 + return $this->renderJson($e);
  111 + }
207 112 // 校验验证码
208   - $vcode = $this->getRegisterCode($mobile);
  113 + $vcode = PhoneCodeHelper::getRegisterCode($mobile);
209 114 if (empty($vcode)) {
210 115 $e->message = '验证码已经超时请重新发送';
211 116 return $this->renderJson($e);
... ... @@ -214,31 +119,15 @@ class LoginController extends BaseController
214 119 $e->message = '验证码不对';
215 120 return $this->renderJson($e);
216 121 }
217   - // 检查车厂名称是否注册了
218   - // 检查手机号码是否注册了
219   - $userMobile = ClientUserModel::findOne(['mobile' => $mobile]);
220   - if ($userMobile) {
221   - $e->message = '该手机号已经注册过维修厂,请更换其他手机号';
222   - return $this->renderJson($e);
223   - }
224 122  
225   - $uData = [
226   - 'mobile' => $mobile,
227   - 'name' => $name,
228   - 'user_name' => $mobile
  123 + $rData = [
  124 + 'name' => $name, 'emergencyContact' => $emergencyContact, 'emergencyPerson' => $emergencyPerson,
  125 + 'licensePic' => $licensePic, 'headPic' => $headPic, 'techChargePic' => $techChargePic ,'QAChargePic' => $QAChargePic
229 126 ];
230   - $userEntity = User::create($uData);
231   - $this->removeRegisterCode($mobile);
232   - $saveImageInfo = ImageManager::mvUploadImage($licensePic, $userEntity->uuid);
233   - $userEntity->license_pic = $saveImageInfo[0].$saveImageInfo[1];
234   - $userEntity->save();
235   - // 必须用 app\wx\models\User 才能登录
236   - $loginUserModel = ClientUserModel::findOne(['id' => $userEntity->id]);
237   - if ($this->processLogin($loginUserModel)) {
238   - $e->success = true;
239   - } else {
240   - $e->message = '注册成功但是登录失败';
241   - }
  127 + $regResult = UserIdentity::register($mobile, $rData);
  128 +
  129 + $e->success = $regResult->success;
  130 + $e->message = $regResult->message;
242 131  
243 132 return $this->renderJson($e);
244 133 }
... ... @@ -266,7 +155,7 @@ class LoginController extends BaseController
266 155 }
267 156  
268 157 // 校验验证码
269   - $logVcode = $this->getLoginCode($mobile);
  158 + $logVcode = PhoneCodeHelper::getLoginCode($mobile);
270 159 if (empty($logVcode)) {
271 160 $e->message = '该手机登录码过期';
272 161 return $this->renderJson($e);
... ... @@ -276,39 +165,13 @@ class LoginController extends BaseController
276 165 return $this->renderJson($e);
277 166 }
278 167  
279   - $where = ['mobile' => $mobile];
280   - $userInfo = ClientUserModel::findOne($where);
281   - if (empty($userInfo)) {
282   - $e->message = '登录失败,该手机未注册';
283   - return $this->renderJson($e);
284   - }
285   - if($this->processLogin($userInfo)) {
286   - $this->removeLoginCode($mobile);
287   - $e->success = true;
288   - } else {
289   - $e->message = '登录失败';
290   - }
  168 + $loginRe = UserIdentity::login($mobile);
  169 + $e->success = $loginRe->success;
  170 + $e->message = $loginRe->message;
291 171  
292 172 return $this->renderJson($e);
293 173 }
294 174  
295   -
296   - /**
297   - * 处理用户登录逻辑
298   - * @param User $userEntity
299   - * @return bool|void
300   - */
301   - protected function processLogin($userEntity)
302   - {
303   - /**
304   - * 登陆时间为7000秒,目前微信API的access token 的 expires_in 为 7200秒
305   - */
306   - if(Yii::$app->getUser()->login($userEntity, 7000)) {
307   - return true;
308   - }
309   - return false;
310   - }
311   -
312 175 public function actionLogout()
313 176 {
314 177 Yii::$app->user->logout();
... ...
app-wx/modules/user/views/default/pages/register-template.php
... ... @@ -27,7 +27,7 @@ $baseUrl = Url::base(true);
27 27 -moz-background-size:cover;background-size:cover;position: relative}
28 28 #register .upload-box .upload-item{background-image:url('<?=$baseUrl?>/i/user/upload-convert.png');background-repeat: no-repeat;background-position: 0 0}
29 29 #register .upload-box .upload-input-cls{width: 100%;display: block;background: rgba(0,0,0,0);opacity: 0;height: 0;padding-bottom: 100%;}
30   - #register .action-box{padding:1rem;box-sizing:border-box;padding-top:3rem;}
  30 + #register .action-box{padding:1rem;box-sizing:border-box;}
31 31 #register .register-btn-cls{width:80%;border-radius: 2rem; padding:0.8rem 1rem;text-align:center;box-sizing: border-box;color:#fff;background:#FF8728;margin: 0 auto;font-size:1.13rem}
32 32 #register .count-down-cls{font-size:0.7rem;color:#999}
33 33 #register .login-btn-cls{color:#4C4C4C;font-size:1rem;margin-top: 1rem; text-align: center}
... ... @@ -37,7 +37,23 @@ $baseUrl = Url::base(true);
37 37 #register input::input-placeholder{
38 38 color:#BCBCBC
39 39 }
  40 + #register .legal-agreement{padding:0.2rem 2rem;width: 100%;box-sizing: border-box;display:flex;align-items: center}
  41 + #register .check-agreement{width:1rem;height: 1rem;display: block;border:1px solid #ccc;border-radius: 1rem;}
  42 + #register .legal-agreement .checked-active{border:1px solid #FF8728;background: #FF8728;position: relative}
  43 + #register .legal-agreement .checked-active:after{content: '';position: absolute;top: 4px;left: 3px;width: 0.50rem;height: 0.2rem;border-top: 0.125rem solid #fff;border-right: 0.125rem solid #fff;transform: rotate(135deg);}
  44 + #register .agreement-cls,
  45 + #register .agreement-cls:hover,
  46 + #register .agreement-cls:active,
  47 + #register .agreement-cls:visited{color:#FF8728;font-size:0.8rem;}
40 48  
  49 + #register #agreement-wrapper{position: absolute;top: 0;bottom: 0;width: 100%;z-index: 2;padding:3rem 2rem;box-sizing: border-box;background: rgba(0,0,0,0.3);}
  50 + #register #agreement-wrapper .agreement-wrapper-inner{width:100%;background: #fff;height:100%;position: relative}
  51 + #register #agreement-wrapper .paragraph-cls{width:100%;padding:0.5rem 1rem;box-sizing: border-box;margin:0.25rem 0 ;}
  52 +
  53 + #register #agreement-wrapper .agree-btn{position: absolute;bottom:0;right:0;width:100%;color:#FF8728;background: #fff;padding:0.8rem 0.5rem;box-sizing: border-box;text-align: center}
  54 +
  55 + #register #agreement-wrapper h2{font-size: 1.0rem;font-weight: bold;}
  56 + #register #agreement-wrapper p{line-height: 1.5rem;padding:0;margin: 0;}
41 57 </style>
42 58 <script id="register-template" type="text/template">
43 59 <div class="pages">
... ... @@ -49,9 +65,12 @@ $baseUrl = Url::base(true);
49 65 </div>
50 66 <div class="input-list">
51 67 <div class="input-row-cls"><label class="input-label-cls"></label>
52   - <div class="input-div"><input class="input-cls name" type="text" placeholder="输入维修厂名" /></div></div>
  68 + <div class="input-div"><input class="input-cls name" type="text" placeholder="输入维修厂名" /></div>
  69 + </div>
53 70  
54   - <div class="input-row-cls"><label class="input-label-cls"></label><div class="input-div"><input class="input-cls mobile" type="number" placeholder="输入手机号码" /></div></div>
  71 + <div class="input-row-cls">
  72 + <label class="input-label-cls"></label><div class="input-div"><input class="input-cls mobile" type="number" placeholder="输入手机号码" /></div>
  73 + </div>
55 74  
56 75 <div class="input-row-cls">
57 76 <label class="input-label-cls"></label>
... ... @@ -60,6 +79,13 @@ $baseUrl = Url::base(true);
60 79 <div class="get-code-cls">获取验证码</div>
61 80 </div>
62 81 </div>
  82 +
  83 + <div class="input-row-cls">
  84 + <label class="input-label-cls"></label><div class="input-div"><input class="input-cls emergency_person" type="text" placeholder="紧急联系人" /></div>
  85 + </div>
  86 + <div class="input-row-cls">
  87 + <label class="input-label-cls"></label><div class="input-div"><input class="input-cls emergency_contact" type="number" placeholder="紧急联系电话" /></div>
  88 + </div>
63 89 </div>
64 90 <div class="upload-box">
65 91 <div class="upload-section">
... ... @@ -70,24 +96,102 @@ $baseUrl = Url::base(true);
70 96 </div>
71 97 </div>
72 98 </div>
73   - <!--
  99 +
  100 + <div class="upload-section">
  101 + <div class="upload-title">维修厂门头照</div>
  102 + <div class="upload-img-box">
  103 + <div class="upload-item upload-btn-cls headPic">
  104 + <input type="file" id="upload-head-btn" class="upload-input-cls" name="file" accept="image/*"/>
  105 + </div>
  106 + </div>
  107 + </div>
  108 +
  109 + </div>
  110 +
  111 + <div class="upload-box">
74 112 <div class="upload-section">
75   - <div class="upload-title">维修场门头照</div>
  113 + <div class="upload-title">维修技术负责人证书</div>
76 114 <div class="upload-img-box">
77   - <div class="upload-item upload-btn-cls">
78   - <input type="file" id="upload-home-btn" class="upload-input-cls" name="file" accept="image/*"/>
  115 + <div class="upload-item upload-btn-cls techChargePic">
  116 + <input type="file" id="upload-charge-btn" class="upload-input-cls" name="file" accept="image/*"/>
79 117 </div>
80 118 </div>
81 119 </div>
82   - -->
  120 +
  121 + <div class="upload-section">
  122 + <div class="upload-title">质检负责人证书</div>
  123 + <div class="upload-img-box">
  124 + <div class="upload-item upload-btn-cls QAChargePic">
  125 + <input type="file" id="upload-qa-btn" class="upload-input-cls" name="file" accept="image/*"/>
  126 + </div>
  127 + </div>
  128 + </div>
  129 +
  130 + </div>
  131 + <div class="legal-agreement">
  132 + <span class="check-agreement"></span> <a href="javascript:void(0)" class="agreement-cls">《平台车管家服务条款》</a>
83 133 </div>
84 134 <div class="action-box">
85 135 <div class="register-btn-cls register-btn">注册</div>
86   -
87 136 <div class="login-btn login-btn-cls">登录</div>
88   -
89 137 </div>
90 138 </div>
91 139 </div>
92 140 </div>
93 141 </script>
  142 +<script id="agreement-template" type="text/template">
  143 + <div class="agreement-wrapper" id="agreement-wrapper">
  144 + <div class="agreement-wrapper-inner">
  145 + <div class="agree-btn">我同意</div>
  146 + <div class="agreement-list-div" style="width:100%;height:calc(100% - 50px);;overflow-y: scroll">
  147 + <div class="paragraph-cls">
  148 + <h2>平安车主服务中心合作维修厂钣金工艺标准流程</h2>
  149 + <p>1.轻微钣金整形要求,板面平整,无明显坑洼,手感光滑,无高凸点,筋线流畅,车身左右对称标准无差异,板金件工作面需要作羽状边处理,裸露铁皮需要作磷化底漆处理。</p>
  150 + <p>2.中度钣金整形件要求缝隙均称,灯缝均称,钣金部位车身密封性完好,无漏水,漏风,筋线流畅,车身左右对称线标准无差异,车体密封胶平整光滑,所有带铰链部件如:(发动机盖,车门,行李盖,油箱盖)等的缝隙,段差,间隙以及开启与关闭状态完好,螺钉无缺失。</p>
  151 + <p>3.重度事故整形要求各重要指数标准对称无误差,左右,上下无偏差,大梁左右准确对称无偏差,(大梁更换须增加百分之三十塞焊点,焊接处平整光滑),发动机仓,后备厢仓左右标准对称,所有对角线在正常误差范围内。车身隔音,防腐工艺完成。全车内饰,玻璃无烫伤,无划痕。路试车辆无异常振动,噪声,异响,及过大风噪声。</p>
  152 + </div>
  153 + <div class="paragraph-cls">
  154 + <h2>平安车主服务中心合作维修厂烤漆工艺标准流程</h2>
  155 + <p>1、烤漆工艺前不得接受钣金不良品。</p>
  156 + <p>2、修补腻子之前,对钣金部位或钣金件作好除油,羽状边修整,打磨光滑。</p>
  157 + <p>3、工艺中,修䃼腻子要求平整(腻子厚度不超3毫米),无波浪,无沙眼,筋线左右车身对比无差异,线条标准流畅。</p>
  158 + <p>4、严格按照汽车喷漆工艺流程作业,严禁偷漏工序。</p>
  159 + <p>5、遮蔽纸粘贴合整齐,防止喷涂工艺中有飞漆,保护作业面周围及车身其它部位漆面无损。</p>
  160 + <p>6、喷漆工艺完成后,漆面要求调漆颜色一致,无尘点,无流痕,无沙纸痕,无油点,色泽丰满,无桔皮纹等。</p>
  161 + <p>7、作业完成漆面部位,需要进行外表抛光处理,漆面抛光完成后无露漆,无尘点,亮度光泽如新。</p>
  162 + </div>
  163 + <div class="paragraph-cls">
  164 + <h2>平安车主服务中心合作维修厂质检负责人承诺书</h2>
  165 + <p>一、必须对该厂对接的平安车主服务中心推送的维修车辆技术质量负责,严格把好质量关,对每道工序严格检查,并作好记录,防止返修产生,客户投诉。</p>
  166 + <p>二、对该厂各维修班组不定期检查,掌握自检、互检情况,并作好记录。</p>
  167 + <p>三、负责判断该厂对接平安车主服务中心推送维修车辆,维修过程中质量是否合格,提出明确结论,并对结论负责。</p>
  168 + <p>四、负责该厂对接平安车主服务中心推送客户车辆维修过程,处理质量纠纷要准确,是非明确,态度明确。</p>
  169 + <p>五、负责统计好平安车主服务中心车辆维修质量检验的一次合格率、返修率。</p>
  170 + <p>六、修竣后总检(试车调试,眼观,起动、路试,复查,验车完成)交车</p>
  171 + <p>七、负责解答平安车主服务中心客户的技术咨询。</p>
  172 + </div>
  173 + <div class="paragraph-cls">
  174 + <h2>平安车主服务中心合作维修厂质量保修承诺书</h2>
  175 + <p>一、汽车维修更换的配件质量保证期为6个月(自维修出厂之日起)或一万公里(超出其中一项即为超出保证期)国家质保标准;</p>
  176 + <p>二、在保证期内,凡属于更换的配件质量,维修工艺,装配调整等技术或质量缺陷而引起车辆(或零部件)损坏,维修厂应予以免费保修。</p>
  177 + <p>三、特殊零部件的保修承诺:<br/>
  178 + <p>1、玻璃及外观装饰件的质量问题,自客户维修出厂之日起三个月内予以保修;<br/>
  179 + 2、蓄电池、喇叭自客户维修出厂之日起,保修半年;<br/>
  180 + 3、橡胶件、密封条、塑料配件、外观装饰件,内饰板等零件,自出厂之日起,正常使用范围内,保修一年;<br/>
  181 + 4、正常损耗和易损件不于保修,灯泡(大灯、雾灯除外)、保险丝、制动蹄、雨刷片等;<br/>
  182 + 5、机油,机油滤清器、汽油滤清器、空气滤芯、火花塞、辅料等,只对其第一更换周期内的质量予以保修;<br/>
  183 + 6、发动机,变速箱等核心零部件按照保修法规定标准予以保修(一年或两万公里);<br/>
  184 + 7、喷漆质量保证期终身,正常情况下,如腻子开裂,失光,变色,自然脱落等,保修期内予以免费维修。</p>
  185 +
  186 + </div>
  187 + <div class="paragraph-cls">
  188 + <h2>平安车主服务中心合作维修厂钣喷维修时效标准</h2>
  189 + <p>1、轻微钣喷(1件一3件)要求时效为24小时内完成所有作业工艺,并交车给客户。</p>
  190 + <p>2、中度,重度钣喷(3件以上),需要更换零部件,外部釆购零部件,添加机电维修项目等,根椐维修厂车间生产情况和客户要求协商确认交车时间,征得客户同意。</p>
  191 + <p>3、超过时效未能完工交车的,需主动联系客户,征求客户意见和谅解,维修厂应免费提供客户代步车辆。</p>
  192 + </div>
  193 +
  194 + </div>
  195 + </div>
  196 + </div>
  197 +</script>
94 198 \ No newline at end of file
... ...
common/config/params.php
... ... @@ -3,5 +3,5 @@ return [
3 3 'adminEmail' => 'admin@example.com',
4 4 'supportEmail' => 'support@example.com',
5 5 'user.passwordResetTokenExpire' => 3600,
6   - 'VERSION' => 'v1.0.0 build 2'
  6 + 'VERSION' => 'v1.0.0 build 3'
7 7 ];
... ...
common/helpers/ImageManager.php
... ... @@ -22,9 +22,10 @@ class ImageManager
22 22 * 根据系统模块划分, 定义图片一级目录结构
23 23 */
24 24  
25   - public static $MAINTENANCE_PATH = 'maintenance/'; // 维修厂用户注册的图片路径
  25 + public static $MAINTENANCE_PATH = 'maintenance/'; // 维修厂用户注册的图片路径
26 26 public static $ORDER_BROKEN_PATH = 'broken_order/'; // 订单里面车损坏的图片
27 27 public static $ORDER_FINISH_PATH = 'finish_order/'; // 维修好车的时候的图片
  28 + public static $ORDER_COMMENT_PATH = 'comment_order/'; // 维修评论图片
28 29  
29 30 /**
30 31 * @param $path 数据库存储的图片相对路径
... ...
domain/PhoneCodeHelper.php 0 → 100755
... ... @@ -0,0 +1,107 @@
  1 +<?php
  2 +
  3 +namespace domain;
  4 +
  5 +use Yii;
  6 +use common\helpers\Utils;
  7 +use domain\user\PhoneCode;
  8 +
  9 +/**
  10 + * 手机验证?码类
  11 + * Class PhoneCode
  12 + * @package domain
  13 + */
  14 +class PhoneCodeHelper
  15 +{
  16 + const CODE_EXPIRE = 120;
  17 + /**
  18 + * @param $mobile
  19 + * @return string
  20 + */
  21 + public static function setRegisterCode($mobile)
  22 + {
  23 + $session = Yii::$app->session;
  24 + $code = Utils::randRegCode(6);
  25 + $codeKey = $mobile."_".PhoneCode::REGISTER_TYPE;
  26 + $sessionStr = json_encode(['content' => $code, 'expire_at' => time() + self::CODE_EXPIRE]);
  27 + $session->set($codeKey, $sessionStr);
  28 +
  29 + return $code;
  30 + }
  31 +
  32 + /**
  33 + * @param $mobile
  34 + * @return bool
  35 + */
  36 + public static function removeRegisterCode($mobile)
  37 + {
  38 + $session = Yii::$app->session;
  39 + $codeKey = $mobile."_".PhoneCode::REGISTER_TYPE;
  40 + return $session->remove($codeKey);
  41 + }
  42 +
  43 + /**
  44 + * @param $mobile
  45 + * @return mixed
  46 + */
  47 + public static function getRegisterCode($mobile)
  48 + {
  49 + $session = Yii::$app->session;
  50 + $codeKey = $mobile."_".PhoneCode::REGISTER_TYPE;
  51 + $sessionContent = $session->get($codeKey);
  52 + if (!$sessionContent) {
  53 + return null;
  54 + }
  55 +
  56 + $sessionContent = json_decode($sessionContent, true);
  57 + if ($sessionContent && isset($sessionContent['expire_at']) && $sessionContent['expire_at'] > time()) {
  58 + return $sessionContent['content'];
  59 + } else {
  60 + $session->remove($codeKey);
  61 + return null;
  62 + }
  63 + }
  64 +
  65 + /**
  66 + * @param $mobile
  67 + * @return mixed
  68 + */
  69 + public static function getLoginCode($mobile)
  70 + {
  71 + $session = Yii::$app->session;
  72 + $codeKey = $mobile."_".PhoneCode::LOGIN_TYPE;
  73 + $sessionContent = $session->get($codeKey);
  74 + if (!$sessionContent) {
  75 + return null;
  76 + }
  77 + $sessionContent = json_decode($sessionContent, true);
  78 + if ($sessionContent && isset($sessionContent['expire_at']) && $sessionContent['expire_at'] > time()) {
  79 + return $sessionContent['content'];
  80 + } else {
  81 + $session->remove($codeKey);
  82 + return null;
  83 + }
  84 + }
  85 +
  86 + /**
  87 + * @param $mobile
  88 + * @return string
  89 + */
  90 + public static function setLoginCode($mobile)
  91 + {
  92 + $session = Yii::$app->session;
  93 + $code = Utils::randRegCode(6);
  94 + $codeKey = $mobile."_".PhoneCode::LOGIN_TYPE;
  95 + $sessionStr = json_encode(['content' => $code, 'expire_at' => time() + self::CODE_EXPIRE]);
  96 + $session->set($codeKey, $sessionStr);
  97 +
  98 + return $code;
  99 + }
  100 +
  101 + public static function removeLoginCode($mobile)
  102 + {
  103 + $session = Yii::$app->session;
  104 + $codeKey = $mobile."_".PhoneCode::LOGIN_TYPE;
  105 + $session->remove($codeKey);
  106 + }
  107 +}
0 108 \ No newline at end of file
... ...
domain/order/CarModelRepository.php 0 → 100644
... ... @@ -0,0 +1,33 @@
  1 +<?php
  2 +
  3 +namespace domain\order;
  4 +
  5 +use Yii;
  6 +use domain\order\models\CarModel as CarModelModel;
  7 +/**
  8 + * 评价
  9 + */
  10 +class CarModelRepository
  11 +{
  12 + /**
  13 + * @param $condition
  14 + * @return static
  15 + */
  16 + static function findOne($condition)
  17 + {
  18 + return CarModelModel::findOne($condition);
  19 + }
  20 +
  21 + /**
  22 + * @param $condition
  23 + * @return array|\yii\db\ActiveRecord[]
  24 + */
  25 + static function findAll($condition)
  26 + {
  27 + $catModelFind = CarModelModel::find();
  28 + $catModelFind->where($condition);
  29 + $catModelFind->asArray();
  30 + $carList = $catModelFind->all();
  31 + return $carList;
  32 + }
  33 +}
0 34 \ No newline at end of file
... ...
domain/order/RepairOrderRate.php
... ... @@ -3,6 +3,7 @@
3 3 namespace domain\order;
4 4  
5 5 use Yii;
  6 +use common\helpers\ImageManager;
6 7 use domain\order\models\RepairOrderRate as RepairOrderRateModel;
7 8 /**
8 9 * 评价
... ... @@ -14,7 +15,7 @@ class RepairOrderRate
14 15 * @param $star
15 16 * @return string
16 17 */
17   - static function starLabel($star)
  18 + static function starLabel($star = '')
18 19 {
19 20 $arr = [
20 21 1 => '很差',
... ... @@ -23,7 +24,7 @@ class RepairOrderRate
23 24 4 => '满意',
24 25 5 => '很满意',
25 26 ];
26   - if ($arr[$star]) {
  27 + if (isset($arr[$star])) {
27 28 return $arr[$star];
28 29 } else {
29 30 return '';
... ... @@ -60,4 +61,20 @@ class RepairOrderRate
60 61 {
61 62 return RepairOrderRateModel::findOne($condition);
62 63 }
  64 +
  65 + /**
  66 + * @param $orderUUId
  67 + * @param $images
  68 + */
  69 + static function mvImages($orderUUId, $images)
  70 + {
  71 + if (empty($images)) {
  72 + return null;
  73 + }
  74 + $imgPath = [];
  75 + foreach($images as $k => $v) {
  76 + $imgPath[] = ImageManager::mvUploadImage($v, $orderUUId, ImageManager::$ORDER_COMMENT_PATH);
  77 + }
  78 + return $imgPath;
  79 + }
63 80 }
64 81 \ No newline at end of file
... ...
domain/order/RepairOrderStatus.php
... ... @@ -10,8 +10,12 @@ use domain\order\models\RepairOrder as RepairOrderModel;
10 10 */
11 11 class RepairOrderStatus
12 12 {
13   - const WORKING = 1; //维修中
14   - const FINISH = 2; // 维修完成
  13 + const WORKING = 1; //维修中
  14 + const FINISH = 2; //维修完成
  15 +
  16 + const FINISH_STATUS_WORKING = 0; //0 处理中
  17 + const FINISH_STATUS_NORMAL = 1; //1 正常交车
  18 + const FINISH_STATUS_DELAY = 2; //2 延迟交车
15 19  
16 20 /**
17 21 * @param $index
... ... @@ -53,4 +57,39 @@ class RepairOrderStatus
53 57 }
54 58 }
55 59  
  60 + /**
  61 + * @param $preTime
  62 + * @param $finishTime
  63 + * @return int
  64 + */
  65 + static function getFinishStatus($preTime, $finishTime)
  66 + {
  67 + if (date('Y-m-d H', $finishTime) > date('Y-m-d H', $preTime)) {
  68 + return self::FINISH_STATUS_DELAY;
  69 + } else {
  70 + return self::FINISH_STATUS_NORMAL;
  71 + }
  72 + }
  73 +
  74 + /**
  75 + * @param string $index
  76 + * @return array|string
  77 + */
  78 + static function getFinishLabels($index = '')
  79 + {
  80 + $arr = [
  81 + self::FINISH_STATUS_WORKING => "处理中",
  82 + self::FINISH_STATUS_NORMAL => "正常交车",
  83 + self::FINISH_STATUS_DELAY => '延迟交车'
  84 + ];
  85 + if ('' === $index) {
  86 + return $arr;
  87 + }
  88 + if (isset($arr[$index])) {
  89 + return $arr[$index];
  90 + } else {
  91 + return '';
  92 + }
  93 + }
  94 +
56 95 }
57 96 \ No newline at end of file
... ...
domain/order/models/CarModel.php 0 → 100644
... ... @@ -0,0 +1,36 @@
  1 +<?php
  2 +
  3 +namespace domain\order\models;
  4 +
  5 +use yii\db\ActiveRecord;
  6 +use yii\behaviors\TimestampBehavior;
  7 +use common\helpers\Utils;
  8 +
  9 +/**
  10 + * 汽车型号
  11 + * This is the model class for table "{{%gk_car_model}}".
  12 + */
  13 +class CarModel extends ActiveRecord
  14 +{
  15 + /**
  16 + * @inheritdoc
  17 + */
  18 + public static function tableName()
  19 + {
  20 + return '{{%gk_car_model}}';
  21 + }
  22 +
  23 + /**
  24 + * @return array
  25 + */
  26 + public function behaviors()
  27 + {
  28 + return [
  29 + 'time' => [
  30 + 'class' => TimestampBehavior::className(),
  31 + 'createdAtAttribute' => 'created_at',
  32 + 'updatedAtAttribute' => 'updated_at',
  33 + ]
  34 + ];
  35 + }
  36 +}
0 37 \ No newline at end of file
... ...
domain/system/SmsMessage.php
... ... @@ -88,4 +88,20 @@ class SmsMessage
88 88 //$this->send($phone, $signName, "SMS_180755775", ["code" => $code]);
89 89 return true;
90 90 }
  91 +
  92 + /*
  93 + * 【XX车管家】您好,xxxx厂已经进行维修,预计完成时间xxxx,预估维修内容xxxx,预估维修费用xxxx, 地址:XXXXXX, 联系电话;XXXXXXXX”
  94 + * */
  95 + public function sendSubmitInfo($maintainer, $maintainerPhone, $preFinish, $address, $phone)
  96 + {
  97 + return true;
  98 + }
  99 +
  100 + /*
  101 + * 【XX车管家】您好,xxxx厂已对您的车维修完成,点击http://wwwwwww.com/xxx 可以给本次服务评分。如有意见请拨打投诉热线:4000xxxxxx”
  102 + * */
  103 + public function sendFinishInfo($maintainer, $url, $phone)
  104 + {
  105 + return true;
  106 + }
91 107 }
92 108 \ No newline at end of file
... ...
domain/user/User.php
... ... @@ -6,10 +6,15 @@ use Yii;
6 6 use domain\user\models\User as UserModel;
7 7  
8 8 /**
9   - * 手机验证码
  9 + * 维修厂
10 10 */
11 11 class User
12 12 {
  13 +
  14 + const STATUS_APPROVE = 1; //审核通过
  15 + const STATUS_REVIEWING = 2; //审核中
  16 + const STATUS_REJECT = 3; //审核拒绝
  17 +
13 18 /**
14 19 * @param $data
15 20 * @return null|object
... ... @@ -33,4 +38,25 @@ class User
33 38 return null;
34 39 }
35 40 }
  41 +
  42 + /**
  43 + * @param string $index
  44 + * @return array|string
  45 + */
  46 + static function getStatusLabels($index = '')
  47 + {
  48 + $arr = [
  49 + self::STATUS_APPROVE => '审核通过',
  50 + self::STATUS_REVIEWING => '审核中',
  51 + ];
  52 + if ('' === $index) {
  53 + return $arr;
  54 + }
  55 + if (isset($arr[$index])) {
  56 + return $arr[$index];
  57 + } else {
  58 + return '';
  59 + }
  60 +
  61 + }
36 62 }
37 63 \ No newline at end of file
... ...
domain/user/UserProfile.php 0 → 100644
... ... @@ -0,0 +1,37 @@
  1 +<?php
  2 +
  3 +namespace domain\user;
  4 +
  5 +use Yii;
  6 +use domain\user\models\UserProfile as UserProfileModel;
  7 +
  8 +/**
  9 + * 维修厂附加类
  10 + */
  11 +class UserProfile
  12 +{
  13 +
  14 + /**
  15 + * @param $data
  16 + * @return null|object
  17 + * @throws \yii\base\InvalidConfigException
  18 + */
  19 + static function create($data)
  20 + {
  21 + if (empty($data)) {
  22 + return null;
  23 + }
  24 + $classData = [
  25 + 'class' => UserProfileModel::className()
  26 + ];
  27 + foreach($data as $k => $v) {
  28 + $classData[$k] = $v;
  29 + }
  30 + $userProfileModel = Yii::createObject($classData);
  31 + if($userProfileModel->save()) {
  32 + return $userProfileModel;
  33 + } else {
  34 + return null;
  35 + }
  36 + }
  37 +}
0 38 \ No newline at end of file
... ...
domain/user/UserRepository.php
... ... @@ -3,6 +3,7 @@
3 3 namespace domain\user;
4 4  
5 5 use domain\user\models\User as UserModel;
  6 +use domain\user\models\UserProfile as UserProfileModel;
6 7  
7 8 /**
8 9 * 手机验证码
... ... @@ -27,9 +28,11 @@ class UserRepository
27 28 */
28 29 public static function getAdminUserList($offset, $limit, $map, $orderDesc = '')
29 30 {
  31 + $UPT = UserProfileModel::tableName();
30 32 $userFind = UserModel::find();
31 33 $userFind->alias('user');
32   - $userFind->select(["user.*"]);
  34 + $userFind->select(["user.*","upt.emergency_contact", "upt.emergency_person"]);
  35 + $userFind->leftJoin("{$UPT} as upt", 'upt.user_id = user.id');
33 36 $userFind->where($map);
34 37 if (empty($orderDesc)) {
35 38 $orderDesc = "user.created_at desc";
... ... @@ -51,10 +54,12 @@ class UserRepository
51 54 */
52 55 public static function getAdminUserListCount($map)
53 56 {
54   - $orderFind = UserModel::find();
55   - $orderFind->alias('user');
56   - $orderFind->where($map);
  57 + $UPT = UserProfileModel::tableName();
  58 + $userFind = UserModel::find();
  59 + $userFind->alias('user');
  60 + $userFind->leftJoin("{$UPT} as upd", 'upd.user_id = user.id');
  61 + $userFind->where($map);
57 62  
58   - return $orderFind->count();
  63 + return $userFind->count();
59 64 }
60 65 }
61 66 \ No newline at end of file
... ...
domain/user/models/User.php
... ... @@ -2,9 +2,10 @@
2 2  
3 3 namespace domain\user\models;
4 4  
5   -use common\helpers\Utils;
6 5 use yii\db\ActiveRecord;
7 6 use yii\behaviors\TimestampBehavior;
  7 +use domain\user\models\UserProfile as UserProfileModel;
  8 +use common\helpers\Utils;
8 9  
9 10 /**
10 11 * 用户
... ... @@ -54,4 +55,8 @@ class User extends ActiveRecord
54 55 $this->uuid = Utils::genUUID();
55 56 }
56 57  
  58 + public function getProfile()
  59 + {
  60 + return $this->hasOne(UserProfileModel::className(),["user_id" => "id"]);
  61 + }
57 62 }
58 63 \ No newline at end of file
... ...
domain/user/models/UserProfile.php 0 → 100644
... ... @@ -0,0 +1,35 @@
  1 +<?php
  2 +
  3 +namespace domain\user\models;
  4 +
  5 +use yii\db\ActiveRecord;
  6 +use yii\behaviors\TimestampBehavior;
  7 +
  8 +/**
  9 + * 用户
  10 + * This is the model class for table "{{%gk_user_profile}}".
  11 + */
  12 +class UserProfile extends ActiveRecord
  13 +{
  14 + /**
  15 + * @inheritdoc
  16 + */
  17 + public static function tableName()
  18 + {
  19 + return '{{%gk_user_profile}}';
  20 + }
  21 +
  22 + /**
  23 + * @return array
  24 + */
  25 + public function behaviors()
  26 + {
  27 + return [
  28 + 'time' => [
  29 + 'class' => TimestampBehavior::className(),
  30 + 'createdAtAttribute' => 'created_at',
  31 + 'updatedAtAttribute' => 'updated_at',
  32 + ]
  33 + ];
  34 + }
  35 +}
0 36 \ No newline at end of file
... ...
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=""><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,s=Template7,t=new t,l="/user/default/upload-file",c="/order/default/submit",d=!0,u="";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.openCarModel(),t.searchCarModel(),t.carModelClick()},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(l),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()),l=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==d)return!1;if(""==r)return n.toast({content:"车牌号必填"}),!1;if(""==a)return n.toast({content:"车辆型号必填"}),!1;if(""==s)return n.toast({content:"客户名称必填"}),!1;if(""==l)return n.toast({content:"客联系电话必填"}),!1;if(!n.isMobile(l)&&!n.isTelephone(l))return n.toast({content:"客联系电话有误"}),!1;var p=t.getUploadImgs();if(0==p.length)return n.toast({content:"请上传车损照"}),!1;d=!1;var f=t.csrf({carNo:r,carModel:a,customer:s,phone:l,preRepair:u,repairPrice:m,finishDate:v,images:p});n.httpPost(c,f,function(t){return d=!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("#submit .finish-date-input").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(),d=r.getHours(),m=s+"-"+(l+1)+"-"+c;if(""!=e&&null!=e&&void 0!==e){var v=e.split(" ");m=v[0],d=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,d],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];u=i[0]+" "+n,o(t).val(u),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];u=i[0]+" "+n,o(t).val(u),h.destroy()})},t.openCarModel=function(){o("#submit").on("click",".carModel",function(t){o("#search-wrapper").remove();var e=o("#submit"),i=o("script#search-carr-model-template"),n=s.compile(i.html()),r=n({keyword:""});e.append(r)})},t.renderCarModelItem=function(t){var e=o("#search-wrapper .model-list"),i=o("script#search-car-model-item-template"),n=s.compile(i.html()),r=n({items:t});e.html(r)},t.searchCarModel=function(){var t=this;o("#submit").on("click",".model-search-btn",function(e){t.ajaxSearch()}),o("#submit").on("submit","#search-form",function(e){return e.preventDefault(),t.ajaxSearch(),!1})},t.ajaxSearch=function(){var t=this,i={keyword:o("#search-wrapper .search-input").val()};o.ajax({method:"POST",url:e.to("order/default/search-model"),data:i,dataType:"json",beforeSend:function(){t.showIndicator()},success:function(e){e.success?t.renderCarModelItem(e.items):t.renderCarModelItem([])},error:function(t){},complete:function(e){t.hideIndicator()}})},t.carModelClick=function(){o("#submit").on("click",".model-div-btn",function(t){var e=o(this).attr("data-value");o("#submit .carModel").val(e),o("#search-wrapper").remove()}),o("#submit").on("click",".closeBtn",function(t){o("#search-wrapper").remove()})},t});
2 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 a={tab:e};return t.runController("index",a)},submit:function(){return n=!1,i(),t.runController("submit")},"order-details/:id":function(e){n=!1,i();var a={id:e};return t.runController("order-details",a)},"customer-order/:id/:sn":function(e,a){n=!1,i();var r={id:e,sn:a};return t.runController("customer-order",r)},"rate/:id/:sn":function(e,a){n=!1,i();var r={id:e,sn:a};return t.runController("rate",r)},"cost-list/:id":function(e){n=!1,i();var a={id:e};return t.runController("cost-list",a)},"*":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 a=Dom7,t=(Template7,new t),r="/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;a("#cost-list .add-repair-plan").click(function(e){var i=a("#cost-list .cost-list-div"),n=t.planTpl(i.length+1);a(n).insertBefore(a("#cost-list .cost-total-list-div"))})},t.delPlanEvent=function(){var t=this;a("#cost-list").on("click",".del-plan",function(e){console.log("del plan event"),a(this).parents(".cost-list-div").remove(),a("#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=""><span class="del-plan"></span></div></div>';return e},t.inputPriceChangeEvent=function(){var t=this;a("#cost-list").on("input propertychange",".input-cls",function(){var e=t.computedPrice();a("#cost-list .total-plan-price").html(e)})},t.computedPrice=function(){var t=a("#cost-list .input-right"),e=0;return a.each(t,function(t,i){e+=1*a(i).val()}),Math.round(e,2)},t.uploadImgEvent=function(){var t=this;a("#cost-list #upload-btn").change(function(){if(""!=a(this).val()&&null!=a(this).val()){var o=a(this).parents("li");n.uploadFile({selector:"#upload-btn",url:e.to(r),processAppendTo:"#cost-list",success:function(e,n){try{if(e.success){var r=e.tmpUrl;a('<li class="upload-li up-img"><div data="'+e.tmpFile+'" data-url="'+r+'" class="upload-item" style="background-image:url('+e.tmpMinUrl+')"></div><span class="del-img"></span></li>').insertBefore(o),t.imgLimit==a("#cost-list #image-list").find(".up-img").length&&a("#cost-list .upload-btn-li").hide()}else i.toast({content:e.message,closeDelay:5e3})}catch(s){console.log(s),i.toast({content:"出错",closeDelay:5e3})}}})}}),a("#cost-list #image-list").on("click",".del-img",function(e){a(this).parent().remove(),t.imgLimit>=a("#cost-list #image-list").find(".up-img").length&&a("#cost-list .upload-btn-li").show()})},t.submitEvent=function(){var t=this;a("#cost-list .btn-submit").click(function(n){var r=a("#cost-list .content-div").find(".repair-item-cls"),s=[],l=!0,c=!0;if(a.each(r,function(t,e){var n=i.trim(a(e).find(".input-left").val()),r=i.trim(a(e).find(".input-right").val());""==n&&(l=!1),""!=r&&0!=r||(c=!1),s.push({content:n,price:r})}),!l)return i.toast({content:"维修清单有部分未填内容"}),!1;if(!c)return i.toast({content:"维修清单有部分未填价格"}),!1;var d=a("#cost-list #image-list").find(".upload-item"),u=[];if(a.each(d,function(t,e){u.push(a(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,a=Template7,t=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.agreementEvent()},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.agreementEvent=function(){n("#customer-order").on("click",".warranty-btn",function(t){n("#warranty-wrapper").remove();var e=n("#customer-order"),i=n("script#warranty-template"),r=a.compile(i.html()),o=r({});e.append(o)}),n("#customer-order").on("click",".agree-btn",function(t){n("#warranty-wrapper").remove()})},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 a=Math.abs(i-e);if(a>=0&&a<=20)n("#img-mask").remove();else{var r=n(t.target).attr("id");"img-mask"==r&&n("#img-mask").remove()}})},t}),define("order/index-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,e,i){var n=Dom7,a=Template7,t=new t,r="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 a={status:t.tab};a.page=t.page+1,a=t.csrf(a),n.ajax({method:"GET",url:e.to(r),data:a,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"),r=n("script#order-item-template"),o=a.compile(r.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),a="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(a),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.agreementEvent=function(){},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 a=Math.abs(i-e);if(a>=0&&a<=20)n("#img-mask").remove();else{var r=n(t.target).attr("id");"img-mask"==r&&n("#img-mask").remove()}})},t}),define("order/rate-controller",["mk7/controller","mk7/url","mk7/utils","mk7/uploadjs"],function(t,e,i,n){var a=Dom7,t=(Template7,new t),r="order/customer/submit-rate",o="/user/default/upload-file";return t.run=function(){var t=this;t.id=t.params.id,t.sn=t.params.sn,t.imgLimit=4,t.setPageTitle("评价"),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.starClickEvent(),t.submitEvent(),t.uploadImgEvent()},t.loadPage=function(){var t=this;t.render()},t.starClickEvent=function(){a("#rate").on("click",".img-star",function(t){var e=a(this).attr("data-id"),i=a(this).parent(".star-div"),n=i.find(".img-star");a.each(n,function(t,n){var r=a(n).attr("data-id");if(1*r<=e){a(n).addClass("star-on");var o=i.find(".rate-text"),s=a(n).attr("data-txt");o.html(s)}else a(n).removeClass("star-on")})})},t.uploadImgEvent=function(){var t=this;a("#rate #upload-btn").change(function(){if(""!=a(this).val()&&null!=a(this).val()){var r=a(this).parents("li");n.uploadFile({selector:"#upload-btn",url:e.to(o),processAppendTo:"#rate",success:function(e,n){try{if(e.success){var o=e.tmpUrl;a('<li class="upload-li up-img"><div data="'+e.tmpFile+'" data-url="'+o+'" class="upload-item" style="background-image:url('+e.tmpMinUrl+')"></div><span class="del-img"></span></li>').insertBefore(r),t.imgLimit==a("#rate #image-list").find(".up-img").length&&a("#rate .upload-btn-li").hide()}else i.toast({content:e.message,closeDelay:5e3})}catch(s){console.log(s),i.toast({content:"出错",closeDelay:5e3})}}})}}),a("#rate #image-list").on("click",".del-img",function(e){a(this).parent().remove(),t.imgLimit>=a("#rate #image-list").find(".up-img").length&&a("#rate .upload-btn-li").show()})},t.getUploadImgs=function(){var t=a("#rate #image-list").find(".up-img"),e=[];return 0==t.length?[]:(a.each(t,function(t,i){var n=a(i).find(".upload-item");e.push(n.attr("data"))}),e)},t.submitEvent=function(){var t=this;a("#rate .submit-btn").click(function(n){var o=i.trim(a("#rate .text-content").val()),s=a("#rate .quality-box .img-star"),l=0;a.each(s,function(t,e){a(e).hasClass("star-on")&&l++});var c=a("#rate .effect-box .img-star"),d=0;a.each(c,function(t,e){a(e).hasClass("star-on")&&d++});var u=a("#rate .service-box .img-star"),m=0;a.each(u,function(t,e){a(e).hasClass("star-on")&&m++});var p=t.getUploadImgs(),v=t.csrf({comment:o,id:t.id,qualityStar:l,effectStar:d,serviceStar:m,images:p});i.httpPost(e.to(r),v,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,a,r){var o=Dom7,s=Template7,t=new t,l="/user/default/upload-file",c="/order/default/submit",d=!0,u="";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.openCarModel(),t.searchCarModel(),t.carModelClick()},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");a.uploadFile({selector:"#upload-btn",url:e.to(l),processAppendTo:"#submit",success:function(e,a){try{if(e.success){var r=e.tmpUrl;o('<li class="upload-li up-img"><div data="'+e.tmpFile+'" data-url="'+r+'" 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){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 a=n.trim(o("#submit .carNo").val()),r=n.trim(o("#submit .carModel").val()),s=n.trim(o("#submit .customer").val()),l=n.trim(o("#submit .phone").val()),u=n.trim(o("#submit .preRepair").val()),m=n.trim(o("#submit .repairPrice").val()),p=n.trim(o("#submit .finishDate").val());if(0==d)return!1;if(""==a)return n.toast({content:"车牌号必填"}),!1;if(""==r)return n.toast({content:"车辆型号必填"}),!1;if(""==s)return n.toast({content:"客户名称必填"}),!1;if(""==l)return n.toast({content:"客联系电话必填"}),!1;if(!n.isMobile(l)&&!n.isTelephone(l))return n.toast({content:"客联系电话有误"}),!1;if(""==p)return n.toast({content:"预估完成时间必填"}),!1;var v=t.getUploadImgs();if(0==v.length)return n.toast({content:"请上传车损照"}),!1;d=!1;var f=t.csrf({carNo:a,carModel:r,customer:s,phone:l,preRepair:u,repairPrice:m,finishDate:p,images:v});n.httpPost(c,f,function(t){return d=!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("#submit .finish-date-input").val();console.log(i),t.dateTimeSelector("#submit .finish-date-input",i)})},t.dateTimeSelector=function(t,e){var n=this,a=new Date,r=30,s=a.getFullYear(),l=a.getMonth(),c=a.getDate(),d=a.getHours(),m=s+"-"+(l+1)+"-"+c;if(""!=e&&null!=e&&void 0!==e){var p=e.split(" ");m=p[0],d=p[1]}var v=[];for(i=0;i<=r;i++){var f=new Date;f.setDate(a.getDate()+i);var g=f.getFullYear()+"-"+(f.getMonth()+1)+"-"+f.getDate();v.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,d],onChange:function(t,e,i){var n,a,r;if(e[0]instanceof Date)n=e[0].getFullYear(),a=e[0].getMonth(),r=e[0].getDate();else{var o=e[0].split("-");n=o[0],a=o[1]-1,r=o[2]}var s=new Date(n,a,r,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 a=n+" "+e[1];return a},cols:[{values:v,displayValues:function(){var t=[],e=new Date,i=e.getFullYear(),n=e.getMonth()+1,a=e.getDate();e.setDate(e.getDate()+1);for(var r=0;r<v.length;r++){var o=v[r],s=o.split("-"),l=s[1]+"月"+s[2]+"日";i==s[0]&&1*n==s[1]&&1*a==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];u=i[0]+" "+n,o(t).val(u),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];u=i[0]+" "+n,o(t).val(u),h.destroy()})},t.openCarModel=function(){o("#submit").on("click",".carModel",function(t){o("#search-wrapper").remove();var e=o("#submit"),i=o("script#search-car-model-template"),n=s.compile(i.html()),a=n({keyword:""});e.append(a)})},t.renderCarModelItem=function(t){var e=o("#search-wrapper .model-list"),i=o("script#search-car-model-item-template"),n=s.compile(i.html()),a=n({items:t});e.html(a)},t.searchCarModel=function(){var t=this;o("#submit").on("click",".model-search-btn",function(e){t.ajaxSearch()}),o("#submit").on("submit","#search-form",function(e){return e.preventDefault(),t.ajaxSearch(),!1})},t.ajaxSearch=function(){var t=this,i={keyword:o("#search-wrapper .search-input").val()};o.ajax({method:"POST",url:e.to("order/default/search-model"),data:i,dataType:"json",beforeSend:function(){t.showIndicator()},success:function(e){e.success?t.renderCarModelItem(e.items):t.renderCarModelItem([])},error:function(t){},complete:function(e){t.hideIndicator()}})},t.carModelClick=function(){o("#submit").on("click",".model-div-btn",function(t){var e=o(this).attr("data-value");o("#submit .carModel").val(e),o("#search-wrapper").remove()}),o("#submit").on("click",".closeBtn",function(t){o("#search-wrapper").remove()})},t});
3 3 \ No newline at end of file
... ...
web/dist/js/user-app.js
1   -define("user-app",["mk7/app"],function(e){var t=Dom7,n=function(){var e=t(".ui-loading-block");0==e.length&&(t(".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 e=document.getElementById("loader-inner"),t=document.createElement("p");t.className="notice",e&&(t.innerHTML='加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>',e.appendChild(t))},window.waitingTime))},o=!0;return e.name="user",e.routes={index:function(){return o=!1,n(),e.runController("index")},register:function(){return o=!1,n(),e.runController("register")},login:function(){return o=!1,n(),e.runController("login")},"*":function(){return e.runController("index")}},e}),define("user/index-controller",["mk7/controller","mk7/url","mk7/utils"],function(e,t,n){var e=(Dom7,Template7,new e);return e.run=function(){var e=this;e.setPageTitle("首页"),e.hideAllNonBaseMenuItem(window.$site),e.render()},e.bindEvents=function(){console.log("bindEvents")},e}),define("user/login-controller",["mk7/controller","mk7/url","mk7/utils"],function(e,t,n){var o=Dom7,e=(Template7,new e),i="/user/login/get-code",r="/user/login/login",s=!0,l=!0,c=null;return e.run=function(){var e=this;return e.setPageTitle("登录"),e.codeDuration=60,isGuest?void e.render():(window.location.href=t.to("order/#index"),"")},e.bindEvents=function(){var e=this;console.log("bindEvents"),e.getCodeEvent(),e.gotoRegisterEvent(),e.loginEvent()},e.getCodeEvent=function(){var e=this;o("#login .get-code-cls").click(function(){var r=n.trim(o("#login .mobile").val());if(""==r)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(r))return n.toast({content:"手机号码不合格"}),!1;if(0==s)return!1;clearInterval(c),s=!1;var l=e.csrf({action:"login",mobile:r});n.httpGet(t.to(i),l,function(t){if(!t.success)return n.toast({content:t.message,closeDelay:3e3}),s=!0,!1;n.toast({content:t.message}),t.testCode&&o("#login .code").val(t.testCode);var i=t.codeDuration;e.codeDuration=i,c=setInterval(function(t){e.codeDuration--,0==e.codeDuration?(o("#login .get-code-cls").html("获取验证码"),clearInterval(c),e.codeDuration=i,s=!0):o("#login .get-code-cls").html('<span class="count-down-cls">'+e.codeDuration+"s后重新获取</span>")},1e3)})})},e.loginEvent=function(){var e=this;o("#login .login-btn").click(function(i){var s=n.trim(o("#login .mobile").val()),c=n.trim(o("#login .code").val());if(""==s)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(s))return n.toast({content:"手机号码不合格"}),!1;if(""==c)return n.toast({content:"验证码必填"}),!1;if(0==l)return!1;l=!1;var a=e.csrf({mobile:s,code:c});n.httpPost(t.to(r),a,function(e){return l=!0,e.success?void(window.location.href=t.to("order/#index")):(n.toast({content:e.message,closeDelay:3e3}),!1)})})},e.gotoRegisterEvent=function(){o("#login .register-btn").click(function(e){window.location.href=t.to("user/#register")})},e}),define("user/register-controller",["mk7/controller","mk7/url","mk7/utils","mk7/uploadjs"],function(e,t,n,o){var i=Dom7,e=(Template7,new e),r="/user/login/register",s="/user/default/upload-file",l="/user/login/get-code",c=!0,a=!0,u=null;return e.run=function(){var e=this;return e.setPageTitle("注册"),e.codeDuration=60,isGuest?void e.render():(window.location.href=t.to("order/#index"),"")},e.bindEvents=function(){var e=this;console.log("bindEvents"),e.uploadEvent(),e.getCodeEvent(),e.registerEvent(),e.gotoLoginEvent()},e.uploadEvent=function(){i("#register .upload-input-cls").change(function(){if(""!=i(this).val()&&null!=i(this).val()){var e=i(this).attr("id"),r=i(this).parent();o.uploadFile({selector:"#"+e,url:t.to(s),processAppendTo:"#register",success:function(e,t){try{if(e.success){var o=e.tmpUrl;r.css("background-image","url("+e.tmpMinUrl+")"),r.attr("data",e.tmpFile),r.attr("data-url",o)}else n.toast({content:e.message,closeDelay:5e3})}catch(i){n.toast({content:"出错",closeDelay:5e3})}}})}})},e.getCodeEvent=function(){var e=this;i("#register .get-code-cls").click(function(){var o=n.trim(i("#register .mobile").val());if(""==o)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(o))return n.toast({content:"手机号码不合格"}),!1;if(0==c)return!1;clearInterval(u),c=!1;var r=e.csrf({action:"register",mobile:o});n.httpGet(t.to(l),r,function(t){if(!t.success)return n.toast({content:t.message,closeDelay:3e3}),c=!0,!1;n.toast({content:t.message}),t.testCode&&i("#register .code").val(t.testCode);var o=t.codeDuration;e.codeDuration=o,u=setInterval(function(t){e.codeDuration--,0==e.codeDuration?(i("#register .get-code-cls").html("获取验证码"),clearInterval(u),e.codeDuration=o,c=!0):i("#register .get-code-cls").html('<span class="count-down-cls">'+e.codeDuration+"s后重新获取</span>")},1e3)})})},e.registerEvent=function(){var e=this;i("#register .register-btn").click(function(o){var s=n.trim(i("#register .name").val()),l=n.trim(i("#register .mobile").val()),c=n.trim(i("#register .code").val());if(""==s)return n.toast({content:"车厂名称必填"}),!1;if(""==l)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(l))return n.toast({content:"手机号码不合格"}),!1;if(""==c)return n.toast({content:"验证码必填"}),!1;var u=i("#register .licensePic").attr("data");if(void 0===u||null==u)return n.toast({content:"请上传营业执照"}),!1;if(0==a)return!1;a=!1;var d=e.csrf({name:s,mobile:l,code:c,licensePic:u});n.httpPost(t.to(r),d,function(e){return e.success?void(window.location.href=t.to("order/#index")):(n.toast({content:e.message,closeDelay:3e3}),a=!0,!1)})})},e.gotoLoginEvent=function(){i("#register .login-btn").click(function(e){window.location.href=t.to("user/#login")})},e});
2 1 \ No newline at end of file
  2 +define("user-app",["mk7/app"],function(e){var t=Dom7,n=function(){var e=t(".ui-loading-block");0==e.length&&(t(".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 e=document.getElementById("loader-inner"),t=document.createElement("p");t.className="notice",e&&(t.innerHTML='加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>',e.appendChild(t))},window.waitingTime))},r=!0;return e.name="user",e.routes={index:function(){return r=!1,n(),e.runController("index")},register:function(){return r=!1,n(),e.runController("register")},login:function(){return r=!1,n(),e.runController("login")},"*":function(){return e.runController("index")}},e}),define("user/index-controller",["mk7/controller","mk7/url","mk7/utils"],function(e,t,n){var e=(Dom7,Template7,new e);return e.run=function(){var e=this;e.setPageTitle("首页"),e.hideAllNonBaseMenuItem(window.$site),e.render()},e.bindEvents=function(){console.log("bindEvents")},e}),define("user/login-controller",["mk7/controller","mk7/url","mk7/utils"],function(e,t,n){var r=Dom7,e=(Template7,new e),o="/user/login/get-code",i="/user/login/login",c=!0,s=!0,a=null;return e.run=function(){var e=this;return e.setPageTitle("登录"),e.codeDuration=60,isGuest?void e.render():(window.location.href=t.to("order/#index"),"")},e.bindEvents=function(){var e=this;console.log("bindEvents"),e.getCodeEvent(),e.gotoRegisterEvent(),e.loginEvent()},e.getCodeEvent=function(){var e=this;r("#login .get-code-cls").click(function(){var i=n.trim(r("#login .mobile").val());if(""==i)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(i))return n.toast({content:"手机号码不合格"}),!1;if(0==c)return!1;clearInterval(a),c=!1;var s=e.csrf({action:"login",mobile:i});n.httpGet(t.to(o),s,function(t){if(!t.success)return n.toast({content:t.message,closeDelay:3e3}),c=!0,!1;n.toast({content:t.message}),t.testCode&&r("#login .code").val(t.testCode);var o=t.codeDuration;e.codeDuration=o,a=setInterval(function(t){e.codeDuration--,0==e.codeDuration?(r("#login .get-code-cls").html("获取验证码"),clearInterval(a),e.codeDuration=o,c=!0):r("#login .get-code-cls").html('<span class="count-down-cls">'+e.codeDuration+"s后重新获取</span>")},1e3)})})},e.loginEvent=function(){var e=this;r("#login .login-btn").click(function(o){var c=n.trim(r("#login .mobile").val()),a=n.trim(r("#login .code").val());if(""==c)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(c))return n.toast({content:"手机号码不合格"}),!1;if(""==a)return n.toast({content:"验证码必填"}),!1;if(0==s)return!1;s=!1;var l=e.csrf({mobile:c,code:a});n.httpPost(t.to(i),l,function(e){return s=!0,e.success?void(window.location.href=t.to("order/#index")):(n.toast({content:e.message,closeDelay:3e3}),!1)})})},e.gotoRegisterEvent=function(){r("#login .register-btn").click(function(e){window.location.href=t.to("user/#register")})},e}),define("user/register-controller",["mk7/controller","mk7/url","mk7/utils","mk7/uploadjs"],function(e,t,n,r){var o=Dom7,i=Template7,e=new e,c="/user/login/register",s="/user/default/upload-file",a="/user/login/get-code",l=!0,u=!0,d=null;return e.run=function(){var e=this;return e.setPageTitle("注册"),e.codeDuration=60,isGuest?void e.render():(window.location.href=t.to("order/#index"),"")},e.bindEvents=function(){var e=this;console.log("bindEvents"),e.uploadEvent(),e.getCodeEvent(),e.registerEvent(),e.gotoLoginEvent(),e.checkAgreement()},e.uploadEvent=function(){o("#register .upload-input-cls").change(function(){if(""!=o(this).val()&&null!=o(this).val()){var e=o(this).attr("id"),i=o(this).parent();r.uploadFile({selector:"#"+e,url:t.to(s),processAppendTo:"#register",success:function(e,t){try{if(e.success){var r=e.tmpUrl;i.css("background-image","url("+e.tmpMinUrl+")"),i.attr("data",e.tmpFile),i.attr("data-url",r)}else n.toast({content:e.message,closeDelay:5e3})}catch(o){n.toast({content:"出错",closeDelay:5e3})}}})}})},e.getCodeEvent=function(){var e=this;o("#register .get-code-cls").click(function(){var r=n.trim(o("#register .mobile").val());if(""==r)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(r))return n.toast({content:"手机号码不合格"}),!1;if(0==l)return!1;clearInterval(d),l=!1;var i=e.csrf({action:"register",mobile:r});n.httpGet(t.to(a),i,function(t){if(!t.success)return n.toast({content:t.message,closeDelay:3e3}),l=!0,!1;n.toast({content:t.message}),t.testCode&&o("#register .code").val(t.testCode);var r=t.codeDuration;e.codeDuration=r,d=setInterval(function(t){e.codeDuration--,0==e.codeDuration?(o("#register .get-code-cls").html("获取验证码"),clearInterval(d),e.codeDuration=r,l=!0):o("#register .get-code-cls").html('<span class="count-down-cls">'+e.codeDuration+"s后重新获取</span>")},1e3)})})},e.registerEvent=function(){var e=this;o("#register .register-btn").click(function(r){var i=n.trim(o("#register .name").val()),s=n.trim(o("#register .mobile").val()),a=n.trim(o("#register .code").val()),l=n.trim(o("#register .emergency_contact").val()),d=n.trim(o("#register .emergency_person").val());if(""==i)return n.toast({content:"车厂名称必填"}),!1;if(""==s)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(s))return n.toast({content:"手机号码不合格"}),!1;if(""==a)return n.toast({content:"验证码必填"}),!1;if(""==d)return n.toast({content:"紧急联系人必填"}),!1;if(""==l)return n.toast({content:"紧急联系电话必填"}),!1;if(!n.isMobile(l)&&!n.isTelephone(l))return n.toast({content:"紧急联系电话不合格"}),!1;if(l==s)return n.toast({content:"紧急联系电话不能和注册手机一样"}),!1;var g=o("#register .licensePic").attr("data");if(void 0===g||null==g)return n.toast({content:"请上传营业执照"}),!1;var v=o("#register .headPic").attr("data");if(void 0===v||null==v)return n.toast({content:"请上传维修厂门头照"}),!1;var f=o("#register .techChargePic").attr("data");if(void 0===f||null==f)return n.toast({content:"请上传维修技术负责人证书"}),!1;var m=o("#register .QAChargePic").attr("data");if(void 0===m||null==m)return n.toast({content:"请上传质检负责人证书"}),!1;if(!o("#register .check-agreement").hasClass("checked-active"))return n.toast({content:"请阅读同意《平台车管家服务条款》"}),!1;if(0==u)return!1;u=!1;var h=e.csrf({name:i,mobile:s,code:a,emergencyContact:l,emergencyPerson:d,licensePic:g,headPic:v,techChargePic:f,QAChargePic:m});n.httpPost(t.to(c),h,function(e){if(!e.success)return n.toast({content:e.message,closeDelay:3e3}),u=!0,!1;var r=3e3;n.toast({content:e.message,closeDelay:r}),setTimeout(function(){window.location.href=t.to("order/#index")},r)})})},e.gotoLoginEvent=function(){o("#register .login-btn").click(function(e){window.location.href=t.to("user/#login")})},e.checkAgreement=function(){o("#register .check-agreement").click(function(e){o(this).hasClass("checked-active")?o(this).removeClass("checked-active"):o(this).addClass("checked-active")}),o("#register .agreement-cls").click(function(e){o("#agreement-wrapper").remove();var t=o("#register"),n=o("script#agreement-template"),r=i.compile(n.html()),c=r({});t.append(c)}),o("#register").on("click",".agree-btn",function(e){o("#agreement-wrapper").remove();var t=o("#register .check-agreement");t.hasClass("checked-active")||t.addClass("checked-active")})},e});
3 3 \ No newline at end of file
... ...
web/src/js/order/customer-order-controller.js
... ... @@ -30,6 +30,7 @@ define(
30 30 console.log("bindEvents");
31 31 me.goToComment();
32 32 me.popupImageLayer();
  33 + me.agreementEvent();
33 34 }
34 35 ctrl.beforeRender = function() {
35 36 var me = this;
... ... @@ -57,7 +58,21 @@ define(
57 58 })
58 59  
59 60 }
60   - ctrl.popupImageLayer = function(){
  61 + ctrl.agreementEvent = function() {
  62 + $$('#customer-order').on('click', '.warranty-btn', function(e){
  63 + $$('#warranty-wrapper').remove();
  64 + var page = $$('#customer-order');
  65 + var ele = $$('script#warranty-template');
  66 + var compiled = t7.compile(ele.html());
  67 + var doms = compiled({});
  68 + page.append(doms);
  69 + })
  70 +
  71 + $$('#customer-order').on('click','.agree-btn', function(e){
  72 + $$('#warranty-wrapper').remove();
  73 + })
  74 + }
  75 + ctrl.popupImageLayer = function() {
61 76 $$('#customer-order').on('click', '.view-img-cls', function(e) {
62 77 var url = $$(this).attr('data-url');
63 78 $$('#img-mask').remove();
... ...
web/src/js/order/order-details-controller.js
... ... @@ -50,10 +50,26 @@ define(
50 50 ctrl.finishBtnEvent = function() {
51 51 var me = this;
52 52 $$('#order-details .finish-submit').click(function(e){
53   - window.location.href = url.to('order/#cost-list/'+me.id);
  53 + window.location.href = url.to('order/#cost-list/' + me.id);
54 54 })
55 55 }
  56 + ctrl.agreementEvent = function() {
  57 + //agreement-btn
  58 + /*
  59 + $$('#order-details .agreement-btn').click(function(e){
  60 + $$('#agreement-wrapper').remove();
  61 + var page = $$('#order-details');
  62 + var ele = $$('script#agreement-template');
  63 + var compiled = t7.compile(ele.html());
  64 + var doms = compiled({});
  65 + page.append(doms);
  66 + })
56 67  
  68 + $$('#order-details').on('click','.agree-btn', function(e){
  69 + $$('#agreement-wrapper').remove();
  70 + })
  71 + */
  72 + }
57 73 ctrl.popupImageLayer = function(){
58 74 $$('#order-details').on('click', '.view-img-cls', function(e) {
59 75 var url = $$(this).attr('data-url');
... ... @@ -72,7 +88,7 @@ define(
72 88 var interval = Math.abs(ih-bh);
73 89 if (interval >=0 && interval <= 20) {
74 90 $$('#img-mask').remove();
75   - console.log('dddd')
  91 +
76 92 } else {
77 93 var id = $$(e.target).attr('id');
78 94 if('img-mask' == id) {
... ...
web/src/js/order/rate-controller.js
... ... @@ -7,19 +7,22 @@ define(
7 7 'mk7/controller',
8 8 'mk7/url',
9 9 'mk7/utils',
  10 + 'mk7/uploadjs',
10 11 ],
11 12  
12   - function(ctrl, url, utils) {
  13 + function(ctrl, url, utils, uploadjs) {
13 14  
14 15 var $$ = Dom7;
15 16 var t7 = Template7;
16 17 var ctrl = new ctrl();
17 18  
18 19 var submitURL = 'order/customer/submit-rate';
  20 + var uploadURL = '/user/default/upload-file';
19 21 ctrl.run = function () {
20 22 var me = this;
21 23 me.id = me.params.id;
22 24 me.sn = me.params.sn;
  25 + me.imgLimit = 4;
23 26 me.setPageTitle("评价");
24 27 me.loadPage();
25 28 }
... ... @@ -28,20 +31,22 @@ define(
28 31 console.log("bindEvents");
29 32 me.starClickEvent();
30 33 me.submitEvent();
  34 + me.uploadImgEvent();
31 35 }
32 36 ctrl.loadPage = function(){
33 37 var me = this;
34 38 me.render();
35 39 }
36 40 ctrl.starClickEvent = function() {
37   - $$('#rate').on('click','.quality-box .img-star',function(e) {
  41 + $$('#rate').on('click', '.img-star',function(e) {
38 42 var id = $$(this).attr('data-id');
39   - var stars = $$('#rate .quality-box .img-star')
  43 + var parentBox = $$(this).parent('.star-div');
  44 + var stars = parentBox.find('.img-star')
40 45 $$.each(stars, function(i,n){
41 46 var cid = $$(n).attr('data-id');
42 47 if ((cid*1) <= id) {
43 48 $$(n).addClass('star-on');
44   - var rateText = $$('#rate .quality-box').find('.rate-text');
  49 + var rateText = parentBox.find('.rate-text');
45 50 var txt = $$(n).attr('data-txt');
46 51  
47 52 rateText.html(txt);
... ... @@ -51,19 +56,94 @@ define(
51 56 })
52 57 })
53 58 }
  59 + ctrl.uploadImgEvent = function() {
  60 + var me = this;
  61 +
  62 + $$('#rate #upload-btn').change(function () {
  63 + if ('' == $$(this).val() || null == $$(this).val()) {
  64 + return;
  65 + }
  66 + var uploadParent = $$(this).parents('li');
  67 +
  68 + uploadjs.uploadFile({
  69 + selector: '#upload-btn',
  70 + url: url.to(uploadURL),
  71 + processAppendTo: '#rate',
  72 + success: function (response, e) {
  73 + try {
  74 + if (response.success) {
  75 + var imgUrl = response.tmpUrl;
  76 + $$('<li class="upload-li up-img"><div data="' + response.tmpFile + '" data-url="' + imgUrl + '" class="upload-item" style="background-image:url(' + response.tmpMinUrl + ')">' + '</div><span class="del-img"></span></li>').insertBefore(uploadParent);
  77 + if (me.imgLimit == $$('#rate #image-list').find('.up-img').length) {
  78 + $$('#rate .upload-btn-li').hide();
  79 + }
  80 + } else {
  81 + utils.toast({content: response.message, closeDelay: 5000});
  82 + }
  83 + } catch (ex) {
  84 + console.log(ex)
  85 + utils.toast({content: '出错', closeDelay: 5000});
  86 + }
  87 + }
  88 + });
  89 + })
  90 +
  91 + $$('#rate #image-list').on('click', '.del-img', function(e){
  92 + $$(this).parent().remove();
  93 + if (me.imgLimit >= $$('#rate #image-list').find('.up-img').length) {
  94 + $$('#rate .upload-btn-li').show();
  95 + }
  96 + })
  97 + }
  98 + ctrl.getUploadImgs = function() {
  99 + var images = $$('#rate #image-list').find('.up-img');
  100 + var returnImg = [];
  101 + if (images.length == 0 ) {
  102 + return [];
  103 + }
  104 + $$.each(images, function(i, n){
  105 + var img = $$(n).find('.upload-item');
  106 + returnImg.push(img.attr('data'))
  107 + })
  108 +
  109 + return returnImg;
  110 + }
54 111 ctrl.submitEvent = function() {
55 112 var me = this;
56 113 $$('#rate .submit-btn').click(function(e){
57 114 var comment = utils.trim($$('#rate .text-content').val());
58   - var stars = $$('#rate .img-star')
59   - var star = 0;
60   - $$.each(stars, function(i,n){
  115 + var qualityStars = $$('#rate .quality-box .img-star')
  116 + var qualityStar = 0;
  117 + $$.each(qualityStars, function(i,n){
61 118 if($$(n).hasClass('star-on')) {
62   - star++
  119 + qualityStar++
63 120 }
64 121 })
65 122  
66   - var pData = me.csrf({star:star,comment:comment,id:me.id});
  123 + var effectStars = $$('#rate .effect-box .img-star')
  124 + var effectStar = 0;
  125 + $$.each(effectStars, function(i,n){
  126 + if($$(n).hasClass('star-on')) {
  127 + effectStar++
  128 + }
  129 + })
  130 +
  131 + var serviceStars = $$('#rate .service-box .img-star')
  132 + var serviceStar = 0;
  133 + $$.each(serviceStars, function(i,n){
  134 + if($$(n).hasClass('star-on')) {
  135 + serviceStar++
  136 + }
  137 + })
  138 + var images = me.getUploadImgs();
  139 + var pData = me.csrf({
  140 + comment:comment,
  141 + id:me.id,
  142 + qualityStar:qualityStar,
  143 + effectStar:effectStar,
  144 + serviceStar:serviceStar,
  145 + images:images
  146 + });
67 147 utils.httpPost(url.to(submitURL), pData, function(res) {
68 148 if (res.success) {
69 149 window.location.replace(url.to('order/customer#customer-order/'+me.id+'/'+me.sn));
... ...
web/src/js/order/submit-controller.js
... ... @@ -63,7 +63,7 @@ define(
63 63 utils.toast({content: response.message, closeDelay: 5000});
64 64 }
65 65 } catch (ex) {
66   - console.log(ex)
  66 + //console.log(ex)
67 67 utils.toast({content: '出错', closeDelay: 5000});
68 68 }
69 69 }
... ... @@ -120,11 +120,12 @@ define(
120 120 utils.toast({content:'预估维修费用必填'});
121 121 return false;
122 122 }
  123 + */
123 124 if ('' == finishDate) {
124 125 utils.toast({content:'预估完成时间必填'});
125 126 return false;
126 127 }
127   - */
  128 +
128 129 var imgs = me.getUploadImgs();
129 130 if (0 == imgs.length) {
130 131 utils.toast({content:'请上传车损照'});
... ... @@ -339,7 +340,7 @@ define(
339 340 $$('#submit').on('click', '.carModel',function(e) {
340 341 $$('#search-wrapper').remove();
341 342 var page = $$('#submit');
342   - var ele = $$('script#search-carr-model-template');
  343 + var ele = $$('script#search-car-model-template');
343 344 var compiled = t7.compile(ele.html());
344 345 var doms = compiled({keyword: ''});
345 346 page.append(doms);
... ... @@ -395,7 +396,6 @@ define(
395 396 $$('#submit').on('click','.model-div-btn', function(e){
396 397 var model = $$(this).attr('data-value');
397 398 $$('#submit .carModel').val(model);
398   -
399 399 $$('#search-wrapper').remove();
400 400 })
401 401 $$('#submit').on('click','.closeBtn', function(e){
... ...
web/src/js/user/register-controller.js
... ... @@ -41,6 +41,7 @@ define(
41 41 me.getCodeEvent();
42 42 me.registerEvent();
43 43 me.gotoLoginEvent();
  44 + me.checkAgreement();
44 45 }
45 46 ctrl.uploadEvent = function() {
46 47 $$('#register .upload-input-cls').change(function() {
... ... @@ -123,6 +124,9 @@ define(
123 124 var name = utils.trim($$('#register .name').val());
124 125 var mobile = utils.trim($$('#register .mobile').val());
125 126 var code = utils.trim($$('#register .code').val());
  127 + var emergencyContact = utils.trim($$('#register .emergency_contact').val());
  128 + var emergencyPerson = utils.trim($$('#register .emergency_person').val());
  129 +
126 130 if ('' == name) {
127 131 utils.toast({content:'车厂名称必填'})
128 132 return false;
... ... @@ -140,23 +144,76 @@ define(
140 144 return false;
141 145 }
142 146  
  147 + if ('' == emergencyPerson) {
  148 + utils.toast({content:'紧急联系人必填'})
  149 + return false;
  150 + }
  151 +
  152 + if ('' == emergencyContact) {
  153 + utils.toast({content:'紧急联系电话必填'})
  154 + return false;
  155 + }
  156 +
  157 + if (!utils.isMobile(emergencyContact) && !utils.isTelephone(emergencyContact)) {
  158 + utils.toast({content:'紧急联系电话不合格'})
  159 + return false;
  160 + }
  161 + if (emergencyContact == mobile) {
  162 + utils.toast({content:'紧急联系电话不能和注册手机一样'})
  163 + return false;
  164 + }
  165 +
143 166 var licensePic = $$('#register .licensePic').attr('data');
144 167 if (undefined === licensePic || null == licensePic) {
145 168 utils.toast({content:'请上传营业执照'})
146 169 return false;
147 170 }
  171 + var headPic = $$('#register .headPic').attr('data');
  172 + if (undefined === headPic || null == headPic) {
  173 + utils.toast({content:'请上传维修厂门头照'})
  174 + return false;
  175 + }
  176 + var techChargePic = $$('#register .techChargePic').attr('data');
  177 + if (undefined === techChargePic || null == techChargePic) {
  178 + utils.toast({content:'请上传维修技术负责人证书'})
  179 + return false;
  180 + }
  181 + var QAChargePic = $$('#register .QAChargePic').attr('data');
  182 + if (undefined === QAChargePic || null == QAChargePic) {
  183 + utils.toast({content:'请上传质检负责人证书'})
  184 + return false;
  185 + }
  186 +
  187 + if (!$$('#register .check-agreement').hasClass('checked-active')) {
  188 + utils.toast({content:'请阅读同意《平台车管家服务条款》'})
  189 + return false;
  190 + }
  191 +
148 192 if (false == registerClick) {
149 193 return false;
150 194 }
151 195 registerClick = false;
152   - var pData = me.csrf({name:name, mobile:mobile,code:code,licensePic:licensePic})
  196 + var pData = me.csrf({
  197 + name:name, mobile:mobile,code:code,
  198 + emergencyContact:emergencyContact,emergencyPerson:emergencyPerson,
  199 + licensePic:licensePic,
  200 + headPic:headPic,
  201 + techChargePic:techChargePic,
  202 + QAChargePic:QAChargePic,
  203 + })
  204 +
153 205 utils.httpPost(url.to(registerUrl),pData, function(res) {
154 206 if (!res.success) {
155 207 utils.toast({content:res.message,closeDelay:3000})
156 208 registerClick = true;
157 209 return false;
158 210 } else {
159   - window.location.href = url.to('order/#index');
  211 + var closeDelay = 3000;
  212 + utils.toast({content:res.message, closeDelay:closeDelay})
  213 + setTimeout(function(){
  214 + window.location.href = url.to('order/#index');
  215 + }, closeDelay)
  216 +
160 217 }
161 218 })
162 219 })
... ... @@ -166,6 +223,33 @@ define(
166 223 window.location.href = url.to('user/#login');
167 224 })
168 225 }
  226 + ctrl.checkAgreement = function() {
  227 + $$('#register .check-agreement').click(function(e) {
  228 + if($$(this).hasClass('checked-active')) {
  229 + $$(this).removeClass('checked-active');
  230 + } else {
  231 + $$(this).addClass('checked-active');
  232 + }
  233 + })
  234 +
  235 + $$('#register .agreement-cls').click(function(e){
  236 + $$('#agreement-wrapper').remove();
  237 + var page = $$('#register');
  238 + var ele = $$('script#agreement-template');
  239 + var compiled = t7.compile(ele.html());
  240 + var doms = compiled({});
  241 + page.append(doms);
  242 + })
  243 +
  244 + $$('#register').on('click','.agree-btn', function(e){
  245 + $$('#agreement-wrapper').remove();
  246 + var checkAgreement = $$('#register .check-agreement');
  247 + if(!checkAgreement.hasClass('checked-active')) {
  248 + checkAgreement.addClass('checked-active');
  249 + }
  250 +
  251 + })
  252 + }
169 253 return ctrl;
170 254 }
171 255 );
... ...