Authored by ccbikai

删除地址

@@ -15,13 +15,7 @@ var $nav = $('.category-nav'), @@ -15,13 +15,7 @@ var $nav = $('.category-nav'),
15 15
16 var $curContent = $contents.not('.hide'); 16 var $curContent = $contents.not('.hide');
17 17
18 -<<<<<<< HEAD  
19 -// $curClickSubLevel;  
20 -  
21 -var navHammer, ccHammer;  
22 -=======  
23 var navHammer; 18 var navHammer;
24 ->>>>>>> master  
25 19
26 //初始化container高度 20 //初始化container高度
27 (function() { 21 (function() {
@@ -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() {
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 你确定要删除地址吗? 21 你确定要删除地址吗?
22 </div> 22 </div>
23 <div class="action"> 23 <div class="action">
24 - <span class="cencel"> 24 + <span class="cancel">
25 取消 25 取消
26 </span> 26 </span>
27 <span class="confim"> 27 <span class="confim">
@@ -16,8 +16,8 @@ @@ -16,8 +16,8 @@
16 <script src="http://static.buy.test.yoho.cn/dist/myohobuy/{{version}}/index-debug.js"></script> 16 <script src="http://static.buy.test.yoho.cn/dist/myohobuy/{{version}}/index-debug.js"></script>
17 {{/if}} 17 {{/if}}
18 {{#if devEnv}} 18 {{#if devEnv}}
19 -<script src="http://172.16.6.204:8000/static/js/sea.js?nowrap"></script>  
20 -<script>seajs.config({base: 'http://172.16.6.204:8000/'});</script> 19 +<script src="http://localhost:8000/static/js/sea.js?nowrap"></script>
  20 +<script>seajs.config({base: 'http://localhost:8000/'});</script>
21 {{/if}} 21 {{/if}}
22 <script type="text/javascript"> 22 <script type="text/javascript">
23 (function(w,d,s,j,f){ 23 (function(w,d,s,j,f){
@@ -266,7 +266,7 @@ class HomeController extends AbstractAction @@ -266,7 +266,7 @@ class HomeController extends AbstractAction
266 /** 266 /**
267 * 删除地址 267 * 删除地址
268 */ 268 */
269 - public function addressDelAction() 269 + public function delAddressAction()
270 { 270 {
271 $result = array(); 271 $result = array();
272 272