yangc преди 8 години
родител
ревизия
50b201ad41

+ 12 - 1
src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_invoice_ctrl.js

@@ -103,7 +103,8 @@ define(['app/app'], function(app) {
             $scope.validForm = {
                 validBillHead: true,
                 validBillName: true,
-                validBankName: true
+                validBankName: true,
+                validDetailAddress: true
             }
 
             $scope.checkValidFrom = function () {
@@ -145,6 +146,16 @@ define(['app/app'], function(app) {
                 $scope.validForm.validBankName = true;
             }
         }
+
+        //详细地址Check
+        $scope.checkDetailAddress = function () {
+            var len = getRealStringLen($scope.bill.detailAddress);
+            if (len > 60) {
+                $scope.validForm.validDetailAddress = false;
+            } else {
+                $scope.validForm.valiDetailAddress = true;
+            }
+        }
             
         //设置新增栏目切换发票类型
         $scope.billType = 1206

+ 4 - 4
src/main/webapp/resources/view/usercenter/forstore/buyer_invoice.html

@@ -502,7 +502,7 @@
                     <div class="form-group"  ng-if="billType == 1205">
                         <label class="col-md-2 control-label"><b class="text-inverse">*</b>单位电话:</label>
                         <div class="col-md-5">
-                            <input type="text" class="form-control" ng-focus="form.companyPhone.$touched = false" ng-blur="form.companyPhone.$touched = true" placeholder="区号和号码使用 '-' 隔开,或者不填区号" name="companyPhone" ng-model="bill.companyPhone" ng-maxlength="20" required="required">
+                            <input type="text" class="form-control" ng-focus="form.companyPhone.$touched = false" ng-blur="form.companyPhone.$touched = true" placeholder="区号和号码使用 '-' 隔开,或者不填区号" name="companyPhone" ng-model="bill.companyPhone" ng-maxlength="20" ng-pattern="/^0\d{2,3}-[1-9]\d{6,7}$/" required="required">
                         </div>
                         <div class="text-inverse error col-md-3" ng-show="form.companyPhone.$touched&&form.companyPhone.$invalid" ng-bind="form.companyPhone.$error.required?'请填写单位电话':'请勿超过20个字符'"></div>
                     </div>
@@ -583,10 +583,10 @@
                     <div class="form-group">
                         <label class="col-md-2 control-label"><b class="text-inverse">*</b>详细地址:</label>
                         <div class="col-md-5">
-                            <input id="mzaddress" type="text" class="form-control" required="required" name="billDetail" ng-model="bill.detailAddress" ng-maxlength="60" title="建议您填写详细发件地址,如街道名,门牌号,楼层和房间号等信息"
-                            placeholder="建议您填写详细发件地址,如街道名,门牌号,楼层和房间号等信息" ng-focus="form.billDetail.$touched = false" ng-blur="form.billDetail.$touched = true" >
+                            <input id="mzaddress" type="text" class="form-control" required="required" name="billDetail" ng-model="bill.detailAddress" title="建议您填写详细发件地址,如街道名,门牌号,楼层和房间号等信息"
+                            placeholder="建议您填写详细发件地址,如街道名,门牌号,楼层和房间号等信息" ng-focus="form.billDetail.$touched = false" ng-blur="form.billDetail.$touched = true; checkDetailAddress()" >
                         </div>
-                        <div class="text-inverse error col-md-3" ng-show="form.billDetail.$touched&&form.billDetail.$invalid" ng-bind="form.billDetail.$error.required?'请填写详细地址':'请勿超过30个字'"></div>
+                        <div class="text-inverse error col-md-3" ng-show="form.billDetail.$touched&&(form.billDetail.$invalid|| !validForm.validDetailAddress)" ng-bind="form.billDetail.$error.required?'请填写详细地址':'请勿超过30个字'"></div>
                     </div>
                     <div class="form-bottom">
                         <div class="form-group">