Authored by xuqi

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

@@ -13,10 +13,8 @@ var $nav = $('.category-nav'), @@ -13,10 +13,8 @@ var $nav = $('.category-nav'),
13 $subLevelItem = $categoryContainer.find('.sub-level li'), 13 $subLevelItem = $categoryContainer.find('.sub-level li'),
14 $primaryItem = $categoryContainer.find('.primary-level li'); 14 $primaryItem = $categoryContainer.find('.primary-level li');
15 15
16 -var $curContent = $contents.not('.hide');  
17 -  
18 -  
19 -var navHammer; 16 +var $curContent = $contents.not('.hide'),
  17 + navHammer;
20 18
21 //初始化container高度 19 //初始化container高度
22 (function() { 20 (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,32 @@ function editAddress(data) { @@ -32,9 +34,32 @@ 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: {
  45 + id: deleteId
  46 + }
  47 + }).then(function(res) {
  48 + if ($.type(res) !== 'object') {
  49 + res = {};
  50 + }
  51 + if (res.code !== 200) {
  52 + tip.show(res.message || '网络出了点问题~');
  53 + } else {
  54 + window.location.reload();
  55 + }
  56 + }).fail(function() {
  57 + tip.show('网络出了点问题~');
  58 + }).always(function() {
  59 + deleteId = null;
  60 + $confim.hide();
  61 + });
  62 +});
38 63
39 // 添加地址 64 // 添加地址
40 $addAddress.on('touchend', function() { 65 $addAddress.on('touchend', function() {
@@ -45,7 +70,8 @@ $addAddress.on('touchend', function() { @@ -45,7 +70,8 @@ $addAddress.on('touchend', function() {
45 $action.on('touchend', '.edit', function() { 70 $action.on('touchend', '.edit', function() {
46 editAddress($(this).data()); 71 editAddress($(this).data());
47 }).on('touchend', '.del', function() { 72 }).on('touchend', '.del', function() {
48 - deleteAddress(); 73 + deleteId = $(this).data('id');
  74 + $confim.show();
49 }); 75 });
50 76
51 $submit.on('touchend', function() { 77 $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