Selaa lähdekoodia

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

wangxiaoming 6 vuotta sitten
vanhempi
commit
3adb29f612

+ 73 - 0
watero-rst-core/src/main/java/com.iamberry.rst.core/cm/ReturnStatisticsInfo.java

@@ -0,0 +1,73 @@
+package com.iamberry.rst.core.cm;
+
+import java.io.Serializable;
+
+/**
+ * Created by Administrator on 2018/6/28.
+ */
+public class ReturnStatisticsInfo implements Serializable {
+    private static final long serialVersionUID = 5441284030629333720L;
+    private Integer months;//销售月份
+    private Integer totalSales;//销售总数
+    private Integer totalExchange;//总换货
+    private Integer totalReturn;//总退货
+    private Integer secondaryChangeNew;//二次换新
+    private Integer returnForSecond;//二次换新退货
+    private Integer num;//数量
+
+    public Integer getMonths() {
+        return months;
+    }
+
+    public void setMonths(Integer months) {
+        this.months = months;
+    }
+
+    public Integer getTotalSales() {
+        return totalSales;
+    }
+
+    public void setTotalSales(Integer totalSales) {
+        this.totalSales = totalSales;
+    }
+
+    public Integer getTotalExchange() {
+        return totalExchange;
+    }
+
+    public void setTotalExchange(Integer totalExchange) {
+        this.totalExchange = totalExchange;
+    }
+
+    public Integer getTotalReturn() {
+        return totalReturn;
+    }
+
+    public void setTotalReturn(Integer totalReturn) {
+        this.totalReturn = totalReturn;
+    }
+
+    public Integer getSecondaryChangeNew() {
+        return secondaryChangeNew;
+    }
+
+    public void setSecondaryChangeNew(Integer secondaryChangeNew) {
+        this.secondaryChangeNew = secondaryChangeNew;
+    }
+
+    public Integer getReturnForSecond() {
+        return returnForSecond;
+    }
+
+    public void setReturnForSecond(Integer returnForSecond) {
+        this.returnForSecond = returnForSecond;
+    }
+
+    public Integer getNum() {
+        return num;
+    }
+
+    public void setNum(Integer num) {
+        this.num = num;
+    }
+}

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

@@ -162,4 +162,35 @@ public interface CustomerService {
      * @return
      */
     List<CustomerStatisticalInfo> listStatisticalCustomer();
+
+    /**
+     * 总销量
+     * @param salesOrder
+     * @return
+     */
+    List<ReturnStatisticsInfo> salesTotalSales(SalesOrder salesOrder);
+    /**
+     * 总换货
+     * @param salesOrder
+     * @return
+     */
+    List<ReturnStatisticsInfo> salesTotalExchange(SalesOrder salesOrder);
+    /**
+     * 总退货
+     * @param salesOrder
+     * @return
+     */
+    List<ReturnStatisticsInfo> salesTotalReturn(SalesOrder salesOrder);
+    /**
+     * 二次换新
+     * @param salesOrder
+     * @return
+     */
+    List<ReturnStatisticsInfo> salesSecondaryChangeNew(SalesOrder salesOrder);
+    /**
+     * 二次换新退货
+     * @param salesOrder
+     * @return
+     */
+    List<ReturnStatisticsInfo> salesReturnForSecond(SalesOrder salesOrder);
 }

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

@@ -1103,6 +1103,31 @@ public class CustomerServiceImpl implements CustomerService {
         return customerInfoMapper.listStatisticalCustomer();
     }
 
+    @Override
+    public List<ReturnStatisticsInfo> salesTotalSales(SalesOrder salesOrder) {
+        return customerInfoMapper.salesTotalSales(salesOrder);
+    }
+
+    @Override
+    public List<ReturnStatisticsInfo> salesTotalExchange(SalesOrder salesOrder) {
+        return customerInfoMapper.salesTotalExchange(salesOrder);
+    }
+
+    @Override
+    public List<ReturnStatisticsInfo> salesTotalReturn(SalesOrder salesOrder) {
+        return customerInfoMapper.salesTotalReturn(salesOrder);
+    }
+
+    @Override
+    public List<ReturnStatisticsInfo> salesSecondaryChangeNew(SalesOrder salesOrder) {
+        return customerInfoMapper.salesSecondaryChangeNew(salesOrder);
+    }
+
+    @Override
+    public List<ReturnStatisticsInfo> salesReturnForSecond(SalesOrder salesOrder) {
+        return customerInfoMapper.salesReturnForSecond(salesOrder);
+    }
+
     /**
          * 向Efast推送订单--添加订单
          * @return

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

@@ -2,6 +2,8 @@ package com.iamberry.rst.service.cm.mapper;
 
 import com.iamberry.rst.core.cm.CustomerInfo;
 import com.iamberry.rst.core.cm.CustomerStatisticalInfo;
+import com.iamberry.rst.core.cm.ReturnStatisticsInfo;
+import com.iamberry.rst.core.cm.SalesOrder;
 import com.iamberry.rst.core.order.ProductType;
 
 import java.util.List;
@@ -55,4 +57,34 @@ public interface CustomerInfoMapper {
      */
     List<CustomerStatisticalInfo> listStatisticalCustomer();
 
+    /**
+     * 总销量
+     * @param salesOrder
+     * @return
+     */
+    List<ReturnStatisticsInfo> salesTotalSales(SalesOrder salesOrder);
+    /**
+     * 总换货
+     * @param salesOrder
+     * @return
+     */
+    List<ReturnStatisticsInfo> salesTotalExchange(SalesOrder salesOrder);
+    /**
+     * 总退货
+     * @param salesOrder
+     * @return
+     */
+    List<ReturnStatisticsInfo> salesTotalReturn(SalesOrder salesOrder);
+    /**
+     * 二次换新
+     * @param salesOrder
+     * @return
+     */
+    List<ReturnStatisticsInfo> salesSecondaryChangeNew(SalesOrder salesOrder);
+    /**
+     * 二次换新退货
+     * @param salesOrder
+     * @return
+     */
+    List<ReturnStatisticsInfo> salesReturnForSecond(SalesOrder salesOrder);
 }

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

@@ -1084,4 +1084,159 @@ 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_sales_order_item soi ON soi.item_order_id = oi.sales_id
   </select>
+  <!-- 退换货统计sql start -->
+  <!-- 总销量 -->
+  <select id="salesTotalSales" parameterType="SalesOrder" resultType="ReturnStatisticsInfo">
+    SELECT MONTH (salesNum.sales_create_time) AS months,
+    count(1) AS num from (
+    SELECT
+    oi.sales_create_time
+    FROM
+    tb_rst_sales_order_info oi
+    JOIN tb_rst_sales_order_item soi ON soi.item_order_id = oi.sales_id
+    <where>
+      oi.sales_shipping_status = 1
+      <if test="itemColorBar != null and itemColorBar != ''" >
+        AND soi.item_color_bar = #{itemColorBar}
+      </if>
+      <if test="startDate!=null and startDate!='' ">
+        AND oi.sales_create_time &gt; #{startDate}
+      </if>
+      <if test="endDate!=null and endDate!=''">
+        and oi.sales_create_time &lt; #{endDate}
+      </if>
+    </where>
+    GROUP BY oi.sales_id) salesNum
+    GROUP BY MONTH (salesNum.sales_create_time)
+  </select>
+
+  <!-- 总换货 -->
+  <select id="salesTotalExchange" parameterType="SalesOrder" resultType="ReturnStatisticsInfo">
+    SELECT MONTH (salesExchange.sales_create_time) AS months,
+    count(1) AS num from (
+    SELECT sales_create_time from (
+    SELECT
+    oi.sales_id,oi.sales_create_time
+    FROM
+    tb_rst_sales_order_info oi
+    JOIN tb_rst_sales_order_item soi ON soi.item_order_id = oi.sales_id
+    <where>
+      oi.sales_shipping_status = 1
+      <if test="itemColorBar != null and itemColorBar != ''" >
+        AND soi.item_color_bar = #{itemColorBar}
+      </if>
+      <if test="startDate!=null and startDate!='' ">
+        AND oi.sales_create_time &gt; #{startDate}
+      </if>
+      <if test="endDate!=null and endDate!=''">
+        and oi.sales_create_time &lt; #{endDate}
+      </if>
+    </where>
+    GROUP BY oi.sales_id) salesNum
+    LEFT JOIN tb_rst_relation_order ro
+    on ro.sales_id = salesNum.sales_id
+    WHERE relation_type = 3) salesExchange
+    GROUP BY
+    MONTH (salesExchange.sales_create_time)
+  </select>
+
+  <!-- 总退货 -->
+  <select id="salesTotalReturn" parameterType="SalesOrder" resultType="ReturnStatisticsInfo">
+    SELECT MONTH (salesExchange.sales_create_time) AS months,
+    count(1) AS num from (
+    SELECT sales_create_time from (
+    SELECT
+    oi.sales_id,oi.sales_create_time
+    FROM
+    tb_rst_sales_order_info oi
+    JOIN tb_rst_sales_order_item soi ON soi.item_order_id = oi.sales_id
+    <where>
+      oi.sales_shipping_status = 1
+      <if test="itemColorBar != null and itemColorBar != ''" >
+        AND soi.item_color_bar = #{itemColorBar}
+      </if>
+      <if test="startDate!=null and startDate!='' ">
+        AND oi.sales_create_time &gt; #{startDate}
+      </if>
+      <if test="endDate!=null and endDate!=''">
+        and oi.sales_create_time &lt; #{endDate}
+      </if>
+    </where>
+    GROUP BY oi.sales_id) salesNum
+    LEFT JOIN tb_rst_relation_order ro
+    on ro.sales_id = salesNum.sales_id
+    WHERE relation_type in (6,7)) salesExchange
+    GROUP BY
+    MONTH (salesExchange.sales_create_time)
+  </select>
+
+  <!-- 二次换新-->
+  <select id="salesSecondaryChangeNew" parameterType="SalesOrder" resultType="ReturnStatisticsInfo">
+    SELECT MONTH (salesExchange.sales_create_time) AS months,
+    count(1) AS num from (
+    SELECT sales_create_time from (
+    SELECT
+    oi.sales_id,oi.sales_create_time
+    FROM
+    tb_rst_sales_order_info oi
+    JOIN tb_rst_sales_order_item soi ON soi.item_order_id = oi.sales_id
+    <where>
+      oi.sales_shipping_status = 1
+      <if test="itemColorBar != null and itemColorBar != ''" >
+        AND soi.item_color_bar = #{itemColorBar}
+      </if>
+      <if test="startDate!=null and startDate!='' ">
+        AND oi.sales_create_time &gt; #{startDate}
+      </if>
+      <if test="endDate!=null and endDate!=''">
+        and oi.sales_create_time &lt; #{endDate}
+      </if>
+    </where>
+    GROUP BY oi.sales_id) salesNum
+    LEFT JOIN tb_rst_relation_order ro
+    on ro.sales_id = salesNum.sales_id
+    LEFT JOIN tb_rst_renewed rr
+    on ro.relation_id = rr.renewed_id
+    LEFT JOIN tb_rst_customer_info ci
+    ON rr.customer_id = ci.customer_id
+    WHERE relation_type = 3 and ci.customer_secondary_customer = 1) salesExchange
+    GROUP BY
+    MONTH (salesExchange.sales_create_time)
+  </select>
+
+  <!-- 二次换新退货-->
+  <select id="salesReturnForSecond" parameterType="SalesOrder" resultType="ReturnStatisticsInfo">
+    SELECT MONTH (salesExchange.sales_create_time) AS months,
+    count(1) AS num from (
+    SELECT sales_create_time from (
+    SELECT
+    oi.sales_id,oi.sales_create_time
+    FROM
+    tb_rst_sales_order_info oi
+    JOIN tb_rst_sales_order_item soi ON soi.item_order_id = oi.sales_id
+    <where>
+      oi.sales_shipping_status = 1
+      <if test="itemColorBar != null and itemColorBar != ''" >
+        AND soi.item_color_bar = #{itemColorBar}
+      </if>
+      <if test="startDate!=null and startDate!='' ">
+        AND oi.sales_create_time &gt; #{startDate}
+      </if>
+      <if test="endDate!=null and endDate!=''">
+        and oi.sales_create_time &lt; #{endDate}
+      </if>
+    </where>
+    GROUP BY oi.sales_id) salesNum
+    LEFT JOIN tb_rst_relation_order ro
+    on ro.sales_id = salesNum.sales_id
+    LEFT JOIN tb_rst_renewed rr
+    on ro.relation_id = rr.renewed_id
+    LEFT JOIN tb_rst_customer_info ci
+    ON rr.customer_id = ci.customer_id
+    WHERE relation_type in(6,7) and ci.customer_secondary_customer = 1) salesExchange
+    GROUP BY
+    MONTH (salesExchange.sales_create_time)
+  </select>
+  <!-- 退换货统计sql end -->
+
 </mapper>

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

@@ -5,6 +5,7 @@ import com.iamberry.rst.core.order.Product;
 import com.iamberry.rst.core.order.ProductColor;
 import com.iamberry.rst.core.order.ProductType;
 import com.iamberry.rst.core.page.PagedResult;
+import com.iamberry.rst.core.pts.Produce;
 import com.iamberry.rst.core.sys.Admin;
 import com.iamberry.rst.faces.address.AddressService;
 import com.iamberry.rst.faces.cm.*;
@@ -2167,5 +2168,128 @@ public class AdminCustomerController {
                 bos.close();
         }
     }
+
+
+    /**
+     * 跳转到添加客诉页面
+     *
+     * @return
+     */
+    @RequiresPermissions("customer:statistical:customer")
+    @RequestMapping(value = "/to_return_statistics")
+    public ModelAndView toReturnStatistics(HttpServletRequest request) {
+        ModelAndView mv = new ModelAndView("cm/report/return_statistics");
+        //获取产品集合,用于页面选择产品
+        ProductColor productColor = new ProductColor();
+        List<ProductColor> productColorList = productService.listproductAndColor(productColor);
+        mv.addObject("productColorList", productColorList);
+        //查询店铺
+        StoreInfo storeInfo = new StoreInfo();
+        List<StoreInfo> storeList = storeInfoService.listStore(storeInfo);
+        mv.addObject("storeList", storeList);
+        return mv;
+    }
+
+    /**
+     * 退换货统计
+     * @param request
+     * @param salesOrder
+     * @return
+     */
+    @ResponseBody
+    @RequestMapping("/return_statistics")
+    public ResponseJson returnStatistics(HttpServletRequest request,SalesOrder salesOrder){
+        if(salesOrder.getStartDate() == null){
+            Date now = new Date();
+            Calendar c = Calendar.getInstance();
+            c.setTime(now);
+            c.set(Calendar.DAY_OF_YEAR, 1);
+            c.set(Calendar.HOUR, 0);
+            c.set(Calendar.MINUTE, 0);
+            c.set(Calendar.SECOND, 0);
+            salesOrder.setStartDate(c.getTime());
+            c.add(Calendar.YEAR, 1);
+            c.set(Calendar.DAY_OF_YEAR, -1);
+            c.set(Calendar.HOUR, 23);
+            c.set(Calendar.MINUTE, 59);
+            c.set(Calendar.SECOND, 59);
+            salesOrder.setEndDate(c.getTime());
+        }
+        /*销售总数*/
+        List<ReturnStatisticsInfo> listTotalSales = customerService.salesTotalSales(salesOrder);
+        /*总换货*/
+        List<ReturnStatisticsInfo> listTotalExchange = customerService.salesTotalExchange(salesOrder);
+        /*总退货*/
+        List<ReturnStatisticsInfo> listTotalReturn = customerService.salesTotalReturn(salesOrder);
+        /*二次换货*/
+        List<ReturnStatisticsInfo> listSecondaryChangeNew = customerService.salesSecondaryChangeNew(salesOrder);
+        /*二次换新退货*/
+        List<ReturnStatisticsInfo> listReturnForSecond = customerService.salesReturnForSecond(salesOrder);
+        /*封装数据*/
+        List<ReturnStatisticsInfo> listReturnStatisticsInfo = new ArrayList<>();
+        boolean isThereAre = false;
+        for (int i = 1;i<=12;i++){
+            ReturnStatisticsInfo returnStatisticsInfo = new ReturnStatisticsInfo();
+            for(int j = 0;j< listTotalSales.size(); j++){
+                if(i == listTotalSales.get(j).getMonths()){
+                    returnStatisticsInfo.setMonths(i);
+                    returnStatisticsInfo.setTotalSales(listTotalSales.get(j).getNum());
+                    isThereAre = true;
+                }
+            }
+            if(!isThereAre){
+                returnStatisticsInfo.setMonths(i);
+                returnStatisticsInfo.setTotalSales(0);
+            }
+            isThereAre = false;
+            listReturnStatisticsInfo.add(returnStatisticsInfo);
+        }
+        for(int i = 0;i<listReturnStatisticsInfo.size();i++){
+            for(int j = 0;j< listTotalExchange.size(); j++){
+                if(i+1 == listTotalExchange.get(j).getMonths()){
+                    listReturnStatisticsInfo.get(i).setTotalExchange(listTotalExchange.get(j).getNum());
+                    isThereAre = true;
+                }
+            }
+            if(!isThereAre){
+                listReturnStatisticsInfo.get(i).setTotalExchange(0);
+            }
+            isThereAre = false;
+            for(int j = 0;j< listTotalReturn.size(); j++){
+                if(i+1 == listTotalReturn.get(j).getMonths()){
+                    listReturnStatisticsInfo.get(i).setTotalReturn(listTotalReturn.get(j).getNum());
+                    isThereAre = true;
+                }
+            }
+            if(!isThereAre){
+                listReturnStatisticsInfo.get(i).setTotalReturn(0);
+            }
+            isThereAre = false;
+            for(int j = 0;j< listSecondaryChangeNew.size(); j++){
+                if(i+1 == listSecondaryChangeNew.get(j).getMonths()){
+                    listReturnStatisticsInfo.get(i).setSecondaryChangeNew(listSecondaryChangeNew.get(j).getNum());
+                    isThereAre = true;
+                }
+            }
+            if(!isThereAre){
+                listReturnStatisticsInfo.get(i).setSecondaryChangeNew(0);
+            }
+            isThereAre = false;
+            for(int j = 0;j< listReturnForSecond.size(); j++){
+                if(i+1 == listReturnForSecond.get(j).getMonths()){
+                    listReturnStatisticsInfo.get(i).setReturnForSecond(listReturnForSecond.get(j).getNum());
+                    isThereAre = true;
+                }
+            }
+            if(!isThereAre){
+                listReturnStatisticsInfo.get(i).setReturnForSecond(0);
+            }
+            isThereAre = false;
+        }
+        ResponseJson rj = new ResponseJson(200, "查询成功", 200);
+        rj.addResponseKeyValue("listReturnStatisticsInfo", listReturnStatisticsInfo);
+        return rj;
+
+    }
 }
 

+ 1 - 0
watero-rst-web/src/main/resources/watero-rst-orm.xml

@@ -106,6 +106,7 @@
 		<typeAlias type="com.iamberry.rst.core.tools.LogisticsInfo" alias="LogisticsInfo"/>
 		<typeAlias type="com.iamberry.rst.core.order.DownsingleRuleInfo" alias="DownsingleRuleInfo"/>
 		<typeAlias type="com.iamberry.rst.core.order.DownsingleRuleItemInfo" alias="DownsingleRuleItemInfo"/>
+		<typeAlias type="com.iamberry.rst.core.cm.ReturnStatisticsInfo" alias="ReturnStatisticsInfo"/>
 	</typeAliases>
 	<!-- PageHelper -->
 	<plugins>

+ 238 - 0
watero-rst-web/src/main/webapp/WEB-INF/views/cm/report/return_statistics.ftl

@@ -0,0 +1,238 @@
+<!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" />
+    <link rel="Bookmark" href="/favicon.ico" >
+    <link rel="Shortcut Icon" href="/favicon.ico" />
+<#include "/base/add_base.ftl">
+    <title>订单退换统计列表</title>
+    <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;
+        }
+        .select-order{text-decoration:none;color: #32A3D8;}
+        .select-order:hover{text-decoration:underline;}
+    </style>
+</head>
+<body>
+<div class="page-container">
+    <div class="order-list">
+        <div class="text-c">
+            <form action="" method="post">
+                <div class="row cl" style="margin-left: 0px;">
+                    <div class="formControls col-2 col-sm-2" >
+                    </div>
+                    <div class="formControls col-2 col-sm-2" style="padding: 0px 10px 0px 0px; width: 110px;" > <span class="select-box">
+                        <select name="salesStoreId" class="select" id="salesStoreId">
+                             <option value="">店铺</option>
+                            <#if storeList?? &&  (storeList?size > 0) >
+                                <#list storeList as storeInfo>
+                                    <option value ="${storeInfo.storeId!""}">${storeInfo.storeName!""}</option>
+                                </#list>
+                            </#if>
+                        </select>
+                        </span>
+                    </div>
+
+                    <div class="formControls col-2 col-sm-2" style="padding: 0px 10px 0px 0px; width: 110px;" > <span class="select-box">
+                        <select name="itemColorBar" class="select" id="itemColorBar">
+                             <option value="">产品</option>
+                        <#if productColorList?? &&  (productColorList?size > 0) >
+                            <#list productColorList as productColorInfo>
+                                <option value ="${productColorInfo.colorBar!""}">${productColorInfo.productName!""}</option>
+                            </#list>
+                        </#if>
+                        </select>
+                        </span>
+                    </div>
+                    <div class="formControls col-3 col-sm-3" >
+                     <input type="text" style="width:120px;height:36px;margin-right: 0px;margin-bottom: 10px;" name="startTime" id="startTime" class="input-text" placeholder="开始时间" onClick="WdatePicker({startDate: '%y-01-01 00:00:00' ,dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate: true })" value="${(customerInfo.startTime?string("yyyyy-MM-dd HH:mm:ss"))!''}" readonly="readonly"/>-
+                     <input type="text" style="width:120px;height:36px;margin-right: 0px;margin-bottom: 10px;" name="endTime" id="endTime" class="input-text" placeholder="结束时间" onClick="WdatePicker({startDate: '%y-01-01 00:00:00' ,dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate: true })" value="${(customerInfo.endTime?string("yyyy-MM-dd HH:mm:ss"))!''}" readonly="readonly"/>
+                    </div>
+                     <div class="formControls col-1 col-sm-1" >
+                         <button type="button" class="btn btn-primary" style="background: #32a3d8;color: #fff;-webkit-transform:translateY(-5%);" onclick="statistical();" id="" name="">搜索</button>
+                     </div>
+                     <#--<a src="javascript:void(0)" style="color: #00e;text-decoration: underline;" onclick="addOrder()">去添加</a>-->
+                </div>
+
+            </form>
+        </div>
+
+        <#--<div class="mt-20" style="height: 330px;overflow: auto;overflow-x: hidden;margin-bottom: 12px;border: 1px solid #ddd;">-->
+            <table class="table table-border table-bordered table-bg table-hover table-sort">
+                <thead>
+                <tr class="text-c">
+                    <th width="50">销售月份</th>
+                    <th width="50">发货总数</th>
+                    <th width="50">销售总数</th>
+                    <th width="50">退换货率</th>
+                    <th width="100">总换货</th>
+                    <th width="60">换货率</th>
+                    <th width="80">其中二次换新</th>
+                    <th width="80">总退货数</th>
+                    <th width="80">总退货率</th>
+                    <th width="80">其中二次换新退货</th>
+                    <th width="80">二次退换货占总退换货比例</th>
+                </tr>
+                </thead>
+                <tbody id="statisticalAll">
+
+                     <tr class="text-c">
+                         <td colspan="11">暂无统计数据
+                         </td>
+                     </tr>
+
+                </tbody>
+            </table>
+        <#--</div>-->
+    </div>
+    </form>
+    </div>
+
+
+</div>
+
+<tfoot>
+<#--<#include "/base/page_util.ftl">-->
+</tfoot>
+
+<#--时间控件-->
+<script type="text/javascript" src="${path}/common/lib/My97DatePicker/4.8/WdatePicker.js"></script>
+
+<script>
+
+    $(function () {
+        statistical();
+    })
+
+    /**
+     * 搜索订单
+     */
+    function statistical(){
+        var salesStoreId = convertUndefinedToEmpty($("#salesStoreId").val());
+        var startTime = convertUndefinedToEmpty($("#startTime").val());
+        var endTime = convertUndefinedToEmpty($("endTime").val());
+        var itemColorBar = convertUndefinedToEmpty($("itemColorBar").val());
+        $.ajax({
+            type: "POST",
+            data: {
+                salesStoreId : salesStoreId,
+                startTime : startTime,
+                endTime : endTime,
+                itemColorBar : itemColorBar
+            },
+            url: "${path}/admin/customer/return_statistics",
+            async: true,
+            success: function(data){
+                var html = "";
+                if (data.returnCode == 200 && data.returnMsg.listReturnStatisticsInfo.length > 0 ) {
+                    for(var i=0;i<data.returnMsg.listReturnStatisticsInfo.length;i++){
+                        var returnStatisticsInfo = data.returnMsg.listReturnStatisticsInfo[i];
+                        returnStatisticsInfo.totalSales = undefinedToEmpty(returnStatisticsInfo.totalSales);
+                        returnStatisticsInfo.totalExchange = undefinedToEmpty(returnStatisticsInfo.totalExchange);
+                        returnStatisticsInfo.totalReturn = undefinedToEmpty(returnStatisticsInfo.totalReturn);
+                        returnStatisticsInfo.secondaryChangeNew = undefinedToEmpty(returnStatisticsInfo.secondaryChangeNew);
+                        returnStatisticsInfo.returnForSecond = undefinedToEmpty(returnStatisticsInfo.returnForSecond);
+                        //总退换货率计算
+                        /*alert(returnStatisticsInfo.totalSales+" "+returnStatisticsInfo.totalExchange+" "+returnStatisticsInfo.totalReturn+" "+returnStatisticsInfo.secondaryChangeNew+" "+returnStatisticsInfo.returnForSecond);*/
+                        html += '<tr class="text-c">' +
+                                ' <td>'+ returnStatisticsInfo.months +'</td>' +
+                                ' <td>'+ returnStatisticsInfo.totalSales +'</td>' +
+                                ' <td>'+ (Number(returnStatisticsInfo.totalSales)-(Number(returnStatisticsInfo.totalExchange) - Number(returnStatisticsInfo.totalReturn)))  +'</td>' +
+                                ' <td>'+ toDecimal(Number((returnStatisticsInfo.totalExchange + returnStatisticsInfo.totalReturn))/Number(returnStatisticsInfo.totalSales)* 100)  +'%</td>' +
+                                ' <td>'+  returnStatisticsInfo.totalExchange +'</td>' +
+                                ' <td>'+ toDecimal(Number(returnStatisticsInfo.secondaryChangeNew)/Number(returnStatisticsInfo.totalExchange)* 100) +'%</td>' +
+                                ' <td>'+ returnStatisticsInfo.secondaryChangeNew +'</td>' +
+                                ' <td>'+ returnStatisticsInfo.totalReturn +'</td>' +
+                                ' <td>'+ toDecimal(Number(returnStatisticsInfo.totalReturn)/Number(returnStatisticsInfo.totalSales)* 100)  +'%</td>' +
+                                ' <td>'+ returnStatisticsInfo.returnForSecond +'</td>' +
+                                ' <td>'+ toDecimal(Number(returnStatisticsInfo.returnForSecond)/Number(returnStatisticsInfo.totalReturn) * 100)+'%</td>' +
+                                ' </tr>';
+                    }
+                }else{
+                    html = '<tr class="text-c"><td colspan="12">暂无统计数据!</td></tr>';
+                }
+                $("#statisticalAll").html(html);
+            }
+        });
+    }
+
+
+</script>
+
+
+<script>
+    /**
+     * 该方法用于将Undefined转换为空值
+     *
+     * @param val
+     */
+    function undefinedToEmpty(val) {
+        if (undefined == val || null == val||typeof val == undefined || typeof val == 'undefined'|| 'undefined' == val) {
+            val = 0;
+        }
+        return val;
+    }
+    //保留俩位小数
+    function toDecimal(x) {
+        var f = parseFloat(x);
+        if (isNaN(f)) {
+            return '0.00';
+        }
+        var f = Math.round(x*100)/100;
+        var s = f.toString();
+        var rs = s.indexOf('.');
+        if (rs < 0) {
+            rs = s.length;
+            s += '.';
+        }
+        while (s.length <= rs + 2) {
+            s += '0';
+        }
+        return s;
+    }
+</script>
+</body>
+</html>