Authored by htoooth

Merge remote-tracking branch 'origin/release/1.0' into release/1.0

... ... @@ -27,19 +27,11 @@ function dotYou($el) {
});
}
// set address-all & new address block
function setAllNewOfAddress() {
var $address = $('#address-list .address');
// 若添加后有20个地址则隐藏新增的按钮
if ($address.length === 20) {
$('#address-list .new-address-block').addClass('hide');
} else {
$('#address-list .new-address-block').removeClass('hide');
}
// set address-all show or not
function setAllOfAddress() {
// 显示全部地址[3个地址块+1个新增地址按钮]
if ($address.length > 3) {
if ($('#address-list .address').length > 3) {
$('.address-all').removeClass('vhide');
} else {
$('.address-all').addClass('vhide');
... ... @@ -252,7 +244,7 @@ function addressDialogFactory(opt, $the) {
dotYou($('#address-list .address').first());
setAllNewOfAddress();
setAllOfAddress();
// 新地址默认使用,更新收货信息
receiver(the);
... ... @@ -318,8 +310,8 @@ function newAddress(isInit) {
function newAddressHandle() {
// 判断是否超过20条地址
if ($('#address-list .address').length >= 20) {
new Alert('您最多添加20个收货地址,可删除不需要的地址后再添加新地址').show();
if ($('#address-list .address').length >= 7) {
new Alert('您最多添加7个收货地址,可删除不需要的地址后再添加新地址').show();
return;
}
... ... @@ -401,7 +393,7 @@ $('.address-list').on('click', '.address', function() {
$this.remove();
delConfirm.close();
setAllNewOfAddress();
setAllOfAddress();
}
});
}
... ... @@ -437,19 +429,19 @@ $.ajax({
var list;
if (data && data.code === 200) {
list = data.data;
if (list.length === 0) {
if (data.data.length === 0) {
// new address
newAddress(true);
} else {
list = data.data.slice(0, 7);
$('#address-list').append(addressTpl({
address: data.data,
hasNew: data.data.length >= 20 ? false : true
address: list,
hasNew: true
}));
// 3个地址块+1个新增地址块
if (data.data.length > 3) {
if (list.length > 3) {
$('.address-all').removeClass('vhide');
}
... ...