|
|
@@ -96,6 +96,13 @@ define(['app/app', 'calendar'], function(app) {
|
|
|
},
|
|
|
addr : function(){
|
|
|
return angular.copy(addr);
|
|
|
+ },
|
|
|
+ isModify : function () {
|
|
|
+ if (addr){
|
|
|
+ return true;
|
|
|
+ }else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}).result.then(function(address){
|
|
|
@@ -194,12 +201,13 @@ define(['app/app', 'calendar'], function(app) {
|
|
|
}]);
|
|
|
|
|
|
//地址编辑模态框
|
|
|
- app.register.controller('editAddrHomeCtrl', ['$scope', 'isSetTop', 'addr', '$modalInstance', 'toaster', '$http', 'ShippingAddress', function($scope, isSetTop, addr, $modalInstance, toaster, $http, ShippingAddress){
|
|
|
+ app.register.controller('editAddrHomeCtrl', ['$scope', 'isSetTop', 'isModify', 'addr', '$modalInstance', 'toaster', '$http', 'ShippingAddress', function($scope, isSetTop, isModify, addr, $modalInstance, toaster, $http, ShippingAddress){
|
|
|
if (addr){
|
|
|
$scope.isSetTop = addr.num == 1;
|
|
|
}else {
|
|
|
$scope.isSetTop = isSetTop;
|
|
|
}
|
|
|
+ $scope.isModify = isModify;
|
|
|
//验证数据
|
|
|
$scope.checkeds = {};
|
|
|
|
|
|
@@ -207,7 +215,7 @@ define(['app/app', 'calendar'], function(app) {
|
|
|
var size;
|
|
|
if(num == 1) {
|
|
|
if ($scope.address.name){
|
|
|
- size = $scope.address.name.replace(/[^x00-xFF]/g,'**').length;
|
|
|
+ size = $scope.address.name.replace(/[^\x00-\xff]/g,'**').length;
|
|
|
if (size > 20) {
|
|
|
console.log(size);
|
|
|
$scope.userError = true;
|
|
|
@@ -217,7 +225,7 @@ define(['app/app', 'calendar'], function(app) {
|
|
|
}
|
|
|
} else if(num == 2) {
|
|
|
if ($scope.address.tel){
|
|
|
- size = $scope.address.tel.replace(/[^x00-xFF]/g,'**').length;
|
|
|
+ size = $scope.address.tel.replace(/[^\x00-\xff]/g,'**').length;
|
|
|
if (size < 8 || size > 11) {
|
|
|
$scope.telError = true;
|
|
|
return;
|
|
|
@@ -232,7 +240,7 @@ define(['app/app', 'calendar'], function(app) {
|
|
|
}
|
|
|
} else if(num == 3) {
|
|
|
if ($scope.address.detailAddress){
|
|
|
- size = $scope.address.detailAddress.replace(/[^x00-xFF]/g,'**').length;
|
|
|
+ size = $scope.address.detailAddress.replace(/[^\x00-\xff]/g,'**').length;
|
|
|
if (size > 60) {
|
|
|
$scope.addrError = true;
|
|
|
return;
|