Browse Source

修改客户信息

liujiankang 7 years ago
parent
commit
68b94ff833

+ 4 - 3
watero-rst-service/src/main/java/com/iamberry/rst/service/customer/CustomerBasicServiceImpl.java

@@ -141,7 +141,7 @@ public class CustomerBasicServiceImpl implements CustomerBasicService{
     public void updateCustomerBasicInfo(CustomerBasicInfo customerBasicInfo,List<DockedContactInfo> dockedContactInfoList, List<ChannelSaleInfo> channelSaleInfoList,
     public void updateCustomerBasicInfo(CustomerBasicInfo customerBasicInfo,List<DockedContactInfo> dockedContactInfoList, List<ChannelSaleInfo> channelSaleInfoList,
                                       BillingInfo billingInfo, TicketOpeningInfo ticketOpeningInfo) throws Exception{
                                       BillingInfo billingInfo, TicketOpeningInfo ticketOpeningInfo) throws Exception{
         int customerId = -1;
         int customerId = -1;
-        int channelDivisionId = -1;
+        Integer channelDivisionId = -1;
         try {
         try {
             customerBasicMapper.updateCustomerBasic(customerBasicInfo);
             customerBasicMapper.updateCustomerBasic(customerBasicInfo);
             customerId = customerBasicInfo.getCustomerId();
             customerId = customerBasicInfo.getCustomerId();
@@ -153,6 +153,7 @@ public class CustomerBasicServiceImpl implements CustomerBasicService{
                 for(ChannelSaleInfo channelSaleInfo : listChannelSale){
                 for(ChannelSaleInfo channelSaleInfo : listChannelSale){
                     customerBasicMapper.deleteDivisionInfo(channelSaleInfo.getChannelDivisionId());
                     customerBasicMapper.deleteDivisionInfo(channelSaleInfo.getChannelDivisionId());
                 }
                 }
+                customerBasicMapper.deleteSaleInfo(customerId);
             }
             }
 
 
             if(customerId != -1){
             if(customerId != -1){
@@ -168,12 +169,12 @@ public class CustomerBasicServiceImpl implements CustomerBasicService{
                     for (ChannelSaleInfo channelSaleInfo: channelSaleInfoList) {
                     for (ChannelSaleInfo channelSaleInfo: channelSaleInfoList) {
                         channelSaleInfo.setCustomerId(customerId);
                         channelSaleInfo.setCustomerId(customerId);
                         channelDivisionId = customerBasicMapper.queryIsExsitChannelNameChannelName(channelSaleInfo.getChannelName());
                         channelDivisionId = customerBasicMapper.queryIsExsitChannelNameChannelName(channelSaleInfo.getChannelName());
-                        if(channelDivisionId >= 0){
+                        if(channelDivisionId > 0){
                             channelSaleInfo.setChannelDivisionId(channelDivisionId);
                             channelSaleInfo.setChannelDivisionId(channelDivisionId);
                             customerBasicMapper.saveChannelSaleInfo(channelSaleInfo);
                             customerBasicMapper.saveChannelSaleInfo(channelSaleInfo);
                         }else{
                         }else{
-                            customerBasicMapper.saveChannelSaleInfo(channelSaleInfo);
                             customerBasicMapper.saveChannelDivisionInfo(channelSaleInfo);
                             customerBasicMapper.saveChannelDivisionInfo(channelSaleInfo);
+                            customerBasicMapper.saveChannelSaleInfo(channelSaleInfo);
                         }
                         }
                     }
                     }
                 }
                 }

+ 20 - 3
watero-rst-service/src/main/java/com/iamberry/rst/service/customer/mapper/CustomerBasicMapper.xml

@@ -62,6 +62,7 @@
           AND bi.customer_status = #{isSelectAll}
           AND bi.customer_status = #{isSelectAll}
         </if>-->
         </if>-->
       </where>
       </where>
+        GROUP BY bi.customer_id
   </select>
   </select>
 
 
 
 
@@ -184,7 +185,7 @@
         <result property="channelCode" column="channel_code" />
         <result property="channelCode" column="channel_code" />
         <result property="receivablesPhone" column="receivables_phone" />
         <result property="receivablesPhone" column="receivables_phone" />
         <result property="createDate" column="create_date" />
         <result property="createDate" column="create_date" />
-        <collection property="listChannelSaleInfo" column="channel_division_id" ofType="ChannelDivisionInfo" select="listChannelSaleInfo"/>
+        <collection property="listChannelSaleInfo" column="channel_division_id" ofType="ChannelDivisionInfo" select="listSaleInfoByChannelDivisionId"/>
     </resultMap>
     </resultMap>
     <select id="listChannelDivisionInfo" resultMap="listChannelDivisionMap" parameterType="ChannelDivisionInfo">
     <select id="listChannelDivisionInfo" resultMap="listChannelDivisionMap" parameterType="ChannelDivisionInfo">
         SELECT
         SELECT
@@ -198,6 +199,20 @@
         WHERE
         WHERE
         customer_id = #{customerId}
         customer_id = #{customerId}
     </select>
     </select>
+    <select id="listSaleInfoByChannelDivisionId" resultType="ChannelSaleInfo" parameterType="java.lang.Integer">
+        SELECT
+            si.channel_sale_id AS channelSaleId,
+            si.customer_id AS customerId,
+            si.channel_division_id AS channelDivisionId,
+            si.promoting_products AS promotingProducts,
+            si.supply_price AS supplyPrice,
+            si.account_period AS account_period,
+            si.create_date AS createDate
+        FROM
+            tb_rst_channel_sale_info si
+        WHERE
+            si.channel_division_id= #{channelDivisionId}
+    </select>
 
 
 
 
     <!--映射结果集 start-->
     <!--映射结果集 start-->
@@ -230,6 +245,7 @@
     <resultMap type="com.iamberry.rst.core.customer.ChannelSaleInfo" id="channelSaleInfoResult">
     <resultMap type="com.iamberry.rst.core.customer.ChannelSaleInfo" id="channelSaleInfoResult">
         <id property="channelSaleId" column="channel_sale_id"/>
         <id property="channelSaleId" column="channel_sale_id"/>
         <result property="channelName" column="channel_name" />
         <result property="channelName" column="channel_name" />
+        <result property="channelDivisionId" column="channel_division_id" />
         <result property="promotingProducts" column="promoting_products" />
         <result property="promotingProducts" column="promoting_products" />
         <result property="supplyPrice" column="supply_price" />
         <result property="supplyPrice" column="supply_price" />
         <result property="accountPeriod" column="account_period" />
         <result property="accountPeriod" column="account_period" />
@@ -398,9 +414,9 @@
     </select>
     </select>
     <!-- 根据客户id查询客户销售渠道备案信息 -->
     <!-- 根据客户id查询客户销售渠道备案信息 -->
     <!--查询渠道名称是否存在-->
     <!--查询渠道名称是否存在-->
-    <select id="queryIsExsitChannelNameChannelName" parameterType="java.lang.String" resultType="java.lang.Integer">
+    <select id="queryIsExsitChannelNameChannelName" parameterType="String" resultType="Integer">
         SELECT
         SELECT
-        t.channel_division_id
+        IFNULL(max(t.channel_division_id),0)
         FROM
         FROM
         tb_rst_channel_division_info t
         tb_rst_channel_division_info t
         WHERE
         WHERE
@@ -410,6 +426,7 @@
         SELECT
         SELECT
         t.channel_sale_id,
         t.channel_sale_id,
         t.channel_name,
         t.channel_name,
+        t.channel_division_id,
         t.promoting_products,
         t.promoting_products,
         t.supply_price,
         t.supply_price,
         t.account_period,
         t.account_period,

+ 2 - 2
watero-rst-web/src/main/webapp/WEB-INF/views/customer/customer_basic_list.ftl

@@ -130,9 +130,9 @@
                                 <#if !isSelectAll?? ||(isSelectAll != 2) || (adminId == list.idCreateBy)>
                                 <#if !isSelectAll?? ||(isSelectAll != 2) || (adminId == list.idCreateBy)>
                                         <a href="#" onclick="customerDetail(${list.customerId!''})">详情</a>
                                         <a href="#" onclick="customerDetail(${list.customerId!''})">详情</a>
                                 </#if>
                                 </#if>
-                                <#--<#if adminId == list.idCreateBy>-->
+                                <#if adminId == list.idCreateBy>
                                     <a href="#" onclick="customerupdate(${list.customerId!''})">修改</a>
                                     <a href="#" onclick="customerupdate(${list.customerId!''})">修改</a>
-                                <#--</#if>-->
+                                </#if>
                             </td>
                             </td>
 						</tr>
 						</tr>
 					</#list>
 					</#list>

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

@@ -171,6 +171,10 @@
             <div class="formControls col-1 col-sm-1">
             <div class="formControls col-1 col-sm-1">
                 <span class="select-box">
                 <span class="select-box">
                     <select name="channelCategory" id="channelCategory" class="select">
                     <select name="channelCategory" id="channelCategory" class="select">
+                        <option value="1">电商</option>
+                        <option value="2">特殊渠道</option>
+                        <option value="3">线下</option>
+                        <option value="4">海外</option>
                     </select>
                     </select>
                 </span>
                 </span>
             </div>
             </div>
@@ -334,7 +338,7 @@
         <div  class="row cl">
         <div  class="row cl">
             <label class="form-label col-5 col-sm-5"></label>
             <label class="form-label col-5 col-sm-5"></label>
             <div class="formControls col-5 col-sm-5 skin-minimal">
             <div class="formControls col-5 col-sm-5 skin-minimal">
-                <span class="c-red"><button type="button" style="cursor:pointer; float: inherit;height: 35px;margin-right: 30px;margin-bottom: 10px;margin-top: 20px;" class="my-btn-search" onclick="addCustomerBasicInfo();">确认修改</button></span>
+                <span class="c-red"><button type="button" style="cursor:pointer; float: inherit;height: 35px;margin-right: 30px;margin-bottom: 10px;margin-top: 20px;" class="my-btn-search" onclick="addCustomerBasicInfo();">确认提交</button></span>
             </div>
             </div>
         </div>
         </div>
     </form>
     </form>
@@ -353,7 +357,7 @@
         initProvince();
         initProvince();
 
 
         /*初始化渠道类别(大类)*/
         /*初始化渠道类别(大类)*/
-        initChannelCategory();
+        /*initChannelCategory();*/
 
 
         /*初始化销售产品(大类)*/
         /*初始化销售产品(大类)*/
         initPromotingProducts();
         initPromotingProducts();
@@ -565,7 +569,7 @@
                     if (data.returnCode == 200) {
                     if (data.returnCode == 200) {
                         for(var i=0;i<data.returnMsg.supplyPriceList.length;i++){
                         for(var i=0;i<data.returnMsg.supplyPriceList.length;i++){
                             var supplyPriceInfo = data.returnMsg.supplyPriceList[i];
                             var supplyPriceInfo = data.returnMsg.supplyPriceList[i];
-                            html += '<option value="'+ supplyPriceInfo.colorPrice +'">'+ supplyPriceInfo.colorPrice +'</option>';
+                            html += '<option value="'+ supplyPriceInfo.colorPrice/100 +'">'+ supplyPriceInfo.colorPrice/100 +'</option>';
                         }
                         }
                     }else{
                     }else{
                         html = '';
                         html = '';
@@ -590,9 +594,6 @@
 
 
     /*保存对接联系人信息到列表*/
     /*保存对接联系人信息到列表*/
     function toAddDockedContactInfo() {
     function toAddDockedContactInfo() {
-        //var dockedContactInfoList =  new Array();
-        //document.getElementById("contactListId").innerHTML = "";
-        //$("#contactListId").innerHTML = "";
         var contactName = document.getElementById("contactName").value;
         var contactName = document.getElementById("contactName").value;
         var contactPhone = document.getElementById("contactPhone").value;
         var contactPhone = document.getElementById("contactPhone").value;
         var contactType = document.getElementById("contactType").value;
         var contactType = document.getElementById("contactType").value;
@@ -608,11 +609,11 @@
             return;
             return;
         }
         }
         if(contactType == "" || contactType == null ){
         if(contactType == "" || contactType == null ){
-            alert("职位/身份不能为空");
+            layer.msg("职位/身份不能为空");
             return;
             return;
         }
         }
         if(contactEmail == "" || contactEmail == null ){
         if(contactEmail == "" || contactEmail == null ){
-            alert("联系邮箱不能为空");
+            layer.msg("联系邮箱不能为空");
             return;
             return;
         }
         }
         //var operation = "删除";
         //var operation = "删除";
@@ -649,6 +650,8 @@
         var channelType = document.getElementById("channelType").value;
         var channelType = document.getElementById("channelType").value;
         var channelName = document.getElementById("channelName").value;
         var channelName = document.getElementById("channelName").value;
         var promotingProducts = document.getElementById("promotingProducts").value;
         var promotingProducts = document.getElementById("promotingProducts").value;
+        var myselect=document.getElementById("promotingProducts");
+        var promotingProductsText = myselect.options[myselect.selectedIndex].text;
         var supplyPrice = document.getElementById("supplyPrice").value;
         var supplyPrice = document.getElementById("supplyPrice").value;
         var writeSupplyPrice = document.getElementById("writeSupplyPrice").value;//手动输入价格
         var writeSupplyPrice = document.getElementById("writeSupplyPrice").value;//手动输入价格
         if(writeSupplyPrice != null && writeSupplyPrice !=""){
         if(writeSupplyPrice != null && writeSupplyPrice !=""){
@@ -663,25 +666,26 @@
             accountPeriod = "两个月";
             accountPeriod = "两个月";
         }
         }
         if(channelCategory == "" || channelCategory == null ){
         if(channelCategory == "" || channelCategory == null ){
-            alert("渠道类别不能为空");
+            layer.msg("渠道类别不能为空");
             return;
             return;
         }
         }
         if(channelType == "" || channelType == null ){
         if(channelType == "" || channelType == null ){
-            alert("渠道类型不能为空");
+            layer.msg("渠道类型不能为空");
             return;
             return;
         }
         }
         if(channelName == "" || channelName == null ){
         if(channelName == "" || channelName == null ){
-            alert("渠道平台/名称不能为空");
+            layer.msg("渠道平台/名称不能为空");
             return;
             return;
         }
         }
         if(promotingProducts == "" || promotingProducts == null ){
         if(promotingProducts == "" || promotingProducts == null ){
-            alert("销售产品不能为空");
+            layer.msg("销售产品不能为空");
             return;
             return;
         }
         }
         if(supplyPrice == "" || supplyPrice == null ){
         if(supplyPrice == "" || supplyPrice == null ){
-            alert("供货价格不能为空");
+            layer.msg("供货价格不能为空");
             return;
             return;
         }
         }
+        var promotingProductsHtml = '<input type="hidden" value="'+promotingProducts+'">';
         //var operation = "删除";
         //var operation = "删除";
         var operation = "<a href='javascript:;' onclick='deleteChannelSale(this)' name='deleteChannelSale'>删除</a>";
         var operation = "<a href='javascript:;' onclick='deleteChannelSale(this)' name='deleteChannelSale'>删除</a>";
         row = document.getElementById("saleTable").insertRow();
         row = document.getElementById("saleTable").insertRow();
@@ -693,7 +697,7 @@
             cell = row.insertCell();
             cell = row.insertCell();
             cell.innerHTML=channelName;
             cell.innerHTML=channelName;
             cell = row.insertCell();
             cell = row.insertCell();
-            cell.innerHTML=promotingProducts;
+            cell.innerHTML=promotingProductsHtml+promotingProductsText;
             cell = row.insertCell();
             cell = row.insertCell();
             cell.innerHTML=supplyPrice;
             cell.innerHTML=supplyPrice;
             cell = row.insertCell();
             cell = row.insertCell();
@@ -719,19 +723,19 @@
         customerBasicInfo.customerRemarks = $("[name='customerRemarks']").val();
         customerBasicInfo.customerRemarks = $("[name='customerRemarks']").val();
         customerBasicInfo.customerStatus = "2";
         customerBasicInfo.customerStatus = "2";
         if(customerBasicInfo.customerName == "" || customerBasicInfo.customerName == null ){
         if(customerBasicInfo.customerName == "" || customerBasicInfo.customerName == null ){
-            alert("客户名称不能为空");
+            layer.msg("客户名称不能为空");
             return;
             return;
         }
         }
         if(customerBasicInfo.customerIndustry == "" || customerBasicInfo.customerIndustry == null ){
         if(customerBasicInfo.customerIndustry == "" || customerBasicInfo.customerIndustry == null ){
-            alert("客户行业不能为空");
+            layer.msg("客户行业不能为空");
             return;
             return;
         }
         }
         if(customerBasicInfo.customerProvinceCode == "" || customerBasicInfo.customerProvinceCode == null ){
         if(customerBasicInfo.customerProvinceCode == "" || customerBasicInfo.customerProvinceCode == null ){
-            alert("客户省份不能为空");
+            layer.msg("客户省份不能为空");
             return;
             return;
         }
         }
         if(customerBasicInfo.customerCityCode == "" || customerBasicInfo.customerCityCode == null ){
         if(customerBasicInfo.customerCityCode == "" || customerBasicInfo.customerCityCode == null ){
-            alert("客户城市不能为空");
+            layer.msg("客户城市不能为空");
             return;
             return;
         }/*if(customerBasicInfo.customerAddress == "" || customerBasicInfo.customerAddress == null ){
         }/*if(customerBasicInfo.customerAddress == "" || customerBasicInfo.customerAddress == null ){
             alert("客户地址不能为空");
             alert("客户地址不能为空");
@@ -739,49 +743,82 @@
         }*/
         }*/
         //对接联系人信息
         //对接联系人信息
         var dockedContactInfoList =  new Array();
         var dockedContactInfoList =  new Array();
-        $("#contactListId").find("tr").each(function (){
+        $("#contactListId").find("tr").each(function (index,element){
+            var a = $(element).children();
             var dockedContactInfo = {};
             var dockedContactInfo = {};
-            dockedContactInfo.contactName = $("[name='contactName']").val();
-            dockedContactInfo.contactPhone = $("[name='contactPhone']").val();
-            dockedContactInfo.contactType = $("[name='contactType']").val();
-            dockedContactInfo.contactEmail = $("[name='contactEmail']").val();
+            for(var i=0;i<a.length;i++){
+                switch(i){
+                    case 0:
+                        dockedContactInfo.contactName = a.eq(i).text().trim();
+                        break;
+                    case 1:
+                        dockedContactInfo.contactPhone = a.eq(i).text().trim();
+                        break;
+                    case 2:
+                        dockedContactInfo.contactType = a.eq(i).text().trim();
+                        break;
+                    case 3:
+                        dockedContactInfo.contactEmail = a.eq(i).text().trim();
+                        break;
+                }
+            }
             dockedContactInfoList.push(dockedContactInfo);
             dockedContactInfoList.push(dockedContactInfo);
         })
         })
-        if(dockedContactInfoList.length<2){
-            alert("对接联系人信息不能为空");
+        if(dockedContactInfoList.length<1){
+            layer.msg("对接联系人信息不能为空");
             return;
             return;
         }
         }
         //var dockedContactInfoListJson = $("#dockedContactInfoJson").val(JSON.stringify(dockedContactInfoList));
         //var dockedContactInfoListJson = $("#dockedContactInfoJson").val(JSON.stringify(dockedContactInfoList));
         //客户销售渠道信息
         //客户销售渠道信息
         var channelSaleInfoList =  new Array();
         var channelSaleInfoList =  new Array();
-        $("#channelSaleListId").find("tr").each(function (){
+        $("#channelSaleListId").find("tr").each(function (index,element){
+            var a = $(element).children();
             var channelSaleInfo = {};
             var channelSaleInfo = {};
-            channelSaleInfo.channelCategory = $("[name='channelCategory']").val();
-            if(channelSaleInfo.channelCategory == "电商"){
-                channelSaleInfo.channelCategory = "1";
-            }else if(channelSaleInfo.channelCategory == "特殊渠道"){
-                channelSaleInfo.channelCategory = "2";
-            }else if(channelSaleInfo.channelCategory == "线下"){
-                channelSaleInfo.channelCategory = "3";
-            }else if(channelSaleInfo.channelCategory == "海外"){
-                channelSaleInfo.channelCategory = "4";
-            }
-            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();
-            if(channelSaleInfo.accountPeriod == "先款"){
-                channelSaleInfo.accountPeriod = "1";
-            }else if(channelSaleInfo.accountPeriod == "月结"){
-                channelSaleInfo.accountPeriod = "2";
-            }else if(channelSaleInfo.accountPeriod == "两个月"){
-                channelSaleInfo.accountPeriod = "3";
+            for(var i=0;i<a.length;i++){
+                switch(i){
+                    case 0:
+                        channelSaleInfo.channelCategory = a.eq(i).text().trim();
+                        if(channelSaleInfo.channelCategory == "电商"){
+                            channelSaleInfo.channelCategory = "1";
+                        }else if(channelSaleInfo.channelCategory == "特殊渠道"){
+                            channelSaleInfo.channelCategory = "2";
+                        }else if(channelSaleInfo.channelCategory == "线下"){
+                            channelSaleInfo.channelCategory = "3";
+                        }else if(channelSaleInfo.channelCategory == "海外"){
+                            channelSaleInfo.channelCategory = "4";
+                        }
+                        break;
+                    case 1:
+                        channelSaleInfo.channelType = a.eq(i).text().trim();
+                        break;
+                    case 2:
+                        channelSaleInfo.channelName = a.eq(i).text().trim();
+                        break;
+                    case 3:
+                        channelSaleInfo.promotingProducts = a.eq(i).text().trim();
+                        break;
+                    case 4:
+                        channelSaleInfo.supplyPrice = a.eq(i).text().trim();
+                        channelSaleInfo.supplyPrice = channelSaleInfo.supplyPrice * 100;
+                        break;
+                    case 5:
+                        channelSaleInfo.accountPeriod = a.eq(i).text().trim();
+                        if(channelSaleInfo.accountPeriod == "先款"){
+                            channelSaleInfo.accountPeriod = "1";
+                        }else if(channelSaleInfo.accountPeriod == "月结"){
+                            channelSaleInfo.accountPeriod = "2";
+                        }else if(channelSaleInfo.accountPeriod == "两个月"){
+                            channelSaleInfo.accountPeriod = "3";
+                        }
+                        break;
+                }
             }
             }
+
             channelSaleInfoList.push(channelSaleInfo);
             channelSaleInfoList.push(channelSaleInfo);
-        })
+
+        });
         if(channelSaleInfoList.length<2){
         if(channelSaleInfoList.length<2){
-            alert("客户销售渠道信息不能为空");
+            layer.msg("客户销售渠道信息不能为空");
             return;
             return;
         }
         }
         //var channelSaleInfoListJson = $("#channelSaleInfoJson").val(JSON.stringify(channelSaleInfoList));
         //var channelSaleInfoListJson = $("#channelSaleInfoJson").val(JSON.stringify(channelSaleInfoList));
@@ -792,23 +829,23 @@
         billingInfo.accountNum = $("[name='accountNum']").val();
         billingInfo.accountNum = $("[name='accountNum']").val();
         billingInfo.receivablesName = $("[name='receivablesName']").val();
         billingInfo.receivablesName = $("[name='receivablesName']").val();
         billingInfo.receivablesPhone = $("[name='receivablesPhone']").val();
         billingInfo.receivablesPhone = $("[name='receivablesPhone']").val();
-        if(billingInfo.billAccountOpeningBranch == "" || billingInfo.billAccountOpeningBranch == null ){
-            alert("开户支行不能为空");
+        if(billingInfo.accountOpeningBranch == "" || billingInfo.accountOpeningBranch == null ){
+            layer.msg("开户支行不能为空");
             return;
             return;
         }
         }
         if(billingInfo.accountName == "" || billingInfo.accountName == null ){
         if(billingInfo.accountName == "" || billingInfo.accountName == null ){
-            alert("账号名称不能为空");
+            layer.msg("账号名称不能为空");
             return;
             return;
         }
         }
         if(billingInfo.accountNum == "" || billingInfo.accountNum == null ){
         if(billingInfo.accountNum == "" || billingInfo.accountNum == null ){
-            alert("账号不能为空");
+            layer.msg("账号不能为空");
             return;
             return;
         }
         }
         if(billingInfo.receivablesName == "" || billingInfo.receivablesName == null ){
         if(billingInfo.receivablesName == "" || billingInfo.receivablesName == null ){
-            alert("收款人姓名不能为空");
+            layer.msg("收款人姓名不能为空");
             return;
             return;
         }if(billingInfo.receivablesPhone == "" || billingInfo.receivablesPhone == null ){
         }if(billingInfo.receivablesPhone == "" || billingInfo.receivablesPhone == null ){
-            alert("收款人手机不能为空");
+            layer.msg("收款人手机不能为空");
             return;
             return;
         }
         }
         //开票信息
         //开票信息
@@ -821,36 +858,36 @@
         ticketOpeningInfo.ticketOpeningPhone = $("[name='ticketOpeningPhone']").val();
         ticketOpeningInfo.ticketOpeningPhone = $("[name='ticketOpeningPhone']").val();
         ticketOpeningInfo.enterpriseAddress = $("[name='enterpriseAddress']").val();
         ticketOpeningInfo.enterpriseAddress = $("[name='enterpriseAddress']").val();
         if(ticketOpeningInfo.ticketType == "1" ){
         if(ticketOpeningInfo.ticketType == "1" ){
-            if(ticketOpeningInfo.ticketAccountOpeningBranch == "" || ticketOpeningInfo.ticketAccountOpeningBranch == null ){
-                alert("开户支行不能为空");
+            if(ticketOpeningInfo.accountOpeningBranch == "" || ticketOpeningInfo.accountOpeningBranch == null ){
+                layer.msg("开户支行不能为空");
                 return;
                 return;
             }
             }
             if(ticketOpeningInfo.ticketOpeningAccount == "" || ticketOpeningInfo.ticketOpeningAccount == null ){
             if(ticketOpeningInfo.ticketOpeningAccount == "" || ticketOpeningInfo.ticketOpeningAccount == null ){
-                alert("开票账户不能为空");
+                layer.msg("开票账户不能为空");
                 return;
                 return;
             }
             }
             if(ticketOpeningInfo.enterpriseName == "" || ticketOpeningInfo.enterpriseName == null ){
             if(ticketOpeningInfo.enterpriseName == "" || ticketOpeningInfo.enterpriseName == null ){
-                alert("企业名称不能为空");
+                layer.msg("企业名称不能为空");
                 return;
                 return;
             }
             }
             if(ticketOpeningInfo.taxpayerIdentificationNum == "" || ticketOpeningInfo.taxpayerIdentificationNum == null ){
             if(ticketOpeningInfo.taxpayerIdentificationNum == "" || ticketOpeningInfo.taxpayerIdentificationNum == null ){
-                alert("纳税人识别号不能为空");
+                layer.msg("纳税人识别号不能为空");
                 return;
                 return;
             }
             }
             if(ticketOpeningInfo.ticketOpeningPhone == "" || ticketOpeningInfo.ticketOpeningPhone == null ){
             if(ticketOpeningInfo.ticketOpeningPhone == "" || ticketOpeningInfo.ticketOpeningPhone == null ){
-                alert("开票电话不能为空");
+                layer.msg("开票电话不能为空");
                 return;
                 return;
             }if(ticketOpeningInfo.enterpriseAddress == "" || ticketOpeningInfo.enterpriseAddress == null ){
             }if(ticketOpeningInfo.enterpriseAddress == "" || ticketOpeningInfo.enterpriseAddress == null ){
-                alert("企业地址不能为空");
+                layer.msg("企业地址不能为空");
                 return;
                 return;
             }
             }
         }else{
         }else{
             if(ticketOpeningInfo.enterpriseName == "" || ticketOpeningInfo.enterpriseName == null ){
             if(ticketOpeningInfo.enterpriseName == "" || ticketOpeningInfo.enterpriseName == null ){
-                alert("企业名称不能为空");
+                layer.msg("企业名称不能为空");
                 return;
                 return;
             }
             }
             if(ticketOpeningInfo.taxpayerIdentificationNum == "" || ticketOpeningInfo.taxpayerIdentificationNum == null ){
             if(ticketOpeningInfo.taxpayerIdentificationNum == "" || ticketOpeningInfo.taxpayerIdentificationNum == null ){
-                alert("纳税人识别号不能为空");
+                layer.msg("纳税人识别号不能为空");
                 return;
                 return;
             }
             }
         }
         }
@@ -885,15 +922,16 @@
             success: function(data){
             success: function(data){
                 if (data.returnCode == 200) {
                 if (data.returnCode == 200) {
                     saveStates = "保存成功";
                     saveStates = "保存成功";
-                    alert(saveStates);
+                    layer.msg(saveStates);
+                    window.location.href= "${path}/admin/customerBasic/listCustomerBasic";
                 }else{
                 }else{
                     saveStates = "保存失败";
                     saveStates = "保存失败";
-                    alert(saveStates);
+                    layer.msg(saveStates);
                 }
                 }
             },
             },
             error: function(XmlHttpRequest, textStatus, errorThrown){
             error: function(XmlHttpRequest, textStatus, errorThrown){
                 saveStates = "保存失败";
                 saveStates = "保存失败";
-                alert(saveStates);
+                layer.msg(saveStates);
             }
             }
         });
         });
     }
     }

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

@@ -157,6 +157,7 @@
                     </thead>
                     </thead>
                     <tbody id="contactListId">
                     <tbody id="contactListId">
                     <#if listDockedContactInfo?? &&  (listDockedContactInfo?size > 0) >
                     <#if listDockedContactInfo?? &&  (listDockedContactInfo?size > 0) >
+                        <tr><td colspan="5" id="contactTbodyId"  class="td-manage text-c" style="display: none;" >暂时没有联系人信息,请添加!</td></tr>
                         <#list listDockedContactInfo as list>
                         <#list listDockedContactInfo as list>
                         <tr>
                         <tr>
                             <td>${list.contactName!''}</td>
                             <td>${list.contactName!''}</td>
@@ -186,6 +187,10 @@
             <div class="formControls col-1 col-sm-1">
             <div class="formControls col-1 col-sm-1">
                 <span class="select-box">
                 <span class="select-box">
                     <select name="channelCategory" id="channelCategory" class="select">
                     <select name="channelCategory" id="channelCategory" class="select">
+                        <option value="1">电商</option>
+                        <option value="2">特殊渠道</option>
+                        <option value="3">线下</option>
+                        <option value="4">海外</option>
                     </select>
                     </select>
                 </span>
                 </span>
             </div>
             </div>
@@ -213,7 +218,7 @@
                     <select name="supplyPrice" id="supplyPrice" class="select">
                     <select name="supplyPrice" id="supplyPrice" class="select">
                     </select>
                     </select>
                 </span>
                 </span>
-                    <input type="text" class="input-text"  style="width:90px;margin-right: 0px;margin-bottom: 10px;"  placeholder="填写供货价格" id="supplyPrice" name="supplyPrice">
+                <input type="text" class="input-text"  style="width:90px;margin-right: 0px;margin-bottom: 10px;"  placeholder="填写供货价格" id="writeSupplyPrice" name="writeSupplyPrice">
             </div>
             </div>
             <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>账期:</label>
             <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>账期:</label>
             <div class="formControls col-1 col-sm-1">
             <div class="formControls col-1 col-sm-1">
@@ -241,16 +246,29 @@
                     </tr>
                     </tr>
                     </thead>
                     </thead>
                     <tbody id="channelSaleListId">
                     <tbody id="channelSaleListId">
-
                     <#if listChannelSaleInfo?? &&  (listChannelSaleInfo?size > 0) >
                     <#if listChannelSaleInfo?? &&  (listChannelSaleInfo?size > 0) >
+                    <tr><td colspan="7" class="td-manage text-c" id="channelTbodyId" style="display: none;" >暂时没有客户销售渠道信息,请添加!</td></tr>
                         <#list listChannelSaleInfo as list>
                         <#list listChannelSaleInfo as list>
                         <tr>
                         <tr>
-                            <td>${list.channelCategory!''}</td>
+                            <td>
+                                <#if list.channelCategory??>
+                                    <#if list.channelCategory == 1>电商</#if>
+                                    <#if list.channelCategory == 2>特殊渠道</#if>
+                                    <#if list.channelCategory == 3>线下</#if>
+                                    <#if list.channelCategory == 4>海外</#if>
+                                </#if>
+                            </td>
                             <td>${list.channelType!''}</td>
                             <td>${list.channelType!''}</td>
                             <td>${list.channelName!''}</td>
                             <td>${list.channelName!''}</td>
                             <td>${list.promotingProducts!''}</td>
                             <td>${list.promotingProducts!''}</td>
-                            <td>${list.supplyPrice!''}</td>
-                            <td>${list.accountPeriod!''}</td>
+                            <td>${list.supplyPrice/100!''}</td>
+                            <td>
+                                <#if list.accountPeriod??>
+                                    <#if list.accountPeriod == 1>先款</#if>
+                                    <#if list.accountPeriod == 2>月结</#if>
+                                    <#if list.accountPeriod == 3>俩个月</#if>
+                                </#if>
+                            </td>
                             <td><a href='javascript:;' onclick='deleteChannelSale(this)'>删除</a></td>
                             <td><a href='javascript:;' onclick='deleteChannelSale(this)'>删除</a></td>
                         </tr>
                         </tr>
                         </#list>
                         </#list>
@@ -274,7 +292,7 @@
             <label class="form-label col-2 col-sm-2"><span class="c-red">*</span>开户支行:</label>
             <label class="form-label col-2 col-sm-2"><span class="c-red">*</span>开户支行:</label>
             <div class="formControls col-2 col-sm-2">
             <div class="formControls col-2 col-sm-2">
                 <input type="text" class="input-text trim_input" placeholder="开户支行" id="accountOpeningBranch" name="accountOpeningBranch" value="${billingInfo.accountOpeningBranch!''}">
                 <input type="text" class="input-text trim_input" placeholder="开户支行" id="accountOpeningBranch" name="accountOpeningBranch" value="${billingInfo.accountOpeningBranch!''}">
-            </div>1
+            </div>
             <label class="form-label col-2 col-sm-2"><span class="c-red">*</span>账户名称:</label>
             <label class="form-label col-2 col-sm-2"><span class="c-red">*</span>账户名称:</label>
             <div class="formControls col-2 col-sm-2 skin-minimal">
             <div class="formControls col-2 col-sm-2 skin-minimal">
                 <input type="text" class="input-text trim_input" placeholder="账户名称" id="accountName" name="accountName" value="${billingInfo.accountName!''}">
                 <input type="text" class="input-text trim_input" placeholder="账户名称" id="accountName" name="accountName" value="${billingInfo.accountName!''}">
@@ -452,7 +470,7 @@
         initCity('${customerBasicInfo.customerProvinceCode!''}');
         initCity('${customerBasicInfo.customerProvinceCode!''}');
 
 
         /*初始化渠道类别(大类)*/
         /*初始化渠道类别(大类)*/
-        initChannelCategory();
+        /*initChannelCategory();*/
 
 
         /*初始化销售产品(大类)*/
         /*初始化销售产品(大类)*/
         initPromotingProducts();
         initPromotingProducts();
@@ -665,7 +683,7 @@
                     if (data.returnCode == 200) {
                     if (data.returnCode == 200) {
                         for(var i=0;i<data.returnMsg.supplyPriceList.length;i++){
                         for(var i=0;i<data.returnMsg.supplyPriceList.length;i++){
                             var supplyPriceInfo = data.returnMsg.supplyPriceList[i];
                             var supplyPriceInfo = data.returnMsg.supplyPriceList[i];
-                            html += '<option value="'+ supplyPriceInfo.colorPrice +'">'+ supplyPriceInfo.colorPrice +'</option>';
+                            html += '<option value="'+ supplyPriceInfo.colorPrice/100 +'">'+ supplyPriceInfo.colorPrice/100 +'</option>';
                         }
                         }
                     }else{
                     }else{
                         html = '';
                         html = '';
@@ -690,9 +708,6 @@
 
 
     /*保存对接联系人信息到列表*/
     /*保存对接联系人信息到列表*/
     function toAddDockedContactInfo() {
     function toAddDockedContactInfo() {
-        //var dockedContactInfoList =  new Array();
-        //document.getElementById("contactListId").innerHTML = "";
-        //$("#contactListId").innerHTML = "";
         var contactName = document.getElementById("contactName").value;
         var contactName = document.getElementById("contactName").value;
         var contactPhone = document.getElementById("contactPhone").value;
         var contactPhone = document.getElementById("contactPhone").value;
         var contactType = document.getElementById("contactType").value;
         var contactType = document.getElementById("contactType").value;
@@ -750,6 +765,10 @@
         var myselect=document.getElementById("promotingProducts");
         var myselect=document.getElementById("promotingProducts");
         var promotingProductsText = myselect.options[myselect.selectedIndex].text;
         var promotingProductsText = myselect.options[myselect.selectedIndex].text;
         var supplyPrice = document.getElementById("supplyPrice").value;
         var supplyPrice = document.getElementById("supplyPrice").value;
+        var writeSupplyPrice = document.getElementById("writeSupplyPrice").value;//手动输入价格
+        if(writeSupplyPrice != null && writeSupplyPrice !=""){
+            supplyPrice = writeSupplyPrice;
+        }
         var accountPeriod = document.getElementById("accountPeriod").value;
         var accountPeriod = document.getElementById("accountPeriod").value;
         if(accountPeriod == "1"){
         if(accountPeriod == "1"){
             accountPeriod = "先款";
             accountPeriod = "先款";
@@ -833,49 +852,85 @@
         }
         }
         //对接联系人信息
         //对接联系人信息
         var dockedContactInfoList =  new Array();
         var dockedContactInfoList =  new Array();
-        $("#contactListId").find("tr").each(function (){
+        $("#contactListId").find("tr").each(function (index,element){
+            var a = $(element).children();
             var dockedContactInfo = {};
             var dockedContactInfo = {};
-            dockedContactInfo.contactName = $("[name='contactName']").val();
-            dockedContactInfo.contactPhone = $("[name='contactPhone']").val();
-            dockedContactInfo.contactType = $("[name='contactType']").val();
-            dockedContactInfo.contactEmail = $("[name='contactEmail']").val();
+            for(var i=0;i<a.length;i++){
+                switch(i){
+                    case 0:
+                        dockedContactInfo.contactName = a.eq(i).text().trim();
+                        break;
+                    case 1:
+                        dockedContactInfo.contactPhone = a.eq(i).text().trim();
+                        break;
+                    case 2:
+                        dockedContactInfo.contactType = a.eq(i).text().trim();
+                        break;
+                    case 3:
+                        dockedContactInfo.contactEmail = a.eq(i).text().trim();
+                        break;
+                }
+            }
             dockedContactInfoList.push(dockedContactInfo);
             dockedContactInfoList.push(dockedContactInfo);
-        });
-        if(dockedContactInfoList.length<2){
+        })
+        if(dockedContactInfoList.length<1){
             layer.msg("对接联系人信息不能为空");
             layer.msg("对接联系人信息不能为空");
             return;
             return;
         }
         }
-        var dockedContactInfoListJson = $("#dockedContactInfoJson").val(JSON.stringify(dockedContactInfoList));
+        /*var dockedContactInfoListJson = $("#dockedContactInfoJson").val(JSON.stringify(dockedContactInfoList));*/
         //客户销售渠道信息
         //客户销售渠道信息
         var channelSaleInfoList =  new Array();
         var channelSaleInfoList =  new Array();
-        $("#channelSaleListId").find("tr").each(function (){
+        $("#channelSaleListId").find("tr").each(function (index,element){
+            var a = $(element).children();
             var channelSaleInfo = {};
             var channelSaleInfo = {};
-            channelSaleInfo.channelCategory = $("[name='channelCategory']").val();
-            if(channelSaleInfo.channelCategory == "电商"){
-                channelSaleInfo.channelCategory = "1";
-            }else if(channelSaleInfo.channelCategory == "特殊渠道"){
-                channelSaleInfo.channelCategory = "2";
-            }else if(channelSaleInfo.channelCategory == "线下"){
-                channelSaleInfo.channelCategory = "3";
-            }else if(channelSaleInfo.channelCategory == "海外"){
-                channelSaleInfo.channelCategory = "4";
-            }
-            channelSaleInfo.channelType = $("[name='channelType']").val();
-            channelSaleInfo.channelName = $("[name='channelName']").val();
-            channelSaleInfo.promotingProducts = $("[name='promotingProducts']").val();
-            alert($("[name='promotingProducts']").val()+"--1");
-            channelSaleInfo.supplyPrice = $("[name='supplyPrice']").val();
-            channelSaleInfo.accountPeriod = $("[name='accountPeriod']").val();
-            if(channelSaleInfo.accountPeriod == "先款"){
-                channelSaleInfo.accountPeriod = "1";
-            }else if(channelSaleInfo.accountPeriod == "月结"){
-                channelSaleInfo.accountPeriod = "2";
-            }else if(channelSaleInfo.accountPeriod == "两个月"){
-                channelSaleInfo.accountPeriod = "3";
+            for(var i=0;i<a.length;i++){
+                switch(i){
+                    case 0:
+                        channelSaleInfo.channelCategory = a.eq(i).text().trim();
+                        if(channelSaleInfo.channelCategory == "电商"){
+                            channelSaleInfo.channelCategory = "1";
+                        }else if(channelSaleInfo.channelCategory == "特殊渠道"){
+                            channelSaleInfo.channelCategory = "2";
+                        }else if(channelSaleInfo.channelCategory == "线下"){
+                            channelSaleInfo.channelCategory = "3";
+                        }else if(channelSaleInfo.channelCategory == "海外"){
+                            channelSaleInfo.channelCategory = "4";
+                        }
+                        break;
+                    case 1:
+                        channelSaleInfo.channelType = a.eq(i).text().trim();
+                        break;
+                    case 2:
+                        channelSaleInfo.channelName = a.eq(i).text().trim();
+                        break;
+                    case 3:
+                        channelSaleInfo.promotingProducts = a.eq(i).text().trim();
+                        break;
+                    case 4:
+                        channelSaleInfo.supplyPrice = a.eq(i).text().trim();
+                        channelSaleInfo.supplyPrice = channelSaleInfo.supplyPrice * 100;
+                        break;
+                    case 5:
+                        channelSaleInfo.accountPeriod = a.eq(i).text().trim();
+                        if(channelSaleInfo.accountPeriod == "先款"){
+                            channelSaleInfo.accountPeriod = "1";
+                        }else if(channelSaleInfo.accountPeriod == "月结"){
+                            channelSaleInfo.accountPeriod = "2";
+                        }else if(channelSaleInfo.accountPeriod == "两个月"){
+                            channelSaleInfo.accountPeriod = "3";
+                        }
+                        break;
+                }
             }
             }
+
             channelSaleInfoList.push(channelSaleInfo);
             channelSaleInfoList.push(channelSaleInfo);
+
         });
         });
-        var channelSaleInfoListJson = $("#channelSaleInfoJson").val(JSON.stringify(channelSaleInfoList));
+        if(channelSaleInfoList.length<2){
+            layer.msg("客户销售渠道信息不能为空");
+            return;
+        }
+        /*var channelSaleInfoListJson = $("#channelSaleInfoJson").val(JSON.stringify(channelSaleInfoList));*/
         //alert("dockedContactInfoList:"+dockedContactInfoList.length);
         //alert("dockedContactInfoList:"+dockedContactInfoList.length);
         //alert("channelSaleInfoList:"+channelSaleInfoList.length);
         //alert("channelSaleInfoList:"+channelSaleInfoList.length);
         //付款/退款信息
         //付款/退款信息
@@ -961,14 +1016,16 @@
         var customerInfoJson = JSON.stringify(customerBasicInfo);
         var customerInfoJson = JSON.stringify(customerBasicInfo);
         var billingInfoJson = JSON.stringify(billingInfo);
         var billingInfoJson = JSON.stringify(billingInfo);
         var ticketOpeningInfoJson = JSON.stringify(ticketOpeningInfo);
         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){});
         //$.post("${path}/admin/customerBasic/save_customer_info",customerBasicInfoSaveForm, function(res){});
         $.ajax({
         $.ajax({
             type: "POST",
             type: "POST",
             data: {
             data: {
                 customerInfoJson:customerInfoJson,
                 customerInfoJson:customerInfoJson,
-                dockedContactInfoList:dockedContactInfoList,
-                channelSaleInfoList:channelSaleInfoList,
+                dockedContactInfoListJson:dockedContactInfoListJson,
+                channelSaleInfoListJson:channelSaleInfoListJson,
                 billingInfoJson : billingInfoJson,
                 billingInfoJson : billingInfoJson,
                 ticketOpeningInfoJson:ticketOpeningInfoJson
                 ticketOpeningInfoJson:ticketOpeningInfoJson
             },
             },