Authored by ccbikai

地址管理三级菜单

@@ -12,7 +12,11 @@ var $action = $('.action'), @@ -12,7 +12,11 @@ var $action = $('.action'),
12 $submit = $('.submit'), 12 $submit = $('.submit'),
13 $addAddress = $('.add-address'), 13 $addAddress = $('.add-address'),
14 $editAddressPage = $('.my-edit-address-page'), 14 $editAddressPage = $('.my-edit-address-page'),
15 - isSubmiting; 15 + $addressListPage = $('.my-address-list-page'),
  16 + $area = $('.area'),
  17 + $footer = $('#yoho-footer'),
  18 + isSubmiting,
  19 + newArea = [];
16 20
17 function editAddress(data) { 21 function editAddress(data) {
18 data = data || {}; 22 data = data || {};
@@ -71,3 +75,30 @@ $addressForm.on('submit', function() { @@ -71,3 +75,30 @@ $addressForm.on('submit', function() {
71 }); 75 });
72 return false; 76 return false;
73 }); 77 });
  78 +
  79 +// 省市区
  80 +$area.on('touchend', function() {
  81 + $footer.hide();
  82 + $addressListPage.show();
  83 +});
  84 +
  85 +$addressListPage.on('touchend', '.address', function() {
  86 + newArea.push($(this).children('.caption').text());
  87 + $(this).siblings().hide();
  88 + $(this).children('ul').show();
  89 + return false;
  90 +}).on('touchend', '.address-last', function() {
  91 +
  92 + // 填结果到 html
  93 + newArea.push($(this).children('.caption').text());
  94 + $('[name="area"]').val(newArea.join(' '));
  95 + $('[name="area_code"]').val($(this).data('id'));
  96 +
  97 + // 恢复默认的三级选择
  98 + $addressListPage.hide();
  99 + $addressListPage.find('ul').hide();
  100 + $addressListPage.children('ul').show().children('li').show();
  101 + $footer.show();
  102 + newArea = [];
  103 + return false;
  104 +});
@@ -102,7 +102,7 @@ @@ -102,7 +102,7 @@
102 .my-edit-address-page { 102 .my-edit-address-page {
103 position: absolute; 103 position: absolute;
104 bottom: 0; 104 bottom: 0;
105 - top: pxToRem(90px); 105 + top: 0;
106 width: 100%; 106 width: 100%;
107 color: #d0d0d0; 107 color: #d0d0d0;
108 background: #f0f0f0; 108 background: #f0f0f0;
@@ -157,7 +157,7 @@ @@ -157,7 +157,7 @@
157 157
158 textarea { 158 textarea {
159 height: pxToRem(58px) * 2; 159 height: pxToRem(58px) * 2;
160 - padding: pxToRem(20px) pxToRem(10px); 160 + padding: pxToRem(20px) 0;
161 } 161 }
162 } 162 }
163 163
@@ -172,3 +172,31 @@ @@ -172,3 +172,31 @@
172 line-height: pxToRem(88px); 172 line-height: pxToRem(88px);
173 } 173 }
174 } 174 }
  175 +
  176 +.my-address-list-page {
  177 + position: absolute;
  178 + bottom: 0;
  179 + top: 0;
  180 + width: 100%;
  181 + color: #444;
  182 + background: #fff;
  183 +
  184 + li {
  185 + padding: 0 pxToRem(30px);
  186 + font-size: pxToRem(32px);
  187 + line-height: pxToRem(88px);
  188 + border-bottom: 1px solid #e0e0e0;
  189 + .iconfont {
  190 + float: right;
  191 + color: #d0d0d0;
  192 + }
  193 + ul {
  194 + display: none;
  195 + position: absolute;
  196 + top: 0;
  197 + left: 0;
  198 + background: #fff;
  199 + width: 100%;
  200 + }
  201 + }
  202 +}
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 <span class="tel">{{mobile}}</span> 6 <span class="tel">{{mobile}}</span>
7 <p class="address-info">{{area}} {{address}}</p> 7 <p class="address-info">{{area}} {{address}}</p>
8 <div class="action iconfont"> 8 <div class="action iconfont">
9 - <a href="/home/address/edit?id={{address_id}}" class="edit">&#xe61e;</a> 9 + <span class="edit" data-id="{{address_id}}" data-consignee="{{consignee}}" data-mobile="{{mobile}}" data-area-code="{{area_code}}" data-area="{{area}}" data-address="{{address}}">&#xe61e;</span>
10 <span class="del" data-id="{{address_id}}">&#xe621;</span> 10 <span class="del" data-id="{{address_id}}">&#xe621;</span>
11 </div> 11 </div>
12 </div> 12 </div>
@@ -30,5 +30,7 @@ @@ -30,5 +30,7 @@
30 </div> 30 </div>
31 </div> 31 </div>
32 </div> 32 </div>
  33 + {{> me/address/edit-address}}
  34 + {{> me/address/address-list}}
33 </div> 35 </div>
34 {{> layout/footer}} 36 {{> layout/footer}}
1 -{{> layout/header}}  
2 -<div class="my-edit-address-page yoho-page">  
3 - <form class="edit-address">  
4 - <label class="username">  
5 - 用户名  
6 - <input type="text" name="name" value="张三">  
7 - </label>  
8 - <label class="mobile">  
9 - 手机号码  
10 - <input type="text" name="mobile" value="18911110110">  
11 - </label>  
12 - <label class="area">  
13 - 省市区  
14 - <input type="text" name="area" value="江苏省南京市栖霞区">  
15 - <span class="iconfont">&#xe604;</span>  
16 - </label>  
17 - <label class="address">  
18 - 详细地址  
19 - <textarea name="address">东大街西大66号茶馆东大街西大66号茶馆东大街西大66号茶馆</textarea>  
20 - </label>  
21 -  
22 - </form>  
23 -  
24 - <div class="submit">  
25 - 确认  
26 - </div>  
27 -</div>  
28 -{{> layout/footer}}  
1 -{{> layout/header}}  
2 -<div class="online-service-page yoho-page">  
3 - {{# service}}  
4 - <div class="question">  
5 - <div class="question-title">问题查询</div>  
6 - <div class="question-tab">  
7 - {{#tab}}  
8 - <span class="tab-item {{#current}}current{{/current}}" data-tab="{{tabid}}">{{tabname}}</span>  
9 - {{#iscut}}<span class="line"></span>{{/iscut}}  
10 - {{/tab}}  
11 - </div>  
12 - {{#question}}  
13 - <ul class="question-list {{#current}}current{{/current}}" data-tab-name="{{name}}">  
14 - {{#list}}  
15 - <li class="question-item">  
16 - <a href="{{link}}" title="{{title}}">  
17 - {{title}}  
18 - <span class="iconfont icon-yoho-enter">&#xe604;</span>  
19 - </a>  
20 - </li>  
21 - {{/list}}  
22 - </ul>  
23 - {{/question}}  
24 - </div>  
25 - {{/ service}}  
26 - <div class="connect-info">  
27 - <div class="connect-item connect-online">  
28 - <a href="http://chat80.live800.com/live800/chatClient/chatbox.jsp?companyID=493979&amp;configID=123576&amp;jid=9277320930" target="_blank" title="在线客服">  
29 - <span class="icon iconfont icon-chat">&#xe63c;</span>  
30 - 在线客服  
31 - <span class="iconfont icon-yoho-enter">&#xe604;</span>  
32 - </a>  
33 - </div>  
34 - <div class="connect-item connect-tel">  
35 - <a href="tel:400-889-9649" title="电话客服">  
36 - <span class="icon iconfont icon-tel">&#xe63e;</span>  
37 - 电话客服  
38 - <p>  
39 - 400-889-9649 &nbsp;&nbsp; 09:00 - 22:30 &nbsp; (周一至周日)  
40 - </p>  
41 - </a>  
42 -  
43 - </div>  
44 - </div>  
45 -</div>  
46 -{{> layout/footer}}  
1 -{{> layout/header}}  
2 -<div class="online-service-detail-page yoho-page">  
3 - <div class="qa-list">  
4 - {{# list}}  
5 - <div class="question-item">  
6 - <div class="question">Q:{{q}}</div>  
7 - <div class="answer">{{a}}</div>  
8 - </div>  
9 - {{/ list}}  
10 - </div>  
11 -</div>  
12 -{{> layout/footer}}  
@@ -231,3 +231,8 @@ @@ -231,3 +231,8 @@
231 seajs.use('js/me/online-service'); 231 seajs.use('js/me/online-service');
232 </script> 232 </script>
233 {{/if}} 233 {{/if}}
  234 +{{#if addressPage}}
  235 +<script>
  236 + seajs.use('js/me/address');
  237 +</script>
  238 +{{/if}}
1 <div class="my-address-list-page hide"> 1 <div class="my-address-list-page hide">
2 -{{# addressList}}  
3 <ul class="address-list"> 2 <ul class="address-list">
  3 + {{# addressList}}
4 <li class="address"> 4 <li class="address">
5 - {{caption}} 5 + <span class="caption">{{caption}}</span>
6 <span class="iconfont">&#xe604;</span> 6 <span class="iconfont">&#xe604;</span>
7 <ul> 7 <ul>
8 {{# sub}} 8 {{# sub}}
9 <li class="address"> 9 <li class="address">
10 - {{caption}} 10 + <span class="caption">{{caption}}</span>
  11 + <span class="iconfont">&#xe604;</span>
11 <ul class="address-list"> 12 <ul class="address-list">
12 {{# sub}} 13 {{# sub}}
13 <li class="address-last" data-id="{{code}}"> 14 <li class="address-last" data-id="{{code}}">
14 - {{caption}}, {{code}} 15 + <span class="caption">{{caption}}</span>
15 </li> 16 </li>
16 {{/ sub}} 17 {{/ sub}}
17 </ul> 18 </ul>
@@ -19,6 +20,6 @@ @@ -19,6 +20,6 @@
19 {{/ sub}} 20 {{/ sub}}
20 </ul> 21 </ul>
21 </li> 22 </li>
  23 + {{/ addressList}}
22 </ul> 24 </ul>
23 -{{/ addressList}}  
24 </div> 25 </div>
@@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
12 <label class="area"> 12 <label class="area">
13 省市区 13 省市区
14 <input type="hidden" name="area_code" value=""> 14 <input type="hidden" name="area_code" value="">
15 - <input type="text" name="area" value=""> 15 + <input type="text" name="area" value="" readonly>
16 <span class="iconfont">&#xe604;</span> 16 <span class="iconfont">&#xe604;</span>
17 </label> 17 </label>
18 <label class="address"> 18 <label class="address">
@@ -207,7 +207,7 @@ class HomeController extends AbstractAction @@ -207,7 +207,7 @@ class HomeController extends AbstractAction
207 $address = \Index\UserModel::getAddressData($uid); 207 $address = \Index\UserModel::getAddressData($uid);
208 $addressList = \Index\UserModel::getAddressListData($uid); 208 $addressList = \Index\UserModel::getAddressListData($uid);
209 209
210 - // print_r($address); 210 + // print_r($addressList);
211 211
212 $this->_view->display('address', array( 212 $this->_view->display('address', array(
213 'addressPage' => true, 213 'addressPage' => true,
@@ -277,7 +277,7 @@ class HomeController extends AbstractAction @@ -277,7 +277,7 @@ class HomeController extends AbstractAction
277 277
278 $service = home\OnlineModel::getOnlineServiceInfo(); 278 $service = home\OnlineModel::getOnlineServiceInfo();
279 279
280 - $this->_view->display('online_service', array( 280 + $this->_view->display('online-service', array(
281 'onlineServicePage' => true, 281 'onlineServicePage' => true,
282 // 'pageFooter' => true, 282 // 'pageFooter' => true,
283 'service' => $service 283 'service' => $service
@@ -295,7 +295,7 @@ class HomeController extends AbstractAction @@ -295,7 +295,7 @@ class HomeController extends AbstractAction
295 } 295 }
296 $this->setTitle('在线客服'); 296 $this->setTitle('在线客服');
297 $this->setNavHeader($cateName, true, ''); 297 $this->setNavHeader($cateName, true, '');
298 - $this->_view->display('online_service_detail', $service); 298 + $this->_view->display('online-service-detail', $service);
299 } 299 }
300 300
301 /** 301 /**
@@ -296,10 +296,10 @@ class UserModel @@ -296,10 +296,10 @@ class UserModel
296 } else if (empty($consignee)) { 296 } else if (empty($consignee)) {
297 $result['code'] = 403; 297 $result['code'] = 403;
298 $result['message'] = '请输入收件人姓名'; 298 $result['message'] = '请输入收件人姓名';
299 - } else if (!empty($email) && Helpers::verifyEmail($email)) { 299 + } else if (!empty($email) && !Helpers::verifyEmail($email)) {
300 $result['code'] = 404; 300 $result['code'] = 404;
301 $result['message'] = '输入的邮箱地址格式不正确'; 301 $result['message'] = '输入的邮箱地址格式不正确';
302 - } else if (!empty($mobile) && Helpers::verifyMobile($mobile)) { 302 + } else if (!empty($mobile) && !Helpers::verifyMobile($mobile)) {
303 $result['code'] = 404; 303 $result['code'] = 404;
304 $result['message'] = '输入的手机号码格式不正确'; 304 $result['message'] = '输入的手机号码格式不正确';
305 } else { 305 } else {