瀏覽代碼

添加客户基本信息

dujinyan 7 年之前
父節點
當前提交
cf487b10a2

+ 47 - 0
watero-rst-interface/src/main/java/com/iamberry/rst/faces/customer/CustomerBasicInfoSaveService.java

@@ -0,0 +1,47 @@
+package com.iamberry.rst.faces.customer;
+
+
+import com.iamberry.rst.core.customer.*;
+
+public interface CustomerBasicInfoSaveService {
+
+    /**
+     * 添加客户基本信息
+     *
+     * @param customerBasicInfo
+     * @return
+     */
+    public void saveCustomerBasicInfo(CustomerBasicInfo customerBasicInfo);
+
+    /**
+     * 添加对接联系人信息
+     *
+     * @param dockedContactInfo
+     * @return
+     */
+    public void saveDockedContactInfo(DockedContactInfo dockedContactInfo);
+
+    /**
+     * 添加客户销售渠道备案信息
+     *
+     * @param channelSaleInfo
+     * @return
+     */
+    public void saveChannelSaleInfo(ChannelSaleInfo channelSaleInfo);
+
+    /**
+     * 添加付款/退款信息
+     *
+     * @param billingInfo
+     * @return
+     */
+    public void saveBillingInfo(BillingInfo billingInfo);
+
+    /**
+     * 添加对开票信息
+     *
+     * @param ticketOpeningInfo
+     * @return
+     */
+    public void saveTicketOpeningInfo(TicketOpeningInfo ticketOpeningInfo);
+}

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

@@ -390,7 +390,7 @@
            and customer_create_time <= #{endTime}
         </if>
       </where>
-  </select>
+   </select>
 
 
   <select id="listOnCustomer" parameterType="CustomerInfo" resultMap="customerMap">

+ 31 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/customer/CustomerBasicInfoSaveServiceImpl.java

@@ -0,0 +1,31 @@
+package com.iamberry.rst.service.customer;
+
+import com.iamberry.rst.core.customer.*;
+import com.iamberry.rst.faces.customer.CustomerBasicInfoSaveService;
+
+public class CustomerBasicInfoSaveServiceImpl implements CustomerBasicInfoSaveService {
+    @Override
+    public void saveCustomerBasicInfo(CustomerBasicInfo customerBasicInfo) {
+
+    }
+
+    @Override
+    public void saveDockedContactInfo(DockedContactInfo dockedContactInfo) {
+
+    }
+
+    @Override
+    public void saveChannelSaleInfo(ChannelSaleInfo channelSaleInfo) {
+
+    }
+
+    @Override
+    public void saveBillingInfo(BillingInfo billingInfo) {
+
+    }
+
+    @Override
+    public void saveTicketOpeningInfo(TicketOpeningInfo ticketOpeningInfo) {
+
+    }
+}

+ 45 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/customer/mapper/CustomerBasicInfoSaveMapper.java

@@ -0,0 +1,45 @@
+package com.iamberry.rst.service.customer.mapper;
+
+import com.iamberry.rst.core.customer.*;
+
+public interface CustomerBasicInfoSaveMapper {
+    /**
+     * 添加客户基本信息
+     *
+     * @param customerBasicInfo
+     * @return
+     */
+    public int saveCustomerBasicInfo(CustomerBasicInfo customerBasicInfo);
+
+    /**
+     * 添加对接联系人信息
+     *
+     * @param dockedContactInfo
+     * @return
+     */
+    public void saveDockedContactInfo(DockedContactInfo dockedContactInfo);
+
+    /**
+     * 添加客户销售渠道备案信息
+     *
+     * @param channelSaleInfo
+     * @return
+     */
+    public void saveChannelSaleInfo(ChannelSaleInfo channelSaleInfo);
+
+    /**
+     * 添加付款/退款信息
+     *
+     * @param billingInfo
+     * @return
+     */
+    public void saveBillingInfo(BillingInfo billingInfo);
+
+    /**
+     * 添加对开票信息
+     *
+     * @param ticketOpeningInfo
+     * @return
+     */
+    public void saveTicketOpeningInfo(TicketOpeningInfo ticketOpeningInfo);
+}

+ 72 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/customer/mapper/CustomerBasicInfoSaveMapper.xml

@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.iamberry.rst.service.customer.mapper.CustomerBasicInfoSaveMapper" >
+    <!-- 添加客户基本信息 -->
+    <insert id="saveCustomerBasicInfo" parameterType="CustomerBasicInfo">
+        INSERT INTO
+        tb_rst_customer_basic_info
+        (
+        customer_name, customer_industry, customer_type, cooperative_state, customer_province_code,customer_city_code,
+        customer_address, customer_status, create_date, update_date,id_create_by,customer_remarks
+        )
+        VALUES
+        (
+        #{customerName},#{customerIndustry},#{customerType},#{cooperativeState},#{customerProvinceCode},#{customerCityCode},
+        #{customerAddress},#{customerStatus},NOW(),NOW(),#{idCreateBy},#{customerRemarks}
+        )
+    </insert>
+
+    <!-- 添加对接联系人信息 -->
+    <insert id="saveDockedContactInfo" parameterType="DockedContactInfo">
+        INSERT INTO
+        tb_rst_docked_contact_info
+        (
+        customer_id, contact_name, contact_phone, contact_type, contact_email,create_date
+        )
+        VALUES
+        (
+        #{customerId},#{contactName},#{contactPhone},#{contactType},#{contactEmail},NOW()
+        )
+    </insert>
+
+    <!-- 添加客户销售渠道备案信息 -->
+    <insert id="saveChannelSaleInfo" parameterType="ChannelSaleInfo">
+        INSERT INTO
+        tb_rst_ channel_sale_info
+        (
+        customer_id, channel_division_id, channel_name, promoting_products, supply_price,account_period,create_date
+        )
+        VALUES
+        (
+        #{customerId},#{channelDivisionId},#{channelName},#{promotingProducts},#{supplyPrice},#{accountPeriod},NOW()
+        )
+    </insert>
+
+    <!-- 添加付款/退款信息 -->
+    <insert id="saveBillingInfo" parameterType="BillingInfo">
+        INSERT INTO
+        tb_rst_billing_info
+        (
+        customer_id, account_opening_branch, account_name, account_num, receivables_name,receivables_phone,create_date
+        )
+        VALUES
+        (
+        #{customerId},#{accountOpeningBranch},#{accountName},#{accountNum},#{receivablesName},#{receivablesPhone},NOW()
+        )
+    </insert>
+
+    <!-- 添加对开票信息 -->
+    <insert id="saveTicketOpeningInfo" parameterType="TicketOpeningInfo">
+        INSERT INTO
+        tb_rst_ticket_opening_info
+        (
+        customer_id, ticket_type, account_opening_branch, ticket_opening_account, enterprise_name,
+        taxpayer_identification_num,ticket_opening_phone, enterprise_address, create_date
+        )
+        VALUES
+        (
+        #{customerId},#{ticketType},#{accountOpeningBranch},#{ticketOpeningAccount},#{enterpriseName},
+        #{taxpayerIdentificationNum},#{ticketOpeningPhone},#{enterpriseAddress},NOW()
+        )
+    </insert>
+</mapper>

+ 402 - 0
watero-rst-web/src/main/java/com/iamberry/rst/controllers/customer/CustomerBasicInfoSaveController.java

@@ -0,0 +1,402 @@
+package com.iamberry.rst.controllers.customer;
+
+import com.iamberry.rst.controllers.cm.AdminCustomerController;
+import com.iamberry.rst.core.cm.*;
+import com.iamberry.rst.core.order.ProductType;
+import com.iamberry.rst.core.sys.Admin;
+import com.iamberry.rst.faces.address.AddressService;
+import com.iamberry.rst.faces.cm.*;
+import com.iamberry.rst.faces.customer.CustomerBasicService;
+import com.iamberry.rst.faces.order.EfastOrderService;
+import com.iamberry.rst.faces.product.ProductService;
+import com.iamberry.rst.faces.sms.SmsService;
+import com.iamberry.rst.faces.sys.SysService;
+import com.iamberry.rst.util.CustomerCommonUtil;
+import com.iamberry.rst.util.SmsConfig;
+import com.iamberry.rst.utils.AdminUtils;
+import com.iamberry.rst.utils.OrderNoUtil;
+import com.iamberry.wechat.tools.ResponseJson;
+import net.sf.json.JSONArray;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
+import java.util.List;
+
+@Controller
+@RequestMapping("/admin/CustomerBasic")
+public class CustomerBasicInfoSaveController {
+
+    private Logger logger = LoggerFactory.getLogger(CustomerBasicInfoSaveController.class);
+    @Autowired
+    private CustomerBasicService customerBasicService;
+    @Autowired
+    private CompanyInfoService companyInfoService;
+    @Autowired
+    private StoreInfoService storeInfoService;
+    @Autowired
+    private SalesOrderService salesOrderService;
+    @Autowired
+    private CustomerService customerService;
+    @Autowired
+    private ProductService productService;
+    @Autowired
+    private SysService sysService;
+    @Autowired
+    private ComplaintTypeInfoService complaintTypeInfoService;
+    @Autowired
+    private VisitService visitService;
+    @Autowired
+    private QuestionDescribeService questionDescribeService;
+    @Autowired
+    private RenewedService renewedService;
+    @Autowired
+    private RepairService repairService;
+    @Autowired
+    private BackGoodsService backGoodsService;
+    @Autowired
+    private FittingsInfoService fittingsInfoService;
+    @Autowired
+    private ReissueService reissueService;
+    @Autowired
+    private NoreasonBackService noreasonBackService;
+    @Autowired
+    private ComplaintQuestionInfoService complaintQuestionInfoService;
+    @Autowired
+    private SmsService smsService;
+    @Autowired
+    private ComplaintSignclosedInfoService complaintSignclosedInfoService;
+    @Autowired
+    private ComplaintSmallClassInfoService complaintSmallClassInfoService;
+    @Autowired
+    private CustomerCommonService customerCommonService;
+    @Autowired
+    private AddressService addressService;
+    @Autowired
+    private PostageService postageService;
+    @Autowired
+    private EfastOrderService efastOrderService;
+    @Autowired
+    private RelationOrderService relationOrderService;
+
+    /**
+     * 跳转到添加客户信息页面
+     *
+     * @return
+     */
+    @RequiresPermissions("customer:add:customer")
+    @RequestMapping(value = "/save_customer_info")
+    public ModelAndView toAddCustomer(HttpServletRequest request) {
+        ModelAndView mv = new ModelAndView("customerInfoAdmin/save_customer_info");
+        return mv;
+    }
+
+    /**
+     * 添加客户信息
+     * @param request
+     * @param customerInfo
+     * @param salesOrder
+     * @param customerCommon
+     * @param sendProdcuesJson
+     * @param sendFittingsJson
+     * @param closedProdcuesJson
+     * @param closedFittingsJson
+     * @return
+     * @throws Exception
+     */
+    @ResponseBody
+    @RequiresPermissions("customer:add:customer")
+    @RequestMapping("/save_customer")
+    public ResponseJson addCustomer(HttpServletRequest request, CustomerInfo customerInfo, SalesOrder salesOrder, CustomerCommon customerCommon,
+                                    String sendProdcuesJson, String sendFittingsJson, String closedProdcuesJson, String closedFittingsJson) throws Exception {
+        ResponseJson rjx = this.isValiData(customerInfo);
+        if(rjx.getResultCode() == 500){
+            return rjx;
+        }
+
+        Integer customerIsSolve = customerInfo.getCustomerIsSolve();    //处理类型
+        String phone = customerInfo.getCustomerTel();       //手机号码
+        Integer typeCompany = customerInfo.getTypeCompany();    // 所属商城   1:美国watero; 2:上朵电动牙刷  3:优尼雅净水机
+
+        Integer flag = 0;
+        if(customerInfo.getIsNeedSelectOrder() == 1){ ////1:需要有订单    2:不需要有订单
+            JSONArray jsonArray;
+            List<SendProdcue> sendProdcueList;
+            List<SendFitting> sendFittingList;
+            List<ClosedProdcue> closedProdcueList;
+            List<ClosedFitting> closedFittingList;
+
+            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);
+        }
+
+        customerInfo.setCustomerCommon(customerCommon);
+        String orderId = "";
+        if (customerInfo.getCustomerIsSolve() == 3 || customerInfo.getCustomerIsSolve() == 4 || customerInfo.getCustomerIsSolve() == 5) {
+            Integer adminId = AdminUtils.getLoginAdminId();
+            orderId = OrderNoUtil.createOrderCode(adminId);
+        }
+        customerInfo.setTransactionNumber(orderId);
+
+        Integer customerId = customerInfo.getCustomerId();
+        logger.info("-----------------添加客诉开始----------------------");
+        try {
+            flag = customerService.saveCustomerInfo(customerInfo, salesOrder);
+        } catch (RuntimeException e) {
+            return new ResponseJson(500, e.getMessage(), 500);
+        }
+        customerId = customerInfo.getCustomerId();
+        logger.info("-----------------添加客诉结束----------------------");
+        if (flag < 1) {
+            return new ResponseJson(500, "添加客诉失败!", 500);
+        }
+        String msg = "";
+        //处理结果: 1:已解决  2:未解决 3:换新  4:维修 5:补发 6:退货 7:无理由退货
+        if (customerIsSolve == 3 || customerIsSolve == 4 || customerIsSolve == 5 || customerIsSolve == 6 || customerIsSolve == 7) {
+            String solveMsg = "";
+            switch (customerIsSolve) {
+                case 3:
+                    solveMsg = "为您更换新机";
+                    break;
+                case 4:
+                    solveMsg = "为您维修机器";
+                    break;
+                case 5:
+                    solveMsg = "为您补发产品";
+                    break;
+                case 6:
+                    solveMsg = "为您办理退货";
+                    break;
+                case 7:
+                    solveMsg = "为您办理退货";
+                    break;
+            }
+
+            String addCustomerSuccessMsg = "";
+            String typeMsg = "";
+            switch (typeCompany) {
+                case 1:
+                    addCustomerSuccessMsg = SmsConfig.ADD_CUSTOMER_SUCCESS_WATERO;
+                    typeMsg = "美国WaterO售后";
+                    break;
+                case 2:
+                    addCustomerSuccessMsg = SmsConfig.ADD_CUSTOMER_SUCCESS_SHANGDUO;
+                    typeMsg = "上朵售后";
+                    break;
+                case 3:
+                    addCustomerSuccessMsg = SmsConfig.ADD_CUSTOMER_SUCCESS_YULIA;
+                    typeMsg = "YULIA售后";
+                    break;
+                case 4:
+                    addCustomerSuccessMsg = SmsConfig.ADD_CUSTOMER_SUCCESS_AIBERLE;
+                    typeMsg = "爱贝源售后";
+                    break;
+            }
+            msg = ",请前往Efast进行换货/退货操作。";
+        }
+        return new ResponseJson(200, "录入客诉成功!客诉编号:" + customerId + msg, 200);
+    }
+
+
+    /**
+     * 跳转到修改客户信息页面
+     *
+     * @return
+     */
+    @RequiresPermissions("customer:update:customer")
+    @RequestMapping(value = "/update_customer_info")
+    public ModelAndView updateCustomerInfo(HttpServletRequest request,Integer customerId) {
+        ModelAndView mv = new ModelAndView("customerInfoAdmin/update_customer_info");
+
+        ProductType productType = new ProductType();
+        //查询产品类型集合
+        List<ProductType> typeList = productService.listProductType(productType);
+        //查询客诉类型集合
+        List<ComplaintTypeInfo> complaintTypeList = complaintTypeInfoService.listComplaintTypeInfo(new ComplaintTypeInfo());
+        //查询跟进客服集合
+        Admin admin = new Admin();
+        admin.setAdminDept(3);
+        admin.setAdminStatus(1);
+        List<Admin> adminList = sysService.listSelectAdmin(admin);
+        //获取登录人id
+        Integer loginAdminId = AdminUtils.getLoginAdminId();
+        //查询客诉基本信息
+        CustomerInfo customerInfo = customerService.getCustomerInfo(customerId);
+        /*客诉信息处理-stast*/
+        //对于区域处理
+        if(customerInfo!=null && customerInfo.getCustomerArea() != null){
+//            String[] customerAreaAndCity = customerInfo.getCustomerArea().split("-");
+//            customerInfo.setProvinceName(customerAreaAndCity[0]);
+//            City city
+//            addressService.listCity(customerAreaAndCity[0]);
+//            customerInfo.setCityName(customerAreaAndCity[0]);
+        }
+        /*客诉信息处理-end*/
+        CustomerCommon customerCommon = new CustomerCommon();
+        if(customerInfo.getCustomerIsSolve() != null){
+            switch (customerInfo.getCustomerIsSolve()){   //处理结果: 1:已解决  2:未解决 3:换新  4:维修 5:补发 6:退货 7:无理由退货
+                case 3://获取换新
+                    Renewed renewed = new Renewed();
+                    renewed.setCustomerId(customerInfo.getCustomerId());
+                    renewed = renewedService.getRenewed(renewed);
+                    customerCommon = CustomerCommonUtil.getCustomerCommon(3,renewed);
+                    break;
+                case 4://维修
+                    Repair repair = new Repair();
+                    repair.setCustomerId(customerInfo.getCustomerId());
+                    repair = repairService.getRepair(repair);
+                    customerCommon = CustomerCommonUtil.getCustomerCommon(4,repair);
+                    break;
+                case 5:
+                    Reissue reissue = new  Reissue();
+                    reissue.setCustomerId(customerInfo.getCustomerId());
+                    reissue = reissueService.getReissue(reissue);
+                    customerCommon = CustomerCommonUtil.getCustomerCommon(5,reissue);
+                    break;
+                case 6:
+                    BackGoods backGoods = new  BackGoods();
+                    backGoods.setCustomerId(customerInfo.getCustomerId());
+                    backGoods = backGoodsService.getBackGoods(backGoods);
+                    customerCommon = CustomerCommonUtil.getCustomerCommon(6,backGoods);
+                    break;
+                case 7:
+                    NoreasonBack noreasonBack = new  NoreasonBack();
+                    noreasonBack.setCustomerId(customerInfo.getCustomerId());
+                    noreasonBack = noreasonBackService.getNoreasonBack(noreasonBack);
+                    customerCommon = CustomerCommonUtil.getCustomerCommon(7,noreasonBack);
+                    break;
+            }
+
+            /*查询所有需要寄入寄出的产品*/
+            customerCommon.setCustomerIsSolve(customerInfo.getCustomerIsSolve());
+            customerCommon = customerCommonService.getListProduceAndFitting(customerCommon);
+
+            // 2018/4/18  页面只会给寄回的赋值,在处理方式为补发的情况下,寄出需要赋值到寄回当中
+            if(customerInfo.getCustomerIsSolve() == 5){
+                //售后寄回产品表
+                List<ClosedProdcue> closedProdcues = new ArrayList<ClosedProdcue>();
+                for (SendProdcue sendProdcue : customerCommon.getSendProdcues()) {
+                    ClosedProdcue closedProdcue = new ClosedProdcue();
+                    closedProdcue.setRelationId(sendProdcue.getRelationId());
+                    closedProdcue.setProductType(sendProdcue.getProductType());
+                    closedProdcue.setProductId(sendProdcue.getProductId());
+                    closedProdcue.setColorId(sendProdcue.getColorId());
+                    closedProdcue.setClosedProductName(sendProdcue.getSendProduceName());
+                    closedProdcue.setClosedColorName(sendProdcue.getSendColorName());
+                    closedProdcue.setClosedProdcueNumber(sendProdcue.getSendProdcueNumber());
+                    closedProdcues.add(closedProdcue);
+                }
+                //售后寄回产品配件表
+                List<ClosedFitting> closedFittings = new ArrayList<ClosedFitting>();
+                for (SendFitting sendFitting : customerCommon.getSendFittings()) {
+                    ClosedFitting closedFitting = new ClosedFitting();
+                    closedFitting.setRelationId(sendFitting.getRelationId());
+                    closedFitting.setClosedFittingType(sendFitting.getSendFittingType());
+                    closedFitting.setProductId(sendFitting.getProductId());
+                    closedFitting.setFittingsId(sendFitting.getFittingsId());
+                    closedFitting.setClosedProductName(sendFitting.getSendProductName());
+                    closedFitting.setClosedFittingsName(sendFitting.getSendFittingsName());
+                    closedFitting.setClosedFittingNumber(sendFitting.getSendFittingNumber());
+                    closedFittings.add(closedFitting);
+                }
+                customerCommon.setClosedProdcues(closedProdcues);
+                customerCommon.setClosedFittings(closedFittings);
+            }
+            mv.addObject("customerCommon", customerCommon);
+
+            if(customerInfo.getTypeId() == 1){
+                customerInfo.setIsNeedSelectOrder(2);       //不需要订单
+            }else{
+                customerInfo.setIsNeedSelectOrder(1);
+            }
+
+            if(customerInfo.getTypeId() != 1 && (customerInfo.getCustomerIsSolve() == 3 || customerInfo.getCustomerIsSolve() == 4 || customerInfo.getCustomerIsSolve() == 5 ||
+                    customerInfo.getCustomerIsSolve() == 6 || customerInfo.getCustomerIsSolve() == 7)){
+                RelationOrder relationOrder = new RelationOrder();
+                relationOrder.setRelationType(customerCommon.getCustomerIsSolve());
+                relationOrder.setRelationId(customerCommon.getRelationId());
+                List<RelationOrder> relationOrderList = relationOrderService.getRelationOrderList(relationOrder);
+
+                String[] salesIds = new String[relationOrderList.size()];
+                for (int k=0; k<relationOrderList.size();k++){
+                    salesIds[k] = String.valueOf(relationOrderList.get(k).getSalesId());
+                }
+                SalesOrder so = new SalesOrder();
+                so.setSalesIds(salesIds);
+                List<SalesOrder> orderList = salesOrderService.listSalesOrder(so);
+                for (SalesOrder sor: orderList) {
+                    SalesOrderItem salesOrderItem = new SalesOrderItem();
+                    salesOrderItem.setItemOrderId(sor.getSalesId());
+                    List<SalesOrderItem> salesOrderItemList = salesOrderService.listSalesOrderItem(salesOrderItem);
+                    sor.setSalesOrderItemList(salesOrderItemList);
+                }
+                mv.addObject("salesOrderList", orderList);
+            }else{
+                mv.addObject("salesOrderList", null);
+            }
+        }
+        if ("2".equals(customerInfo.getCustomerIsVisit())){ //1:不需要回访  2:需要回访
+            Visit visit = new Visit();
+            visit.setCustomerId(customerInfo.getCustomerId());
+            visit = visitService.getVisit(visit);
+            mv.addObject("visit", visit);
+        }
+
+        //查询关联问题
+        ComplaintQuestionInfo complaintQuestionInfo = complaintQuestionInfoService.getQuestionById(customerInfo.getQuestionId());
+        //查询问题小类
+        ComplaintSmallClassInfo complaintSmallClassInfo = new ComplaintSmallClassInfo();
+        complaintSmallClassInfo.setComplaintId(complaintQuestionInfo.getComplaintId());
+        List<ComplaintSmallClassInfo> complaintSmallClassInfoList = complaintSmallClassInfoService.listComplaintSmallClassInfo(complaintSmallClassInfo);
+        //查询问题大类
+        ComplaintTypeInfo complaintTypeInfo = new ComplaintTypeInfo();
+        List<ComplaintTypeInfo> complaintTypeInfoList = complaintTypeInfoService.listComplaintTypeInfo(complaintTypeInfo);
+        mv.addObject("customerInfo", customerInfo);
+        mv.addObject("typeList", typeList);
+        mv.addObject("complaintTypeList", complaintTypeList);
+        mv.addObject("complaintTypeList", complaintTypeList);
+        mv.addObject("adminList", adminList);
+        mv.addObject("loginAdminId", loginAdminId);
+        mv.addObject("complaintQuestionInfo", complaintQuestionInfo);
+        mv.addObject("complaintSmallClassInfoList", complaintSmallClassInfoList);
+        mv.addObject("complaintTypeInfoList", complaintTypeInfoList);
+        return mv;
+    }
+
+
+    //方法
+    /**
+     * 验证方法
+     *
+     * @param customerInfo
+     * @return
+     */
+    public ResponseJson isValiData(CustomerInfo customerInfo) {
+        ResponseJson rj = new ResponseJson();
+        if(customerInfo.getAdminId() == null){
+            return new ResponseJson(500, "未填写客诉id", 500);
+        }
+        return rj;
+    }
+}

+ 331 - 0
watero-rst-web/src/main/webapp/WEB-INF/views/customerInfoAdmin/save_customer_info

@@ -0,0 +1,331 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+    <meta charset="utf-8">
+    <meta name="renderer" content="webkit|ie-comp|ie-stand">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
+    <meta http-equiv="Cache-Control" content="no-siteapp" />
+<#include "/base/add_base.ftl">
+    <link href="${path}/common/lib/jquery.ui/jquery-ui.css" rel="stylesheet" type="text/css"/>
+    <link href="${path}/common/lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css"/>
+    <link href="${path}/common/lib/icheck/icheck.css" rel="stylesheet" type="text/css"/>
+
+    <style>
+        .tit{position: relative;text-align: left;font-size: 16px;padding-left: 10px;}
+        .tit:after{content: '';position: absolute;left: 0;top: 20%;height: 60%;width: 3px;background-color: #32a3d8;}
+        .tit-2{position: relative;text-align: left;font-size: 16px;padding-left: 10px;}
+        .tit-2:after{content: '';position: absolute;left: 0;top: 20%;height: 60%;width: 3px;background-color: #32a3d8;}
+        #province select{margin-right:10px; width:100px;height: 31px;-webkit-appearance:none !important;appearance:none;background: url(${path}/common/images/cm/select-1.png) right center no-repeat;background-size: auto 100%;padding-left:3px;padding-right: 25px;}
+
+        #suggest, #suggest2 {width:200px}
+        .gray {color:gray}
+        .ac_results {background:#fff;border:1px solid #7f9db9;position: absolute;z-index: 10000;display: none}
+        .ac_results li a {white-space: nowrap;text-decoration:none;display:block;color:#05a;padding:1px 3px}
+        .ac_results li {border:1px solid #fff}
+        .ac_over, .ac_results li a:hover {background:#c8e3fc}
+        .ac_results li a span {float:right}
+        .ac_result_tip {border-bottom:1px dashed #666;padding:3px}
+
+        .select-box{background: url(${path}/common/images/cm/select-1.png) right center no-repeat;background-size: auto 100%;}
+        .select-box select{-webkit-appearance:none !important;background-color: transparent; appearance:none;padding-right: 25px;}
+        .dalog-ask{position: absolute;left:60%;top:0;-webkit-transform: translateY(-30%);transform: translateY(-30%);display: none;background-color: #fff;z-index: 10;}
+        .tag{ width:300px; min-height:300px; border:1px solid #32a3d8; position:relative;background-color: #fff;line-height: 1.5;padding: 10px 12px;}
+        .tag em{display:block; border-width:15px; position:absolute; top:30%; left:-30px;border-style:solid dashed dashed; border-color:transparent  #32a3d8 transparent transparent;font-size:0; line-height:0;}
+        .dalog-ask .ask{color: #000;margin: 10px 0 5px 0;}
+        .dalog-ask .answer{color: #666;margin-bottom: 10px;}
+        .dalog-ask .answer:hover{color: #32a3d8;cursor: pointer;}
+        .time-line-list{list-style: none;width: 100%;margin-left: -20px;}
+        .time-line-list>li{position: relative;float: left; text-align: center;width: 100px;overflow: hidden;white-space: nowrap;word-break: break-all;padding: 2px 0;}
+        .time-line-list .number{display: inline-block; padding: 2px; background: #32a3d8;border: 2px solid #fff;box-shadow:0 0 0 1px #32a3d8;width: 20px;height: 20px;color: #fff;line-height: 20px;border-radius: 50%;}
+        .time-line-list>li:before{content:'';position: absolute;height: 1px;width: 30%;right:0;top: 15px; background-color: #32a3d8;}
+        .time-line-list>li:after{content: '';position: absolute;height: 1px;width: 30%;left: 0;top: 15px;background:#32a3d8;}
+        .time-line-list>li:first-child:after,.time-line-list>li:last-child:before{display: none;}
+        .time-line-list .arrow{border-width:7px; position:absolute; left:25%; top:9px;border-style:solid dashed dashed; border-color:transparent  transparent  transparent #32a3d8;font-size:0; line-height:0;}
+        .time-line-list>li:first-child .arrow{display: none;}
+        .table-bg th{background-color: #e2f6ff;}
+        .update-parts>span{margin-right: 10px;padding: 3px 4px;background-color: #effaff;border: 1px solid #32a3d8;}
+        .my-search-input{padding-left: 30px;background: url(${path}/common/images/cm/search.png) 6px center no-repeat;background-size: auto 60%; }
+        .input-produce{height: 25px;line-height: 25px}
+        .color-div{height: 30px;}
+
+        .table-td-color{}
+        .msg-phone{height: 35px;line-height: 35px;}
+
+        /*用于邮寄信息的css*/
+        .youxi_xinxi{width: 980px}
+    </style>
+    <title>添加客诉 - 客诉管理 - RST</title>
+</head>
+<body>
+<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
+    <span class="c-gray en">&gt;</span> 客户信息管理
+    <span class="c-gray en">&gt;</span> 新增客户信息
+    <a class="btn radius r"
+       style="line-height:1.6em;margin-top:3px;background: #32a3d8;color: #fff;border:1px solid #32a3d8;"
+       href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
+</nav>
+<article class="page-container" style="padding: 10px;">
+    <div class="pd-20 cl">
+        <form action="${path}/admin/customer/save_customer_info" method="post" class="form form-horizontal" id="form-customerInfoAdmin-add"  onkeydown="if(event.keyCode==13)return false;">
+
+            <input type="hidden" id="isNeedSelectOrder" name="isNeedSelectOrder" value="">
+            <#--客户基本信息-->
+            <div class="row cl">
+                <label class="form-label col-3">
+                    <div class="tit-2">客户基本信息</div>
+                </label>
+                <div class="formControls col-9">
+                </div>
+            </div>
+            <div class="row cl">
+                <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>客户类型:</label>
+                <div class="formControls col-1 col-sm-1">
+                    <span class="select-box" style=" width: 625px;">
+                        <select name="adminId" id="adminId" class="select">
+                        </select>
+				    </span>
+                </div>
+                <label class="form-label col-1 col-sm-2"><span class="c-red">*</span>合作进度:</label>
+                <div class="formControls col-1 col-sm-1">
+                    <span class="select-box" style=" width: 625px;">
+                        <select name="adminId" id="adminId" class="select">
+                        </select>
+				    </span>
+                </div>
+                <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>客户名称:</label>
+                <div class="formControls col-2 col-sm-2 skin-minimal">
+                    <input type="text" class="input-text trim_input" placeholder="公司/客户 全称" id="customerWechatName" name="customerWechatName" value="">
+                </div>
+                <label class="form-label col-1 col-sm-2">客户行业:</label>
+                <div class="formControls col-2 col-sm-2 skin-minimal">
+                    <input type="text" class="input-text trim_input" placeholder="请输入行业名称" id="customerName" name="customerName" value="">
+                </div>
+                <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>客户地址:</label>
+                <div class="formControls col-2 col-sm-2 skin-minimal">
+                    <#--省份-->
+                    <span class="select-box" style=" width: 625px;">
+                        <select name="adminId" id="adminId" class="select">
+                        </select>
+				    </span>
+                    <#--城市-->
+                    <span class="select-box" style=" width: 625px;">
+                        <select name="adminId" id="adminId" class="select">
+                        </select>
+				    </span>
+                    <#--详细地址-->
+                    <input type="text" class="input-text trim_input" placeholder="请输入客户的详细地址" id="customerWechatName" name="customerWechatName" value="">
+                </div>
+            </div>
+            <#--对接联系人信息-->
+            <div class="row cl">
+                <label class="form-label col-3">
+                    <div class="tit-2">对接联系人信息<span style="font-family:'Arial Normal', 'Arial';font-weight:400;font-size:14px;">(请确保真实性,公司将不定期抽验回访)</span></div>
+                </label>
+                <div class="formControls col-9">
+                </div>
+            </div>
+            <div class="row cl">
+                <div class="formControls col-9">
+                    <input type="text" class="my-input"  style="width:90px;margin-right: 0px; margin-bottom: 10px;" value="${customerInfo.customerId!}" placeholder="联系人姓名" id="customerId" name="customerId">
+                    <input type="text" class="my-input"  style="width:90px;margin-right: 0px;margin-bottom: 10px;" value="${customerInfo.sendLogisticsNo!}" placeholder="联系人电话" id="sendLogisticsNo" name="sendLogisticsNo">
+                    <input type="text" class="my-input"  style="width:90px;margin-right: 0px;margin-bottom: 10px;" value="${customerInfo.customerName!}" placeholder="职位或身份" id="customerName" name="customerName">
+                    <input type="text" class="my-input"  style="width:90px;margin-right: 0px;margin-bottom: 10px;" value="${customerInfo.customerTel!}" placeholder="邮箱" id="customerTel" name="customerTel">
+                    <button type="button" style="cursor:pointer; float: left;height: 35px;margin-right: 30px;margin-bottom: 10px;" class="my-btn-search" onclick="toAddCustomerInfo();">保存</button>
+                </div>
+                <div class="mt-20" style="margin: 20px;">
+                    <table class="table table-border table-bordered table-bg table-hover table-sort">
+                        <thead>
+                        <tr class="text-c">
+                            <th width="100">联系人姓名</th>
+                            <th width="100">联系电话</th>
+                            <th width="100">职位/身份</th>
+                            <th width="100">联系邮箱</th>
+                            <th width="100">操作</th>
+                        </tr>
+                        </thead>
+                        <tbody id="listid">
+                        </tbody>
+                    </table>
+                </div>
+            </div>
+            <#--客户销售渠道信息备案-->
+            <div class="row cl">
+                <label class="form-label col-3">
+                    <div class="tit-2">客户销售渠道信息备案</div>
+                </label>
+                <div class="formControls col-9">
+                </div>
+            </div>
+            <div class="row cl">
+                <div class="formControls col-9">
+                    <input type="text" class="my-input"  style="width:90px;margin-right: 0px; margin-bottom: 10px;" value="${customerInfo.customerId!}" placeholder="客诉编号" id="customerId" name="customerId">
+                    <input type="text" class="my-input"  style="width:90px;margin-right: 0px;margin-bottom: 10px;" value="${customerInfo.sendLogisticsNo!}" placeholder="物流编号" id="sendLogisticsNo" name="sendLogisticsNo">
+                    <input type="text" class="my-input"  style="width:90px;margin-right: 0px;margin-bottom: 10px;" value="${customerInfo.customerName!}" placeholder="请输入姓名" id="customerName" name="customerName">
+                    <input type="text" class="my-input"  style="width:90px;margin-right: 0px;margin-bottom: 10px;" value="${customerInfo.customerTel!}" placeholder="请输入电话号码" id="customerTel" name="customerTel">
+                    <select class="my-select" name="adminId" style="height: 36px;width: 120px;margin: 0px;padding: 12px 10px 6px 15px;margin-bottom: 10px;">
+                        <option value ="">渠道类别</option>
+                        <#if adminList?? &&  (adminList?size > 0) >
+                            <#list adminList as admin>
+                                <option value ="${admin.adminId!}" <#if customerInfo.adminId??><#if customerInfo.adminId ==admin.adminId >selected="selected"</#if></#if>>${admin.adminName!}</option>
+                            </#list>
+                        </#if>
+                    </select>
+                    <select class="my-select" name="adminId" style="height: 36px;width: 120px;margin: 0px;padding: 12px 10px 6px 15px;margin-bottom: 10px;">
+                        <option value ="">渠道类型</option>
+                        <#if adminList?? &&  (adminList?size > 0) >
+                            <#list adminList as admin>
+                                <option value ="${admin.adminId!}" <#if customerInfo.adminId??><#if customerInfo.adminId ==admin.adminId >selected="selected"</#if></#if>>${admin.adminName!}</option>
+                            </#list>
+                        </#if>
+                    </select>
+                    <span>渠道名称<input type="text" class="my-input"  style="width:90px;margin-right: 0px;margin-bottom: 10px;" value="${customerInfo.customerTel!}" placeholder="填写具体店名" id="customerTel" name="customerTel"></span>
+                    <select class="my-select" name="adminId" style="height: 36px;width: 120px;margin: 0px;padding: 12px 10px 6px 15px;margin-bottom: 10px;">
+                        <option value ="">销售产品</option>
+                        <#if adminList?? &&  (adminList?size > 0) >
+                            <#list adminList as admin>
+                                <option value ="${admin.adminId!}" <#if customerInfo.adminId??><#if customerInfo.adminId ==admin.adminId >selected="selected"</#if></#if>>${admin.adminName!}</option>
+                            </#list>
+                        </#if>
+                    </select>
+                    <input type="text" class="my-input"  style="width:90px;margin-right: 0px; margin-bottom: 10px;" value="${customerInfo.customerId!}" placeholder="供货价格" id="customerId" name="customerId">
+                    <select class="my-select" name="adminId" style="height: 36px;width: 120px;margin: 0px;padding: 12px 10px 6px 15px;margin-bottom: 10px;">
+                        <option value ="">供货价格</option>
+                        <#if adminList?? &&  (adminList?size > 0) >
+                            <#list adminList as admin>
+                                <option value ="${admin.adminId!}" <#if customerInfo.adminId??><#if customerInfo.adminId ==admin.adminId >selected="selected"</#if></#if>>${admin.adminName!}</option>
+                            </#list>
+                        </#if>
+                    </select>
+                    <select class="my-select" name="adminId" style="height: 36px;width: 120px;margin: 0px;padding: 12px 10px 6px 15px;margin-bottom: 10px;">
+                        <option value ="">账期</option>
+                        <option value="1" <#if customerInfo.customerSourceType??><#if customerInfo.customerSourceType == 1 >selected="selected"</#if></#if>>先款</option>
+                        <option value="2" <#if customerInfo.customerSourceType??><#if customerInfo.customerSourceType == 2 >selected="selected"</#if></#if>>月结</option>
+                        <option value="3" <#if customerInfo.customerSourceType??><#if customerInfo.customerSourceType == 3 >selected="selected"</#if></#if>>两个月</option>
+                    </select>
+                    <button type="button" style="cursor:pointer; float: left;height: 35px;margin-right: 30px;margin-bottom: 10px;" class="my-btn-search" onclick="toAddCustomerInfo();">保存</button>
+                </div>
+            </div>
+            <#--付款/退款信息-->
+            <div class="row cl">
+                <label class="form-label col-3">
+                    <div class="tit-2">付款/退款信息<span style="font-family:'Arial Normal', 'Arial';font-weight:400;font-size:14px;">(请真实有效,用于财务收款确认或退款业务)</span></div>
+                </label>
+                <div class="formControls col-9">
+                </div>
+            </div>
+            <div class="row cl">
+                <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>开户支行:</label>
+                <div class="formControls col-1 col-sm-1">
+                    <input type="text" class="input-text trim_input" placeholder="开户支行" id="customerName" name="customerName" value="">
+                </div>
+                <label class="form-label col-1 col-sm-2"><span class="c-red">*</span>账户名称:</label>
+                <div class="formControls col-2 col-sm-2 skin-minimal">
+                    <input type="text" class="input-text trim_input" placeholder="账户名称" id="customerName" name="customerName" value="">
+                </div>
+                <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>账号:</label>
+                <div class="formControls col-2 col-sm-2 skin-minimal">
+                    <input type="text" class="input-text trim_input" placeholder="填写账号" id="customerWechatName" name="customerWechatName" value="">
+                </div>
+                <label class="form-label col-1 col-sm-2"><span class="c-red">*</span>收款人姓名:</label>
+                <div class="formControls col-2 col-sm-2 skin-minimal">
+                    <input type="text" class="input-text trim_input" placeholder="收款人姓名" id="customerName" name="customerName" value="">
+                </div>
+                <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>收款人手机:</label>
+                <div class="formControls col-2 col-sm-2 skin-minimal">
+                    <input type="text" class="input-text trim_input" placeholder="收款人手机" id="customerWechatName" name="customerWechatName" value="">
+                </div>
+            </div>
+            <#--开票信息-->
+            <div class="row cl">
+                <label class="form-label col-3">
+                    <div class="tit-2">开票信息</div>
+                </label>
+                <div class="formControls col-9">
+                </div>
+            </div>
+            <div class="row cl">
+                <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>发票类型:</label>
+                <div class="formControls col-1 col-sm-1">
+                        <span class="select-box" style=" width: 625px;">
+                            <select name="adminId" id="adminId" class="select">
+                            </select>
+                        </span>
+                </div>
+                <label class="form-label col-1 col-sm-2"><span class="c-red">*</span>开户支行:</label>
+                <div class="formControls col-2 col-sm-2 skin-minimal">
+                    <input type="text" class="input-text trim_input" placeholder="开户支行名称" id="customerName" name="customerName" value="">
+                </div>
+                <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>开票账户:</label>
+                <div class="formControls col-2 col-sm-2 skin-minimal">
+                    <input type="text" class="input-text trim_input" placeholder="开票账户" id="customerWechatName" name="customerWechatName" value="">
+                </div>
+                <label class="form-label col-1 col-sm-2">企业名称:</label>
+                <div class="formControls col-2 col-sm-2 skin-minimal">
+                    <input type="text" class="input-text trim_input" placeholder="企业名称" id="customerName" name="customerName" value="">
+                </div>
+                <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>纳税人识别号:</label>
+                <div class="formControls col-2 col-sm-2 skin-minimal">
+                    <input type="text" class="input-text trim_input" placeholder="纳税人识别号" id="customerWechatName" name="customerWechatName" value="">
+                </div>
+                <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>开票电话:</label>
+                <div class="formControls col-2 col-sm-2 skin-minimal">
+                    <input type="text" class="input-text trim_input" placeholder="开票电话" id="customerWechatName" name="customerWechatName" value="">
+                </div>
+                <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>企业地址:</label>
+                <div class="formControls col-2 col-sm-2 skin-minimal">
+                    <input type="text" class="input-text trim_input" placeholder="企业地址" id="customerWechatName" name="customerWechatName" value="">
+                </div>
+            </div>
+            <#--客户备注-->
+            <div class="row cl">
+                <label class="form-label col-3">
+                    <div class="tit-2">客户备注</div>
+                </label>
+                <div class="formControls col-9">
+                    <textarea id="customer_remarks"></textarea>
+                </div>
+            </div>
+            <div class="row cl">
+        </form>
+    </div>
+</article>
+
+<script type="text/javascript">
+    var url_path = "${path}";
+</script>
+
+<#--时间控件-->
+<script type="text/javascript" src="${path}/common/lib/My97DatePicker/4.8/WdatePicker.js"></script>
+<script type="text/javascript" src="${path}/common/lib/icheck/jquery.icheck.min.js"></script>
+
+<#--业务js-->
+<script type="text/javascript" src="${path}/common/js/customerSaveAdmin/save_customer_info.js"></script>
+<script>
+    //定义变量
+
+    /*初始化页面参数*/
+    $(function () {
+        /* 初始化单选框样式 */
+        //initCheck();
+
+        /*初始化省份(大类)*/
+        initProvince();
+
+        /*初始化渠道类别(大类)*/
+        initChannelCategory();
+
+        /*监听省份*/
+        $("input[name='customerProvince']").change(function (){
+            initCity($(this).val());
+        })
+
+        /*监听渠道类别*/
+        $("input[name='customerChannelCategory']").change(function (){
+            initChannelType($(this).val());
+        })
+
+</script>
+
+</body>
+</html>

+ 977 - 0
watero-rst-web/src/main/webapp/common/js/customerSaveAdmin/save_customer_info.js

@@ -0,0 +1,977 @@
+/**
+ * 初始化销售渠道
+ */
+getCompany();
+/*===============================TDS 城市加载  -- start -- =============================== */
+$(function(){
+    $("#province").ProvinceCity();
+    $('.skin-minimal input').iCheck({
+        checkboxClass: 'icheckbox-blue',
+        radioClass: 'iradio-blue',
+        increaseArea: '20%'
+    });
+    $("#arrcity").suggest(citys,{hot_list:commoncitys,dataContainer:'#arrcity_3word',onSelect:function(result){
+        console.log($(this)[0].value);
+        $("#city2").click()
+    },
+        attachObject:'#suggest'
+    });
+    $("#city2").suggest(citys,{hot_list:commoncitys,attachObject:"#suggest2"})
+});
+/*===============================TDS 城市加载  -- start -- =============================== */
+
+/*===============================问题回复选择  -- start -- =============================== */
+$(document).on('click', '.dalog-ask .answer', function() {
+
+    initCity();//初始化城市
+    var QA_complaintId = $(this).find(".QA_complaintId").val();
+    var QA_smallClassId = $(this).find(".QA_smallClassId").val();
+    $("select[name='complaintId']").val(QA_complaintId);
+    initChannelType(QA_complaintId,QA_smallClassId); //初始化渠道类型
+
+    var questionId = $(this).find(".quesId").val();
+    var title = $(this).find("span").html();
+    var desc = $(this).find("#questionProfile").html();
+
+    $("#questionId").val(questionId);
+    $("#describeTitle").val(title);
+    UE.getEditor('describeContentText').setContent(desc);
+
+    //$("#answer-textarea").text();
+    $(".dalog-ask").hide(); //隐藏qa
+});
+
+
+
+var isInitSendAddressSms = false;
+
+/*处理结果的执行状态*/
+var isSolve = {
+    solved : [],
+    noSolved : [],
+    renewed : ["录入客诉","督促用户寄回","录入快递单号","仓库收货","换新发货","发货通知用户","收货后回访"],
+    maintain : ["录入客诉","督促用户寄回","录入快递单号","仓库收货","品质检测","产线维修","换新发货","发货通知用户","收货后回访"],
+    reissue : ["录入客诉","生成E订单","督促仓库发货","仓库发货","发货通知用户","收货后回访"],
+    backGoods : ["录入客诉","督促用户寄回","录入快递单号","仓库收货","品质检测","退款","退货完成"],
+    noReasonBack : ["录入客诉","督促用户寄回","录入快递单号","仓库收货","品质检测","退款","退货完成"]
+}
+
+/*处理结果的变更状态  产品列表表头信息*/
+var isSolveTitleMsg = {
+    solved : [[],[]],
+    noSolved : [[],[]],
+    renewed : [["寄回产品","寄回产品颜色","退回产品配件","机器编码"],["寄出产品","寄出产品颜色","寄出产品配件"]],
+    maintain : [["寄回产品","寄回产品颜色","寄回产品配件","机器编码"],["寄出产品","寄出产品颜色","寄出产品配件"]],
+    reissue : [[],["补发产品","补发产品颜色","补发产品配件"]],
+    backGoods : [["退回产品","退回产品颜色","退回产品配件","机器编码"],[]],
+    noReasonBack : [["退回产品","退回产品颜色","退回产品配件","机器编码"],[]]
+}
+/*===============================定义全局变量以及监听事件和初始化  -- end -- =============================== */
+
+/*===============================正则表达式  -- start -- =============================== */
+var phoneReg = /^[1][3,4,5,7,8][0-9]{9}$/;
+var phoneReg2 = /(^[0-9]{3,4}\-[0-9]{3,8}$)|(^[0-9]{3,8}$)|(^\([0-9]{3,4}\)[0-9]{3,8}$)|(^0{0,1}13[0-9]{9}$)/;
+/*===============================正则表达式  -- end -- =============================== */
+
+/*=============================== 页面加载完成启动事件  -- start -- =============================== */
+$(function (){
+    /* 所有trim_input 样式,input框都需要去除前后空格*/
+    $(".trim_input").change(function(){
+        var value = $.trim($(this).val());
+        $(this).val(value);
+    })
+
+    /*监听销售公司选择事件*/
+    $("#selectCompany").change(function (){
+        var companyId = $(this).val();
+        $("#companyId").val(companyId);
+        setStore(companyId,$("#selectStore"));       //获取店铺
+    })
+
+    /*监听店铺选择事件*/
+    $("#selectStore").change(function (){
+        var storeId = $(this).val();
+        $("#storeId").val(storeId);
+    })
+})
+/*===============================页面加载完成启动事件  -- end -- =============================== */
+
+/*用于初始化监听回访信息的展示*/
+function initVisitEvent(){
+    $("input[name='customerIsVisit']").change(function (){
+        if($(this).val() == 2){
+            $("#needToVisit").css("display","block");
+        }else{
+            $("#needToVisit").css("display","none");
+        }
+    })
+}
+
+/*关闭qa*/
+function closeQA(){
+    $(".dalog-ask").hide(); //隐藏qa
+}
+
+/*初始化单选框样式*/
+function initCheck(){
+    $('.skin-minimal input').iCheck({
+        checkboxClass: 'icheckbox-blue',
+        radioClass: 'iradio-blue',
+        increaseArea: '20%'
+    });
+}
+
+/*初始化单选框样式*/
+function initCheckByNode(node){
+    $(node).iCheck({
+        checkboxClass: 'icheckbox-blue',
+        radioClass: 'iradio-blue',
+        increaseArea: '20%'
+    });
+}
+
+/*
+* type 1:不需要回访  2:需要回访
+* */
+function visitByType(type){
+    if(isUpdate &&  customerIsVisit){
+        customerIsVisit = false;
+        return false;
+    }
+    if(1 == type){  //不需要回访
+        $("#customer-visit-2").iCheck('check');  //设置不需要回访
+        $("#needToVisit").css("display","none");
+    }else{
+        $("#customer-visit-1").iCheck('check');  //设置需要回访
+        $("#needToVisit").css("display","block");
+    }
+    initVisitEvent();
+}
+
+function initSysAdmin() {
+    sysAminList = getSysAdmin();
+    var html = "";
+    for(var i=0;i<sysAminList.length;i++){
+        var adminList = sysAminList[i];
+        if(adminId != null && adminId != "" && adminId != 0 && adminId == adminList.adminId ){
+            html += '<option value="'+ adminList.adminId +'" selected>'+ adminList.adminName +'(我)</option>';
+        }else{
+            html += '<option value="'+ adminList.adminId +'">'+ adminList.adminName +'</option>';
+        }
+    }
+    $("#adminId").html(html);
+}
+
+/*初始化回访客服的选择*/
+function initVisitSysAdmin(){
+    var html = "";
+    var flag = false;
+    for(var i=0;i<sysAminList.length;i++){
+        var adminList = sysAminList[i];
+        if(adminId != null && adminId != "" && adminId != 0 && adminId == adminList.adminId ){
+            html += '<option value="'+ adminList.adminId +'" selected>'+ adminList.adminName +'(我)</option>';
+            flag = true;
+        }else{
+            html += '<option value="'+ adminList.adminId +'">'+ adminList.adminName +'</option>';
+        }
+    }
+    $("#visitAdminId").html(html);
+    if(flag){
+        showVisitMsg(1);
+    }
+}
+
+/**
+ * 用于显示回访指派任务提示信息
+ * 1 :自己
+ * 2 :其他人
+ */
+function showVisitMsg(type,adminName) {
+    if(type == 1){
+        $("#visitAdminIdMsg").html("您将为自己指定一个回访任务");
+    }else{
+        $("#visitAdminIdMsg").html("您将为"+ adminName +"指定一个回访任务");
+    }
+}
+
+function getSysAdmin(){
+    if(sysAminList != null && sysAminList.length > 0){
+        return sysAminList;
+    }
+    $.ajax({
+        type: "POST",
+        data: {
+        },
+        url: url_path + "/admin/customer/select_sys_admin",
+        async: false,
+        success: function(data){
+            if (data.returnCode == 200) {
+                sysAminList = data.returnMsg.adminList;
+                adminId = data.returnMsg.adminId;
+            }
+        },
+        error: function(XmlHttpRequest, textStatus, errorThrown){
+        }
+    });
+    return sysAminList;
+}
+
+/*初始化产品类型 --  客诉头部的产品类型单选*/
+function initProduceType(){
+    $.ajax({
+        type: "POST",
+        data: {
+        },
+        url: url_path + "/admin/customer/select_produce_type",
+        success: function(data){
+            var html = "";
+            if (data.returnCode == 200) {
+                var check = "checked";
+                for(var i=0;i<data.returnMsg.productTypeList.length;i++){
+                    var produce = data.returnMsg.productTypeList[i];
+                    html += ' <div class="radio-box">' +
+                        '<input type="radio" class="single_loading"  id="produce-type-'+ i +'" name="typeId" typeCompany="'+ produce.typeCompany +'"  datatype="*" value="'+ produce.typeId +'"  '+ check +' nullmsg="请选择产品类型!" >' +
+                        ' <label for="produce-type-'+ i +'">'+ produce.typeName +'</label>' +
+                        ' </div>';
+                    check = "";
+                }
+            }else{
+                html = '';
+            }
+            $("#produceTypeHtml").html(html);
+            initCheckByNode(".produce_type_html input");
+
+            /*绑定产品类型选择事件*/
+            $("input[name='typeId']").change(function (){
+                var typeId = parseInt($(this).val());
+                var isOrder = 1;
+                switch (typeId){    //1:Soodo电动牙刷   6:WaterO净水机    7:Aiberle净水机    9 :YULIA净水机
+                    case 1:
+                        isOrder = 2;
+                        break;
+                    case 6:
+                        isOrder = 1;
+                        break;
+                    case 7:
+                        isOrder = 1;
+                        break;
+                    case 9:
+                        isOrder = 1;
+                        break;
+                    default:
+                        break;
+                }
+                opentionSelectOrder(isOrder);
+            })
+            /*当前第一个默认选中上朵电动牙刷  isNeedSelectOrder = 2  默认不需要选择订单*/
+            opentionSelectOrder(2);
+        },
+        error: function(XmlHttpRequest, textStatus, errorThrown){
+        }
+    });
+}
+
+/**
+ * 选择处理结果-- 默认选择已解决
+ * type : 1 :已解决  2:未解决  3:换新  4:维修  5:补发   6:退货  7:无理由退货
+ */
+function initProcessResult(type){
+
+    if(type == null || type == ""){
+        type = 1;
+    }
+
+    allCustomerType = type;
+
+    if(allCustomerInfoType == null || allCustomerInfoType == ""){
+        allCustomerInfoType = $("input[name='customerCounselType']:checked").val();
+    }
+
+    var statusHtml = '<li><span class="arrow"></span><div class="number">status_index</div><div>status_html</div></li>';
+    var resultHtml = '';
+    var result = {};
+    var resultProductTableTitle = {};
+
+    $("#solved").show(); //已解决
+    $("#noSolved").show();//未解决
+    if(allCustomerInfoType == 1){  //售前
+        $("#renewed").hide();
+        $("#maintain").hide();
+        $("#reissue").hide();
+        $("#backGoods").hide();
+        $("#noReasonBack").hide();
+
+        switch(type)
+        {
+            case 1:
+                otherHied();
+                visitByType(1);
+                //getCompany();
+                break;
+            case 2:
+                otherHied();
+                visitByType(2);
+                //getCompany();
+                break;
+            default:
+                break;
+        }
+    }else if(allCustomerInfoType == 2){ //售后
+
+        if(!isInitSendAddressSms){
+            initComplaintQuestionInfo("m");
+            isInitSendAddressSms = true;
+        }
+        if(isUpdate){       //修改页面加载省市区
+            setAddressInfo();       //修改页面才会调用
+        }else{
+            /* 在选择售后类型是,直接初始化省市区,使用isInitAddress 变量来判断 */
+            if(isInitAddress == 0){
+                var proId = setPro(null,2);
+                var cityId = setCity(null,proId,2);
+                setDistrict(null,cityId,2);
+                isInitAddress = 1;
+            }
+        }
+
+        $("#renewed").show();
+        $("#maintain").show();
+        $("#reissue").show();
+        $("#backGoods").show();
+        $("#noReasonBack").show();
+        switch(type)
+        {
+            case 1:
+                otherHied();
+                visitByType(1);
+                //getCompany();
+                break;
+            case 2:
+                otherHied();
+                visitByType(2); //需要回访
+                //getCompany();
+                break;
+            case 3: //换新
+                result = isSolve.renewed;
+                resultProductTableTitle = isSolveTitleMsg.renewed;
+                $("#relationProduct").html("换新产品");
+                $("#processResultStatus").show();
+                $("#orderHead").show();
+                $("#order").show();
+                //$("#recipientInfo").show();
+                //$("#recipientInfoTitle").show();
+                //$("#recipientAddress").show();
+                //$("#recipientAddressText").show();
+                $("#renewedProduct").show();
+                $("#TDScollect").show();
+                $("#TDScollectShow").show();
+                $("#sendAddressInfo").show();
+                $("#sendAddressByPhone").show();
+                $("#updateProduct").hide(); //换新产品
+                $("#postageAccount").show();    //邮费转账账户
+                visitByType(2); //需要回访
+                //$("#salesChannelsSelect").hide();  //屏蔽销售公司
+                break;
+            case 4: //维修
+                result = isSolve.maintain;
+                resultProductTableTitle = isSolveTitleMsg.maintain;
+                $("#relationProduct").html("维修产品");
+                $("#processResultStatus").show();
+                $("#orderHead").show();
+                $("#order").show();
+                //$("#recipientInfo").show();
+                //$("#recipientInfoTitle").show();
+                //$("#recipientAddress").show();
+                //$("#recipientAddressText").show();
+                $("#renewedProduct").show();
+                $("#TDScollect").show();
+                $("#TDScollectShow").show();
+                $("#sendAddressInfo").show();
+                $("#sendAddressByPhone").show();
+                $("#updateProduct").hide();//维修产品
+                $("#postageAccount").show();    //邮费转账账户
+                visitByType(2); //需要回访
+                //$("#salesChannelsSelect").hide();  //屏蔽销售公司
+                break;
+            case 5://补发
+                result = isSolve.reissue;
+                resultProductTableTitle = isSolveTitleMsg.reissue;
+                $("#relationProduct").html("补发产品");
+                $("#processResultStatus").show();
+                $("#orderHead").show();
+                $("#order").show();
+                //$("#recipientInfo").show();
+                //$("#recipientInfoTitle").show();
+                // $("#recipientAddress").show();
+                // $("#recipientAddressText").show();
+                $("#renewedProduct").hide();
+                $("#TDScollect").show();
+                $("#TDScollectShow").show();
+                $("#sendAddressInfo").hide();
+                $("#sendAddressByPhone").hide();
+                $("#updateProduct").hide();
+                $("#postageAccount").hide();    //邮费转账账户 -- 隐藏
+                visitByType(2); //需要回访
+                $("#salesChannelsSelect").hide();  //屏蔽销售公司
+                break;
+            case 6: //退货
+                result = isSolve.backGoods;
+                resultProductTableTitle = isSolveTitleMsg.backGoods;
+                $("#relationProduct").html("退货产品");
+                $("#processResultStatus").show();
+                $("#orderHead").show();
+                $("#order").show();
+                // $("#recipientInfo").show();
+                //$("#recipientInfoTitle").show();
+                //$("#recipientAddress").show();
+                //$("#recipientAddressText").show();
+                $("#renewedProduct").show();
+                $("#TDScollect").show();
+                $("#TDScollectShow").show();
+                $("#sendAddressInfo").show();
+                $("#sendAddressByPhone").show();
+                $("#updateProduct").hide();
+                $("#postageAccount").show();    //邮费转账账户
+                visitByType(2); //需要回访
+                //$("#salesChannelsSelect").hide();  //屏蔽销售公司
+                break;
+            case 7://无理由退货
+                result = isSolve.noReasonBack;
+                resultProductTableTitle = isSolveTitleMsg.noReasonBack;
+                $("#relationProduct").html("退货产品");
+                $("#processResultStatus").show();
+                $("#orderHead").show();
+                $("#order").show();
+                //$("#recipientInfo").show();
+                //$("#recipientInfoTitle").show();
+                //$("#recipientAddress").show();
+                //$("#recipientAddressText").show();
+                $("#renewedProduct").show();
+                $("#TDScollect").show();
+                $("#TDScollectShow").show();
+                $("#sendAddressInfo").show();
+                $("#sendAddressByPhone").show();
+                $("#updateProduct").hide();
+                $("#postageAccount").show();    //邮费转账账户
+                visitByType(2); //需要回访
+                //$("#salesChannelsSelect").hide();  //屏蔽销售公司
+                break;
+            default:
+                break;
+        }
+    }
+    for(var i=0;i< result.length;i++){
+        var html = statusHtml.replace("status_index",i+1);
+        html = html.replace("status_html",result[i]);
+        resultHtml += html;
+    }
+
+    if(resultProductTableTitle != null && resultProductTableTitle.length > 0){
+        /* 根据处理类型来切换 产品列表的列名称 */
+        for(var i=0;i<resultProductTableTitle[0].length;i++){
+            $("#table1").find("th").eq(i).html(resultProductTableTitle[0][i]);
+        }
+        for(var i=0;i<resultProductTableTitle[1].length;i++){
+            $("#table2").find("th").eq(i).html(resultProductTableTitle[1][i]);
+        }
+    }
+
+    $("#processResultStatus").html(resultHtml);
+
+    opentionSelectOrderDiv();
+}
+
+/*已解决|未解决 */
+function otherHied(){
+    $("#salesChannelsSelect").show();  //展示销售公司
+    $("#processResultStatus").hide();   //处理结果的执行状态  已解决未解决没有该信息
+    $("#orderHead").hide();
+    $("#order").hide();
+    $("#recipientInfo").hide();
+    $("#recipientInfoTitle").hide();
+    $("#recipientAddress").hide();
+    $("#recipientAddressText").hide();
+    $("#renewedProduct").hide();
+    $("#TDScollect").show();
+    $("#TDScollectShow").show();
+    $("#sendAddressInfo").hide();
+    $("#sendAddressByPhone").hide();
+    $("#updateProduct").hide();
+}
+
+
+/*初始化省份*/
+function initProvince() {
+    //默认为售前咨询
+    //var customerCounselTypeOverall = allCustomerInfoType;
+    var customerChannelCategory = null;
+    $.ajax({
+        type: "POST",
+        data: {
+            complaintConsultingType : customerChannelCategory
+        },
+        url: url_path + "/admin/complaintQuestion/list_complaintType",
+        async: true,
+        success: function(data){
+            var html = '<option value="">请选择省份</option>';
+            var id;
+            if (data.returnCode == 200) {
+                for(var i=0;i<data.returnMsg.complaintTypeInfoList.length;i++){
+                    var complaintTypeInfo = data.returnMsg.complaintTypeInfoList[i];
+                    if(i == 0 ){
+                        id = complaintTypeInfo.complaintId;
+                    }
+                    html += '<option value="'+ complaintTypeInfo.complaintId +'">'+ complaintTypeInfo.complaintClassName +'</option>';
+                }
+            }else{
+                html = '';
+            }
+            $("[name='complaintId']").html(html);
+        },
+        error: function(XmlHttpRequest, textStatus, errorThrown){
+        }
+    });
+}
+
+/*初始化城市*/
+function initCity(complaintId,smallId){
+    if(complaintId == null || complaintId == ""){
+        var html = '<option value="">请选择城市</option>';
+        $("[name='smallClassId']").html(html);
+    }else{
+        $.ajax({
+            type: "POST",
+            data: {
+                complaintId : complaintId
+            },
+            url: url_path + "/admin/complaintQuestion/list_complaintSmallClass",
+            async: true,
+            success: function(data){
+                var html = '<option value="">请选择城市</option>';
+                if (data.returnCode == 200) {
+                    for(var i=0;i<data.returnMsg.complaintSmallClassInfoList.length;i++){
+                        var ComplaintSmallClassInfo = data.returnMsg.complaintSmallClassInfoList[i];
+                        html += '<option value="'+ ComplaintSmallClassInfo.smallClassId +'">'+ ComplaintSmallClassInfo.smallClassName +'</option>';
+                    }
+                }else{
+                    html = '';
+                }
+                $("[name='smallClassId']").html(html);
+
+                if(smallId != null && smallId != "" && typeof(smallId)!="undefined" ){
+                    $("select[name='smallClassId']").val(smallId);
+                }
+            },
+            error: function(XmlHttpRequest, textStatus, errorThrown){
+            }
+        });
+    }
+}
+
+/*初始化渠道类别*/
+function initChannelCategory() {
+    //默认为售前咨询
+    //var customerCounselTypeOverall = allCustomerInfoType;
+    var customerChannelCategory = null;
+    $.ajax({
+        type: "POST",
+        data: {
+            complaintConsultingType : customerChannelCategory
+        },
+        url: url_path + "/admin/complaintQuestion/list_complaintType",
+        async: true,
+        success: function(data){
+            var html = '<option value="">请选择渠道类别</option>';
+            var id;
+            if (data.returnCode == 200) {
+                for(var i=0;i<data.returnMsg.complaintTypeInfoList.length;i++){
+                    var complaintTypeInfo = data.returnMsg.complaintTypeInfoList[i];
+                    if(i == 0 ){
+                        id = complaintTypeInfo.complaintId;
+                    }
+                    html += '<option value="'+ complaintTypeInfo.complaintId +'">'+ complaintTypeInfo.complaintClassName +'</option>';
+                }
+            }else{
+                html = '';
+            }
+            $("[name='complaintId']").html(html);
+        },
+        error: function(XmlHttpRequest, textStatus, errorThrown){
+        }
+    });
+}
+
+/*显示小类*/
+function initChannelType(complaintId,smallId){
+    if(complaintId == null || complaintId == ""){
+        var html = '<option value="">请选择渠道类别</option>';
+        $("[name='smallClassId']").html(html);
+    }else{
+        $.ajax({
+            type: "POST",
+            data: {
+                complaintId : complaintId
+            },
+            url: url_path + "/admin/complaintQuestion/list_complaintSmallClass",
+            async: true,
+            success: function(data){
+                var html = '<option value="">请选择渠道类型</option>';
+                if (data.returnCode == 200) {
+                    for(var i=0;i<data.returnMsg.customerChannelTypeList.length;i++){
+                        var ComplaintSmallClassInfo = data.returnMsg.customerChannelTypeList[i];
+                        html += '<option value="'+ ComplaintSmallClassInfo.smallClassId +'">'+ ComplaintSmallClassInfo.smallClassName +'</option>';
+                    }
+                }else{
+                    html = '';
+                }
+                $("[name='smallClassId']").html(html);
+
+                if(smallId != null && smallId != "" && typeof(smallId)!="undefined" ){
+                    $("select[name='smallClassId']").val(smallId);
+                }
+            },
+            error: function(XmlHttpRequest, textStatus, errorThrown){
+            }
+        });
+    }
+}
+
+
+
+
+/**
+ * 设置市
+ * type  1:搜索订单赋值   2:只查询全部,默认第一个
+ */
+function setCity(cityName,proId,type) {
+    var cityId = '';
+    var city = listCity(proId,"");
+    var selectCity = new Array();
+    if(type == 1){
+        selectCity = listCity(proId,cityName);
+    }
+
+    if(city!=null){
+        var cityHtml = ''
+        for(var i=0;i<city.length;i++){
+            cityHtml += '<option value="'+ city[i].cityId +'">'+ city[i].city +'</option>';
+        }
+        $("#city").html(cityHtml);
+        if(selectCity != null && selectCity.length > 0 ){
+            cityId = selectCity[0].cityId;
+        }else{
+            cityId = city[0].cityId;
+        }
+        $("#city option[value='" + cityId + "']").attr("selected","true");
+    }
+    return cityId;
+}
+
+/*===============================客户信息提交  -- start -- =============================== */
+$(function(){
+    $("#form-customerInfoAdmin-add").Validform({
+        tiptype: function (msg, o, cssctl) {
+            if (o.type == 3) {//失败
+                layer.msg(msg, {icon: 5, time: 3000});
+                $(window).scrollTop(o.obj.offset().top - 40);
+            }
+        },
+        datatype: {//自定义验证类型
+
+        },
+        ignoreHidden: true,
+        tipSweep: true, //若为true,则只在表单提交时验证
+        ajaxPost: true, //异步提交
+        beforeCheck: function (curform) {  //验证通过之前执行的函数
+        },
+        beforeSubmit: function (curform) {  //验证通过之后执行的函数
+            var flag  = addCustomerReady();
+            if(!flag){
+                return false;
+            }
+        },
+        callback: function (data) {//异步回调函数
+            if (data) {
+                var index = layer.alert(data.resultMsg, function (index) {
+                    if (data.resultCode == 200) {
+                        location.href = url_path + "/admin/customer/select_customer_list";
+                    } else if(data.resultCode == 505){
+                        location.href = url_path + "/admin/customer/select_customer_list";
+                    }else {
+                        layer.close(index);
+                    }
+                });
+            }
+        }
+    });
+})
+
+/* 添加客诉的准备 */
+function addCustomerReady(){
+    //保存AQ
+    saveQuestion(2);
+
+    /* 是否需要添加订单,赋值 */
+    $("#isNeedSelectOrder").val(isNeedSelectOrder);
+
+    var phoneFlag = true;
+    $(".associated-phone").each(function () {
+        var phone = $(this).val();
+        if(phone != null && phone != "" && typeof (phone) != "undefined"){
+            if(phone.length != 11){
+                vailErrorMsg($(this),"手机号码格式不正确");
+                phoneFlag = false;
+            }
+            /*if (!phoneReg.test(phone)) {
+                vailErrorMsg($(this),"手机号码格式不正确");
+                phoneFlag = false;
+            }*/
+        }
+    })
+
+    if(!phoneFlag){
+        return false;
+    }
+
+    /*验证来源入口*/
+    var customerSourceType = $("input:radio[name='customerSourceType']:checked").val();
+    if(customerSourceType == 3){
+        var customerSourceOld = $("#customerSourceOld").val();
+        if(customerSourceOld == null || customerSourceOld == "" || typeof(customerSourceOld)=="undefined"){
+            vailErrorMsg($("#customerSourceOld"),"未填写来源入口");
+            return false;
+        }else{
+            $("#customerSource").val(customerSourceOld);
+        }
+    }
+
+    /*根据产品类型,获取来源商城*/
+    var typeCompany = parseInt($("input:radio[name='typeId']:checked").attr("typeCompany"));
+    $("#typeCompany").val(typeCompany);
+
+    /*----TDS收集模块--start-----*/
+    var valicity = $(".ac_result_tip").html();
+    if(valicity == null || valicity == "" || typeof(valicity)=="undefined"){
+        $("#TDSArea").html("");
+    }else if(valicity.indexOf("对不起,找不到") > 0 ){
+        $("#TDSArea").html("");
+        $("#customerArea").val("");
+    }else{
+        var TDSArea = $("#TDSArea").find("option:selected").text();
+        if(TDSArea != null && TDSArea != ""){
+            var area = TDSCity + "-" + TDSArea
+            $("#customerArea").val(area);
+        }
+    }
+    /*----TDS收集模块--end-----*/
+
+    /* 地址拼接  */
+    var province = $("#province").find("option:selected").text();
+    var city = $("#city").find("option:selected").text();
+    var district = $("#district").find("option:selected").text();
+    var relationSendMergeAddress = province + "-" + city + "-" + district;
+    $("#relationSendMergeAddress").val(relationSendMergeAddress);
+    /* 地址拼接  */
+
+    /*----问题描述- start --*/
+    var quId = $("#questionId").val();
+    if(quId == null || quId == ""){
+        vailErrorMsg($("#questionId"),"未保存QA!");
+        return false;
+    }
+    var describeContentText = UE.getEditor('describeContentText').getContent();
+    if(describeContentText == null || describeContentText == ""){
+        //layer.msg("未填写问题描述", {icon: 5, time: 3000});
+        vailErrorMsg($("#describeTitle"),"未填写问题描述");
+        return false;
+    }
+    if(describeContentText.length > 3000){
+        vailErrorMsg($("#describeContent"),"问题回复最大支持3000个字符");
+        return false;
+    }
+    $("#describeContent").val(describeContentText);
+    /*----问题描述--end-----*/
+
+    /*----处理描述- start --*/
+    var describeHandleDescText = UE.getEditor('describeHandleDescText').getContent();
+    if(describeHandleDescText.length > 3000){
+        vailErrorMsg($("#describeHandleDesc"),"问题描述最大支持3000个字符");
+        return false;
+    }
+    $("#describeHandleDesc").val(describeHandleDescText);
+    /*----处理描述--end-----*/
+
+    /* --- 类型:售后   处理结果:维修/换新/补发/退货/无理由退货 -- 处理产品 start---- */
+
+    if(isNeedSelectOrder == 1) {     //需要订单
+
+        var sendProdcues = new Array();  //寄出产品表
+        var sendFittings = new Array();
+        var closedProdcues = new Array();         //获取寄回,寄出直接复制寄回
+        var closedFittings = new Array();         //获取寄回,寄出直接复制寄回
+
+        $("#addProduct").find(".input-number").each(function () {
+            var machineNo = $(this).val();    //机器编号
+            var number = $(this).attr("number");    //机器编号
+            var itemIsSource = $(this).attr("itemissource");    //是否为配件  1:产品颜色表,2:配件表
+            if (number != null && number != "" && number != 0) {
+                var product = new Object();
+                var fittings = new Object();
+                product.productId = $(this).parent().find(".input-produce-id").val();
+                product.colorId = $(this).parent().find(".input-fc-id").val();
+                fittings.productId = $(this).parent().find(".input-produce-id").val();
+                fittings.fittingsId = $(this).parent().find(".input-fc-id").val();
+                if(itemIsSource == 1){ //产品颜色
+                    product.sendProdcueNumber = number;
+                    product.closedProdcueNumber = number;
+                    product.closedProdcueMachineNo = machineNo;
+                    //换新、维修,退货,无理由退货,
+                    if (allCustomerType == 3 || allCustomerType == 4 ){        //换新/维修
+                        sendProdcues.push(product);
+                        closedProdcues.push(product);
+                    }else if(allCustomerType == 6 || allCustomerType == 7){
+                        closedProdcues.push(product);
+                    }else if(allCustomerType == 5){             //补发
+                        sendProdcues.push(product);
+                    }
+                }else{
+                    fittings.sendFittingNumber = number;
+                    fittings.closedFittingNumber = number;
+                    //换新、维修,退货,无理由退货,
+                    if (allCustomerType == 3 || allCustomerType == 4 ) {        //换新/维修
+                        sendFittings.push(fittings);
+                        closedFittings.push(fittings);
+                    }else if(allCustomerType == 6 || allCustomerType == 7){
+                        closedFittings.push(fittings);
+                    }else if(allCustomerType == 5){             //补发
+                        sendFittings.push(fittings);
+                    }
+                }
+            }
+        })
+
+        var backErrorMsg = "请选择一个replace_error_msg寄回的产品或配件并填写一个以上的数量!"
+        var sendErrorMsg = "请选择一个replace_error_msg寄送的产品或配件并填写一个以上的数量!"
+        var process = true;
+        switch (allCustomerType) {
+            case 3:
+                process = processIsEmpty([closedProdcues, closedFittings]);
+                if (!process) {
+                    var msg = backErrorMsg.replace("replace_error_msg", "换新");
+                    layer.msg(msg, {icon: 5, time: 3000});
+                    return false;
+                }
+                process = processIsEmpty([sendProdcues, sendFittings]);
+                if (!process) {
+                    var msg = sendErrorMsg.replace("replace_error_msg", "换新");
+                    layer.msg(msg, {icon: 5, time: 3000});
+                    return false;
+                }
+                break;
+            case 4:
+                process = processIsEmpty([closedProdcues, closedFittings]);
+                if (!process) {
+                    var msg = backErrorMsg.replace("replace_error_msg", "维修");
+                    layer.msg(msg, {icon: 5, time: 3000});
+                    return false;
+                }
+                process = processIsEmpty([sendProdcues, sendFittings]);
+                if (!process) {
+                    var msg = sendErrorMsg.replace("replace_error_msg", "维修");
+                    layer.msg(msg, {icon: 5, time: 3000});
+                    return false;
+                }
+                break;
+            case 5:
+                process = processIsEmpty([sendProdcues, sendFittings]);
+                if (!process) {
+                    var msg = sendErrorMsg.replace("replace_error_msg", "补发");
+                    layer.msg(msg, {icon: 5, time: 3000});
+                    return false;
+                }
+                break;
+            case 6:
+                process = processIsEmpty([closedProdcues, closedFittings]);
+                if (!process) {
+                    var msg = backErrorMsg.replace("replace_error_msg", "退货");
+                    layer.msg(msg, {icon: 5, time: 3000});
+                    return false;
+                }
+                break;
+            case 7:
+                process = processIsEmpty([closedProdcues, closedFittings]);
+                if (!process) {
+                    var msg = backErrorMsg.replace("replace_error_msg", "退货");
+                    layer.msg(msg, {icon: 5, time: 3000});
+                    return false;
+                }
+                break;
+            default:
+                break;
+        }
+        $("#sendProdcues").val(JSON.stringify(sendProdcues));
+        $("#sendFittings").val(JSON.stringify(sendFittings));
+        $("#closedProdcues").val(JSON.stringify(closedProdcues));
+        $("#closedFittings").val(JSON.stringify(closedFittings));
+    }
+
+    var visitTimeSelect = $("input[name='visitTimeSelect']:checked").val();
+    var visit_date = $('#datemin').val();
+    var myDate = new Date();
+    var date = myDate.getFullYear()+"-"+(myDate.getMonth()+1)+"-"+myDate.getDate();
+    var hours = myDate.getHours();
+    //如果两个时间相等,则判断可选的回访时间
+    if(Date.parse(visit_date) == Date.parse(date)){
+        var msg = "该时间已超过当前时间,请重新选择回访时间!";
+        if (hours > 12 && visitTimeSelect == 1) {
+            vailErrorMsg($("#datemin"),msg);
+            return false;
+        } else if (hours > 14 && visitTimeSelect == 2) {
+            vailErrorMsg($("#datemin"),msg);
+            return false;
+        } else if (hours > 18 && visitTimeSelect == 3) {
+            vailErrorMsg($("#datemin"),msg);
+            return false;
+        }
+    }
+    return true;
+}
+
+/* 判断产品与配件是否填入值 */
+function processIsEmpty(process){
+    if(process != null && process != "" && process.length > 0){
+        var flag = 2;
+        var num = 0;
+        if(process[0] == null ||  process[0].length < 1 ){
+            flag -- ;
+        }
+        if(process[1] == null ||  process[1].length < 1 ){
+            flag -- ;
+        }
+
+        for(var j=0; j<process.length;j++){
+            for(var i=0;i<process[j].length;i++){
+                if(process[j][i].sendProdcueNumber !== undefined){
+                    num +=  process[j][i].sendProdcueNumber;
+                }
+                if(process[j][i].sendFittingNumber !== undefined){
+                    num += process[j][i].sendFittingNumber;
+                }
+                if(process[j][i].closedProdcueNumber !== undefined){
+                    num += process[j][i].closedProdcueNumber ;
+                }
+                if(process[j][i].closedFittingNumber !== undefined){
+                    num += process[j][i].closedFittingNumber;
+                }
+            }
+        }
+        if(flag == 0){
+            return false;
+        }
+        if(num == 0){
+            return false;
+        }
+    }
+    return true;
+}
+/*===============================客诉提交  -- end -- =============================== */