...
|
...
|
@@ -28,7 +28,6 @@ var $action = $('.action'), |
|
|
|
|
|
// 清除返回按钮原有链接
|
|
|
$backBtn.attr('href', 'javascript:void(0);');
|
|
|
|
|
|
window.rePosFooter();
|
|
|
|
|
|
// 自定义返回按钮事件
|
...
|
...
|
@@ -39,6 +38,7 @@ $backBtn.on('touchend', function(e) { |
|
|
e.preventDefault();
|
|
|
currentPage = 'address';
|
|
|
$navTitle.html('地址管理');
|
|
|
window.rePosFooter();
|
|
|
} else if (currentPage === 'list') {
|
|
|
$pageWrap.hide();
|
|
|
$editAddressPage.show();
|
...
|
...
|
@@ -60,9 +60,10 @@ function editAddress(data) { |
|
|
$addressForm.find('[name="address"]').val(data.address || '');
|
|
|
|
|
|
currentPage = 'edit';
|
|
|
$footer.hide();
|
|
|
$pageWrap.hide();
|
|
|
$editAddressPage.show();
|
|
|
|
|
|
$footer.addClass('bottom');
|
|
|
}
|
|
|
|
|
|
$confim.on('touchend', '.cancel', function() {
|
...
|
...
|
@@ -94,30 +95,7 @@ $confim.on('touchend', '.cancel', function() { |
|
|
});
|
|
|
});
|
|
|
|
|
|
// 添加地址
|
|
|
$addAddress.on('touchend', function() {
|
|
|
if ($addressItem.length >= 5) {
|
|
|
tip.show('您最多添加5个收货地址');
|
|
|
return false;
|
|
|
}
|
|
|
editAddress();
|
|
|
$navTitle.html('添加新地址');
|
|
|
});
|
|
|
|
|
|
// 编辑或删除
|
|
|
$action.on('touchend', '.edit', function() {
|
|
|
editAddress($(this).data());
|
|
|
$navTitle.html('修改地址');
|
|
|
}).on('touchend', '.del', function() {
|
|
|
deleteId = $(this).data('id');
|
|
|
$confim.show();
|
|
|
});
|
|
|
|
|
|
$submit.on('touchend', function() {
|
|
|
$addressForm.submit();
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
// 提交表单请求
|
|
|
$addressForm.on('submit', function() {
|
|
|
if (isSubmiting) {
|
|
|
return false;
|
...
|
...
|
@@ -168,6 +146,34 @@ $addressForm.on('submit', function() { |
|
|
return false;
|
|
|
});
|
|
|
|
|
|
// 添加地址
|
|
|
$addAddress.on('touchend', function() {
|
|
|
if ($addressItem.length >= 5) {
|
|
|
tip.show('您最多添加5个收货地址');
|
|
|
return false;
|
|
|
}
|
|
|
editAddress();
|
|
|
$navTitle.html('添加新地址');
|
|
|
});
|
|
|
|
|
|
// 编辑或删除
|
|
|
$action.on('touchend', '.edit', function() {
|
|
|
editAddress($(this).data());
|
|
|
$navTitle.html('修改地址');
|
|
|
}).on('touchend', '.del', function() {
|
|
|
deleteId = $(this).data('id');
|
|
|
$confim.show();
|
|
|
});
|
|
|
|
|
|
$submit.on('touchend', function() {
|
|
|
$addressForm.submit();
|
|
|
return false;
|
|
|
}).on('touchstart', function() {
|
|
|
$(this).addClass('highlight');
|
|
|
}).on('touchend touchcancel', function() {
|
|
|
$(this).removeClass('highlight');
|
|
|
});
|
|
|
|
|
|
// 省市区
|
|
|
$area.on('touchend', function() {
|
|
|
$footer.hide();
|
...
|
...
|
@@ -176,10 +182,9 @@ $area.on('touchend', function() { |
|
|
currentPage = 'list';
|
|
|
});
|
|
|
|
|
|
// 省市区联动
|
|
|
$addressListPage.on('touchend', '.address', function() {
|
|
|
var caption = $(this).children('.caption').text();
|
|
|
|
|
|
newArea.push(caption);
|
|
|
newArea.push($(this).children('.caption').text());
|
|
|
$(this).siblings().hide();
|
|
|
$(this).children('ul').show();
|
|
|
return false;
|
...
|
...
|
@@ -193,6 +198,7 @@ $addressListPage.on('touchend', '.address', function() { |
|
|
$editAddressPage.show();
|
|
|
currentPage = 'edit';
|
|
|
$navTitle.html('修改地址');
|
|
|
$footer.show();
|
|
|
|
|
|
// 恢复默认的三级选择
|
|
|
$addressListPage.hide();
|
...
|
...
|
@@ -201,3 +207,17 @@ $addressListPage.on('touchend', '.address', function() { |
|
|
newArea = [];
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
$($editAddressPage, $addressListPage).css('min-height', function() {
|
|
|
return $(window).height() - $('#yoho-header').height();
|
|
|
});
|
|
|
|
|
|
$pageWrap.first().css('min-height', function() {
|
|
|
return $(window).height() - $('#yoho-header').height() - $footer.height();
|
|
|
});
|
|
|
|
|
|
$('input, textarea').on('focus', function() {
|
|
|
$footer.hide();
|
|
|
}).on('blur', function() {
|
|
|
$footer.show();
|
|
|
}); |
|
|
\ No newline at end of file |
...
|
...
|
|