...
|
...
|
@@ -5,6 +5,7 @@ |
|
|
*/
|
|
|
|
|
|
var $ = require('jquery'),
|
|
|
Hammer = require('yoho.hammer'),
|
|
|
tip = require('../plugin/tip'),
|
|
|
loading = require('../plugin/loading');
|
|
|
|
...
|
...
|
@@ -179,36 +180,55 @@ $submit.on('touchend', function() { |
|
|
|
|
|
// 省市区
|
|
|
$area.on('touchend', function() {
|
|
|
$footer.hide();
|
|
|
$pageWrap.hide();
|
|
|
$addressListPage.show();
|
|
|
$addressListPage.show(1, function() {
|
|
|
$footer.hide();
|
|
|
});
|
|
|
currentPage = 'list';
|
|
|
});
|
|
|
|
|
|
// touchend 在下滑的时候会触发
|
|
|
// 省市区联动
|
|
|
$addressListPage.on('touchend', '.address', function() {
|
|
|
newArea.push($(this).children('.caption').text());
|
|
|
$(this).siblings().hide();
|
|
|
$(this).children('ul').show();
|
|
|
return false;
|
|
|
}).on('touchend', '.address-last', function() {
|
|
|
$addressListPage.find('.address').each(function(i, elem) {
|
|
|
var addressHammer = new Hammer(elem);
|
|
|
|
|
|
// 填结果到 html
|
|
|
newArea.push($(this).children('.caption').text());
|
|
|
$('[name="area"]').val(newArea.join(' '));
|
|
|
$('[name="area_code"]').val($(this).data('id'));
|
|
|
addressHammer.on('tap', function(e) {
|
|
|
var $this = $(e.target);
|
|
|
|
|
|
$editAddressPage.show();
|
|
|
currentPage = 'edit';
|
|
|
$navTitle.html('修改地址');
|
|
|
$footer.show();
|
|
|
newArea.push($this.children('.caption').text());
|
|
|
$this.siblings().hide();
|
|
|
$this.children('ul').show().children('li').show();
|
|
|
|
|
|
// 恢复默认的三级选择
|
|
|
$addressListPage.hide();
|
|
|
$addressListPage.find('ul').hide();
|
|
|
$addressListPage.children('ul').show().children('li').show();
|
|
|
newArea = [];
|
|
|
return false;
|
|
|
e.srcEvent.preventDefault();
|
|
|
e.srcEvent.stopPropagation();
|
|
|
});
|
|
|
});
|
|
|
|
|
|
$addressListPage.find('.address-last').each(function(i, elem) {
|
|
|
var addressLastHammer = new Hammer(elem);
|
|
|
|
|
|
addressLastHammer.on('tap', function(e) {
|
|
|
var $this = $(e.target);
|
|
|
|
|
|
// 填结果到 html
|
|
|
newArea.push($this.children('.caption').text());
|
|
|
$('[name="area"]').val(newArea.join(' '));
|
|
|
$('[name="area_code"]').val($this.data('id'));
|
|
|
|
|
|
$editAddressPage.show();
|
|
|
currentPage = 'edit';
|
|
|
$navTitle.html('修改地址');
|
|
|
$footer.show();
|
|
|
|
|
|
// 恢复默认的三级选择
|
|
|
$addressListPage.hide();
|
|
|
$addressListPage.find('ul').hide();
|
|
|
$addressListPage.children('ul').show().children('li').show();
|
|
|
newArea = [];
|
|
|
|
|
|
e.srcEvent.preventDefault();
|
|
|
e.srcEvent.stopPropagation();
|
|
|
});
|
|
|
});
|
|
|
|
|
|
$($editAddressPage, $addressListPage).css('min-height', function() {
|
...
|
...
|
|