浏览代码

客诉修改

wangxiaoming 6 年之前
父节点
当前提交
2ff66e6afe

+ 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);
 

+ 159 - 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 =  cmRelationMapper.getCmRelationByCustomerId(customerInfo.getCustomerId());
+
         //删除旧的售后数据
-        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,98 @@ 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());
+        CmRelation cmRelation = customerInfo.getCmRelation();
+        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("-----------添加客诉-添加订单 --------------");
+        }
+        cmRelation.setRelationId(cr.getRelationId());
+        cmRelation.setRelationDesc(cr.getRelationDesc());//备注
+        if (procMethod.getProcMethodIsBack()==2) {
+            cmRelation.setRelationBackStatus(1); //寄回状态 1:未寄回
+            cmRelation.setRelationIsTransfer(0);    //是否已转账邮费
+            cmRelation.setRelationBackPostage(0);   //邮费
+            cmRelation.setRelationBackLogisticsCompany("");//寄回物流公司
+            cmRelation.setRelationBackLogisticsNo("");//寄回物流单号
+            cmRelation.setRelationAlipay("");//转账账户
+            cmRelation.setRelationAlipayName("");//转账账户 (账户姓名)
+        }
+        if (procMethod.getProcMethodIsSend()==2) {
+            cmRelation.setRelationSendStatus(1); //寄送状态 1:未寄送
+            cmRelation.setRelationSendLogisticsCompany("");//寄送物流公司
+            cmRelation.setRelationSendLogisticsNo("");//寄送物流单号
+        }
+        /* 初始化产品类型,名称,配件名称 */
+        customerService.setName(cmRelation);
+        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(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("-----------添加客诉-添加处理与订单关联表--------------");
+        }
 
-            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(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;
     }
 
@@ -485,158 +358,45 @@ 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);
+            flag = salesOrderMapper.updateSalesOrder(newOrder);
+            if(flag < 1){
+                throw new RuntimeException("修改客诉-恢复订单状态,恢复订单状态失败");
+            }
         }
 
         /* 删除掉订单与处理的关联表 */
-        relationOrderService.deleteByRelationId(relationId);
+        flag =  relationOrderService.deleteByRelationId(cmRelation.getRelationId());
+        if(flag < 1){
+            throw new RuntimeException("修改客诉-恢复订单状态,恢复订单状态失败");
+        }
     }
 
     @Override

+ 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());
         }

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

@@ -189,22 +189,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();
@@ -257,7 +241,6 @@ public class AdminCustomerController {
         mv.addObject("complaintQuestionInfo", complaintQuestionInfo);
         mv.addObject("complaintSmallClassInfoList", complaintSmallClassInfoList);
         mv.addObject("complaintTypeInfoList", complaintTypeInfoList);
-        //mv.addObject("questionDescribe", questionDescribe);
         return mv;
     }
 
@@ -907,8 +890,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;
@@ -929,21 +912,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();

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

@@ -550,37 +550,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="initProvinceCode" 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="initCityCode" 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="initDistrictCode" 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 +711,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;
 
@@ -873,12 +772,10 @@
         $("input[name='customerCounselType']").change(function (){
             allCustomerInfoType = parseInt($(this).val());
             if(allCustomerInfoType == 1){
-//                $("#customer-process-1").iCheck('check');  //设置已解决
                 $("#twiceSellEnd").hide();
                 $("#openTheLock").hide();
                 promethodUlc.setUlcById(0,1);
             }else{
-//                $("#customer-process-3").iCheck('check');  //设置换新
                 $("#twiceSellEnd").show();
                 $("#openTheLock").show();
                 promethodUlc.setUlcById(0,2);

+ 139 - 261
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">
@@ -498,7 +481,7 @@
                 </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>
+                <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">
 
                     <table class="table table-border table-bg table-bordered">
@@ -511,7 +494,6 @@
                             </tr>
                         </thead>
                         <tbody id="addProduct">
-
                             <#if (cmRelation.closedProdcues?size>0)>
                                 <#list cmRelation.closedProdcues as closedProdcues>
                                 <tr>
@@ -532,25 +514,48 @@
                                         </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>
+                            <#else >
+                                <tr>
+                                    <td style="text-align: center;" colspan="4">选择订单后展示</td>
+                                </tr>
+                            </#if>
+                        </tbody>
+                    </table>
+                </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="40">产品颜色</th>
+                            <th style="text-align: center;" width="30">产品配件</th>
+                            <th style="text-align: center;" width="100">机器编码</th>
+                        </tr>
+                        </thead>
+                        <tbody id="back-product">
+                            <#if (cmRelation.sendProdcues?size>0)>
+                                <#list cmRelation.sendProdcues as sendProdcues>
+                                <tr>
+                                    <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>
+                                </tr>
                                 </#list>
                             <#else >
                                 <tr>
@@ -561,84 +566,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" 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>
+            </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="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;">
-                    <#--<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="initProvinceCode" class="select" id="initProvince"
+                                ulcValName="province" ulcValId="provinceId"  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="initCityCode" 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 name="initDistrictCode" class="select" id="initCountry"
+                                ulcValName="district" ulcValId="districtId"  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 +651,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 +660,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 +709,9 @@
 
 <script type="text/javascript">
 
+    /*加载TDS地址信息*/
+    var addressUlc = init_address($(".init_address"));
+
     var customerId = "${customerInfo.customerId!''}";
 
     /*是否是修改页面*/
@@ -737,124 +726,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 +758,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 +782,14 @@
         $("input[name='customerCounselType']").change(function (){
             allCustomerInfoType = parseInt($(this).val());
             if(allCustomerInfoType == 1){
-                $("#customer-process-1").iCheck('check');  //设置已解决
                 $("#twiceSellEnd").hide();
                 $("#openTheLock").hide();
-                allCustomerType = 1;
+                promethodUlc.setUlcById(0,1);
             }else{
-                $("#customer-process-3").iCheck('check');  //设置换新
                 $("#twiceSellEnd").show();
                 $("#openTheLock").show();
-                allCustomerType =3;
+                promethodUlc.setUlcById(0,2);
             }
-            initProcessResult(allCustomerType,allCustomerInfoType);
         })
 
         var ty = parseInt($("input[name='typeId']:checked").val());
@@ -946,18 +832,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 +872,6 @@
         /*监听回访类型选择事件  是否需要回访  1:不需要回访  2:需要回复  */
        initVisitEvent();
 
-
         /*监听回访选择客服的选择事件*/
         $(document).on('change', '#visitAdminId', function() {
             var visitAdminName = $("#visitAdminId").find("option:selected").text();
@@ -1001,14 +887,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 (){

+ 95 - 95
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) {
@@ -39,6 +44,9 @@
                 //this.isBackChangeEvent = false; //直接删除change,所以弃用
                 //标记为以哪个数据为主  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(){
             /**
@@ -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;
+};

+ 8 - 11
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){
         }
@@ -460,15 +460,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){ //不需要寄回,不需要寄出就是 已解决,未解决
+        if((procMethodIsBack == 2 && procMethodIsSend == 2) || isNeedSelectOrder == 2){ //不需要寄回,不需要寄出就是 已解决,未解决
             otherHied();
             visitByType(1);
         }
@@ -481,7 +477,7 @@ function initProcessResult(procMethodIsBack,procMethodIsSend){
         if((procMethodIsBack == 1 || procMethodIsSend == 1) && isNeedSelectOrder == 1){  //是否需要寄回 1:需要寄回 2:不需要寄回
             // result = isSolve.renewed;
             // resultProductTableTitle = isSolveTitleMsg.renewed;
-            $("#relationProduct").html("产品操作");     //寄回产品
+            // $("#relationProduct").html("");     //寄回产品
             $("#processResultStatus").show();
             $("#orderHead").show();
             $("#order").show();
@@ -549,6 +545,7 @@ function otherHied(customerInfoType){
     $("#sendAddressInfo").hide();
     $("#sendAddressByPhone").hide();
     $("#updateProduct").hide();
+    $("#sendInformationTitle").hide();
 }
 
 /*初始化问题大类*/
@@ -1399,7 +1396,7 @@ function setStore(companyId,node){
  *  1:需要有订单    2:不需要有订单
  */
 function  opentionSelectOrder(){
-    opentionSelectOrderDiv();
+    // opentionSelectOrderDiv();
 }
 
 /**