Authored by Lynnic

Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into develop

@@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
5 */ 5 */
6 6
7 var $ = require('jquery'), 7 var $ = require('jquery'),
  8 + Hammer = require('yoho.hammer'),
8 tip = require('../plugin/tip'), 9 tip = require('../plugin/tip'),
9 loading = require('../plugin/loading'); 10 loading = require('../plugin/loading');
10 11
@@ -179,36 +180,55 @@ $submit.on('touchend', function() { @@ -179,36 +180,55 @@ $submit.on('touchend', function() {
179 180
180 // 省市区 181 // 省市区
181 $area.on('touchend', function() { 182 $area.on('touchend', function() {
182 - $footer.hide();  
183 $pageWrap.hide(); 183 $pageWrap.hide();
184 - $addressListPage.show(); 184 + $addressListPage.show(1, function() {
  185 + $footer.hide();
  186 + });
185 currentPage = 'list'; 187 currentPage = 'list';
186 }); 188 });
187 189
  190 +// touchend 在下滑的时候会触发
188 // 省市区联动 191 // 省市区联动
189 -$addressListPage.on('touchend', '.address', function() {  
190 - newArea.push($(this).children('.caption').text());  
191 - $(this).siblings().hide();  
192 - $(this).children('ul').show();  
193 - return false;  
194 -}).on('touchend', '.address-last', function() { 192 +$addressListPage.find('.address').each(function(i, elem) {
  193 + var addressHammer = new Hammer(elem);
195 194
196 - // 填结果到 html  
197 - newArea.push($(this).children('.caption').text());  
198 - $('[name="area"]').val(newArea.join(' '));  
199 - $('[name="area_code"]').val($(this).data('id')); 195 + addressHammer.on('tap', function(e) {
  196 + var $this = $(e.target);
200 197
201 - $editAddressPage.show();  
202 - currentPage = 'edit';  
203 - $navTitle.html('修改地址');  
204 - $footer.show(); 198 + newArea.push($this.children('.caption').text());
  199 + $this.siblings().hide();
  200 + $this.children('ul').show().children('li').show();
205 201
206 - // 恢复默认的三级选择  
207 - $addressListPage.hide();  
208 - $addressListPage.find('ul').hide();  
209 - $addressListPage.children('ul').show().children('li').show();  
210 - newArea = [];  
211 - return false; 202 + e.srcEvent.preventDefault();
  203 + e.srcEvent.stopPropagation();
  204 + });
  205 +});
  206 +
  207 +$addressListPage.find('.address-last').each(function(i, elem) {
  208 + var addressLastHammer = new Hammer(elem);
  209 +
  210 + addressLastHammer.on('tap', function(e) {
  211 + var $this = $(e.target);
  212 +
  213 + // 填结果到 html
  214 + newArea.push($this.children('.caption').text());
  215 + $('[name="area"]').val(newArea.join(' '));
  216 + $('[name="area_code"]').val($this.data('id'));
  217 +
  218 + $editAddressPage.show();
  219 + currentPage = 'edit';
  220 + $navTitle.html('修改地址');
  221 + $footer.show();
  222 +
  223 + // 恢复默认的三级选择
  224 + $addressListPage.hide();
  225 + $addressListPage.find('ul').hide();
  226 + $addressListPage.children('ul').show().children('li').show();
  227 + newArea = [];
  228 +
  229 + e.srcEvent.preventDefault();
  230 + e.srcEvent.stopPropagation();
  231 + });
212 }); 232 });
213 233
214 $($editAddressPage, $addressListPage).css('min-height', function() { 234 $($editAddressPage, $addressListPage).css('min-height', function() {
@@ -29,12 +29,20 @@ @@ -29,12 +29,20 @@
29 } 29 }
30 30
31 .action { 31 .action {
32 - font-size: pxToRem(28px);  
33 - line-height: pxToRem(40px); 32 + font-size: pxToRem(40px);
  33 + line-height: pxToRem(60px);
34 text-align: right; 34 text-align: right;
  35 +
  36 + .edit,
  37 + .del {
  38 + display: inline-block;
  39 + text-align: center;
  40 + width: pxToRem(60px);
  41 + height: pxToRem(60px);
  42 + }
35 43
36 .edit { 44 .edit {
37 - margin-right: pxToRem(30px); 45 + padding-right: pxToRem(20px);
38 } 46 }
39 } 47 }
40 } 48 }