Showing
4 changed files
with
34 additions
and
2 deletions
@@ -5311,10 +5311,33 @@ var $action = $('.action'), | @@ -5311,10 +5311,33 @@ var $action = $('.action'), | ||
5311 | $area = $('.area'), | 5311 | $area = $('.area'), |
5312 | $footer = $('#yoho-footer'), | 5312 | $footer = $('#yoho-footer'), |
5313 | $confim = $('.confim-mask'), | 5313 | $confim = $('.confim-mask'), |
5314 | + $pageWrap = $('.page-wrap'), | ||
5315 | + $backBtn = $('.nav-back'), | ||
5314 | isSubmiting, | 5316 | isSubmiting, |
5315 | deleteId, | 5317 | deleteId, |
5318 | + currentPage = 'address', | ||
5316 | newArea = []; | 5319 | newArea = []; |
5317 | 5320 | ||
5321 | +// 清除原有链接 | ||
5322 | +$backBtn.attr('href', 'javascript:void(0);'); | ||
5323 | + | ||
5324 | +// 自定义事件 | ||
5325 | +$backBtn.on('touchend', function(e) { | ||
5326 | + if (currentPage === 'edit') { | ||
5327 | + $pageWrap.hide(); | ||
5328 | + $pageWrap.first().show(); | ||
5329 | + e.preventDefault(); | ||
5330 | + currentPage = 'address'; | ||
5331 | + } else if (currentPage === 'list') { | ||
5332 | + $pageWrap.hide(); | ||
5333 | + $editAddressPage.show(); | ||
5334 | + e.preventDefault(); | ||
5335 | + currentPage = 'edit'; | ||
5336 | + } else { | ||
5337 | + window.history.go(-1); | ||
5338 | + } | ||
5339 | +}); | ||
5340 | + | ||
5318 | function editAddress(data) { | 5341 | function editAddress(data) { |
5319 | data = data || {}; | 5342 | data = data || {}; |
5320 | $addressForm.find('[name="id"]').val(data.id || ''); | 5343 | $addressForm.find('[name="id"]').val(data.id || ''); |
@@ -5323,7 +5346,10 @@ function editAddress(data) { | @@ -5323,7 +5346,10 @@ function editAddress(data) { | ||
5323 | $addressForm.find('[name="area_code"]').val(data.areaCode || ''); | 5346 | $addressForm.find('[name="area_code"]').val(data.areaCode || ''); |
5324 | $addressForm.find('[name="area"]').val(data.area || ''); | 5347 | $addressForm.find('[name="area"]').val(data.area || ''); |
5325 | $addressForm.find('[name="address"]').val(data.address || ''); | 5348 | $addressForm.find('[name="address"]').val(data.address || ''); |
5349 | + | ||
5350 | + currentPage = 'edit'; | ||
5326 | $footer.hide(); | 5351 | $footer.hide(); |
5352 | + $pageWrap.hide(); | ||
5327 | $editAddressPage.show(); | 5353 | $editAddressPage.show(); |
5328 | } | 5354 | } |
5329 | 5355 | ||
@@ -5423,11 +5449,15 @@ $addressForm.on('submit', function() { | @@ -5423,11 +5449,15 @@ $addressForm.on('submit', function() { | ||
5423 | // 省市区 | 5449 | // 省市区 |
5424 | $area.on('touchend', function() { | 5450 | $area.on('touchend', function() { |
5425 | $footer.hide(); | 5451 | $footer.hide(); |
5452 | + $pageWrap.hide(); | ||
5426 | $addressListPage.show(); | 5453 | $addressListPage.show(); |
5454 | + currentPage = 'list'; | ||
5427 | }); | 5455 | }); |
5428 | 5456 | ||
5429 | $addressListPage.on('touchend', '.address', function() { | 5457 | $addressListPage.on('touchend', '.address', function() { |
5430 | - newArea.push($(this).children('.caption').text()); | 5458 | + var caption = $(this).children('.caption').text(); |
5459 | + | ||
5460 | + newArea.push(caption); | ||
5431 | $(this).siblings().hide(); | 5461 | $(this).siblings().hide(); |
5432 | $(this).children('ul').show(); | 5462 | $(this).children('ul').show(); |
5433 | return false; | 5463 | return false; |
@@ -5438,11 +5468,13 @@ $addressListPage.on('touchend', '.address', function() { | @@ -5438,11 +5468,13 @@ $addressListPage.on('touchend', '.address', function() { | ||
5438 | $('[name="area"]').val(newArea.join(' ')); | 5468 | $('[name="area"]').val(newArea.join(' ')); |
5439 | $('[name="area_code"]').val($(this).data('id')); | 5469 | $('[name="area_code"]').val($(this).data('id')); |
5440 | 5470 | ||
5471 | + $editAddressPage.show(); | ||
5472 | + currentPage = 'edit'; | ||
5473 | + | ||
5441 | // 恢复默认的三级选择 | 5474 | // 恢复默认的三级选择 |
5442 | $addressListPage.hide(); | 5475 | $addressListPage.hide(); |
5443 | $addressListPage.find('ul').hide(); | 5476 | $addressListPage.find('ul').hide(); |
5444 | $addressListPage.children('ul').show().children('li').show(); | 5477 | $addressListPage.children('ul').show().children('li').show(); |
5445 | - $footer.show(); | ||
5446 | newArea = []; | 5478 | newArea = []; |
5447 | return false; | 5479 | return false; |
5448 | }); | 5480 | }); |
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
-
Please register or login to post a comment