Browse Source

添加客户基本信息

dujinyan 7 years ago
parent
commit
4f754420ec

+ 76 - 0
watero-rst-web/src/main/webapp/WEB-INF/views/customer/update_customer_info.ftl

@@ -756,6 +756,22 @@
         }
     }
 
+    function getByteLen(val) {
+        var len = 0;
+        for (var i = 0; i < val.length; i++) {
+            var length = val.charCodeAt(i);
+            if(length>=0&&length<=128)
+            {
+                len += 1;
+            }
+            else
+            {
+                len += 2;
+            }
+        }
+        return len;
+    }
+
     /*保存对接联系人信息到列表*/
     function toAddDockedContactInfo() {
         var contactName = document.getElementById("contactName").value;
@@ -765,6 +781,9 @@
         if(contactName == "" || contactName == null ){
             layer.msg("联系人姓名不能为空");
             return;
+        }else if(getByteLen(contactName) > 10){
+            layer.msg("联系人姓名长度超限");
+            return;
         }
         if(contactPhone == "" || contactPhone == null ){
             layer.msg("电话不能为空");
@@ -780,6 +799,9 @@
         if(contactType == "" || contactType == null ){
             layer.msg("职位/身份不能为空");
             return;
+        }else if(getByteLen(contactType) > 10){
+            layer.msg("职位/身份长度超限");
+            return;
         }
         if(contactEmail == "" || contactEmail == null ){
             layer.msg("联系邮箱不能为空");
@@ -789,6 +811,9 @@
             if(!reg.test(contactEmail)){
                 layer.msg("请填写正确的邮箱!", {icon: 5, time: 3000});
                 return;
+            }else if(getByteLen(contactEmail) > 30){
+                layer.msg("邮箱长度超限");
+                return;
             }
         }
         //var operation = "删除";
@@ -856,6 +881,9 @@
         if(channelName == "" || channelName == null ){
             layer.msg("渠道平台/名称不能为空");
             return;
+        }else if(getByteLen(channelName) > 30){
+            layer.msg("渠道平台/名称长度超限");
+            return;
         }
         if(promotingProducts == "" || promotingProducts == null ){
             layer.msg("销售产品不能为空");
@@ -864,6 +892,9 @@
         if(supplyPrice == "" || supplyPrice == null ){
             layer.msg("供货价格不能为空");
             return;
+        }else if(getByteLen(supplyPrice) > 9){
+            layer.msg("供货价格长度超限");
+            return;
         }
         var promotingProductsHtml = '<input type="hidden" value="'+promotingProducts+'">';
 
@@ -912,6 +943,13 @@
         if(customerBasicInfo.customerName == "" || customerBasicInfo.customerName == null ){
             layer.msg("客户名称不能为空");
             return;
+        }else if(getByteLen(customerBasicInfo.customerName) > 20){
+            layer.msg("客户名称长度超限");
+            return;
+        }
+        if(getByteLen(customerBasicInfo.customerIndustry) > 20){
+            layer.msg("客户行业长度超限");
+            return;
         }
         if(customerBasicInfo.customerProvinceCode == "" || customerBasicInfo.customerProvinceCode == null ){
             layer.msg("客户省份不能为空");
@@ -921,6 +959,14 @@
             layer.msg("客户城市不能为空");
             return;
         }
+        if(getByteLen(customerBasicInfo.customerAddress) > 100){
+            layer.msg("客户详细地址长度超限");
+            return;
+        }
+        if(getByteLen(customerBasicInfo.customerRemarks) > 100){
+            layer.msg("备注信息长度超限");
+            return;
+        }
         //对接联系人信息
         var dockedContactInfoList =  new Array();
         $("#contactListId").find("tr").each(function (index,element){
@@ -1015,14 +1061,23 @@
         if(billingInfo.accountOpeningBranch == "" || billingInfo.accountOpeningBranch == null ){
             layer.msg("开户支行不能为空");
             return;
+        }else if(getByteLen(billingInfo.accountOpeningBranch) > 50){
+            layer.msg("开户支行长度超限");
+            return;
         }
         if(billingInfo.accountName == "" || billingInfo.accountName == null ){
             layer.msg("账号名称不能为空");
             return;
+        }else if(getByteLen(billingInfo.accountName) > 30){
+            layer.msg("账号名称长度超限");
+            return;
         }
         if(billingInfo.accountNum == "" || billingInfo.accountNum == null ){
             layer.msg("账号不能为空");
             return;
+        }else if(getByteLen(billingInfo.accountNum) > 20){
+            layer.msg("账号长度超限");
+            return;
         }
         /*if(billingInfo.receivablesName == "" || billingInfo.receivablesName == null ){
             layer.msg("收款人姓名不能为空");
@@ -1052,18 +1107,30 @@
             if(ticketOpeningInfo.accountOpeningBranch == "" || ticketOpeningInfo.accountOpeningBranch == null ){
                 layer.msg("开户支行不能为空");
                 return;
+            }else if(getByteLen(ticketOpeningInfo.accountOpeningBranch) > 50){
+                layer.msg("开户支行长度超限");
+                return;
             }
             if(ticketOpeningInfo.ticketOpeningAccount == "" || ticketOpeningInfo.ticketOpeningAccount == null ){
                 layer.msg("开票账户不能为空");
                 return;
+            }else if(getByteLen(ticketOpeningInfo.ticketOpeningAccount) > 30){
+                layer.msg("开票账户长度超限");
+                return;
             }
             if(ticketOpeningInfo.enterpriseName == "" || ticketOpeningInfo.enterpriseName == null ){
                 layer.msg("企业名称不能为空");
                 return;
+            }else if(getByteLen(ticketOpeningInfo.enterpriseName) > 30){
+                layer.msg("企业名称长度超限");
+                return;
             }
             if(ticketOpeningInfo.taxpayerIdentificationNum == "" || ticketOpeningInfo.taxpayerIdentificationNum == null ){
                 layer.msg("纳税人识别号不能为空");
                 return;
+            }else if(getByteLen(ticketOpeningInfo.taxpayerIdentificationNum) > 30){
+                layer.msg("纳税人识别号长度超限");
+                return;
             }
             if(ticketOpeningInfo.ticketOpeningPhone == "" || ticketOpeningInfo.ticketOpeningPhone == null ){
                 layer.msg("开票电话不能为空");
@@ -1077,15 +1144,24 @@
             }if(ticketOpeningInfo.enterpriseAddress == "" || ticketOpeningInfo.enterpriseAddress == null ){
                 layer.msg("企业地址不能为空");
                 return;
+            }else if(getByteLen(ticketOpeningInfo.enterpriseAddress) > 30){
+                layer.msg("企业地址长度超限");
+                return;
             }
         }else{
             if(ticketOpeningInfo.enterpriseName == "" || ticketOpeningInfo.enterpriseName == null ){
                 layer.msg("企业名称不能为空");
                 return;
+            }else if(getByteLen(ticketOpeningInfo.enterpriseName) > 30){
+                layer.msg("企业名称长度超限");
+                return;
             }
             if(ticketOpeningInfo.taxpayerIdentificationNum == "" || ticketOpeningInfo.taxpayerIdentificationNum == null ){
                 layer.msg("纳税人识别号不能为空");
                 return;
+            }else if(getByteLen(ticketOpeningInfo.taxpayerIdentificationNum) > 30){
+                layer.msg("纳税人识别号长度超限");
+                return;
             }
         }
         //发送保存请求