|
@@ -15,7 +15,9 @@ var $action = $('.action'), |
|
@@ -15,7 +15,9 @@ var $action = $('.action'), |
15
|
$addressListPage = $('.my-address-list-page'),
|
15
|
$addressListPage = $('.my-address-list-page'),
|
16
|
$area = $('.area'),
|
16
|
$area = $('.area'),
|
17
|
$footer = $('#yoho-footer'),
|
17
|
$footer = $('#yoho-footer'),
|
|
|
18
|
+ $confim = $('.confim-mask'),
|
18
|
isSubmiting,
|
19
|
isSubmiting,
|
|
|
20
|
+ deleteId,
|
19
|
newArea = [];
|
21
|
newArea = [];
|
20
|
|
22
|
|
21
|
function editAddress(data) {
|
23
|
function editAddress(data) {
|
|
@@ -32,9 +34,30 @@ function editAddress(data) { |
|
@@ -32,9 +34,30 @@ function editAddress(data) { |
32
|
// $addressForm.find('[name="consignee"]').focus();
|
34
|
// $addressForm.find('[name="consignee"]').focus();
|
33
|
}
|
35
|
}
|
34
|
|
36
|
|
35
|
-function deleteAddress(data) {
|
|
|
36
|
-
|
|
|
37
|
-}
|
37
|
+$confim.on('touchend', '.cancel', function(){
|
|
|
38
|
+ deleteId = null;
|
|
|
39
|
+ $confim.hide();
|
|
|
40
|
+}).on('touchend', '.confim', function(){
|
|
|
41
|
+ $.ajax({
|
|
|
42
|
+ method: 'POST',
|
|
|
43
|
+ url: '/home/deladdress',
|
|
|
44
|
+ data: {id: deleteId}
|
|
|
45
|
+ }).then(function(res) {
|
|
|
46
|
+ if ($.type(res) !== 'object') {
|
|
|
47
|
+ res = {};
|
|
|
48
|
+ }
|
|
|
49
|
+ if (res.code !== 200) {
|
|
|
50
|
+ tip.show(res.message || '网络出了点问题~');
|
|
|
51
|
+ } else {
|
|
|
52
|
+ window.location.reload();
|
|
|
53
|
+ }
|
|
|
54
|
+ }).fail(function() {
|
|
|
55
|
+ tip.show('网络出了点问题~');
|
|
|
56
|
+ }).always(function() {
|
|
|
57
|
+ deleteId = null;
|
|
|
58
|
+ $confim.hide();
|
|
|
59
|
+ });
|
|
|
60
|
+});
|
38
|
|
61
|
|
39
|
// 添加地址
|
62
|
// 添加地址
|
40
|
$addAddress.on('touchend', function() {
|
63
|
$addAddress.on('touchend', function() {
|
|
@@ -45,7 +68,8 @@ $addAddress.on('touchend', function() { |
|
@@ -45,7 +68,8 @@ $addAddress.on('touchend', function() { |
45
|
$action.on('touchend', '.edit', function() {
|
68
|
$action.on('touchend', '.edit', function() {
|
46
|
editAddress($(this).data());
|
69
|
editAddress($(this).data());
|
47
|
}).on('touchend', '.del', function() {
|
70
|
}).on('touchend', '.del', function() {
|
48
|
- deleteAddress();
|
71
|
+ deleteId = $(this).data('id');
|
|
|
72
|
+ $confim.show();
|
49
|
});
|
73
|
});
|
50
|
|
74
|
|
51
|
$submit.on('touchend', function() {
|
75
|
$submit.on('touchend', function() {
|