소스 검색

修改买家中心中显示新增地址的问题

hulh 8 년 전
부모
커밋
5f6cee4d05
1개의 변경된 파일12개의 추가작업 그리고 4개의 파일을 삭제
  1. 12 4
      src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_home_ctrl.js

+ 12 - 4
src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_home_ctrl.js

@@ -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;