2.1 地址选择 (1)在 orderInfoController.js 增加代码 [AppleScript] 纯文本查看 复制代码 //选择地址
$scope.selectAddress=function(address){
$scope.address=address;
}
//判断是否是当前选中的地址
$scope.isSelectedAddress=function(address){
if(address==$scope.address){ return true;
}else{
return false;
}
} (2)修改页面-点击选择 [AppleScript] 纯文本查看 复制代码 < div ng-repeat="address in addressList" >
<div class="con name {{isSelectedAddress(address)?'selected':''}}" ><a
href="javascript:;" ng-click="selectAddress(address)">{{address.contact}}<span title="点击取消选择"> </a></div>
<div class="con address" >{{address.address}}<span>{{address.mobile}}</span>
<span class="base" ng-if="address.isDefault=='1'">默认地址</span>
<span class="edittext"><a data-toggle="modal" data-target=".edit"
data-keyboard="false" >编辑</a> <a href="javascript:;">删除</a></span>
</div>
<div class="clearfix"></div>
</div> (3)修改页面,显示选择的地址 [AppleScript] 纯文本查看 复制代码 < div class="fc-receiverInfo"> 寄送至:{{address.address}} 收货人: {{address.contact}}
{{address.mobile}}</div> 2.1 默认地址显示 修改 orderInfoController.js [AppleScript] 纯文本查看 复制代码 //查询当前登录人的地址列表
$scope.findAddressList=function(){ addressService.findListByLoginUser().success(
function(response){
$scope.addressList=response;
//设置默认地址
for(var i=0;i< $scope.addressList.length;i++){
if($scope.addressList[i].isDefault=='1'){
$scope.address=$scope.addressList[i];
break;
}
}
}
);
} 2.1 收件人地址增加、修改与删除 学员实现 |