소스 검색

添加客户基本信息

dujinyan 7 년 전
부모
커밋
77bbd153ab
1개의 변경된 파일35개의 추가작업 그리고 17개의 파일을 삭제
  1. 35 17
      watero-rst-web/src/main/webapp/WEB-INF/views/customer/save_customer_info.ftl

+ 35 - 17
watero-rst-web/src/main/webapp/WEB-INF/views/customer/save_customer_info.ftl

@@ -575,6 +575,7 @@
     /*保存对接联系人信息到列表*/
     function toAddDockedContactInfo() {
         //var dockedContactInfoList =  new Array();
+        document.getElementById("contactListId").innerHTML = "";
         var contactName = document.getElementById("contactName").value;
         var contactPhone = document.getElementById("contactPhone").value;
         var contactType = document.getElementById("contactType").value;
@@ -600,14 +601,15 @@
     /*保存客户销售信息到列表*/
     function toAddChannelSaleInfo() {
         //var channelSaleInfoList =  new Array();
+        document.getElementById("channelSaleListId").innerHTML = "";
         var channelCategory = document.getElementById("channelCategory").value;
         var channelType = document.getElementById("channelType").value;
         var channelName = document.getElementById("channelName").value;
         var promotingProducts = document.getElementById("promotingProducts").value;
         var supplyPrice = document.getElementById("supplyPrice").value;
         var accountPeriod = document.getElementById("accountPeriod").value;
-        var operation = "删除";
-        //var operation = var operation = "<a href='javascript:;' onclick='deleteChannelSale(this)'>删除</a>";
+        //var operation = "删除";
+        var operation = "<a href='javascript:;' onclick='deleteChannelSale(this)'>删除</a>";
         row = document.getElementById("saleTable").insertRow();
         if(row!=null){
             cell=row.insertCell();
@@ -629,7 +631,7 @@
     }
     /*添加客户信息*/
     function addCustomerBasicInfo() {
-        var customerBasicInfoSaveForm = {};
+        //var customerBasicInfoSaveForm = {};
         //客户基本信息
         var customerBasicInfo = {};
         customerBasicInfo.customerType = $("[name='customerType']").val();
@@ -650,7 +652,7 @@
             dockedContactInfo.contactEmail = $("[name='contactEmail']").val();
             dockedContactInfoList.push(dockedContactInfo);
         })
-        var dockedContactInfoListJson = $("#dockedContactInfoJson").val(JSON.stringify(dockedContactInfoList));
+        //var dockedContactInfoListJson = $("#dockedContactInfoJson").val(JSON.stringify(dockedContactInfoList));
         //客户销售渠道信息
         var channelSaleInfoList =  new Array();
         $("#channelSaleListId").find("tr").each(function (){
@@ -663,9 +665,7 @@
             channelSaleInfo.accountPeriod = $("[name='accountPeriod']").val();
             channelSaleInfoList.push(channelSaleInfo);
         })
-        var channelSaleInfoListJson = $("#channelSaleInfoJson").val(JSON.stringify(channelSaleInfoList));
-        //alert("dockedContactInfoList:"+dockedContactInfoList.length);
-        //alert("channelSaleInfoList:"+channelSaleInfoList.length);
+        //var channelSaleInfoListJson = $("#channelSaleInfoJson").val(JSON.stringify(channelSaleInfoList));
         //付款/退款信息
         var billingInfo = {};
         billingInfo.accountOpeningBranch = $("[name='accountOpeningBranch']").val();
@@ -683,28 +683,27 @@
         ticketOpeningInfo.ticketOpeningPhone = $("[name='ticketOpeningPhone']").val();
         ticketOpeningInfo.enterpriseAddress = $("[name='enterpriseAddress']").val();
         //发送保存请求
-        alert("request ...Start...");
+        /*alert("request ...Start...");
         customerBasicInfoSaveForm.customerBasicInfo = customerBasicInfo;
         customerBasicInfoSaveForm.dockedContactInfoList = dockedContactInfoList;
         customerBasicInfoSaveForm.channelSaleInfoList = channelSaleInfoList;
         customerBasicInfoSaveForm.billingInfo = billingInfo;
-        customerBasicInfoSaveForm.ticketOpeningInfo = ticketOpeningInfo;
-        var saveStates = "";
-        console.log(customerBasicInfoSaveForm);
+        customerBasicInfoSaveForm.ticketOpeningInfo = ticketOpeningInfo;*/
 
+        var saveStates = "";
         var customerInfoJson = JSON.stringify(customerBasicInfo);
         var billingInfoJson = JSON.stringify(billingInfo);
         var ticketOpeningInfoJson = JSON.stringify(ticketOpeningInfo);
+        var dockedContactInfoListJson = JSON.stringify(dockedContactInfoList);
+        var channelSaleInfoListJson = JSON.stringify(channelSaleInfoList);
 
         //$.post("${path}/admin/customerBasic/save_customer_info",customerBasicInfoSaveForm, function(res){});
         $.ajax({
             type: "POST",
             data: {
                 customerInfoJson:customerInfoJson,
-                /*dockedContactInfoListJson:dockedContactInfoListJson,
-                channelSaleInfoListJson:dockedContactInfoListJson,*/
-                dockedContactInfoList:dockedContactInfoList,
-                channelSaleInfoList:channelSaleInfoList,
+                dockedContactInfoListJson:dockedContactInfoListJson,
+                channelSaleInfoListJson:channelSaleInfoListJson,
                 billingInfoJson : billingInfoJson,
                 ticketOpeningInfoJson:ticketOpeningInfoJson
             },
@@ -730,11 +729,30 @@
     function deleteContact(x){
         $(x).parent().parent().remove();
         // tr.parentNode.removeChild(tr);
+        if(document.getElementById("contactListId").innerHTML = ""){
+            document.getElementById("contactListId").innerHTML = "<tr><td colspan=\"5\" class=\"td-manage text-c\" >暂时没有联系人信息,请添加!</td></tr>";
+        }
+
     }
     // 删除客户销售渠道信息函数
     function deleteChannelSale(x){
-        var tr = x.parentNode.parentNode;
-        tr.parentNode.removeChild(tr);
+        $(x).parent().parent().remove();
+        /*var tr = x.parentNode.parentNode;
+        tr.parentNode.removeChild(tr);*/
+        var channelSaleInfoList =  new Array();
+        $("#channelSaleListId").find("tr").each(function (){
+            var channelSaleInfo = {};
+            channelSaleInfo.channelCategory = $("[name='channelCategory']").val();
+            channelSaleInfo.channelType = $("[name='channelType']").val();
+            channelSaleInfo.channelName = $("[name='channelName']").val();
+            channelSaleInfo.promotingProducts = $("[name='promotingProducts']").val();
+            channelSaleInfo.supplyPrice = $("[name='supplyPrice']").val();
+            channelSaleInfo.accountPeriod = $("[name='accountPeriod']").val();
+            channelSaleInfoList.push(channelSaleInfo);
+        })
+        if(channelSaleInfoList.length<1){
+            document.getElementById("contactListId").innerHTML = "<tr><td colspan=\"7\" class=\"td-manage text-c\" >暂时没有客户销售渠道信息,请添加!</td></tr>";
+        }
     }
     /*业务逻辑js控制 end*/
 </script>