...
|
...
|
@@ -45,7 +45,11 @@ var address = { |
|
|
},
|
|
|
|
|
|
editAddr: function(id) {
|
|
|
$.getJSON('/home/address/editAddress?id=' + id, function(jsonData) {
|
|
|
$.ajax({
|
|
|
url: '/home/address/editAddress',
|
|
|
type: 'POST',
|
|
|
data: {id: id},
|
|
|
}).done(function(jsonData) {
|
|
|
if (jsonData.code === 200) {
|
|
|
$('#form-status').html('修改地址');
|
|
|
$('#addressName').val(jsonData.data.consignee);
|
...
|
...
|
@@ -82,7 +86,7 @@ var address = { |
|
|
delAddr: function(addrId) {
|
|
|
$.getJSON('/home/address/delAddress?id=' + addrId, function(jsonData) {
|
|
|
if (jsonData.code === 200) {
|
|
|
$('.address-list').find('li[addressId=' + addrId + ']').remove();
|
|
|
$('.address-list').find('li[addressId="' + addrId + '"]').remove();
|
|
|
if (addrId === $('#addrId').val()) {
|
|
|
address.clearAddrForm();
|
|
|
}
|
...
|
...
|
@@ -96,10 +100,14 @@ var address = { |
|
|
setDefaultAddr: function(addrId) {
|
|
|
var oldBtn = $('.address-list').find('.default-btn'),
|
|
|
oldLi = $('.address-list').find('.default-btn').parents('li'),
|
|
|
curLi = $('.address-list').find('li[addressId=' + addrId + ']'),
|
|
|
curLi = $('.address-list').find('li[addressId="' + addrId + '"]'),
|
|
|
curBtn = curLi.find('.set-default-btn');
|
|
|
|
|
|
$.getJSON('/home/address/defaultAddress?id=' + addrId, function(jsonData) {
|
|
|
$.ajax({
|
|
|
url: '/home/address/defaultAddress',
|
|
|
type: 'POST',
|
|
|
data: {id: addrId},
|
|
|
}).done(function(jsonData) {
|
|
|
if (jsonData.code === 200) {
|
|
|
oldBtn.attr('class', 'btn-c3 set-default-btn');
|
|
|
oldLi.removeClass('preferred');
|
...
|
...
|
|