You cannot select more than 25 topics 
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long. 
		
		
		
		
		
			
	
	
		
			
	
		
			This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
		 
	
		
		
			
				
				
					
						
						
						
							var  util  =  require ( '../../../utils/util.js' ) ; 
 
						
						
						
							var  api  =  require ( '../../../config/api.js' ) ; 
 
						
						
						
							var  app  =  getApp ( ) ; 
 
						
						
						
							
 
						
						
						
							Page ( { 
 
						
						
						
							  data :  { 
 
						
						
						
							    addressList :  [ ] , 
 
						
						
						
							    total :  0 
 
						
						
						
							  } , 
 
						
						
						
							  onLoad :  function ( options )  { 
 
						
						
						
							    // 页面初始化 options为页面跳转所带来的参数
  
						
						
						
							} , 
 
						
						
						
							  onReady :  function ( )  { 
 
						
						
						
							    // 页面渲染完成
  
						
						
						
							} , 
 
						
						
						
							  onShow :  function ( )  { 
 
						
						
						
							    // 页面显示
  
						
						
						
							this . getAddressList ( ) ; 
 
						
						
						
							  } , 
 
						
						
						
							  getAddressList ( )  { 
 
						
						
						
							    let  that  =  this ; 
 
						
						
						
							    util . request ( api . AddressList ) . then ( function ( res )  { 
 
						
						
						
							      if  ( res . errno  ===  0 )  { 
 
						
						
						
							        that . setData ( { 
 
						
						
						
							          addressList :  res . data . list , 
 
						
						
						
							          total :  res . data . total 
 
						
						
						
							        } ) ; 
 
						
						
						
							      } 
 
						
						
						
							    } ) ; 
 
						
						
						
							  } , 
 
						
						
						
							  addressAddOrUpdate ( event )  { 
 
						
						
						
							    console . log ( event ) 
 
						
						
						
							
 
						
						
						
							    //返回之前, ,   
						
						
						
							var  pages  =  getCurrentPages ( ) ; 
 
						
						
						
							    var  prevPage  =  pages [ pages . length  -  2 ] ; 
 
						
						
						
							
 
						
						
						
							    if  ( prevPage . route  ==  "pages/checkout/checkout" )  { 
 
						
						
						
							      try  { 
 
						
						
						
							        wx . setStorageSync ( 'addressId' ,  event . currentTarget . dataset . addressId ) ; 
 
						
						
						
							      }  catch  ( e )  { 
 
						
						
						
							
 
						
						
						
							      } 
 
						
						
						
							
 
						
						
						
							      let  addressId  =  event . currentTarget . dataset . addressId ; 
 
						
						
						
							      if  ( addressId  &&  addressId  !=  0 )  { 
 
						
						
						
							        wx . navigateBack ( ) ; 
 
						
						
						
							      }  else  { 
 
						
						
						
							        wx . navigateTo ( { 
 
						
						
						
							          url :  '/pages/ucenter/addressAdd/addressAdd?id='  +  addressId 
 
						
						
						
							        } ) 
 
						
						
						
							      } 
 
						
						
						
							
 
						
						
						
							    }  else  { 
 
						
						
						
							      wx . navigateTo ( { 
 
						
						
						
							        url :  '/pages/ucenter/addressAdd/addressAdd?id='  +  event . currentTarget . dataset . addressId 
 
						
						
						
							      } ) 
 
						
						
						
							    } 
 
						
						
						
							  } , 
 
						
						
						
							  deleteAddress ( event )  { 
 
						
						
						
							    console . log ( event . target ) 
 
						
						
						
							    let  that  =  this ; 
 
						
						
						
							    wx . showModal ( { 
 
						
						
						
							      title :  '' , 
 
						
						
						
							      content :  '确定要删除地址?' , 
 
						
						
						
							      success :  function ( res )  { 
 
						
						
						
							        if  ( res . confirm )  { 
 
						
						
						
							          let  addressId  =  event . target . dataset . addressId ; 
 
						
						
						
							          util . request ( api . AddressDelete ,  { 
 
						
						
						
							            id :  addressId 
 
						
						
						
							          } ,  'POST' ) . then ( function ( res )  { 
 
						
						
						
							            if  ( res . errno  ===  0 )  { 
 
						
						
						
							              that . getAddressList ( ) ; 
 
						
						
						
							              wx . removeStorage ( { 
 
						
						
						
							                key :  'addressId' , 
 
						
						
						
							                success :  function ( res )  { } , 
 
						
						
						
							              } ) 
 
						
						
						
							            } 
 
						
						
						
							          } ) ; 
 
						
						
						
							          console . log ( '用户点击确定' ) 
 
						
						
						
							        } 
 
						
						
						
							      } 
 
						
						
						
							    } ) 
 
						
						
						
							    return  false ; 
 
						
						
						
							
 
						
						
						
							  } , 
 
						
						
						
							  onHide :  function ( )  { 
 
						
						
						
							    // 页面隐藏
  
						
						
						
							} , 
 
						
						
						
							  onUnload :  function ( )  { 
 
						
						
						
							    // 页面关闭
  
						
						
						
							} 
 
						
						
						
							} )