Authored by 姜敏

个人中心-收货地址调试接口

@@ -16,7 +16,7 @@ var $phone = $('#phone'); @@ -16,7 +16,7 @@ var $phone = $('#phone');
16 require('./me'); 16 require('./me');
17 17
18 // 设置收货地址 18 // 设置收货地址
19 -$('.default-address').click(function () { 19 +$('.default-address').click(function() {
20 if ($(this).hasClass('checked')) { 20 if ($(this).hasClass('checked')) {
21 $(this).removeClass('checked'); 21 $(this).removeClass('checked');
22 $(this).html(''); 22 $(this).html('');
@@ -27,26 +27,26 @@ $('.default-address').click(function () { @@ -27,26 +27,26 @@ $('.default-address').click(function () {
27 }); 27 });
28 28
29 // 校验 29 // 校验
30 -$consignee.keydown(function () { 30 +$consignee.keydown(function() {
31 $(this).next().hide(); 31 $(this).next().hide();
32 }); 32 });
33 -$consignee.blur(function () { 33 +$consignee.blur(function() {
34 if ($(this).val().trim() === '') { 34 if ($(this).val().trim() === '') {
35 $(this).next().show(); 35 $(this).next().show();
36 } 36 }
37 }); 37 });
38 -$addressDetail.keydown(function () { 38 +$addressDetail.keydown(function() {
39 $(this).next().hide(); 39 $(this).next().hide();
40 }); 40 });
41 -$addressDetail.blur(function () { 41 +$addressDetail.blur(function() {
42 if ($(this).val().trim() === '') { 42 if ($(this).val().trim() === '') {
43 $(this).next().show(); 43 $(this).next().show();
44 } 44 }
45 }); 45 });
46 -$mobile.keydown(function () { 46 +$mobile.keydown(function() {
47 $(this).next().hide(); 47 $(this).next().hide();
48 }); 48 });
49 -$mobile.blur(function () { 49 +$mobile.blur(function() {
50 if ($(this).val().trim() === '') { 50 if ($(this).val().trim() === '') {
51 $(this).next().show(); 51 $(this).next().show();
52 } else { 52 } else {
@@ -60,7 +60,7 @@ $mobile.blur(function () { @@ -60,7 +60,7 @@ $mobile.blur(function () {
60 }); 60 });
61 61
62 // 保存收货地址 62 // 保存收货地址
63 -$('#save-address').click(function () { 63 +$('#save-address').click(function() {
64 if ($consignee.val().trim() === '') { 64 if ($consignee.val().trim() === '') {
65 alert('name不能为空'); 65 alert('name不能为空');
66 } else { 66 } else {
@@ -79,7 +79,7 @@ $('#save-address').click(function () { @@ -79,7 +79,7 @@ $('#save-address').click(function () {
79 mobile: $mobile.val(), 79 mobile: $mobile.val(),
80 phone: $phone.val() 80 phone: $phone.val()
81 }, 81 },
82 - success: function () { // 刷新下面列表数据 82 + success: function() { // 刷新下面列表数据
83 83
84 } 84 }
85 }); 85 });
@@ -90,12 +90,12 @@ $('#save-address').click(function () { @@ -90,12 +90,12 @@ $('#save-address').click(function () {
90 // 修改收货地址 90 // 修改收货地址
91 91
92 // 删除收货地址 92 // 删除收货地址
93 -$('.del-address').click(function () { 93 +$('.del-address').click(function() {
94 let id = $(this).data('id'); 94 let id = $(this).data('id');
95 95
96 new _confirm({ 96 new _confirm({
97 content: '您确定要删除收货地址吗?', 97 content: '您确定要删除收货地址吗?',
98 - cb: function () { 98 + cb: function() {
99 $.ajax({ 99 $.ajax({
100 type: 'POST', 100 type: 'POST',
101 url: '/me/address/del', 101 url: '/me/address/del',
@@ -105,7 +105,7 @@ $('.del-address').click(function () { @@ -105,7 +105,7 @@ $('.del-address').click(function () {
105 uid: '123456', 105 uid: '123456',
106 id: id 106 id: id
107 }, 107 },
108 - success: function () { // 刷新下面列表数据 108 + success: function() { // 刷新下面列表数据
109 109
110 } 110 }
111 }); 111 });
@@ -114,7 +114,7 @@ $('.del-address').click(function () { @@ -114,7 +114,7 @@ $('.del-address').click(function () {
114 }); 114 });
115 115
116 // 设置默认收货地址 116 // 设置默认收货地址
117 -$('.set-default').click(function () { 117 +$('.set-default').click(function() {
118 let id = $(this).data('id'); 118 let id = $(this).data('id');
119 119
120 $.ajax({ 120 $.ajax({
@@ -126,13 +126,13 @@ $('.set-default').click(function () { @@ -126,13 +126,13 @@ $('.set-default').click(function () {
126 uid: '123456', 126 uid: '123456',
127 id: id 127 id: id
128 }, 128 },
129 - success: function () { // 刷新下面列表数据 129 + success: function() { // 刷新下面列表数据
130 130
131 } 131 }
132 }); 132 });
133 }); 133 });
134 134
135 -$(function () { 135 +$(function() {
136 // 运行此demo 136 // 运行此demo
137 // 1. 安装 npm i -g json-server 137 // 1. 安装 npm i -g json-server
138 // 2. json-server --watch mock/address.json 138 // 2. json-server --watch mock/address.json