Prechádzať zdrojové kódy

添加客户基本信息

dujinyan 7 rokov pred
rodič
commit
86fd93d55b

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

@@ -60,7 +60,7 @@
 <div class="pd-20 cl">
     <form action="${path}/admin/customerBasic/saveCustomerInfo" method="post">
     <#--<form action="${path}/admin/customerBasic/save_customer_info" method="post" class="form form-horizontal" id="form-customerInfoAdmin-add"  onkeydown="if(event.keyCode==13)return false;">-->
-        <input type="hidden" id="isNeedSelectOrder" name="isNeedSelectOrder" value="">
+        <input type="hidden" id="saveCustomerInfo" name="saveCustomerInfo" value="">
         <#--客户基本信息 start-->
         <div class="row cl">
             <label class="form-label col-2">
@@ -141,6 +141,7 @@
                 <span class="c-red"><button type="button" style="cursor:pointer; float: right;height: 35px;margin-right: 30px;margin-bottom: 10px;" class="my-btn-search" onclick="toAddDockedContactInfo();">保存</button></span>
             </div>
             <div class="mt-20" style="margin: 20px;">
+                <input type="hidden" id="dockedContactInfoJson" name="dockedContactInfoJson">
                 <table class="table table-border table-bordered table-bg table-hover table-sort" id="contactTable">
                     <thead>
                     <tr class="text-c">
@@ -151,7 +152,7 @@
                         <th width="100">操作</th>
                     </tr>
                     </thead>
-                    <tbody id="listid">
+                    <tbody id="contactListId">
                         <tr><td colspan="5" class="td-manage text-c" >暂时没有联系人信息,请添加!</td></tr>
                     </tbody>
                 </table>
@@ -211,6 +212,7 @@
             </div>
             <button type="button" style="cursor:pointer; float: right;height: 35px;margin-right: 30px;margin-bottom: 10px;" class="my-btn-search" onclick="toAddChannelSaleInfo();">保存</button>
             <div class="mt-20" style="margin: 20px;">
+                <input type="hidden" id="channelSaleInfoJson" name="channelSaleInfoJson">
                 <table class="table table-border table-bordered table-bg table-hover table-sort" id="saleTable">
                     <thead>
                     <tr class="text-c">
@@ -223,8 +225,8 @@
                         <th width="100">操作</th>
                     </tr>
                     </thead>
-                    <tbody id="listid">
-                    <tr><td colspan="7" class="td-manage text-c" >暂时没有联系人信息,请添加!</td></tr>
+                    <tbody id="channelSaleListId">
+                    <tr><td colspan="7" class="td-manage text-c" >暂时没有客户销售渠道信息,请添加!</td></tr>
                     </tbody>
                 </table>
             </div>
@@ -265,7 +267,7 @@
         <#--开票信息-->
         <div class="row cl" style="margin-bottom: 10px;">
             <label class="form-label col-3">
-                <div class="tit-2">开票信息</div>
+                <div class="tit-2">开票信息<span> *是否开票<input type="radio" value="1" checked="checked">开票</input><input type="radio" value="2">不开票</input></span></div>
             </label>
             <div class="formControls col-9">
             </div>
@@ -329,10 +331,9 @@
         </div>
         <#--添加保存按钮-->
         <!-- Unnamed (矩形) -->
-        <div id="u29" class="ax_default _三级标题">
-            <div id="u29_div" class=""></div>
-            <!-- Unnamed () -->
-            <div id="u30" class="text" style="visibility: visible;">
+        <div  class="class="row cl"">
+            <!-- Unnamed ()  style="visibility: visible;"-->
+            <div id="u30" class="my-btn-search" style="cursor:pointer; float: center;height: 35px;margin-right: 30px;margin-bottom: 10px;">
                 <p><span onclick="addCustomerBasicInfo()">添加客户信息</span></p>
             </div>
         </div>
@@ -573,6 +574,7 @@
 
     /*保存对接联系人信息到列表*/
     function toAddDockedContactInfo() {
+        //var dockedContactInfoList =  new Array();
         var contactName = document.getElementById("contactName").value;
         var contactPhone = document.getElementById("contactPhone").value;
         var contactType = document.getElementById("contactType").value;
@@ -597,6 +599,7 @@
     }
     /*保存客户销售信息到列表*/
     function toAddChannelSaleInfo() {
+        //var channelSaleInfoList =  new Array();
         var channelCategory = document.getElementById("channelCategory").value;
         var channelType = document.getElementById("channelType").value;
         var channelName = document.getElementById("channelName").value;
@@ -626,7 +629,99 @@
     }
     /*添加客户信息*/
     function addCustomerBasicInfo() {
-        alert("addCustomerBasicInfo...");
+        var customerBasicInfoSaveForm = {};
+        //客户基本信息
+        var customerBasicInfo = {};
+        customerBasicInfo.customerType = $("[name='customerType']").val();
+        customerBasicInfo.cooperativeState = $("[name='cooperativeState']").val();
+        customerBasicInfo.customerName = $("[name='customerName']").val();
+        customerBasicInfo.customerIndustry = $("[name='customerIndustry']").val();
+        customerBasicInfo.customerProvinceCode = $("[name='customerProvinceCode']").val();
+        customerBasicInfo.customerCityCode = $("[name='customerCityCode']").val();
+        customerBasicInfo.customerAddress = $("[name='customerAddress']").val();
+        customerBasicInfo.customerRemarks = $("[name='customerRemarks']").val();
+        //对接联系人信息
+        var dockedContactInfoList =  new Array();
+        $("#contactListId").find("tr").each(function (){
+            var dockedContactInfo = {};
+            dockedContactInfo.contactName = $("[name='contactName']").val();
+            dockedContactInfo.contactPhone = $("[name='contactPhone']").val();
+            dockedContactInfo.contactType = $("[name='contactType']").val();
+            dockedContactInfo.contactEmail = $("[name='contactEmail']").val();
+            dockedContactInfoList.push(dockedContactInfo);
+        })
+        var dockedContactInfoListJson = $("#dockedContactInfoJson").val(JSON.stringify(dockedContactInfoList));
+        //客户销售渠道信息
+        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);
+        })
+        var channelSaleInfoListJson = $("#channelSaleInfoJson").val(JSON.stringify(channelSaleInfoList));
+        //alert("dockedContactInfoList:"+dockedContactInfoList.length);
+        //alert("channelSaleInfoList:"+channelSaleInfoList.length);
+        //付款/退款信息
+        var billingInfo = {};
+        billingInfo.accountOpeningBranch = $("[name='accountOpeningBranch']").val();
+        billingInfo.accountName = $("[name='accountName']").val();
+        billingInfo.accountNum = $("[name='accountNum']").val();
+        billingInfo.receivablesName = $("[name='receivablesName']").val();
+        billingInfo.receivablesPhone = $("[name='receivablesPhone']").val();
+        //开票信息
+        var ticketOpeningInfo = {};
+        ticketOpeningInfo.ticketType = $("[name='ticketType']").val();
+        ticketOpeningInfo.accountOpeningBranch = $("[name='accountOpeningBranch']").val();
+        ticketOpeningInfo.ticketOpeningAccount = $("[name='ticketOpeningAccount']").val();
+        ticketOpeningInfo.enterpriseName = $("[name='enterpriseName']").val();
+        ticketOpeningInfo.taxpayerIdentificationNum = $("[name='taxpayerIdentificationNum']").val();
+        ticketOpeningInfo.ticketOpeningPhone = $("[name='ticketOpeningPhone']").val();
+        ticketOpeningInfo.enterpriseAddress = $("[name='enterpriseAddress']").val();
+        //发送保存请求
+        alert("request ...Start...");
+        customerBasicInfoSaveForm.customerBasicInfo = customerBasicInfo;
+        customerBasicInfoSaveForm.dockedContactInfoList = dockedContactInfoList;
+        customerBasicInfoSaveForm.channelSaleInfoList = channelSaleInfoList;
+        customerBasicInfoSaveForm.billingInfo = billingInfo;
+        customerBasicInfoSaveForm.ticketOpeningInfo = ticketOpeningInfo;
+        var saveStates = "";
+        console.log(customerBasicInfoSaveForm);
+
+        var customerInfoJson = JSON.stringify(customerBasicInfo);
+        var billingInfoJson = JSON.stringify(billingInfo);
+        var ticketOpeningInfoJson = JSON.stringify(ticketOpeningInfo);
+
+        //$.post("${path}/admin/customerBasic/save_customer_info",customerBasicInfoSaveForm, function(res){});
+        $.ajax({
+            type: "POST",
+            data: {
+                customerInfoJson:customerInfoJson,
+                /*dockedContactInfoListJson:dockedContactInfoListJson,
+                channelSaleInfoListJson:dockedContactInfoListJson,*/
+                billingInfoJson : billingInfoJson,
+                ticketOpeningInfoJson:ticketOpeningInfoJson
+            },
+            url: "${path}/admin/customerBasic/save_customer_info",
+            async: true,
+            success: function(data){
+                if (data.returnCode == 200) {
+                    saveStates = "保存成功";
+                    alert(saveStates);
+                }else{
+                    saveStates = "保存失败";
+                    alert(saveStates);
+                }
+            },
+            error: function(XmlHttpRequest, textStatus, errorThrown){
+                saveStates = "保存失败";
+                alert(saveStates);
+            }
+        });
     }
 
     // 删除对接联系人函数