Commit 32926e460f8938a8d21fd8a91cbc3115462c621e
1 parent
e1558792
Exists in
master
app-wx(v0.1.0 build 11)
1. F 调整维修厂登录和注册的User 类 2. A 注册登录集成 发短信码 3. F 提交维修单界面,录入车型改为查找筛选. 非必填字段调整 4. A 完成维修订单那里默认价格0 去除了
Showing
16 changed files
with
298 additions
and
162 deletions
Show diff stats
app-wx/config/main.php
@@ -23,7 +23,7 @@ return [ | @@ -23,7 +23,7 @@ return [ | ||
23 | ], | 23 | ], |
24 | 'components' => [ | 24 | 'components' => [ |
25 | 'user' => [ | 25 | 'user' => [ |
26 | - 'identityClass' => 'app\wx\models\User', | 26 | + 'identityClass' => 'app\wx\models\UserIdentity', |
27 | 'enableAutoLogin' => true, | 27 | 'enableAutoLogin' => true, |
28 | 'identityCookie' => ['name' => '_identity-gk', 'httpOnly' => true], | 28 | 'identityCookie' => ['name' => '_identity-gk', 'httpOnly' => true], |
29 | ], | 29 | ], |
app-wx/config/params.php
app-wx/models/User.php
@@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
3 | namespace app\wx\models; | 3 | namespace app\wx\models; |
4 | 4 | ||
5 | use Yii; | 5 | use Yii; |
6 | +use yii\base\NotSupportedException; | ||
6 | use yii\web\IdentityInterface; | 7 | use yii\web\IdentityInterface; |
7 | use domain\user\models\User as UserModel; | 8 | use domain\user\models\User as UserModel; |
8 | 9 | ||
@@ -12,105 +13,42 @@ use domain\user\models\User as UserModel; | @@ -12,105 +13,42 @@ use domain\user\models\User as UserModel; | ||
12 | */ | 13 | */ |
13 | class User extends UserModel implements IdentityInterface | 14 | class User extends UserModel implements IdentityInterface |
14 | { | 15 | { |
15 | - | ||
16 | - static $id = null; | ||
17 | - public function register() | 16 | + /** |
17 | + * @param mixed $condition | ||
18 | + * @return static | ||
19 | + */ | ||
20 | + static function findOne($condition) | ||
18 | { | 21 | { |
19 | - | 22 | + return parent::findOne($condition); // TODO: Change the autogenerated stub |
20 | } | 23 | } |
21 | 24 | ||
22 | - | ||
23 | - | ||
24 | - | ||
25 | - | ||
26 | - /** | ||
27 | - * Finds an identity by the given ID. | ||
28 | - * | ||
29 | - * @param string|int $id the ID to be looked for | ||
30 | - * @return IdentityInterface|null the identity object that matches the given ID. | ||
31 | - */ | 25 | + /** @inheritdoc */ |
32 | public static function findIdentity($id) | 26 | public static function findIdentity($id) |
33 | { | 27 | { |
34 | return static::findOne($id); | 28 | return static::findOne($id); |
35 | } | 29 | } |
36 | 30 | ||
37 | - /** | ||
38 | - * Finds an identity by the given token. | ||
39 | - * | ||
40 | - * @param string $token the token to be looked for | ||
41 | - * @return IdentityInterface|null the identity object that matches the given token. | ||
42 | - */ | 31 | + /** @inheritdoc */ |
43 | public static function findIdentityByAccessToken($token, $type = null) | 32 | public static function findIdentityByAccessToken($token, $type = null) |
44 | { | 33 | { |
45 | - return static::findOne(['access_token' => $token]); | 34 | + throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.'); |
46 | } | 35 | } |
47 | 36 | ||
48 | - /** | ||
49 | - * @inheritdoc | ||
50 | - */ | 37 | + /** @inheritdoc */ |
51 | public function getId() | 38 | public function getId() |
52 | { | 39 | { |
53 | - return self::getIdFromSession(); | 40 | + return $this->getAttribute('id'); |
54 | } | 41 | } |
55 | 42 | ||
56 | - /** | ||
57 | - * @inheritdoc | ||
58 | - */ | 43 | + /** @inheritdoc */ |
59 | public function getAuthKey() | 44 | public function getAuthKey() |
60 | { | 45 | { |
61 | - return ''; | 46 | + return $this->getAttribute('auth_key'); |
62 | } | 47 | } |
63 | 48 | ||
64 | - /** | ||
65 | - * @inheritdoc | ||
66 | - */ | 49 | + /** @inheritdoc */ |
67 | public function validateAuthKey($authKey) | 50 | public function validateAuthKey($authKey) |
68 | { | 51 | { |
69 | - return true; | ||
70 | - } | ||
71 | - | ||
72 | - /** | ||
73 | - * Validates password | ||
74 | - * | ||
75 | - * @param string $password password to validate | ||
76 | - * @return bool if password provided is valid for current user | ||
77 | - */ | ||
78 | - public function validatePassword($password) | ||
79 | - { | ||
80 | - return true ;//Yii::$app->security->validatePassword($password, $this->password_hash); | ||
81 | - } | ||
82 | - | ||
83 | - /** | ||
84 | - * Generates password hash from password and sets it to the model | ||
85 | - * | ||
86 | - * @param string $password | ||
87 | - */ | ||
88 | - public function setPassword($password) | ||
89 | - { | ||
90 | - $this->password_hash = Yii::$app->security->generatePasswordHash($password); | ||
91 | - } | ||
92 | - | ||
93 | - /** | ||
94 | - * Generates new password reset token | ||
95 | - */ | ||
96 | - public function generatePasswordResetToken() | ||
97 | - { | ||
98 | - $this->password_reset_token = Yii::$app->security->generateRandomString() . '_' . time(); | ||
99 | - } | ||
100 | - | ||
101 | - /** | ||
102 | - * @return mixed|null | ||
103 | - */ | ||
104 | - protected static function getIdFromSession() | ||
105 | - { | ||
106 | - if (null === self::$id){ | ||
107 | - $user = Yii::$app->getUser(); | ||
108 | - $session = Yii::$app->getSession(); | ||
109 | - $id = $session->getHasSessionId() || $session->getIsActive() ? $session->get($user->idParam) : null; | ||
110 | - self::$id = $id; | ||
111 | - } | ||
112 | - | ||
113 | - return self::$id; | 52 | + return $this->getAttribute('auth_key') == $authKey; |
114 | } | 53 | } |
115 | - | ||
116 | } | 54 | } |
app-wx/models/UserIdentity.php
1 | <?php namespace app\wx\models; | 1 | <?php namespace app\wx\models; |
2 | 2 | ||
3 | -use yii; | 3 | +use Yii; |
4 | use yii\web\IdentityInterface; | 4 | use yii\web\IdentityInterface; |
5 | +use app\wx\models\User as UserModel; | ||
5 | 6 | ||
6 | /** | 7 | /** |
7 | - * Class UserIdentity | 8 | + * Class User |
8 | * @package app\wx\models | 9 | * @package app\wx\models |
9 | */ | 10 | */ |
10 | -class UserIdentity implements IdentityInterface | 11 | +class UserIdentity extends UserModel |
11 | { | 12 | { |
12 | - /** | ||
13 | - * @var null | ||
14 | - */ | ||
15 | static $id = null; | 13 | static $id = null; |
16 | 14 | ||
17 | /** | 15 | /** |
18 | - * @param int|string $id | ||
19 | - * @return IdentityInterface | 16 | + * Finds an identity by the given ID. |
17 | + * | ||
18 | + * @param string|int $id the ID to be looked for | ||
19 | + * @return IdentityInterface|null the identity object that matches the given ID. | ||
20 | */ | 20 | */ |
21 | public static function findIdentity($id) | 21 | public static function findIdentity($id) |
22 | { | 22 | { |
23 | - self::getIdFromSession(); | ||
24 | - return new UserIdentity(); | 23 | + return static::findOne($id); |
25 | } | 24 | } |
26 | 25 | ||
27 | /** | 26 | /** |
28 | - * @param mixed $token | ||
29 | - * @param null $type | ||
30 | - * @return IdentityInterface | 27 | + * Finds an identity by the given token. |
28 | + * | ||
29 | + * @param string $token the token to be looked for | ||
30 | + * @return IdentityInterface|null the identity object that matches the given token. | ||
31 | */ | 31 | */ |
32 | public static function findIdentityByAccessToken($token, $type = null) | 32 | public static function findIdentityByAccessToken($token, $type = null) |
33 | { | 33 | { |
34 | - return self::getIdFromSession(); | ||
35 | - return new UserIdentity(); | 34 | + return static::findOne(['access_token' => $token]); |
36 | } | 35 | } |
37 | 36 | ||
38 | /** | 37 | /** |
39 | - * @return int|string $id | 38 | + * @inheritdoc |
40 | */ | 39 | */ |
41 | public function getId() | 40 | public function getId() |
42 | { | 41 | { |
@@ -44,17 +43,15 @@ class UserIdentity implements IdentityInterface | @@ -44,17 +43,15 @@ class UserIdentity implements IdentityInterface | ||
44 | } | 43 | } |
45 | 44 | ||
46 | /** | 45 | /** |
47 | - *不启动自动登录,AuthKey 是用来设定到cookie的字符串 | ||
48 | - * | 46 | + * @inheritdoc |
49 | */ | 47 | */ |
50 | public function getAuthKey() | 48 | public function getAuthKey() |
51 | { | 49 | { |
52 | - return ""; | 50 | + return ''; |
53 | } | 51 | } |
54 | 52 | ||
55 | /** | 53 | /** |
56 | - * 不启动自动登录,这里默认返回true | ||
57 | - * @param string $authKey | 54 | + * @inheritdoc |
58 | */ | 55 | */ |
59 | public function validateAuthKey($authKey) | 56 | public function validateAuthKey($authKey) |
60 | { | 57 | { |
@@ -62,12 +59,41 @@ class UserIdentity implements IdentityInterface | @@ -62,12 +59,41 @@ class UserIdentity implements IdentityInterface | ||
62 | } | 59 | } |
63 | 60 | ||
64 | /** | 61 | /** |
62 | + * Validates password | ||
63 | + * | ||
64 | + * @param string $password password to validate | ||
65 | + * @return bool if password provided is valid for current user | ||
66 | + */ | ||
67 | + public function validatePassword($password) | ||
68 | + { | ||
69 | + return true ;//Yii::$app->security->validatePassword($password, $this->password_hash); | ||
70 | + } | ||
71 | + | ||
72 | + /** | ||
73 | + * Generates password hash from password and sets it to the model | ||
74 | + * | ||
75 | + * @param string $password | ||
76 | + */ | ||
77 | + public function setPassword($password) | ||
78 | + { | ||
79 | + $this->password_hash = Yii::$app->security->generatePasswordHash($password); | ||
80 | + } | ||
81 | + | ||
82 | + /** | ||
83 | + * Generates new password reset token | ||
84 | + */ | ||
85 | + public function generatePasswordResetToken() | ||
86 | + { | ||
87 | + $this->password_reset_token = Yii::$app->security->generateRandomString() . '_' . time(); | ||
88 | + } | ||
89 | + | ||
90 | + /** | ||
65 | * @return mixed|null | 91 | * @return mixed|null |
66 | */ | 92 | */ |
67 | protected static function getIdFromSession() | 93 | protected static function getIdFromSession() |
68 | { | 94 | { |
69 | if (null === self::$id){ | 95 | if (null === self::$id){ |
70 | - $user = \Yii::$app->getUser(); | 96 | + $user = Yii::$app->getUser(); |
71 | $session = Yii::$app->getSession(); | 97 | $session = Yii::$app->getSession(); |
72 | $id = $session->getHasSessionId() || $session->getIsActive() ? $session->get($user->idParam) : null; | 98 | $id = $session->getHasSessionId() || $session->getIsActive() ? $session->get($user->idParam) : null; |
73 | self::$id = $id; | 99 | self::$id = $id; |
app-wx/modules/order/controllers/CustomerController.php
@@ -68,16 +68,23 @@ class CustomerController extends CustomerBaseController | @@ -68,16 +68,23 @@ class CustomerController extends CustomerBaseController | ||
68 | $hasComment = true; | 68 | $hasComment = true; |
69 | $comments = ['starTxt' => RepairOrderRate::starLabel($rateModel->star_count), 'comment' => $rateModel->comment]; | 69 | $comments = ['starTxt' => RepairOrderRate::starLabel($rateModel->star_count), 'comment' => $rateModel->comment]; |
70 | } | 70 | } |
71 | - | 71 | + $preFinishDate = '暂无'; |
72 | + $predictPrice = '暂无'; | ||
73 | + if($orderModel->predict_finish_time) { | ||
74 | + $preFinishDate = date('Y-m-d H:00', $orderModel->predict_finish_time); | ||
75 | + } | ||
76 | + if($orderModel->predict_price) { | ||
77 | + $predictPrice = $orderModel->predict_price.'元'; | ||
78 | + } | ||
72 | $e->success = true; | 79 | $e->success = true; |
73 | $e->item = [ | 80 | $e->item = [ |
74 | 'carNo' => $orderModel->car_no, | 81 | 'carNo' => $orderModel->car_no, |
75 | 'carModel' => $orderModel->car_model, | 82 | 'carModel' => $orderModel->car_model, |
76 | 'customer' => $orderModel->customer, | 83 | 'customer' => $orderModel->customer, |
77 | 'mobile' => '1*****'.substr($orderModel->contact_mobile,7,4), | 84 | 'mobile' => '1*****'.substr($orderModel->contact_mobile,7,4), |
78 | - 'preRepair' => $orderModel->predict_fault, | ||
79 | - 'repairPrice' => $orderModel->predict_price.'元', | ||
80 | - 'preFinishDate' => date('Y-m-d H:00', $orderModel->predict_finish_time), | 85 | + 'preRepair' => empty($orderModel->predict_fault)?'暂无':$orderModel->predict_fault, |
86 | + 'repairPrice' => $predictPrice, | ||
87 | + 'preFinishDate' => $preFinishDate, | ||
81 | 'orderDateTime' => date('Y-m-d H:00', $orderModel->created_at), | 88 | 'orderDateTime' => date('Y-m-d H:00', $orderModel->created_at), |
82 | 'status' => RepairOrderStatus::getEnLabel($orderModel->status), | 89 | 'status' => RepairOrderStatus::getEnLabel($orderModel->status), |
83 | 'hasComment' => $hasComment, | 90 | 'hasComment' => $hasComment, |
app-wx/modules/order/controllers/DefaultController.php
@@ -63,6 +63,12 @@ class DefaultController extends BaseController | @@ -63,6 +63,12 @@ class DefaultController extends BaseController | ||
63 | $e->message = '联系电话未填'; | 63 | $e->message = '联系电话未填'; |
64 | return $this->renderJson($e); | 64 | return $this->renderJson($e); |
65 | } | 65 | } |
66 | + if (empty($finishDate)) { | ||
67 | + $predict_finish_time= null; | ||
68 | + } else { | ||
69 | + $predict_finish_time = strtotime($finishDate.':00:00'); | ||
70 | + } | ||
71 | + | ||
66 | 72 | ||
67 | $data = [ | 73 | $data = [ |
68 | 'user_id' => $userId, | 74 | 'user_id' => $userId, |
@@ -72,7 +78,7 @@ class DefaultController extends BaseController | @@ -72,7 +78,7 @@ class DefaultController extends BaseController | ||
72 | 'contact_mobile' => $phone, | 78 | 'contact_mobile' => $phone, |
73 | 'predict_fault' => $preRepair, | 79 | 'predict_fault' => $preRepair, |
74 | 'predict_price' => $predictPrice, | 80 | 'predict_price' => $predictPrice, |
75 | - 'predict_finish_time' => strtotime($finishDate.':00:00'), | 81 | + 'predict_finish_time' => $predict_finish_time, |
76 | 'status' => RepairOrderStatus::WORKING, | 82 | 'status' => RepairOrderStatus::WORKING, |
77 | ]; | 83 | ]; |
78 | $tran = Yii::$app->db->beginTransaction(); | 84 | $tran = Yii::$app->db->beginTransaction(); |
@@ -195,15 +201,23 @@ class DefaultController extends BaseController | @@ -195,15 +201,23 @@ class DefaultController extends BaseController | ||
195 | $comments = ['starTxt' => RepairOrderRate::starLabel($rateModel->star_count), 'comment' => $rateModel->comment]; | 201 | $comments = ['starTxt' => RepairOrderRate::starLabel($rateModel->star_count), 'comment' => $rateModel->comment]; |
196 | } | 202 | } |
197 | $shortId = $orderModel->short_uuid; | 203 | $shortId = $orderModel->short_uuid; |
204 | + $preFinishDate = '暂无'; | ||
205 | + $predictPrice = '暂无'; | ||
206 | + if($orderModel->predict_finish_time) { | ||
207 | + $preFinishDate = date('Y-m-d H:00', $orderModel->predict_finish_time); | ||
208 | + } | ||
209 | + if($orderModel->predict_price) { | ||
210 | + $predictPrice = $orderModel->predict_price.'元'; | ||
211 | + } | ||
198 | $e->success = true; | 212 | $e->success = true; |
199 | $e->item = [ | 213 | $e->item = [ |
200 | 'carNo' => $orderModel->car_no, | 214 | 'carNo' => $orderModel->car_no, |
201 | 'carModel' => $orderModel->car_model, | 215 | 'carModel' => $orderModel->car_model, |
202 | 'customer' => $orderModel->customer, | 216 | 'customer' => $orderModel->customer, |
203 | 'mobile' => $orderModel->contact_mobile, | 217 | 'mobile' => $orderModel->contact_mobile, |
204 | - 'preRepair' => $orderModel->predict_fault, | ||
205 | - 'repairPrice' => $orderModel->predict_price.'元', | ||
206 | - 'preFinishDate' => date('Y-m-d H:00', $orderModel->predict_finish_time), | 218 | + 'preRepair' => empty($orderModel->predict_fault)?'暂无':$orderModel->predict_fault, |
219 | + 'repairPrice' => $predictPrice, | ||
220 | + 'preFinishDate' => $preFinishDate, | ||
207 | 'orderDateTime' => date('Y-m-d H:00', $orderModel->created_at), | 221 | 'orderDateTime' => date('Y-m-d H:00', $orderModel->created_at), |
208 | 'status' => RepairOrderStatus::getEnLabel($orderModel->status), | 222 | 'status' => RepairOrderStatus::getEnLabel($orderModel->status), |
209 | 'hasComment' => $hasComment, | 223 | 'hasComment' => $hasComment, |
@@ -264,4 +278,43 @@ class DefaultController extends BaseController | @@ -264,4 +278,43 @@ class DefaultController extends BaseController | ||
264 | return $this->renderJson($e); | 278 | return $this->renderJson($e); |
265 | } | 279 | } |
266 | 280 | ||
281 | + /** | ||
282 | + * 查找汽车型号 | ||
283 | + * @return string | ||
284 | + */ | ||
285 | + public function actionSearchModel() | ||
286 | + { | ||
287 | + $e = new stdClass(); | ||
288 | + $e->success = false; | ||
289 | + $request = Yii::$app->request; | ||
290 | + $keyword = $request->post('keyword'); | ||
291 | + if (empty($keyword)) { | ||
292 | + $e->message = '关键字为空'; | ||
293 | + return $this->renderJson($e); | ||
294 | + } | ||
295 | + $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'], | ||
309 | + ]; | ||
310 | + foreach ($models as $k => $v) { | ||
311 | + if (false !== strpos($v['name'], strtoupper($keyword))) { | ||
312 | + $items[] = $v; | ||
313 | + } | ||
314 | + } | ||
315 | + $e->items = $items; | ||
316 | + $e->success = true; | ||
317 | + return $this->renderJson($e); | ||
318 | + } | ||
319 | + | ||
267 | } | 320 | } |
268 | \ No newline at end of file | 321 | \ No newline at end of file |
app-wx/modules/order/views/default/pages/cost-list-template.php
@@ -22,8 +22,8 @@ $baseUrl = Url::base(true); | @@ -22,8 +22,8 @@ $baseUrl = Url::base(true); | ||
22 | #cost-list .img-plus {width: 1rem; height: 1rem; vertical-align: text-top; margin-right: 0.2rem} | 22 | #cost-list .img-plus {width: 1rem; height: 1rem; vertical-align: text-top; margin-right: 0.2rem} |
23 | #cost-list .item-title { font-size:0.88rem;display:inline-block;font-weight:400; color:rgba(186,186,186,1); line-height:1.81rem;} | 23 | #cost-list .item-title { font-size:0.88rem;display:inline-block;font-weight:400; color:rgba(186,186,186,1); line-height:1.81rem;} |
24 | #cost-list .input-cls{font-size: 1rem;line-height: inherit} | 24 | #cost-list .input-cls{font-size: 1rem;line-height: inherit} |
25 | - #cost-list .input-left {width:70%; padding: 0 0.5rem; height:2.47rem; background:rgba(255,255,255,1); border:1px solid rgba(221,221,221,1); border-radius:0rem 0rem 0rem 0rem;} | ||
26 | - #cost-list .input-right {width:30%; height:2.47rem; padding: 0 0.5rem; text-align: center; background:rgba(255,255,255,1); border:1px solid rgba(221,221,221,1); border-radius:0rem 0rem 0rem 0rem; border-left: none} | 25 | + #cost-list .input-left {width:70%; padding: 0 0.5rem; height:2.47rem; background:rgba(255,255,255,1); border:1px solid rgba(221,221,221,1); border-radius:0;} |
26 | + #cost-list .input-right {width:30%; height:2.47rem; padding: 0 0.5rem; text-align: center; background:rgba(255,255,255,1); border:1px solid rgba(221,221,221,1); border-radius:0; border-left: none} | ||
27 | #cost-list .repair-item-cls .del-plan{width:1.2rem;position: absolute;top: -18px;right: -2px;height: 1.2rem;background: url('<?=$baseUrl?>/i/order/trash.png');background-repeat: no-repeat;background-size: 1rem auto;background-position: 1px 1px;display:inline-block;z-index:12} | 27 | #cost-list .repair-item-cls .del-plan{width:1.2rem;position: absolute;top: -18px;right: -2px;height: 1.2rem;background: url('<?=$baseUrl?>/i/order/trash.png');background-repeat: no-repeat;background-size: 1rem auto;background-position: 1px 1px;display:inline-block;z-index:12} |
28 | #cost-list .upload-box{padding: 1rem;box-sizing: border-box;background:#fff;margin-top:1rem;} | 28 | #cost-list .upload-box{padding: 1rem;box-sizing: border-box;background:#fff;margin-top:1rem;} |
29 | #cost-list .upload-box .upload-title{line-height: 1.5rem;color:#000000;margin-bottom: 0.5rem;font-size:1rem;} | 29 | #cost-list .upload-box .upload-title{line-height: 1.5rem;color:#000000;margin-bottom: 0.5rem;font-size:1rem;} |
@@ -62,7 +62,7 @@ $baseUrl = Url::base(true); | @@ -62,7 +62,7 @@ $baseUrl = Url::base(true); | ||
62 | <div class="cost-list-div"> | 62 | <div class="cost-list-div"> |
63 | <p class="item-title">第1项</p> | 63 | <p class="item-title">第1项</p> |
64 | <div class="repair-item-cls"> | 64 | <div class="repair-item-cls"> |
65 | - <input type="text" class="input-left input-cls" placeholder="填写维修内容" value=""/><input type="number" class="input-right input-cls" placeholder="填写价格" value="0"/> | 65 | + <input type="text" class="input-left input-cls" placeholder="填写维修内容" value=""/><input type="number" class="input-right input-cls" placeholder="价格" value=""/> |
66 | 66 | ||
67 | </div> | 67 | </div> |
68 | </div> | 68 | </div> |
app-wx/modules/order/views/default/pages/submit-template.php
@@ -19,7 +19,13 @@ $baseUrl = Url::base(true); | @@ -19,7 +19,13 @@ $baseUrl = Url::base(true); | ||
19 | #submit .s-li-div .s-li-div-input{font-size: 1rem;width:100%;border: 0;line-height: inherit} | 19 | #submit .s-li-div .s-li-div-input{font-size: 1rem;width:100%;border: 0;line-height: inherit} |
20 | #submit .s-li-label{color:#000000;font-size:1rem;line-height: 1.25rem;display: flex;align-items: center;padding:0.3rem 0;} | 20 | #submit .s-li-label{color:#000000;font-size:1rem;line-height: 1.25rem;display: flex;align-items: center;padding:0.3rem 0;} |
21 | #submit .s-li-div .require-cls{color:#FC7621;display:flex;align-items: center;margin-left: 0.3rem;} | 21 | #submit .s-li-div .require-cls{color:#FC7621;display:flex;align-items: center;margin-left: 0.3rem;} |
22 | - | 22 | + #submit .s-li-div .repairPrice{padding-right: 1.5rem;box-sizing: border-box;} |
23 | + #submit .s-li-div .price-union-cls{display: inline-block;position: absolute; right: 0.5rem;top:0.5rem} | ||
24 | + #submit .s-li-div .down-arrow{ width: 0; | ||
25 | + height: 0; | ||
26 | + border-width: 0.4rem; | ||
27 | + border-top-width: 0.5rem; | ||
28 | + border-bottom:0;position: absolute;right: 0.5rem;top:0.8rem;border-style: solid;border-color: #999 rgba(0,0,0,0) rgba(0,0,0,0) rgba(0,0,0,0);} | ||
23 | #submit .upload-box{padding: 1rem;box-sizing: border-box;background:#fff;margin-top:1rem;} | 29 | #submit .upload-box{padding: 1rem;box-sizing: border-box;background:#fff;margin-top:1rem;} |
24 | #submit .upload-box .upload-title{line-height: 1.5rem;color:#000000;margin-bottom: 0.5rem;font-size:1rem;} | 30 | #submit .upload-box .upload-title{line-height: 1.5rem;color:#000000;margin-bottom: 0.5rem;font-size:1rem;} |
25 | #submit .upload-box .note-cls{color:#555555;font-size:0.75rem} | 31 | #submit .upload-box .note-cls{color:#555555;font-size:0.75rem} |
@@ -36,6 +42,22 @@ $baseUrl = Url::base(true); | @@ -36,6 +42,22 @@ $baseUrl = Url::base(true); | ||
36 | #submit .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;} | 42 | #submit .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;} |
37 | #submit .submit-btn-box{width:100%;display: block;padding:2rem ;box-sizing: border-box} | 43 | #submit .submit-btn-box{width:100%;display: block;padding:2rem ;box-sizing: border-box} |
38 | #submit .submit-btn-box .submit-btn-cls{width:100%;background-color:#FF8728;color:#fff;border-radius: 2rem;padding:1rem; box-sizing: border-box;font-size: 1rem;text-align: center;margin:0 auto;} | 44 | #submit .submit-btn-box .submit-btn-cls{width:100%;background-color:#FF8728;color:#fff;border-radius: 2rem;padding:1rem; box-sizing: border-box;font-size: 1rem;text-align: center;margin:0 auto;} |
45 | + #submit #search-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);} | ||
46 | + #submit #search-wrapper .search-wrapper-inner{width:100%;background: #fff;height:100%;} | ||
47 | + #submit #search-wrapper .search-input-cls{ font-size: 1rem;line-height: inherit; width: 100%;padding: 0; border: 0;background: #EFEFEF;} | ||
48 | + #submit #search-wrapper .search-box-cls{width: 100%;line-height: 1.0rem;padding: 0.5rem 0.8rem;box-sizing: border-box;padding-top:1.25rem;position: relative} | ||
49 | + | ||
50 | + .pages #search-wrapper .search-box-cls .closeBtn{position: absolute;top:-1rem;right:-0.5rem;width:1.5rem;height:1.5rem;border-radius: 1rem;background: #fff;border: 1px solid #999;} | ||
51 | + .pages #search-wrapper .search-box-cls .closeBtn:before, | ||
52 | + .pages #search-wrapper .search-box-cls .closeBtn:after{content:'';display:block;width:1px ;height:0.8rem;background: #999;transform: rotate(45deg); top: 5px;right: 11px;position:absolute} | ||
53 | + .pages #search-wrapper .search-box-cls .closeBtn:after{transform: rotate(-45deg); top: 5px;right: 11px;} | ||
54 | + .pages #search-wrapper .model-list{padding: 0 0.8rem;width: 100%;box-sizing: border-box;} | ||
55 | + .pages #search-wrapper .model-list .model-div-cls{padding-bottom: 0.3rem;border-bottom: 1px solid #ccc;line-height: 1.5rem} | ||
56 | + .pages #search-wrapper .model-list .model-item-cls{padding:0.5rem 0;padding-top:0;width: 100%;} | ||
57 | + | ||
58 | + #search-wrapper .search-form{display:flex;width:100%;} | ||
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 | + #search-wrapper .search-input-box{width:100%;background:#EFEFEF;padding: 0.3rem;box-sizing: border-box;} | ||
39 | </style> | 61 | </style> |
40 | <script id="submit-template" type="text/template"> | 62 | <script id="submit-template" type="text/template"> |
41 | <div class="pages"> | 63 | <div class="pages"> |
@@ -55,7 +77,7 @@ $baseUrl = Url::base(true); | @@ -55,7 +77,7 @@ $baseUrl = Url::base(true); | ||
55 | <div class="s-li-div"> | 77 | <div class="s-li-div"> |
56 | <label class="s-li-label">车辆型号<span class="require-cls">*</span></label> | 78 | <label class="s-li-label">车辆型号<span class="require-cls">*</span></label> |
57 | <div class="s-li-div-input-box"> | 79 | <div class="s-li-div-input-box"> |
58 | - <input class="s-li-div-input carModel" type="text" value="" placeholder="请填写车辆型号" /> | 80 | + <input class="s-li-div-input carModel" type="text" value="" readonly placeholder="请点选车辆型号" /> |
59 | </div> | 81 | </div> |
60 | </div> | 82 | </div> |
61 | </li> | 83 | </li> |
@@ -77,7 +99,7 @@ $baseUrl = Url::base(true); | @@ -77,7 +99,7 @@ $baseUrl = Url::base(true); | ||
77 | </li> | 99 | </li> |
78 | <li class="s-li-item"> | 100 | <li class="s-li-item"> |
79 | <div class="s-li-div"> | 101 | <div class="s-li-div"> |
80 | - <label class="s-li-label">预估维修内容<span class="require-cls">*</span></label> | 102 | + <label class="s-li-label">预估维修内容</label> |
81 | <div class="s-li-div-input-box"> | 103 | <div class="s-li-div-input-box"> |
82 | <input class="s-li-div-input preRepair" type="text" value="" placeholder="请填写预估维修内容" /> | 104 | <input class="s-li-div-input preRepair" type="text" value="" placeholder="请填写预估维修内容" /> |
83 | </div> | 105 | </div> |
@@ -85,17 +107,19 @@ $baseUrl = Url::base(true); | @@ -85,17 +107,19 @@ $baseUrl = Url::base(true); | ||
85 | </li> | 107 | </li> |
86 | <li class="s-li-item"> | 108 | <li class="s-li-item"> |
87 | <div class="s-li-div"> | 109 | <div class="s-li-div"> |
88 | - <label class="s-li-label">预估维修费用<span class="require-cls">*</span></label> | ||
89 | - <div class="s-li-div-input-box"> | ||
90 | - <input class="s-li-div-input repairPrice" type="text" value="" placeholder="请填写预估维修费用" /> | 110 | + <label class="s-li-label">预估维修费用</label> |
111 | + <div class="s-li-div-input-box" style="position: relative"> | ||
112 | + <input class="s-li-div-input repairPrice" type="number" value="" placeholder="请填写预估维修费用" /> | ||
113 | + <span class="price-union-cls">元</span> | ||
91 | </div> | 114 | </div> |
92 | </div> | 115 | </div> |
93 | </li> | 116 | </li> |
94 | <li class="s-li-item"> | 117 | <li class="s-li-item"> |
95 | <div class="s-li-div"> | 118 | <div class="s-li-div"> |
96 | - <label class="s-li-label">预估完成时间<span class="require-cls">*</span></label> | ||
97 | - <div class="s-li-div-input-box finish-date-btn"> | 119 | + <label class="s-li-label">预估完成时间</label> |
120 | + <div class="s-li-div-input-box finish-date-btn" style="position: relative"> | ||
98 | <input class="s-li-div-input finishDate finish-date-input" type="text" value="" readonly placeholder="请填写预估完成时间" /> | 121 | <input class="s-li-div-input finishDate finish-date-input" type="text" value="" readonly placeholder="请填写预估完成时间" /> |
122 | + <span class="down-arrow date-arrow"></span> | ||
99 | </div> | 123 | </div> |
100 | </div> | 124 | </div> |
101 | </li> | 125 | </li> |
@@ -122,3 +146,31 @@ $baseUrl = Url::base(true); | @@ -122,3 +146,31 @@ $baseUrl = Url::base(true); | ||
122 | </div> | 146 | </div> |
123 | </div> | 147 | </div> |
124 | </script> | 148 | </script> |
149 | +<script id="search-carr-model-template" type="text/template"> | ||
150 | + <div class="search-wrapper" id="search-wrapper"> | ||
151 | + <div class="search-wrapper-inner"> | ||
152 | + <div class="search-box-cls" style="display:flex;"><span class="closeBtn"></span> | ||
153 | + <form class="search-form" id="search-form"> | ||
154 | + <div class="search-input-box"><input class="search-input-cls search-input" type="text" placeholder="请输入型号关键字" value=""/></div> | ||
155 | + <div class="model-search-cls model-search-btn">搜索</div> | ||
156 | + </form> | ||
157 | + </div> | ||
158 | + <div class="model-list-div" style="width:100%;height:calc(100% - 50px);;overflow-y: scroll"> | ||
159 | + <ul class="model-list"> | ||
160 | + | ||
161 | + </ul> | ||
162 | + </div> | ||
163 | + </div> | ||
164 | + </div> | ||
165 | +</script> | ||
166 | +<script id="search-car-model-item-template" type="text/template"> | ||
167 | + {{#each items}} | ||
168 | + <li class="model-item-cls"> | ||
169 | + <div class="model-div-cls model-div-btn" data-value="{{this.name}}"> | ||
170 | + {{this.name}} | ||
171 | + </div> | ||
172 | + </li> | ||
173 | + {{else}} | ||
174 | + <li><div>暂无型号</div></li> | ||
175 | + {{/each}} | ||
176 | +</script> | ||
125 | \ No newline at end of file | 177 | \ No newline at end of file |
app-wx/modules/user/controllers/LoginController.php
@@ -3,12 +3,14 @@ | @@ -3,12 +3,14 @@ | ||
3 | namespace app\wx\modules\user\controllers; | 3 | namespace app\wx\modules\user\controllers; |
4 | 4 | ||
5 | use Yii; | 5 | use Yii; |
6 | +use app\wx\models\User as ClientUserModel; | ||
6 | use domain\user\User; | 7 | use domain\user\User; |
7 | use common\helpers\Utils; | 8 | use common\helpers\Utils; |
8 | use common\helpers\Log as AppLog; | 9 | use common\helpers\Log as AppLog; |
9 | use domain\user\UserRepository; | 10 | use domain\user\UserRepository; |
10 | use common\helpers\ImageManager; | 11 | use common\helpers\ImageManager; |
11 | use domain\user\PhoneCode; | 12 | use domain\user\PhoneCode; |
13 | +use domain\system\SmsMessage; | ||
12 | use stdClass; | 14 | use stdClass; |
13 | 15 | ||
14 | /** | 16 | /** |
@@ -32,23 +34,29 @@ class LoginController extends BaseController | @@ -32,23 +34,29 @@ class LoginController extends BaseController | ||
32 | $e->message = '请输入合格手机号码'; | 34 | $e->message = '请输入合格手机号码'; |
33 | return $this->renderJson($e); | 35 | return $this->renderJson($e); |
34 | } | 36 | } |
35 | - $tt = time(); | 37 | + |
36 | if ('login' == $action) { | 38 | if ('login' == $action) { |
37 | - $userInfo = UserRepository::findOne(['mobile' => $mobile]); | 39 | + $userInfo = ClientUserModel::findOne(['mobile' => $mobile]); |
38 | if (empty($userInfo)) { | 40 | if (empty($userInfo)) { |
39 | $e->message = '登录失败,该手机未注册'; | 41 | $e->message = '登录失败,该手机未注册'; |
40 | return $this->renderJson($e); | 42 | return $this->renderJson($e); |
41 | } | 43 | } |
42 | $code = $this->getLoginCode($mobile); | 44 | $code = $this->getLoginCode($mobile); |
45 | + $sms = new SmsMessage(); | ||
43 | if ($code) { | 46 | if ($code) { |
44 | // 发送短信 | 47 | // 发送短信 |
48 | + $sms->sendLoginCode($mobile, $code); | ||
49 | + $e->message = '您的登录码已经发送,请注意查收短信!'; | ||
45 | } else { | 50 | } else { |
46 | $code = $this->setLoginCode($mobile); | 51 | $code = $this->setLoginCode($mobile); |
47 | // 发送短信 | 52 | // 发送短信 |
53 | + $sms->sendLoginCode($mobile, $code); | ||
54 | + $e->message = '您的登录码已经发送,请注意查收短信!'; | ||
48 | } | 55 | } |
49 | 56 | ||
50 | } else { | 57 | } else { |
51 | - $userModel = UserRepository::findOne(['mobile' => $mobile]); | 58 | + $userModel = ClientUserModel::findOne(['mobile' => $mobile]); |
59 | + $sms = new SmsMessage(); | ||
52 | if ($userModel) { | 60 | if ($userModel) { |
53 | $e->message = '该手机号码已经注册过'; | 61 | $e->message = '该手机号码已经注册过'; |
54 | return $this->renderJson($e); | 62 | return $this->renderJson($e); |
@@ -58,9 +66,13 @@ class LoginController extends BaseController | @@ -58,9 +66,13 @@ class LoginController extends BaseController | ||
58 | if ($phoneCode) { | 66 | if ($phoneCode) { |
59 | $code = $phoneCode; | 67 | $code = $phoneCode; |
60 | //发送短信 | 68 | //发送短信 |
69 | + $sms->sendRegCode($mobile, $code); | ||
70 | + $e->message = '您的注册码已经发送,请注意查收短信!'; | ||
61 | } else { | 71 | } else { |
62 | $code = $this->setRegisterCode($mobile); | 72 | $code = $this->setRegisterCode($mobile); |
63 | //发送短信 | 73 | //发送短信 |
74 | + $sms->sendRegCode($mobile, $code); | ||
75 | + $e->message = '您的注册码已经发送,请注意查收短信!'; | ||
64 | } | 76 | } |
65 | } | 77 | } |
66 | 78 | ||
@@ -204,7 +216,7 @@ class LoginController extends BaseController | @@ -204,7 +216,7 @@ class LoginController extends BaseController | ||
204 | } | 216 | } |
205 | // 检查车厂名称是否注册了 | 217 | // 检查车厂名称是否注册了 |
206 | // 检查手机号码是否注册了 | 218 | // 检查手机号码是否注册了 |
207 | - $userMobile = UserRepository::findOne(['mobile' => $mobile]); | 219 | + $userMobile = ClientUserModel::findOne(['mobile' => $mobile]); |
208 | if ($userMobile) { | 220 | if ($userMobile) { |
209 | $e->message = '该手机号已经注册过维修厂,请更换其他手机号'; | 221 | $e->message = '该手机号已经注册过维修厂,请更换其他手机号'; |
210 | return $this->renderJson($e); | 222 | return $this->renderJson($e); |
@@ -220,7 +232,9 @@ class LoginController extends BaseController | @@ -220,7 +232,9 @@ class LoginController extends BaseController | ||
220 | $saveImageInfo = ImageManager::mvUploadImage($licensePic, $userEntity->uuid); | 232 | $saveImageInfo = ImageManager::mvUploadImage($licensePic, $userEntity->uuid); |
221 | $userEntity->license_pic = $saveImageInfo[0].$saveImageInfo[1]; | 233 | $userEntity->license_pic = $saveImageInfo[0].$saveImageInfo[1]; |
222 | $userEntity->save(); | 234 | $userEntity->save(); |
223 | - if ($this->processLogin($userEntity)) { | 235 | + // 必须用 app\wx\models\User 才能登录 |
236 | + $loginUserModel = ClientUserModel::findOne(['id' => $userEntity->id]); | ||
237 | + if ($this->processLogin($loginUserModel)) { | ||
224 | $e->success = true; | 238 | $e->success = true; |
225 | } else { | 239 | } else { |
226 | $e->message = '注册成功但是登录失败'; | 240 | $e->message = '注册成功但是登录失败'; |
@@ -263,7 +277,7 @@ class LoginController extends BaseController | @@ -263,7 +277,7 @@ class LoginController extends BaseController | ||
263 | } | 277 | } |
264 | 278 | ||
265 | $where = ['mobile' => $mobile]; | 279 | $where = ['mobile' => $mobile]; |
266 | - $userInfo = UserRepository::findOne($where); | 280 | + $userInfo = ClientUserModel::findOne($where); |
267 | if (empty($userInfo)) { | 281 | if (empty($userInfo)) { |
268 | $e->message = '登录失败,该手机未注册'; | 282 | $e->message = '登录失败,该手机未注册'; |
269 | return $this->renderJson($e); | 283 | return $this->renderJson($e); |
domain/user/models/User.php
@@ -3,10 +3,8 @@ | @@ -3,10 +3,8 @@ | ||
3 | namespace domain\user\models; | 3 | namespace domain\user\models; |
4 | 4 | ||
5 | use common\helpers\Utils; | 5 | use common\helpers\Utils; |
6 | -use yii\base\NotSupportedException; | ||
7 | use yii\db\ActiveRecord; | 6 | use yii\db\ActiveRecord; |
8 | use yii\behaviors\TimestampBehavior; | 7 | use yii\behaviors\TimestampBehavior; |
9 | -use yii\web\IdentityInterface; | ||
10 | 8 | ||
11 | /** | 9 | /** |
12 | * 用户 | 10 | * 用户 |
@@ -56,33 +54,4 @@ class User extends ActiveRecord | @@ -56,33 +54,4 @@ class User extends ActiveRecord | ||
56 | $this->uuid = Utils::genUUID(); | 54 | $this->uuid = Utils::genUUID(); |
57 | } | 55 | } |
58 | 56 | ||
59 | - /** @inheritdoc */ | ||
60 | - public static function findIdentity($id) | ||
61 | - { | ||
62 | - return static::findOne($id); | ||
63 | - } | ||
64 | - | ||
65 | - /** @inheritdoc */ | ||
66 | - public static function findIdentityByAccessToken($token, $type = null) | ||
67 | - { | ||
68 | - throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.'); | ||
69 | - } | ||
70 | - | ||
71 | - /** @inheritdoc */ | ||
72 | - public function getId() | ||
73 | - { | ||
74 | - return $this->getAttribute('id'); | ||
75 | - } | ||
76 | - | ||
77 | - /** @inheritdoc */ | ||
78 | - public function getAuthKey() | ||
79 | - { | ||
80 | - return $this->getAttribute('auth_key'); | ||
81 | - } | ||
82 | - | ||
83 | - /** @inheritdoc */ | ||
84 | - public function validateAuthKey($authKey) | ||
85 | - { | ||
86 | - return $this->getAttribute('auth_key') == $authKey; | ||
87 | - } | ||
88 | } | 57 | } |
89 | \ No newline at end of file | 58 | \ 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="0"><span class="del-plan"></span></div></div>';return e},t.inputPriceChangeEvent=function(){var t=this;r("#cost-list").on("input propertychange",".input-cls",function(){var e=t.computedPrice();r("#cost-list .total-plan-price").html(e)})},t.computedPrice=function(){var t=r("#cost-list .input-right"),e=0;return r.each(t,function(t,i){e+=1*r(i).val()}),Math.round(e,2)},t.uploadImgEvent=function(){var t=this;r("#cost-list #upload-btn").change(function(){if(""!=r(this).val()&&null!=r(this).val()){var o=r(this).parents("li");n.uploadFile({selector:"#upload-btn",url:e.to(a),processAppendTo:"#cost-list",success:function(e,n){try{if(e.success){var a=e.tmpUrl;r('<li class="upload-li up-img"><div data="'+e.tmpFile+'" data-url="'+a+'" class="upload-item" style="background-image:url('+e.tmpMinUrl+')"></div><span class="del-img"></span></li>').insertBefore(o),t.imgLimit==r("#cost-list #image-list").find(".up-img").length&&r("#cost-list .upload-btn-li").hide()}else i.toast({content:e.message,closeDelay:5e3})}catch(s){console.log(s),i.toast({content:"出错",closeDelay:5e3})}}})}}),r("#cost-list #image-list").on("click",".del-img",function(e){r(this).parent().remove(),t.imgLimit>=r("#cost-list #image-list").find(".up-img").length&&r("#cost-list .upload-btn-li").show()})},t.submitEvent=function(){var t=this;r("#cost-list .btn-submit").click(function(n){var a=r("#cost-list .content-div").find(".repair-item-cls"),s=[],l=!0,c=!0;if(r.each(a,function(t,e){var n=i.trim(r(e).find(".input-left").val()),a=i.trim(r(e).find(".input-right").val());""==n&&(l=!1),""!=a&&0!=a||(c=!1),s.push({content:n,price:a})}),!l)return i.toast({content:"维修清单有部分未填内容"}),!1;if(!c)return i.toast({content:"维修清单有部分未填价格"}),!1;var d=r("#cost-list #image-list").find(".upload-item"),u=[];if(r.each(d,function(t,e){u.push(r(e).attr("data"))}),!t.canSubmit)return!1;t.canSubmit=!1;var m=t.csrf({images:u,plans:s,id:t.id});i.httpPost(o,m,function(n){t.canSubmit=!0,n.success?window.location.replace(e.to("order#order-details/"+t.id)):i.toast({content:n.message})},!0)})},t}),define("order/customer-order-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,e,i){var n=Dom7,t=(Template7,new t),r="order/customer/order-details";return t.run=function(){var t=this;t.id=t.params.id,t.sn=t.params.sn,t.success=!0,t.setPageTitle("维修单"),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.goToComment(),t.popupImageLayer()},t.beforeRender=function(){var t=this;console.log("beforeRender"),t.success||(this.view="customer-order-error")},t.loadPage=function(){var t=this,n=t.csrf({id:t.id});i.httpPost(e.to(r),n,function(e){var i=e;t.success=e.success,t.render(i)},!0)},t.goToComment=function(){var t=this;n("#customer-order .rate-btn-cls").click(function(i){window.location.replace(e.to("order/customer#rate/"+t.id+"/"+t.sn))})},t.popupImageLayer=function(){n("#customer-order").on("click",".view-img-cls",function(t){var e=n(this).attr("data-url");n("#img-mask").remove();var i='<div id="img-mask" style="z-index:2;background:#000;justify-content:center;position: absolute;bottom:0;top:0;width:100%;display:flex;flex-direction: column;align-items: center"><div style="width:100%;"> <img width="100%" src="'+e+'" /></div></div>';n("#customer-order").append(i)}),n("#customer-order").on("click","#img-mask, #img-mask img",function(t){t.preventDefault(),t.stopPropagation();var e=document.body.clientHeight,i=n("#img-mask img").height();console.log(e+"dddd"+i);var r=Math.abs(i-e);if(r>=0&&r<=20)n("#img-mask").remove();else{var a=n(t.target).attr("id");"img-mask"==a&&n("#img-mask").remove()}})},t}),define("order/index-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,e,i){var n=Dom7,r=Template7,t=new t,a="order/default/order-list";return t.run=function(){var t=this;t.setPageTitle("订单列表"),t.tab=t.params.tab,t.page=0,t.nodata="",t.loading=!1,t.pageCount=1,t.render({tab:t.tab}),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.tabEvent(),t.bindScrollEvent(),t.addEvent(),t.orderClickEvent()},t.tabEvent=function(){n(".tab-cls").click(function(t){var e=n(this).attr("data-href");window.location.replace(e)})},t.handleNodata=function(){var t=this;t.nodata="没有数据了";var e=n(".nodata");0==e.length&&n("#index .order-list").append('<div class="nodata">'+t.nodata+"</div>"),t.app.detachInfiniteScroll(".infinite-scroll"),n("#index .infinite-scroll-preloader").remove()},t.loadPage=function(){var t=this;if(t.loading=!0,t.page>=t.pageCount)return void t.handleNodata();var r={status:t.tab};r.page=t.page+1,r=t.csrf(r),n.ajax({method:"GET",url:e.to(a),data:r,dataType:"json",beforeSend:function(){t.showIndicator()},success:function(e){if(1==e.success&&(i.isDefined(e.page)&&(t.page=parseInt(e.page)),i.isDefined(e.page_count)&&(t.pageCount=parseInt(e.page_count)),t.renderItems(e.items,!0),t.page>=t.pageCount))return void t.handleNodata()},error:function(t){},complete:function(e){t.hideIndicator(),t.loading=!1}})},t.bindScrollEvent=function(){var t=this;t.app.attachInfiniteScroll("#index .infinite-scroll"),n("#index .infinite-scroll").on("infinite",function(){t.loading||t.nodata||t.loadPage()})},t.renderItems=function(t,e){var i=n("#index .order-list"),a=n("script#order-item-template"),o=r.compile(a.html()),s=o({list:t});0==e&&(i.html(""),i.append(s)),i.append(s)},t.addEvent=function(){n("#index .add-btn-cls").click(function(t){window.location.href=e.to("order/#submit")})},t.orderClickEvent=function(){n("#index").on("click",".order-item",function(t){var i=n(this).attr("data-id");window.location.href=e.to("order#order-details/"+i)})},t}),define("order/order-details-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,e,i){var n=Dom7,t=(Template7,new t),r="order/default/order-details";return t.run=function(){var t=this;t.id=t.params.id,t.success=!0,t.setPageTitle("维修单"),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.finishBtnEvent(),t.popupImageLayer()},t.beforeRender=function(){var t=this;console.log("beforeRender"),t.success||(t.view="order-details-error")},t.loadPage=function(){var t=this,n=t.csrf({id:t.id});i.httpPost(e.to(r),n,function(e){var i=e;t.success=e.success,t.render(i)},!0)},t.finishBtnEvent=function(){var t=this;n("#order-details .finish-submit").click(function(i){window.location.href=e.to("order/#cost-list/"+t.id)})},t.popupImageLayer=function(){n("#order-details").on("click",".view-img-cls",function(t){var e=n(this).attr("data-url");n("#img-mask").remove();var i='<div id="img-mask" style="z-index:2;background:#000;justify-content:center;position: absolute;bottom:0;top:0;width:100%;display:flex;flex-direction: column;align-items: center"><div style="width:100%;"> <img width="100%" src="'+e+'" /></div></div>';n("#order-details").append(i)}),n("#order-details").on("click","#img-mask, #img-mask img",function(t){t.preventDefault(),t.stopPropagation();var e=document.body.clientHeight,i=n("#img-mask img").height();console.log(e+"dddd"+i);var r=Math.abs(i-e);if(r>=0&&r<=20)n("#img-mask").remove(),console.log("dddd");else{var a=n(t.target).attr("id");"img-mask"==a&&n("#img-mask").remove()}})},t}),define("order/rate-controller",["mk7/controller","mk7/url","mk7/utils"],function(t,e,i){var n=Dom7,t=(Template7,new t),r="order/customer/submit-rate";return t.run=function(){var t=this;t.id=t.params.id,t.sn=t.params.sn,t.setPageTitle("评价"),t.loadPage()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.starClickEvent(),t.submitEvent()},t.loadPage=function(){var t=this;t.render()},t.starClickEvent=function(){n("#rate").on("click",".quality-box .img-star",function(t){var e=n(this).attr("data-id"),i=n("#rate .quality-box .img-star");n.each(i,function(t,i){var r=n(i).attr("data-id");if(1*r<=e){n(i).addClass("star-on");var a=n("#rate .quality-box").find(".rate-text"),o=n(i).attr("data-txt");a.html(o)}else n(i).removeClass("star-on")})})},t.submitEvent=function(){var t=this;n("#rate .submit-btn").click(function(a){var o=i.trim(n("#rate .text-content").val()),s=n("#rate .img-star"),l=0;n.each(s,function(t,e){n(e).hasClass("star-on")&&l++});var c=t.csrf({star:l,comment:o,id:t.id});i.httpPost(e.to(r),c,function(n){n.success?window.location.replace(e.to("order/customer#customer-order/"+t.id+"/"+t.sn)):i.toast({content:n.message})},!0)})},t}),define("order/submit-controller",["mk7/controller","mk7/url","mk7/utils","mk7/uploadjs","mk7/picker"],function(t,e,n,r,a){var o=Dom7,t=(Template7,new t),s="/user/default/upload-file",l="/order/default/submit",c=!0,d="";return t.run=function(){var t=this;t.setPageTitle("录入维修单"),t.imgLimit=9,t.render()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.uploadImgEvent(),t.submitEvent(),t.selectDateEvent()},t.uploadImgEvent=function(){var t=this;o("#submit #upload-btn").change(function(){if(""!=o(this).val()&&null!=o(this).val()){var i=o(this).parents("li");r.uploadFile({selector:"#upload-btn",url:e.to(s),processAppendTo:"#submit",success:function(e,r){try{if(e.success){var a=e.tmpUrl;o('<li class="upload-li up-img"><div data="'+e.tmpFile+'" data-url="'+a+'" class="upload-item" style="background-image:url('+e.tmpMinUrl+')"></div><span class="del-img"></span></li>').insertBefore(i),t.imgLimit==o("#submit #image-list").find(".up-img").length&&o("#submit .upload-btn-li").hide()}else n.toast({content:e.message,closeDelay:5e3})}catch(s){console.log(s),n.toast({content:"出错",closeDelay:5e3})}}})}}),o("#submit #image-list").on("click",".del-img",function(e){o(this).parent().remove(),t.imgLimit>=o("#submit #image-list").find(".up-img").length&&o("#submit .upload-btn-li").show()})},t.submitEvent=function(){var t=this;o("#submit .submit-btn-cls").click(function(i){var r=n.trim(o("#submit .carNo").val()),a=n.trim(o("#submit .carModel").val()),s=n.trim(o("#submit .customer").val()),d=n.trim(o("#submit .phone").val()),u=n.trim(o("#submit .preRepair").val()),m=n.trim(o("#submit .repairPrice").val()),v=n.trim(o("#submit .finishDate").val());if(0==c)return!1;if(""==r)return n.toast({content:"车牌号必填"}),!1;if(""==a)return n.toast({content:"车辆型号必填"}),!1;if(""==s)return n.toast({content:"客户名称必填"}),!1;if(""==d)return n.toast({content:"客联系电话必填"}),!1;if(!n.isMobile(d)&&!n.isTelephone(d))return n.toast({content:"客联系电话有误"}),!1;if(""==u)return n.toast({content:"预估维修内容必填"}),!1;if(""==m)return n.toast({content:"预估维修费用必填"}),!1;if(""==v)return n.toast({content:"预估完成时间必填"}),!1;var p=t.getUploadImgs();if(0==p.length)return n.toast({content:"请上传车损照"}),!1;c=!1;var f=t.csrf({carNo:r,carModel:a,customer:s,phone:d,preRepair:u,repairPrice:m,finishDate:v,images:p});n.httpPost(l,f,function(t){return c=!0,t.success?void window.location.replace(e.to("order#order-details/"+t.orderId)):(n.toast({content:message}),!1)},!0)})},t.getUploadImgs=function(){var t=o("#submit #image-list").find(".up-img"),e=[];return 0==t.length?[]:(o.each(t,function(t,i){var n=o(i).find(".upload-item");e.push(n.attr("data"))}),e)},t.selectDateEvent=function(){var t=this;o("#submit .finish-date-input").click(function(e){var i=o(this).val();console.log(i),t.dateTimeSelector("#submit .finish-date-input",i)})},t.dateTimeSelector=function(t,e){var n=this,r=new Date,a=30,s=r.getFullYear(),l=r.getMonth(),c=r.getDate(),u=r.getHours(),m=s+"-"+(l+1)+"-"+c;if(""!=e&&null!=e&&void 0!==e){var v=e.split(" ");m=v[0],u=v[1]}var p=[];for(i=0;i<=a;i++){var f=new Date;f.setDate(r.getDate()+i);var g=f.getFullYear()+"-"+(f.getMonth()+1)+"-"+f.getDate();p.push(g)}var h=n.app.picker({input:t,toolbarTemplate:'<div class="toolbar"><div class="toolbar-inner"><div class="left">请选择用工时间</div><div class="right"><a href="javascript:void(0);" class="link submit-confirm-picker">确定</a></div></div></div>',value:[m,u],onChange:function(t,e,i){var n,r,a;if(e[0]instanceof Date)n=e[0].getFullYear(),r=e[0].getMonth(),a=e[0].getDate();else{var o=e[0].split("-");n=o[0],r=o[1]-1,a=o[2]}var s=new Date(n,r,a,e[1],0),l=new Date((new Date).getTime()+36e5);if(s<l){if(void 0===t.cols[0])return!1;var c=l.getHours(),d=l.getFullYear()+"-"+(l.getMonth()+1)+"-"+l.getDate(),u=new Date(l.getFullYear(),l.getMonth(),l.getDate(),l.getHours(),0);if(u-new Date<9e5){var m=new Date(u.getTime()+36e5);c=m.getHours(),d=m.getFullYear()+"-"+(m.getMonth()+1)+"-"+m.getDate()}t.cols[0].setValue(d),t.cols[2].setValue(c)}},formatValue:function(t,e,i){var n="";n=e[0]instanceof Date?e[0].getFullYear()+"-"+(e[0].getMonth()+1)+"-"+e[0].getDate():e[0];var r=n+" "+e[1];return r},cols:[{values:p,displayValues:function(){var t=[],e=new Date,i=e.getFullYear(),n=e.getMonth()+1,r=e.getDate();e.setDate(e.getDate()+1);for(var a=0;a<p.length;a++){var o=p[a],s=o.split("-"),l=s[1]+"月"+s[2]+"日";i==s[0]&&1*n==s[1]&&1*r==s[2]&&(l+="(今天)"),1*e.getFullYear()==s[0]&&1*e.getMonth()+1==s[1]&&1*e.getDate()==s[2]&&(l+="(明天)"),t.push(l)}return t}()},{divider:!0,content:" "},{values:function(){for(var t=[],e=0;e<=23;e++)t.push(e);return t}(),displayValues:function(){for(var t=[],e=0;e<=23;e++)t.push(e<10?"0"+e+"时":e+"时");return t}()},{divider:!0,content:" "}],onClose:function(e){if(h){var i=h.value,n=i[1]<10?"0"+i[1]:i[1];d=i[0]+" "+n,o(t).val(d),h.destroy()}}});h.open(),o(".submit-confirm-picker").on("click",function(e){e.preventDefault();var i=h.value,n=i[1]<10?"0"+i[1]:i[1];d=i[0]+" "+n,o(t).val(d),h.destroy()})},t}); | ||
2 | \ No newline at end of file | 1 | \ No newline at end of file |
2 | +define("order-app",["mk7/app"],function(t){var e=Dom7,i=function(){var t=e(".ui-loading-block");0==t.length&&(e(".view-main").html('<div class="ui-loading-block" id="ui-loading"><div class="ui-loading-cnt"><div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div><div id="loader-inner"><p></p></div> </div> </div>'),window.waitingTime=1e4,window.loaderTimer&&clearTimeout(window.loaderTimer),window.loaderTimer=setTimeout(function(){var t=document.getElementById("loader-inner"),e=document.createElement("p");e.className="notice",t&&(e.innerHTML='加载速度太慢?试试<a class="link" href="#" onclick="javascript:location.reload();return false;">重新加载</a>',t.appendChild(e))},window.waitingTime))},n=!0;return t.name="order",t.routes={index:function(){return n=!1,i(),t.runController("index")},"index/:tab":function(e){n=!1,i();var r={tab:e};return t.runController("index",r)},submit:function(){return n=!1,i(),t.runController("submit")},"order-details/:id":function(e){n=!1,i();var r={id:e};return t.runController("order-details",r)},"customer-order/:id/:sn":function(e,r){n=!1,i();var a={id:e,sn:r};return t.runController("customer-order",a)},"rate/:id/:sn":function(e,r){n=!1,i();var a={id:e,sn:r};return t.runController("rate",a)},"cost-list/:id":function(e){n=!1,i();var r={id:e};return t.runController("cost-list",r)},"*":function(){return t.runController("index")}},t}),define("order/cost-list-controller",["mk7/controller","mk7/url","mk7/utils","mk7/uploadjs"],function(t,e,i,n){var r=Dom7,t=(Template7,new t),a="/user/default/upload-file",o="/order/default/submit-repair-plans";return t.run=function(){var t=this;t.setPageTitle("费用列表"),t.id=t.params.id,t.imgLimit=9,t.canSubmit=!0,t.render()},t.bindEvents=function(){var t=this;console.log("bindEvents"),t.addEvent(),t.uploadImgEvent(),t.delPlanEvent(),t.inputPriceChangeEvent(),t.submitEvent()},t.addEvent=function(){var t=this;r("#cost-list .add-repair-plan").click(function(e){var i=r("#cost-list .cost-list-div"),n=t.planTpl(i.length+1);r(n).insertBefore(r("#cost-list .cost-total-list-div"))})},t.delPlanEvent=function(){var t=this;r("#cost-list").on("click",".del-plan",function(e){console.log("del plan event"),r(this).parents(".cost-list-div").remove(),r("#cost-list .total-plan-price").html(t.computedPrice())})},t.planTpl=function(t){var e='<div class="cost-list-div"><p class="item-title">第'+t+'项</p><div class="repair-item-cls"><input type="text" class="input-left input-cls" placeholder="填写维修内容" value=""><input type="number" class="input-right input-cls" placeholder="价格" value=""><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}); | ||
3 | \ No newline at end of file | 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",l=!0,s=!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==l)return!1;clearInterval(c),l=!1;var s=e.csrf({action:"login",mobile:r});n.httpGet(t.to(i),s,function(t){if(!t.success)return n.toast({content:t.message,closeDelay:3e3}),l=!0,!1;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,l=!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 l=n.trim(o("#login .mobile").val()),c=n.trim(o("#login .code").val());if(""==l)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(l))return n.toast({content:"手机号码不合格"}),!1;if(""==c)return n.toast({content:"验证码必填"}),!1;if(0==s)return!1;s=!1;var a=e.csrf({mobile:l,code:c});n.httpPost(t.to(r),a,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(){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",l="/user/default/upload-file",s="/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(l),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(s),r,function(t){if(!t.success)return n.toast({content:t.message,closeDelay:3e3}),c=!0,!1;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 l=n.trim(i("#register .name").val()),s=n.trim(i("#register .mobile").val()),c=n.trim(i("#register .code").val());if(""==l)return n.toast({content:"车厂名称必填"}),!1;if(""==s)return n.toast({content:"手机号码必填"}),!1;if(!n.isMobile(s))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:l,mobile:s,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 | \ No newline at end of file | 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))},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}); | ||
3 | \ No newline at end of file | 3 | \ No newline at end of file |
web/src/js/order/cost-list-controller.js
@@ -56,7 +56,7 @@ define( | @@ -56,7 +56,7 @@ define( | ||
56 | var str = '<div class="cost-list-div">'+ | 56 | var str = '<div class="cost-list-div">'+ |
57 | '<p class="item-title">第'+i+'项</p>'+ | 57 | '<p class="item-title">第'+i+'项</p>'+ |
58 | '<div class="repair-item-cls">'+ | 58 | '<div class="repair-item-cls">'+ |
59 | - '<input type="text" class="input-left input-cls" placeholder="填写维修内容" value=""><input type="number" class="input-right input-cls" placeholder="填写价格" value="0">'+ | 59 | + '<input type="text" class="input-left input-cls" placeholder="填写维修内容" value=""><input type="number" class="input-right input-cls" placeholder="价格" value="">'+ |
60 | '<span class="del-plan"></span>'+ | 60 | '<span class="del-plan"></span>'+ |
61 | '</div>'+ | 61 | '</div>'+ |
62 | '</div>'; | 62 | '</div>'; |
web/src/js/order/submit-controller.js
@@ -33,6 +33,10 @@ define( | @@ -33,6 +33,10 @@ define( | ||
33 | me.uploadImgEvent(); | 33 | me.uploadImgEvent(); |
34 | me.submitEvent(); | 34 | me.submitEvent(); |
35 | me.selectDateEvent(); | 35 | me.selectDateEvent(); |
36 | + me.openCarModel(); | ||
37 | + me.searchCarModel(); | ||
38 | + me.carModelClick() | ||
39 | + | ||
36 | } | 40 | } |
37 | ctrl.uploadImgEvent = function() { | 41 | ctrl.uploadImgEvent = function() { |
38 | var me = this; | 42 | var me = this; |
@@ -107,6 +111,7 @@ define( | @@ -107,6 +111,7 @@ define( | ||
107 | utils.toast({content:'客联系电话有误'}); | 111 | utils.toast({content:'客联系电话有误'}); |
108 | return false; | 112 | return false; |
109 | } | 113 | } |
114 | + /* | ||
110 | if ('' == preRepair) { | 115 | if ('' == preRepair) { |
111 | utils.toast({content:'预估维修内容必填'}); | 116 | utils.toast({content:'预估维修内容必填'}); |
112 | return false; | 117 | return false; |
@@ -119,6 +124,7 @@ define( | @@ -119,6 +124,7 @@ define( | ||
119 | utils.toast({content:'预估完成时间必填'}); | 124 | utils.toast({content:'预估完成时间必填'}); |
120 | return false; | 125 | return false; |
121 | } | 126 | } |
127 | + */ | ||
122 | var imgs = me.getUploadImgs(); | 128 | var imgs = me.getUploadImgs(); |
123 | if (0 == imgs.length) { | 129 | if (0 == imgs.length) { |
124 | utils.toast({content:'请上传车损照'}); | 130 | utils.toast({content:'请上传车损照'}); |
@@ -157,7 +163,7 @@ define( | @@ -157,7 +163,7 @@ define( | ||
157 | ctrl.selectDateEvent = function() { | 163 | ctrl.selectDateEvent = function() { |
158 | var me = this | 164 | var me = this |
159 | $$('#submit .finish-date-input').click(function(e) { | 165 | $$('#submit .finish-date-input').click(function(e) { |
160 | - var cData = $$(this).val(); | 166 | + var cData = $$('#submit .finish-date-input').val(); |
161 | console.log(cData) | 167 | console.log(cData) |
162 | me.dateTimeSelector('#submit .finish-date-input', cData); | 168 | me.dateTimeSelector('#submit .finish-date-input', cData); |
163 | }) | 169 | }) |
@@ -327,6 +333,75 @@ define( | @@ -327,6 +333,75 @@ define( | ||
327 | pickerInline.destroy(); | 333 | pickerInline.destroy(); |
328 | }); | 334 | }); |
329 | } | 335 | } |
336 | + | ||
337 | + ctrl.openCarModel= function() { | ||
338 | + var me = this; | ||
339 | + $$('#submit').on('click', '.carModel',function(e) { | ||
340 | + $$('#search-wrapper').remove(); | ||
341 | + var page = $$('#submit'); | ||
342 | + var ele = $$('script#search-carr-model-template'); | ||
343 | + var compiled = t7.compile(ele.html()); | ||
344 | + var doms = compiled({keyword: ''}); | ||
345 | + page.append(doms); | ||
346 | + | ||
347 | + }) | ||
348 | + } | ||
349 | + ctrl.renderCarModelItem = function (items) { | ||
350 | + | ||
351 | + var addressList = $$('#search-wrapper .model-list'); | ||
352 | + var ele = $$('script#search-car-model-item-template'); | ||
353 | + var compiled = t7.compile(ele.html()); | ||
354 | + var doms = compiled({items: items}); | ||
355 | + addressList.html(doms); | ||
356 | + } | ||
357 | + ctrl.searchCarModel = function() { | ||
358 | + var me = this; | ||
359 | + $$('#submit').on('click', '.model-search-btn', function(e){ | ||
360 | + me.ajaxSearch(); | ||
361 | + }) | ||
362 | + | ||
363 | + $$('#submit').on('submit', '#search-form', function(e){ | ||
364 | + e.preventDefault(); | ||
365 | + me.ajaxSearch(); | ||
366 | + return false; | ||
367 | + }) | ||
368 | + } | ||
369 | + ctrl.ajaxSearch = function() { | ||
370 | + var me = this; | ||
371 | + var pData = {keyword: $$('#search-wrapper .search-input').val()}; | ||
372 | + $$.ajax({ | ||
373 | + method : "POST", | ||
374 | + url: url.to('order/default/search-model'), | ||
375 | + data : pData, | ||
376 | + dataType : "json", | ||
377 | + beforeSend : function(){ | ||
378 | + me.showIndicator(); | ||
379 | + }, | ||
380 | + success : function(res){ | ||
381 | + if (res.success) { | ||
382 | + me.renderCarModelItem(res.items); | ||
383 | + } else { | ||
384 | + me.renderCarModelItem([]); | ||
385 | + } | ||
386 | + }, | ||
387 | + error : function(res){}, | ||
388 | + complete : function(res){ | ||
389 | + me.hideIndicator(); | ||
390 | + } | ||
391 | + }) | ||
392 | + } | ||
393 | + ctrl.carModelClick = function(){ | ||
394 | + var me = this; | ||
395 | + $$('#submit').on('click','.model-div-btn', function(e){ | ||
396 | + var model = $$(this).attr('data-value'); | ||
397 | + $$('#submit .carModel').val(model); | ||
398 | + | ||
399 | + $$('#search-wrapper').remove(); | ||
400 | + }) | ||
401 | + $$('#submit').on('click','.closeBtn', function(e){ | ||
402 | + $$('#search-wrapper').remove(); | ||
403 | + }) | ||
404 | + } | ||
330 | return ctrl; | 405 | return ctrl; |
331 | } | 406 | } |
332 | ); | 407 | ); |
web/src/js/user/login-controller.js
@@ -61,6 +61,7 @@ define( | @@ -61,6 +61,7 @@ define( | ||
61 | clickGetCode = true; | 61 | clickGetCode = true; |
62 | return false; | 62 | return false; |
63 | } | 63 | } |
64 | + utils.toast({content:res.message}); | ||
64 | if(res.testCode) { | 65 | if(res.testCode) { |
65 | $$('#login .code').val(res.testCode); | 66 | $$('#login .code').val(res.testCode); |
66 | } | 67 | } |
web/src/js/user/register-controller.js
@@ -97,6 +97,7 @@ define( | @@ -97,6 +97,7 @@ define( | ||
97 | clickGetCode = true; | 97 | clickGetCode = true; |
98 | return false; | 98 | return false; |
99 | } | 99 | } |
100 | + utils.toast({content:res.message}); | ||
100 | if(res.testCode) { | 101 | if(res.testCode) { |
101 | $$('#register .code').val(res.testCode); | 102 | $$('#register .code').val(res.testCode); |
102 | } | 103 | } |