Bläddra i källkod

Merge branch 'develop' of http://git.iamberry.com/hexiugang/iamberry-common-parent into develop

liujiankang 6 år sedan
förälder
incheckning
72cee4158b

+ 29 - 0
watero-rst-core/src/main/java/com.iamberry.rst.core/cm/CustomerInfo.java

@@ -159,6 +159,11 @@ public class CustomerInfo  implements Serializable {
     private Integer procMethodIsBack; //处理方式名称1:需要寄回 2:不需要寄回
     private Integer procMethodIsSend; //处理方式名称1:需要寄出 2:不需要寄出
 
+
+    private String customerProvinceId;    //省
+    private String customerCityId;    //市
+    private String customerDistrictId;    //区
+
     public void setComplaintDetectList(List<ComplaintDetectInfo> complaintDetectList) {
         this.complaintDetectList = complaintDetectList;
     }
@@ -788,4 +793,28 @@ public class CustomerInfo  implements Serializable {
     public void setProcMethodIsSend(Integer procMethodIsSend) {
         this.procMethodIsSend = procMethodIsSend;
     }
+
+    public String getCustomerProvinceId() {
+        return customerProvinceId;
+    }
+
+    public void setCustomerProvinceId(String customerProvinceId) {
+        this.customerProvinceId = customerProvinceId;
+    }
+
+    public String getCustomerCityId() {
+        return customerCityId;
+    }
+
+    public void setCustomerCityId(String customerCityId) {
+        this.customerCityId = customerCityId;
+    }
+
+    public String getCustomerDistrictId() {
+        return customerDistrictId;
+    }
+
+    public void setCustomerDistrictId(String customerDistrictId) {
+        this.customerDistrictId = customerDistrictId;
+    }
 }

+ 10 - 0
watero-rst-core/src/main/java/com.iamberry.rst.core/cm/SendProdcue.java

@@ -30,6 +30,8 @@ public class SendProdcue  implements Serializable {
 
     private String colorBar;        //69码
 
+    private String sendProdcueMachineNo;      //机器编码
+
     public String getSendProduceName() {
         return sendProduceName;
     }
@@ -128,4 +130,12 @@ public class SendProdcue  implements Serializable {
     public void setColorBar(String colorBar) {
         this.colorBar = colorBar;
     }
+
+    public String getSendProdcueMachineNo() {
+        return sendProdcueMachineNo;
+    }
+
+    public void setSendProdcueMachineNo(String sendProdcueMachineNo) {
+        this.sendProdcueMachineNo = sendProdcueMachineNo;
+    }
 }

+ 1 - 1
watero-rst-interface/src/main/java/com/iamberry/rst/faces/cm/CustomerService.java

@@ -148,7 +148,7 @@ public interface CustomerService {
     Integer getQuestionNumber(CustomerInfo customerInfo);
 
     /*删除旧的售后信息*/
-    void deleteCustomerAfterSales(CustomerInfo customer);
+    void deleteCustomerAfterSales(CustomerInfo customer,CmRelation cmRelation);
 
     Integer selectNotSolvedCustomer(CustomerInfo customer);
 

+ 150 - 399
watero-rst-service/src/main/java/com/iamberry/rst/service/cm/CustomerServiceImpl.java

@@ -7,10 +7,7 @@ import com.iamberry.rst.core.fm.ComplaintDetectInfo;
 import com.iamberry.rst.core.fm.ComplaintSignclosedInfo;
 import com.iamberry.rst.core.order.*;
 import com.iamberry.rst.core.page.PagedResult;
-import com.iamberry.rst.faces.cm.CustomerCommonService;
-import com.iamberry.rst.faces.cm.CustomerService;
-import com.iamberry.rst.faces.cm.ProcMethodService;
-import com.iamberry.rst.faces.cm.RelationOrderService;
+import com.iamberry.rst.faces.cm.*;
 import com.iamberry.rst.faces.order.EfastOrderService;
 import com.iamberry.rst.service.address.mapper.AddressMapper;
 import com.iamberry.rst.service.cm.mapper.*;
@@ -150,88 +147,68 @@ public class CustomerServiceImpl implements CustomerService {
                     throw new RuntimeException("添加客诉-订单为空-请重新添加订单");
                 }
             }
-            logger.info("-----------添加客诉-添加订单 --------------");
+            logger.info("-----------添加客诉-添加订单校验 --------------");
+        }
 
-            CmRelation cmRelation = customerInfo.getCmRelation();
-            cmRelation.setCustomerId(customerInfo.getCustomerId());
-            cmRelation.setRelationBackStatus(1); //寄回状态 1:未寄回
-            cmRelation.setRelationSendStatus(1); //寄送状态 1:未寄送
-            cmRelation.setRelationState(1); //状态  默认使用中
-            //cmRelation.setTransactionNumber(customerInfo.getTransactionNumber());   //外部交易号
-            // TODO: 2018/3/27 是否转账邮费,默认为不需要转账 : 0
-            cmRelation.setRelationIsTransfer(0);    //是否已转账邮费
-            cmRelation.setRelationBackPostage(0);   //邮费默认为0
-            cmRelation.setRelationBackName(cmRelation.getRelationSendName()); //姓名
-            cmRelation.setRelationBackTel(cmRelation.getRelationSendTel()); //电话号码
+        CmRelation cmRelation = customerInfo.getCmRelation();
+        cmRelation.setCustomerId(customerInfo.getCustomerId());
+        cmRelation.setRelationBackStatus(1); //寄回状态 1:未寄回
+        cmRelation.setRelationSendStatus(1); //寄送状态 1:未寄送
+        cmRelation.setRelationState(1); //状态  默认使用中
+        //cmRelation.setTransactionNumber(customerInfo.getTransactionNumber());   //外部交易号
+        // TODO: 2018/3/27 是否转账邮费,默认为不需要转账 : 0
+        cmRelation.setRelationIsTransfer(0);    //是否已转账邮费
+        cmRelation.setRelationBackPostage(0);   //邮费默认为0
+        cmRelation.setRelationBackName(cmRelation.getRelationSendName()); //姓名
+        cmRelation.setRelationBackTel(cmRelation.getRelationSendTel()); //电话号码
 
              /*  初始化产品类型,名称,配件名称 */
-            customerService.setName(cmRelation);
-            logger.info("-----------添加客诉-初始化产品,配件信息--------------");
-
-            ComplaintDetectInfo complaintDetectInfo = new ComplaintDetectInfo();  //品质检测
-            ComplaintSignclosedInfo complaintSignclosedInfo = new ComplaintSignclosedInfo(); //客诉-签收表
-
-      /*       Map<String,Object> map;
-           customerService.chargebackEfastOrder(customerCommon,salesOrder,2);    //原订单生成退单
-            map = customerService.sendEfastOrder(customerCommon,salesOrder);  //换新需要向Efast推送一条换新发货的订单
-            if(map.get("status") == 1){
-                customerCommon.setRelationBackEfastOrderId(String.valueOf(map.get("EfastOrderId")));  //存放Efast订单编号
-                complaintSignclosedInfo.setNewEfastId(String.valueOf(map.get("EfastOrderId")));     //仓储签收表添加  发货的Efast订单id
-            }else{
-                throw new RuntimeException("换新创建Efast订单失败");
-            }
-            complaintSignclosedInfo.setOldEfastId(salesOrder.getSalesOrderId());    //原有订单的Efast的订单编号
-            customerService.saveComplaintSignclosedInfo(complaintSignclosedInfo,customerCommon);//创建仓储任务
-            complaintDetectInfo.setSignclosedId(complaintSignclosedInfo.getSignclosedId()); //设置仓储签收id
-            customerService.saveComplaintDetectInfo(complaintDetectInfo,customerCommon);   //创建品检*/
-
-            logger.info("-----------添加客诉-创建仓储/品检成功--------------");
-
-            cmRelation.setSignclosedId(complaintSignclosedInfo.getSignclosedId()); //设置仓储id
+        customerService.setName(cmRelation);
+        logger.info("-----------添加客诉-初始化产品,配件信息--------------");
 
             /*添加处理方式*/
-            flag = cmRelationMapper.save(cmRelation);
-            if (flag < 1) {
-                throw new RuntimeException("添加客诉处理结果失败");
-            }
-            logger.info("-----------添加客诉-添加客诉处理成功--------------");
+        flag = cmRelationMapper.save(cmRelation);
+        if (flag < 1) {
+            throw new RuntimeException("添加客诉处理结果失败");
+        }
+        logger.info("-----------添加客诉-添加客诉处理成功--------------");
 
             /*添加客诉-添加处理与订单关联表*/
-            List<RelationOrder> relationOrderList = new ArrayList<>();
-            for (SalesOrder sor : orderList) {
-                RelationOrder ro = new RelationOrder();
-                ro.setRelationId(cmRelation.getRelationId());
-                ro.setSalesId(sor.getSalesId());
-                ro.setRelationCustomerId(customerInfo.getCustomerId());
-                relationOrderList.add(ro);
-            }
-            if(relationOrderList != null && relationOrderList.size() > 0){
-                flag = relationOrderService.saveList(relationOrderList);
-                if(flag < 1){
-                    throw new RuntimeException("添加客诉,关联订单失败");
-                }
-            }
-            logger.info("-----------添加客诉-添加处理与订单关联表--------------");
-
-            for (SalesOrder sor : orderList) {
-                SalesOrder newOrder = new SalesOrder(); //salesOrderStatus
-                newOrder.setSalesId(sor.getSalesId());
-                newOrder.setSalesOrderStatus(procMethod.getProcTypeId());
-                flag = salesOrderMapper.updateSalesOrder(newOrder);
-                if(flag < 1){
-                    throw new RuntimeException("添加客诉,修改订单失败");
-                }
-            }
-            logger.info("-----------添加客诉-修改订单--------------");
-            CustomerCommonUtil.setProduceOrFitting(cmRelation);
-            if(cmRelation.getClosedProdcues() != null && cmRelation.getClosedProdcues().size()>0){
-                closedProdcueMapper.insert(cmRelation.getClosedProdcues());
+        List<RelationOrder> relationOrderList = new ArrayList<>();
+        for (SalesOrder sor : orderList) {
+            RelationOrder ro = new RelationOrder();
+            ro.setRelationId(cmRelation.getRelationId());
+            ro.setSalesId(sor.getSalesId());
+            ro.setRelationCustomerId(customerInfo.getCustomerId());
+            relationOrderList.add(ro);
+        }
+        if(relationOrderList != null && relationOrderList.size() > 0){
+            flag = relationOrderService.saveList(relationOrderList);
+            if(flag < 1){
+                throw new RuntimeException("添加客诉,关联订单失败");
             }
-            if(cmRelation.getSendProdcues() != null && cmRelation.getSendProdcues().size() > 0){
-                sendProdcueMapper.insert(cmRelation.getSendProdcues());
+        }
+        logger.info("-----------添加客诉-添加处理与订单关联表--------------");
+
+        for (SalesOrder sor : orderList) {
+            SalesOrder newOrder = new SalesOrder(); //salesOrderStatus
+            newOrder.setSalesId(sor.getSalesId());
+            newOrder.setSalesOrderStatus(procMethod.getProcTypeId());
+            flag = salesOrderMapper.updateSalesOrder(newOrder);
+            if(flag < 1){
+                throw new RuntimeException("添加客诉,修改订单失败");
             }
-            logger.info("-----------添加客诉-寄回寄出产品配件成功--------------");
         }
+        logger.info("-----------添加客诉-修改订单--------------");
+        CustomerCommonUtil.setProduce(cmRelation);
+        if(cmRelation.getClosedProdcues() != null && cmRelation.getClosedProdcues().size()>0){
+            closedProdcueMapper.insert(cmRelation.getClosedProdcues());
+        }
+        if(cmRelation.getSendProdcues() != null && cmRelation.getSendProdcues().size() > 0){
+            sendProdcueMapper.insert(cmRelation.getSendProdcues());
+        }
+        logger.info("-----------添加客诉-寄回寄出产品配件成功--------------");
+
         return flag;
     }
 
@@ -240,23 +217,19 @@ public class CustomerServiceImpl implements CustomerService {
     @Transactional
     public Integer updateCustomerInfo(CustomerInfo customerInfo,SalesOrder salesOrder){
         Integer isNeedSelectOrder = customerInfo.getIsNeedSelectOrder();
-        //查询旧的客诉类型信息
-        CustomerCommon cc = customerInfo.getCustomerCommon();
-        cc.setCustomerId(customerInfo.getCustomerId());
-        List<CustomerCommon> ccList = customerCommonService.listCustomerCommon(cc);
-        /*if(ccList.size() > 0){
-            cc = ccList.get(0);
-        }*/
+        //当前处理信息
+        CmRelation cr =  customerInfo.getCmRelation();
+
         //删除旧的售后数据
-        customerService.deleteCustomerAfterSales(customerInfo);
+        customerService.deleteCustomerAfterSales(customerInfo,cr);
 
-        List<SalesOrder> orderList = new ArrayList<>();
+        List<SalesOrder> orderList = new ArrayList<SalesOrder>();
 
         //修改客诉基本信息
         Integer flag = 0;
         flag = customerInfoMapper.updateCustomerInfo(customerInfo);
         if(flag < 1){
-            throw new RuntimeException("修改客诉失败");
+            throw new RuntimeException("修改客诉失败-修改客诉基本信息失败");
         }
         logger.info("-----------修改客诉-修改客诉基本信息---------------");
 
@@ -266,8 +239,12 @@ public class CustomerServiceImpl implements CustomerService {
         questionDescribe.setDescribeTitle(customerInfo.getDescribeTitle());  //客诉问题标题
         questionDescribe.setDescribeContent(customerInfo.getDescribeContent());  //客诉问题描述
         questionDescribe.setDescribeHandleDesc(customerInfo.getDescribeHandleDesc());   //处理描述
-        questionDescribeMapper.updateByPrimaryKeySelective(questionDescribe);
+        flag = questionDescribeMapper.updateByPrimaryKeySelective(questionDescribe);
+        if(flag < 1){
+            throw new RuntimeException("修改客诉失败-修改客诉问题信息失败");
+        }
         logger.info("-----------修改客诉-修改客诉问题---------------");
+
         if ("2".equals(customerInfo.getCustomerIsVisit())) {
             Visit visit = new Visit();
             visit.setCustomerId(customerInfo.getCustomerId());
@@ -280,202 +257,95 @@ public class CustomerServiceImpl implements CustomerService {
             visit.setVisitStatus(1);    //回访状态
             flag = visitMapper.addVisitInfo(visit);
             if(flag < 1){
-                throw new RuntimeException("修改客诉回访失败");
+                throw new RuntimeException("修改客诉失败-修改客诉回访失败");
             }
             logger.info("-----------修改客诉-修改客诉回访信息---------------");
         }
-        if (2 == customerInfo.getCustomerCounselType() &&
-                (customerInfo.getCustomerIsSolve() == 3 || customerInfo.getCustomerIsSolve() == 4 || customerInfo.getCustomerIsSolve() == 5 ||
-                        customerInfo.getCustomerIsSolve() == 6 || customerInfo.getCustomerIsSolve() == 7)
-                ){
 
+        ProcMethod procMethod = procMethodService.getProcMethodById(customerInfo.getProcMethodId());
+        if (2 == customerInfo.getCustomerCounselType() && (procMethod.getProcMethodIsBack()==1||procMethod.getProcMethodIsSend()==1)){
             if(isNeedSelectOrder == 1){
                 SalesOrder so = new SalesOrder();
                 if(salesOrder.getIds()!= null && salesOrder.getIds().indexOf("_") > -1){
                     String[] salesIds = salesOrder.getIds().split("_");
                     so.setSalesIds(salesIds);
                     orderList = salesOrderMapper.listSalesOrder(so);
-                    logger.info("-----------修改客诉-查询订单--------------");
+                    if(orderList == null || orderList.size() < 1){
+                        throw new RuntimeException("添加客诉-订单为空-请重新添加订单");
+                    }
+                }else{
+                    throw new RuntimeException("添加客诉-订单查询出错-请重新添加订单");
                 }
             }
+            logger.info("-----------添加客诉-添加订单 --------------");
+        }
+        if (procMethod.getProcMethodIsBack()==2) {
+            cr.setRelationBackStatus(1); //寄回状态 1:未寄回
+            cr.setRelationIsTransfer(0);    //是否已转账邮费
+            cr.setRelationBackPostage(0);   //邮费
+            cr.setRelationBackLogisticsCompany("");//寄回物流公司
+            cr.setRelationBackLogisticsNo("");//寄回物流单号
+            cr.setRelationAlipay("");//转账账户
+            cr.setRelationAlipayName("");//转账账户 (账户姓名)
+        }
+        if (procMethod.getProcMethodIsSend()==2) {
+            cr.setRelationSendStatus(1); //寄送状态 1:未寄送
+            cr.setRelationSendLogisticsCompany("");//寄送物流公司
+            cr.setRelationSendLogisticsNo("");//寄送物流单号
+        }
+        /* 初始化产品类型,名称,配件名称 */
+        customerService.setName(cr);
+        logger.info("-----------修改客诉-初始化产品,配件信息--------------");
 
-            CustomerCommon customerCommon = customerInfo.getCustomerCommon();
-            if(ccList.size() > 0){
-                cc = ccList.get(0);
-                customerCommon.setRelationBackStatus(cc.getRelationBackStatus() == null ? 1:cc.getRelationBackStatus()); //寄回状态 1:未寄回
-                customerCommon.setRelationSendStatus(cc.getRelationSendStatus() == null ? 1:cc.getRelationSendStatus()); //寄送状态 1:未寄送
-                customerCommon.setRelationIsTransfer(cc.getRelationIsTransfer() == null ? 0:cc.getRelationIsTransfer());    //是否已转账邮费
-                customerCommon.setRelationBackPostage(cc.getRelationBackPostage() == null ? 0:cc.getRelationBackPostage());   //邮费
-                //旧的物流公司物流单号支付宝信息 邮费状态 efast订单号
-                customerCommon.setRelationBackLogisticsCompany(cc.getRelationBackLogisticsCompany());//寄回物流公司
-                customerCommon.setRelationBackLogisticsNo(cc.getRelationBackLogisticsNo());//寄回物流单号
-                customerCommon.setRelationAlipay(cc.getRelationAlipay());//转账账户
-                customerCommon.setRelationAlipayName(cc.getRelationAlipayName());//转账账户 (账户姓名)
-                customerCommon.setRelationDesc(cc.getRelationDesc());//备注
-                customerCommon.setRelationSendLogisticsCompany(cc.getRelationSendLogisticsCompany());//寄送物流公司
-                customerCommon.setRelationSendLogisticsNo(cc.getRelationSendLogisticsNo());//寄送物流单号
-                customerCommon.setSalesOrderId(cc.getSalesOrderId());//efast订单号
-            }else{
-                customerCommon.setRelationBackStatus(1); //寄回状态 1:未寄回
-                customerCommon.setRelationSendStatus(1); //寄送状态 1:未寄送
-                customerCommon.setRelationIsTransfer(0);    //是否已转账邮费  0:不需要
-                customerCommon.setRelationBackPostage(0);   //邮费默认为0
-            }
-            customerCommon.setCustomerId(customerInfo.getCustomerId()); //设置客诉id
-            customerCommon.setRelationState(1); //状态  默认使用中 //新
-            if(isNeedSelectOrder == 1){
-                customerCommon.setOrderId(salesOrder.getSalesId()); //订单id //新
-            }
-            customerCommon.setTransactionNumber(customerInfo.getTransactionNumber());   //外部交易号
-            customerCommon.setIsNeedSelectOrder(isNeedSelectOrder); //是否需要添加订单
-            customerCommon.setRelationBackName(customerCommon.getRelationSendName()); //姓名//新
-            customerCommon.setRelationBackTel(customerCommon.getRelationSendTel()); //电话号码//新
-
-            /*  初始化产品类型,名称,配件名称 */
-            customerService.setName(customerCommon);
-            logger.info("-----------修改客诉-初始化产品,配件信息--------------");
-
-            ComplaintDetectInfo complaintDetectInfo = new ComplaintDetectInfo();  //品质检测
-            ComplaintSignclosedInfo complaintSignclosedInfo = new ComplaintSignclosedInfo(); //客诉-签收表
-            Map<String,Object> map;
-            boolean isReturn = false;
-            switch (customerInfo.getCustomerIsSolve()) {  //处理结果: 1:已解决  2:未解决 3:换新  4:维修 5:补发 6:退货 7:无理由退货
-                case 3: //换新
-//                    customerService.chargebackEfastOrder(customerCommon,salesOrder,2);    //原订单生成退单
-//                    map = customerService.sendEfastOrder(customerCommon,salesOrder);  //换新需要向Efast推送一条换新发货的订单
-//                    if(map.get("status") == 1){
-//                        customerCommon.setRelationBackEfastOrderId(String.valueOf(map.get("EfastOrderId")));  //存放Efast订单编号
-//                        complaintSignclosedInfo.setNewEfastId(String.valueOf(map.get("EfastOrderId")));     //仓储签收表添加  发货的Efast订单id
-//                    }else{
-//                        throw new RuntimeException("换新创建Efast订单失败");
-//                    }
-//                    complaintSignclosedInfo.setOldEfastId(salesOrder.getSalesOrderId());    //原有订单的Efast的订单编号
-//                    customerService.saveComplaintSignclosedInfo(complaintSignclosedInfo,customerCommon);//创建仓储任务
-//                    complaintDetectInfo.setSignclosedId(complaintSignclosedInfo.getSignclosedId()); //设置仓储签收id
-//                    customerService.saveComplaintDetectInfo(complaintDetectInfo,customerCommon);   //创建品检
-                    break;
-                case 4: //维修
-//                    customerService.chargebackEfastOrder(customerCommon,salesOrder,2);    //原订单生成退单
-//                    map = customerService.sendEfastOrder(customerCommon,salesOrder);  //维修需要向Efast推送一条维修发货的订单
-//                    if(map.get("status") == 1){
-//                        customerCommon.setRelationBackEfastOrderId(String.valueOf(map.get("EfastOrderId")));  //存放Efast订单编号
-//                        complaintSignclosedInfo.setNewEfastId(String.valueOf(map.get("EfastOrderId")));     //仓储签收表添加  发货的Efast订单id
-//                    }else{
-//                        throw new RuntimeException("维修创建Efast订单失败");
-//                    }
-//                    complaintSignclosedInfo.setOldEfastId(salesOrder.getSalesOrderId());    //原有订单的Efast的订单编号
-//                    customerService.saveComplaintSignclosedInfo(complaintSignclosedInfo,customerCommon);//创建仓储任务
-//                    complaintDetectInfo.setSignclosedId(complaintSignclosedInfo.getSignclosedId()); //设置仓储签收id
-//                    customerService.saveComplaintDetectInfo(complaintDetectInfo,customerCommon);   //创建品检
-                    break;
-                case 5: //补发  不用创建仓储签收任务
-//                    map = customerService.sendEfastOrder(customerCommon,salesOrder);  //补发需要向Efast推送一条发货的订单
-//                    if(map.get("status") == 1){
-//                        customerCommon.setRelationBackEfastOrderId(String.valueOf(map.get("EfastOrderId")));  //存放Efast订单编号
-//                        complaintSignclosedInfo.setNewEfastId(String.valueOf(map.get("EfastOrderId")));     //仓储签收表添加  发货的Efast订单id
-//                    }else{
-//                        throw new RuntimeException("补发创建Efast订单失败");
-//                    }
-                    break;
-                case 6: //退货
-//                    customerService.chargebackEfastOrder(customerCommon,salesOrder,3);    //原订单生成退单
-
-//                    complaintSignclosedInfo.setOldEfastId(salesOrder.getSalesOrderId());    //原有订单的Efast的订单编号
-//                    customerService.saveComplaintSignclosedInfo(complaintSignclosedInfo,customerCommon);//创建仓储任务
-//                    complaintDetectInfo.setSignclosedId(complaintSignclosedInfo.getSignclosedId()); //设置仓储签收id
-//                    customerService.saveComplaintDetectInfo(complaintDetectInfo,customerCommon);   //创建品检
-                    break;
-                case 7: //无理由退货
-//                    customerService.chargebackEfastOrder(customerCommon,salesOrder,3);    //原订单生成退单
-//                    complaintSignclosedInfo.setOldEfastId(salesOrder.getSalesOrderId());    //原有订单的Efast的订单编号
-//                    customerService.saveComplaintSignclosedInfo(complaintSignclosedInfo,customerCommon);//创建仓储任务
-//                    complaintDetectInfo.setSignclosedId(complaintSignclosedInfo.getSignclosedId()); //设置仓储签收id
-//                    customerService.saveComplaintDetectInfo(complaintDetectInfo,customerCommon);   //创建品检
-                    break;
-            }
-            logger.info("-----------修改客诉-创建仓储/品检成功--------------");
-            customerCommon.setSignclosedId(complaintSignclosedInfo.getSignclosedId()); //设置仓储id
-
-            Object object = CustomerCommonUtil.getRelation(customerInfo.getCustomerIsSolve(), customerCommon);
-            Integer relationId = 0;
-            Integer orderStatus = 1;
-//            switch (customerInfo.getCustomerIsSolve()) {  //处理结果: 1:已解决  2:未解决 3:换新  4:维修 5:补发 6:退货 7:无理由退货
-//                case 3: //换新
-//                    Renewed renewed = (Renewed) object;
-//                    flag = renewedMapper.insert(renewed);
-//                    relationId = renewed.getRenewedId();
-//                    orderStatus = 2;
-//                    break;
-//                case 4: //维修
-//                    Repair repair = (Repair) object;
-//                    flag = repairMapper.insert(repair);
-//                    relationId = repair.getRepairId();
-//                    orderStatus = 4;
-//                    break;
-//                case 5: //补发
-//                    Reissue reissue = (Reissue) object;
-//                    flag = reissueMapper.insert(reissue);
-//                    relationId = reissue.getReissueId();
-//                    orderStatus = 5;
-//                    break;
-//                case 6: //退货
-//                    BackGoods backGoods = (BackGoods) object;
-//                    flag = backGoodsMapper.insert(backGoods);
-//                    relationId = backGoods.getBackGoodsId();
-//                    orderStatus = 3;
-//                    break;
-//                case 7: //无理由退货
-//                    NoreasonBack noreasonBack = (NoreasonBack) object;
-//                    flag = noreasonBackMapper.insert(noreasonBack);
-//                    relationId = noreasonBack.getNoreasonBackId();
-//                    orderStatus = 3;
-//                    break;
-//            }
-            if (flag < 1) {
-                throw new RuntimeException("添加客诉处理结果失败");
-            }
-            logger.info("-----------修改客诉-添加换新/维修/补发/退货/无理由退货信息成功--------------");
-
-              /*添加客诉-添加处理与订单关联表*/
-            List<RelationOrder> relationOrderList = new ArrayList<>();
-            for (SalesOrder sor : orderList) {
-                RelationOrder ro = new RelationOrder();
-                ro.setRelationType(customerInfo.getCustomerIsSolve());
-                ro.setRelationId(relationId);
-                ro.setSalesId(sor.getSalesId());
-                ro.setRelationCustomerId(customerInfo.getCustomerId());
-                relationOrderList.add(ro);
-            }
-            if(relationOrderList != null && relationOrderList.size() > 0){
-                flag = relationOrderService.saveList(relationOrderList);
-                if(flag < 1){
-                    throw new RuntimeException("添加客诉,关联订单失败");
-                }
-            }
+        ComplaintDetectInfo complaintDetectInfo = new ComplaintDetectInfo();  //品质检测
+        ComplaintSignclosedInfo complaintSignclosedInfo = new ComplaintSignclosedInfo(); //客诉-签收表
+        Map<String,Object> map;
+        boolean isReturn = false;
+        logger.info("-----------修改客诉-创建仓储/品检成功--------------");
 
-            for (SalesOrder sor : orderList) {
-                SalesOrder newOrder = new SalesOrder(); //salesOrderStatus
-                newOrder.setSalesId(sor.getSalesId());
-                newOrder.setSalesOrderStatus(orderStatus);
-                flag = salesOrderMapper.updateSalesOrder(newOrder);
-                if(flag < 1){
-                    throw new RuntimeException("添加客诉,修改订单状态失败");
-                }
+        flag = cmRelationMapper.update(cr);
+        if(flag < 1){
+            throw new RuntimeException("修改客诉-修改处理信息失败");
+        }
+        logger.info("-----------修改客诉-修改处理信息失败--------------");
+
+        /*添加客诉-添加处理与订单关联表*/
+        List<RelationOrder> relationOrderList = new ArrayList<>();
+        for (SalesOrder sor : orderList) {
+            RelationOrder ro = new RelationOrder();
+            ro.setRelationId(cr.getRelationId());
+            ro.setSalesId(sor.getSalesId());
+            ro.setRelationCustomerId(customerInfo.getCustomerId());
+            relationOrderList.add(ro);
+        }
+        if(relationOrderList != null && relationOrderList.size() > 0){
+            flag = relationOrderService.saveList(relationOrderList);
+            if(flag < 1){
+                throw new RuntimeException("添加客诉,关联订单失败");
             }
-            logger.info("-----------添加客诉-添加处理与订单关联表--------------");
+        }
 
-            customerCommon.setRelationId(relationId);
-            if(customerCommon.getIsNeedSelectOrder() == 1){
-                CustomerCommonUtil.setProduceOrFitting(customerInfo.getCustomerIsSolve(),customerCommon);
-                if(customerCommon.getClosedProdcues() != null && customerCommon.getClosedProdcues().size() > 0){
-                    closedProdcueMapper.insert(customerCommon.getClosedProdcues());
-                }
-                if(customerCommon.getSendProdcues() != null && customerCommon.getSendProdcues().size() > 0){
-                    sendProdcueMapper.insert(customerCommon.getSendProdcues());
-                }
-                logger.info("-----------添加客诉-寄回寄出产品配件成功--------------");
+        for (SalesOrder sor : orderList) {
+            SalesOrder newOrder = new SalesOrder(); //salesOrderStatus
+            newOrder.setSalesId(sor.getSalesId());
+            newOrder.setSalesOrderStatus(procMethod.getProcTypeId());
+            flag = salesOrderMapper.updateSalesOrder(newOrder);
+            if(flag < 1){
+                throw new RuntimeException("添加客诉,修改订单状态失败");
             }
         }
+        logger.info("-----------添加客诉-添加处理与订单关联表--------------");
+
+        logger.info("-----------添加客诉-修改订单--------------");
+        CustomerCommonUtil.setProduce(cr);
+        if(cr.getClosedProdcues() != null && cr.getClosedProdcues().size()>0){
+            closedProdcueMapper.insert(cr.getClosedProdcues());
+        }
+        if(cr.getSendProdcues() != null && cr.getSendProdcues().size() > 0){
+            sendProdcueMapper.insert(cr.getSendProdcues());
+        }
+        logger.info("-----------添加客诉-寄回寄出产品配件成功--------------");
+
         return flag;
     }
 
@@ -485,158 +355,39 @@ public class CustomerServiceImpl implements CustomerService {
      */
     @Override
     @Transactional
-    public void deleteCustomerAfterSales(CustomerInfo customer){
+    public void deleteCustomerAfterSales(CustomerInfo customer,CmRelation cmRelation){
+        Integer flag = 0;
         CustomerInfo customerInfo = customerInfoMapper.getCustomerInfo(customer.getCustomerId());
+
         //删除回访信息
         if ("2".equals(customerInfo.getCustomerIsVisit())){
-            visitMapper.deleteByPrimaryKey(customer.getCustomerId());
+            flag = visitMapper.deleteByPrimaryKey(customer.getCustomerId());
+            if(flag < 1){
+                throw new RuntimeException("修改客诉-删除回访,删除回访失败");
+            }
         }
 
-        //查询旧客诉类型,判断是否修改了客诉类型
-        Integer oldIsSolve = customerInfo.getCustomerIsSolve();// //处理结果: 1:已解决  2:未解决 3:换新  4:维修 5:补发 6:退货 7:无理由退货
+        //删除寄出寄回产品
         ClosedProdcue closedrecord = new ClosedProdcue();
-        ClosedFitting closedRecord = new ClosedFitting();
         SendProdcue sendProdcue = new SendProdcue();
-        SendFitting sendFitting = new SendFitting();
-        CustomerCommon customerCommon = customerInfo.getCustomerCommon();
-        SalesOrder salesOrder = new SalesOrder();
-        if(oldIsSolve > 2){
-            customerCommon = customerInfo.getCustomerCommon();
-            customerCommon.setCustomerId(customerInfo.getCustomerId()); //设置客诉id
-            customerCommon.setRelationBackStatus(1); //寄回状态 1:未寄回
-            customerCommon.setRelationSendStatus(1); //寄送状态 1:未寄送
-            customerCommon.setRelationState(1); //状态  默认使用中
-            customerCommon.setTransactionNumber(customerInfo.getTransactionNumber());   //外部交易号
-            customerCommon.setRelationIsTransfer(0);    //是否已转账邮费  0:不需要
-            customerCommon.setRelationBackPostage(0);   //邮费默认为0
-            customerCommon.setRelationBackName(customerCommon.getRelationSendName()); //姓名
-            customerCommon.setRelationBackTel(customerCommon.getRelationSendTel()); //电话号码
-            /*  初始化产品类型,名称,配件名称 */
-            /*customerService.setName(customerCommon);*/
-        }
-        Integer relationId = 0;
-//        switch (oldIsSolve){
-//            case 3:
-//                //删除换新数据
-//                Renewed renewed = new Renewed();
-//                renewed.setCustomerId(customer.getCustomerId());
-//                //查询换新数据id
-//                renewed = renewedMapper.getRenewedInfo(renewed);
-//                relationId = renewed.getRenewedId();
-//                if(customer.getCustomerIsSolve() < 3){ //从维修换货补发修改为已解决或未解决时,原订单生成退单
-//                    //salesOrder = salesOrderMapper.getSalesOrderById(renewed.getOrderId());    //salesOrder.getSalesId()  全场最佳,就你戏多
-//                    //customerCommon.setOrderId(renewed.getOrderId()); //订单id
-//                    SendProdcue record = new SendProdcue();
-//                    record.setRelationId(renewed.getRenewedId());
-//                    customerCommon.setSendProdcues(sendProdcueMapper.listSendProdcue(record));
-//                    customerService.setName(customerCommon);
-//                    //customerService.chargebackEfastOrder(customerCommon,salesOrder,8,2);
-//                }
-//                //删除寄出寄回产品
-//                closedRecord.setRelationId(renewed.getRenewedId());
-//                closedFittingMapper.deleteByPrimaryKey(closedRecord);
-//                closedrecord.setRelationId(renewed.getRenewedId());
-//                closedProdcueMapper.deleteByPrimaryKey(closedrecord);
-//                sendProdcue.setRelationId(renewed.getRenewedId());
-//                sendProdcueMapper.deleteByPrimaryKey(sendProdcue);
-//                sendFitting.setRelationId(renewed.getRenewedId());
-//                sendFittingMapper.deleteByPrimaryKey(sendFitting);
-//                renewedMapper.deleteByPrimaryKey(renewed);
-//                break;
-//            case 4:
-//                //删除维修数据
-//                Repair repair = new Repair();
-//                repair.setCustomerId(customer.getCustomerId());
-//                //查询维修数据id
-//                repair = repairMapper.getRepairInfo(repair);
-//                relationId = repair.getRepairId();
-//                if(customer.getCustomerIsSolve() < 3) { //从维修换货补发修改为已解决或未解决时,原订单生成退单
-//                    //salesOrder = salesOrderMapper.getSalesOrderById(repair.getOrderId());
-//                    //customerCommon.setOrderId(repair.getOrderId()); //订单id
-//                    SendProdcue record = new SendProdcue();
-//                    record.setRelationId(repair.getRepairId());
-//                    customerCommon.setSendProdcues(sendProdcueMapper.listSendProdcue(record));
-//                    customerService.setName(customerCommon);
-//                    //customerService.chargebackEfastOrder(customerCommon, salesOrder, 8,2);    //从维修换货补发修改为已解决或未解决时,原订单生成退单
-//                }
-//                //删除寄出寄回产品
-//                closedRecord.setRelationId(repair.getRepairId());
-//                closedFittingMapper.deleteByPrimaryKey(closedRecord);
-//                closedrecord.setRelationId(repair.getRepairId());
-//                closedProdcueMapper.deleteByPrimaryKey(closedrecord);
-//                sendProdcue.setRelationId(repair.getRepairId());
-//                sendProdcueMapper.deleteByPrimaryKey(sendProdcue);
-//                sendFitting.setRelationId(repair.getRepairId());
-//                sendFittingMapper.deleteByPrimaryKey(sendFitting);
-//                repairMapper.deleteByPrimaryKey(repair);
-//                break;
-//            case 5:
-//                //删除补发数据
-//                Reissue reissue = new Reissue();
-//                reissue.setCustomerId(customer.getCustomerId());
-//                //查询补发数据id
-//                reissue = reissueMapper.getReissue(reissue);
-//                relationId = reissue.getReissueId();
-//                if(customer.getCustomerIsSolve() < 3) { //从维修换货补发修改为已解决或未解决时,原订单生成退单
-//                    //salesOrder = salesOrderMapper.getSalesOrderById(reissue.getOrderId());
-//                    //customerCommon.setOrderId(reissue.getOrderId()); //订单id
-//                    SendProdcue record = new SendProdcue();
-//                    record.setRelationId(reissue.getReissueId());
-//                    customerCommon.setSendProdcues(sendProdcueMapper.listSendProdcue(record));
-//                    customerService.setName(customerCommon);
-//                    //customerService.chargebackEfastOrder(customerCommon, salesOrder, 8,2);    //从维修换货补发修改为已解决或未解决时,原订单生成退单
-//                }
-//                //删除寄出产品
-//                sendProdcue.setRelationId(reissue.getReissueId());
-//                sendProdcueMapper.deleteByPrimaryKey(sendProdcue);
-//                sendFitting.setRelationId(reissue.getReissueId());
-//                sendFittingMapper.deleteByPrimaryKey(sendFitting);
-//                reissueMapper.deleteByPrimaryKey(reissue);
-//                break;
-//            case 6:
-//                //删除退货数据
-//                BackGoods backGoods = new BackGoods();
-//                backGoods.setCustomerId(customer.getCustomerId());
-//                //查询维修数据id
-//                backGoods = backGoodsMapper.getBackGoods(backGoods);
-//                relationId = backGoods.getBackGoodsId();
-//                //删除寄出寄回产品
-//                closedRecord.setRelationId(backGoods.getBackGoodsId());
-//                closedFittingMapper.deleteByPrimaryKey(closedRecord);
-//                closedrecord.setRelationId(backGoods.getBackGoodsId());
-//                closedProdcueMapper.deleteByPrimaryKey(closedrecord);
-//                backGoodsMapper.deleteByPrimaryKey(backGoods);
-//                break;
-//            case 7:
-//                //删除无理由退货数据
-//                NoreasonBack noreasonBack = new NoreasonBack();
-//                noreasonBack.setCustomerId(customer.getCustomerId());
-//                //查询维修数据id
-//                noreasonBack = noreasonBackMapper.getNoreasonBack(noreasonBack);
-//                relationId = noreasonBack.getNoreasonBackId();
-//                        //删除寄出寄回产品
-//                closedRecord.setRelationId(noreasonBack.getNoreasonBackId());
-//                closedFittingMapper.deleteByPrimaryKey(closedRecord);
-//                closedrecord.setRelationId(noreasonBack.getNoreasonBackId());
-//                closedProdcueMapper.deleteByPrimaryKey(closedrecord);
-//                noreasonBackMapper.deleteByPrimaryKey(noreasonBack);
-//                break;
-//        }
+        closedrecord.setRelationId(cmRelation.getRelationId());
+        closedProdcueMapper.deleteByPrimaryKey(closedrecord);
+        sendProdcue.setRelationId(cmRelation.getRelationId());
+        sendProdcueMapper.deleteByPrimaryKey(sendProdcue);
 
         /*恢复订单状态*/
         RelationOrder relationOrder = new RelationOrder();
-        relationOrder.setRelationType(oldIsSolve);
-        relationOrder.setRelationId(relationId);
+        relationOrder.setRelationId(cmRelation.getRelationId());
         List<RelationOrder> relationOrderList = relationOrderService.getRelationOrderList(relationOrder);
         for (int k=0; k<relationOrderList.size();k++){
             SalesOrder newOrder = new SalesOrder(); //salesOrderStatus
             newOrder.setSalesId(relationOrderList.get(k).getSalesId());
             newOrder.setSalesOrderStatus(1);    //恢复订单到之前的状态
-            Integer flag = salesOrderMapper.updateSalesOrder(newOrder);
+            salesOrderMapper.updateSalesOrder(newOrder);
         }
 
         /* 删除掉订单与处理的关联表 */
-        relationOrderService.deleteByRelationId(relationId);
+        relationOrderService.deleteByRelationId(cmRelation.getRelationId());
     }
 
     @Override

+ 20 - 5
watero-rst-service/src/main/java/com/iamberry/rst/service/cm/mapper/customerInfoMapper.xml

@@ -58,7 +58,10 @@
       t.customer_out_damaged,
       t.customer_secondary_customer,
       t.customer_last_id,
-      t.customer_initial_id
+      t.customer_initial_id,
+      t.customer_province_id,
+      t.customer_city_id,
+      t.customer_district_id
     from tb_rst_cm_customer_info t
     where t.customer_id = #{customerId,jdbcType=INTEGER}
   </select>
@@ -453,14 +456,17 @@
       company_id, store_id, customer_source_type, 
       customer_source, customer_counsel_type, customer_name, 
       customer_tel,customer_wechat_name, customer_is_solve, customer_is_visit,
-      customer_in_TDS, customer_out_TDS, customer_area, type_id, customer_desc, customer_out_damaged, customer_secondary_customer, customer_last_id, customer_initial_id
+      customer_in_TDS, customer_out_TDS, customer_area, type_id, customer_desc, customer_out_damaged, customer_secondary_customer, customer_last_id,
+       customer_province_id,customer_city_id,customer_district_id,
+       customer_initial_id
       )
     values (#{customerId,jdbcType=INTEGER}, #{adminId,jdbcType=INTEGER}, #{questionId,jdbcType=INTEGER}, 
       #{companyId,jdbcType=INTEGER}, #{storeId,jdbcType=INTEGER}, #{customerSourceType,jdbcType=TINYINT}, 
       #{customerSource,jdbcType=VARCHAR}, #{customerCounselType,jdbcType=BIT}, #{customerName,jdbcType=VARCHAR}, 
       #{customerTel,jdbcType=VARCHAR},#{customerWechatName,jdbcType=VARCHAR}, #{customerIsSolve,jdbcType=TINYINT}, #{customerIsVisit,jdbcType=VARCHAR},
-      #{customerInTDS,jdbcType=INTEGER}, #{customerOutTDS,jdbcType=INTEGER}, #{customerArea,jdbcType=VARCHAR},#{typeId},#{customerDesc},#{customerOutDamaged},#{customerSecondaryCustomer}
-      ,#{customerLastId},#{customerInitialId}
+      #{customerInTDS,jdbcType=INTEGER}, #{customerOutTDS,jdbcType=INTEGER}, #{customerArea,jdbcType=VARCHAR},#{typeId},#{customerDesc},#{customerOutDamaged},#{customerSecondaryCustomer},#{customerLastId},
+      #{customerProvinceId},#{customerCityId},#{customerDistrictId},
+      #{customerInitialId}
       )
   </insert>
 
@@ -535,7 +541,16 @@
         customer_last_id = #{customerLastId},
       </if>
       <if test="customerInitialId != null" >
-        customer_initial_id = #{customerInitialId}
+        customer_initial_id = #{customerInitialId},
+      </if>
+      <if test="customerProvinceId != null" >
+        customer_province_id = #{customerProvinceId},
+      </if>
+      <if test="customerCityId != null" >
+        customer_city_id = #{customerCityId},
+      </if>
+      <if test="customerDistrictId != null" >
+        customer_district_id = #{customerDistrictId},
       </if>
       <if test="factoryId != null" >
         factory_id = #{factoryId}

+ 1 - 1
watero-rst-service/src/main/java/com/iamberry/rst/util/CustomerCommonUtil.java

@@ -351,7 +351,7 @@ public class CustomerCommonUtil {
      * 将所有的寄回寄出中的类型改为  type
      * @param cc
      */
-    public static void setProduceOrFitting(CmRelation cc){
+    public static void setProduce(CmRelation cc){
         for (int i=0;i<cc.getSendProdcues().size();i++) {
             cc.getSendProdcues().get(i).setRelationId(cc.getRelationId());
         }

+ 6 - 30
watero-rst-web/src/main/java/com/iamberry/rst/controllers/cm/AdminCustomerController.java

@@ -188,22 +188,6 @@ public class AdminCustomerController {
         } else {
             customerInfo.setIsNeedSelectOrder(1);
         }
-
-            /*查询所有的产品,颜色和配件信息*/
-//            List<Product> productList = productService.listProduce(new Product());
-//            for(Product product : productList){
-//                ProductColor productColor = new ProductColor();
-//                productColor.setColorProductId(product.getProductId());
-//                List<ProductColor>  productColorList = productService.listProduceColor(productColor);
-//                product.setColorList(productColorList);
-//
-//                FittingsInfo fittingsInfo = new FittingsInfo();
-//                fittingsInfo.setProductId(product.getProductId());
-//                List<FittingsInfo> fittingsInfoList = fittingsInfoService.listFittings(fittingsInfo);
-//                product.setFittingsList(fittingsInfoList);
-//            }
-//            mv.addObject("productList", productList);
-
         //setIsNeedSelectOrder
         if (customerInfo.getIsNeedSelectOrder() == 1 ) {
             RelationOrder relationOrder = new RelationOrder();
@@ -256,7 +240,6 @@ public class AdminCustomerController {
         mv.addObject("complaintQuestionInfo", complaintQuestionInfo);
         mv.addObject("complaintSmallClassInfoList", complaintSmallClassInfoList);
         mv.addObject("complaintTypeInfoList", complaintTypeInfoList);
-        //mv.addObject("questionDescribe", questionDescribe);
         return mv;
     }
 
@@ -906,8 +889,8 @@ public class AdminCustomerController {
     @ResponseBody
     @RequiresPermissions("customer:update:customer")
     @RequestMapping("/update_customer")
-    public ResponseJson updateCustomer(HttpServletRequest request, CustomerInfo customerInfo, SalesOrder salesOrder, CustomerCommon customerCommon,
-                                       String sendProdcuesJson, String sendFittingsJson, String closedProdcuesJson, String closedFittingsJson) throws Exception {
+    public ResponseJson updateCustomer(HttpServletRequest request, CustomerInfo customerInfo, SalesOrder salesOrder, CmRelation cmRelation,
+                                       String sendProdcuesJson,  String closedProdcuesJson) throws Exception {
         ResponseJson rjx = this.isValiData(customerInfo);
         if (rjx.getResultCode() == 500) {
             return rjx;
@@ -928,21 +911,12 @@ public class AdminCustomerController {
             jsonArray = JSONArray.fromObject(sendProdcuesJson);
             sendProdcueList = (List) JSONArray.toCollection(jsonArray, SendProdcue.class);
 
-            jsonArray = JSONArray.fromObject(sendFittingsJson);
-            sendFittingList = (List) JSONArray.toCollection(jsonArray, SendFitting.class);
-
             jsonArray = JSONArray.fromObject(closedProdcuesJson);
             closedProdcueList = (List) JSONArray.toCollection(jsonArray, ClosedProdcue.class);
 
-            jsonArray = JSONArray.fromObject(closedFittingsJson);
-            closedFittingList = (List) JSONArray.toCollection(jsonArray, ClosedFitting.class);
-
-            customerCommon.setSendProdcues(sendProdcueList);
-            customerCommon.setSendFittings(sendFittingList);
-            customerCommon.setClosedProdcues(closedProdcueList);
-            customerCommon.setClosedFittings(closedFittingList);
+            cmRelation.setSendProdcues(sendProdcueList);
+            cmRelation.setClosedProdcues(closedProdcueList);
         }
-//        customerInfo.setCustomerCommon(customerCommon);
         String orderId = "";
         if (customerInfo.getCustomerIsSolve() == 3 || customerInfo.getCustomerIsSolve() == 4 || customerInfo.getCustomerIsSolve() == 5) {
             Integer adminId = AdminUtils.getLoginAdminId();
@@ -950,6 +924,8 @@ public class AdminCustomerController {
         }
         customerInfo.setTransactionNumber(orderId);
 
+        customerInfo.setCmRelation(cmRelation);
+
         Integer customerId = customerInfo.getCustomerId();
         logger.info("-----------------修改客诉开始----------------------");
         try {

+ 77 - 160
watero-rst-web/src/main/webapp/WEB-INF/views/cm/customer/add_customer.ftl

@@ -385,13 +385,13 @@
                 </div>
             </div>
 
-            <div class="row cl" id="orderHead" style="display: none;">
+            <div class="row cl orderHead" id="" style="display: none;">
                 <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>订单信息:</label>
                 <div class="formControls col-1 col-sm-1">
                     <button type="button" class="btn btn-primary" id="selectOrder">搜索订单</button>
                 </div>
             </div>
-            <div class="row cl" id="order" style="display: none;">
+            <div class="row cl orderHead" id="" style="display: none;">
                 <label class="form-label col-1 col-sm-1"></label>
                 <div class="formControls col-9 col-sm-9 text-c">
                     <table class="table table-border table-bg table-bordered" >
@@ -419,12 +419,12 @@
                 </div>
             </div>
 
-            <div class="row cl" id="recipientInfoTitle" style="display: none">
+            <div class="row cl recipientInfo" id="" style="display: none">
                 <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>收件信息:</label>
                 <div class="formControls col-8 col-sm-8">请先选择订单,系统自动填充姓名,电话和地址信息。</div>
             </div>
 
-            <div class="row cl" id="recipientInfo" style="display: none">
+            <div class="row cl recipientInfo" id="" style="display: none">
                 <label class="form-label col-1 col-sm-1"></label>
                 <div class="formControls col-2 col-sm-2">
                     <input type="text" class="input-text" value="" placeholder="填写收件人姓名" id="sendName" name="relationSendName" datatype="*1-16" errormsg="联系人格式不正确!" >
@@ -437,7 +437,7 @@
                 </div>
             </div>
 
-            <div class="row cl" id="recipientAddress" style="display: none">
+            <div class="row cl recipientAddress" id="" style="display: none">
                 <input type="hidden" id="addressInfo">
                 <label class="form-label col-1 col-sm-1"></label>
                 <div class="formControls col-2 col-sm-2">
@@ -461,7 +461,7 @@
                 <input type="hidden" name="relationSendMergeAddress" id="relationSendMergeAddress">
             </div>
 
-            <div class="row cl" id="recipientAddressText" style="display: none">
+            <div class="row cl recipientAddress" id="" style="display: none">
                 <label class="form-label col-1 col-sm-1"></label>
                 <div class="formControls col-5 col-sm-5">
                     <textarea name="relationSendAddress" id="sendAddress" cols="" rows="2" datatype="*" errormsg="收货地址不正确!" class="textarea" placeholder="请填写详细地址,最多支持50字符" onKeyUp="$.Huitextarealength(this,50)"></textarea>
@@ -469,29 +469,42 @@
                 </div>
             </div>
 
-            <div class="row cl" id="renewedProduct" style="display: none">
+            <div class="row cl renewedProduct" id="" style="display: none">
                 <label class="form-label col-1 col-sm-1"><span class="c-red">*</span><span id="relationProduct">寄回产品</span>:</label>
-                <div class="formControls col-9 col-sm-9 text-c" id="produceSelect">
+                <div class="formControls col-1 col-sm-1">
+                    <button type="button" class="btn btn-primary" id="" onclick="addProduct(1)">添加产品</button>
+                </div>
+            </div>
+            <div class="row cl renewedProduct" id="" style="display: none">
+                <label class="form-label col-1 col-sm-1"></label>
+                <div class="formControls col-9 col-sm-9" >
                     <table class="table table-border table-bg table-bordered">
                         <thead>
-                            <tr class="text-c" id="table1">
-                                <th style="text-align: center;" width="60">产品名称</th>
-                                <th style="text-align: center;" width="40">产品颜色</th>
-                                <th style="text-align: center;" width="30">数量</th>
-                                <th style="text-align: center;" width="100">机器编码</th>
-                            </tr>
+                        <tr class="text-c" id="table2">
+                            <th style="text-align: center;" width="60">产品名称</th>
+                            <th style="text-align: center;" width="40">产品颜色</th>
+                            <th style="text-align: center;" width="30">数量</th>
+                            <th style="text-align: center;" width="100">机器编号</th>
+                            <th style="text-align: center;" width="30">操作</th>
+                        </tr>
                         </thead>
-                        <tbody id="addProduct">
-                            <tr id="">
-                                <td style="text-align: center;" colspan="4">选择订单后展示</td>
-                            </tr>
+                        <tbody id="addBackProduct">
+                        <tr id="">
+                            <td style="text-align: center;" colspan="5">选择订单后展示</td>
+                        </tr>
                         </tbody>
                     </table>
                 </div>
             </div>
 
-            <div class="row cl" id="updateProduct" style="display: none">
+            <div class="row cl updateProduct" id="" style="display: none">
                 <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>寄出产品:</label>
+                <div class="formControls col-1 col-sm-1">
+                    <button type="button" class="btn btn-primary" id="" onclick="addProduct(2)">添加产品</button>
+                </div>
+            </div>
+            <div class="row cl updateProduct" id="" style="display: none">
+                <label class="form-label col-1 col-sm-1"></label>
                 <div class="formControls col-9 col-sm-9" >
                     <table class="table table-border table-bg table-bordered">
                         <thead>
@@ -500,12 +513,13 @@
                             <th style="text-align: center;" width="40">产品颜色</th>
                             <th style="text-align: center;" width="30">数量</th>
                             <th style="text-align: center;" width="100">机器编号</th>
+                            <th style="text-align: center;" width="30">操作</th>
                         </tr>
                         </thead>
-                        <tbody id="back-product">
-                            <tr id="">
-                                <td style="text-align: center;" colspan="4">选择订单后展示</td>
-                            </tr>
+                        <tbody id="addSendProduct">
+                        <tr id="">
+                            <td style="text-align: center;" colspan="5">选择订单后展示</td>
+                        </tr>
                         </tbody>
                     </table>
                 </div>
@@ -521,14 +535,15 @@
                     <input type="text" class="input-text trim_input" placeholder="客户报价" id="relationCustomerCosts" name="relationCustomerCosts" value="">
                   </div>
             </div>
-            <div class="row cl"  id="sendInformationTitle">
+
+            <div class="row cl sendAddressInfo"  id="">
                  <label class="form-label col-1 col-sm-1">
                      <div class="tit-2">寄回信息</div>
                  </label>
                      <div class="formControls col-10 col-sm-10">
                       </div>
             </div>
-            <div class="row cl" id="sendAddressInfo">
+            <div class="row cl sendAddressInfo" id="">
                 <label class="form-label col-1 col-sm-1"></label>
                 <div class="formControls col-9 col-sm-9" style="height: 240px" id="sendAddressSmsHtml">
                    <#-- <script id="sendAddressSms" type="text/plain" style="width:983px;height:200px;"></script>
@@ -536,7 +551,7 @@
                 </div>
             </div>
 
-            <div class="row cl" id="sendAddressByPhone" style="display: none;">
+            <div class="row cl sendAddressInfo" id="" style="display: none;">
                 <label class="form-label col-1 col-sm-1"></label>
                 <div class="formControls col-2 col-sm-2">
                     <input type="text" class="input-text associated-phone" value="" placeholder="请输入手机号" id="m-phone" name="">
@@ -550,37 +565,41 @@
             </div>
 
             <div class="row cl">
-                 <label class="form-label col-1 col-sm-1">
-                 <div class="tit-2">TDS收集</div>
-                 </label>
-            <div class="formControls col-10 col-sm-10">
-            </div>
+                <label class="form-label col-1 col-sm-1">
+                     <div class="tit-2">TDS收集</div>
+                </label>
+                <div class="formControls col-10 col-sm-10"></div>
             </div>
-             <div class="row cl" id="TDScollect" style="display: none;">
-             <label class="form-label col-1 col-sm-1"></label>
+
+            <div class="row cl init_address" id="TDScollect" style="display: none;" code="returnCode" msg="resultMsg" data="returnMsg">
+                <label class="form-label col-1 col-sm-1"></label>
                 <div class="formControls col-2 col-sm-2" style="position: relative;">
-                  <span class="select-box">
-                  <select name="initProvinceCode" class="select" id="initProvince">
-                      <option value="">请选择省份</option>
-                  </select>
-                   </span>
+                    <span class="select-box">
+                        <select name="customerProvinceId" class="select" id="initProvince"
+                                ulcValName="province" ulcValId="provinceId"  ulcURL="/address/list_province" ulcMsg="" ulcList="provinceList"
+                                ulcIsFristSelect="true" ulcFristSelectMsg="请选择省份">
+                        </select>
+                    </span>
                 </div>
                 <div class="formControls col-2 col-sm-2">
-                <span class="select-box">
-                 <select name="initCityCode" class="select" id="initCity">
-                   <option value="">请选择城市</option>
-                 </select>
-                 </span>
-             </div>
+                    <span class="select-box">
+                        <select name="customerCityId" class="select" id="initCity"
+                                ulcValName="city" ulcValId="cityId"  ulcURL="/address/list_city?provinceId=" ulcMsg="" ulcList="cityList"
+                                ulcIsFristSelect="true" ulcFristSelectMsg="请选择市">
+                        </select>
+                    </span>
+                </div>
                 <div class="formControls col-2 col-sm-2" style="position: relative;">
-                  <span class="select-box">
-                   <select name="initDistrictCode" class="select" id="initCountry">
-                       <option value="">请选择区/县</option>
-                   </select>
-                  </span>
+                    <span class="select-box">
+                        <select name="customerDistrictId" class="select" id="initCountry"
+                                ulcValName="district" ulcValId="districtId"  ulcURL="/address/list_district?cityId=" ulcMsg="" ulcList="districtList"
+                                ulcIsFristSelect="true" ulcFristSelectMsg="请选择区/县">
+                        </select>
+                    </span>
                 </div>
-                   <input type="hidden" name="customerArea" id="customerArea">
+                <input type="hidden" name="customerArea" id="customerArea">
            </div>
+
           <div class="row cl" >
              <label class="form-label col-1 col-sm-1"></label>
              <div class="formControls col-2 col-sm-2">
@@ -707,120 +726,15 @@
 <script type="text/javascript" charset="utf-8" src="${path}/common/lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
 
 <#-- 业务脚本JS -->
-<script type="text/javascript" charset="utf-8" src="${path}/common/js/common/UnlimitedLevelContact.js"></script>
 <script type="text/javascript" charset="utf-8" src="${path}/common/js/customer/customer.js"></script>
 
-
 <script>
-
-    $(function(){
-        /*初始化省份*/
-        initProvince();
-        /*监听省份*/
-        $("[name='initProvinceCode']").change(function (){
-            initCity($(this).val());
-        })
-        /*监听城市*/
-        $("[name='initCityCode']").change(function (){
-            initDistrict($(this).val());
-        })
-    })
-    /*初始化省份*/
-    function initProvince() {
-        //默认查询参数为空
-        var provinceListInfo = null;
-        $.ajax({
-            type: "POST",
-            data: {
-                provinceId : provinceListInfo
-            },
-            url: "${path}/admin/customerBasic/query_provinceList",
-            async: true,
-            success: function(data){
-                var html = '<option value="">请选择省份</option>';
-                var id;
-                if (data.returnCode == 200) {
-                    for(var i=0;i<data.returnMsg.provinceList.length;i++){
-                        provinceListInfo = data.returnMsg.provinceList[i];
-                        if(i == 0 ){
-                            id = provinceListInfo.provinceId;
-                        }
-                        html += '<option value="'+ provinceListInfo.provinceId +'">'+ provinceListInfo.province +'</option>';
-                    }
-                }else{
-                    html = '';
-                }
-                $("[name='initProvinceCode']").html(html);
-            },
-            error: function(XmlHttpRequest, textStatus, errorThrown){
-            }
-        });
-    }
-    /*根据省份代号初始化城市*/
-    function initCity(customerProvinceId){
-        var cityListInfo = null;
-        if(customerProvinceId == null || customerProvinceId == ""){
-            var html = '<option value="">请选择城市</option>';
-            $("[name='initCityCode']").html(html);
-        }else{
-            $.ajax({
-                type: "POST",
-                data: {
-                    provinceId : customerProvinceId
-                },
-                url: "${path}/admin/customerBasic/query_cityList",
-                async: true,
-                success: function(data){
-                    var html = '<option value="">请选择城市</option>';
-                    if (data.returnCode == 200) {
-                        for(var i=0;i<data.returnMsg.cityList.length;i++){
-                            cityListInfo = data.returnMsg.cityList[i];
-                            html += '<option value="'+ cityListInfo.cityId +'">'+ cityListInfo.city +'</option>';
-                        }
-                    }else{
-                        html = '';
-                    }
-                    $("[name='initCityCode']").html(html);
-                },
-                error: function(XmlHttpRequest, textStatus, errorThrown){
-                }
-            });
-        }
-    }
-    /*根据省份代号初始化区/县*/
-    function initDistrict(customerCityId){
-        var districtListInfo = null;
-        if(customerCityId == null || customerCityId == ""){
-            var html = '<option value="">请选择区/县</option>';
-            $("[name='initDistrictCode']").html(html);
-        }else{
-            $.ajax({
-                type: "POST",
-                data: {
-                    cityId : customerCityId
-                },
-                url: "${path}/admin/customerBasic/query_districtList",
-                async: true,
-                success: function(data){
-                    var html = '<option value="">请选择区/县</option>';
-                    if (data.returnCode == 200) {
-                        for(var i=0;i<data.returnMsg.districtList.length;i++){
-                            districtListInfo = data.returnMsg.districtList[i];
-                            html += '<option value="'+ districtListInfo.districtId +'">'+ districtListInfo.district +'</option>';
-                        }
-                    }else{
-                        html = '';
-                    }
-                    $("[name='initDistrictCode']").html(html);
-                },
-                error: function(XmlHttpRequest, textStatus, errorThrown){
-                }
-            });
-        }
-    }
+    /*加载TDS地址信息*/
+    var addressUlc = init_address($(".init_address"));
 
     /*是否是修改页面*/
     var isUpdate = false;
+
     /*是否需要回访  只有修改页面才会使用*/
     var customerIsVisit = false;
 
@@ -845,6 +759,9 @@
     /*1:需要有订单    2:不需要有订单*/
     var isNeedSelectOrder = 2;
 
+    /*添加产品的类型 0:全部添加  1:寄回产品添加   2:寄出产品添加 */
+    var productAddType = 0;
+
     /*初始化页面参数*/
     $(function () {
         /* 初始化单选框样式 */
@@ -873,12 +790,12 @@
         $("input[name='customerCounselType']").change(function (){
             allCustomerInfoType = parseInt($(this).val());
             if(allCustomerInfoType == 1){
-//                $("#customer-process-1").iCheck('check');  //设置已解决
+                isNeedSelectOrder = 2;
                 $("#twiceSellEnd").hide();
                 $("#openTheLock").hide();
                 promethodUlc.setUlcById(0,1);
             }else{
-//                $("#customer-process-3").iCheck('check');  //设置换新
+                isNeedSelectOrder = 1;
                 $("#twiceSellEnd").show();
                 $("#openTheLock").show();
                 promethodUlc.setUlcById(0,2);

+ 189 - 292
watero-rst-web/src/main/webapp/WEB-INF/views/cm/customer/update_customer.ftl

@@ -279,7 +279,6 @@
                         <a href="javascript:void(0)" style="margin-left: 200px;" onclick="initComplaintQuestionInfo('ne')">下一页</a>
                     </div>
                 </div>
-
             </div>
 
             <div class="row cl">
@@ -336,43 +335,27 @@
             </div>
 
             <input type="hidden" id="sendProdcues" name="sendProdcuesJson" value="">
-            <input type="hidden" id="sendFittings" name="sendFittingsJson" value="">
             <input type="hidden" id="closedProdcues" name="closedProdcuesJson" value="">
-            <input type="hidden" id="closedFittings" name="closedFittingsJson" value="">
 
-            <div class="row cl">
-                <label class="form-label col-1 col-sm-1">处理类型:</label>
-                <div class="formControls col-10 col-sm-10 skin-minimal">
-                    <div class="radio-box" id="solved">
-                        <input type="radio" id="customer-process-1" value="1" name="customerIsSolve"  <#if customerInfo.customerIsSolve == 1 >checked</#if> >
-                        <label for="customer-process-1">已解决</label>
-                    </div>
-                    <div class="radio-box" id="noSolved">
-                        <input type="radio" id="customer-process-2" value="2" name="customerIsSolve" <#if customerInfo.customerIsSolve == 2 >checked</#if> >
-                        <label for="customer-process-2">未解决</label>
-                    </div>
-                    <div class="radio-box" id="renewed" style="display: none">
-                        <input type="radio" id="customer-process-3" value="3" name="customerIsSolve" <#if customerInfo.customerIsSolve == 3 >checked</#if> >
-                        <label for="customer-process-3">换新</label>
-                    </div>
-                    <div class="radio-box" id="maintain" style="display: none">
-                        <input type="radio" id="customer-process-4" value="4" name="customerIsSolve" <#if customerInfo.customerIsSolve == 4 >checked</#if> >
-                        <label for="customer-process-4">维修</label>
-                    </div>
-                    <div class="radio-box" id="reissue" style="display: none">
-                        <input type="radio" id="customer-process-5" value="5" name="customerIsSolve" <#if customerInfo.customerIsSolve == 5 >checked</#if> >
-                        <label for="customer-process-5">补发</label>
-                    </div>
-                    <div class="radio-box" id="backGoods" style="display: none">
-                        <input type="radio" id="customer-process-6" value="6" name="customerIsSolve" <#if customerInfo.customerIsSolve == 6 >checked</#if> >
-                        <label for="customer-process-6">退货</label>
-                    </div>
-                    <div class="radio-box" id="noReasonBack" style="display: none">
-                        <input type="radio" id="customer-process-7" value="7" name="customerIsSolve" <#if customerInfo.customerIsSolve == 7 >checked</#if> >
-                        <label for="customer-process-7">无理由退货</label>
-                    </div>
+            <input type="hidden" id="customerIsSolve" name="customerIsSolve" value="">
+
+            <div class="row cl init_proMethod" id="" code="returnCode" msg="resultMsg" data="returnMsg" >
+                <label class="form-label col-1 col-sm-1">处理结果:</label>
+                <div class="formControls col-2 col-sm-2">
+                    <span class="select-box">
+                         <select class="select" id="procTypeId" name="procTypeId" ulcId="${procMethod.procTypeId!''}" ulcValName="procTypeName" ulcValId="procTypeId"  ulcURL="/admin/proc/type" msg="" ulcList="list">
+                         </select>
+                     </span>
+                </div>
+                <div class="formControls col-2 col-sm-2">
+                    <span class="select-box">
+                         <select class="select" id="procMethodId" name="procMethodId" ulcId="${procMethod.procMethodId!''}"  ulcValName="procMethodName" ulcValId="procMethodId"  ulcURL="/admin/proc/method?procTypeId=" msg="" ulcList="list" >
+                         </select>
+                     </span>
                 </div>
             </div>
+
+
             <div class="row cl" style="display: none;">
                 <label class="form-label col-1 col-sm-1"></label>
                 <div class="formControls col-10 col-sm-10">
@@ -387,14 +370,14 @@
                     </ul>
                 </div>
             </div>
-            <div class="row cl" id="orderHead" style="display: none;">
+            <div class="row cl orderHead" id="" style="display: none;">
                 <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>订单信息:</label>
                 <div class="formControls col-1 col-sm-1">
                     <button type="button" class="btn btn-primary" id="selectOrder">搜索订单</button>
                 </div>
             </div>
 
-            <div class="row cl" id="order" style="display: none;">
+            <div class="row cl orderHead" id="" style="display: none;">
                 <label class="form-label col-1 col-sm-1"></label>
                 <div class="formControls col-9 col-sm-9 text-c">
                     <table class="table table-border table-bg table-bordered">
@@ -447,12 +430,12 @@
             <input type="hidden" id="orderId" name="salesId" value="">
             <input type="hidden" id="ids" name="ids" value="${ids!''}" >
 
-            <div class="row cl" id="recipientInfoTitle" style="display: none;">
+            <div class="row cl recipientInfo" id="" style="display: none;">
                 <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>收件信息:</label>
                 <div class="formControls col-8 col-sm-8">请先选择订单,系统自动填充姓名,电话和地址信息。</div>
             </div>
 
-            <div class="row cl" id="recipientInfo" style="display: none;">
+            <div class="row cl recipientInfo" id="" style="display: none;">
                 <label class="form-label col-1 col-sm-1"></label>
                 <div class="formControls col-2 col-sm-2">
                     <input type="text" class="input-text" value="${cmRelation.relationSendName!''}" placeholder="填写收件人姓名" id="sendName" name="relationSendName" datatype="/^[\u4e00-\u9fa5]{1,20}$/" errormsg="联系人格式不正确!" >
@@ -464,7 +447,7 @@
                     <input type="text" class="input-text" value="${cmRelation.relationAlipay!''}" placeholder="邮费转账 支付宝账户" id="relationAlipay" name="relationAlipay" errormsg="邮费转账账户!">
                 </div>
             </div>
-            <div class="row cl" id="recipientAddress" style="display: none;">
+            <div class="row cl recipientAddress" id="" style="display: none;">
                 <input type="hidden" id="addressInfo">
                 <label class="form-label col-1 col-sm-1"></label>
                 <div class="formControls col-2 col-sm-2">
@@ -490,68 +473,107 @@
                 <input type="hidden" name="relationSendMergeAddress" id="relationSendMergeAddress">
 
             </div>
-            <div class="row cl" id="recipientAddressText" style="display: none;">
+            <div class="row cl recipientAddress" id="" style="display: none;">
                 <label class="form-label col-1 col-sm-1"></label>
                 <div class="formControls col-5 col-sm-5">
                     <textarea name="relationSendAddress" id="sendAddress" cols="" rows="2" datatype="*" errormsg="收货地址不正确!" class="textarea" placeholder="请填写详细地址,最多支持50字符" onKeyUp="$.Huitextarealength(this,50)">${cmRelation.relationSendAddress!''}</textarea>
                     <span id="addrssMsg"></span>
                 </div>
             </div>
-            <div class="row cl" id="renewedProduct" style="display: none;">
-                <label class="form-label col-1 col-sm-1"><span class="c-red">*</span><span id="relationProduct">换新产品</span>:</label>
+
+            <div class="row cl renewedProduct" id="" style="display: none;">
+                <label class="form-label col-1 col-sm-1"><span class="c-red">*</span><span id="relationProduct">寄回产品</span>:</label>
+                <div class="formControls col-9 col-sm-9 text-c" id="produceSelect">
+                </div>
+            </div>
+
+            <div class="row cl renewedProduct" id="" style="display: none;">
+                <label class="form-label col-1 col-sm-1"></label>
                 <div class="formControls col-9 col-sm-9 text-c" id="produceSelect">
 
                     <table class="table table-border table-bg table-bordered">
                         <thead>
-                            <tr class="text-c" id="table1">
-                                <th style="text-align: center;" width="60">产品名称</th>
-                                <th style="text-align: center;" width="40">产品颜色</th>
-                                <th style="text-align: center;" width="30">数量</th>
-                                <th style="text-align: center;" width="100">机器编码</th>
-                            </tr>
+                        <tr class="text-c" id="table1">
+                            <th style="text-align: center;" width="60">产品名称</th>
+                            <th style="text-align: center;" width="40">产品颜色</th>
+                            <th style="text-align: center;" width="30">数量</th>
+                            <th style="text-align: center;" width="100">机器编码</th>
+                            <th style="text-align: center;" width="30">操作</th>
+                        </tr>
                         </thead>
-                        <tbody id="addProduct">
+                        <tbody id="addBackProduct">
+                        <#if (cmRelation.closedProdcues?size>0)>
+                            <#list cmRelation.closedProdcues as closedProdcues>
+                            <tr>
+                                <td style="text-align: center;">
+                                ${closedProdcues.closedProductName!""}
+                                </td>
+                                <td style="text-align: center;">
+                                ${closedProdcues.closedColorName!""}
+                                </td>
+                                <td style="text-align: center;">
+                                    <input type="text" style="width: 100%;border: none;text-align: center;" class="input-text input-number input-itemNum" value="${closedProdcues.closedProdcueNumber!"0"}"  placeholder="产品数量" onkeyup="keyFun($(this),999,1)" onpaste="keyFun($(this),999,1)">
+                                </td>
+                                <td style="text-align: center;">
+                                    <input type="hidden" class="input-produce-id" value="${closedProdcues.productId}">
+                                    <input type="hidden" class="input-fc-id" value="${closedProdcues.colorId}">
+                                    <input type="hidden" class="input-69code" value="${closedProdcues.colorBar}">
+                                    <input type="text" class="input-text input-number input-code" style="width: 100%;border: none;text-align: center;" value="${closedProdcues.closedProdcueMachineNo!""}" placeholder="机器编号" name="" id="item-${closedProdcues.productId}-${closedProdcues.colorId}" number="${closedProdcues.closedProdcueNumber}"  itemIsSource="1"  onkeyup="keyFunString($(this),30)" onpaste="keyFunString($(this),30)" >
+                                </td>
+                                <td style="text-align: center;" ><a href="javascript:void(0)" onclick="delColor(this)" >删除</a></td>
+                            </tr>
+                            </#list>
+                        <#else >
+                        <tr>
+                            <td style="text-align: center;" colspan="5">选择订单后展示</td>
+                        </tr>
+                        </#if>
+                        </tbody>
+                    </table>
+                </div>
+            </div>
 
-                            <#if (cmRelation.closedProdcues?size>0)>
-                                <#list cmRelation.closedProdcues as closedProdcues>
+            <div class="row cl updateProduct" id="" style="display: none;">
+                <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>寄出产品:</label>
+                <div class="formControls col-9 col-sm-9" ></div>
+            </div>
+
+            <div class="row cl updateProduct" id="" style="display: none;">
+                <label class="form-label col-1 col-sm-1"></label>
+                <div class="formControls col-9 col-sm-9" >
+
+                    <table class="table table-border table-bg table-bordered">
+                        <thead>
+                        <tr class="text-c" id="table2">
+                            <th style="text-align: center;" width="60">产品名称</th>
+                            <th style="text-align: center;" width="40">产品颜色</th>
+                            <th style="text-align: center;" width="30">产品配件</th>
+                            <th style="text-align: center;" width="100">机器编码</th>
+                            <th style="text-align: center;" width="30">操作</th>
+                        </tr>
+                        </thead>
+                        <tbody id="addSendProduct">
+                            <#if (cmRelation.sendProdcues?size>0)>
+                                <#list cmRelation.sendProdcues as sendProdcues>
                                 <tr>
-                                        <td style="text-align: center;">
-                                            ${closedProdcues.closedProductName!""}
-                                        </td>
-                                        <td style="text-align: center;">
-                                            ${closedProdcues.closedColorName!""}
-                                        </td>
-                                        <td style="text-align: center;">
-                                            <input type="text" style="width: 100%;border: none;text-align: center;" class="input-text input-number input-itemNum" value="${closedProdcues.closedProdcueNumber!"0"}"  placeholder="产品数量" onkeyup="keyFun($(this),999,1)" onpaste="keyFun($(this),999,1)">
-                                        </td>
-                                        <td style="text-align: center;">
-                                            <input type="hidden" class="input-produce-id" value="${closedProdcues.productId}">
-                                            <input type="hidden" class="input-fc-id" value="${closedProdcues.colorId}">
-                                            <input type="hidden" class="input-69code" value="${closedProdcues.colorBar}">
-                                            <input type="text" class="input-text input-number input-code" style="width: 100%;border: none;text-align: center;" value="${closedProdcues.closedProdcueMachineNo!""}" placeholder="机器编号" name="" id="item-${closedProdcues.productId}-${closedProdcues.colorId}" number="${closedProdcues.closedProdcueNumber}"  itemIsSource="1"  onkeyup="keyFunString($(this),30)" onpaste="keyFunString($(this),30)" >
-                                        </td>
+                                    <td style="text-align: center;">
+                                    ${sendProdcues.sendProduceName!""}
+                                    </td>
+                                    <td style="text-align: center;">
+                                    ${sendProdcues.sendColorName!""}
+                                    </td>
+                                    <td style="text-align: center;">
+                                        <input type="text" style="width: 100%;border: none;text-align: center;" class="input-text input-number input-itemNum" value="${sendProdcues.sendProdcueNumber!"0"}"  placeholder="产品数量" onkeyup="keyFun($(this),999,1)" onpaste="keyFun($(this),999,1)">
+                                    </td>
+                                    <td style="text-align: center;">
+                                        <input type="hidden" class="input-produce-id" value="${sendProdcues.productId}">
+                                        <input type="hidden" class="input-fc-id" value="${sendProdcues.colorId}">
+                                        <input type="hidden" class="input-69code" value="${sendProdcues.colorBar}">
+                                        <input type="text" class="input-text input-number input-code" style="width: 100%;border: none;text-align: center;" value="${sendProdcues.sendProdcueMachineNo!""}" placeholder="机器编号" name="" id="item-${sendProdcues.productId}-${sendProdcues.colorId}" number="${sendProdcues.sendProdcueNumber}"  itemIsSource="1"  onkeyup="keyFunString($(this),30)" onpaste="keyFunString($(this),30)" >
+                                    </td>
+                                    <td style="text-align: center;" ><a href="javascript:void(0)" onclick="delColor(this)" >删除</a></td>
                                 </tr>
                                 </#list>
-                                <#list cmRelation.closedFittings as closedFittings>
-                                    <tr>
-                                        <td style="text-align: center;">
-                                            ${closedFittings.closedProductName!""}
-                                        </td>
-                                        <td style="text-align: center;">
-                                            ${closedFittings.closedFittingsName!""}
-                                        </td>
-                                        <td style="text-align: center;">
-                                            ${closedFittings.closedFittingNumber!""}
-                                        </td>
-                                        <td style="text-align: center;">
-                                            <input type="hidden" class="input-produce-id" value="${closedFittings.productId}">
-                                            <input type="hidden" class="input-fc-id" value="${closedFittings.fittingsId}">
-                                            <input type="hidden" class="input-69code" value="${closedFittings.colorBar}">
-                                            -
-                                            <input type="hidden" class="input-text input-number" style="width: 100%;border: none;text-align: center;" value="" placeholder="机器编号" name="" id="item-${closedFittings.productId}-${closedFittings.fittingsId}" number="${closedFittings.closedFittingNumber}"  itemIsSource="1"  onkeyup="keyFunString($(this),30)" onpaste="keyFunString($(this),30)" >
-                                        </td>
-                                    </tr>
-                                </#list>
                             <#else >
                                 <tr>
                                     <td style="text-align: center;" colspan="4">选择订单后展示</td>
@@ -561,84 +583,83 @@
                     </table>
                 </div>
             </div>
-                    <div class="row cl" id="customerCostsDiv" style="display: none;">
-                            <label class="form-label col-1 col-sm-1">工厂报价:</label>
-                    <div class="col-2 col-sm-2">
-                            <input type="text" class="input-text trim_input" placeholder="工厂报价" id="relationFactoryCosts" name="relationFactoryCosts" value="${cmRelation.relationFactoryCosts!''}">
-                            </div>
-                            <label class="form-label col-1 col-sm-1">给客户报价:</label>
-                    <div class="col-2 col-sm-2">
-                            <input type="text" class="input-text trim_input" placeholder="客户报价" id="relationCustomerCosts" name="relationCustomerCosts" value="${cmRelation.relationCustomerCosts!''}">
-                            </div>
-                            </div>
-                    <div class="row cl" id="sendInformationTitle">
-                          <label class="form-label col-1 col-sm-1">
-                          <div class="tit-2">寄回信息</div>
-                        </label>
-                       <div class="formControls col-10 col-sm-10">
-                      </div>
-                     </div>
-                        <div class="row cl" id="sendAddressInfo">
-                           <label class="form-label col-1 col-sm-1"></label>
-                        <div class="formControls col-9 col-sm-9" style="height: 250px" id="sendAddressSmsHtml">
-                            <#-- <script id="sendAddressSms" type="text/plain" style="width:983px;height:200px;"></script>
-                                </script>-->
-                         </div>
-                          </div>
-                          <div class="row cl" id="sendAddressByPhone" style="display: none;">
-                       <label class="form-label col-1 col-sm-1"></label>
-                       <div class="formControls col-2 col-sm-2">
-                      <input type="text" class="input-text associated-phone" value="" placeholder="请输入手机号" id="m-phone" name="">
-                        </div>
-                       <div class="formControls col-2 col-sm-2" style="width: 10%">
-                      <input type="button" class="btn btn-primary" value="发短信给用户" onclick="sendPhone('m','m-msg');">
-                     </div>
-                    <div class="formControls col-2 col-sm-2 msg-phone">
-                   <div id="m-msg" style="color: #e00"></div>
+
+            <div class="row cl" id="customerCostsDiv" style="display: none;">
+                <label class="form-label col-1 col-sm-1">工厂报价:</label>
+                <div class="col-2 col-sm-2">
+                    <input type="text" class="input-text trim_input" placeholder="工厂报价" id="relationFactoryCosts" name="relationFactoryCosts" value="${cmRelation.relationFactoryCosts!''}">
                 </div>
-             </div>
-             <div class="row cl">
+                <label class="form-label col-1 col-sm-1">给客户报价:</label>
+                <div class="col-2 col-sm-2">
+                    <input type="text" class="input-text trim_input" placeholder="客户报价" id="relationCustomerCosts" name="relationCustomerCosts" value="${cmRelation.relationCustomerCosts!''}">
+                </div>
+            </div>
+
+            <div class="row cl sendAddressInfo" id="">
+                  <label class="form-label col-1 col-sm-1">
+                  <div class="tit-2">寄回信息</div>
+                </label>
+                <div class="formControls col-10 col-sm-10"></div>
+            </div>
+
+            <div class="row cl sendAddressInfo" id="">
+                <label class="form-label col-1 col-sm-1"></label>
+                <div class="formControls col-9 col-sm-9" style="height: 250px" id="sendAddressSmsHtml">
+                    <#-- <script id="sendAddressSms" type="text/plain" style="width:983px;height:200px;"></script>
+                        </script>-->
+                 </div>
+            </div>
+
+            <div class="row cl" id="sendAddressByPhone" style="display: none;">
+                <label class="form-label col-1 col-sm-1"></label>
+                <div class="formControls col-2 col-sm-2">
+                    <input type="text" class="input-text associated-phone" value="" placeholder="请输入手机号" id="m-phone" name="">
+                </div>
+                <div class="formControls col-2 col-sm-2" style="width: 10%">
+                   <input type="button" class="btn btn-primary" value="发短信给用户" onclick="sendPhone('m','m-msg');">
+                </div>
+                <div class="formControls col-2 col-sm-2 msg-phone">
+                    <div id="m-msg" style="color: #e00"></div>
+                </div>
+            </div>
+
+            <div class="row cl">
                  <label class="form-label col-1 col-sm-1">
                  <div class="tit-2">TDS收集</div></label>
                  <div class="formControls col-10 col-sm-10">
                  </div>
             </div>
-            <div class="row cl" id="TDScollect" style="display: none;">
+
+            <div class="row cl init_address" id="TDScollect" style="" code="returnCode" msg="resultMsg" data="returnMsg">
                 <label class="form-label col-1 col-sm-1"></label>
                 <div class="formControls col-2 col-sm-2" style="position: relative;">
-                    <#--<input type="hidden" name="arrcity_3word" id="arrcity_3word" value="" />
-                    <input style="width: 190px;" placeholder="" class="input-text my-search-input" placeholder="请输入城市名称搜索" type="text" name="arrcity" id="arrcity" value="" />
-                    <div id="suggest" class="ac_results"></div>-->
                     <span class="select-box">
-                        <select name="initProvinceCode" class="select" id="initProvince">
-                            <option value="">请选择省份</option>
+                        <select name="customerProvinceId" class="select" id="initProvince"
+                                ulcValName="province" ulcValId="provinceId" ulcId="${customerInfo.customerProvinceId!''}"  ulcURL="/address/list_province" ulcMsg="" ulcList="provinceList"
+                                ulcIsFristSelect="true" ulcFristSelectMsg="请选择省份">
                         </select>
-				    </span>
+                    </span>
                 </div>
                 <div class="formControls col-2 col-sm-2">
                     <span class="select-box">
-                        <select name="initCityCode" class="select" id="initCity<#--TDSArea-->" <#--name="TDSArea"-->>
-                            <option value="">请选择城市<#--请搜索城市--></option>
+                        <select name="customerCityId" class="select" id="initCity"
+                                ulcValName="city" ulcValId="cityId" ulcId="${customerInfo.customerCityId!''}"  ulcURL="/address/list_city?provinceId=" ulcMsg="" ulcList="cityList"
+                                ulcIsFristSelect="true" ulcFristSelectMsg="请选择市">
                         </select>
                     </span>
                 </div>
                 <div class="formControls col-2 col-sm-2" style="position: relative;">
                     <span class="select-box">
-                        <select name="initDistrictCode" class="select" id="initCountry">
-                            <option value="">请选择区/县</option>
+                        <select name="customerDistrictId" class="select" id="initCountry"
+                                ulcValName="district" ulcValId="districtId" ulcId="${customerInfo.customerDistrictId!''}" ulcURL="/address/list_district?cityId=" ulcMsg="" ulcList="districtList"
+                                ulcIsFristSelect="true" ulcFristSelectMsg="请选择区/县">
                         </select>
-				    </span>
+                    </span>
                 </div>
-                <#--<div class="formControls col-2 col-sm-2">
-				<span class="select-box">
-                    <select name="" class="select" id="TDSArea" name="TDSArea">
-                        <option value="">请搜索城市</option>
-                    </select>
-				</span>
-                </div>-->
                 <input type="hidden" name="customerArea" id="customerArea" value="${customerInfo.customerArea!''}">
-                </div>
-                <div class="row cl" >
+            </div>
+
+            <div class="row cl" >
                  <label class="form-label col-1 col-sm-1"></label>
                 <div class="formControls col-2 col-sm-2">
                     <input type="text" class="input-text" style="width: 156px;" value="${customerInfo.customerInTDS!'0'}" placeholder="进水TDS数值,最大999" id="customerInTDS" name="customerInTDS" onkeyup="TDSLinkage($(this),999)" onpaste="TDSLinkage($(this),999)">
@@ -647,6 +668,7 @@
                     <input type="text" class="input-text" style="width: 156px;" value="${customerInfo.customerOutTDS!'0'}" placeholder="出水TDS数值,最大999" id="customerOutTDS" name="customerOutTDS" onkeyup="TDSLinkage($(this),999)" onpaste="TDSLinkage($(this),999)">
                 </div>
             </div>
+
             <div class="row cl" id="TDScollectShow" /*style="display: none;"*/>
                <!-- <label class="form-label col-1 col-sm-1"></label>
                 <div class="formControls col-6 col-sm-6">
@@ -655,39 +677,20 @@
                 </div>-->
             </div>
 
-
             <div class="row cl">
                  <label class="form-label col-1 col-sm-1">
                  <div class="tit-2">备注信息</div></label>
                   <div class="formControls col-10 col-sm-10">
                   </div>
              </div>
+
              <div class="row cl" id="customerDescDiv">
                  <label class="form-label col-1 col-sm-1"></label>
                     <div class="col-9 col-sm-9">
                   <textarea type="text" placeholder="" id="customerDesc" name="customerDesc" style="width: 100%;height: 80px;">${customerInfo.customerDesc!''}</textarea>
                     </div>
               </div>
-            <div class="row cl" id="updateProduct" style="display: none;">
-                <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>更换产品:</label>
-                <div class="formControls col-9 col-sm-9" >
-
-                    <table class="table table-border table-bg table-bordered">
-                        <thead>
-                            <tr class="text-c" id="table2">
-                                <th style="text-align: center;" width="60">产品名称</th>
-                                <th style="text-align: center;" width="60">产品颜色</th>
-                                <th style="text-align: center;" width="60">产品配件</th>
-                            </tr>
-                        </thead>
-                        <tbody id="back-product">
-
-
-                        </tbody>
-                    </table>
-                </div>
 
-            </div>
             <div class="row cl">
                 <div class="col-2 col-sm-2 col-offset-3">
                     <button class="btn btn-block btn-primary size-XL" type="submit">确认录入</button>
@@ -723,6 +726,9 @@
 
 <script type="text/javascript">
 
+    /*加载TDS地址信息*/
+    var addressUlc = init_address($(".init_address"));
+
     var customerId = "${customerInfo.customerId!''}";
 
     /*是否是修改页面*/
@@ -737,124 +743,21 @@
     var allCustomerInfoType = ${customerInfo.customerCounselType};
 
     /*全局标识当前状态  type : 1 :已解决  2:未解决  3:换新  4:维修  5:补发   6:退货  7:无理由退货*/
-    var allCustomerType = ${customerInfo.customerIsSolve};
-    var allCustomerTypeName = ["已解决","未解决","换新","维修","补发","退货","无理由退货"];
+    <#--var allCustomerType = ${customerInfo.customerIsSolve};-->
+    <#--var allCustomerTypeName = ["已解决","未解决","换新","维修","补发","退货","无理由退货"];-->
+
+    var allProcMethodIsBack = ${procMethod.procMethodIsBack};    //是否需要寄回 1:需要寄回 2:不需要寄回
+    var allProcMethodIsSend = ${procMethod.procMethodIsSend};    //是否需要寄出 1:需要寄出 2:不需要寄出
 
     /*  寄回地址的id */
     var complaint_questionId = 5;
 
     /* 用于判断是否第一次初始化省市区-- 只在选择类型为售后时使用 */
-    var isInitAddress = ${customerInfo.customerIsSolve!''};
+    var isInitAddress = 0;
 
     /*1:需要有订单    2:不需要有订单*/
     var isNeedSelectOrder = ${customerInfo.isNeedSelectOrder};
 
-    $(function(){
-        /*初始化省份*/
-        initProvince();
-        /*监听省份*/
-        $("[name='initProvinceCode']").change(function (){
-            initCity($(this).val());
-        })
-        /*监听城市*/
-        $("[name='initCityCode']").change(function (){
-            initDistrict($(this).val());
-        })
-    })
-    /*初始化省份*/
-    function initProvince() {
-        //默认查询参数为空
-        var provinceListInfo = null;
-        $.ajax({
-            type: "POST",
-            data: {
-                provinceId : provinceListInfo
-            },
-            url: "${path}/admin/customerBasic/query_provinceList",
-            async: true,
-            success: function(data){
-                var html = '<option value="">请选择省份</option>';
-                var id;
-                if (data.returnCode == 200) {
-                    for(var i=0;i<data.returnMsg.provinceList.length;i++){
-                        provinceListInfo = data.returnMsg.provinceList[i];
-                        if(i == 0 ){
-                            id = provinceListInfo.provinceId;
-                        }
-                        html += '<option value="'+ provinceListInfo.provinceId +'">'+ provinceListInfo.province +'</option>';
-                    }
-                }else{
-                    html = '';
-                }
-                $("[name='initProvinceCode']").html(html);
-            },
-            error: function(XmlHttpRequest, textStatus, errorThrown){
-            }
-        });
-    }
-    /*根据省份代号初始化城市*/
-    function initCity(customerProvinceId){
-        var cityListInfo = null;
-        if(customerProvinceId == null || customerProvinceId == ""){
-            var html = '<option value="">请选择城市</option>';
-            $("[name='initCityCode']").html(html);
-        }else{
-            $.ajax({
-                type: "POST",
-                data: {
-                    provinceId : customerProvinceId
-                },
-                url: "${path}/admin/customerBasic/query_cityList",
-                async: true,
-                success: function(data){
-                    var html = '<option value="">请选择城市</option>';
-                    if (data.returnCode == 200) {
-                        for(var i=0;i<data.returnMsg.cityList.length;i++){
-                            cityListInfo = data.returnMsg.cityList[i];
-                            html += '<option value="'+ cityListInfo.cityId +'">'+ cityListInfo.city +'</option>';
-                        }
-                    }else{
-                        html = '';
-                    }
-                    $("[name='initCityCode']").html(html);
-                },
-                error: function(XmlHttpRequest, textStatus, errorThrown){
-                }
-            });
-        }
-    }
-    /*根据省份代号初始化区/县*/
-    function initDistrict(customerCityId){
-        var districtListInfo = null;
-        if(customerCityId == null || customerCityId == ""){
-            var html = '<option value="">请选择区/县</option>';
-            $("[name='initDistrictCode']").html(html);
-        }else{
-            $.ajax({
-                type: "POST",
-                data: {
-                    cityId : customerCityId
-                },
-                url: "${path}/admin/customerBasic/query_districtList",
-                async: true,
-                success: function(data){
-                    var html = '<option value="">请选择区/县</option>';
-                    if (data.returnCode == 200) {
-                        for(var i=0;i<data.returnMsg.districtList.length;i++){
-                            districtListInfo = data.returnMsg.districtList[i];
-                            html += '<option value="'+ districtListInfo.districtId +'">'+ districtListInfo.district +'</option>';
-                        }
-                    }else{
-                        html = '';
-                    }
-                    $("[name='initDistrictCode']").html(html);
-                },
-                error: function(XmlHttpRequest, textStatus, errorThrown){
-                }
-            });
-        }
-    }
-
     /*初始化页面参数*/
     $(function () {
         /* 初始化单选框样式 */
@@ -872,11 +775,14 @@
         /*初始化回访客服*/
         //initVisitSysAdmin();
 
-        /*初始化问题描述*/
+        var promethodUlc = init_ulc($(".init_proMethod"));
+        promethodUlc.setUlcAllCallback(ulcProcessResult);
+
+        /*初始化问题描述 -- 注释将不能展示选中的客诉问题*/
         initQuestionDescribe();
 
         /*初始化选择处理结果 -- type : 1 :已解决  2:未解决  3:换新  4:维修  5:补发   6:退货  7:无理由退货 */
-        initProcessResult(allCustomerType);
+//        initProcessResult(allCustomerType);
 
 
         /*监听来源入口选择事件*/
@@ -893,17 +799,16 @@
         $("input[name='customerCounselType']").change(function (){
             allCustomerInfoType = parseInt($(this).val());
             if(allCustomerInfoType == 1){
-                $("#customer-process-1").iCheck('check');  //设置已解决
+                isNeedSelectOrder = 2;
                 $("#twiceSellEnd").hide();
                 $("#openTheLock").hide();
-                allCustomerType = 1;
+                promethodUlc.setUlcById(0,1);
             }else{
-                $("#customer-process-3").iCheck('check');  //设置换新
+                isNeedSelectOrder = 1;
                 $("#twiceSellEnd").show();
                 $("#openTheLock").show();
-                allCustomerType =3;
+                promethodUlc.setUlcById(0,2);
             }
-            initProcessResult(allCustomerType,allCustomerInfoType);
         })
 
         var ty = parseInt($("input[name='typeId']:checked").val());
@@ -946,18 +851,19 @@
                 default:
                     break;
             }
-            opentionSelectOrder(isOrder);
-        })
+            isNeedSelectOrder = isOrder ;
+            initProcessResult(allProcMethodIsBack,allProcMethodIsSend);
+        });
 
         /*监听处理结果选择事件*/
         $("[name='customerIsSolve']").change(function(){
             initProcessResult(parseInt($(this).val()));
-        })
+        });
 
         /*监听问题类型 选择事件*/
         $("[name='complaintId']").change(function(){
             initComplaintSmallClassInfo($(this).val());
-        })
+        });
 
         /*监听问题关键字搜索*/
         $(document).on('click', '#search_button', function() {
@@ -985,7 +891,6 @@
         /*监听回访类型选择事件  是否需要回访  1:不需要回访  2:需要回复  */
        initVisitEvent();
 
-
         /*监听回访选择客服的选择事件*/
         $(document).on('change', '#visitAdminId', function() {
             var visitAdminName = $("#visitAdminId").find("option:selected").text();
@@ -1001,14 +906,6 @@
         $(document).on('change', '#TDSArea', function() {
             setTDSCollect();
         });
-        /*实时监听文本框-- TDS进水*/
-//        document.getElementById("customerInTDS").addEventListener("input", function(){
-//            setTDSCollect();
-//        });
-        /*实时监听文本框-- TDS出水*/
-//        document.getElementById("customerOutTDS").addEventListener("input", function(){
-//            setTDSCollect();
-//        });
 
         /* 监听手机号 失去焦点时  将其他手机号码未填的 */
         $(".associated-phone").blur(function (){

+ 98 - 98
watero-rst-web/src/main/webapp/common/js/common/UnlimitedLevelContact.js

@@ -1,3 +1,8 @@
+/**
+ * 插件依赖Jquery1.6以上
+ * create:xm
+ *
+ */
 ;(function($,window,document,undefined){
     //定义UnlimitedLevelContact的构造函数
     var UnlimitedLevelContact = function(ele,opt) {
@@ -34,11 +39,14 @@
                 //是否已加载出来值 //默认为否,因为异步初始是没有值的
                 this.isLoad = false;
                 //因为change事件能够重复添加,所以,在这里控制change事件重复问题,导致页面点击一次,调用多次联动
-                this.isLoadChangeEvent = false; //直接删除change,所以弃用
+                this.isLoadChangeEvent = false; //
                 //用于绑定回调函数的调用
-                //this.isBackChangeEvent = false; //直接删除change,所以弃用
+                //this.isBackChangeEvent = false; //弃用
                 //标记为以哪个数据为主  1:id   2:name   默认为1
                 this.dataType = 1;
+
+                this.isContainId = false;
+
                 if(ulc.ulcIsEmpty(this.ulcName)){
                     this.dataType = 2;
                 }
@@ -55,6 +63,9 @@
             this.options.data = new Array(num);
         },
         initUlcHtml : function(level,id,thisId){
+            /*
+            * level 级别    id上一级节点id,作为参数     thisId 本级应该选中的值
+            */
             //初始化联动
             level = Number(level);
             var ulc = this;
@@ -62,97 +73,98 @@
             if(ulc.ulcIsEmpty(thisId)){
                 node.ulcId = thisId;    //当前应该选中的值
             }
-            $.get(ulc.options.urlPrefix + node.ulcURL + id, function(result){
-                $(node.ulcNode).empty();    //清空下拉框
-                if(node.isFristSelect){
-                    $(node.ulcNode).append("<option value=''>"+ node.fristSelectMsg +"</option>");
-                    node.isSelected = 2;
-                }
-                var res = node.repData(result);
-                if (res.code == res.isFlag) {
-                    //数据返回
-                    if(res.data.length < 1 && !node.isFristSelect){
-                        $(node.ulcNode).append("<option value=''></option>");
-                        node.isSelected = 2;
-                    }
-                    var isContainId = false;
-                    $(res.data).each(function (){
-                        var data =  node.parseData(this);
-                        $(node.ulcNode).append("<option value='"+ data.id +"' msg='"+ ulc.ulcCufte(data.msg) +"'>"+ data.val +"</option>");
 
-                        if(node.ulcId == data.id){
-                            isContainId = true;
+            var falg = true;    //标识查询
+            $(node.ulcNode).empty();    //清空下拉框
+            if(node.isFristSelect){    //是否加入首选
+                $(node.ulcNode).append("<option value=''>"+ node.fristSelectMsg +"</option>");
+                node.isSelected = 2;
+                if(level > 0 && ulc.options.ulcLevel[level-1].isSelected == 2 && !ulc.ulcIsEmpty(id) && !ulc.options.ulcLevel[level-1].isContainId){
+                    falg = false;
+                    if(ulc.options.ulcLevel.length-1 > level ) {
+                        ulc.initUlcHtml(level + 1, '', ''); //递归下一级
+                    }
+                }
+            }
+            if(falg){
+                $.get(ulc.options.urlPrefix + node.ulcURL + id, function(result){
+                    var res = node.repData(result);
+                    if (res.code == res.isFlag) {
+                        //数据返回
+                        if(res.data.length < 1 && !node.isFristSelect){
+                            $(node.ulcNode).append("<option value=''></option>");
+                            node.isSelected = 2;
                         }
-                    });
-                    if(isContainId && node.dataType == 1){
-                        /*当ulcId为选项之一,*/
-                        //赋值本下拉框的id
-                        //$(node.ulcNode).val(node.ulcId);
-                        // node.ulcId
-                    }else if(ulc.ulcIsEmpty(node.ulcName) && node.dataType == 2){
-                        node.ulcId = ulc.getUlcIdByName(node);
-                        if(!ulc.ulcIsEmpty(node.ulcId)){
-                            node.ulcId = node.parseData(res.data[0]).id;
+                        node.isContainId = false;
+                        $(res.data).each(function (){
+                            var data =  node.parseData(this);
+                            $(node.ulcNode).append("<option value='"+ data.id +"' msg='"+ ulc.ulcCufte(data.msg) +"'>"+ data.val +"</option>");
+
+                            if(node.ulcId == data.id){
+                                node.isContainId = true;
+                            }
+                        });
+                        var nodeUlcId='';
+                        if(node.isContainId && node.dataType == 1){
+                            nodeUlcId = node.ulcId;
+                        }else if(ulc.ulcIsEmpty(node.ulcName) && node.dataType == 2){
+                            nodeUlcId = ulc.getUlcIdByName(node);
+                            if(!ulc.ulcIsEmpty(node.ulcId) && node.isSelected != 2){
+                                nodeUlcId = node.parseData(res.data[0]).id;
+                            }
+                        }else if(res.data.length > 0 && node.isSelected != 2){
+                            nodeUlcId = node.parseData(res.data[0]).id;
                         }
-                    }else if(res.data.length > 0){
-                        node.ulcId = node.parseData(res.data[0]).id;
-                    }
-                    $(node.ulcNode).val(node.ulcId);
-                    /*  标志已经加载 */
-                    node.isLoad = true;
+                        node.ulcId = nodeUlcId;
+                        $(node.ulcNode).val(nodeUlcId);
 
-                    // $(node.ulcNode).unbind("change"); //移除change
+                        //标志已经加载
+                        node.isLoad = true;
+                        // $(node.ulcNode).unbind("change"); //移除change
 
-                    /* 将每次选中的数据加入到data */
-                    ulc.options.dataList[level] = res.data;
-                    // var valId = $(node.ulcNode).val();
-                    // $(res.data).each(function (){
-                    //     var data =  node.parseData(this);
-                    //     if(valId == data.id){
-                    //         ulc.options.dataList[level] = this;
-                    //     }
-                    // });
+                        /* 将每次选中的数据加入到dataList */
+                        ulc.options.dataList[level] = res.data;
 
-                    /* 绑定事件 */
-                    if(ulc.options.ulcLevel.length-1 > level &&  node.isSelected == 1){
-                        if(!node.isLoadChangeEvent){
-                            $(node.ulcNode).change(function (){
-                                /*点击事件*/
-                                ulc.initUlcHtml(level+1,$(node.ulcNode).val(),ulc.options.ulcLevel[level+1].ulcId);
-                                /*点击事件-触发回调函数*/
-                                ulc.backData(level);
-                            });
-                            /*只需要绑定一次事件*/
-                            node.isLoadChangeEvent = true;
-                        }
-                        var ulcId = ulc.options.ulcLevel[level+1].ulcId,ulcName=ulc.options.ulcLevel[level+1].ulcName;
-                        if(ulc.ulcIsEmpty(ulcName)){
-                            ulcId = ulc.getUlcIdByName(ulc.options.ulcLevel[level+1]);
+                        /* 绑定事件 */
+                        if(ulc.options.ulcLevel.length-1 >= level){
+                            if(!node.isLoadChangeEvent){
+                                $(node.ulcNode).change(function (){
+                                    if(ulc.options.ulcLevel.length-1 > level){
+                                        //点击事件
+                                        ulc.initUlcHtml(level+1,$(node.ulcNode).val(),ulc.options.ulcLevel[level+1].ulcId);
+                                    }else if(ulc.options.ulcLevel.length-1 == level){
+                                        //点击触发回调datalist函数
+                                        ulc.allBackData();
+                                    }
+                                    //点击事件-触发回调函数
+                                    ulc.backData(level);
+                                });
+                                //只需要绑定一次事件
+                                node.isLoadChangeEvent = true;
+                            }
+                            if(ulc.options.ulcLevel.length-1 == level){
+                                // 当前就回调datalist函数
+                                ulc.allBackData();
+                            }
                         }
-                        if(ulc.ulcIsEmpty(ulcId)){
-                            ulcId = ulc.options.ulcLevel[level+1].ulcId;
+                        // 递归查询下一级
+                        if(ulc.options.ulcLevel.length-1 > level ){
+                            var ulcId = ulc.options.ulcLevel[level+1].ulcId,ulcName=ulc.options.ulcLevel[level+1].ulcName;
+                            if(ulc.ulcIsEmpty(ulcName)){
+                                ulcId = ulc.getUlcIdByName(ulc.options.ulcLevel[level+1]);
+                            }
+                            if(ulc.ulcIsEmpty(ulcId)){
+                                ulcId = ulc.options.ulcLevel[level+1].ulcId;
+                            }
+                            ulc.initUlcHtml(level+1,node.ulcId,ulcId);
                         }
-                        ulc.initUlcHtml(level+1,node.ulcId,ulcId);
                     }else{
-                        /*此处为最后一个选项的绑定事件*/
-                        if(!node.isLoadChangeEvent){
-                            $(node.ulcNode).change(function (){
-                                /*点击事件-触发回调函数*/
-                                ulc.backData(level);
-                                ulc.allBackData();
-                            });
-                            /*只需要绑定一次事件*/
-                            node.isLoadChangeEvent = true;
-                        }
-                        /* 选择之后回调所有 */
-                        ulc.allBackData();
+                        console.log(res.msg);
                     }
-                }else{
-                    console.log(res.msg);
-                }
-            }).fail(function () {   //要求jq 1.6以上
-                console.log("查询失败!");
-            });
+                }).fail(function () {   //要求jq 1.6以上
+                    console.log("查询失败!");
+                });
+            }
         },
         setUlcById: function(){
             /**
@@ -299,7 +311,7 @@
             this.options.allCallback(ulc.options.data);
         },
         setUlcCallback:function (fun,level) {
-            /*回调函数设置*/
+            //回调函数设置
             this.options.ulcLevel[level].callback = fun;
         },
         setUlcAllCallback:function (fun) {
@@ -335,8 +347,8 @@
             obj.ulcURL = $ulc.attr("ulcURL");	//url
             obj.ulcId = $ulc.attr("ulcId");	//节点option的value
             obj.ulcName = $ulc.attr("ulcName");
-            obj.isFristSelect = false;	//是否有“请选择项”  false:无
-            obj.fristSelectMsg = "请选择";
+            obj.isFristSelect = $ulc.attr("ulcIsFristSelect");	//是否有“请选择项”  false:无
+            obj.fristSelectMsg = $ulc.attr("ulcFristSelectMsg");
             obj.repData = function(res){ //res 即为原始返回的数据
                 return {
                     "isFlag": 200, //code判断
@@ -361,7 +373,6 @@
     }
 })(jQuery,window,document);
 
-
 /**
  * html初始化插件
  * @param node
@@ -372,20 +383,9 @@ function init_ulc(node){
         urlPrefix: root_path,
         ulcLevel:null
     });
-    // ulc.setUlcCallback(ulcSecc1,0);
-    // ulc.setUlcCallback(ulcSecc,1);
     return ulc;
 };
 
-// function ulcSecc(data) {
-//     console.log(JSON.stringify(data));
-// }
-//
-// function ulcSecc1(data) {
-//     console.log("------"+JSON.stringify(data));
-// }
-//
-// var  ulcLevel = new Array();
 // $(node).find("select").each(function () {
 //     var $ulc = $(this);
 //     var obj = new Object();

+ 15 - 0
watero-rst-web/src/main/webapp/common/js/common/address.js

@@ -168,3 +168,18 @@ function initAddress(addressNode){
     });
     return ulc;
 }
+
+
+/**
+ * html初始化插件
+ * @param node
+ * @returns {jQuery}
+ */
+function init_address(node){
+    var ulc = $(node).initUlcByHtml({
+        urlPrefix: root_path,
+        judgeNameShield : ["省","市","县","乡","镇","市","自治区"],
+        ulcLevel:null
+    });
+    return ulc;
+};

+ 148 - 144
watero-rst-web/src/main/webapp/common/js/customer/customer.js

@@ -393,11 +393,11 @@ function initProduceType(){
                         break;
                 }
                 isNeedSelectOrder = isOrder ;
-                opentionSelectOrder();
+                initProcessResult(allProcMethodIsBack,allProcMethodIsSend);
             })
             /*当前第一个默认选中上朵电动牙刷  isNeedSelectOrder = 2  默认不需要选择订单*/
-            isNeedSelectOrder = 2 ;
-            opentionSelectOrder();
+            // isNeedSelectOrder = 2 ;
+            // initProcessResult(allProcMethodIsBack,allProcMethodIsSend);
         },
         error: function(XmlHttpRequest, textStatus, errorThrown){
         }
@@ -434,15 +434,10 @@ function initProcessResult(procMethodIsBack,procMethodIsSend){
         allCustomerInfoType = $("input[name='customerCounselType']:checked").val();
     }
 
+    otherHied();    //全部隐藏
+
     if(allCustomerInfoType == 1){  //售前
-        $("#renewed").hide();
-        $("#maintain").hide();
-        $("#reissue").hide();
-        $("#backGoods").hide();
-        $("#noReasonBack").hide();
         $("#customerCostsDiv").hide();
-        $("#sendInformationTitle").hide();
-        otherHied();
     }else if(allCustomerInfoType == 2){ //售后
         $("#customerCostsDiv").hide();
         if(!isInitSendAddressSms){
@@ -460,16 +455,11 @@ function initProcessResult(procMethodIsBack,procMethodIsSend){
                 isInitAddress = 1;
             }
         }
-        $("#renewed").show();
-        $("#maintain").show();
-        $("#reissue").show();
-        $("#backGoods").show();
-        $("#noReasonBack").show();
+
         $("#salesChannelsSelect").show();  //展示销售公司
         $("#TDScollect").show();
 
-        if(procMethodIsBack == 2 && procMethodIsSend == 2){ //不需要寄回,不需要寄出就是 已解决,未解决
-            otherHied();
+        if((procMethodIsBack == 2 && procMethodIsSend == 2) || isNeedSelectOrder == 2){ //不需要寄回,不需要寄出就是 已解决,未解决
             visitByType(1);
         }
 
@@ -478,29 +468,21 @@ function initProcessResult(procMethodIsBack,procMethodIsSend){
             $("#customerCostsDiv").hide();  //工厂报价
         }
 
-        if((procMethodIsBack == 1 || procMethodIsSend == 1) && isNeedSelectOrder == 1){  //是否需要寄回 1:需要寄回 2:不需要寄回
-            // result = isSolve.renewed;
-            // resultProductTableTitle = isSolveTitleMsg.renewed;
-            $("#relationProduct").html("产品操作");     //寄回产品
-            $("#processResultStatus").show();
-            $("#orderHead").show();
-            $("#order").show();
-            $("#renewedProduct").show();
-            $("#sendAddressInfo").show();
-            $("#sendAddressByPhone").show();
-            $("#updateProduct").show(); //换新产品
+        if((procMethodIsBack == 1 || procMethodIsSend == 1) && isNeedSelectOrder == 1){  //是否有订单
+            if(procMethodIsBack == 1 ){ //需要寄回
+                $(".renewedProduct").show();
+            }
+            if(procMethodIsSend == 1){  //需要寄出
+                $(".updateProduct").show();
+            }
+            //订单信息
+            $(".orderHead").show();
+            $(".sendAddressInfo").show();
             $("#postageAccount").show();    //邮费转账账户
-            $("#sendInformationTitle").show();
-            $("#sendAddressSmsHtml").show();
 
             //地址信息
-            $("#recipientInfoTitle").show();
-            $("#recipientInfo").show();
-            $("#recipientAddress").show();
-            $("#recipientAddressText").show();
-            $("#renewedProduct").show();
-            $("#updateProduct").show();
-            //地址信息
+            $(".recipientInfo").show();
+            $(".recipientAddress").show();
 
             visitByType(2); //需要回访
             if(customerInfoType == 1){
@@ -512,43 +494,16 @@ function initProcessResult(procMethodIsBack,procMethodIsSend){
             }
         }
     }
-    // for(var i=0;i< result.length;i++){
-    //     var html = statusHtml.replace("status_index",i+1);
-    //     html = html.replace("status_html",result[i]);
-    //     resultHtml += html;
-    // }
-
-    // if(resultProductTableTitle != null && resultProductTableTitle.length > 0){
-    //     /* 根据处理类型来切换 产品列表的列名称 */
-    //     for(var i=0;i<resultProductTableTitle[0].length;i++){
-    //         $("#table1").find("th").eq(i).html(resultProductTableTitle[0][i]);
-    //     }
-    //     for(var i=0;i<resultProductTableTitle[1].length;i++){
-    //         $("#table2").find("th").eq(i).html(resultProductTableTitle[1][i]);
-    //     }
-    // }
-    // $("#processResultStatus").html(resultHtml);
-
-    // opentionSelectOrderDiv();
 }
 
 /*已解决|未解决 */
 function otherHied(customerInfoType){
-    // $("#salesChannelsSelect").show();  //展示销售公司
-    // $("#TDScollect").show();
-    // $("#TDScollectShow").show();
-
-    $("#processResultStatus").hide();   //处理结果的执行状态  已解决未解决没有该信息
-    $("#orderHead").hide();
-    $("#order").hide();
-    $("#recipientInfo").hide();
-    $("#recipientInfoTitle").hide();
-    $("#recipientAddress").hide();
-    $("#recipientAddressText").hide();
-    $("#renewedProduct").hide();
-    $("#sendAddressInfo").hide();
-    $("#sendAddressByPhone").hide();
-    $("#updateProduct").hide();
+    $(".orderHead").hide();
+    $(".recipientInfo").hide();
+    $(".recipientAddress").hide();
+    $(".sendAddressInfo").hide();
+    $(".renewedProduct").hide();
+    $(".updateProduct").hide();
 }
 
 /*初始化问题大类*/
@@ -996,7 +951,6 @@ function setSelectOrder(orderId){
             $("#storeId").val(storeId);
             $("#ids").val(orderId);
             getCompany();
-
             layer.close(index);
         },
         error: function(XmlHttpRequest, textStatus, errorThrown){
@@ -1191,14 +1145,7 @@ function setProduce(orderItemList) {
     var colorHtml = '';
     for(var k=0;k<orderItemList.length;k++){
         var item = orderItemList[k];
-        var fiHidden = "";
-        var fiHtml = "";
-        if(item.itemIsSource == 1){
-            fiHidden = "text"
-        }else{
-            fiHidden = "hidden"
-            fiHtml = "-"
-        }
+        var fiHtml = "-";
         colorHtml += '<tr >'
             + '<td style="text-align: center;" >' + item.itemProductName + '</td>'
             + '<td style="text-align: center;" >' + item.itemProductColor + '</td>'
@@ -1207,14 +1154,24 @@ function setProduce(orderItemList) {
             + '<input type="hidden" class="input-produce-id" value="' + item.itemProductId + '">'
             + '<input type="hidden" class="input-fc-id" value="' + item.itemColorId +'">'
             + '<input type="hidden" class="input-69code" value="' + item.itemColorBar +'">'
-            +  fiHtml
-            + '<input type="'+ fiHidden +'" class="input-text input-number input-code" style="width: 100%;border: none;text-align: center;" value="" placeholder="机器编号" name="" id="item-' + item.itemProductId + '-' + item.itemColorId +'" number="'+ item.itemNum +'" "  onkeyup="keyFunString($(this),30)" onpaste="keyFunString($(this),30)" >'
+            + '<input type="" class="input-text input-number input-code" style="width: 100%;border: none;text-align: center;" value="" placeholder="机器编号" name="" id="item-' + item.itemProductId + '-' + item.itemColorId +'" number="'+ item.itemNum +'" "  onkeyup="keyFunString($(this),30)" onpaste="keyFunString($(this),30)" >'
             + '</td>'
+            + '<td style="text-align: center;" ><a href="javascript:void(0)" onclick="delColor(this)" >删除</a></td>'
             + '</tr>';
     }
-    $("#addProduct").html(colorHtml);
-   // setBackProduct(html);  //设置寄回产品
-    //monitorProduct();   //监听产品变化
+    if(allProcMethodIsBack == 1 ){ //需要寄回
+        $("#addBackProduct").html(colorHtml);
+    }
+    if(allProcMethodIsSend == 1){  //需要寄出
+        $("#addSendProduct").html(colorHtml);
+    }
+}
+
+/**
+ * 删除颜色
+ */
+function delColor(node) {
+    $(node).parent().parent().remove();
 }
 
 /*获取产品*/
@@ -1258,37 +1215,6 @@ function getProduceFittings(productId){
     return produceFittings;
 }
 
-// /*监听产品变化 -- 暂时不用
-// */
-// function monitorProduct(){
-//     /*产品数量*/
-//     $("#addProduct").find(".input-color-number").blur(function (){
-//         setBackProduct();
-//     })
-//     /*产品配件*/
-//     $("#addProduct").find(".input-fittings-number").blur(function (){
-//         setBackProduct();
-//     })
-// }
-
-/*设置寄回产品  -- 暂时不用 */
-// function setBackProduct(html) {
-//     if(html != null && html != "" && typeof(html) != "undefined"){
-//         $("#back-product").html(html);
-//     }else{
-//         $("#addProduct").find(".input-color-number").each(function(){
-//             var number = $(this).val();
-//             var colorNodeId = $(this).attr("id");
-//             $("#back-product").find("#"+colorNodeId).val(number);
-//         })
-//         $("#addProduct").find(".input-fittings-number").each(function(){
-//             var number = $(this).val();
-//             var fittingsNodeId = $(this).attr("id");
-//             $("#back-product").find("#"+fittingsNodeId).val(number);
-//         })
-//     }
-// }
-
 /*设置TDS收集信息*/
 function setTDSCollect(){
     var TDSArea = $("#TDSArea").find("option:selected").text();
@@ -1399,30 +1325,28 @@ function setStore(companyId,node){
  *  1:需要有订单    2:不需要有订单
  */
 function  opentionSelectOrder(){
-    opentionSelectOrderDiv();
+    // opentionSelectOrderDiv();
 }
 
 /**
  * 展示订单
  */
-function opentionSelectOrderDiv(){
-    if(isNeedSelectOrder == 2 || (allProcMethodIsBack == 2 && allProcMethodIsSend == 2) ){        //不展示
-        $("#orderHead").hide();
-        $("#order").hide();
-        $("#renewedProduct").hide();
-        $("#updateProduct").hide();
-    }else{      //展示
-        $("#orderHead").show();
-        $("#order").show();
-        if(allProcMethodIsBack == 1){
-            $("#renewedProduct").show();
-            $("#updateProduct").show();
-        }else{
-            $("#renewedProduct").hide();
-            $("#updateProduct").hide();
-        }
-    }
-};
+// function opentionSelectOrderDiv(){
+//     if(isNeedSelectOrder == 2 || (allProcMethodIsBack == 2 && allProcMethodIsSend == 2) ){        //不展示
+//         $(".orderHead").hide();
+//         $(".renewedProduct").hide();
+//         $(".updateProduct").hide();
+//     }else{      //展示
+//         $(".orderHead").show();
+//         if(allProcMethodIsBack == 1){
+//             $(".renewedProduct").show();
+//             $(".updateProduct").show();
+//         }else{
+//             $(".renewedProduct").hide();
+//             $(".updateProduct").hide();
+//         }
+//     }
+// };
 
 /*===============================客诉提交  -- start -- =============================== */
 $(function(){
@@ -1557,10 +1481,24 @@ function addCustomerReady(){
 
     /* --- 类型:售后   处理结果:维修/换新/补发/退货/无理由退货 -- 处理产品 start---- */
     if(isNeedSelectOrder == 1 &&  (allProcMethodIsBack == 1 || allProcMethodIsSend == 1 ) ) {     //需要订单
-        var sendProdcues = new Array();  //寄出产品表
+        // 寄回
         var closedProdcues = new Array(); //获取寄回,寄出直接复制寄回
+        $("#addBackProduct").find(".input-code").each(function () {
+            var machineNo = $(this).val();    //机器编号
+            var number = $(this).parents("tr").find(".input-itemNum").eq(0).val();    //数量
+            if (number != null && number != "" && number != 0) {
+                var product = new Object();
+                product.colorBar = $(this).parent().find(".input-69code").val();
+                product.sendProdcueNumber = number;
+                product.closedProdcueNumber = number;
+                product.closedProdcueMachineNo = machineNo;
+                closedProdcues.push(product);
+            }
+        });
 
-        $("#addProduct").find(".input-code").each(function () {
+        //寄出
+        var sendProdcues = new Array();  //寄出产品表
+        $("#addSendProduct").find(".input-code").each(function () {
             var machineNo = $(this).val();    //机器编号
             var number = $(this).parents("tr").find(".input-itemNum").eq(0).val();    //数量
             if (number != null && number != "" && number != 0) {
@@ -1569,14 +1507,9 @@ function addCustomerReady(){
                 product.sendProdcueNumber = number;
                 product.closedProdcueNumber = number;
                 product.closedProdcueMachineNo = machineNo;
-                if (allProcMethodIsBack == 1 ){
-                    closedProdcues.push(product);
-                }
-                if (allProcMethodIsSend == 1 ){
-                    sendProdcues.push(product);
-                }
+                sendProdcues.push(product);
             }
-        })
+        });
         $("#sendProdcues").val(JSON.stringify(sendProdcues));
         $("#closedProdcues").val(JSON.stringify(closedProdcues));
     }
@@ -1725,4 +1658,75 @@ function selectOnCustomer() {
         }
     }
 }
-/*根据客户信息查询老的客诉---end--*/
+/*根据客户信息查询老的客诉---end--*/
+
+/**
+ * 添加产品
+ */
+function addProduct(type) {
+    productAddType = type;
+    layer_show("商品列表",url_path + "/admin/salesOrder/to_add_product","1000","500");
+}
+
+
+/**
+ * 选择商品回调
+ * @param colorIds
+ */
+function setSelectProduct(colorIds){
+    var index = layer.load(1, {
+        shade: [0.5,'#fff'] //0.1透明度的白色背景
+    });
+
+    var colorIdArray = colorIds.split("_");
+    for(var i=0;i<colorIdArray.length;i++){
+        var colorId = colorIdArray[i];
+        if(colorId == ""){
+            break;
+        }
+
+        var flag = true;
+        $("#add_product").find("tr").each(function (){
+            var colId = $(this).find(".color_id").eq(0).val();
+            if(colId == colorId){
+                flag  = false;
+            }
+        });
+        if(!flag){
+            continue;
+        }
+        $.ajax({
+            type: "POST",
+            data: { colorId : colorId},
+            url: url_path +"/admin/product/get_product",
+            success: function(data){
+                var html = "";
+                if (data.returnCode == 200 && data.returnMsg.productColorList.length > 0 ) {
+                    for(var i=0;i<data.returnMsg.productColorList.length;i++){
+                        var productColor = data.returnMsg.productColorList[i];
+                        html += '<tr >'
+                            + '<td style="text-align: center;" >' + cufte(productColor.productName) + '</td>'
+                            + '<td style="text-align: center;" >' + cufte(productColor.colorName) + '</td>'
+                            + '<td style="text-align: center;"><input type="text" style="width: 100%;border: none;text-align: center;" class="input-text input-number input-itemNum" value="1"  placeholder="产品数量" onkeyup="keyFun($(this),999,1)" onpaste="keyFun($(this),999,1)"></td>'
+                            + '<td style="text-align: center;" >'
+                            + '<input type="hidden" class="input-produce-id" value="' + productColor.colorProductId + '">'
+                            + '<input type="hidden" class="input-fc-id" value="' + productColor.colorId +'">'
+                            + '<input type="hidden" class="input-69code" value="' + productColor.colorBar +'">'
+                            + '<input type="" class="input-text input-number input-code" style="width: 100%;border: none;text-align: center;" value="" placeholder="机器编号" name="" id="item-' + productColor.colorProductId + '-' + productColor.colorId +'" number="1" "  onkeyup="keyFunString($(this),30)" onpaste="keyFunString($(this),30)" >'
+                            + '</td>'
+                            + '<td style="text-align: center;" ><a href="javascript:void(0)" onclick="delColor(this)" >删除</a></td>'
+                            + '</tr>';
+                    }
+                }else{
+                    layer.msg("添加产品失败!", {icon: 5, time: 3000});
+                }
+                if(productAddType == 2){
+                    $("#addSendProduct").append(html);
+                }else if(productAddType == 1){
+                    $("#addBackProduct").append(html);
+                }
+            }
+        });
+    }
+    layer.close(index);
+}