liujiankang 7 rokov pred
rodič
commit
a484e061c4

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

@@ -146,4 +146,11 @@ public interface CustomerService {
     void deleteCustomerAfterSales(CustomerInfo customer);
 
     Integer selectNotSolvedCustomer(CustomerInfo customer);
+
+    /**
+     *  查询旧的客诉基本信息
+     * @param customerInfo
+     * @return
+     */
+    List<CustomerInfo> listOnCustomer(CustomerInfo customerInfo);
 }

+ 93 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/cm/CustomerServiceImpl.java

@@ -627,6 +627,99 @@ public class CustomerServiceImpl implements CustomerService {
         return listCustomer.size();
     }
 
+    @Override
+    public List<CustomerInfo> listOnCustomer(CustomerInfo customerInfo) {
+       List<CustomerInfo> customerList = customerInfoMapper.listOnCustomer(customerInfo);
+        //查询售后维修集合
+        Repair repairInfo = new Repair();
+        repairInfo.setRepairState(1);
+        List<Repair> repairList = repairMapper.listRepair(repairInfo);
+        //查询售后退货集合
+        BackGoods backGoodsInfo = new BackGoods();
+        backGoodsInfo.setBackGoodsState(1);
+        List<BackGoods> backGoodsList = backGoodsMapper.listBackGoods(backGoodsInfo);
+        //查询售后无理由退货集合
+        NoreasonBack noreasonBackInfo = new NoreasonBack();
+        noreasonBackInfo.setNoreasonBackState(1);
+        List<NoreasonBack> noreasonBackList = noreasonBackMapper.listNoreasonBack(noreasonBackInfo);
+        //查询售后补发集合
+        Reissue reissueInfo = new Reissue();
+        reissueInfo.setReissueState(1);
+        List<Reissue> reissueList = reissueMapper.listReissue(reissueInfo);
+        //查询售后换新集合
+        Renewed renewedInfo = new Renewed();
+        renewedInfo.setRenewedState(1);
+        List<Renewed> renewedList = renewedMapper.listRenewed(renewedInfo);
+
+        if (customerList != null && customerList.size() > 0) {
+            for (CustomerInfo customer : customerList) {
+                switch (customer.getCustomerIsSolve().intValue()) {
+                    case 3: //换新
+                        for (Renewed renewed : renewedList) {
+                            if (renewed.getCustomerId().intValue() == customer.getCustomerId()) {
+                                customer.setBackStatus(renewed.getRenewedBackStatus());
+                                customer.setSendStatus(renewed.getRenewedSendStatus());
+                                customer.setSalesTime(renewed.getSalesPayTime());
+                                customer.setSendLogisticsNo(renewed.getRenewedSendLogisticsNo());
+                                customer.setSendLogisticsCompany(renewed.getRenewedSendLogisticsCompany());
+                                customer.setBackLogisticsNo(renewed.getRenewedBackLogisticsNo());
+                                customer.setBackLogisticsCompany(renewed.getRenewedBackLogisticsCompany());
+                                break;
+                            }
+                        }
+                        break;
+                    case 4: //维修
+                        for (Repair repair : repairList) {
+                            if (repair.getCustomerId().intValue() == customer.getCustomerId()) {
+                                customer.setBackStatus(repair.getRepairBackStatus());
+                                customer.setSendStatus(repair.getRepairSendStatus());
+                                customer.setSalesTime(repair.getSalesPayTime());
+                                customer.setSendLogisticsNo(repair.getRepairSendLogisticsNo());
+                                customer.setSendLogisticsCompany(repair.getRepairSendLogisticsCompany());
+                                customer.setBackLogisticsNo(repair.getRepairBackLogisticsNo());
+                                customer.setBackLogisticsCompany(repair.getRepairBackLogisticsCompany());
+                                break;
+                            }
+                        }
+                        break;
+                    case 5: //补发
+                        for (Reissue reissue : reissueList) {
+                            if (reissue.getCustomerId().intValue() == customer.getCustomerId()) {
+                                customer.setSendStatus(reissue.getReissueSendStatus());
+                                customer.setSalesTime(reissue.getSalesPayTime());
+                                customer.setBackLogisticsNo(reissue.getReissueSendLogisticsNo());
+                                customer.setBackLogisticsCompany(reissue.getReissueSendLogisticsCompany());
+                                break;
+                            }
+                        }
+                        break;
+                    case 6: //退货
+                        for (BackGoods backGoods : backGoodsList) {
+                            if (backGoods.getCustomerId().intValue() == customer.getCustomerId()) {
+                                customer.setBackStatus(backGoods.getBackGoodsBackStatus());
+                                customer.setSalesTime(backGoods.getSalesPayTime());
+                                customer.setSendLogisticsNo(backGoods.getBackGoodsBackLogisticsNo());
+                                break;
+                            }
+                        }
+                        break;
+                    case 7: //无理由退货
+                        for (NoreasonBack noreasonBack : noreasonBackList) {
+                            if (noreasonBack.getCustomerId().intValue() == customer.getCustomerId()) {
+                                customer.setBackStatus(noreasonBack.getNoreasonBackBackStatus());
+                                customer.setSalesTime(noreasonBack.getSalesPayTime());
+                                customer.setSendLogisticsNo(noreasonBack.getNoreasonBackBackLogisticsNo());
+                                customer.setSendLogisticsCompany(noreasonBack.getNoreasonBackBackLogisticsCompany());
+                                break;
+                            }
+                        }
+                        break;
+                }
+            }
+        }
+        return customerList;
+    }
+
     /**
      * 产品配件初始化
      * @param cc

+ 7 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/cm/mapper/CustomerInfoMapper.java

@@ -41,4 +41,11 @@ public interface CustomerInfoMapper {
 
     /*查询问题个数*/
     Integer getQuestionNumber(CustomerInfo customerInfo);
+    /**
+     *  查询旧的客诉基本信息
+     * @param customerInfo
+     * @return
+     */
+    List<CustomerInfo> listOnCustomer(CustomerInfo customerInfo);
+
 }

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

@@ -392,4 +392,68 @@
       </where>
   </select>
 
+
+  <select id="listOnCustomer" parameterType="CustomerInfo" resultMap="customerMap">
+    select
+    c.customer_id,
+    c.customer_counsel_type,
+    a.admin_name,
+    c.customer_name,
+    c.customer_tel,
+    c.customer_wechat_name,
+    c.customer_source_type,
+    c.customer_source,
+    t.type_name,
+    ct.complaint_class_name,
+    s.small_class_name,
+    d.describe_title,
+    sc.company_name,
+    si.store_name,
+    c.customer_area,
+    c.customer_in_TDS,
+    c.customer_out_TDS,
+    c.customer_is_solve,
+    c.customer_is_visit,
+    c.customer_create_time,
+    c.customer_desc,
+    c.customer_out_damaged,
+    c.customer_secondary_customer,
+    v.visit_status,
+    v.visit_complete_date,
+    v.visit_name,
+    v.visit_tel,
+    v.visit_date,
+    v.visit_time_select,
+    v.visit_complete_name,
+    v.visit_complete_tel,
+    sa.admin_name AS  visitDesignatedAdminName,
+    q.question_profile,
+    d.describe_handle_desc,
+    d.describe_content
+    from
+    tb_rst_customer_info c
+    LEFT JOIN tb_rst_question_describe d ON c.customer_id = d.customer_id
+    LEFT JOIN tb_rst_product_type t ON c.type_id = t.type_id
+    LEFT JOIN tb_rst_complaint_question q ON c.question_id = q.question_id
+    LEFT JOIN tb_rst_complaint_small_class s ON q.small_class_id = s.small_class_id
+    LEFT JOIN tb_rst_complaint_type ct ON s.complaint_id = ct.complaint_id
+    LEFT JOIN tb_rst_sales_company sc ON c.company_id = sc.company_id
+    LEFT JOIN tb_rst_store_info si ON c.store_id = si.store_id
+    LEFT JOIN tb_rst_sys_admin a ON c.admin_id = a.admin_id
+    LEFT JOIN tb_rst_visit v ON v.customer_id = c.customer_id
+    LEFT JOIN tb_rst_sys_admin sa ON v.designated_admin_id = sa.admin_id
+    <where>
+      <if test="customerName != null and customerName != ''">
+        c.customer_name = #{customerName}
+      </if>
+      <if test="customerTel != null and customerTel != ''">
+        OR c.customer_tel = #{customerTel}
+      </if>
+      <if test="customerWechatName != null and customerWechatName != ''">
+        OR c.customer_wechat_name = #{customerWechatName}
+      </if>
+    </where>
+
+    ORDER BY c.customer_id desc
+  </select>
 </mapper>

+ 51 - 0
watero-rst-web/src/main/java/com/iamberry/rst/controllers/cm/AdminCustomerController.java

@@ -9,6 +9,7 @@ import com.iamberry.rst.core.page.PagedResult;
 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.order.EfastOrderService;
 import com.iamberry.rst.faces.product.ProductService;
 import com.iamberry.rst.faces.sms.SmsService;
 import com.iamberry.rst.faces.sys.SysService;
@@ -22,6 +23,7 @@ import com.iamberry.wechat.tools.NameUtils;
 import com.iamberry.wechat.tools.ResponseJson;
 import com.iamberry.wechat.tools.ResultInfo;
 import net.sf.json.JSONArray;
+import net.sf.json.JSONObject;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.lang.StringUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
@@ -91,6 +93,8 @@ public class AdminCustomerController {
     private AddressService addressService;
     @Autowired
     private PostageService postageService;
+    @Autowired
+    private EfastOrderService efastOrderService;
 
 
 
@@ -1892,5 +1896,52 @@ public class AdminCustomerController {
         }
     }
 
+    /**
+     * 根据客户信息查询旧的客诉信息
+     *
+     * @param request
+     * @return
+     * @throws Exception
+     */
+    @ResponseBody
+    @RequestMapping("/selectOnCustomer")
+    public ResponseJson listOnCustomer(HttpServletRequest request,CustomerInfo customerInfo) throws Exception {
+        if (customerInfo == null) {
+            return new ResponseJson(500, "查询客诉失败!", 500);
+        }
+        List<CustomerInfo> onCustomerList = customerService.listOnCustomer(customerInfo);
+        if (onCustomerList.size() == 0) {
+            return new ResponseJson(500, "未找到客诉!", 500);
+        } else {
+            ResponseJson rj = new ResponseJson(200, "查询成功", 200);
+            rj.addResponseKeyValue("onCustomerList", onCustomerList);
+            return rj;
+        }
+    }
+
+    /**
+     * 根据efast订单号查询efast订单物流信息
+     * @param request
+     * @return
+     * @throws Exception
+     */
+    @ResponseBody
+    @RequestMapping("/getefastOrder")
+    public ResponseJson getEfastOrderInfo(HttpServletRequest request,String efastOrderId) throws Exception {
+        if (efastOrderId == null) {
+            return new ResponseJson(500, "查询失败!", 500);
+        }
+        JSONObject orderInfo = efastOrderService.getOrderFormEfastByOrderId(efastOrderId);
+        if (orderInfo == null) {
+            return new ResponseJson(500, "查询失败!", 500);
+        } else if (!orderInfo.has("orders")) {
+            return new ResponseJson(500, "查询失败!", 500);
+
+        } else {
+            ResponseJson rj = new ResponseJson(200, "查询成功", 200);
+            rj.addResponseKeyValue("orderInfo", orderInfo.toString());
+            return rj;
+        }
+    }
 }
 

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

@@ -162,6 +162,28 @@
                     <input type="text" class="input-text associated-phone" placeholder="用户电话" id="customerTel" name="customerTel" value="">
                 </div>
             </div>
+            <div class="row cl" style="display: none;">
+                <div class="formControls col-9 col-sm-9 text-c" id="onCustomerTable">
+                    <table class="table table-border table-bg table-bordered">
+                        <thead>
+                        <tr class="text-c">
+                            <th style="text-align: center;" width="60">客诉时间</th>
+                            <th style="text-align: center;" width="60">跟进客服</th>
+                            <th style="text-align: center;" width="60">用户姓名</th>
+                            <th style="text-align: center;" width="60">用户昵称</th>
+                            <th style="text-align: center;" width="60">用户电话</th>
+                            <th style="text-align: center;" width="60">处理方式</th>
+                            <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="onCustomer">
+
+                        </tbody>
+                    </table>
+                </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-10 col-sm-10 skin-minimal">

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

@@ -198,11 +198,11 @@
 
                                         <#if (customer.backLogisticsNo??)>
                                             寄回:
-                                            <a onclick="openLogistics('物流信息','${path}/admin/detect/to_view_logistics?billCode=${customer.backLogisticsNo!''}&billName=${customer.backLogisticsCompany!''}',500,400);">${customer.backLogisticsNo!''}</a><br>
+                                            <a onclick="openLogistics('物流信息','${path}/admin/detect/to_view_logistics?billCode=${customer.backLogisticsNo!''}&billName=${customer.backLogisticsCompany!''}',300,400);">${customer.backLogisticsNo!''}</a><br>
                                         </#if>
                                         <#if customer.sendLogisticsNo??>
                                             寄出:
-                                            <a onclick="openLogistics('物流信息','${path}/admin/detect/to_view_logistics?billCode=${customer.sendLogisticsNo!''}&billName=${customer.sendLogisticsCompany!''}',500,400);">${customer.sendLogisticsNo!''}</a><br>
+                                            <a onclick="openLogistics('物流信息','${path}/admin/detect/to_view_logistics?billCode=${customer.sendLogisticsNo!''}&billName=${customer.sendLogisticsCompany!''}',300,400);">${customer.sendLogisticsNo!''}</a><br>
                                         </#if>
                                 <#else>

+ 21 - 0
watero-rst-web/src/main/webapp/WEB-INF/views/cm/customer/update_repair.ftl

@@ -1036,6 +1036,27 @@
             }
         })
     }
+
+    /*填写订单号后自动获取物流信息*/
+    $("#repairBackEfastOrderId").blur(function () {
+        var repairBackEfastOrderId = $("#repairBackEfastOrderId").val();
+            $.ajax({
+                cache: true,
+                type: "POST",
+                data: {"efastOrderId":repairBackEfastOrderId},
+                url: "${path}/admin/customer/getefastOrder",
+                async: false,
+                success: function(data){
+                    if (data != null && data != "") {
+                        var orderInfo = eval('(' + data.returnMsg.orderInfo + ')');
+                       $("#repairSendLogisticsCompany").val(orderInfo.shipping_name);
+                       $("#repairSendLogisticsNo").val(orderInfo.invoice_no);
+                    }
+                },
+                error: function(XmlHttpRequest, textStatus, errorThrown){
+                }
+            })
+    });
 </script>
 </body>
 </html>

+ 122 - 1
watero-rst-web/src/main/webapp/common/js/customer/customer.js

@@ -1885,4 +1885,125 @@ function processIsEmpty(process){
     }
     return true;
 }
-/*===============================客诉提交  -- end -- =============================== */
+/*===============================客诉提交  -- end -- =============================== */
+
+
+/*$("#customerWechatName").blur(function(){
+    selectOnCustomer();
+});
+$("#customerName").blur(function(){
+    selectOnCustomer();
+});
+$("#customerTel").blur(function(){
+    selectOnCustomer();
+});*/
+/*根据客户信息查询老的客诉---start--*/
+function selectOnCustomer() {
+    var customerWechatName = $("#customerWechatName").val();
+    var customerName = $("#customerName").val();
+    var customerTel = $("#customerTel").val();
+    if((customerWechatName == null || customerWechatName == "") &&
+        (customerName == null || customerName == "") &&
+        (customerTel == null || customerTel == "")){
+        return;
+    }
+    $.ajax({
+        type: "POST",
+        data: {"customerWechatName" :customerWechatName,
+            "customerName":customerName,
+            "customerTel":customerTel},
+        url: url_path + "/admin/customer/selectOnCustomer",
+        async: false,
+        success: function(data){
+            if (data.returnCode == 200) {
+                var onCustomerList = data.returnMsg.onCustomerList;
+                if(onCustomerList != null && onCustomerList.length >0 ){
+                    var onCustomerTd = "";
+                   for(var i = 0;i < onCustomerList.length; i++){
+                        var onCustomer = onCustomerList[i];
+                        //客诉时间
+                       var time = formatDate(new Date(onCustomer.customerCreateTime),"yyyy-MM-dd");
+                       //处理方式
+                       var customerIsSolve = "";
+                       switch (onCustomer.customerIsSolve){
+                           case 1:
+                               customerIsSolve = "已解决";
+
+                               break;
+                           case 2:
+                               customerIsSolve = "未解决";
+                               break;
+                           case 3:
+                               customerIsSolve = "换新"+ backStatus(onCustomer.backStatus)+sendStatus(onCustomer.sendStatus);
+                               break;
+                           case 4:
+                               customerIsSolve = "维修"+ backStatus(onCustomer.backStatus)+sendStatus(onCustomer.sendStatus);
+                               break;
+                           case 5:
+                               customerIsSolve = "补发"+ sendStatus(onCustomer.sendStatus);
+                               break;
+                           case 6:
+                               customerIsSolve = "退货"+ backStatus(onCustomer.backStatus);
+                               break;
+                           case 7:
+                               customerIsSolve = "无理由退货"+ backStatus(onCustomer.backStatus);
+                               break;
+                       }
+                       var customerWechatName = onCustomer.customerWechatName;
+                        //微信昵称
+                       if(typeof(onCustomer.customerWechatName)=="undefined"){
+                           customerWechatName = "";
+                       }
+
+                       var customerName = onCustomer.customerName;
+                       //姓名
+                       if(typeof(onCustomer.customerName)=="undefined"){
+                           customerName = "";
+                       }
+                       onCustomerTd += '' +
+                           ' <tr>' +
+                           ' <td style="text-align: center;">'+ time+'</td>' +
+                           ' <td style="text-align: center;">'+onCustomer.adminName +'</td>' +
+                           ' <td style="text-align: center;">'+customerName +'</td>' +
+                           ' <td style="text-align: center;">'+customerWechatName +'</td>' +
+                           ' <td style="text-align: center;">'+onCustomer.customerTel +'</td>' +
+                           ' <td style="text-align: center;">'+customerIsSolve +'</td>' +
+                           ' <td style="text-align: center;">'+onCustomer.describeTitle +'</td>' +
+                           ' <td style="text-align: center;">'+onCustomer.describeContent +'</td>' +
+                           ' <td style="text-align: center;"></td>' +
+                           ' </tr>' +
+                           '';
+                   }
+                   $("#onCustomer").html(onCustomerTd);
+                }
+            }
+        },
+        error: function(XmlHttpRequest, textStatus, errorThrown){
+        }
+    });
+
+
+    function backStatus(status) {
+        if(status == 1){
+            return "(未寄回)";
+        }
+        if(status == 2){
+            return "(已寄回)";
+        }
+        if(status == 3){
+            return "(已收货)";
+        }
+    }
+    function sendStatus(status) {
+        if(status == 1){
+            return "(未寄送)";
+        }
+        if(status == 2){
+            return "(已寄送)";
+        }
+        if(status == 3){
+            return "(已收货)";
+        }
+    }
+}
+/*根据客户信息查询老的客诉---end--*/