浏览代码

Merge remote-tracking branch 'origin/developer' into developer

Aslee 4 年之前
父节点
当前提交
414c7cbc67
共有 73 个文件被更改,包括 8471 次插入250 次删除
  1. 9 6
      src/main/java/com/caimei/modules/bulkpurchase/web/CmRefundsProductController.java
  2. 30 0
      src/main/java/com/caimei/modules/hehe/dao/CmHeheActivityDao.java
  3. 73 0
      src/main/java/com/caimei/modules/hehe/dao/CmHeheActivityProductDao.java
  4. 26 0
      src/main/java/com/caimei/modules/hehe/dao/CmHeheImageDao.java
  5. 49 0
      src/main/java/com/caimei/modules/hehe/dao/CmHeheProductDao.java
  6. 80 0
      src/main/java/com/caimei/modules/hehe/dao/CmHeheUserDao.java
  7. 22 0
      src/main/java/com/caimei/modules/hehe/dao/HeHeNewOrderDao.java
  8. 77 0
      src/main/java/com/caimei/modules/hehe/entity/CmHeHeActivityLadder.java
  9. 102 0
      src/main/java/com/caimei/modules/hehe/entity/CmHeheActivity.java
  10. 127 0
      src/main/java/com/caimei/modules/hehe/entity/CmHeheActivityProduct.java
  11. 74 0
      src/main/java/com/caimei/modules/hehe/entity/CmHeheImage.java
  12. 187 0
      src/main/java/com/caimei/modules/hehe/entity/CmHeheProduct.java
  13. 95 0
      src/main/java/com/caimei/modules/hehe/entity/CmHeheUser.java
  14. 57 0
      src/main/java/com/caimei/modules/hehe/entity/cmHeHeUserActivity.java
  15. 112 0
      src/main/java/com/caimei/modules/hehe/service/CmHeheActivityProductService.java
  16. 106 0
      src/main/java/com/caimei/modules/hehe/service/CmHeheActivityService.java
  17. 78 0
      src/main/java/com/caimei/modules/hehe/service/CmHeheImageService.java
  18. 112 0
      src/main/java/com/caimei/modules/hehe/service/CmHeheProductService.java
  19. 136 0
      src/main/java/com/caimei/modules/hehe/service/CmHeheUserService.java
  20. 313 0
      src/main/java/com/caimei/modules/hehe/service/HeHeNewOrderService.java
  21. 97 0
      src/main/java/com/caimei/modules/hehe/web/CmHeheActivityController.java
  22. 110 0
      src/main/java/com/caimei/modules/hehe/web/CmHeheActivityProductController.java
  23. 143 0
      src/main/java/com/caimei/modules/hehe/web/CmHeheImageController.java
  24. 152 0
      src/main/java/com/caimei/modules/hehe/web/CmHeheProductController.java
  25. 178 0
      src/main/java/com/caimei/modules/hehe/web/CmHeheUserController.java
  26. 281 0
      src/main/java/com/caimei/modules/hehe/web/HeHeNewOrderController.java
  27. 9 0
      src/main/java/com/caimei/modules/order/entity/CmReturnedPurchase.java
  28. 1 1
      src/main/java/com/caimei/modules/order/entity/NewOrder.java
  29. 24 0
      src/main/java/com/caimei/modules/order/entity/NewOrderProduct.java
  30. 18 7
      src/main/java/com/caimei/modules/order/service/CmDiscernReceiptService.java
  31. 27 2
      src/main/java/com/caimei/modules/order/service/CmPayShopService.java
  32. 3 2
      src/main/java/com/caimei/modules/order/service/CmReturnedPurchaseService.java
  33. 8 4
      src/main/java/com/caimei/modules/order/service/NewOrderService.java
  34. 4 2
      src/main/java/com/caimei/modules/order/service/NewShopOrderService.java
  35. 1 0
      src/main/java/com/caimei/modules/order/web/CmReturnedPurchaseController.java
  36. 213 202
      src/main/java/com/caimei/modules/user/service/CmUserService.java
  37. 1 1
      src/main/resources/config/dev/caimei.properties
  38. 131 0
      src/main/resources/mappings/modules/hehe/CmHeheActivityMapper.xml
  39. 188 0
      src/main/resources/mappings/modules/hehe/CmHeheActivityProductMapper.xml
  40. 108 0
      src/main/resources/mappings/modules/hehe/CmHeheImageMapper.xml
  41. 185 0
      src/main/resources/mappings/modules/hehe/CmHeheProductMapper.xml
  42. 229 0
      src/main/resources/mappings/modules/hehe/CmHeheUserMapper.xml
  43. 253 0
      src/main/resources/mappings/modules/hehe/HeHeNewOrderMapper.xml
  44. 6 0
      src/main/resources/mappings/modules/order/CmReturnedPurchaseMapper.xml
  45. 1 0
      src/main/resources/mappings/modules/order/OrderMapper.xml
  46. 1 0
      src/main/resources/mappings/modules/order/OrderProductMapper.xml
  47. 6 1
      src/main/webapp/WEB-INF/views/modules/bulkpurchase/applyRefoundForm.jsp
  48. 1 1
      src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderConfirmReturnRecord.jsp
  49. 1 1
      src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderReviewReturnRecord.jsp
  50. 122 0
      src/main/webapp/WEB-INF/views/modules/hehe/addActivityProduct.jsp
  51. 126 0
      src/main/webapp/WEB-INF/views/modules/hehe/addUserActivityProduct.jsp
  52. 227 0
      src/main/webapp/WEB-INF/views/modules/hehe/cmHeheActivityForm.jsp
  53. 128 0
      src/main/webapp/WEB-INF/views/modules/hehe/cmHeheActivityList.jsp
  54. 206 0
      src/main/webapp/WEB-INF/views/modules/hehe/cmHeheActivityProductForm.jsp
  55. 194 0
      src/main/webapp/WEB-INF/views/modules/hehe/cmHeheActivityProductList.jsp
  56. 196 0
      src/main/webapp/WEB-INF/views/modules/hehe/cmHeheImageForm.jsp
  57. 151 0
      src/main/webapp/WEB-INF/views/modules/hehe/cmHeheImageList.jsp
  58. 301 0
      src/main/webapp/WEB-INF/views/modules/hehe/cmHeheProductForm.jsp
  59. 179 0
      src/main/webapp/WEB-INF/views/modules/hehe/cmHeheProductList.jsp
  60. 80 0
      src/main/webapp/WEB-INF/views/modules/hehe/cmHeheUserAllList.jsp
  61. 74 0
      src/main/webapp/WEB-INF/views/modules/hehe/cmHeheUserForm.jsp
  62. 80 0
      src/main/webapp/WEB-INF/views/modules/hehe/cmHeheUserList.jsp
  63. 136 0
      src/main/webapp/WEB-INF/views/modules/hehe/heheAddProduct.jsp
  64. 825 0
      src/main/webapp/WEB-INF/views/modules/hehe/heheNewOrderDetail.jsp
  65. 974 0
      src/main/webapp/WEB-INF/views/modules/hehe/heheNewOrderList.jsp
  66. 186 0
      src/main/webapp/WEB-INF/views/modules/hehe/userActivityProductList.jsp
  67. 4 1
      src/main/webapp/WEB-INF/views/modules/order/cmDiscernReceiptForm.jsp
  68. 5 4
      src/main/webapp/WEB-INF/views/modules/order/cmDiscernReceiptList.jsp
  69. 7 1
      src/main/webapp/WEB-INF/views/modules/order/cmPayFormList.jsp
  70. 5 1
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopDetail.jsp
  71. 4 1
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopForm.jsp
  72. 3 1
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopList.jsp
  73. 13 11
      src/main/webapp/WEB-INF/views/modules/order/cmReturnedPurchaseList.jsp

+ 9 - 6
src/main/java/com/caimei/modules/bulkpurchase/web/CmRefundsProductController.java

@@ -301,8 +301,8 @@ public class CmRefundsProductController extends BaseController {
      */
     @RequestMapping(value = "saveRefound")
     public String saveRefound(CmReturnedPurchase cmReturnedPurchase, HttpServletRequest request, HttpServletResponse response, Model model) {
+        NewOrder newOrder = newOrderService.get(cmReturnedPurchase.getOrderID().toString());
         try {
-            NewOrder newOrder = newOrderService.get(cmReturnedPurchase.getOrderID().toString());
             String receiptStatus = "0";
             if (null != newOrder) {
                 receiptStatus = newOrder.getReceiptStatus();//收款状态:1待收款、2部分收款、3已收款
@@ -355,7 +355,7 @@ public class CmRefundsProductController extends BaseController {
                                 freightNum = bean.getApplicationReturnedNum();
                             }
                             //判断退货数量,取消数量 是否大于0
-                            if (bean != null && (bean.getApplicationReturnedNum() != null && bean.getApplicationCancelNum() != null && (bean.getApplicationReturnedNum() > 0 || bean.getApplicationCancelNum() > 0))) {
+                            if (bean.getApplicationReturnedNum() != null && bean.getApplicationCancelNum() != null && (bean.getApplicationReturnedNum() > 0 || bean.getApplicationCancelNum() > 0)) {
                                 bean.setActualReturnedNum(bean.getApplicationReturnedNum());
                                 bean.setActualCancelNum(bean.getApplicationCancelNum());
                                 NewOrderProduct orderProduct = newOrderProductService.get(bean.getOrderProductID().toString());
@@ -436,7 +436,7 @@ public class CmRefundsProductController extends BaseController {
         } catch (Exception e) {
             e.printStackTrace();
         }
-        return "redirect:" + Global.getAdminPath() + "/order/cmReturnedPurchase/";
+        return "redirect:" + Global.getAdminPath() + "/order/cmReturnedPurchase/list?orderType=" + newOrder.getOrderType();
     }
 
     //计算退款用户数据
@@ -739,14 +739,15 @@ public class CmRefundsProductController extends BaseController {
      */
     @RequestMapping(value = "cancelApply")
     public String cancelApply(CmReturnedPurchase cmReturnedPurchase, RedirectAttributes redirectAttributes) {
+        NewOrder order = new NewOrder();
         try {
             cmReturnedPurchase.setDelFlag("1");
-            cmReturnedPurchaseService.cancelApply(cmReturnedPurchase);
+            order = cmReturnedPurchaseService.cancelApply(cmReturnedPurchase);
         } catch (Exception e) {
             addMessage(redirectAttributes, e.getMessage());
             e.printStackTrace();
         }
-        return "redirect:" + Global.getAdminPath() + "/order/cmReturnedPurchase/";
+        return "redirect:" + Global.getAdminPath() + "/order/cmReturnedPurchase/list?orderType=" + order.getOrderType();
     }
 
     /**
@@ -758,16 +759,18 @@ public class CmRefundsProductController extends BaseController {
      */
     @RequestMapping(value = "revokeApply")
     public String revokeApply(CmReturnedPurchase cmReturnedPurchase, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+        NewOrder order = new NewOrder();
         try {
             cmReturnedPurchase = cmReturnedPurchaseService.get(cmReturnedPurchase.getId());
             if (!"2".equals(cmReturnedPurchase.getStatus())) {
                 throw new Exception("该退款单状态已发生改变,不可撤销");
             }
+            order = newOrderService.findByOrderID(cmReturnedPurchase.getOrderID());
             cmReturnedPurchaseService.revokeApply(cmReturnedPurchase, request);
         } catch (Exception e) {
             addMessage(redirectAttributes, e.getMessage());
             e.printStackTrace();
         }
-        return "redirect:" + Global.getAdminPath() + "/order/cmReturnedPurchase/";
+        return "redirect:" + Global.getAdminPath() + "/order/cmReturnedPurchase/list?orderType=" + order.getOrderType();
     }
 }

+ 30 - 0
src/main/java/com/caimei/modules/hehe/dao/CmHeheActivityDao.java

@@ -0,0 +1,30 @@
+package com.caimei.modules.hehe.dao;
+
+import com.caimei.modules.hehe.entity.CmHeheActivity;
+import com.thinkgem.jeesite.common.persistence.CrudDao;
+import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 呵呵商城活动DAO接口
+ *
+ * @author plf
+ * @version 2021-04-19
+ */
+@MyBatisDao
+public interface CmHeheActivityDao extends CrudDao<CmHeheActivity> {
+
+    /**
+     * 修改小程序状态
+     *
+     * @param status
+     * @param id
+     */
+    void updateStatusById(@Param("status") String status, @Param("id") Integer id);
+
+    void deleteActivityProduct(String activityId);
+
+    void deleteUserActivity(String activityId);
+
+    void deleteActivityLadder(String activityId);
+}

+ 73 - 0
src/main/java/com/caimei/modules/hehe/dao/CmHeheActivityProductDao.java

@@ -0,0 +1,73 @@
+package com.caimei.modules.hehe.dao;
+
+import com.caimei.modules.hehe.entity.CmHeHeActivityLadder;
+import com.caimei.modules.hehe.entity.CmHeheProduct;
+import com.thinkgem.jeesite.common.persistence.CrudDao;
+import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
+import com.caimei.modules.hehe.entity.CmHeheActivityProduct;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 活动商品DAO接口
+ *
+ * @author plf
+ * @version 2021-04-20
+ */
+@MyBatisDao
+public interface CmHeheActivityProductDao extends CrudDao<CmHeheActivityProduct> {
+    /**
+     * 查询活动商品id
+     *
+     * @return
+     */
+    List<Integer> findActivityProductId();
+
+    /**
+     * 查询呵呵商城所有上架商品
+     *
+     * @param product
+     * @return
+     */
+    List<CmHeheProduct> findAllHeHeProduct(CmHeheProduct product);
+
+    /**
+     * 查询活动阶梯
+     *
+     * @param activityId
+     * @param productId
+     * @return
+     */
+    List<CmHeHeActivityLadder> findActivityLadder(@Param("activityId") Integer activityId, @Param("productId") Integer productId);
+
+    /**
+     * 保存活动阶梯
+     *
+     * @param ladder
+     */
+    void insertLadder(CmHeHeActivityLadder ladder);
+
+    /**
+     * 删除活动阶梯
+     *
+     * @param activityId
+     * @param productId
+     */
+    void deleteLadder(@Param("activityId") Integer activityId, @Param("productId") Integer productId);
+
+    /**
+     * 根据商品id查询活动
+     *
+     * @param productId
+     * @return
+     */
+    Integer findActivityByProductId(String productId);
+
+    /**
+     * 删除分销者活动商品
+     *
+     * @param productId
+     */
+    void deleteUserActivity(Integer productId);
+}

+ 26 - 0
src/main/java/com/caimei/modules/hehe/dao/CmHeheImageDao.java

@@ -0,0 +1,26 @@
+package com.caimei.modules.hehe.dao;
+
+import com.thinkgem.jeesite.common.persistence.CrudDao;
+import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
+import com.caimei.modules.hehe.entity.CmHeheImage;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 呵呵轮播图DAO接口
+ *
+ * @author plf
+ * @version 2021-04-15
+ */
+@MyBatisDao
+public interface CmHeheImageDao extends CrudDao<CmHeheImage> {
+
+    /**
+     * 修改小程序状态
+     *
+     * @param status
+     * @param id
+     */
+    void updateStatusById(@Param("status") String status, @Param("id") Integer id);
+
+    void saveSort(@Param("sort") String sort, @Param("id") String id);
+}

+ 49 - 0
src/main/java/com/caimei/modules/hehe/dao/CmHeheProductDao.java

@@ -0,0 +1,49 @@
+package com.caimei.modules.hehe.dao;
+
+import com.caimei.modules.product.entity.Product;
+import com.thinkgem.jeesite.common.persistence.CrudDao;
+import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
+import com.caimei.modules.hehe.entity.CmHeheProduct;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 呵呵商品DAO接口
+ *
+ * @author plf
+ * @version 2021-04-14
+ */
+@MyBatisDao
+public interface CmHeheProductDao extends CrudDao<CmHeheProduct> {
+
+    /**
+     * 查询呵呵商城商品所有商品id
+     *
+     * @return
+     */
+    List<Integer> findHeHeProductId();
+
+    /**
+     * 查询采美所有商品
+     *
+     * @param product
+     * @return
+     */
+    List<Product> findAllProduct(Product product);
+
+    /**
+     * 保存排序值
+     *
+     * @param sort
+     * @param id
+     */
+    void saveSort(@Param("sort") String sort, @Param("id") String id);
+
+    /**
+     * 删除活动商品
+     *
+     * @param productId
+     */
+    void deleteActivityProduct(Integer productId);
+}

+ 80 - 0
src/main/java/com/caimei/modules/hehe/dao/CmHeheUserDao.java

@@ -0,0 +1,80 @@
+package com.caimei.modules.hehe.dao;
+
+import com.caimei.modules.hehe.entity.CmHeheActivityProduct;
+import com.caimei.modules.hehe.entity.CmHeheProduct;
+import com.caimei.modules.hehe.entity.cmHeHeUserActivity;
+import com.caimei.modules.user.entity.CmUser;
+import com.thinkgem.jeesite.common.persistence.CrudDao;
+import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
+import com.caimei.modules.hehe.entity.CmHeheUser;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 呵呵用户DAO接口
+ *
+ * @author plf
+ * @version 2021-04-14
+ */
+@MyBatisDao
+public interface CmHeheUserDao extends CrudDao<CmHeheUser> {
+
+    /**
+     * 查询手机号唯一
+     *
+     * @param cmHeheUser
+     * @return
+     */
+    Integer findMobileOnly(CmHeheUser cmHeheUser);
+
+    /**
+     * 保存user信息
+     *
+     * @param user
+     */
+    void insertUser(CmUser user);
+
+    void updateUser(CmUser user);
+
+    /**
+     * 分销者活动商品列表
+     *
+     * @param activityProduct
+     * @return
+     */
+    List<CmHeheActivityProduct> activityProductList(CmHeheActivityProduct activityProduct);
+
+    /**
+     * 分销者下活动商品
+     *
+     * @param userId
+     * @return
+     */
+    List<Integer> findUserActivityProduct(Integer userId);
+
+    /**
+     * 查询所有参与活动的商品
+     *
+     * @param product
+     * @return
+     */
+    List<CmHeheProduct> findAllActivityProduct(CmHeheProduct product);
+
+    /**
+     * 保存活动商品到用户活动
+     *
+     * @param userActivity
+     */
+    void insertUserActivity(cmHeHeUserActivity userActivity);
+
+    /**
+     * 修改排序值
+     *
+     * @param sort
+     * @param id
+     */
+    void updateSortById(@Param("sort") String sort, @Param("id") String id);
+
+    void deleteUserActivity(@Param("userId") Integer userId, @Param("productId") String productId);
+}

+ 22 - 0
src/main/java/com/caimei/modules/hehe/dao/HeHeNewOrderDao.java

@@ -0,0 +1,22 @@
+package com.caimei.modules.hehe.dao;
+
+import com.caimei.modules.order.entity.NewOrder;
+import com.thinkgem.jeesite.common.persistence.CrudDao;
+import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
+
+/**
+ * Description
+ *
+ * @author : plf
+ * @date : 2021/4/27
+ */
+@MyBatisDao
+public interface HeHeNewOrderDao extends CrudDao<NewOrder> {
+    /**
+     * 查询分销者信息
+     *
+     * @param heUserId
+     * @return
+     */
+    String findHeUser(Integer heUserId);
+}

+ 77 - 0
src/main/java/com/caimei/modules/hehe/entity/CmHeHeActivityLadder.java

@@ -0,0 +1,77 @@
+package com.caimei.modules.hehe.entity;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * Description
+ *
+ * @author : plf
+ * @date : 2021/4/20
+ */
+public class CmHeHeActivityLadder implements Serializable {
+    private Integer id;
+    private Integer activityId;     //活动id
+    private Integer productId;      //对应采美商品id
+    private Integer ladderNum;  //第几阶梯
+    private Integer buyNum;     //购买数量
+    private BigDecimal buyPrice;    //购买价格
+    private Date createDate;      //创建时间
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getActivityId() {
+        return activityId;
+    }
+
+    public void setActivityId(Integer activityId) {
+        this.activityId = activityId;
+    }
+
+    public Integer getProductId() {
+        return productId;
+    }
+
+    public void setProductId(Integer productId) {
+        this.productId = productId;
+    }
+
+    public Integer getLadderNum() {
+        return ladderNum;
+    }
+
+    public void setLadderNum(Integer ladderNum) {
+        this.ladderNum = ladderNum;
+    }
+
+    public Integer getBuyNum() {
+        return buyNum;
+    }
+
+    public void setBuyNum(Integer buyNum) {
+        this.buyNum = buyNum;
+    }
+
+    public BigDecimal getBuyPrice() {
+        return buyPrice;
+    }
+
+    public void setBuyPrice(BigDecimal buyPrice) {
+        this.buyPrice = buyPrice;
+    }
+
+    public Date getCreateDate() {
+        return createDate;
+    }
+
+    public void setCreateDate(Date createDate) {
+        this.createDate = createDate;
+    }
+}

+ 102 - 0
src/main/java/com/caimei/modules/hehe/entity/CmHeheActivity.java

@@ -0,0 +1,102 @@
+package com.caimei.modules.hehe.entity;
+
+import org.hibernate.validator.constraints.Length;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+
+/**
+ * 呵呵商城活动Entity
+ * @author plf
+ * @version 2021-04-19
+ */
+public class CmHeheActivity extends DataEntity<CmHeheActivity> {
+	
+	private static final long serialVersionUID = 1L;
+	private String name;		// 活动名称
+	private String status;		// 小程序状态:1启用,2停用
+	private String listImage;		// 小程序列表缩略图
+	private String detailsImage;		// 小程序详情主题图
+	private Date beginTime;		// 开始时间
+	private Date endTime;		// 结束时间
+	private Date addTime;		// 创建时间
+	private Integer activityStatus;  	//活动状态:1未开始,2进行中,3已结束
+	
+	public CmHeheActivity() {
+		super();
+	}
+
+	public CmHeheActivity(String id){
+		super(id);
+	}
+
+	@Length(min=0, max=50, message="活动名称长度必须介于 0 和 50 之间")
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	@Length(min=0, max=1, message="小程序状态长度必须介于 0 和 1 之间")
+	public String getStatus() {
+		return status;
+	}
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+	
+	public String getListImage() {
+		return listImage;
+	}
+
+	public void setListImage(String listImage) {
+		this.listImage = listImage;
+	}
+	
+	public String getDetailsImage() {
+		return detailsImage;
+	}
+
+	public void setDetailsImage(String detailsImage) {
+		this.detailsImage = detailsImage;
+	}
+	
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	public Date getBeginTime() {
+		return beginTime;
+	}
+
+	public void setBeginTime(Date beginTime) {
+		this.beginTime = beginTime;
+	}
+	
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	public Date getEndTime() {
+		return endTime;
+	}
+
+	public void setEndTime(Date endTime) {
+		this.endTime = endTime;
+	}
+	
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	public Date getAddTime() {
+		return addTime;
+	}
+
+	public void setAddTime(Date addTime) {
+		this.addTime = addTime;
+	}
+
+	public Integer getActivityStatus() {
+		return activityStatus;
+	}
+
+	public void setActivityStatus(Integer activityStatus) {
+		this.activityStatus = activityStatus;
+	}
+}

+ 127 - 0
src/main/java/com/caimei/modules/hehe/entity/CmHeheActivityProduct.java

@@ -0,0 +1,127 @@
+package com.caimei.modules.hehe.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 活动商品Entity
+ *
+ * @author plf
+ * @version 2021-04-20
+ */
+public class CmHeheActivityProduct extends DataEntity<CmHeheActivityProduct> {
+
+    private static final long serialVersionUID = 1L;
+    private Integer activityId;        // 呵呵活动id
+    private Integer productId;        // 对应采美商品id
+    private String sort;        // 排序值
+    private Date addTime;        // 添加时间
+    private String name;         //商品名称
+    private String mainImage;       //商品图片
+    private String shopName;        //供应商名称
+    private BigDecimal price;        // 售价
+    private String unit;        //包装规格
+    private Integer userId;         //用户id
+    private List<CmHeHeActivityLadder> activityLadderList;  //活动阶梯
+
+    public CmHeheActivityProduct() {
+        super();
+    }
+
+    public CmHeheActivityProduct(String id) {
+        super(id);
+    }
+
+    public Integer getActivityId() {
+        return activityId;
+    }
+
+    public void setActivityId(Integer activityId) {
+        this.activityId = activityId;
+    }
+
+    public Integer getProductId() {
+        return productId;
+    }
+
+    public void setProductId(Integer productId) {
+        this.productId = productId;
+    }
+
+    public String getSort() {
+        return sort;
+    }
+
+    public void setSort(String sort) {
+        this.sort = sort;
+    }
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    public Date getAddTime() {
+        return addTime;
+    }
+
+    public void setAddTime(Date addTime) {
+        this.addTime = addTime;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getMainImage() {
+        return mainImage;
+    }
+
+    public void setMainImage(String mainImage) {
+        this.mainImage = mainImage;
+    }
+
+    public String getShopName() {
+        return shopName;
+    }
+
+    public void setShopName(String shopName) {
+        this.shopName = shopName;
+    }
+
+    public BigDecimal getPrice() {
+        return price;
+    }
+
+    public void setPrice(BigDecimal price) {
+        this.price = price;
+    }
+
+    public String getUnit() {
+        return unit;
+    }
+
+    public void setUnit(String unit) {
+        this.unit = unit;
+    }
+
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
+    public List<CmHeHeActivityLadder> getActivityLadderList() {
+        return activityLadderList;
+    }
+
+    public void setActivityLadderList(List<CmHeHeActivityLadder> activityLadderList) {
+        this.activityLadderList = activityLadderList;
+    }
+}

+ 74 - 0
src/main/java/com/caimei/modules/hehe/entity/CmHeheImage.java

@@ -0,0 +1,74 @@
+package com.caimei.modules.hehe.entity;
+
+import org.hibernate.validator.constraints.Length;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+
+/**
+ * 呵呵轮播图Entity
+ * @author plf
+ * @version 2021-04-15
+ */
+public class CmHeheImage extends DataEntity<CmHeheImage> {
+	
+	private static final long serialVersionUID = 1L;
+	private String topic;		// 主题
+	private String image;		// 图片
+	private String sort;		// 排序值
+	private String status;		// 小程序状态:1启用,2停用
+	private Date addTime;		// 添加时间
+	
+	public CmHeheImage() {
+		super();
+	}
+
+	public CmHeheImage(String id){
+		super(id);
+	}
+
+	@Length(min=0, max=50, message="主题长度必须介于 0 和 50 之间")
+	public String getTopic() {
+		return topic;
+	}
+
+	public void setTopic(String topic) {
+		this.topic = topic;
+	}
+	
+	public String getImage() {
+		return image;
+	}
+
+	public void setImage(String image) {
+		this.image = image;
+	}
+	
+	public String getSort() {
+		return sort;
+	}
+
+	public void setSort(String sort) {
+		this.sort = sort;
+	}
+	
+	@Length(min=0, max=1, message="小程序状态:1启用,2停用长度必须介于 0 和 1 之间")
+	public String getStatus() {
+		return status;
+	}
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+	
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	public Date getAddTime() {
+		return addTime;
+	}
+
+	public void setAddTime(Date addTime) {
+		this.addTime = addTime;
+	}
+	
+}

+ 187 - 0
src/main/java/com/caimei/modules/hehe/entity/CmHeheProduct.java

@@ -0,0 +1,187 @@
+package com.caimei.modules.hehe.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+import org.hibernate.validator.constraints.Length;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 呵呵商品Entity
+ *
+ * @author plf
+ * @version 2021-04-14
+ */
+public class CmHeheProduct extends DataEntity<CmHeheProduct> {
+
+    private static final long serialVersionUID = 1L;
+    private Integer productId;        // 对应采美商品id
+    private Integer sort;        // 排序值
+    private String recommend;        // 是否为推荐商品(0 没推荐,1 推荐商品)
+    private String validFlag;        // 上架状态:1上架,2下架
+    private BigDecimal price;        // 售价
+    private String includedTax;        // 是否含税 0不含税,1含税
+    private String invoiceType;        // 发票类型(基于是否含税基础) 1增值税专用发票,2增值税普通发票, 3不能开票
+    private BigDecimal clubTaxPoint;        // 机构税率 :增值税默认13%,普通票6%取值范围[0-100]
+    private BigDecimal shopTaxPoint;        // 供应商税率:增值专用发票默认13%,增值税普通发票6%取值范围[0-100]
+    private String costType;        // 成本价类型:1固定成本 2比例成本
+    private BigDecimal costPrice;        // 成本价
+    private BigDecimal costProportional;        // 比例成本百分比
+    private Date addTime;        // 添加时间
+    private String name;         //商品名称
+    private String mainImage;       //商品图片
+    private String shopName;        //供应商名称
+    private List<Integer> ids;             //刚添加的活动id
+
+    public CmHeheProduct() {
+        super();
+    }
+
+    public CmHeheProduct(String id) {
+        super(id);
+    }
+
+    public Integer getProductId() {
+        return productId;
+    }
+
+    public void setProductId(Integer productId) {
+        this.productId = productId;
+    }
+
+    public Integer getSort() {
+        return sort;
+    }
+
+    public void setSort(Integer sort) {
+        this.sort = sort;
+    }
+
+    @Length(min = 0, max = 2, message = "是否为推荐商品(0 没推荐,1 推荐商品)长度必须介于 0 和 2 之间")
+    public String getRecommend() {
+        return recommend;
+    }
+
+    public void setRecommend(String recommend) {
+        this.recommend = recommend;
+    }
+
+    @Length(min = 0, max = 2, message = "上架状态:1上架,2下架长度必须介于 0 和 2 之间")
+    public String getValidFlag() {
+        return validFlag;
+    }
+
+    public void setValidFlag(String validFlag) {
+        this.validFlag = validFlag;
+    }
+
+    public BigDecimal getPrice() {
+        return price;
+    }
+
+    public void setPrice(BigDecimal price) {
+        this.price = price;
+    }
+
+    @Length(min = 0, max = 2, message = "是否含税 0不含税,1含税长度必须介于 0 和 2 之间")
+    public String getIncludedTax() {
+        return includedTax;
+    }
+
+    public void setIncludedTax(String includedTax) {
+        this.includedTax = includedTax;
+    }
+
+    @Length(min = 0, max = 2, message = "发票类型(基于是否含税基础) 1增值税专用发票,2增值税普通发票, 3不能开票长度必须介于 0 和 2 之间")
+    public String getInvoiceType() {
+        return invoiceType;
+    }
+
+    public void setInvoiceType(String invoiceType) {
+        this.invoiceType = invoiceType;
+    }
+
+    public BigDecimal getClubTaxPoint() {
+        return clubTaxPoint;
+    }
+
+    public void setClubTaxPoint(BigDecimal clubTaxPoint) {
+        this.clubTaxPoint = clubTaxPoint;
+    }
+
+    public BigDecimal getShopTaxPoint() {
+        return shopTaxPoint;
+    }
+
+    public void setShopTaxPoint(BigDecimal shopTaxPoint) {
+        this.shopTaxPoint = shopTaxPoint;
+    }
+
+    @Length(min = 0, max = 2, message = "成本价类型:1固定成本 2比例成本长度必须介于 0 和 2 之间")
+    public String getCostType() {
+        return costType;
+    }
+
+    public void setCostType(String costType) {
+        this.costType = costType;
+    }
+
+    public BigDecimal getCostPrice() {
+        return costPrice;
+    }
+
+    public void setCostPrice(BigDecimal costPrice) {
+        this.costPrice = costPrice;
+    }
+
+    public BigDecimal getCostProportional() {
+        return costProportional;
+    }
+
+    public void setCostProportional(BigDecimal costProportional) {
+        this.costProportional = costProportional;
+    }
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    public Date getAddTime() {
+        return addTime;
+    }
+
+    public void setAddTime(Date addTime) {
+        this.addTime = addTime;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getMainImage() {
+        return mainImage;
+    }
+
+    public void setMainImage(String mainImage) {
+        this.mainImage = mainImage;
+    }
+
+    public String getShopName() {
+        return shopName;
+    }
+
+    public void setShopName(String shopName) {
+        this.shopName = shopName;
+    }
+
+    public List<Integer> getIds() {
+        return ids;
+    }
+
+    public void setIds(List<Integer> ids) {
+        this.ids = ids;
+    }
+}

+ 95 - 0
src/main/java/com/caimei/modules/hehe/entity/CmHeheUser.java

@@ -0,0 +1,95 @@
+package com.caimei.modules.hehe.entity;
+
+import org.hibernate.validator.constraints.Length;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+
+/**
+ * 呵呵用户Entity
+ * @author plf
+ * @version 2021-04-14
+ */
+public class CmHeheUser extends DataEntity<CmHeheUser> {
+	
+	private static final long serialVersionUID = 1L;
+	private Integer userId;		//对应user表用户id
+	private String name;		// 姓名
+	private String mobile;		// 手机号
+	private String userIdentity;		// 用户身份:1普通用户,2分销者
+	private String nickName;		// 微信昵称
+	private String openId;		// 微信openid
+	private Date addTime;		// 添加时间
+	
+	public CmHeheUser() {
+		super();
+	}
+
+	public CmHeheUser(String id){
+		super(id);
+	}
+
+	public Integer getUserId() {
+		return userId;
+	}
+
+	public void setUserId(Integer userId) {
+		this.userId = userId;
+	}
+
+	@Length(min=0, max=30, message="姓名长度必须介于 0 和 30 之间")
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	@Length(min=0, max=20, message="手机号长度必须介于 0 和 20 之间")
+	public String getMobile() {
+		return mobile;
+	}
+
+	public void setMobile(String mobile) {
+		this.mobile = mobile;
+	}
+	
+	@Length(min=0, max=2, message="用户身份:1普通用户,2分销者长度必须介于 0 和 2 之间")
+	public String getUserIdentity() {
+		return userIdentity;
+	}
+
+	public void setUserIdentity(String userIdentity) {
+		this.userIdentity = userIdentity;
+	}
+	
+	@Length(min=0, max=32, message="微信昵称长度必须介于 0 和 32 之间")
+	public String getNickName() {
+		return nickName;
+	}
+
+	public void setNickName(String nickName) {
+		this.nickName = nickName;
+	}
+	
+	@Length(min=0, max=32, message="微信openid长度必须介于 0 和 32 之间")
+	public String getOpenId() {
+		return openId;
+	}
+
+	public void setOpenId(String openId) {
+		this.openId = openId;
+	}
+	
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	public Date getAddTime() {
+		return addTime;
+	}
+
+	public void setAddTime(Date addTime) {
+		this.addTime = addTime;
+	}
+	
+}

+ 57 - 0
src/main/java/com/caimei/modules/hehe/entity/cmHeHeUserActivity.java

@@ -0,0 +1,57 @@
+package com.caimei.modules.hehe.entity;
+
+import java.io.Serializable;
+
+/**
+ * Description
+ *
+ * @author : plf
+ * @date : 2021/4/23
+ */
+public class cmHeHeUserActivity implements Serializable {
+    private Integer id;
+    private Integer userId; //用户id
+    private Integer activityId; //活动id
+    private Integer productId;  //商品id
+    private Integer sort;       //排序值
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
+    public Integer getActivityId() {
+        return activityId;
+    }
+
+    public void setActivityId(Integer activityId) {
+        this.activityId = activityId;
+    }
+
+    public Integer getProductId() {
+        return productId;
+    }
+
+    public void setProductId(Integer productId) {
+        this.productId = productId;
+    }
+
+    public Integer getSort() {
+        return sort;
+    }
+
+    public void setSort(Integer sort) {
+        this.sort = sort;
+    }
+}

+ 112 - 0
src/main/java/com/caimei/modules/hehe/service/CmHeheActivityProductService.java

@@ -0,0 +1,112 @@
+package com.caimei.modules.hehe.service;
+
+import com.caimei.modules.hehe.dao.CmHeheActivityProductDao;
+import com.caimei.modules.hehe.entity.CmHeHeActivityLadder;
+import com.caimei.modules.hehe.entity.CmHeheActivityProduct;
+import com.caimei.modules.hehe.entity.CmHeheProduct;
+import com.caimei.utils.AppUtils;
+import com.caimei.utils.StringUtil;
+import com.thinkgem.jeesite.common.config.Global;
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.service.CrudService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 活动商品Service
+ *
+ * @author plf
+ * @version 2021-04-20
+ */
+@Service
+@Transactional(readOnly = true)
+public class CmHeheActivityProductService extends CrudService<CmHeheActivityProductDao, CmHeheActivityProduct> {
+    @Autowired
+    private CmHeheActivityProductDao activityProductDao;
+
+    public CmHeheActivityProduct get(String id) {
+        CmHeheActivityProduct activityProduct = super.get(id);
+        List<CmHeHeActivityLadder> activityLadderList = activityProductDao.findActivityLadder(activityProduct.getActivityId(), activityProduct.getProductId());
+        activityProduct.setActivityLadderList(activityLadderList);
+        return activityProduct;
+    }
+
+    public List<CmHeheActivityProduct> findList(CmHeheActivityProduct cmHeheActivityProduct) {
+        return super.findList(cmHeheActivityProduct);
+    }
+
+    public Page<CmHeheActivityProduct> findPage(Page<CmHeheActivityProduct> page, CmHeheActivityProduct cmHeheActivityProduct) {
+        Page<CmHeheActivityProduct> productPage = super.findPage(page, cmHeheActivityProduct);
+        List<CmHeheActivityProduct> productList = productPage.getList();
+        String wwwServer = Global.getConfig("wwwServer");
+        productList.forEach(item -> {
+            List<CmHeHeActivityLadder> activityLadderList = activityProductDao.findActivityLadder(item.getActivityId(), item.getProductId());
+            if (StringUtil.isNotBlank(item.getMainImage())) {
+                item.setMainImage(AppUtils.getImageURL("product", item.getMainImage(), 0, wwwServer));
+            }
+            item.setActivityLadderList(activityLadderList);
+        });
+        return productPage;
+    }
+
+    @Transactional(readOnly = false)
+    public void delete(CmHeheActivityProduct cmHeheActivityProduct) {
+        super.delete(cmHeheActivityProduct);
+        activityProductDao.deleteUserActivity(cmHeheActivityProduct.getProductId());
+        activityProductDao.deleteLadder(null, cmHeheActivityProduct.getProductId());
+    }
+
+    public Page<CmHeheProduct> findProductPage(Page<CmHeheProduct> productPage, CmHeheProduct product) {
+        List<Integer> productIds = activityProductDao.findActivityProductId();
+        product.setIds(productIds);
+        product.setPage(productPage);
+        List<CmHeheProduct> productList = activityProductDao.findAllHeHeProduct(product);
+        String wwwServer = Global.getConfig("wwwServer");
+        productList.forEach(item -> {
+            if (StringUtil.isNotBlank(item.getMainImage())) {
+                item.setMainImage(AppUtils.getImageURL("product", item.getMainImage(), 0, wwwServer));
+            }
+        });
+        productPage.setList(productList);
+        return productPage;
+    }
+
+    @Transactional(readOnly = false)
+    public void addProducts(Integer activityId, String productIds) {
+        CmHeheActivityProduct activityProduct = new CmHeheActivityProduct();
+        activityProduct.setActivityId(activityId);
+        if (StringUtil.isNotBlank(productIds)) {
+            String[] ids = productIds.split(",");
+            for (String id : ids) {
+                if (StringUtil.isNotBlank(id)) {
+                    activityProduct.setProductId(Integer.valueOf(id));
+                    activityProductDao.insert(activityProduct);
+                }
+            }
+        }
+    }
+
+    @Transactional(readOnly = false)
+    public void saveActivityLadder(String params, String id) {
+        CmHeheActivityProduct activityProduct = activityProductDao.get(id);
+        if (StringUtil.isNotBlank(params)) {
+            activityProductDao.deleteLadder(activityProduct.getActivityId(), activityProduct.getProductId());
+            CmHeHeActivityLadder ladder = new CmHeHeActivityLadder();
+            ladder.setActivityId(activityProduct.getActivityId());
+            ladder.setProductId(activityProduct.getProductId());
+            int ladderNum = 0;
+            String[] ladders = params.split("-");
+            for (String l : ladders) {
+                ladderNum++;
+                ladder.setLadderNum(ladderNum);
+                ladder.setBuyNum(Integer.valueOf(l.split(",")[0]));
+                ladder.setBuyPrice(new BigDecimal(l.split(",")[1]));
+                activityProductDao.insertLadder(ladder);
+            }
+        }
+    }
+}

+ 106 - 0
src/main/java/com/caimei/modules/hehe/service/CmHeheActivityService.java

@@ -0,0 +1,106 @@
+package com.caimei.modules.hehe.service;
+
+import com.caimei.dfs.image.beens.ImageUploadInfo;
+import com.caimei.modules.brand.utils.ImagePathUtils;
+import com.caimei.modules.hehe.dao.CmHeheActivityDao;
+import com.caimei.modules.hehe.entity.CmHeheActivity;
+import com.caimei.modules.sys.utils.UploadImageUtils;
+import com.thinkgem.jeesite.common.config.Global;
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.service.CrudService;
+import com.thinkgem.jeesite.common.utils.Encodes;
+import com.thinkgem.jeesite.common.utils.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 呵呵商城活动Service
+ *
+ * @author plf
+ * @version 2021-04-19
+ */
+@Service
+@Transactional(readOnly = true)
+public class CmHeheActivityService extends CrudService<CmHeheActivityDao, CmHeheActivity> {
+    @Autowired
+    private CmHeheActivityDao cmHeheActivityDao;
+
+    public CmHeheActivity get(String id) {
+        return super.get(id);
+    }
+
+    public List<CmHeheActivity> findList(CmHeheActivity cmHeheActivity) {
+        return super.findList(cmHeheActivity);
+    }
+
+    public Page<CmHeheActivity> findPage(Page<CmHeheActivity> page, CmHeheActivity cmHeheActivity) {
+        Page<CmHeheActivity> activityPage = super.findPage(page, cmHeheActivity);
+        List<CmHeheActivity> activityList = activityPage.getList();
+        if (activityList != null && activityList.size() > 0) {
+            activityList.forEach(activity -> {
+                Date date = new Date();
+                if (date.compareTo(activity.getBeginTime()) < 0) {
+                    activity.setActivityStatus(1);
+                } else if (date.compareTo(activity.getEndTime()) < 1) {
+                    activity.setActivityStatus(2);
+                } else {
+                    activity.setActivityStatus(3);
+                }
+            });
+        }
+        return activityPage;
+    }
+
+    @Transactional(readOnly = false)
+    public void save(CmHeheActivity cmHeheActivity) {
+        //保存图片
+        String listImage = cmHeheActivity.getListImage();
+        String photoServer = Global.getConfig("photoServer");//获取文件服务器地址
+        if (StringUtils.isNotBlank(listImage) && !listImage.startsWith("http")) {
+            listImage = Encodes.urlDecode(listImage);
+            String realPath = UploadImageUtils.getAbsolutePath(listImage);
+            int pointerIndex = realPath.lastIndexOf(".");
+            ImageUploadInfo saveImageSerivce = new ImageUploadInfo();
+            try {
+                saveImageSerivce = ImagePathUtils.saveImageSerivce(realPath, pointerIndex, realPath);
+                cmHeheActivity.setListImage(photoServer + saveImageSerivce.getSource());
+            } catch (Exception e) {
+                logger.error("图片上传错误:" + e.toString(), e);
+            }
+        }
+        String detailsImage = cmHeheActivity.getDetailsImage();
+        if (StringUtils.isNotBlank(detailsImage) && !detailsImage.startsWith("http")) {
+            detailsImage = Encodes.urlDecode(detailsImage);
+            String realPath = UploadImageUtils.getAbsolutePath(detailsImage);
+            int pointerIndex = realPath.lastIndexOf(".");
+            ImageUploadInfo saveImageSerivce = new ImageUploadInfo();
+            try {
+                saveImageSerivce = ImagePathUtils.saveImageSerivce(realPath, pointerIndex, realPath);
+                cmHeheActivity.setDetailsImage(photoServer + saveImageSerivce.getSource());
+            } catch (Exception e) {
+                logger.error("图片上传错误:" + e.toString(), e);
+            }
+        }
+        super.save(cmHeheActivity);
+    }
+
+    @Transactional(readOnly = false)
+    public void delete(CmHeheActivity cmHeheActivity) {
+        super.delete(cmHeheActivity);
+        //删除活动下商品
+        cmHeheActivityDao.deleteActivityProduct(cmHeheActivity.getId());
+        //删除分销者活动商品
+        cmHeheActivityDao.deleteUserActivity(cmHeheActivity.getId());
+        //删除活动商品阶梯
+        cmHeheActivityDao.deleteActivityLadder(cmHeheActivity.getId());
+    }
+
+    @Transactional(readOnly = false)
+    public void updateStatusById(String status, Integer id) {
+        cmHeheActivityDao.updateStatusById(status, id);
+    }
+}

+ 78 - 0
src/main/java/com/caimei/modules/hehe/service/CmHeheImageService.java

@@ -0,0 +1,78 @@
+package com.caimei.modules.hehe.service;
+
+import java.util.List;
+
+import com.caimei.dfs.image.beens.ImageUploadInfo;
+import com.caimei.modules.brand.utils.ImagePathUtils;
+import com.caimei.modules.sys.utils.UploadImageUtils;
+import com.thinkgem.jeesite.common.config.Global;
+import com.thinkgem.jeesite.common.utils.Encodes;
+import com.thinkgem.jeesite.common.utils.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.service.CrudService;
+import com.caimei.modules.hehe.entity.CmHeheImage;
+import com.caimei.modules.hehe.dao.CmHeheImageDao;
+
+/**
+ * 呵呵轮播图Service
+ *
+ * @author plf
+ * @version 2021-04-15
+ */
+@Service
+@Transactional(readOnly = true)
+public class CmHeheImageService extends CrudService<CmHeheImageDao, CmHeheImage> {
+    @Autowired
+    private CmHeheImageDao cmHeheImageDao;
+
+    public CmHeheImage get(String id) {
+        return super.get(id);
+    }
+
+    public List<CmHeheImage> findList(CmHeheImage cmHeheImage) {
+        return super.findList(cmHeheImage);
+    }
+
+    public Page<CmHeheImage> findPage(Page<CmHeheImage> page, CmHeheImage cmHeheImage) {
+        return super.findPage(page, cmHeheImage);
+    }
+
+    @Transactional(readOnly = false)
+    public void save(CmHeheImage cmHeheImage) {
+        //保存图片
+        String image = cmHeheImage.getImage();
+        if (StringUtils.isNotBlank(image) && !image.startsWith("http")) {
+            String photoServer = Global.getConfig("photoServer");//获取文件服务器地址
+            image = Encodes.urlDecode(image);
+            String realPath = UploadImageUtils.getAbsolutePath(image);
+            int pointerIndex = realPath.lastIndexOf(".");
+            ImageUploadInfo saveImageSerivce = new ImageUploadInfo();
+            try {
+                saveImageSerivce = ImagePathUtils.saveImageSerivce(realPath, pointerIndex, realPath);
+                cmHeheImage.setImage(photoServer + saveImageSerivce.getSource());
+            } catch (Exception e) {
+                logger.error("图片上传错误:" + e.toString(), e);
+            }
+        }
+        super.save(cmHeheImage);
+    }
+
+    @Transactional(readOnly = false)
+    public void delete(CmHeheImage cmHeheImage) {
+        super.delete(cmHeheImage);
+    }
+
+    @Transactional(readOnly = false)
+    public void updateStatusById(String status, Integer id) {
+        cmHeheImageDao.updateStatusById(status, id);
+    }
+
+    @Transactional(readOnly = false)
+    public void saveSort(String sort, String id) {
+        cmHeheImageDao.saveSort(sort, id);
+    }
+}

+ 112 - 0
src/main/java/com/caimei/modules/hehe/service/CmHeheProductService.java

@@ -0,0 +1,112 @@
+package com.caimei.modules.hehe.service;
+
+import com.caimei.modules.hehe.dao.CmHeheActivityProductDao;
+import com.caimei.modules.hehe.dao.CmHeheProductDao;
+import com.caimei.modules.hehe.entity.CmHeheProduct;
+import com.caimei.modules.product.entity.Product;
+import com.caimei.utils.AppUtils;
+import com.caimei.utils.MathUtil;
+import com.caimei.utils.StringUtil;
+import com.thinkgem.jeesite.common.config.Global;
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.service.CrudService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 呵呵商品Service
+ *
+ * @author plf
+ * @version 2021-04-14
+ */
+@Service
+@Transactional(readOnly = true)
+public class CmHeheProductService extends CrudService<CmHeheProductDao, CmHeheProduct> {
+    @Autowired
+    private CmHeheProductDao cmHeheProductDao;
+    @Autowired
+    private CmHeheActivityProductDao activityProductDao;
+
+    public CmHeheProduct get(String id) {
+        return super.get(id);
+    }
+
+    public List<CmHeheProduct> findList(CmHeheProduct cmHeheProduct) {
+        return super.findList(cmHeheProduct);
+    }
+
+    public Page<CmHeheProduct> findPage(Page<CmHeheProduct> page, CmHeheProduct cmHeheProduct) {
+        Page<CmHeheProduct> productPage = super.findPage(page, cmHeheProduct);
+        List<CmHeheProduct> list = productPage.getList();
+        String wwwServer = Global.getConfig("wwwServer");
+        list.forEach(p -> {
+            //比例成本
+            if ("2".equals(p.getCostType())) {
+                BigDecimal costPrice = MathUtil.div(MathUtil.mul(p.getPrice(), p.getCostProportional()), 100, 2);
+                p.setCostPrice(costPrice);
+            }
+            p.setMainImage(AppUtils.getImageURL("product", p.getMainImage(), 0, wwwServer));
+        });
+        return productPage;
+    }
+
+    @Transactional(readOnly = false)
+    public void save(CmHeheProduct cmHeheProduct) {
+        super.save(cmHeheProduct);
+    }
+
+    @Transactional(readOnly = false)
+    public void delete(CmHeheProduct cmHeheProduct) {
+        super.delete(cmHeheProduct);
+        //删除活动商品
+        cmHeheProductDao.deleteActivityProduct(cmHeheProduct.getProductId());
+        //删除分销者活动商品
+        activityProductDao.deleteUserActivity(cmHeheProduct.getProductId());
+        //删除活动阶梯
+        activityProductDao.deleteLadder(null,cmHeheProduct.getProductId());
+    }
+
+    public Page<Product> findProductPage(Page<Product> productPage, Product product) {
+        List<Integer> ids = cmHeheProductDao.findHeHeProductId();
+        product.setIds(ids);
+        product.setPage(productPage);
+        List<Product> productList = cmHeheProductDao.findAllProduct(product);
+        String wwwServer = Global.getConfig("wwwServer");
+        productList.forEach(item -> {
+            if (StringUtil.isNotBlank(item.getMainImage())) {
+                item.setMainImage(AppUtils.getImageURL("product", item.getMainImage(), 0, wwwServer));
+            }
+        });
+        productPage.setList(productList);
+        return productPage;
+    }
+
+    @Transactional(readOnly = false)
+    public void saveSort(String sort, String id) {
+        cmHeheProductDao.saveSort(sort, id);
+    }
+
+    @Transactional(readOnly = false)
+    public void updateValidFlag(CmHeheProduct cmHeheProduct) {
+        if ("1".equals(cmHeheProduct.getValidFlag())) {
+            cmHeheProduct.setValidFlag("2");
+        } else {
+            cmHeheProduct.setValidFlag("1");
+        }
+        cmHeheProductDao.update(cmHeheProduct);
+    }
+
+    @Transactional(readOnly = false)
+    public void updateRecommend(CmHeheProduct cmHeheProduct) {
+        if ("0".equals(cmHeheProduct.getRecommend())) {
+            cmHeheProduct.setRecommend("1");
+        } else {
+            cmHeheProduct.setRecommend("0");
+        }
+        cmHeheProductDao.update(cmHeheProduct);
+    }
+}

+ 136 - 0
src/main/java/com/caimei/modules/hehe/service/CmHeheUserService.java

@@ -0,0 +1,136 @@
+package com.caimei.modules.hehe.service;
+
+import com.caimei.modules.hehe.dao.CmHeheActivityProductDao;
+import com.caimei.modules.hehe.dao.CmHeheUserDao;
+import com.caimei.modules.hehe.entity.*;
+import com.caimei.modules.user.entity.CmUser;
+import com.caimei.utils.AppUtils;
+import com.caimei.utils.StringUtil;
+import com.thinkgem.jeesite.common.config.Global;
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.service.CrudService;
+import com.thinkgem.jeesite.common.utils.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 呵呵用户Service
+ *
+ * @author plf
+ * @version 2021-04-14
+ */
+@Service
+@Transactional(readOnly = true)
+public class CmHeheUserService extends CrudService<CmHeheUserDao, CmHeheUser> {
+    @Autowired
+    private CmHeheUserDao cmHeheUserDao;
+    @Autowired
+    private CmHeheActivityProductDao activityProductDao;
+
+    public CmHeheUser get(String id) {
+        return super.get(id);
+    }
+
+    public List<CmHeheUser> findList(CmHeheUser cmHeheUser) {
+        return super.findList(cmHeheUser);
+    }
+
+    public Page<CmHeheUser> findPage(Page<CmHeheUser> page, CmHeheUser cmHeheUser) {
+        return super.findPage(page, cmHeheUser);
+    }
+
+    @Transactional(readOnly = false)
+    public void save(CmHeheUser cmHeheUser) {
+        CmUser user = new CmUser();
+        user.setBindMobile("H" + cmHeheUser.getMobile());
+        user.setUserName(cmHeheUser.getName());
+        user.setName(cmHeheUser.getName());
+        if (StringUtils.isBlank(cmHeheUser.getId())) {
+            cmHeheUser.setUserIdentity("2");
+            cmHeheUser.setAddTime(new Date());
+            //保存user表
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            String currentTime = simpleDateFormat.format(new Date());
+            user.setPassword("HeHe");
+            //6:呵呵商城用户
+            user.setUserPermission(6);
+            user.setUserIdentity(6);
+            user.setRegisterUserTypeID("6");
+            user.setRegisterTime(currentTime);
+            user.setValidFlag("1");
+            cmHeheUserDao.insertUser(user);
+            cmHeheUser.setUserId(user.getUserID());
+        } else {
+            user.setUserID(cmHeheUser.getUserId());
+            cmHeheUserDao.updateUser(user);
+        }
+        super.save(cmHeheUser);
+    }
+
+    public Integer findMobileOnly(CmHeheUser cmHeheUser) {
+        return cmHeheUserDao.findMobileOnly(cmHeheUser);
+    }
+
+    public Page<CmHeheActivityProduct> activityProductList(Page<CmHeheActivityProduct> productPage, CmHeheActivityProduct activityProduct) {
+        activityProduct.setPage(productPage);
+        List<CmHeheActivityProduct> productList = cmHeheUserDao.activityProductList(activityProduct);
+        String wwwServer = Global.getConfig("wwwServer");
+        productList.forEach(item -> {
+            List<CmHeHeActivityLadder> activityLadderList = activityProductDao.findActivityLadder(item.getActivityId(), item.getProductId());
+            if (StringUtil.isNotBlank(item.getMainImage())) {
+                item.setMainImage(AppUtils.getImageURL("product", item.getMainImage(), 0, wwwServer));
+            }
+            item.setActivityLadderList(activityLadderList);
+        });
+        productPage.setList(productList);
+        return productPage;
+    }
+
+    public Page<CmHeheProduct> findProductPage(Page<CmHeheProduct> productPage, CmHeheProduct product, Integer userId) {
+        List<Integer> productIds = cmHeheUserDao.findUserActivityProduct(userId);
+        product.setIds(productIds);
+        product.setPage(productPage);
+        List<CmHeheProduct> productList = cmHeheUserDao.findAllActivityProduct(product);
+        String wwwServer = Global.getConfig("wwwServer");
+        productList.forEach(item -> {
+            if (StringUtil.isNotBlank(item.getMainImage())) {
+                item.setMainImage(AppUtils.getImageURL("product", item.getMainImage(), 0, wwwServer));
+            }
+        });
+        productPage.setList(productList);
+        return productPage;
+    }
+
+    @Transactional(readOnly = false)
+    public void addActivityProducts(Integer userId, String productIds) {
+        if (StringUtil.isNotBlank(productIds)) {
+            String[] strings = productIds.split(",");
+            cmHeHeUserActivity userActivity = new cmHeHeUserActivity();
+            userActivity.setUserId(userId);
+            for (String productId : strings) {
+                if (StringUtil.isNotBlank(productId)) {
+                    userActivity.setProductId(Integer.valueOf(productId));
+                    Integer activityId = activityProductDao.findActivityByProductId(productId);
+                    userActivity.setActivityId(activityId);
+                    cmHeheUserDao.insertUserActivity(userActivity);
+                }
+            }
+
+        }
+    }
+
+    @Transactional(readOnly = false)
+    public void saveSort(String sort, String id) {
+        cmHeheUserDao.updateSortById(sort, id);
+    }
+
+    @Transactional(readOnly = false)
+    public void deleteActivityProduct(Integer userId, String productId) {
+        cmHeheUserDao.deleteUserActivity(userId,productId);
+    }
+}

+ 313 - 0
src/main/java/com/caimei/modules/hehe/service/HeHeNewOrderService.java

@@ -0,0 +1,313 @@
+package com.caimei.modules.hehe.service;
+
+import com.caimei.modules.bulkpurchase.dao.OrderInvoiceDao;
+import com.caimei.modules.bulkpurchase.service.OrderInvoiceService;
+import com.caimei.modules.hehe.dao.CmHeheUserDao;
+import com.caimei.modules.hehe.dao.HeHeNewOrderDao;
+import com.caimei.modules.order.dao.*;
+import com.caimei.modules.order.entity.*;
+import com.caimei.modules.order.service.CmReceiptOrderRelationService;
+import com.caimei.modules.order.service.OrderUserInfoService;
+import com.caimei.modules.order.utils.NewOrderStatus;
+import com.caimei.modules.product.dao.CmPromotionDao;
+import com.caimei.modules.product.dao.ProductDao;
+import com.caimei.modules.product.entity.OrderProductLadderPrice;
+import com.caimei.modules.user.dao.CmUserDao;
+import com.caimei.modules.user.dao.NewCmClubDao;
+import com.caimei.modules.user.dao.NewCmShopDao;
+import com.caimei.modules.user.entity.CmUser;
+import com.caimei.modules.user.service.CmUserBalanceRecordService;
+import com.caimei.modules.user.service.CmUserService;
+import com.caimei.utils.AppKeys;
+import com.caimei.utils.AppUtils;
+import com.caimei.utils.SysConfig;
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.service.CrudService;
+import com.thinkgem.jeesite.common.utils.StringUtils;
+import org.apache.commons.collections.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
+/**
+ * Description
+ *
+ * @author : plf
+ * @date : 2021/4/27
+ */
+@Service
+@Transactional(readOnly = false)
+public class HeHeNewOrderService extends CrudService<HeHeNewOrderDao, NewOrder> {
+    @Autowired
+    private HeHeNewOrderDao heHeNewOrderDao;
+    @Resource
+    private NewOrderProductDao newOrderProductDao;
+    @Resource
+    private OrderInvoiceService orderInvoiceService;
+    @Resource
+    private OrderUserInfoService orderUserInfoService;
+    @Resource
+    private NewShopOrderDao newShopOrderDao;
+    @Resource
+    private NewCmClubDao newCmClubDao;
+    @Resource
+    private LogisticsBatchDao logisticsBatchDao;
+    @Resource
+    private LogisticsRecordDao logisticsRecordDao;
+    @Resource
+    private LogisticsInformationDao logisticsInformationDao;
+    @Resource
+    private OrderInvoiceDao orderInvoiceDao;
+    @Resource
+    private NewOrderConfigDao newOrderConfigDao;
+    @Resource
+    private ProductDao productDao;
+    @Resource
+    private NewCmShopDao newCmShopDao;
+    @Resource
+    private CmUserDao cmUserDao;
+    @Resource
+    private CmUserService cmUserService;
+    @Resource
+    private CmReturnedPurchaseProductDao cmReturnedPurchaseProductDao;
+    @Resource
+    private CmDiscernReceiptDao cmDiscernReceiptDao;
+    @Resource
+    private CmUserBalanceRecordService cmUserBalanceRecordService;
+    @Resource
+    private CmReturnedPurchaseDao cmReturnedPurchaseDao;
+    @Resource
+    private CmPayShopRecordDao cmPayShopRecordDao;
+    @Resource
+    private CmReceiptOrderRelationDao cmReceiptOrderRelationDao;
+    @Autowired
+    private CmReceiptOrderRelationService cmReceiptOrderRelationService;
+    @Autowired
+    private CmPromotionDao cmPromotionDao;
+    @Autowired
+    private CmHeheUserDao cmHeheUserDao;
+
+    @Override
+    public NewOrder get(String id) {
+        NewOrder newOrder = super.get(id);
+        CmUser user = cmUserDao.get(newOrder.getUserID().toString());
+        if (user != null) {
+            //查询用户余额,机构名
+            newOrder.setBuyer(user.getName());
+            Double ableUserMoney = user.getAbleUserMoney() == null ? 0d : user.getAbleUserMoney();
+            newOrder.setAbleUserMoney(ableUserMoney);
+        }
+        List<Integer> l = new ArrayList<>();
+        l.add(newOrder.getOrderID());
+        List<Integer> orderIds = cmDiscernReceiptDao.findRebateOrderID(l);
+        if (orderIds.contains(newOrder.getOrderID()))
+            newOrder.setRebateOrder("1");
+        else
+            newOrder.setRebateOrder("0");
+        if (null != newOrder) {
+            //获取订单客户
+            OrderUserInfo orderUserInfo = orderUserInfoService.findByOrderID(newOrder.getOrderID());
+            if (null != orderUserInfo) {
+                newOrder.setBpOrderUserinfo(orderUserInfo);
+            }
+            //获取订单商品
+            List<NewOrderProduct> list = new ArrayList<>();
+            List<NewShopOrder> shopOrders = newShopOrderDao.findListByOrderID(newOrder.getOrderID());
+            if (CollectionUtils.isNotEmpty(shopOrders)) {
+                for (NewShopOrder shopOrder : shopOrders) {
+                    List<NewOrderProduct> pList = newOrderProductDao.findListByShopOrderID(shopOrder.getShopOrderID());
+                    pList.forEach(orderProduct -> {
+                        if (orderProduct.getLadderPriceFlag() == 1) {
+                            // 查询订单商品阶梯价格
+                            List<OrderProductLadderPrice> ladderPriceList = newOrderProductDao.findladderPriceList(orderProduct.getOrderProductID());
+                            if (null != ladderPriceList && ladderPriceList.size() > 0) {
+                                IntStream.range(0, ladderPriceList.size()).forEach(i -> {
+                                    if (i == ladderPriceList.size() - 1) {
+                                        ladderPriceList.get(i).setBuyNumRangeShow("≥" + ladderPriceList.get(i).getBuyNum());
+                                    } else {
+                                        String buyNumRangeShow = ladderPriceList.get(i).getBuyNum() + "~" + (ladderPriceList.get(i + 1).getBuyNum() - 1);
+                                        ladderPriceList.get(i).setBuyNumRangeShow(buyNumRangeShow);
+                                    }
+                                });
+                                orderProduct.setOrderProductLadderPriceList(ladderPriceList);
+                            }
+                        }
+                        //分销者名称
+                        if (orderProduct.getHeUserId() != null && orderProduct.getHeUserId() > 0) {
+                            String name = heHeNewOrderDao.findHeUser(orderProduct.getHeUserId());
+                            orderProduct.setHeUserName(name);
+                        }
+                    });
+                    list.addAll(pList);
+                    shopOrder.setNewOrderProducts(pList);
+                    if (pList.stream().anyMatch(p -> p.getProductID() == 999))
+                        shopOrder.setPostFeeCos("1");
+                    pList.forEach(item -> {
+                        if (NewOrderStatus.hasReturn(newOrder.getStatus())) {
+                            Integer returningNum = newOrderProductDao.getReturningNum(item.getOrderProductID());
+                            Integer returnedNum = newOrderProductDao.getReturnedNum(item.getOrderProductID());
+                            item.setReturningNum(returningNum);
+                            item.setReturnedNum(returnedNum);
+                        }
+                        /**确认收货信息*/
+                        if (NewOrderStatus.hasReceived(newOrder.getStatus())) {
+                            Integer receivedNum = newOrderProductDao.getReceivedNum(item.getOrderProductID());
+                            item.setReceivedNum(receivedNum);
+                        }
+                        String domain = SysConfig.getStringConfig("crm.server.domain");
+                        item.setProductImage(AppUtils.getProductImageURL(item.getProductImage(), AppKeys.ORIGINAL_PICTURE, domain));
+                        if (item != null && item.getOrderPromotionsId() != null && item.getOrderPromotionsId() > 0) {
+                            item.setProductPromotion(cmPromotionDao.findOrderPromotions(item.getOrderPromotionsId()));
+                        }
+                    });
+                    Double payed = cmPayShopRecordDao.sumByShopOrderID(shopOrder.getShopOrderID());
+                    shopOrder.setPayed(payed);
+                }
+                newOrder.setNewShopOrders(shopOrders);
+            }
+            if (CollectionUtils.isNotEmpty(list)) {
+                newOrder.setOrderProduct(list);
+                double freight = 0D;
+                double totalAddedValueTax = 0D;
+                for (NewOrderProduct op : list) {
+                    if (op.getProductID().intValue() == 999) { //邮费商品
+                        freight += op.getPrice();
+                    }
+                    totalAddedValueTax += op.getTotalAddedValueTax();
+                }
+                if ("1".equals(newOrder.getFreePostFlag())) newOrder.setFreight(freight);
+                newOrder.setTotalAddedValueTax(totalAddedValueTax);
+            }
+            shopOrders.sort((so1, so2) -> {
+                //给子订单排序  邮费排在最后  其余的按shopOrderID  asc
+                if ("1".equals(so1.getPostFeeCos())) return 1;
+                return so1.getShopOrderID() - so2.getShopOrderID();
+            });
+        }
+        return newOrder;
+    }
+
+    public Page<NewOrder> findPage(Page<NewOrder> page, NewOrder entity) {
+        Page<NewOrder> pageResult = super.findPage(page, entity);
+        List<NewOrder> results = pageResult.getList();
+        List<Integer> oId = results.stream().map(NewOrder::getOrderID).collect(Collectors.toList());
+        //看看这些订单有哪些是返佣订单 返回他们的orderID
+        List<Integer> orderIds = null;
+        if (CollectionUtils.isNotEmpty(oId)) {
+            orderIds = cmDiscernReceiptDao.findRebateOrderID(results.stream().map(NewOrder::getOrderID).collect(Collectors.toList()));
+        }
+        //从查询到的订单列表中 找到正在退款中的订单集合
+        List<Integer> orderIdsInReturn = null;
+        List<Integer> orderIdsInApplyReturn = null;//查询可以申请退款的订单ID
+        if (CollectionUtils.isNotEmpty(oId)) {
+            orderIdsInReturn = cmReturnedPurchaseDao.findOrderIDInReturnPurchase(oId);
+            orderIdsInApplyReturn = cmReturnedPurchaseDao.findOrderIDsInApplyReturnFlag(oId);
+        }
+        for (NewOrder order : results) {
+            order.setAbleUserMoney(0d);
+            if ((orderIds != null && orderIds.contains(order.getOrderID())) || "1".equals(order.getRebateFlag())) {
+                order.setRebateOrder("1");
+            } else {
+                order.setRebateOrder("0");
+                List<Integer> ids = cmReceiptOrderRelationDao.toAudit(order.getOrderID());
+                if (ids != null && ids.size() > 0) {
+                    order.setToAudit("1");
+                }
+            }
+            if (orderIdsInReturn != null && orderIdsInReturn.contains(order.getOrderID())) {
+                order.setReturnedPurchaseStatus("1");
+            } else {
+                order.setReturnedPurchaseStatus("0");
+            }
+            if (orderIdsInApplyReturn != null && orderIdsInApplyReturn.contains(order.getOrderID())) {
+                order.setApplyReturnedPurchaseFlag("0");
+            } else {
+                order.setApplyReturnedPurchaseFlag("1");
+            }
+
+            List<NewShopOrder> shopOrders = order.getNewShopOrders();
+            if (shopOrders != null && shopOrders.size() == 1) {
+                order.setShopName(shopOrders.get(0).getShopName());
+            }
+            int count = 0;
+            for (NewShopOrder shopOrder : order.getNewShopOrders()) {
+                shopOrder.setOrderID(order.getOrderID());
+                shopOrder.setOrderNo(order.getOrderNo());
+                shopOrder.setOrderType(Integer.parseInt(order.getOrderType()));
+                shopOrder.setReceiver(order.getReceiver());
+                shopOrder.setOrderSource(order.getOrderSource());
+                shopOrder.setOrderTime(order.getOrderTime());
+                shopOrder.setBuyer(order.getBuyer());
+                if (shopOrder.getShopID() != 998) {
+                    count++;
+                }
+
+                Integer shopOrderID = shopOrder.getShopOrderID();//子订单ID
+                //通过子订单ID查询子订单信息
+                NewShopOrder newShopOrder = newShopOrderDao.get(String.valueOf(shopOrderID));
+                if (null != newShopOrder) {
+                    shopOrder.setFee(newShopOrder.getFee());
+                    shopOrder.setShouldPayProduct(newShopOrder.getShouldPayProduct());
+                    List<NewOrderProduct> pList = newOrderProductDao.findListByShopOrderID(shopOrderID);
+                    pList.forEach(orderProduct -> {
+                        //充值定金商品
+                        if (6060 == orderProduct.getProductID()) {
+                            order.setRechargeGoods(1);
+                        }
+                    });
+                } else {
+                    shopOrder.setFee(0d);
+                    shopOrder.setShouldPayProduct(0d);
+                }
+            }
+            //一个子订单只有一个商品时,不可拆分
+            if (order.getProductCount() == null) {
+                order.setProductCount(1);
+            }
+            if (order.getProductCount() <= count) {
+                order.setSplitFlag("0");
+            }
+
+            //是否抹平支付过(抹平最多只允许存在一次)
+            CmDiscernReceipt cmDiscernReceipt = cmDiscernReceiptDao.findSmoothoutInfo(order.getOrderID().toString());
+            if (null != cmDiscernReceipt) {
+                order.setAssociationType(cmDiscernReceipt.getAssociationType());
+                String confirmType = cmDiscernReceipt.getConfirmType();
+                order.setConfirmType(confirmType);
+
+                // 是否是一比款收了多个订单
+                if (StringUtils.equals(confirmType, "1") || StringUtils.equals(confirmType, "2") || StringUtils.equals(confirmType, "3")) {
+                    List<CmReceiptOrderRelation> byReceiptList = cmReceiptOrderRelationService.findByReceiptID(cmDiscernReceipt.getId());
+                    if (CollectionUtils.isNotEmpty(byReceiptList) && byReceiptList.size() > 1) {
+                        order.setReceiptOrderFlag(true);
+                    }
+                }
+            }
+
+            // 订单已收款才会出现抹平或者多收退余额,(已收再退款或者撤销退款订单即使存在抹平也需要当未抹平重新计算付款)
+            //            抹平明细
+            String receiptStatus = order.getReceiptStatus();
+            if (StringUtils.equals("3", receiptStatus)) {
+                if (null != cmDiscernReceipt) {
+                    String confirmType = cmDiscernReceipt.getConfirmType();
+                    order.setConfirmType(confirmType);
+                    double associateAmount = cmDiscernReceiptDao.getAssociateAmount(String.valueOf(order.getOrderID()));
+                    order.setOrderReceivedAmount(associateAmount);
+                    //大额退余额
+                    if (StringUtils.equals("3", confirmType)) {
+                        String id = cmDiscernReceipt.getId();
+                        double returnBalanceAmount = cmDiscernReceiptDao.getReturnBalanceAmount(id);
+                        order.setReturnBalanceAmount(returnBalanceAmount);
+                    }
+                }
+            }
+        }
+        return pageResult;
+    }
+}

+ 97 - 0
src/main/java/com/caimei/modules/hehe/web/CmHeheActivityController.java

@@ -0,0 +1,97 @@
+package com.caimei.modules.hehe.web;
+
+import com.caimei.modules.hehe.entity.CmHeheActivity;
+import com.caimei.modules.hehe.service.CmHeheActivityService;
+import com.google.common.collect.Maps;
+import com.thinkgem.jeesite.common.config.Global;
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.utils.StringUtils;
+import com.thinkgem.jeesite.common.web.BaseController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Map;
+
+/**
+ * 呵呵商城活动Controller
+ *
+ * @author plf
+ * @version 2021-04-19
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/hehe/cmHeheActivity")
+public class CmHeheActivityController extends BaseController {
+
+    @Autowired
+    private CmHeheActivityService cmHeheActivityService;
+
+    @ModelAttribute
+    public CmHeheActivity get(@RequestParam(required = false) String id) {
+        CmHeheActivity entity = null;
+        if (StringUtils.isNotBlank(id)) {
+            entity = cmHeheActivityService.get(id);
+        }
+        if (entity == null) {
+            entity = new CmHeheActivity();
+        }
+        return entity;
+    }
+
+    @RequestMapping(value = {"list", ""})
+    public String list(CmHeheActivity cmHeheActivity, HttpServletRequest request, HttpServletResponse response, Model model) {
+        Page<CmHeheActivity> page = cmHeheActivityService.findPage(new Page<CmHeheActivity>(request, response), cmHeheActivity);
+        model.addAttribute("page", page);
+        return "modules/hehe/cmHeheActivityList";
+    }
+
+    @RequestMapping(value = "form")
+    public String form(CmHeheActivity cmHeheActivity, Model model) {
+        model.addAttribute("cmHeheActivity", cmHeheActivity);
+        return "modules/hehe/cmHeheActivityForm";
+    }
+
+    @RequestMapping(value = "save")
+    public String save(CmHeheActivity cmHeheActivity, Model model, RedirectAttributes redirectAttributes) {
+        if (!beanValidator(model, cmHeheActivity)) {
+            return form(cmHeheActivity, model);
+        }
+        cmHeheActivityService.save(cmHeheActivity);
+        addMessage(redirectAttributes, "保存活动成功");
+        return "redirect:" + Global.getAdminPath() + "/hehe/cmHeheActivity/";
+    }
+
+    @RequestMapping(value = "delete")
+    public String delete(CmHeheActivity cmHeheActivity, RedirectAttributes redirectAttributes) {
+        cmHeheActivityService.delete(cmHeheActivity);
+        addMessage(redirectAttributes, "删除活动成功");
+        return "redirect:" + Global.getAdminPath() + "/hehe/cmHeheActivity/";
+    }
+
+    /**
+     * 启用、停用状态
+     */
+    @ResponseBody
+    @RequestMapping(value = "updateStatus")
+    public Map<String, Object> updateStatus(String status, Integer id) {
+        Map<String, Object> map = Maps.newLinkedHashMap();
+        try {
+            cmHeheActivityService.updateStatusById(status, id);
+            map.put("success", true);
+            map.put("msg", "修改成功");
+        } catch (Exception e) {
+            logger.debug(e.toString(), e);
+            map.put("success", false);
+            map.put("msg", "修改失败");
+        }
+        return map;
+    }
+
+}

+ 110 - 0
src/main/java/com/caimei/modules/hehe/web/CmHeheActivityProductController.java

@@ -0,0 +1,110 @@
+package com.caimei.modules.hehe.web;
+
+import com.caimei.modules.hehe.entity.CmHeheActivityProduct;
+import com.caimei.modules.hehe.entity.CmHeheProduct;
+import com.caimei.modules.hehe.service.CmHeheActivityProductService;
+import com.google.common.collect.Maps;
+import com.thinkgem.jeesite.common.config.Global;
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.utils.StringUtils;
+import com.thinkgem.jeesite.common.web.BaseController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.HashMap;
+import java.util.Map;
+
+import static com.caimei.modules.newhome.web.NewPageQualitySupplierController.isInteger;
+
+/**
+ * 活动商品Controller
+ *
+ * @author plf
+ * @version 2021-04-20
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/hehe/cmHeheActivityProduct")
+public class CmHeheActivityProductController extends BaseController {
+
+    @Autowired
+    private CmHeheActivityProductService cmHeheActivityProductService;
+
+    @ModelAttribute
+    public CmHeheActivityProduct get(@RequestParam(required = false) String id) {
+        CmHeheActivityProduct entity = null;
+        if (StringUtils.isNotBlank(id)) {
+            entity = cmHeheActivityProductService.get(id);
+        }
+        if (entity == null) {
+            entity = new CmHeheActivityProduct();
+        }
+        return entity;
+    }
+
+    @RequestMapping(value = {"list", ""})
+    public String list(CmHeheActivityProduct cmHeheActivityProduct, HttpServletRequest request, HttpServletResponse response, Model model) {
+        Page<CmHeheActivityProduct> page = cmHeheActivityProductService.findPage(new Page<CmHeheActivityProduct>(request, response), cmHeheActivityProduct);
+        model.addAttribute("page", page);
+        model.addAttribute("activityProduct", cmHeheActivityProduct);
+        return "modules/hehe/cmHeheActivityProductList";
+    }
+
+    @RequestMapping(value = "form")
+    public String form(CmHeheActivityProduct cmHeheActivityProduct, Model model) {
+        model.addAttribute("cmHeheActivityProduct", cmHeheActivityProduct);
+        return "modules/hehe/cmHeheActivityProductForm";
+    }
+
+    @RequestMapping(value = "delete")
+    public String delete(CmHeheActivityProduct cmHeheActivityProduct, RedirectAttributes redirectAttributes) {
+        cmHeheActivityProductService.delete(cmHeheActivityProduct);
+        addMessage(redirectAttributes, "删除活动商品成功");
+        return "redirect:" + Global.getAdminPath() + "/hehe/cmHeheActivityProduct/list?activityId=" + cmHeheActivityProduct.getActivityId();
+    }
+
+    /**
+     * 添加商品,商品数据
+     */
+    @RequestMapping(value = "findProductPage")
+    public String findProductPage(CmHeheProduct product, Model model, HttpServletRequest request, HttpServletResponse response) {
+        Page<CmHeheProduct> page = cmHeheActivityProductService.findProductPage(new Page<CmHeheProduct>(request, response), product);
+        model.addAttribute("page", page);
+        return "modules/hehe/addActivityProduct";
+    }
+
+    /**
+     * 添加商品
+     *
+     * @return
+     */
+    @RequestMapping(value = "addProducts")
+    @ResponseBody
+    public Map<String, Object> addProducts(Integer activityId, String productIds) {
+        cmHeheActivityProductService.addProducts(activityId, productIds);
+        HashMap<String, Object> map = new HashMap<>(2);
+        map.put("success", true);
+        map.put("info", "添加活动商品成功");
+        return map;
+    }
+
+    /**
+     * 保存活动阶梯
+     */
+    @ResponseBody
+    @RequestMapping(value = "saveActivityLadder")
+    public Map<String, Object> saveActivityLadder(String params, String id) {
+        Map<String, Object> map = new HashMap<>();
+        cmHeheActivityProductService.saveActivityLadder(params, id);
+        map.put("success", true);
+        map.put("info", "保存成功");
+        return map;
+    }
+}

+ 143 - 0
src/main/java/com/caimei/modules/hehe/web/CmHeheImageController.java

@@ -0,0 +1,143 @@
+package com.caimei.modules.hehe.web;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.google.common.collect.Maps;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import com.thinkgem.jeesite.common.config.Global;
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.web.BaseController;
+import com.thinkgem.jeesite.common.utils.StringUtils;
+import com.caimei.modules.hehe.entity.CmHeheImage;
+import com.caimei.modules.hehe.service.CmHeheImageService;
+
+import java.util.Map;
+
+import static com.caimei.modules.newhome.web.NewPageQualitySupplierController.isInteger;
+
+/**
+ * 呵呵轮播图Controller
+ *
+ * @author plf
+ * @version 2021-04-15
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/hehe/cmHeheImage")
+public class CmHeheImageController extends BaseController {
+
+    @Autowired
+    private CmHeheImageService cmHeheImageService;
+
+    @ModelAttribute
+    public CmHeheImage get(@RequestParam(required = false) String id) {
+        CmHeheImage entity = null;
+        if (StringUtils.isNotBlank(id)) {
+            entity = cmHeheImageService.get(id);
+        }
+        if (entity == null) {
+            entity = new CmHeheImage();
+        }
+        return entity;
+    }
+
+    @RequestMapping(value = {"list", ""})
+    public String list(CmHeheImage cmHeheImage, HttpServletRequest request, HttpServletResponse response, Model model) {
+        Page<CmHeheImage> page = cmHeheImageService.findPage(new Page<CmHeheImage>(request, response), cmHeheImage);
+        model.addAttribute("page", page);
+        return "modules/hehe/cmHeheImageList";
+    }
+
+    @RequestMapping(value = "form")
+    public String form(CmHeheImage cmHeheImage, Model model) {
+        model.addAttribute("cmHeheImage", cmHeheImage);
+        return "modules/hehe/cmHeheImageForm";
+    }
+
+    @RequestMapping(value = "save")
+    public String save(CmHeheImage cmHeheImage, Model model, RedirectAttributes redirectAttributes) {
+        if (!beanValidator(model, cmHeheImage)) {
+            return form(cmHeheImage, model);
+        }
+        cmHeheImageService.save(cmHeheImage);
+        addMessage(redirectAttributes, "保存呵呵轮播图成功");
+        return "redirect:" + Global.getAdminPath() + "/hehe/cmHeheImage/?repage";
+    }
+
+    @RequestMapping(value = "delete")
+    public String delete(CmHeheImage cmHeheImage, RedirectAttributes redirectAttributes) {
+        cmHeheImageService.delete(cmHeheImage);
+        addMessage(redirectAttributes, "删除呵呵轮播图成功");
+        return "redirect:" + Global.getAdminPath() + "/hehe/cmHeheImage/?repage";
+    }
+
+    /**
+     * 启用、停用状态
+     */
+    @ResponseBody
+    @RequestMapping(value="updateStatus")
+    public Map<String, Object> updateStatus(String status, Integer id){
+        Map<String, Object> map = Maps.newLinkedHashMap();
+        try {
+            cmHeheImageService.updateStatusById(status,id);
+            map.put("success",true);
+            map.put("msg", "修改成功");
+        } catch (Exception e) {
+            logger.debug(e.toString(),e);
+            map.put("success",false);
+            map.put("msg", "修改失败");
+        }
+        return map;
+    }
+
+    /**
+     * 批量更新排序值
+     */
+    @RequestMapping(value = "batchSaveSort")
+    @ResponseBody
+    public Map<String, Object> batchSaveSort(String sortList) {
+        Map<String, Object> map = Maps.newLinkedHashMap();
+        try {
+            String[] newPageLists = sortList.split(",");
+            for (String list : newPageLists) {
+                String[] split = list.split("-");
+                if (split.length == 1 || split.length < 1) {
+                    String id = split[0];
+                    String sort = null;
+                    cmHeheImageService.saveSort(sort, id);
+                } else {
+                    String id = split[0];
+                    String sort = split[1];
+                    if (isInteger(sort)) {
+                        if (StringUtils.equals("0", sort)) {
+                            map.put("success", false);
+                            map.put("msg", "排序值只能填写大于等于1的整数");
+                            return map;
+                        }
+                        cmHeheImageService.saveSort(sort, id);
+                    } else {
+                        map.put("success", false);
+                        map.put("msg", "排序值只能为数字");
+                        return map;
+                    }
+                }
+            }
+            map.put("success", true);
+            map.put("msg", "更新排序成功");
+            return map;
+        } catch (Exception e) {
+            map.put("success", false);
+            map.put("msg", "更新排序失败");
+            return map;
+        }
+    }
+}

+ 152 - 0
src/main/java/com/caimei/modules/hehe/web/CmHeheProductController.java

@@ -0,0 +1,152 @@
+package com.caimei.modules.hehe.web;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.caimei.modules.product.entity.Product;
+import com.google.common.collect.Maps;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import com.thinkgem.jeesite.common.config.Global;
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.web.BaseController;
+import com.thinkgem.jeesite.common.utils.StringUtils;
+import com.caimei.modules.hehe.entity.CmHeheProduct;
+import com.caimei.modules.hehe.service.CmHeheProductService;
+
+import java.util.Map;
+
+import static com.caimei.modules.newhome.web.NewPageQualitySupplierController.isInteger;
+
+/**
+ * 呵呵商品Controller
+ *
+ * @author plf
+ * @version 2021-04-14
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/hehe/cmHeheProduct")
+public class CmHeheProductController extends BaseController {
+
+    @Autowired
+    private CmHeheProductService cmHeheProductService;
+
+    @ModelAttribute
+    public CmHeheProduct get(@RequestParam(required = false) String id) {
+        CmHeheProduct entity = null;
+        if (StringUtils.isNotBlank(id)) {
+            entity = cmHeheProductService.get(id);
+        }
+        if (entity == null) {
+            entity = new CmHeheProduct();
+        }
+        return entity;
+    }
+
+    @RequestMapping(value = {"list", ""})
+    public String list(CmHeheProduct cmHeheProduct, HttpServletRequest request, HttpServletResponse response, Model model) {
+        Page<CmHeheProduct> page = cmHeheProductService.findPage(new Page<CmHeheProduct>(request, response), cmHeheProduct);
+        model.addAttribute("page", page);
+        return "modules/hehe/cmHeheProductList";
+    }
+
+    @RequestMapping(value = "form")
+    public String form(CmHeheProduct cmHeheProduct, Model model) {
+        model.addAttribute("cmHeheProduct", cmHeheProduct);
+        return "modules/hehe/cmHeheProductForm";
+    }
+
+    @RequestMapping(value = "save")
+    public String save(CmHeheProduct cmHeheProduct, Model model, RedirectAttributes redirectAttributes) {
+        if (!beanValidator(model, cmHeheProduct)) {
+            return form(cmHeheProduct, model);
+        }
+        cmHeheProductService.save(cmHeheProduct);
+        addMessage(redirectAttributes, "保存商品成功");
+        return "redirect:" + Global.getAdminPath() + "/hehe/cmHeheProduct/?repage";
+    }
+
+    @RequestMapping(value = "delete")
+    public String delete(CmHeheProduct cmHeheProduct, RedirectAttributes redirectAttributes) {
+        cmHeheProductService.delete(cmHeheProduct);
+        addMessage(redirectAttributes, "删除商品成功");
+        return "redirect:" + Global.getAdminPath() + "/hehe/cmHeheProduct/?repage";
+    }
+
+    @RequestMapping(value = "findProductPage")
+    public String findProductPage(Product product, Model model, HttpServletRequest request, HttpServletResponse response) {
+        Page<Product> page = cmHeheProductService.findProductPage(new Page<Product>(request, response), product);
+        model.addAttribute("page", page);
+        return "modules/hehe/heheAddProduct";
+    }
+
+    /**
+     * 批量更新排序值
+     */
+    @RequestMapping(value = "batchSaveSort")
+    @ResponseBody
+    public Map<String, Object> batchSaveSort(String sortList) {
+        Map<String, Object> map = Maps.newLinkedHashMap();
+        try {
+            String[] newPageLists = sortList.split(",");
+            for (String list : newPageLists) {
+                String[] split = list.split("-");
+                if (split.length == 1 || split.length < 1) {
+                    String id = split[0];
+                    String sort = null;
+                    cmHeheProductService.saveSort(sort, id);
+                } else {
+                    String id = split[0];
+                    String sort = split[1];
+                    if (isInteger(sort)) {
+                        if (StringUtils.equals("0", sort)) {
+                            map.put("success", false);
+                            map.put("msg", "排序值只能填写大于等于1的整数");
+                            return map;
+                        }
+                        cmHeheProductService.saveSort(sort, id);
+                    } else {
+                        map.put("success", false);
+                        map.put("msg", "排序值只能为数字");
+                        return map;
+                    }
+                }
+            }
+            map.put("success", true);
+            map.put("msg", "更新排序成功");
+            return map;
+        } catch (Exception e) {
+            map.put("success", false);
+            map.put("msg", "更新排序失败");
+            return map;
+        }
+    }
+
+    /**
+     * 商品上下架
+     */
+    @RequestMapping(value = "updateValidFlag")
+    public String updateValidFlag(CmHeheProduct cmHeheProduct) {
+        cmHeheProductService.updateValidFlag(cmHeheProduct);
+        return "redirect:" + Global.getAdminPath() + "/hehe/cmHeheProduct/?repage";
+    }
+
+    /**
+     * 商品修改推荐
+     */
+    @RequestMapping(value = "updateRecommend")
+    public String updateRecommend(CmHeheProduct cmHeheProduct) {
+        cmHeheProductService.updateRecommend(cmHeheProduct);
+        return "redirect:" + Global.getAdminPath() + "/hehe/cmHeheProduct/?repage";
+    }
+
+
+}

+ 178 - 0
src/main/java/com/caimei/modules/hehe/web/CmHeheUserController.java

@@ -0,0 +1,178 @@
+package com.caimei.modules.hehe.web;
+
+import com.caimei.modules.hehe.entity.CmHeheActivityProduct;
+import com.caimei.modules.hehe.entity.CmHeheProduct;
+import com.caimei.modules.hehe.entity.CmHeheUser;
+import com.caimei.modules.hehe.service.CmHeheUserService;
+import com.google.common.collect.Maps;
+import com.thinkgem.jeesite.common.config.Global;
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.utils.StringUtils;
+import com.thinkgem.jeesite.common.web.BaseController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.HashMap;
+import java.util.Map;
+
+import static com.caimei.modules.newhome.web.NewPageQualitySupplierController.isInteger;
+
+/**
+ * 呵呵用户Controller
+ *
+ * @author plf
+ * @version 2021-04-14
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/hehe/cmHeheUser")
+public class CmHeheUserController extends BaseController {
+
+    @Autowired
+    private CmHeheUserService cmHeheUserService;
+
+    @ModelAttribute
+    public CmHeheUser get(@RequestParam(required = false) String id) {
+        CmHeheUser entity = null;
+        if (StringUtils.isNotBlank(id)) {
+            entity = cmHeheUserService.get(id);
+        }
+        if (entity == null) {
+            entity = new CmHeheUser();
+        }
+        return entity;
+    }
+
+    @RequestMapping(value = {"list", ""})
+    public String list(CmHeheUser cmHeheUser, HttpServletRequest request, HttpServletResponse response, Model model) {
+        cmHeheUser.setUserIdentity("2");
+        Page<CmHeheUser> page = cmHeheUserService.findPage(new Page<CmHeheUser>(request, response), cmHeheUser);
+        model.addAttribute("page", page);
+        return "modules/hehe/cmHeheUserList";
+    }
+
+    @RequestMapping(value = "form")
+    public String form(CmHeheUser cmHeheUser, Model model) {
+        model.addAttribute("cmHeheUser", cmHeheUser);
+        return "modules/hehe/cmHeheUserForm";
+    }
+
+    @RequestMapping(value = "save")
+    public String save(CmHeheUser cmHeheUser, Model model, RedirectAttributes redirectAttributes) {
+        if (!beanValidator(model, cmHeheUser)) {
+            return form(cmHeheUser, model);
+        }
+        Integer userId = cmHeheUserService.findMobileOnly(cmHeheUser);
+        if (userId != null && userId > 0) {
+            addMessage(model, "手机号重复,请更换手机号");
+            return form(cmHeheUser, model);
+        }
+        cmHeheUserService.save(cmHeheUser);
+        addMessage(redirectAttributes, "保存呵呵用户成功");
+        return "redirect:" + Global.getAdminPath() + "/hehe/cmHeheUser/?repage";
+    }
+
+    /**
+     * 呵呵商城所有用户列表
+     */
+    @RequestMapping("/userList")
+    public String userList(CmHeheUser cmHeheUser, HttpServletRequest request, HttpServletResponse response, Model model) {
+        Page<CmHeheUser> page = cmHeheUserService.findPage(new Page<CmHeheUser>(request, response), cmHeheUser);
+        model.addAttribute("page", page);
+        return "modules/hehe/cmHeheUserAllList";
+    }
+
+    /**
+     * 分销者活动商品数据
+     */
+    @RequestMapping(value = "activityProductList")
+    public String activityProductList(CmHeheActivityProduct activityProduct, HttpServletRequest request, HttpServletResponse response, Model model) {
+        Page<CmHeheActivityProduct> page = cmHeheUserService.activityProductList(new Page<CmHeheActivityProduct>(request, response), activityProduct);
+        model.addAttribute("page", page);
+        model.addAttribute("activityProduct", activityProduct);
+        return "modules/hehe/userActivityProductList";
+    }
+
+    /**
+     * 添加活动商品,商品数据
+     */
+    @RequestMapping(value = "findProductPage")
+    public String findProductPage(CmHeheProduct product, Integer userId, Model model, HttpServletRequest request, HttpServletResponse response) {
+        Page<CmHeheProduct> page = cmHeheUserService.findProductPage(new Page<CmHeheProduct>(request, response), product, userId);
+        model.addAttribute("page", page);
+        model.addAttribute("userId", userId);
+        return "modules/hehe/addUserActivityProduct";
+    }
+
+    /**
+     * 添加商品
+     */
+    @RequestMapping(value = "addActivityProducts")
+    @ResponseBody
+    public Map<String, Object> addActivityProducts(Integer userId, String productIds) {
+        cmHeheUserService.addActivityProducts(userId, productIds);
+        HashMap<String, Object> map = new HashMap<>(2);
+        map.put("success", true);
+        map.put("info", "添加活动商品成功");
+        return map;
+    }
+
+    /**
+     * 删除分销者活动商品
+     */
+    @RequestMapping(value = "deleteActivityProduct")
+    public String deleteActivityProduct(Integer userId, String productId, RedirectAttributes redirectAttributes) {
+        cmHeheUserService.deleteActivityProduct(userId, productId);
+        addMessage(redirectAttributes, "删除活动商品成功");
+        return "redirect:" + Global.getAdminPath() + "/hehe/cmHeheUser/activityProductList?userId=" + userId;
+    }
+
+    /**
+     * 批量更新排序值
+     */
+    @RequestMapping(value = "batchSaveSort")
+    @ResponseBody
+    public Map<String, Object> batchSaveSort(String sortList) {
+        Map<String, Object> map = Maps.newLinkedHashMap();
+        try {
+            String[] newPageLists = sortList.split(",");
+            for (String list : newPageLists) {
+                String[] split = list.split("-");
+                if (split.length == 1 || split.length < 1) {
+                    String id = split[0];
+                    String sort = null;
+                    cmHeheUserService.saveSort(sort, id);
+                } else {
+                    String id = split[0];
+                    String sort = split[1];
+                    if (isInteger(sort)) {
+                        if (StringUtils.equals("0", sort)) {
+                            map.put("success", false);
+                            map.put("msg", "排序值只能填写大于等于1的整数");
+                            return map;
+                        }
+                        cmHeheUserService.saveSort(sort, id);
+                    } else {
+                        map.put("success", false);
+                        map.put("msg", "排序值只能为数字");
+                        return map;
+                    }
+                }
+            }
+            map.put("success", true);
+            map.put("msg", "更新排序成功");
+            return map;
+        } catch (Exception e) {
+            map.put("success", false);
+            map.put("msg", "更新排序失败");
+            return map;
+        }
+    }
+}

+ 281 - 0
src/main/java/com/caimei/modules/hehe/web/HeHeNewOrderController.java

@@ -0,0 +1,281 @@
+package com.caimei.modules.hehe.web;
+
+import com.caimei.modules.bulkpurchase.entity.BpClause;
+import com.caimei.modules.bulkpurchase.service.BpClauseService;
+import com.caimei.modules.bulkpurchase.service.CmFinanceChargeService;
+import com.caimei.modules.bulkpurchase.service.PurchaseProductService;
+import com.caimei.modules.hehe.dao.CmHeheUserDao;
+import com.caimei.modules.hehe.entity.CmHeheUser;
+import com.caimei.modules.hehe.service.CmHeheUserService;
+import com.caimei.modules.hehe.service.HeHeNewOrderService;
+import com.caimei.modules.order.dao.CmDiscernReceiptDao;
+import com.caimei.modules.order.dao.CmReceiptOrderRelationDao;
+import com.caimei.modules.order.dao.CmReturnedPurchaseDao;
+import com.caimei.modules.order.dao.NewOrderProductDao;
+import com.caimei.modules.order.entity.*;
+import com.caimei.modules.order.service.*;
+import com.caimei.modules.product.dao.CmPromotionDao;
+import com.caimei.modules.product.dao.ProductDao;
+import com.caimei.modules.product.service.CmSecondHandDetailService;
+import com.caimei.modules.product.service.RepeatPurchasePriceHistoryService;
+import com.caimei.modules.product.service.RepeatPurchasePriceService;
+import com.caimei.modules.project.dao.ClubDao;
+import com.caimei.modules.user.dao.CmUserDao;
+import com.caimei.modules.user.service.CmMessageService;
+import com.caimei.modules.user.service.CmUserOrganizeService;
+import com.caimei.modules.user.service.CmUserService;
+import com.caimei.modules.user.service.NewCmShopService;
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.utils.StringUtils;
+import com.thinkgem.jeesite.common.web.BaseController;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * Description
+ *
+ * @author : plf
+ * @date : 2021/4/27
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/hehe/new/order")
+public class HeHeNewOrderController extends BaseController {
+    @Autowired
+    private HeHeNewOrderService heHeNewOrderService;
+    @Autowired
+    private CmHeheUserDao cmHeheUserDao;
+    @Resource
+    private BpClauseService bpClauseService;
+    @Resource
+    private NewOrderProductService newOrderProductService;
+    @Autowired
+    private NewReceiptListService newReceiptListService;
+    @Resource
+    private NewShopOrderService newShopOrderService;
+    @Resource
+    private CmFinanceChargeService cmFinanceChargeService;
+    @Resource
+    private OrderUserInfoService orderUserInfoService;
+    @Resource
+    private CmMessageService cmMessageService;
+    @Resource
+    private ClubDao clubDao;
+    @Autowired
+    private ProductDao productDao;
+    @Resource
+    private CmProductSnService cmProductSnService;
+    @Autowired
+    private NewOrderProductDao newOrderProductDao;
+    @Resource
+    private CmReturnedPurchaseDao cmReturnedPurchaseDao;
+    @Resource
+    private CmUserService cmUserService;
+    @Resource
+    private RepeatPurchasePriceService repeatPurchasePriceService;
+    @Resource
+    private NewCmShopService newCmShopService;
+    @Resource
+    private RepeatPurchasePriceHistoryService repeatPurchasePriceHistoryService;
+    @Resource
+    private NewOrderConfigService newOrderConfigService;
+    @Resource
+    private CmDiscernReceiptService cmDiscernReceiptService;
+    @Resource
+    private CmUserDao cmUserDao;
+    @Resource
+    private CmReturnedPurchaseService cmReturnedPurchaseService;
+    @Resource
+    private CmReceiptOrderRelationDao cmReceiptOrderRelationDao;
+    @Autowired
+    private CmUserOrganizeService cmUserOrganizeService;
+    @Autowired
+    private CmSecondHandDetailService cmSecondHandDetailService;
+    @Autowired
+    private CmDiscernReceiptDao cmDiscernReceiptDao;
+    @Autowired
+    private CmReceiptOrderRelationService cmReceiptOrderRelationService;
+    @Resource
+    private CmPromotionDao cmPromotionDao;
+    @Autowired
+    private PurchaseProductService purchaseProductService;
+
+    @ModelAttribute
+    public NewOrder get(@RequestParam(required = false) String id) {
+        NewOrder entity = null;
+        if (StringUtils.isNotBlank(id)) {
+            entity = heHeNewOrderService.get(id);
+        }
+        if (entity == null) {
+            entity = new NewOrder();
+        }
+        return entity;
+    }
+
+    @RequestMapping("orderList")
+    public String orderList(NewOrder order, HttpServletRequest request, HttpServletResponse response, Model model) {
+        if (null != order.getStartTime() && !"".equals(order.getStartTime()) && !order.getStartTime().endsWith("00:00:00")) {
+            model.addAttribute("startTime", order.getStartTime());
+            order.setStartTime(order.getStartTime() + " 00:00:00");
+        }
+        if (null != order.getEndTime() && !"".equals(order.getEndTime()) && !order.getEndTime().endsWith("23:59:59")) {
+            model.addAttribute("endTime", order.getEndTime());
+            order.setEndTime(order.getEndTime() + " 23:59:59");
+        }
+        if (null != order.getStartConfirmTime() && !"".equals(order.getStartConfirmTime()) && !order.getStartConfirmTime().endsWith("00:00:00")) {
+            model.addAttribute("startConfirmTime", order.getStartConfirmTime());
+            order.setStartConfirmTime(order.getStartConfirmTime() + " 00:00:00");
+        }
+        if (null != order.getEndConfirmTime() && !"".equals(order.getEndConfirmTime()) && !order.getEndConfirmTime().endsWith("23:59:59")) {
+            model.addAttribute("endConfirmTime", order.getEndConfirmTime());
+            order.setEndConfirmTime(order.getEndConfirmTime() + " 23:59:59");
+        }
+        if (null != order.getStartRefundTime() && !"".equals(order.getStartRefundTime()) && !order.getStartRefundTime().endsWith("00:00:00")) {
+            model.addAttribute("startRefundTime", order.getStartRefundTime());
+            order.setStartRefundTime(order.getStartRefundTime() + " 00:00:00");
+        }
+        if (null != order.getEndRefundTime() && !"".equals(order.getEndRefundTime()) && !order.getEndRefundTime().endsWith("23:59:59")) {
+            model.addAttribute("endRefundTime", order.getEndRefundTime());
+            order.setEndRefundTime(order.getEndRefundTime() + " 23:59:59");
+        }
+        model.addAttribute("orderRefundType", order.getOrderRefundType());
+        if (null != order.getBuyer()) {
+            order.setBuyer(order.getBuyer().trim());
+        }
+        if (null != order.getReceiver()) {
+            order.setReceiver(order.getReceiver().trim());
+        }
+        //查询内部处理了已收,未付统计(包含运费)
+        Page<NewOrder> page = heHeNewOrderService.findPage(new Page<>(request, response, 20), order);
+        CmHeheUser user = new CmHeheUser();
+        user.setUserIdentity("2");
+        List<CmHeheUser> heUsers = cmHeheUserDao.findList(user);
+        model.addAttribute("page", page);
+        model.addAttribute("heUsers", heUsers);
+        return "modules/hehe/heheNewOrderList";
+    }
+
+    /**
+     * 订单详情
+     */
+    @RequestMapping("detail")
+    public String detail(NewOrder order, Model model) {
+        BpClause bpClause = new BpClause();
+        bpClause.setEnabledStatus("1");
+        List<BpClause> bpClauses = bpClauseService.findList(bpClause);
+        model.addAttribute("bpClauses", bpClauses);
+        //获取订单是否可以申请付款
+        List<Integer> oId = new ArrayList<>();
+        oId.add(order.getOrderID());
+        List<Integer> orderIdsInApplyReturn = cmReturnedPurchaseDao.findOrderIDsInApplyReturnFlag(oId);
+        if (CollectionUtils.isNotEmpty(orderIdsInApplyReturn) && orderIdsInApplyReturn.size() > 0) {
+            order.setApplyReturnedPurchaseFlag("0");
+        } else {
+            order.setApplyReturnedPurchaseFlag("1");
+        }
+        //判断是否有在收款审核的订单
+        List<Integer> ids = cmReceiptOrderRelationDao.toAudit(order.getOrderID());
+        if (ids != null && ids.size() > 0) {
+            order.setToAudit("1");
+        }
+        //一个子订单只有一个商品时,不可拆分
+        int count = 0;
+        for (NewShopOrder newShopOrder : order.getNewShopOrders()) {
+            if (newShopOrder.getShopID() != 998) {
+                count++;
+            }
+        }
+        if (order.getProductCount() == null) {
+            order.setProductCount(1);
+        }
+        if (order.getProductCount() <= count) {
+            order.setSplitFlag("0");
+        }
+        //是否抹平支付过(抹平最多只允许存在一次)
+        CmDiscernReceipt cmDiscernReceipt = cmDiscernReceiptDao.findSmoothoutInfo(order.getOrderID().toString());
+        if (null != cmDiscernReceipt) {
+            order.setAssociationType(cmDiscernReceipt.getAssociationType());
+            String confirmType = cmDiscernReceipt.getConfirmType();
+            order.setConfirmType(confirmType);
+
+            // 是否是一比款收了多个订单
+            if (StringUtils.equals(confirmType, "1") || StringUtils.equals(confirmType, "2") || StringUtils.equals(confirmType, "3")) {
+                List<CmReceiptOrderRelation> byReceiptList = cmReceiptOrderRelationService.findByReceiptID(cmDiscernReceipt.getId());
+                if (CollectionUtils.isNotEmpty(byReceiptList) && byReceiptList.size() > 1) {
+                    order.setReceiptOrderFlag(true);
+                }
+            }
+        }
+
+        // 订单已收款才会出现抹平或者多收退余额,(已收再退款或者撤销退款订单即使存在抹平也需要当未抹平重新计算付款)
+        String receiptStatus = order.getReceiptStatus();
+        if (StringUtils.equals("3", receiptStatus)) {
+            if (null != cmDiscernReceipt) {
+                String confirmType = cmDiscernReceipt.getConfirmType();
+                order.setConfirmType(confirmType);
+                double associateAmount = cmDiscernReceiptDao.getAssociateAmount(String.valueOf(order.getOrderID()));
+                order.setOrderReceivedAmount(associateAmount);
+                //大额退余额
+                if (StringUtils.equals("3", confirmType)) {
+                    String id = cmDiscernReceipt.getId();
+                    double returnBalanceAmount = cmDiscernReceiptDao.getReturnBalanceAmount(id);
+                    order.setReturnBalanceAmount(returnBalanceAmount);
+                }
+            }
+        }
+
+        model.addAttribute("order", order);
+        if ("0".equals(order.getStatus())) {
+            try {
+                NewOrderConfig confirmOverTime = newOrderConfigService.getValueByKey("confirmOverTime");
+                Double value = confirmOverTime.getValue(); //待确认超过 value 小时自动取消订单
+                GregorianCalendar gc = new GregorianCalendar();
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                Date orderTime = sdf.parse(order.getOrderTime());
+                gc.setTime(orderTime);
+                gc.add(Calendar.HOUR, value.intValue());
+                Date time = gc.getTime();
+                String ot = sdf.format(time);
+                if (time.after(new Date()))
+                    model.addAttribute("time", ot);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        CmReturnedPurchase cmReturnedPurchase = new CmReturnedPurchase();
+        cmReturnedPurchase.setStatus("2");
+        cmReturnedPurchase.setOrderID(order.getOrderID());
+        List<CmReturnedPurchase> dataList = cmReturnedPurchaseService.getReturnedPurchaseList(cmReturnedPurchase);
+        Double returnedPurchaseFee = 0D;    //退款(退货)总金额
+        Double refundFee = 0D;  //退款总额(给买家)
+        for (CmReturnedPurchase bean : dataList) {
+            if (!bean.getStatus().equals("3")) {
+                returnedPurchaseFee += bean.getReturnedPurchaseFee();
+                refundFee += bean.getRefundFee();
+            }
+        }
+        double returnValue = 0d;   //退货价值
+        if (order.getDiscountFee() >= returnedPurchaseFee) {
+            returnValue = 0d;   //如果经理折扣大于退款(退货)总金额之和  那么先抵扣经理折扣  退款价值为0
+        } else {
+            returnValue = returnedPurchaseFee - order.getDiscountFee(); //抵用完经理折扣后才是真实价值
+        }
+        //订单已收金额
+        Double receiptAmount = cmDiscernReceiptService.findOrderReceipt(order.getOrderID());
+        model.addAttribute("returnValue", returnValue);
+        model.addAttribute("receiptAmount", receiptAmount == null ? 0 : receiptAmount);
+        model.addAttribute("returnedPurchaseFee", returnedPurchaseFee);
+        return "modules/hehe/heheNewOrderDetail";
+    }
+}

+ 9 - 0
src/main/java/com/caimei/modules/order/entity/CmReturnedPurchase.java

@@ -69,6 +69,7 @@ public class CmReturnedPurchase extends DataEntity<CmReturnedPurchase> {
     private String applicationUserName;//申请人
     private String reviewUserName;//审核人
     private String name; //机构名
+    private Integer orderType; //订单类型 0协销订单、 1普通订单、 2呵呵订单
 
     public String getName() {
         return name;
@@ -453,4 +454,12 @@ public class CmReturnedPurchase extends DataEntity<CmReturnedPurchase> {
     public void setPayType(String payType) {
         this.payType = payType;
     }
+
+    public Integer getOrderType() {
+        return orderType;
+    }
+
+    public void setOrderType(Integer orderType) {
+        this.orderType = orderType;
+    }
 }

+ 1 - 1
src/main/java/com/caimei/modules/order/entity/NewOrder.java

@@ -52,7 +52,7 @@ public class NewOrder extends DataEntity<NewOrder> {
     private Double freight;             // decimal(20,0) comment '运费' v5.0版本已废弃,运费已使用商品形式存储,
     //    private Integer freePostageTicketID; // bigint(11) comment '包邮券ID',
     private Integer buyUserID;//            下单人
-    private String orderType;//      char(2) comment '订单类型 协销订单0 普通订单1',
+    private String orderType;//    订单类型 0协销订单、 1普通订单、 2呵呵订单
     private List<NewShopOrder> newShopOrders;
     private OrderUserInfo bpOrderUserinfo; //订单用户信息表
     private OrderInvoice orderInvoice;

+ 24 - 0
src/main/java/com/caimei/modules/order/entity/NewOrderProduct.java

@@ -90,6 +90,8 @@ public class NewOrderProduct extends DataEntity<NewOrderProduct> {
     private String splitFlag;//订单商品是否可拆分   1可拆分(不可以进账确认) 0不可拆分----统计子订单中的
     private String costCheckFlag; //成本价选中标志:1固定成本 2比例成
     private Double costProportional;//比例成本百分比
+    private Integer heUserId; //分销者id(呵呵商城订单使用)
+    private String heUserName; //分销者名称
     private List<CmProductSn> cmProductSnList; //(重光电/轻光电)SN码
 
     private String consignee;        //收货人
@@ -109,19 +111,25 @@ public class NewOrderProduct extends DataEntity<NewOrderProduct> {
     private String secondHandType;//二手商品分类,1二手仪器,2临期产品,3其他
     private CmPromotion productPromotion; //下单时商品对应的促销活动
     private Integer ladderPriceFlag;        // 启用阶梯价格标识 0否 1是
+
     public Integer getLadderPriceFlag() {
         return ladderPriceFlag;
     }
+
     public void setLadderPriceFlag(Integer ladderPriceFlag) {
         this.ladderPriceFlag = ladderPriceFlag;
     }
+
     private List<ProductLadderPrice> ladderPriceList;//商品阶梯价格列表
+
     public List<ProductLadderPrice> getLadderPriceList() {
         return ladderPriceList;
     }
+
     public void setLadderPriceList(List<ProductLadderPrice> ladderPriceList) {
         this.ladderPriceList = ladderPriceList;
     }
+
     private Double touchPrice; //优惠价格
     private List<OrderProductLadderPrice> orderProductLadderPriceList;  //订单商品阶梯价格
 
@@ -920,4 +928,20 @@ public class NewOrderProduct extends DataEntity<NewOrderProduct> {
     public void setOrderProductLadderPriceList(List<OrderProductLadderPrice> orderProductLadderPriceList) {
         this.orderProductLadderPriceList = orderProductLadderPriceList;
     }
+
+    public Integer getHeUserId() {
+        return heUserId;
+    }
+
+    public void setHeUserId(Integer heUserId) {
+        this.heUserId = heUserId;
+    }
+
+    public String getHeUserName() {
+        return heUserName;
+    }
+
+    public void setHeUserName(String heUserName) {
+        this.heUserName = heUserName;
+    }
 }

+ 18 - 7
src/main/java/com/caimei/modules/order/service/CmDiscernReceiptService.java

@@ -1,5 +1,6 @@
 package com.caimei.modules.order.service;
 
+import com.caimei.modules.hehe.dao.HeHeNewOrderDao;
 import com.caimei.modules.order.dao.CmDiscernReceiptDao;
 import com.caimei.modules.order.dao.CmRebateRecordDao;
 import com.caimei.modules.order.dao.NewOrderDao;
@@ -45,6 +46,8 @@ public class CmDiscernReceiptService extends CrudService<CmDiscernReceiptDao, Cm
     private NewCmShopDao newCmShopDao;
     @Resource
     private NewShopOrderDao newShopOrderDao;
+    @Resource
+    private HeHeNewOrderDao heHeNewOrderDao;
 
     public CmDiscernReceipt get(String id) {
         return super.get(id);
@@ -56,7 +59,7 @@ public class CmDiscernReceiptService extends CrudService<CmDiscernReceiptDao, Cm
 
     public Page<CmDiscernReceipt> findPage(Page<CmDiscernReceipt> page, CmDiscernReceipt cmDiscernReceipt) {
         Page<CmDiscernReceipt> result = super.findPage(page, cmDiscernReceipt);
-        result.getList().stream().forEach(bean -> {
+        result.getList().forEach(bean -> {
             logger.info("-----------------:::::" + bean.getId());
             String type = "";
             String no = "";
@@ -65,12 +68,20 @@ public class CmDiscernReceiptService extends CrudService<CmDiscernReceiptDao, Cm
                 for (Map<String, Object> map : orderIDs) {
                     if ("".equals(type)) {
 //					协销订单 0 普通订单 1',
-                        Object orderType = map.get("orderType");
+                        Integer orderType = (Integer) map.get("orderType");
                         if (null != map.get("orderType")) {
                             type += map.get("orderType").toString().equals("0") ? "协销" : "自主";
                         } else {
                             type += "自主";
                         }
+                        if (2 == orderType) {
+                            //呵呵商城订单
+                            Integer orderId = (Integer) map.get("orderID");
+                            NewOrder order = newOrderDao.findByOrderID(orderId);
+                            String name = heHeNewOrderDao.findHeUser(order.getUserID());
+                            bean.setName(name);
+                            bean.setReceiptOrderType("2");
+                        }
                     } else {
                         type += ("<br>" + (map.get("orderType").toString().equals("0") ? "协销" : "自主"));
                     }
@@ -100,8 +111,8 @@ public class CmDiscernReceiptService extends CrudService<CmDiscernReceiptDao, Cm
         ReceiptDetailVo vo = cmDiscernReceiptDao.getInfos(cmDiscernReceipt.getId());
         List<CmReceiptOrderRelation> relations = cmReceiptOrderRelationService.findByReceiptID(cmDiscernReceipt.getId());
         boolean receiptOrderFlag = false;
-        if(CollectionUtils.isNotEmpty(relations) && relations.size() > 1){
-                receiptOrderFlag = true;
+        if (CollectionUtils.isNotEmpty(relations) && relations.size() > 1) {
+            receiptOrderFlag = true;
         }
         vo.setReceiptOrderFlag(receiptOrderFlag);//设置一款多单状态
         List<ReceiptOrderInfoVo> orderInfos = new ArrayList<>(); //一个收款可能会关联了一个或多个订单
@@ -118,9 +129,9 @@ public class CmDiscernReceiptService extends CrudService<CmDiscernReceiptDao, Cm
             if (roi != null) {
                 List<ReceiptRecordVo> receiptRecordByOrderID = cmDiscernReceiptDao.findReceiptRecordByOrderID(roi);
 //                暂时不启用抹平明细
-                if(CollectionUtils.isNotEmpty(receiptRecordByOrderID)){
-                    for(ReceiptRecordVo v:receiptRecordByOrderID){
-                        if(StringUtils.equals("3",v.getConfirmType())){
+                if (CollectionUtils.isNotEmpty(receiptRecordByOrderID)) {
+                    for (ReceiptRecordVo v : receiptRecordByOrderID) {
+                        if (StringUtils.equals("3", v.getConfirmType())) {
                             String id = v.getReceiptID();
                             double returnBalanceAmount = cmDiscernReceiptDao.getReturnBalanceAmount(id);
                             v.setReturnBalanceAmount(returnBalanceAmount);

+ 27 - 2
src/main/java/com/caimei/modules/order/service/CmPayShopService.java

@@ -2,6 +2,7 @@ package com.caimei.modules.order.service;
 
 import com.caimei.dfs.image.beens.ImageUploadInfo;
 import com.caimei.modules.common.utils.UploadUtils;
+import com.caimei.modules.hehe.dao.HeHeNewOrderDao;
 import com.caimei.modules.order.dao.*;
 import com.caimei.modules.order.entity.*;
 import com.caimei.modules.sys.utils.UploadImageUtils;
@@ -56,6 +57,8 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
     private CmReceiptOrderRelationDao cmReceiptOrderRelationDao;
     @Resource
     private CmRefundShopRecordDao cmRefundShopRecordDao;
+    @Resource
+    private HeHeNewOrderDao heHeNewOrderDao;
 
     public CmPayShop get(String id) {
         CmPayShop payShop = super.get(id);
@@ -102,9 +105,19 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                     payShop.setRePayment("2");
                 }
             }
+            newShopOrders.forEach(shopOrder -> {
+                NewOrder order = newOrderDao.findByOrderID(shopOrder.getOrderID());
+                if ("2".equals(order.getOrderType())) {
+                    //呵呵商城订单
+                    shopOrder.setOrderType(2);
+                    if (StringUtils.isBlank(shopOrder.getClubName())) {
+                        String name = heHeNewOrderDao.findHeUser(order.getUserID());
+                        shopOrder.setClubName(name);
+                    }
+                }
+            });
         }
-        Page<CmPayShop> cmPayShopPage = page1.setList(list);
-        return cmPayShopPage;
+        return page1.setList(list);
     }
 
     @Transactional(readOnly = false)
@@ -164,6 +177,10 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                 NewOrder newOrder = newOrderDao.get(so.getOrderID().toString());
                 if (null != newOrder) {
                     so.setReceiptStatus(newOrder.getReceiptStatus());
+                    if ("2".equals(newOrder.getOrderType())) {
+                        //呵呵商城订单
+                        so.setOrderType(2);
+                    }
                 } else {
                     so.setReceiptStatus("1");
                 }
@@ -227,6 +244,14 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                 NewOrder newOrder = newOrderDao.get(so.getOrderID().toString());
                 if (null != newOrder) {
                     so.setReceiptStatus(newOrder.getReceiptStatus());
+                    if ("2".equals(newOrder.getOrderType())) {
+                        //呵呵商城订单
+                        so.setOrderType(2);
+                        if (StringUtils.isBlank(so.getClubName())) {
+                            String name = heHeNewOrderDao.findHeUser(newOrder.getUserID());
+                            so.setClubName(name);
+                        }
+                    }
                 } else {
                     so.setReceiptStatus("1");
                 }

+ 3 - 2
src/main/java/com/caimei/modules/order/service/CmReturnedPurchaseService.java

@@ -405,14 +405,14 @@ public class CmReturnedPurchaseService extends CrudService<CmReturnedPurchaseDao
 
 
     @Transactional(readOnly = false)
-    public void cancelApply(CmReturnedPurchase cmReturnedPurchase) throws Exception {
+    public NewOrder cancelApply(CmReturnedPurchase cmReturnedPurchase) throws Exception {
         CmReturnedPurchase returnedPurchase = cmReturnedPurchaseDao.get(cmReturnedPurchase);
         if ("2".equals(returnedPurchase.getStatus())) {
             throw new Exception("该退款单已被审核,不能取消");
         }
         //待审核状态
+        NewOrder newOrder = newOrderService.get(returnedPurchase.getOrderID().toString());
         if ("1".equals(returnedPurchase.getStatus())) {
-            NewOrder newOrder = newOrderService.get(returnedPurchase.getOrderID().toString());
             List<NewOrderProduct> orderProductList = newOrderProductDao.findListByOrderID(newOrder.getOrderID());
             boolean rechargeGoods = false;
             for (NewOrderProduct orderProduct : orderProductList) {
@@ -431,6 +431,7 @@ public class CmReturnedPurchaseService extends CrudService<CmReturnedPurchaseDao
             }
         }
         cmReturnedPurchaseDao.update(cmReturnedPurchase);
+        return newOrder;
     }
 
     @Transactional(readOnly = false)

+ 8 - 4
src/main/java/com/caimei/modules/order/service/NewOrderService.java

@@ -886,8 +886,10 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
             NewCmClub club = newCmClubDao.getclubByUserId(newOrder.getUserID());
             if (null != orderUserInfo) {
                 newOrder.setBpOrderUserinfo(orderUserInfo);
-                //使用机构名称
-                orderUserInfo.setName(club.getName());
+                if (club != null) {
+                    //使用机构名称
+                    orderUserInfo.setName(club.getName());
+                }
             }
             //获取订单商品
             List<NewOrderProduct> list = new ArrayList<>();
@@ -993,8 +995,10 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
             if (null != orderUserInfo) {
                 orderUserInfo = cmUserService.getBalance(orderUserInfo);
                 newOrder.setBpOrderUserinfo(orderUserInfo);
-                //使用机构名称
-                orderUserInfo.setName(club.getName());
+                if (club != null) {
+                    //使用机构名称
+                    orderUserInfo.setName(club.getName());
+                }
             }
             List<NewShopOrder> shopOrders = newShopOrderDao.findListByOrderID(cmReturnedPurchase.getOrderID());
             if (CollectionUtils.isNotEmpty(shopOrders)) {

+ 4 - 2
src/main/java/com/caimei/modules/order/service/NewShopOrderService.java

@@ -56,8 +56,6 @@ public class NewShopOrderService extends CrudService<NewShopOrderDao, NewShopOrd
     @Resource
     private CmRefundShopRecordDao cmRefundShopRecordDao;
     @Resource
-    private CmReturnedPurchaseProductDao cmReturnedPurchaseProductDao;
-    @Resource
     private CmRefundShopDao cmRefundShopDao;
     @Resource
     private CmDiscernReceiptDao cmDiscernReceiptDao;
@@ -268,6 +266,10 @@ public class NewShopOrderService extends CrudService<NewShopOrderDao, NewShopOrd
             NewOrder newOrder = newOrderDao.get(so.getOrderID().toString());
             if (null != newOrder) {
                 so.setReceiptStatus(newOrder.getReceiptStatus());
+                if ("2".equals(newOrder.getOrderType())) {
+                    //呵呵商城订单
+                    so.setOrderType(2);
+                }
             } else {
                 so.setReceiptStatus("1");
             }

+ 1 - 0
src/main/java/com/caimei/modules/order/web/CmReturnedPurchaseController.java

@@ -72,6 +72,7 @@ public class CmReturnedPurchaseController extends BaseController {
         List<CmUserOrganize> cmUserOrganizeList = cmUserOrganizeService.findOrganize();
         model.addAttribute("cmUserOrganizeList", cmUserOrganizeList);
         model.addAttribute("page", page);
+        model.addAttribute("orderType", cmReturnedPurchase.getOrderType());
         return "modules/order/cmReturnedPurchaseList";
     }
 

+ 213 - 202
src/main/java/com/caimei/modules/user/service/CmUserService.java

@@ -24,6 +24,7 @@ import java.util.Map;
 
 /**
  * 用户Service
+ *
  * @author ZCP
  * @version 2017-10-10
  */
@@ -31,20 +32,21 @@ import java.util.Map;
 @Transactional(readOnly = true)
 public class CmUserService extends CrudService<CmUserDao, CmUser> {
 
-	@Autowired
-	CmUserDao cmUserDao;
+    @Autowired
+    CmUserDao cmUserDao;
 
-	@Resource
-	CmBindDao cmBindDao;
+    @Resource
+    CmBindDao cmBindDao;
 
-	public CmUser get(String id) {
-		return super.get(id);
-	}
+    public CmUser get(String id) {
+        return super.get(id);
+    }
 
-	public List<CmUser> findList(CmUser cmUser) {
-		return super.findList(cmUser);
-	}
-//     todo lwt 普通用户管理操作
+    public List<CmUser> findList(CmUser cmUser) {
+        return super.findList(cmUser);
+    }
+
+    //     todo lwt 普通用户管理操作
 //	public List<CmUser> findAllPersonalUser() {
 //		return cmUserDao.findAllPersonalUser();
 //	}
@@ -53,146 +55,153 @@ public class CmUserService extends CrudService<CmUserDao, CmUser> {
 //		return cmUserDao.findUserByRegisterType(registerUserTypeID);
 //	}
 //
-	public Page<CmUser> findPage(Page<CmUser> page, CmUser cmUser) {
-		return super.findPage(page, cmUser);
-	}
+    public Page<CmUser> findPage(Page<CmUser> page, CmUser cmUser) {
+        return super.findPage(page, cmUser);
+    }
+
+    @Transactional(readOnly = false)
+    public void save(CmUser cmUser) {
+        super.save(cmUser);
+    }
 
-	@Transactional(readOnly = false)
-	public void save(CmUser cmUser) {
-		super.save(cmUser);
-	}
+    @Transactional(readOnly = false)
+    public void insert(CmUser cmUser) {
+        cmUserDao.insert(cmUser);
+    }
 
-	@Transactional(readOnly = false)
-	public void insert(CmUser cmUser){
-		cmUserDao.insert(cmUser);
-	}
+    @Transactional(readOnly = false)
+    public void delete(CmUser cmUser) {
+        super.delete(cmUser);
+    }
 
-	@Transactional(readOnly = false)
-	public void delete(CmUser cmUser) {
-		super.delete(cmUser);
-	}
-	@Transactional(readOnly = false)
-	public void update(CmUser cmUser) {
-		cmUserDao.update(cmUser);
-	}
+    @Transactional(readOnly = false)
+    public void update(CmUser cmUser) {
+        cmUserDao.update(cmUser);
+    }
 
-	@Transactional(readOnly = false)
-	public void unBindClub(CmUser cmUser) {
-		cmUser.setCompanyUserID(null); //置空所属企业用户对应UserID
-		cmUser.setName(null);//置空组织名称
-		cmUser.setUserIdentity(UserIdentity.NORMAL_USER.getCode());
-		cmUser.setUserPermission(UserPermission.NORMAL.getCode());//用户权限改成普通人
-		cmUser.setRegisterUserTypeID(UserType.VISITOR.getCode() + "");//设为游离员工
-		cmUser.setClubStatus(null);
-		cmUser.setClubID(null);
-		cmUserDao.update(cmUser);
-	}
+    @Transactional(readOnly = false)
+    public void unBindClub(CmUser cmUser) {
+        cmUser.setCompanyUserID(null); //置空所属企业用户对应UserID
+        cmUser.setName(null);//置空组织名称
+        cmUser.setUserIdentity(UserIdentity.NORMAL_USER.getCode());
+        cmUser.setUserPermission(UserPermission.NORMAL.getCode());//用户权限改成普通人
+        cmUser.setRegisterUserTypeID(UserType.VISITOR.getCode() + "");//设为游离员工
+        cmUser.setClubStatus(null);
+        cmUser.setClubID(null);
+        cmUserDao.update(cmUser);
+    }
 
-	@Transactional(readOnly = false)
-	public void unBindShop(CmUser cmUser) {
-		cmUser.setCompanyUserID(null); //置空所属企业用户对应UserID
-		cmUser.setName(null);//置空组织名称
-		cmUser.setUserIdentity(UserIdentity.NORMAL_USER.getCode());
-		cmUser.setUserPermission(UserPermission.NORMAL.getCode());//用户权限改成普通人
-		cmUser.setRegisterUserTypeID(UserType.VISITOR.getCode() + "");//设为游离员工
-		cmUser.setManufacturerStatus(null);
-		cmUser.setShopID(null);
-		cmUserDao.update(cmUser);
-	}
+    @Transactional(readOnly = false)
+    public void unBindShop(CmUser cmUser) {
+        cmUser.setCompanyUserID(null); //置空所属企业用户对应UserID
+        cmUser.setName(null);//置空组织名称
+        cmUser.setUserIdentity(UserIdentity.NORMAL_USER.getCode());
+        cmUser.setUserPermission(UserPermission.NORMAL.getCode());//用户权限改成普通人
+        cmUser.setRegisterUserTypeID(UserType.VISITOR.getCode() + "");//设为游离员工
+        cmUser.setManufacturerStatus(null);
+        cmUser.setShopID(null);
+        cmUserDao.update(cmUser);
+    }
 
-	@Transactional(readOnly = false)
-	public void unBindWeChat(CmUser cmUser) {
-		cmUser.setOpenID(null);//解除与微信的关联
-		cmUserDao.update(cmUser);
-		List<CmBind> cmbinds = cmBindDao.findCmbindByUserId(cmUser.getUserID());
-		CmBind cmbind = cmbinds.get(0);
-		cmbind.setUserID(null);//微信与用户解绑
-		cmbind.setRegisterUserTypeID(UserType.WXUSER.getCode() + "");//设为微信游客
-		cmBindDao.update(cmbind);
-	}
+    @Transactional(readOnly = false)
+    public void unBindWeChat(CmUser cmUser) {
+        cmUser.setOpenID(null);//解除与微信的关联
+        cmUserDao.update(cmUser);
+        List<CmBind> cmbinds = cmBindDao.findCmbindByUserId(cmUser.getUserID());
+        CmBind cmbind = cmbinds.get(0);
+        cmbind.setUserID(null);//微信与用户解绑
+        cmbind.setRegisterUserTypeID(UserType.WXUSER.getCode() + "");//设为微信游客
+        cmBindDao.update(cmbind);
+    }
 
-	/**
-	 * 查询员工(不包括企业用户)
-	 * @param companyUserID
-	 * @return
-	 */
-	public List<CmUser> findByCompanyUserID(Integer companyUserID){
-		return cmUserDao.findByCompanyUserID(companyUserID);
-	}
+    /**
+     * 查询员工(不包括企业用户)
+     *
+     * @param companyUserID
+     * @return
+     */
+    public List<CmUser> findByCompanyUserID(Integer companyUserID) {
+        return cmUserDao.findByCompanyUserID(companyUserID);
+    }
 
-	/**
-	 * 通过企业用户ID 更新员工状态
-	 * @param clubStatus
-	 * @param manufacturerStatus
-	 * @param companyUserID
-	 */
-	@Transactional(readOnly = false)
-	public void updateEmployeeStatus(Integer userPermission,String clubStatus,String manufacturerStatus,String tipStatus,Integer companyUserID){
-		cmUserDao.updateEmployeeStatus(userPermission,clubStatus,manufacturerStatus,tipStatus,companyUserID);
-	}
+    /**
+     * 通过企业用户ID 更新员工状态
+     *
+     * @param clubStatus
+     * @param manufacturerStatus
+     * @param companyUserID
+     */
+    @Transactional(readOnly = false)
+    public void updateEmployeeStatus(Integer userPermission, String clubStatus, String manufacturerStatus, String tipStatus, Integer companyUserID) {
+        cmUserDao.updateEmployeeStatus(userPermission, clubStatus, manufacturerStatus, tipStatus, companyUserID);
+    }
 
-	@Transactional(readOnly = false)
-	public void updateUserStatus(String manufacturerStatus,Integer userID,String validFlag){
-		cmUserDao.updateUserStatus(manufacturerStatus,userID,validFlag);
-	}
+    @Transactional(readOnly = false)
+    public void updateUserStatus(String manufacturerStatus, Integer userID, String validFlag) {
+        cmUserDao.updateUserStatus(manufacturerStatus, userID, validFlag);
+    }
 
-	/**
-	 * 通过企业用户ID 更新员工权限
-	 * @param companyUserID
-	 */
-	@Transactional(readOnly = false)
-	public void updateEmployeePermission(Integer userPermission,Integer companyUserID){
-		cmUserDao.updateEmployeePermission(userPermission,companyUserID);
-	}
+    /**
+     * 通过企业用户ID 更新员工权限
+     *
+     * @param companyUserID
+     */
+    @Transactional(readOnly = false)
+    public void updateEmployeePermission(Integer userPermission, Integer companyUserID) {
+        cmUserDao.updateEmployeePermission(userPermission, companyUserID);
+    }
 
-	/**
-	 * 企业审核未通过 使申请者变为普通用户
-	 * @return
-	 */
-	@Transactional(readOnly = false)
-	public void initEmployeeInfo(){
-		cmUserDao.initEmployeeInfo();
-	}
+    /**
+     * 企业审核未通过 使申请者变为普通用户
+     *
+     * @return
+     */
+    @Transactional(readOnly = false)
+    public void initEmployeeInfo() {
+        cmUserDao.initEmployeeInfo();
+    }
 
-	/**
-	 * 根据手机号码查询用户
-	 * @param mobile
-	 * @return
-	 */
-	@Transactional(readOnly = true)
-	public CmUser findUserByMobile(String mobile) {
-		return cmUserDao.findUserByMobile(mobile);
-	}
+    /**
+     * 根据手机号码查询用户
+     *
+     * @param mobile
+     * @return
+     */
+    @Transactional(readOnly = true)
+    public CmUser findUserByMobile(String mobile) {
+        return cmUserDao.findUserByMobile(mobile);
+    }
 
-	/**
-	 * 通过企业手机号码查询用户
-	 * @param cmUser
-	 * @return
-	 */
-	@Transactional(readOnly = true)
-	public List<CmUser> findListBuyBindMobile(CmUser cmUser){
-		return cmUserDao.findListBuyBindMobile(cmUser);
-	}
+    /**
+     * 通过企业手机号码查询用户
+     *
+     * @param cmUser
+     * @return
+     */
+    @Transactional(readOnly = true)
+    public List<CmUser> findListBuyBindMobile(CmUser cmUser) {
+        return cmUserDao.findListBuyBindMobile(cmUser);
+    }
 
-	/**
-	 * @Author ye.qin
-	 * @Description //TODO 修改用户的可用余额
-	 * @Date 2019\5\23 0023 13:56
-	 * @Param
-	 * @return
-	 */
-	@Transactional(readOnly = false)
-	public void updateAbleUserMoney1(OrderUserInfo user) {
-		cmUserDao.updateAbleUserMoney(user);
-	}
+    /**
+     * @return
+     * @Author ye.qin
+     * @Description //TODO 修改用户的可用余额
+     * @Date 2019\5\23 0023 13:56
+     * @Param
+     */
+    @Transactional(readOnly = false)
+    public void updateAbleUserMoney1(OrderUserInfo user) {
+        cmUserDao.updateAbleUserMoney(user);
+    }
 
-	/**
-	 * @Author ye.qin
-	 * @Description //TODO 设置余额
-	 * @Date 2019\6\20 0020 16:40
-	 * @Param
-	 * @return
-	 */
+    /**
+     * @Author ye.qin
+     * @Description //TODO 设置余额
+     * @Date 2019\6\20 0020 16:40
+     * @Param
+     * @return
+     */
 //	@Transactional(readOnly = false)
 //	public void setBalance(CmUser user, Double amount) {
 //		if(UserType.isMaker(Integer.parseInt(user.getRegisterUserTypeID()))){
@@ -214,72 +223,74 @@ public class CmUserService extends CrudService<CmUserDao, CmUser> {
 //		cmUserDao.updateMoney(user);
 //	}
 
-	/**
-	 * @Author ye.qin
-	 * @Description //TODO 获取用户余额
-	 * @Date 2019\6\25 0025 17:36
-	 * @Param
-	 * @return
-	 */
-	@Transactional(readOnly = true)
-	public OrderUserInfo getBalance(OrderUserInfo bean) {
-		CmUser user = get(bean.getUserId().toString());
-		//协销
-		if(UserType.isMaker(Integer.parseInt(user.getRegisterUserTypeID()))){
-			bean.setUserMoney(0d);
-			bean.setAbleUserMoney(0d);
-			return  bean;
-		}
-
-		//会所
-		if(UserType.isClub(Integer.parseInt(user.getRegisterUserTypeID()))){
-			user = get(user.getUserID().toString());
-		}
-
-		bean.setUserMoney(user.getUserMoney());
-		bean.setAbleUserMoney(user.getAbleUserMoney());
-		return bean;
-	}
+    /**
+     * @return
+     * @Author ye.qin
+     * @Description //TODO 获取用户余额
+     * @Date 2019\6\25 0025 17:36
+     * @Param
+     */
+    @Transactional(readOnly = true)
+    public OrderUserInfo getBalance(OrderUserInfo bean) {
+        CmUser user = get(bean.getUserId().toString());
+        if (user != null) {
+            if (user.getRegisterUserTypeID() != null) {
+                //协销
+                if (UserType.isMaker(Integer.parseInt(user.getRegisterUserTypeID()))) {
+                    bean.setUserMoney(0d);
+                    bean.setAbleUserMoney(0d);
+                    return bean;
+                }
+                //会所
+                if (UserType.isClub(Integer.parseInt(user.getRegisterUserTypeID()))) {
+                    user = get(user.getUserID().toString());
+                }
+            }
+            bean.setUserMoney(user.getUserMoney());
+            bean.setAbleUserMoney(user.getAbleUserMoney());
+        }
+        return bean;
+    }
 
-	/**
-	 * 编辑用户信息验证新手机号是否可用
-	 */
-	public Map<String,String> checkMobile(String mobile, Integer userID, String source){
-		Map<String, String> result = new HashMap<>(2);
-		if (StringUtils.isEmpty(mobile)) {
-			result.put("code", "-1");
-			result.put("msg", "手机号不能为空");
-			return result;
-		}
-		List<CmUser> users = cmUserDao.selectByMobileOrEmail(mobile, source);
-		if (users != null && users.size()>0) {
-			for (int i = 0; i < users.size(); i++) {
-				//查到的用户不是自己
-				if (!users.get(i).getUserID().equals(userID)) {
-					//获取不可用原因
-					JsonForm validReason = ValidateUtil.findValidReason(mobile, users.get(i));
-					result.put("code", "-1");
-					result.put("msg", validReason.getReturn_message());
-				}else {
-					//查到的用户是自己
-					if ((mobile.equals(users.get(i).getBindMobile()) || mobile.equals(users.get(i).getEmail()))) {
-						//手机号与机构/供应商联系人手机号相同
-						result.put("code", "1");
-						result.put("msg", "该手机号可以使用");
-						break;
-					}else {
-						//手机号与机构/供应商运营人员手机号相同
-						JsonForm validReason = ValidateUtil.findValidReason(mobile, users.get(i));
-						result.put("code", "-1");
-						result.put("msg", validReason.getReturn_message());
-					}
+    /**
+     * 编辑用户信息验证新手机号是否可用
+     */
+    public Map<String, String> checkMobile(String mobile, Integer userID, String source) {
+        Map<String, String> result = new HashMap<>(2);
+        if (StringUtils.isEmpty(mobile)) {
+            result.put("code", "-1");
+            result.put("msg", "手机号不能为空");
+            return result;
+        }
+        List<CmUser> users = cmUserDao.selectByMobileOrEmail(mobile, source);
+        if (users != null && users.size() > 0) {
+            for (int i = 0; i < users.size(); i++) {
+                //查到的用户不是自己
+                if (!users.get(i).getUserID().equals(userID)) {
+                    //获取不可用原因
+                    JsonForm validReason = ValidateUtil.findValidReason(mobile, users.get(i));
+                    result.put("code", "-1");
+                    result.put("msg", validReason.getReturn_message());
+                } else {
+                    //查到的用户是自己
+                    if ((mobile.equals(users.get(i).getBindMobile()) || mobile.equals(users.get(i).getEmail()))) {
+                        //手机号与机构/供应商联系人手机号相同
+                        result.put("code", "1");
+                        result.put("msg", "该手机号可以使用");
+                        break;
+                    } else {
+                        //手机号与机构/供应商运营人员手机号相同
+                        JsonForm validReason = ValidateUtil.findValidReason(mobile, users.get(i));
+                        result.put("code", "-1");
+                        result.put("msg", validReason.getReturn_message());
+                    }
 
-				}
-			}
-		} else {
-			result.put("code", "1");
-			result.put("msg", "该账号可以注册");
-		}
-		return result;
-	}
+                }
+            }
+        } else {
+            result.put("code", "1");
+            result.put("msg", "该账号可以注册");
+        }
+        return result;
+    }
 }

+ 1 - 1
src/main/resources/config/dev/caimei.properties

@@ -148,7 +148,7 @@ photoServer=http\://192.168.2.100/
 server=http\://192.168.2.100/
 #admin2server=http\://localhost:8081/
 admin2Server=http\://admin2.caimei365.com/
-wwwServer=http\://localhost:8100/
+wwwServer=https://www.caimei365.com/
 bServer=http\://btest.365mdd.com/
 
 #CRM\u5730\u5740

+ 131 - 0
src/main/resources/mappings/modules/hehe/CmHeheActivityMapper.xml

@@ -0,0 +1,131 @@
+<?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.caimei.modules.hehe.dao.CmHeheActivityDao">
+    
+	<sql id="cmHeheActivityColumns">
+		a.id AS "id",
+		a.name AS "name",
+		a.status AS "status",
+		a.listImage AS "listImage",
+		a.detailsImage AS "detailsImage",
+		a.beginTime AS "beginTime",
+		a.endTime AS "endTime",
+		a.addTime AS "addTime",
+		a.delFlag AS "delFlag"
+	</sql>
+	
+	<sql id="cmHeheActivityJoins">
+	</sql>
+    
+	<select id="get" resultType="CmHeheActivity">
+		SELECT 
+			<include refid="cmHeheActivityColumns"/>
+		FROM cm_hehe_activity a
+		<include refid="cmHeheActivityJoins"/>
+		WHERE a.id = #{id}
+	</select>
+	
+	<select id="findList" resultType="CmHeheActivity">
+		SELECT 
+			<include refid="cmHeheActivityColumns"/>
+		FROM cm_hehe_activity a
+		<include refid="cmHeheActivityJoins"/>
+		<where>
+			a.delFlag = 0
+			<if test="name != null and name != ''">
+				AND a.name LIKE concat('%',#{name},'%')
+			</if>
+			<if test="status != null and status != ''">
+				AND a.status = #{status}
+			</if>
+			<if test="activityStatus == 1">
+				AND a.beginTime <![CDATA[ > ]]> NOW()
+			</if>
+			<if test="activityStatus == 2">
+				AND NOW() BETWEEN a.beginTime AND a.endTime
+			</if>
+			<if test="activityStatus == 3">
+				AND a.endTime <![CDATA[ < ]]> NOW()
+			</if>
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY addTime DESC
+			</otherwise>
+		</choose>
+	</select>
+	
+	<select id="findAllList" resultType="CmHeheActivity">
+		SELECT 
+			<include refid="cmHeheActivityColumns"/>
+		FROM cm_hehe_activity a
+		<include refid="cmHeheActivityJoins"/>
+		<where>
+			
+		</where>		
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+			</otherwise>
+		</choose>
+	</select>
+	
+	<insert id="insert" parameterType="CmHeheActivity"  keyProperty="id" useGeneratedKeys="true">
+		INSERT INTO cm_hehe_activity(
+			name,
+			status,
+			listImage,
+			detailsImage,
+			beginTime,
+			endTime,
+			addTime,
+			delFlag
+		) VALUES (
+			#{name},
+			#{status},
+			#{listImage},
+			#{detailsImage},
+			#{beginTime},
+			#{endTime},
+			NOW(),
+			0
+		)
+	</insert>
+	
+	<update id="update">
+		UPDATE cm_hehe_activity SET 	
+			name = #{name},
+			status = #{status},
+			listImage = #{listImage},
+			detailsImage = #{detailsImage},
+			beginTime = #{beginTime},
+			endTime = #{endTime}
+		WHERE id = #{id}
+	</update>
+	
+	<update id="delete">
+		UPDATE cm_hehe_activity SET delFlag = 1 WHERE id = #{id}
+	</update>
+
+	<update id="updateStatusById">
+		UPDATE cm_hehe_activity SET status = #{status} WHERE id = #{id}
+	</update>
+
+	<update id="deleteActivityProduct">
+		UPDATE cm_hehe_activity_product SET delFlag = 1 WHERE  activityId = #{activityId}
+	</update>
+
+	<delete id="deleteUserActivity">
+		DELETE FROM cm_hehe_user_activity WHERE activityId = #{activityId}
+	</delete>
+
+	<delete id="deleteActivityLadder">
+		DELETE FROM cm_hehe_activity_ladder WHERE activityId = #{activityId}
+	</delete>
+
+</mapper>

+ 188 - 0
src/main/resources/mappings/modules/hehe/CmHeheActivityProductMapper.xml

@@ -0,0 +1,188 @@
+<?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.caimei.modules.hehe.dao.CmHeheActivityProductDao">
+    
+	<sql id="cmHeheActivityProductColumns">
+		a.id AS "id",
+		a.activityId AS "activityId",
+		a.productId AS "productId",
+		a.addTime AS "addTime",
+		a.delFlag AS "delFlag",
+		chp.price AS "price",
+		p.name AS "name",
+		p.mainImage AS "mainImage",
+		p.unit AS "unit",
+		s.name AS "shopName"
+	</sql>
+	
+	<sql id="cmHeheActivityProductJoins">
+		LEFT JOIN cm_hehe_product chp ON chp.productId = a.productID
+		LEFT JOIN product p ON a.productId = p.productID
+		LEFT JOIN shop s ON s.shopID = p.shopID
+	</sql>
+    
+	<select id="get" resultType="CmHeheActivityProduct">
+		SELECT 
+			<include refid="cmHeheActivityProductColumns"/>
+		FROM cm_hehe_activity_product a
+		<include refid="cmHeheActivityProductJoins"/>
+		WHERE a.id = #{id}
+	</select>
+	
+	<select id="findList" resultType="CmHeheActivityProduct">
+		SELECT 
+			<include refid="cmHeheActivityProductColumns"/>
+		FROM cm_hehe_activity_product a
+		<include refid="cmHeheActivityProductJoins"/>
+		<where>
+			a.delFlag = 0
+			AND a.activityId = #{activityId}
+			<if test="name != null and name != ''">
+				AND p.name LIKE CONCAT('%',#{name},'%')
+			</if>
+			<if test="shopName != null and shopName != ''">
+				AND s.name LIKE CONCAT('%',#{shopName},'%')
+			</if>
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.addTime DESC
+			</otherwise>
+		</choose>
+	</select>
+	
+	<select id="findAllList" resultType="CmHeheActivityProduct">
+		SELECT 
+			<include refid="cmHeheActivityProductColumns"/>
+		FROM cm_hehe_activity_product a
+		<include refid="cmHeheActivityProductJoins"/>
+		<where>
+			
+		</where>		
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+			</otherwise>
+		</choose>
+	</select>
+	
+	<insert id="insert" parameterType="CmHeheActivityProduct"  keyProperty="id" useGeneratedKeys="true">
+		INSERT INTO cm_hehe_activity_product(
+			activityId,
+			productId,
+			addTime,
+			delFlag
+		) VALUES (
+			#{activityId},
+			#{productId},
+			NOW(),
+			0
+		)
+	</insert>
+	
+	<update id="update">
+		UPDATE cm_hehe_activity_product SET 	
+			activityId = #{activityId},
+			productId = #{productId},
+			addTime = #{addTime}
+		WHERE id = #{id}
+	</update>
+	
+	<update id="delete">
+		UPDATE cm_hehe_activity_product SET delFlag = 1 WHERE id = #{id}
+	</update>
+
+	<select id="findActivityProductId" resultType="integer">
+		SELECT
+		  productId
+		FROM
+		  cm_hehe_activity_product a
+		  LEFT JOIN cm_hehe_activity cha ON a.activityId = cha.id
+		WHERE
+		  a.delFlag = 0
+		  AND cha.delFlag = 0
+	</select>
+
+	<select id="findAllHeHeProduct" resultType="com.caimei.modules.hehe.entity.CmHeheProduct">
+		SELECT
+		a.id AS "id",
+		a.productId AS "productId",
+		a.price AS "price",
+		p.name AS "name",
+		p.mainImage AS "mainImage",
+		s.name AS "shopName"
+		FROM
+		cm_hehe_product a
+		LEFT JOIN product p ON a.productId = p.productID
+		LEFT JOIN shop s ON s.shopID = p.shopID
+		WHERE
+		a.validFlag = 1
+		<if test="ids != null and ids.size() > 0 ">
+			AND a.productId NOT IN
+			<foreach collection="ids" open="(" close=")" item="id" separator=",">
+				#{id}
+			</foreach>
+		</if>
+		<if test="productId != null">
+			AND a.productId = #{productId}
+		</if>
+		<if test="name != null and name != ''">
+			AND p.name LIKE CONCAT('%',#{name},'%')
+		</if>
+		<if test="shopName != null and shopName != ''">
+			AND s.name LIKE CONCAT('%',#{shopName},'%')
+		</if>
+	</select>
+
+	<select id="findActivityLadder" resultType="com.caimei.modules.hehe.entity.CmHeHeActivityLadder">
+		SELECT
+		  id,
+		  activityId,
+		  productId,
+		  ladderNum,
+		  buyNum,
+		  buyPrice
+		FROM
+		  cm_hehe_activity_ladder
+		WHERE
+		  activityId = #{activityId}
+		  AND productId = #{productId}
+		ORDER BY
+		  ladderNum ASC
+	</select>
+
+	<insert id="insertLadder">
+		INSERT INTO `cm_hehe_activity_ladder` (
+		  `activityId`, `productId`, `ladderNum`,
+		  `buyNum`, `buyPrice`, `createDate`
+		)
+		VALUES
+		  (
+			#{activityId}, #{productId}, #{ladderNum},
+			#{buyNum}, #{buyPrice}, NOW()
+		  )
+	</insert>
+
+	<delete id="deleteLadder">
+		DELETE FROM cm_hehe_activity_ladder WHERE
+		productId =#{productId}
+		<if test="activityId != null">
+			AND activityId = #{activityId}
+		</if>
+	</delete>
+
+	<select id="findActivityByProductId" resultType="integer">
+		SELECT activityId FROM cm_hehe_activity_product WHERE productId = #{productId} AND delFlag = 0
+	</select>
+
+	<delete id="deleteUserActivity">
+		DELETE FROM cm_hehe_user_activity WHERE productId = #{productId}
+	</delete>
+
+	
+</mapper>

+ 108 - 0
src/main/resources/mappings/modules/hehe/CmHeheImageMapper.xml

@@ -0,0 +1,108 @@
+<?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.caimei.modules.hehe.dao.CmHeheImageDao">
+    
+	<sql id="cmHeheImageColumns">
+		a.id AS "id",
+		a.topic AS "topic",
+		a.image AS "image",
+		a.sort AS "sort",
+		a.status AS "status",
+		a.addTime AS "addTime"
+	</sql>
+	
+	<sql id="cmHeheImageJoins">
+	</sql>
+    
+	<select id="get" resultType="CmHeheImage">
+		SELECT 
+			<include refid="cmHeheImageColumns"/>
+		FROM cm_hehe_image a
+		<include refid="cmHeheImageJoins"/>
+		WHERE a.id = #{id}
+	</select>
+	
+	<select id="findList" resultType="CmHeheImage">
+		SELECT 
+			<include refid="cmHeheImageColumns"/>
+		FROM cm_hehe_image a
+		<include refid="cmHeheImageJoins"/>
+		<where>
+			
+			<if test="topic != null and topic != ''">
+				AND a.topic LIKE 
+					<if test="dbName == 'oracle'">'%'||#{topic}||'%'</if>
+					<if test="dbName == 'mssql'">'%'+#{topic}+'%'</if>
+					<if test="dbName == 'mysql'">concat('%',#{topic},'%')</if>
+			</if>
+			<if test="status != null and status != ''">
+				AND a.status = #{status}
+			</if>
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY -sort DESC
+			</otherwise>
+		</choose>
+	</select>
+	
+	<select id="findAllList" resultType="CmHeheImage">
+		SELECT 
+			<include refid="cmHeheImageColumns"/>
+		FROM cm_hehe_image a
+		<include refid="cmHeheImageJoins"/>
+		<where>
+			
+		</where>		
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+			</otherwise>
+		</choose>
+	</select>
+	
+	<insert id="insert" parameterType="CmHeheImage"  keyProperty="id" useGeneratedKeys="true">
+		INSERT INTO cm_hehe_image(
+			topic,
+			image,
+			sort,
+			status,
+			addTime
+		) VALUES (
+			#{topic},
+			#{image},
+			#{sort},
+			#{status},
+			NOW()
+		)
+	</insert>
+	
+	<update id="update">
+		UPDATE cm_hehe_image SET 	
+			topic = #{topic},
+			image = #{image},
+			sort = #{sort},
+			status = #{status},
+			addTime = #{addTime}
+		WHERE id = #{id}
+	</update>
+	
+	<delete id="delete">
+		DELETE FROM cm_hehe_image
+		WHERE id = #{id}
+	</delete>
+
+	<update id="updateStatusById">
+		UPDATE cm_hehe_image SET status = #{status} WHERE id = #{id}
+	</update>
+
+	<update id="saveSort">
+		UPDATE cm_hehe_image SET sort = #{sort} WHERE id = #{id}
+	</update>
+	
+</mapper>

+ 185 - 0
src/main/resources/mappings/modules/hehe/CmHeheProductMapper.xml

@@ -0,0 +1,185 @@
+<?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.caimei.modules.hehe.dao.CmHeheProductDao">
+    
+	<sql id="cmHeheProductColumns">
+		a.id AS "id",
+		a.productId AS "productId",
+		a.sort AS "sort",
+		a.recommend AS "recommend",
+		a.validFlag AS "validFlag",
+		a.price AS "price",
+		a.includedTax AS "includedTax",
+		a.invoiceType AS "invoiceType",
+		a.clubTaxPoint AS "clubTaxPoint",
+		a.shopTaxPoint AS "shopTaxPoint",
+		p.costCheckFlag AS "costType",
+		p.costPrice AS "costPrice",
+		p.costProportional AS "costProportional",
+		a.addTime AS "addTime",
+		p.name AS "name",
+		p.mainImage AS "mainImage",
+		s.name AS "shopName"
+	</sql>
+	
+	<sql id="cmHeheProductJoins">
+		LEFT JOIN product p ON  a.productId = p.productID
+		LEFT JOIN shop s ON s.shopID = p.shopID
+	</sql>
+    
+	<select id="get" resultType="CmHeheProduct">
+		SELECT 
+			<include refid="cmHeheProductColumns"/>
+		FROM cm_hehe_product a
+		<include refid="cmHeheProductJoins"/>
+		WHERE a.id = #{id}
+	</select>
+	
+	<select id="findList" resultType="CmHeheProduct">
+		SELECT 
+			<include refid="cmHeheProductColumns"/>
+		FROM cm_hehe_product a
+		<include refid="cmHeheProductJoins"/>
+		<where>
+			<if test="productId != null and productId != ''">
+				AND a.productId = #{productId}
+			</if>
+			<if test="validFlag != null and validFlag != ''">
+				AND a.validFlag = #{validFlag}
+			</if>
+			<if test="includedTax != null and includedTax != ''">
+				AND a.includedTax = #{includedTax}
+			</if>
+			<if test="invoiceType != null and invoiceType != ''">
+				AND a.invoiceType = #{invoiceType}
+			</if>
+			<if test="id != null and id != ''">
+				AND a.id = #{id}
+			</if>
+			<if test="name != null and name != ''">
+				AND p.name LIKE CONCAT('%',#{name},'%')
+			</if>
+			<if test="shopName != null and shopName != ''">
+				AND s.name LIKE CONCAT('%',#{shopName},'%')
+			</if>
+			<if test="recommend != null and recommend != ''">
+				AND a.recommend = #{recommend}
+			</if>
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY -sort DESC
+			</otherwise>
+		</choose>
+	</select>
+	
+	<select id="findAllList" resultType="CmHeheProduct">
+		SELECT 
+			<include refid="cmHeheProductColumns"/>
+		FROM cm_hehe_product a
+		<include refid="cmHeheProductJoins"/>
+		<where>
+			
+		</where>		
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+			</otherwise>
+		</choose>
+	</select>
+	
+	<insert id="insert" parameterType="CmHeheProduct"  keyProperty="id" useGeneratedKeys="true">
+		INSERT INTO cm_hehe_product(
+			productId,
+			sort,
+			recommend,
+			validFlag,
+			price,
+			includedTax,
+			invoiceType,
+			clubTaxPoint,
+			shopTaxPoint,
+			addTime
+		) VALUES (
+			#{productId},
+			#{sort},
+			#{recommend},
+			#{validFlag},
+			#{price},
+			#{includedTax},
+			#{invoiceType},
+			#{clubTaxPoint},
+			#{shopTaxPoint},
+			NOW()
+		)
+	</insert>
+	
+	<update id="update">
+		UPDATE cm_hehe_product SET 	
+			productId = #{productId},
+			sort = #{sort},
+			recommend = #{recommend},
+			validFlag = #{validFlag},
+			price = #{price},
+			includedTax = #{includedTax},
+			invoiceType = #{invoiceType},
+			clubTaxPoint = #{clubTaxPoint},
+			shopTaxPoint = #{shopTaxPoint}
+		WHERE id = #{id}
+	</update>
+	
+	<delete id="delete">
+		DELETE FROM cm_hehe_product
+		WHERE id = #{id}
+	</delete>
+
+	<select id="findHeHeProductId" resultType="integer">
+		SELECT productId FROM cm_hehe_product
+	</select>
+
+	<select id="findAllProduct" resultType="com.caimei.modules.product.entity.Product">
+		SELECT
+		a.*,s.name AS "shopName"
+		FROM product a
+		LEFT JOIN shop s on s.shopID = a.shopID
+		<where>
+			<if test="productID != null" >
+				AND a.productID = #{productID}
+			</if>
+			<if test="name != null and name != ''">
+				AND a.name LIKE concat('%',#{name},'%')
+			</if>
+			<if test="shopName != null and shopName != ''">
+				AND s.name LIKE concat('%',#{shopName},'%')
+			</if>
+			<if test="ids != null and ids.size() > 0 ">
+				AND a.productID NOT IN
+				<foreach collection="ids" open="(" close=")" item="id" separator=",">
+					#{id}
+				</foreach>
+			</if>
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				order by a.productID
+			</otherwise>
+		</choose>
+	</select>
+
+	<update id="saveSort">
+		UPDATE cm_hehe_product SET sort = #{sort} WHERE id = #{id}
+	</update>
+	
+	<update id="deleteActivityProduct">
+		UPDATE cm_hehe_activity_product SET delFlag = 1 WHERE productId = #{productId}
+	</update>
+	
+</mapper>

+ 229 - 0
src/main/resources/mappings/modules/hehe/CmHeheUserMapper.xml

@@ -0,0 +1,229 @@
+<?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.caimei.modules.hehe.dao.CmHeheUserDao">
+    
+	<sql id="cmHeheUserColumns">
+		a.id AS "id",
+		a.userId AS "userId",
+		a.name AS "name",
+		a.mobile AS "mobile",
+		a.userIdentity AS "userIdentity",
+		a.nickName AS "nickName",
+		a.openId AS "openId",
+		a.addTime AS "addTime"
+	</sql>
+	
+	<sql id="cmHeheUserJoins">
+	</sql>
+	<delete id="deleteUserActivity">
+		delete from cm_hehe_user_activity where userId = #{userId} and productId = #{productId}
+	</delete>
+
+	<select id="get" resultType="CmHeheUser">
+		SELECT 
+			<include refid="cmHeheUserColumns"/>
+		FROM cm_hehe_user a
+		<include refid="cmHeheUserJoins"/>
+		WHERE a.id = #{id}
+	</select>
+	
+	<select id="findList" resultType="CmHeheUser">
+		SELECT 
+			<include refid="cmHeheUserColumns"/>
+		FROM cm_hehe_user a
+		<include refid="cmHeheUserJoins"/>
+		<where>
+			<if test="name != null and name != ''">
+				AND a.name LIKE 
+					<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
+					<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
+					<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
+			</if>
+			<if test="mobile != null and mobile != ''">
+				AND a.mobile = #{mobile}
+			</if>
+			<if test="userIdentity != null and userIdentity != ''">
+				AND a.userIdentity = #{userIdentity}
+			</if>
+			<if test="nickName != null and nickName != ''">
+				AND a.nickName LIKE concat('%',#{nickName},'%')
+			</if>
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY addTime DESC
+			</otherwise>
+		</choose>
+	</select>
+	
+	<select id="findAllList" resultType="CmHeheUser">
+		SELECT 
+			<include refid="cmHeheUserColumns"/>
+		FROM cm_hehe_user a
+		<include refid="cmHeheUserJoins"/>
+		<where>
+			
+		</where>		
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+			</otherwise>
+		</choose>
+	</select>
+	
+	<insert id="insert" parameterType="CmHeheUser"  keyProperty="id" useGeneratedKeys="true">
+		INSERT INTO cm_hehe_user(
+			userId,
+			name,
+			mobile,
+			userIdentity,
+			nickName,
+			openId,
+			addTime
+		) VALUES (
+			#{userId},
+			#{name},
+			#{mobile},
+			#{userIdentity},
+			#{nickName},
+			#{openId},
+			#{addTime}
+		)
+	</insert>
+	
+	<update id="update">
+		UPDATE cm_hehe_user SET 	
+			name = #{name},
+			mobile = #{mobile},
+			userIdentity = #{userIdentity},
+			nickName = #{nickName},
+			openId = #{openId},
+			addTime = #{addTime}
+		WHERE id = #{id}
+	</update>
+
+	<select id="findMobileOnly" resultType="integer">
+		SELECT
+		  id
+		FROM
+		  cm_hehe_user
+		WHERE
+		  mobile = #{mobile}
+		  <if test="id != null and id != ''">
+			  AND id != #{id}
+		  </if>
+	</select>
+
+	<insert id="insertUser" parameterType="com.caimei.modules.user.entity.CmUser" keyColumn="userID" keyProperty="userID" useGeneratedKeys="true">
+		INSERT INTO USER (
+		  bindMobile, userPermission, userIdentity,
+		  userName, password, name, registerTime,
+		  validFlag, registerUserTypeID
+		)
+		VALUES
+		  (
+			#{bindMobile}, #{userPermission}, #{userIdentity},
+			#{userName}, #{password}, #{name}, #{registerTime},
+			#{validFlag}, #{registerUserTypeID}
+		  )
+	</insert>
+
+	<update id="updateUser">
+		UPDATE
+		  user
+		SET
+		  bindMobile = #{bindMobile},
+		  userName = #{userName},
+		  name = #{name}
+		WHERE
+		  userID = #{userID}
+	</update>
+
+	<select id="activityProductList" resultType="com.caimei.modules.hehe.entity.CmHeheActivityProduct">
+		SELECT
+		a.id AS "id",
+		a.userId AS "userId",
+		a.activityId AS "activityId",
+		a.productId AS "productId",
+		a.sort AS "sort",
+		chp.price AS "price",
+		p.name AS "name",
+		p.mainImage AS "mainImage",
+		p.unit AS "unit",
+		s.name AS "shopName"
+		FROM
+		cm_hehe_user_activity a
+		LEFT JOIN cm_hehe_product chp ON chp.productId = a.productID
+		LEFT JOIN product p ON a.productId = p.productID
+		LEFT JOIN shop s ON s.shopID = p.shopID
+		WHERE
+		a.userId = #{userId}
+		<if test="name != null and name != ''">
+			AND p.name LIKE CONCAT('%',#{name},'%')
+		</if>
+		<if test="shopName != null and shopName != ''">
+			AND s.name LIKE CONCAT('%',#{shopName},'%')
+		</if>
+		ORDER BY
+		- a.sort DESC
+	</select>
+
+	<select id="findUserActivityProduct" resultType="integer">
+		SELECT productId FROM cm_hehe_user_activity  WHERE userId = #{userId}
+	</select>
+	
+	<select id="findAllActivityProduct" resultType="com.caimei.modules.hehe.entity.CmHeheProduct">
+		SELECT
+		  a.id AS "id",
+		  a.productId AS "productId",
+		  chp.price AS "price",
+		  p.name AS "name",
+		  p.mainImage AS "mainImage",
+		  s.name AS "shopName"
+		FROM
+		  cm_hehe_activity_product a
+		  LEFT JOIN cm_hehe_product chp ON a.productId = chp.productId
+		  LEFT JOIN product p ON a.productId = p.productID
+		  LEFT JOIN shop s ON s.shopID = p.shopID
+		WHERE
+		  a.delFlag = 0
+		<if test="ids != null and ids.size() > 0 ">
+			AND a.productId NOT IN
+			<foreach collection="ids" open="(" close=")" item="id" separator=",">
+				#{id}
+			</foreach>
+		</if>
+		<if test="productId != null">
+			AND a.productId = #{productId}
+		</if>
+		<if test="name != null and name != ''">
+			AND p.name LIKE CONCAT('%',#{name},'%')
+		</if>
+		<if test="shopName != null and shopName != ''">
+			AND s.name LIKE CONCAT('%',#{shopName},'%')
+		</if>
+		ORDER BY productId DESC
+	</select>
+
+	<insert id="insertUserActivity">
+		INSERT INTO `cm_hehe_user_activity` (
+		  `userId`, `activityId`, `productId`,
+		  addTime
+		)
+		VALUES
+		  (
+			#{userId}, #{activityId}, #{productId},
+			NOW()
+		  )
+	</insert>
+
+	<update id="updateSortById">
+		UPDATE cm_hehe_user_activity SET sort = #{sort} WHERE id =#{id}
+	</update>
+	
+</mapper>

+ 253 - 0
src/main/resources/mappings/modules/hehe/HeHeNewOrderMapper.xml

@@ -0,0 +1,253 @@
+<?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.caimei.modules.hehe.dao.HeHeNewOrderDao">
+    <sql id="columns">
+		a.orderID AS orderID,
+		a.orderNo AS orderNo,
+		a.organizeID AS organizeID,
+		a.userID AS userID,
+		a.buyUserID AS buyUserID,
+		a.shopOrderIDs AS shopOrderIDs,
+		a.orderSubmitType AS orderSubmitType,
+		a.orderType AS orderType,
+		a.secondHandOrderFlag AS secondHandOrderFlag,
+		a.status AS status,
+		a.productTotalFee AS productTotalFee,
+		a.orderTotalFee AS orderTotalFee,
+		a.payTotalFee AS payTotalFee,
+		a.payableAmount AS payableAmount,
+		a.balancePayFee  AS balancePayFee ,
+		a.discountFee AS discountFee,
+		a.spID AS spID,
+		a.mainSpID AS mainSpID,
+		a.note AS note,
+		a.clubID AS clubID,
+		a.clubScanTime AS clubScanTime,
+		a.payWay AS payWay,
+		a.orderSource AS orderSource,
+		a.orderTime AS orderTime,
+		a.confirmTime AS confirmTime,
+		a.productCount AS productCount,
+		a.presentCount AS presentCount,
+		a.cooFreeFlag AS cooFreeFlag,
+		a.cooFreeRate AS cooFreeRate,
+		a.cooFreeAmount AS cooFreeAmount,
+		a.confirmFlag AS confirmFlag,
+		a.clauseID AS clauseID,
+		a.clauseContent AS clauseContent,
+		a.clauseName AS clauseName,
+		a.updateDate AS updateDate,
+		a.freePostFlag AS freePostFlag,
+		a.freight AS freight,
+		a.delFlag AS delFlag,
+		a.onlinePayFlag AS onlinePayFlag,
+		a.payTime AS payTime,
+		a.splitFlag AS splitFlag,
+		(select sum(cop.totalAddedValueTax) from cm_order_product cop where cop.orderID = a.orderID) AS totalAddedValueTax,
+		a.preferential AS preferential,
+		a.closeReason AS closeReason,
+		a.receiptStatus as receiptStatus,
+		a.payStatus	as payStatus,
+		a.sendOutStatus as sendOutStatus,
+		a.refundType as refundType,
+		a.postageOrderFlag AS postageOrderFlag,
+		a.promotionFullReduction AS promotionFullReduction,
+		a.promotionalGiftsCount AS promotionalGiftsCount,
+		a.affirmPaymentFlag AS affirmPaymentFlag,
+		a.rebateFlag AS rebateFlag,
+		a.zeroCostFlag AS zeroCostFlag
+	</sql>
+
+    <select id="get" resultType="newOrder">
+        SELECT <include refid="columns"/>
+        FROM cm_order a
+        WHERE a.orderID = #{id}
+    </select>
+
+    <resultMap id="orderDisplayList" type="com.caimei.modules.order.entity.NewOrder">
+        <id column="orderID" property="orderID"/>
+        <result column="orderNo" property="orderNo"/>
+        <result column="organizeID" property="organizeID"/>
+        <result column="orderType" property="orderType"/>
+        <result column="shopName" property="shopName"/>
+        <result column="receiver" property="receiver"/>
+        <result column="buyer" property="buyer"/>
+        <result column="orderSource" property="orderSource"/>
+        <result column="orderTotalFee" property="orderTotalFee"/>
+        <result column="orderTime" property="orderTime"/>
+        <result column="productCount" property="productCount"/>
+        <result column="alreadyReceipt" property="alreadyReceipt"/>
+        <result column="unReceipt" property="unReceipt"/>
+        <result column="payTotalFee" property="payTotalFee"/>
+        <result column="payWay" property="payWay"/>
+        <result column="status" property="status"/>
+        <collection property="newShopOrders" ofType="com.caimei.modules.order.entity.NewShopOrder"
+                    select="loadShopOrders" column="orderNo" fetchType="eager">
+        </collection>
+    </resultMap>
+
+    <select id="findList" resultMap="orderDisplayList" parameterType="com.caimei.modules.order.entity.NewOrder">
+        SELECT DISTINCT
+        co.orderID AS orderID,
+        co.orderNo AS orderNo,
+        co.organizeID AS organizeID,
+        co.userID AS userID,
+        co.orderType AS orderType,
+        co.secondHandOrderFlag AS secondHandOrderFlag,
+        co.onlinePayFlag AS onlinePayFlag,
+        bou.shouHuoRen AS receiver,
+        IFNULL(c.name,c.nickName) AS buyer,
+        co.orderSource AS orderSource,
+        co.orderTotalFee AS orderTotalFee,
+        co.payableAmount AS payableAmount,
+        co.orderTime AS orderTime,
+        co.confirmTime AS confirmTime,
+        co.payTotalFee AS payTotalFee,
+        co.payWay AS payWay,
+        co.payStatus AS payStatus,
+        co.refundType AS refundType,
+        co.sendOutStatus AS sendOutStatus,
+        co.receiptStatus AS receiptStatus,
+        co.productCount AS productCount,
+        (SELECT IFNULL(sum(cop.shouldPayFee),0) FROM cm_order_product cop WHERE cop.orderId=co.orderID) AS "shouldPayProduct",
+        co.status AS status,
+        co.splitFlag AS splitFlag,
+        co.postageOrderFlag AS postageOrderFlag,
+        (case when co.orderType = '0' then
+        (select case status when 91 then '采美默认协销经理(官方账号)' else linkMan1 end from serviceprovider where serviceProviderID = co.spID)
+        else
+        ''
+        end) AS spName,
+        co.rebateFlag AS rebateFlag
+        FROM cm_order co
+        LEFT JOIN bp_order_userinfo bou ON bou.orderId = co.orderID
+        LEFT JOIN user u ON u.userID = co.userID
+        LEFT JOIN cm_hehe_user c ON u.userID = c.userId
+        LEFT JOIN cm_order_product cop ON co.orderID = cop.orderID
+        LEFT JOIN product p ON cop.productID = p.productID
+        <where>
+            co.orderType = 2
+            <if test="orderID != null and orderID != ''">
+                AND co.orderID = #{orderID}
+            </if>
+            <if test="orderNo != null and orderNo != ''">
+                AND co.orderNo = #{orderNo}
+            </if>
+            <if test="status != null and status != ''">
+                <choose>
+                    <when test="status == '99'.toString()">
+                        AND co.status in (11,12,13,21,22,23,31,32,33)
+                    </when>
+                    <otherwise>
+                        AND co.status = #{status}
+                    </otherwise>
+                </choose>
+            </if>
+            <if test="buyer != null and buyer != ''">
+                AND (c.name LIKE concat('%',#{buyer},'%') or c.nickName LIKE concat('%',#{buyer},'%'))
+            </if>
+            <if test="orderTime != null and orderTime != ''">
+                AND co.orderTime = #{orderTime}
+            </if>
+            <if test="sendOutStatus != null and sendOutStatus != ''">
+                AND co.sendOutStatus = #{sendOutStatus}
+            </if>
+            <if test="startTime != null and startTime != ''">
+                AND co.orderTime <![CDATA[  >=  ]]> #{startTime}
+            </if>
+            <if test="endTime != null and endTime != ''">
+                AND co.orderTime <![CDATA[   <=  ]]> #{endTime}
+            </if>
+            <if test="receiver != null and receiver != ''">
+                AND bou.shouHuoRen LIKE concat('%',#{receiver},'%')
+            </if>
+
+            <if test="receiptStatus != null and receiptStatus != ''">
+                AND co.receiptStatus = #{receiptStatus}
+            </if>
+            <if test="payStatus != null and payStatus != ''">
+                AND co.payStatus = #{payStatus}
+            </if>
+            <if test="sendOutStatus != null and sendOutStatus != ''">
+                AND co.sendOutStatus = #{sendOutStatus}
+            </if>
+            <if test="returnedPurchaseStatus != null and returnedPurchaseStatus != ''">
+                AND
+                <if test="returnedPurchaseStatus == 1">
+                    exists
+                </if>
+                <if test="returnedPurchaseStatus == 0">
+                    not exists
+                </if>
+                (select 1 from cm_returned_purchase c3 where c3.status = '1' and c3.orderID = co.orderID and c3.delFlag = 0)
+            </if>
+            <if test="refundType != null and refundType != ''">
+                AND
+                <if test="refundType == 0">
+                    co.refundType is null
+                </if>
+                <if test="refundType == 1">
+                    co.refundType = '1'
+                </if>
+                <if test="refundType == 2">
+                    co.refundType = '2'
+                </if>
+            </if>
+            <if test="orderRefundType != null and orderRefundType != ''">
+                <if test="orderRefundType == 0">
+                    AND (select count(1) from cm_returned_purchase crp where co.orderID = crp.orderID  and crp.delFlag = 0) = 0
+                </if>
+                <if test="orderRefundType == 1">
+                    AND (select count(1) from cm_returned_purchase crp where co.orderID = crp.orderID  and crp.delFlag = 0) > 0
+                </if>
+                <if test="orderRefundType == 11">
+                    AND (select count(1) from cm_returned_purchase crp where co.orderID = crp.orderID and crp.status = 1  and crp.delFlag = 0) > 0
+                </if>
+                <if test="orderRefundType == 12">
+                    AND (select count(1) from cm_returned_purchase crp where co.orderID = crp.orderID and crp.status = 2 and crp.delFlag = 0
+                    <if test="startRefundTime != null and startRefundTime != ''">
+                        AND crp.confirmReturnTime <![CDATA[  >=  ]]> #{startRefundTime}
+                    </if>
+                    <if test="endRefundTime != null and endRefundTime != ''">
+                        AND crp.confirmReturnTime <![CDATA[   <=  ]]> #{endRefundTime}
+                    </if>
+                    ) > 0
+                </if>
+                <if test="orderRefundType == 13">
+                    AND (select count(1) from cm_returned_purchase crp where co.orderID = crp.orderID and crp.status = 3 and crp.delFlag = 0) > 0
+                </if>
+            </if>
+            AND co.delFlag = 0
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                ORDER BY co.orderID DESC, co.orderTime DESC
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="loadShopOrders" parameterType="string" resultType="NewShopOrder">
+		SELECT
+		cs.shopOrderID AS shopOrderID,
+		cs.shopOrderNo AS shopOrderNo,
+		cs.shopOrderNo AS shopOrderNo,
+		cs.itemCount AS itemCount,
+		cs.needPayAmount AS needPayAmount,
+		s.name AS shopName,
+		cs.status AS status,
+		cs.shopID AS shopID
+		FROM cm_shop_order cs
+		LEFT JOIN shop s ON cs.shopID = s.shopID
+		WHERE cs.orderNo = #{orderNo} AND cs.delFlag = 0
+	</select>
+
+    <select id="findHeUser" resultType="string">
+        SELECT IFNULL(name,nickName) FROM cm_hehe_user WHERE userId = #{heUserId}
+    </select>
+
+</mapper>

+ 6 - 0
src/main/resources/mappings/modules/order/CmReturnedPurchaseMapper.xml

@@ -109,6 +109,12 @@
 			<if test="organizeID != null and organizeID != ''">
 				AND co.organizeID = #{organizeID}
 			</if>
+			<if test="orderType == 2">
+				AND co.orderType = 2
+			</if>
+			<if test="orderType != 2">
+				AND co.orderType != 2
+			</if>
             <if test="id != null and id != ''">
                 AND a.id = #{id}
             </if>

+ 1 - 0
src/main/resources/mappings/modules/order/OrderMapper.xml

@@ -128,6 +128,7 @@
 		LEFT JOIN cm_order_product cop ON co.orderID = cop.orderID
 	    LEFT JOIN product p ON cop.productID = p.productID
         <where>
+			co.orderType != 2
             <if test="orderID != null and orderID != ''">
                 AND co.orderID = #{orderID}
             </if>

+ 1 - 0
src/main/resources/mappings/modules/order/OrderProductMapper.xml

@@ -93,6 +93,7 @@
 		  a.costPrice as newCostPrice,
 		  p.aliasName AS aliasName,
 		  a.singleShouldPayTotalTax AS singleShouldPayTotalTax,
+		  a.heUserId AS heUserId,
 		  p.productCategory as "productCategory"
 	</sql>
 

+ 6 - 1
src/main/webapp/WEB-INF/views/modules/bulkpurchase/applyRefoundForm.jsp

@@ -181,7 +181,12 @@
 <input type="hidden" id="product_index" value="${fn:length(order.orderProduct)}">
 <input type="hidden" id="ctx" value="${ctx}">
 <ul class="nav nav-tabs">
-    <li><a href="${ctx}/order/orderList">订单列表</a></li>
+    <c:if test="${order.orderType eq 2}">
+        <li><a href="${ctx}/hehe/new/order/orderList">订单列表</a></li>
+    </c:if>
+    <c:if test="${order.orderType ne 2}">
+        <li><a href="${ctx}/order/orderList">订单列表</a></li>
+    </c:if>
     <li class="active"><a href="${ctx}/bulkpurchase/cmRefundsProduct/applyRefound.rpc?orderID=${order.orderID}&id=${cmReturnedPurchase.id}">申请退货</a></li>
 </ul>
 <br/>

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderConfirmReturnRecord.jsp

@@ -108,7 +108,7 @@
 <input type="hidden" id="product_index" value="${fn:length(order.orderProduct)}">
 <input type="hidden" id="ctx" value="${ctx}">
 <ul class="nav nav-tabs">
-    <li><a href="${ctx}/order/cmReturnedPurchase/">退款列表</a></li>
+    <li><a href="${ctx}/order/cmReturnedPurchase/list?orderType=${order.orderType}">退款列表</a></li>
     <li class="active"><a
             href="${ctx}/bulkpurchase/cmRefundsProduct/toRecturnRecord.rpc?id=${cmReturnedPurchase.id}&orderID=${cmReturnedPurchase.orderID}">退款详情</a>
     </li>

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderReviewReturnRecord.jsp

@@ -108,7 +108,7 @@
 <input type="hidden" id="product_index" value="${fn:length(order.orderProduct)}">
 <input type="hidden" id="ctx" value="${ctx}">
 <ul class="nav nav-tabs">
-    <li><a href="${ctx}/order/cmReturnedPurchase/">退款列表</a></li>
+    <li><a href="${ctx}/order/cmReturnedPurchase/list?orderType=${order.orderType}">退款列表</a></li>
     <li class="active"><a href="${ctx}/bulkpurchase/cmRefundsProduct/toReviewRecturnRecord.rpc?id=${cmReturnedPurchase.id}&orderID=${cmReturnedPurchase.orderID}">退款审核</a></li>
 </ul>
 <br/>

+ 122 - 0
src/main/webapp/WEB-INF/views/modules/hehe/addActivityProduct.jsp

@@ -0,0 +1,122 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<html>
+<head>
+    <title>选择商品</title>
+    <meta name="decorator" content="default"/>
+    <style type="text/css">
+        .table td i {
+            margin: 0 2px;
+        }
+    </style>
+    <script type="text/javascript">
+        $(document).ready(function () {
+            //弹出框去滚动条
+            top.$('#jbox-content').css("overflow-y", "hidden");
+            show_title(30);
+
+            //			反选
+            $('body').on('click', 'input[name="info"]', function () {
+                var allInputLength = $('input[name="info"]').length - $('input[name="info"]:disabled').length,
+                    allInputCheckedLength = $('input[name="info"]:checked').length,
+                    checkAllEle = $('.check-all');
+//			    判断选中长度和总长度,如果相等就是全选否则取消全选
+                if (allInputLength === allInputCheckedLength) {
+                    checkAllEle.attr('checked', true);
+                } else {
+                    checkAllEle.attr('checked', false);
+                }
+            })
+        });
+
+        function page(n, s) {
+            $("#pageNo").val(n);
+            $("#pageSize").val(s);
+            $("#searchForm").submit();
+            return false;
+        }
+
+        function getCheckedItems() {
+            var items = new Array();
+            var $items = $('.check-item:checked');
+            $items.each(function () {
+                //通过拿到的商品ID组合键获取其它值
+                var productId = $(this).val();
+                items.push(productId);
+            });
+            return items;
+        }
+
+        function allCkbfun(ckb) {
+            var isChecked = ckb.checked;
+            $(".check-item").attr('checked', isChecked);
+        }
+
+        /**
+         * @param obj
+         * jquery控制input只能输入数字
+         */
+        function onlynum(obj) {
+            obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+        }
+
+        /**
+         * @param obj
+         * jquery控制input只能输入数字和两位小数(金额)
+         */
+        function num(obj) {
+            obj.value = obj.value.replace(/[^\d.]/g, ""); //清除"数字"和"."以外的字符
+            obj.value = obj.value.replace(/^\./g, ""); //验证第一个字符是数字
+            obj.value = obj.value.replace(/\.{2,}/g, "."); //只保留第一个, 清除多余的
+            obj.value = obj.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
+            obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); //只能输入两个小数
+        }
+
+    </script>
+</head>
+<body>
+<form:form id="searchForm" modelAttribute="cmHeheProduct" action="${ctx}/hehe/cmHeheActivityProduct/findProductPage" method="post" class="breadcrumb form-search">
+    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+    <div class="ul-form">
+        <label>商品ID:</label>
+        <form:input path="productId" htmlEscape="false" onkeyup="onlynum(this)" maxlength="9" class="input-mini"/>
+        <label>商品名称:</label>
+        <form:input path="name" htmlEscape="false" class="input-medium" maxlength="20"/>
+        <label>供应商名称:</label>
+        <form:input path="shopName" htmlEscape="false" class="input-medium" maxlength="20"/>
+        &nbsp;&nbsp<input id="btnSubmit" class="btn btn-primary" type="submit" value="搜索"/>
+        <div class="clearfix"></div>
+    </div>
+</form:form>
+<sys:message content="${message}"/>
+<table class="table table-striped table-bordered table-condensed table-hover">
+    <tr>
+        <th style="width:20px;"><input class="check-all" type="checkbox" onclick="allCkbfun(this);"/></th>
+        <th>商品ID</th>
+        <th>商品图片</th>
+        <th>商品名称</th>
+        <th>供应商名称</th>
+    </tr>
+    <tbody>
+    <c:if test="${not empty page.list}">
+        <c:forEach items="${page.list}" var="item">
+            <tr id="${item.id}" class="itemtr">
+                <th>
+                        <input class="check-item" type="checkbox" name="info" value='${item.productId}'/>
+                </th>
+                <td>${item.productId}</td>
+                <td><img src="${item.mainImage}" width="50px" height="50px"></td>
+                <td>${item.name}</td>
+                <td>${item.shopName}</td>
+            </tr>
+        </c:forEach>
+    </c:if>
+    </tbody>
+</table>
+<c:if test="${empty  page.list}">
+    <p style="text-align: center;"><font color="#1e90ff">暂无数据……</font></p>
+</c:if>
+<div class="pagination">${page}</div>
+</body>
+</html>

+ 126 - 0
src/main/webapp/WEB-INF/views/modules/hehe/addUserActivityProduct.jsp

@@ -0,0 +1,126 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<html>
+<head>
+    <title>选择商品</title>
+    <meta name="decorator" content="default"/>
+    <style type="text/css">
+        .table td i {
+            margin: 0 2px;
+        }
+    </style>
+    <script type="text/javascript">
+        $(document).ready(function () {
+            //弹出框去滚动条
+            top.$('#jbox-content').css("overflow-y", "hidden");
+            show_title(30);
+
+            //			反选
+            $('body').on('click', 'input[name="info"]', function () {
+                var allInputLength = $('input[name="info"]').length - $('input[name="info"]:disabled').length,
+                    allInputCheckedLength = $('input[name="info"]:checked').length,
+                    checkAllEle = $('.check-all');
+//			    判断选中长度和总长度,如果相等就是全选否则取消全选
+                if (allInputLength === allInputCheckedLength) {
+                    checkAllEle.attr('checked', true);
+                } else {
+                    checkAllEle.attr('checked', false);
+                }
+            })
+        });
+
+        function page(n, s) {
+            $("#pageNo").val(n);
+            $("#pageSize").val(s);
+            $("#searchForm").submit();
+            return false;
+        }
+
+        function getCheckedItems() {
+            var items = new Array();
+            var $items = $('.check-item:checked');
+            $items.each(function () {
+                //通过拿到的商品ID组合键获取其它值
+                var productId = $(this).val();
+                items.push(productId);
+            });
+            return items;
+        }
+
+        function allCkbfun(ckb) {
+            var isChecked = ckb.checked;
+            $(".check-item").attr('checked', isChecked);
+        }
+
+        /**
+         * @param obj
+         * jquery控制input只能输入数字
+         */
+        function onlynum(obj) {
+            obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+        }
+
+        /**
+         * @param obj
+         * jquery控制input只能输入数字和两位小数(金额)
+         */
+        function num(obj) {
+            obj.value = obj.value.replace(/[^\d.]/g, ""); //清除"数字"和"."以外的字符
+            obj.value = obj.value.replace(/^\./g, ""); //验证第一个字符是数字
+            obj.value = obj.value.replace(/\.{2,}/g, "."); //只保留第一个, 清除多余的
+            obj.value = obj.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
+            obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); //只能输入两个小数
+        }
+
+    </script>
+</head>
+<body>
+<form:form id="searchForm" modelAttribute="cmHeheProduct" action="${ctx}/hehe/cmHeheUser/findProductPage" method="post"
+           class="breadcrumb form-search">
+    <input name="userId" type="hidden" value="${userId}"/>
+    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+    <div class="ul-form">
+        <label>商品ID:</label>
+        <form:input path="productId" htmlEscape="false" onkeyup="onlynum(this)" maxlength="9" class="input-mini"/>
+        <label>商品名称:</label>
+        <form:input path="name" htmlEscape="false" class="input-medium" maxlength="20"/>
+        <label>供应商名称:</label>
+        <form:input path="shopName" htmlEscape="false" class="input-medium" maxlength="20"/>
+        &nbsp;&nbsp<input id="btnSubmit" class="btn btn-primary" type="submit" value="搜索"/>
+        <div class="clearfix"></div>
+    </div>
+</form:form>
+<sys:message content="${message}"/>
+<table class="table table-striped table-bordered table-condensed table-hover">
+    <tr>
+        <th style="width:20px;"><input class="check-all" type="checkbox" onclick="allCkbfun(this);"/></th>
+        <th>商品ID</th>
+        <th>商品图片</th>
+        <th>商品名称</th>
+        <th>供应商名称</th>
+        <th>售价</th>
+    </tr>
+    <tbody>
+    <c:if test="${not empty page.list}">
+        <c:forEach items="${page.list}" var="item">
+            <tr id="${item.id}" class="itemtr">
+                <th>
+                    <input class="check-item" type="checkbox" name="info" value='${item.productId}'/>
+                </th>
+                <td>${item.productId}</td>
+                <td><img src="${item.mainImage}" width="50px" height="50px"></td>
+                <td>${item.name}</td>
+                <td>${item.shopName}</td>
+                <td>${item.price}</td>
+            </tr>
+        </c:forEach>
+    </c:if>
+    </tbody>
+</table>
+<c:if test="${empty  page.list}">
+    <p style="text-align: center;"><font color="#1e90ff">暂无数据……</font></p>
+</c:if>
+<div class="pagination">${page}</div>
+</body>
+</html>

+ 227 - 0
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheActivityForm.jsp

@@ -0,0 +1,227 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+	<title>呵呵商城活动管理</title>
+	<meta name="decorator" content="default"/>
+	<style>
+		.iconBox{
+			font-size: 0;
+		}
+		.controls .conList{
+			display: inline-block;
+			margin-right: 15px;
+		}
+		.conList .btn:nth-of-type(1){
+			margin-left: 25px;
+		}
+		.upload-content {
+			margin-top: -70px;
+		}
+		.upload-content .conList .btn:nth-of-type(1) {
+			width: 90px;
+			height: 100px;
+			border: 2px solid #eee;
+			background: #fff;
+			position: relative;
+		}
+		.upload-content .conList .btn:nth-of-type(1)>div {
+			position: absolute;
+			top: 50%;
+			left: 50%;
+			transform: translate(-50%, -50%);
+			color: #666;
+		}
+		.upload-content .conList .btn:nth-of-type(1) span {
+			font-size: 35px;
+		}
+		.upload-content .conList .btn:nth-of-type(1) h5 {
+			color: #666;
+		}
+		.cancel-upload {
+			background: transparent;
+			border: none;
+			box-shadow: none;
+			position: relative;
+			top: -38px;
+			left: -25px;
+			cursor: pointer;
+			z-index: 100;
+		}
+		.upload-content .conList ol li {
+			width: 114px;
+			min-height: 80px;
+			text-align: center;
+			background: #fff;
+			position: relative;
+			top: 120px;
+			margin-left: 2px;
+		}
+		.hide-pic {
+			display: none !important;
+		}
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function() {
+			//$("#name").focus();
+			$("#inputForm").validate({
+				submitHandler: function(form){
+
+					loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function(error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+		});
+	</script>
+</head>
+<body>
+	<ul class="nav nav-tabs">
+		<li><a href="${ctx}/hehe/cmHeheActivity/list">活动列表</a></li>
+		<li class="active"><a href="${ctx}/hehe/cmHeheActivity/form?id=${cmHeheActivity.id}">${not empty cmHeheActivity.id?'编辑':'添加'}活动</a></li>
+	</ul><br/>
+	<form:form id="inputForm" modelAttribute="cmHeheActivity" action="${ctx}/hehe/cmHeheActivity/save" method="post" class="form-horizontal">
+		<form:hidden path="id"/>
+		<sys:message content="${message}"/>
+		<div class="control-group">
+			<label class="control-label"><font color="red">*</font>活动名称:</label>
+			<div class="controls">
+				<form:input path="name" htmlEscape="false" maxlength="30" style="position:relative" placeholder="最多输入30个汉字" class="input-xlarge required"/>
+			</div>
+		</div>
+		<div class="control-group iconBox">
+			<label class="control-label"><font color="red">*</font>小程序列表缩略图:</label>
+			<div class="controls upload-content" id="listImageBox">
+				<div class="conList">
+					<form:hidden id="listImage" path="listImage" htmlEscape="false" maxlength="255" class="input-xlarge required"/>
+					<sys:ckfinder input="listImage" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
+					<br>
+					<label style="margin-left: 150px">建议图片分辨率180px*180px</label>
+				</div>
+			</div>
+		</div>
+		<div class="control-group iconBox">
+			<label class="control-label"><font color="red">*</font>小程序详情主题图:</label>
+			<div class="controls upload-content" id="detailsImageBox">
+				<div class="conList">
+					<form:hidden id="detailsImage" path="detailsImage" htmlEscape="false" maxlength="255" class="input-xlarge required"/>
+					<sys:ckfinder input="detailsImage" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
+					<br>
+					<label style="margin-left: 150px">建议图片分辨率750px*600px</label>
+				</div>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label"><font color="red">*</font>开始时间:</label>
+			<div class="controls">
+				<input name="beginTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate " required
+					value="<fmt:formatDate value="${cmHeheActivity.beginTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label"><font color="red">*</font>结束时间:</label>
+			<div class="controls">
+				<input name="endTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate " required
+					value="<fmt:formatDate value="${cmHeheActivity.endTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label"><font color="red">*</font>小程序状态:</label>
+			<div class="controls">
+				<form:select path="status" class="input-xlarge required">
+					<form:option value="1" label="启用"/>
+					<form:option value="2" label="停用"/>
+				</form:select>
+			</div>
+		</div>
+		<div class="form-actions">
+			<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
+			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+		</div>
+	</form:form>
+
+	<script>
+		$(function () {
+			$('.upload-content .conList .btn:nth-of-type(1)').html('<div><span>+</span><h5>选择图片</h5></div>');
+			$('.upload-content .conList .btn:nth-of-type(2)').after('<img class="cancel-upload" src="/static/images/close-btn1.png">').remove();
+			$('.upload-content .conList').find('.cancel-upload').hide();
+			var observeEle = document.getElementsByClassName('upload-content')[0];
+			var observeEle1 = document.getElementsByClassName('upload-content')[1];
+			var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
+			var MutationObserverConfig = {
+				childList: true,
+				subtree: true,
+				characterData: true
+			};
+			var observer = new MutationObserver(function (mutations) {
+				$.each(mutations, function (index, item) {
+					if (item.type === 'childList') {
+						// 在创建新的 element 时调用
+						var target = $(item.target),
+								thisWrapper = target.closest('.conList'),
+								nextEle = thisWrapper.next();
+						thisWrapper.find('li').css('z-index', 99);
+						thisWrapper.find('.cancel-upload').show();
+						if (nextEle.hasClass('hide-pic')) {
+							nextEle.removeClass('hide-pic');
+						}
+					}
+				})
+			});
+			observer.observe(observeEle, MutationObserverConfig);
+			observer.observe(observeEle1, MutationObserverConfig);
+
+			$('body').on('click', '.cancel-upload', function () {
+				var wrapper = $(this).closest('.conList');
+				wrapper.find('li').css('z-index', '-1');
+				wrapper.find('input').val('');
+				$(this).hide();
+				wrapper.removeClass("hide-pic");
+				wrapper.parent().append(wrapper.clone());
+				wrapper.remove();
+				$(".conList").each(function (i, ele) {
+					if ($(ele).find("input.input-xlarge").val()) {
+						$(ele).next().removeClass("hide-pic")
+					}
+				})
+			});
+			$(window).on("load", function () {
+				setTimeout(function () {
+					$("#listImageBox").find("input.input-xlarge").each(function (i, ele) {
+						if ($(ele).val()) {
+							$(ele).next().find("li").css("z-index", "99");
+							$(ele).parents(".conList").find(".cancel-upload").show();
+							$(ele).parents(".conList").next().removeClass("hide-pic")
+						}
+					})
+					$("#detailsImageBox").find("input.input-xlarge").each(function (i, ele) {
+						if ($(ele).val()) {
+							$(ele).next().find("li").css("z-index", "99");
+							$(ele).parents(".conList").find(".cancel-upload").show();
+							$(ele).parents(".conList").next().removeClass("hide-pic")
+						}
+					})
+				}, 200);
+			});
+		});
+
+		/**
+		 * @param obj
+		 * jquery控制input只能输入数字
+		 */
+		function onlynum(obj) {
+			obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+		}
+	</script>
+</body>
+</html>

+ 128 - 0
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheActivityList.jsp

@@ -0,0 +1,128 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+	<title>呵呵商城活动管理</title>
+	<meta name="decorator" content="default"/>
+	<style type="text/css">
+		.table th{text-align: center;}
+		.table td{text-align: center;}
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function() {
+			
+		});
+		function page(n,s){
+			$("#pageNo").val(n);
+			$("#pageSize").val(s);
+			$("#searchForm").submit();
+        	return false;
+        }
+	</script>
+</head>
+<body>
+	<ul class="nav nav-tabs">
+		<li class="active"><a href="${ctx}/hehe/cmHeheActivity/list">活动列表</a></li>
+	</ul>
+	<form:form id="searchForm" modelAttribute="cmHeheActivity" action="${ctx}/hehe/cmHeheActivity/" method="post" class="breadcrumb form-search">
+		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+		<div class="ul-form">
+			 <label>活动名称:</label>
+				<form:input path="name" htmlEscape="false" maxlength="50" class="input-medium"/>
+			 <label>小程序状态:</label>
+				<form:select path="status" class="input-medium">
+					<form:option value="" label="全部"/>
+					<form:option value="1" label="启用"/>
+					<form:option value="2" label="停用"/>
+				</form:select>
+			<label>活动状态:</label>
+			<form:select path="activityStatus" class="input-medium">
+				<form:option value="" label="全部"/>
+				<form:option value="1" label="未开始"/>
+				<form:option value="2" label="进行中"/>
+				<form:option value="3" label="已结束"/>
+			</form:select>
+			&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+			&nbsp;&nbsp;<input class="btn btn-primary" style="width: 80px" onclick="window.location='${ctx}/hehe/cmHeheActivity/form'" value="添加活动"/>
+			<div class="clearfix"></div>
+		</div>
+	</form:form>
+	<sys:message content="${message}"/>
+	<table id="contentTable" class="table table-striped table-bordered table-condensed">
+		<thead>
+			<tr>
+				<th>活动名称</th>
+				<th>小程序状态</th>
+				<th>活动状态</th>
+				<th>开始时间</th>
+				<th>结束时间</th>
+				<th>创建时间</th>
+				<th>操作</th>
+			</tr>
+		</thead>
+		<tbody>
+		<c:forEach items="${page.list}" var="cmHeheActivity">
+			<tr>
+				<td>
+					${cmHeheActivity.name}
+				</td>
+				<td>
+					<c:if test="${cmHeheActivity.status eq 1 }">
+						<font color="green">已启用</font>
+						<a href="javascript:void(0);" onclick="updateStatus('2','${cmHeheActivity.id}');" >
+							停用
+						</a>
+					</c:if>
+					<c:if test="${cmHeheActivity.status ne 1 }">
+						<font color="red">已停用</font>
+						<a href="javascript:void(0)" onclick="updateStatus('1','${cmHeheActivity.id}');">
+							启用
+						</a>
+					</c:if>
+				</td>
+				<td>${cmHeheActivity.activityStatus eq 1 ? "未开始":cmHeheActivity.activityStatus eq 2 ? "进行中":"已结束"}</td>
+				<td>
+					<fmt:formatDate value="${cmHeheActivity.beginTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
+				</td>
+				<td>
+					<fmt:formatDate value="${cmHeheActivity.endTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
+				</td>
+				<td>
+					<fmt:formatDate value="${cmHeheActivity.addTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
+				</td>
+				<td>
+					<a href="${ctx}/hehe/cmHeheActivityProduct/list?activityId=${cmHeheActivity.id}">商品列表</a>
+    				<a href="${ctx}/hehe/cmHeheActivity/form?id=${cmHeheActivity.id}">编辑</a>
+					<a href="${ctx}/hehe/cmHeheActivity/delete?id=${cmHeheActivity.id}" onclick="return confirmx('确认要删除该呵呵商城活动吗?', this.href)">删除</a>
+				</td>
+			</tr>
+		</c:forEach>
+		</tbody>
+	</table>
+	<div class="pagination">${page}</div>
+
+<script>
+	//状态修改
+	function updateStatus(status,id){
+		var msg='确定启用该活动吗?';
+		if('2'==status){
+			msg='确定停用该活动吗?';
+		}
+		top.$.jBox.confirm(msg,'系统提示',function(v,h,f){
+			if(v=='ok'){
+				$.post("${ctx}/hehe/cmHeheActivity/updateStatus",{'status':status,'id':id}, function(data) {
+					if(true==data.success){
+						$.jBox.tip(data.msg, 'info');
+					} else {
+						$.jBox.tip(data.msg,'error');
+					}
+					$("#searchForm").submit();
+				},"JSON");//这里返回的类型有:json,html,xml,text
+			}
+			return;
+		},{buttonsFocus:1,persistent: true});
+	}
+</script>
+</body>
+</html>

+ 206 - 0
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheActivityProductForm.jsp

@@ -0,0 +1,206 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<html>
+<head>
+    <title>活动商品管理</title>
+    <meta name="decorator" content="default"/>
+    <style>
+        input.short {
+            width: 50px;
+        }
+    </style>
+    <script type="text/javascript">
+        $(document).ready(function () {
+            //$("#name").focus();
+            $("#inputForm").validate({
+                submitHandler: function (form) {
+                    debugger
+                    alertx(111)
+                    if ($('input[name="activityLadderList[0].buyNum"]:visible').length>0){
+                        var buyNum = $('input[name="activityLadderList[0].buyNum"]').val();
+                        var buyPrice = $('input[name="activityLadderList[0].buyPrice"]').val();
+                        if(buyNum<=0 || buyNum == '' || buyPrice<=0 || buyPrice == ''){
+                            alertx("请输入正确的阶梯价格");
+                            return false;
+                        }
+                    }
+                    if ($('input[name="activityLadderList[1].buyNum"]:visible').length>0){
+                        var buyNum1 = $('input[name="activityLadderList[1].buyNum"]').val();
+                        var buyPrice1 = $('input[name="activityLadderList[1].buyPrice"]').val();
+                        if(buyNum1<=0 || buyNum1 == '' || buyPrice1<=0 || buyPrice1 == ''){
+                            alertx("请输入正确的阶梯价格");
+                            return false;
+                        }
+                    }
+                    if ($('input[name="activityLadderList[2].buyNum"]:visible').length>0){
+                        var buyNum2 = $('input[name="activityLadderList[2].buyNum"]').val();
+                        var buyPrice2 = $('input[name="activityLadderList[2].buyPrice"]').val();
+                        if(buyNum2<=0 || buyNum2 == '' || buyPrice2<=0 || buyPrice2 == ''){
+                            alertx("请输入正确的阶梯价格");
+                            return false;
+                        }
+                    }
+                    loading('正在提交,请稍等...');
+                    form.submit();
+                },
+                errorContainer: "#messageBox",
+                errorPlacement: function (error, element) {
+                    $("#messageBox").text("输入有误,请先更正。");
+                    if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
+                        error.appendTo(element.parent().parent());
+                    } else {
+                        error.insertAfter(element);
+                    }
+                }
+            });
+        });
+
+        $(document).ready(function () {
+            //弹出框去滚动条
+            top.$('#jbox-content').css("overflow-y", "hidden");
+            show_title(30);
+        });
+    </script>
+</head>
+<body>
+<form:form id="inputForm" modelAttribute="cmHeheActivityProduct" action="" method="post" class="form-horizontal">
+    <form:hidden path="id"/>
+    <sys:message content="${message}"/>
+    <br>
+    <div class="control-group">
+        <label>商品名称:</label>${cmHeheActivityProduct.name}
+    </div>
+    <div class="control-group">
+        <label>供应商:</label>${cmHeheActivityProduct.shopName}
+    </div>
+    <div class="control-group">
+        <label>机构价:</label>${cmHeheActivityProduct.price}
+    </div>
+    <div class="control-group">
+        <label>活动价:</label>
+        <div id="ladderPrice1">
+            &nbsp;&nbsp;&nbsp;&nbsp;起订量:<form:input path="activityLadderList[0].buyNum" min="1" type="number"
+                                                    maxlength="11" class="short number" onblur="checkBuyNum(this, 0)"/>及以上,
+            <form:input path="activityLadderList[0].buyPrice" type="number" maxlength="11" class="short price"
+                        onblur="checkBuyPrice(this, 0)"/>元/(${cmHeheActivityProduct.unit})
+            <span class="showBtn ${null != cmHeheActivityProduct.activityLadderList[1] && null != cmHeheActivityProduct.activityLadderList[1].buyNum ? "hide" : ""}">
+                                <a class="addBtn" href="javascript:;">添加</a>
+                                <form:hidden path="activityLadderList[0].id"/>
+                            </span>
+        </div>
+        <div id="ladderPrice2" ${null == cmHeheActivityProduct.activityLadderList[1] && null == cmHeheActivityProduct.activityLadderList[1].buyNum ? "class='hide'" : ""}>
+            &nbsp;&nbsp;&nbsp;&nbsp;起订量:<form:input path="activityLadderList[1].buyNum" type="number" maxlength="11"
+                                                    class="short number" onblur="checkBuyNum(this, 1)"/>及以上,
+            <form:input path="activityLadderList[1].buyPrice" type="number" maxlength="11" class="short price"
+                        onblur="checkBuyPrice(this, 1)"/>元/(${cmHeheActivityProduct.unit})
+            <span class="showBtn ${null != cmHeheActivityProduct.activityLadderList[2] && null != cmHeheActivityProduct.activityLadderList[2].buyNum ? "hide" : ""}">
+                                <a class="delBtn" href="javascript:;">删除</a> / <a class="addBtn"
+                                                                                  href="javascript:;">添加</a>
+                                <form:hidden path="activityLadderList[1].id"/>
+                            </span>
+        </div>
+        <div id="ladderPrice3" ${null == cmHeheActivityProduct.activityLadderList[2] && null == cmHeheActivityProduct.activityLadderList[2].buyNum ? "class='hide'" : ""}>
+            &nbsp;&nbsp;&nbsp;&nbsp;起订量:<form:input path="activityLadderList[2].buyNum" type="number" maxlength="11"
+                                                    class="short number" onblur="checkBuyNum(this, 2)"/>及以上,
+            <form:input path="activityLadderList[2].buyPrice" type="number" maxlength="11" class="short price"
+                        onblur="checkBuyPrice(this, 2)"/>元/(${cmHeheActivityProduct.unit})
+            <span class="showBtn"><a class="delBtn" href="javascript:;">删除</a></span>
+            <form:hidden path="activityLadderList[2].id"/>
+        </div>
+    </div>
+</form:form>
+
+<script>
+    // 阶梯价格点击事件
+    $("#ladderPrice1").on("click", ".addBtn", function () {
+        $("#ladderPrice2").removeClass("hide");
+        $("#delFlag2").val("0");
+        $("#ladderPrice1").find(".showBtn").addClass("hide");
+    });
+    $("#ladderPrice2").on("click", ".addBtn", function () {
+        $("#ladderPrice3").removeClass("hide");
+        $("#delFlag3").val("0");
+        $("#ladderPrice2").find(".showBtn").addClass("hide");
+    }).on("click", ".delBtn", function () {
+        $("#ladderPrice2").addClass("hide");
+        $("#ladderPrice1").find(".showBtn").removeClass("hide");
+        $("#delFlag2").val("1");
+    });
+    $("#ladderPrice3").on("click", ".delBtn", function () {
+        $("#ladderPrice3").addClass("hide");
+        $("#ladderPrice2").find(".showBtn").removeClass("hide");
+        $("#delFlag3").val("1");
+    });
+
+    // 检查阶梯数量
+    function checkBuyNum(input, index) {
+        if (index > 0) {
+            var beforeNum = $('input[name="activityLadderList[' + (index - 1) + '].buyNum"]').val() * 1;
+            if (input.value * 1 <= beforeNum) {
+                alertx("请输入大于上一阶起订量的值");
+                $(input).val(input.value * 1 + beforeNum);
+            }
+        } else {
+            var minNum = $('input[name="activityLadderList[0].buyNum"]').val() * 1;
+            $('#minBuyNumber').val(minNum);
+        }
+    }
+
+    // 检查阶梯价格
+    function checkBuyPrice(input, index) {
+        if (index > 0) {
+            var beforePrice = $('input[name="activityLadderList[' + (index - 1) + '].buyPrice"]').val() * 1;
+            if (input.value * 1 > beforePrice) {
+                $(input).val('');
+                alertx("请输入小于前一个价格的值");
+            }
+        } else {
+            var price1 = $('#price1').val();
+            if (input.value * 1 > price1) {
+                $(input).val('');
+                alertx("第一个阶梯价格不能大于机构价");
+            }
+        }
+    }
+
+    function onclickSave() {
+        if ($('input[name="activityLadderList[0].buyNum"]:visible').length>0){
+            var buyNum = $('input[name="activityLadderList[0].buyNum"]').val();
+            var buyPrice = $('input[name="activityLadderList[0].buyPrice"]').val();
+            if(buyNum<=0 || buyNum == '' || buyPrice<=0 || buyPrice == ''){
+                return false;
+            }
+        }
+        if ($('input[name="activityLadderList[1].buyNum"]:visible').length>0){
+            var buyNum1 = $('input[name="activityLadderList[1].buyNum"]').val();
+            var buyPrice1 = $('input[name="activityLadderList[1].buyPrice"]').val();
+            if(buyNum1<=0 || buyNum1 == '' || buyPrice1<=0 || buyPrice1 == ''){
+                return false;
+            }
+        }
+        if ($('input[name="activityLadderList[2].buyNum"]:visible').length>0){
+            var buyNum2 = $('input[name="activityLadderList[2].buyNum"]').val();
+            var buyPrice2 = $('input[name="activityLadderList[2].buyPrice"]').val();
+            if(buyNum2<=0 || buyNum2 == '' || buyPrice2<=0 || buyPrice2 == ''){
+                return false;
+            }
+        }
+        var params = "";
+        var buyNum = $('input[name="activityLadderList[0].buyNum"]').val() * 1;
+        var buyPrice = $('input[name="activityLadderList[0].buyPrice"]').val() * 1;
+        params = buyNum + "," + buyPrice;
+        if (!$("#ladderPrice2").is(":hidden")) {
+            var buyNum1 = $('input[name="activityLadderList[1].buyNum"]').val() * 1;
+            var buyPrice1 = $('input[name="activityLadderList[1].buyPrice"]').val() * 1;
+            params = params + "-" + buyNum1 + "," + buyPrice1;
+        }
+        if (!$("#ladderPrice3").is(":hidden")) {
+            var buyNum2 = $('input[name="activityLadderList[2].buyNum"]').val() * 1;
+            var buyPrice2 = $('input[name="activityLadderList[2].buyPrice"]').val() * 1;
+            params = params + "-" + buyNum2 + "," + buyPrice2;
+        }
+        return params;
+    }
+</script>
+</body>
+</html>

+ 194 - 0
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheActivityProductList.jsp

@@ -0,0 +1,194 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<html>
+<head>
+    <title>活动商品管理</title>
+    <meta name="decorator" content="default"/>
+    <style type="text/css">
+        .table th {
+            text-align: center;
+        }
+
+        .table td {
+            text-align: center;
+        }
+    </style>
+    <script type="text/javascript">
+        $(document).ready(function () {
+
+        });
+
+        function page(n, s) {
+            $("#pageNo").val(n);
+            $("#pageSize").val(s);
+            $("#searchForm").submit();
+            return false;
+        }
+    </script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+    <li><a href="${ctx}/hehe/cmHeheActivity/list">活动列表</a></li>
+    <li class="active"><a href="${ctx}/hehe/cmHeheActivityProduct/list?activityId=${activityProduct.activityId}">活动商品列表</a></li>
+</ul>
+<form:form id="searchForm" modelAttribute="cmHeheActivityProduct" action="${ctx}/hehe/cmHeheActivityProduct/"
+           method="post" class="breadcrumb form-search">
+    <input type="hidden" name="activityId" value="${activityProduct.activityId}"/>
+    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+    <div class="ul-form">
+        <label>商品名称:</label>
+        <form:input path="name" htmlEscape="false" class="input-medium"/>
+        <label>供应商名称:</label>
+        <form:input path="shopName" htmlEscape="false" class="input-medium"/>
+        &nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+        &nbsp;&nbsp;<input class="btn btn-primary" style="width: 80px" onclick="showSelect()" value="添加商品"/>
+        <div class="clearfix"></div>
+    </div>
+</form:form>
+<sys:message content="${message}"/>
+<table id="contentTable" class="table table-striped table-bordered table-condensed">
+    <thead>
+    <tr>
+        <th>图片</th>
+        <th>名称</th>
+        <th>供应商</th>
+        <th>售价</th>
+        <th>活动价</th>
+        <th>操作</th>
+    </tr>
+    </thead>
+    <tbody>
+    <c:forEach items="${page.list}" var="cmHeheActivityProduct">
+        <tr>
+            <td>
+                <img class="mainImage" src="${cmHeheActivityProduct.mainImage}" width="50px" height="50px">
+            </td>
+            <td>
+                    ${cmHeheActivityProduct.name}
+            </td>
+            <td>
+                    ${cmHeheActivityProduct.shopName}
+            </td>
+            <td>
+                    ${cmHeheActivityProduct.price}
+            </td>
+            <td>
+                <c:if test="${cmHeheActivityProduct.activityLadderList.size() eq 1}">
+                    <label>¥${cmHeheActivityProduct.activityLadderList[0].buyPrice}(购买数≥${cmHeheActivityProduct.activityLadderList[0].buyNum})</label><br>
+                </c:if>
+                <c:if test="${cmHeheActivityProduct.activityLadderList.size() eq 2}">
+                    <label>¥${cmHeheActivityProduct.activityLadderList[0].buyPrice}(购买数${cmHeheActivityProduct.activityLadderList[0].buyNum}-${cmHeheActivityProduct.activityLadderList[1].buyNum})</label><br>
+                    <label>¥${cmHeheActivityProduct.activityLadderList[1].buyPrice}(购买数≥${cmHeheActivityProduct.activityLadderList[1].buyNum})</label><br>
+                </c:if>
+                <c:if test="${cmHeheActivityProduct.activityLadderList.size() eq 3}">
+                    <label>¥${cmHeheActivityProduct.activityLadderList[0].buyPrice}(购买数${cmHeheActivityProduct.activityLadderList[0].buyNum}-${cmHeheActivityProduct.activityLadderList[1].buyNum})</label><br>
+                    <label>¥${cmHeheActivityProduct.activityLadderList[1].buyPrice}(购买数${cmHeheActivityProduct.activityLadderList[1].buyNum}-${cmHeheActivityProduct.activityLadderList[2].buyNum})</label><br>
+                    <label>¥${cmHeheActivityProduct.activityLadderList[2].buyPrice}(购买数≥${cmHeheActivityProduct.activityLadderList[2].buyNum})</label><br>
+                </c:if>
+            </td>
+            <td>
+                <a href="javascript:void(0);" onclick="showLadder(${cmHeheActivityProduct.id})">编辑</a>
+                <a href="${ctx}/hehe/cmHeheActivityProduct/delete?id=${cmHeheActivityProduct.id}"
+                   onclick="return confirmx('确认要删除该商品吗?', this.href)">删除</a>
+            </td>
+        </tr>
+    </c:forEach>
+    </tbody>
+</table>
+<div class="pagination">${page}</div>
+
+<script>
+    //选择添加
+    function showSelect() {
+        var url = '';
+        var title = '';
+        url = "${ctx}/hehe/cmHeheActivityProduct/findProductPage";
+        title = "添加商品";
+        top.$.jBox("iframe:" + url, {
+            iframeScrolling: 'yes',
+            width: $(top.document).width() - 600,
+            height: $(top.document).height() - 160,
+            persistent: true,
+            title: title,
+            buttons: {"确定": '1', "关闭": '-1'},
+            submit: function (v, h, f) {
+                //确定
+                var $jboxFrame = top.$('#jbox-iframe');
+                var $mainFrame = top.$('#mainFrame');
+                if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
+                    var items = $jboxFrame[0].contentWindow.getCheckedItems(0);
+                    if (items.length > 0) {
+                        console.log(items);
+                        //添加数据
+                        $.post("${ctx}/hehe/cmHeheActivityProduct/addProducts?activityId=${activityProduct.activityId}&productIds=" + items, function (data) {
+                            if (true == data.success) {
+                                $.jBox.tip(data.info, 'info');
+                                setTimeout(function () {
+                                    window.location.href = "${ctx}/hehe/cmHeheActivityProduct/list?activityId=${activityProduct.activityId}"
+                                }, 1300);
+                            } else {
+                                $.jBox.tip(data.info, 'error');
+                            }
+                        }, "JSON");//这里返回的类型有:json,html,xml,text
+                        return true;
+                    } else {
+                        top.$.jBox.tip("请先勾选商品...");
+                        return false;
+                    }
+                }
+                return true;
+            }
+        });
+    }
+
+    /**
+     * @param obj
+     * jquery控制input只能输入数字
+     */
+    function onlynum(obj) {
+        obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+    }
+
+    function showLadder(id) {
+        var url = '';
+        var title = '';
+        url = "${ctx}/hehe/cmHeheActivityProduct/form?id=" + id;
+        title = "编辑";
+        top.$.jBox("iframe:" + url, {
+            iframeScrolling: 'yes',
+            width: 550,
+            height: 450,
+            persistent: true,
+            title: title,
+            buttons: {"确定": '1', "关闭": '-1'},
+            submit: function (v, h, f) {
+                //确定
+                var $jboxFrame = top.$('#jbox-iframe');
+                var $mainFrame = top.$('#mainFrame');
+                if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
+                    var params = $jboxFrame[0].contentWindow.onclickSave();
+                    console.log(params);
+                    if (params != false) {
+                        $.post("${ctx}/hehe/cmHeheActivityProduct/saveActivityLadder?params=" + params + "&id=" + id, function (data) {
+                            if (true == data.success) {
+                                $.jBox.tip(data.info, 'info');
+                                setTimeout(function () {
+                                    window.location.href = "${ctx}/hehe/cmHeheActivityProduct/list?activityId=${activityProduct.activityId}"
+                                }, 1300);
+                            } else {
+                                $.jBox.tip(data.info, 'error');
+                            }
+                        }, "JSON");//这里返回的类型有:json,html,xml,text
+                    } else {
+                        top.$.jBox.tip("请输入正确的阶梯价格");
+                        return false;
+                    }
+                }
+                return true;
+            }
+        });
+    }
+</script>
+</body>
+</html>

+ 196 - 0
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheImageForm.jsp

@@ -0,0 +1,196 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+	<title>呵呵轮播图管理</title>
+	<meta name="decorator" content="default"/>
+	<style>
+		.iconBox{
+			font-size: 0;
+		}
+		.controls .conList{
+			display: inline-block;
+			margin-right: 15px;
+		}
+		.conList .btn:nth-of-type(1){
+			margin-left: 25px;
+		}
+		.upload-content {
+			margin-top: -70px;
+		}
+		.upload-content .conList .btn:nth-of-type(1) {
+			width: 90px;
+			height: 100px;
+			border: 2px solid #eee;
+			background: #fff;
+			position: relative;
+		}
+		.upload-content .conList .btn:nth-of-type(1)>div {
+			position: absolute;
+			top: 50%;
+			left: 50%;
+			transform: translate(-50%, -50%);
+			color: #666;
+		}
+		.upload-content .conList .btn:nth-of-type(1) span {
+			font-size: 35px;
+		}
+		.upload-content .conList .btn:nth-of-type(1) h5 {
+			color: #666;
+		}
+		.cancel-upload {
+			background: transparent;
+			border: none;
+			box-shadow: none;
+			position: relative;
+			top: -38px;
+			left: -25px;
+			cursor: pointer;
+			z-index: 100;
+		}
+		.upload-content .conList ol li {
+			width: 114px;
+			min-height: 80px;
+			text-align: center;
+			background: #fff;
+			position: relative;
+			top: 120px;
+			margin-left: 2px;
+		}
+		.hide-pic {
+			display: none !important;
+		}
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function() {
+			//$("#name").focus();
+			$("#inputForm").validate({
+				submitHandler: function(form){
+					loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function(error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+		});
+	</script>
+</head>
+<body>
+	<ul class="nav nav-tabs">
+		<li><a href="${ctx}/hehe/cmHeheImage/">轮播图列表</a></li>
+		<li class="active"><a href="${ctx}/hehe/cmHeheImage/form?id=${cmHeheImage.id}">${not empty cmHeheImage.id?'编辑':'添加'}</a></li>
+	</ul><br/>
+	<form:form id="inputForm" modelAttribute="cmHeheImage" action="${ctx}/hehe/cmHeheImage/save" method="post" class="form-horizontal">
+		<form:hidden path="id"/>
+		<sys:message content="${message}"/>		
+		<div class="control-group">
+			<label class="control-label"><font color="red">*</font>主题:</label>
+			<div class="controls">
+				<form:input path="topic" htmlEscape="false" placeholder="最多输入30个汉字" style="position:relative" maxlength="30" class="input-xlarge required"/>
+			</div>
+		</div>
+		<div class="control-group iconBox">
+			<label class="control-label"><font color="red">*</font>图片:</label>
+			<div class="controls upload-content" id="imageBox">
+				<div class="conList">
+					<form:hidden id="image" path="image" htmlEscape="false" maxlength="255" class="input-xlarge required"/>
+					<sys:ckfinder input="image" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
+					<br>
+					<label style="margin-left: 20px">建议图片分辨率750px*366px</label>
+				</div>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label"><font color="red">*</font>排序:</label>
+			<div class="controls">
+				<form:input path="sort" onkeyup="onlynum(this)" htmlEscape="false" class="input-xlarge required"/>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label"><font color="red">*</font>状态:</label>
+			<div class="controls">
+				<form:select path="status" class="input-xlarge required">
+					<form:option value="1" label="启用"/>
+					<form:option value="2" label="停用"/>
+				</form:select>
+			</div>
+		</div>
+		<div class="form-actions">
+			<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
+			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+		</div>
+	</form:form>
+
+<script>
+	$(function () {
+		$('.upload-content .conList .btn:nth-of-type(1)').html('<div><span>+</span><h5>选择图片</h5></div>');
+		$('.upload-content .conList .btn:nth-of-type(2)').after('<img class="cancel-upload" src="/static/images/close-btn1.png">').remove();
+		$('.upload-content .conList').find('.cancel-upload').hide();
+		var observeEle = document.getElementsByClassName('upload-content')[0];
+		var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
+		var MutationObserverConfig = {
+			childList: true,
+			subtree: true,
+			characterData: true
+		};
+		var observer = new MutationObserver(function (mutations) {
+			$.each(mutations, function (index, item) {
+				if (item.type === 'childList') {
+					// 在创建新的 element 时调用
+					var target = $(item.target),
+							thisWrapper = target.closest('.conList'),
+							nextEle = thisWrapper.next();
+					thisWrapper.find('li').css('z-index', 99);
+					thisWrapper.find('.cancel-upload').show();
+					if (nextEle.hasClass('hide-pic')) {
+						nextEle.removeClass('hide-pic');
+					}
+				}
+			})
+		});
+		observer.observe(observeEle, MutationObserverConfig);
+
+		$('body').on('click', '.cancel-upload', function () {
+			var wrapper = $(this).closest('.conList');
+			wrapper.find('li').css('z-index', '-1');
+			wrapper.find('input').val('');
+			$(this).hide();
+			wrapper.removeClass("hide-pic");
+			wrapper.parent().append(wrapper.clone());
+			wrapper.remove();
+			$(".conList").each(function (i, ele) {
+				if ($(ele).find("input.input-xlarge").val()) {
+					$(ele).next().removeClass("hide-pic")
+				}
+			})
+		});
+		$(window).on("load", function () {
+			setTimeout(function () {
+				$("#imageBox").find("input.input-xlarge").each(function (i, ele) {
+					if ($(ele).val()) {
+						$(ele).next().find("li").css("z-index", "99");
+						$(ele).parents(".conList").find(".cancel-upload").show();
+						$(ele).parents(".conList").next().removeClass("hide-pic")
+					}
+				})
+			}, 200);
+		});
+	});
+
+	/**
+	 * @param obj
+	 * jquery控制input只能输入数字
+	 */
+	function onlynum(obj) {
+		obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+	}
+</script>
+</body>
+</html>

+ 151 - 0
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheImageList.jsp

@@ -0,0 +1,151 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+	<title>呵呵轮播图管理</title>
+	<meta name="decorator" content="default"/>
+	<style type="text/css">
+		.table th{text-align: center;}
+		.table td{text-align: center;}
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function() {
+			
+		});
+		function page(n,s){
+			$("#pageNo").val(n);
+			$("#pageSize").val(s);
+			$("#searchForm").submit();
+        	return false;
+        }
+	</script>
+</head>
+<body>
+	<ul class="nav nav-tabs">
+		<li class="active"><a href="${ctx}/hehe/cmHeheImage/">轮播图列表</a></li>
+	</ul>
+	<form:form id="searchForm" modelAttribute="cmHeheImage" action="${ctx}/hehe/cmHeheImage/" method="post" class="breadcrumb form-search">
+		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+		<div class="ul-form">
+			 <label>主题:</label>
+				<form:input path="topic" htmlEscape="false" maxlength="50" class="input-medium"/>
+			 <label>状态:</label>
+				<form:select path="status" class="input-medium">
+					<form:option value="" label="请选择"/>
+					<form:option value="1" label="启用"/>
+					<form:option value="2" label="停用"/>
+				</form:select>
+			&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+			<input class="btn btn-primary" type="button" value="一键排序" onclick="batchSaveSort()" style="margin-left: 15px"/>
+			&nbsp;&nbsp;<input class="btn btn-primary" style="width: 80px" onclick="window.location='${ctx}/hehe/cmHeheImage/form'" value="添加轮播图"/>
+			<div class="clearfix"></div>
+		</div>
+	</form:form>
+	<sys:message content="${message}"/>
+	<table id="contentTable" class="table table-striped table-bordered table-condensed">
+		<thead>
+			<tr>
+				<th>主题</th>
+				<th>图片</th>
+				<th>排序值</th>
+				<th>小程序状态</th>
+				<th>添加时间</th>
+				<th>操作</th>
+			</tr>
+		</thead>
+		<tbody>
+		<c:forEach items="${page.list}" var="cmHeheImage">
+			<tr>
+				<input class="check-item" type="hidden" id="preferredProductSort${cmHeheImage.id}" value='${cmHeheImage.id}-${cmHeheImage.sort}'/>
+				<td>
+					${cmHeheImage.topic}
+				</td>
+				<td>
+					<img src="${cmHeheImage.image}" width="50px" height="50px">
+				</td>
+				<td>
+					<input id="sort" name="sort" style="width:50px;" value="${cmHeheImage.sort}" onkeyup="onlynum(this)" onchange="changeSort(${cmHeheImage.id},this)">
+				</td>
+				<td>
+					<c:if test="${cmHeheImage.status eq 1 }">
+						<font color="green">已启用</font>
+						<a href="javascript:void(0);" onclick="updateStatus('2','${cmHeheImage.id}');" >
+							停用
+						</a>
+					</c:if>
+					<c:if test="${cmHeheImage.status ne 1 }">
+						<font color="red">已停用</font>
+						<a href="javascript:void(0)" onclick="updateStatus('1','${cmHeheImage.id}');">
+							启用
+						</a>
+					</c:if>
+				</td>
+				<td>
+					<fmt:formatDate value="${cmHeheImage.addTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
+				</td>
+				<td>
+    				<a href="${ctx}/hehe/cmHeheImage/form?id=${cmHeheImage.id}">编辑</a>
+					<a href="${ctx}/hehe/cmHeheImage/delete?id=${cmHeheImage.id}" onclick="return confirmx('确定删除该轮播图吗?删除后需要重新添加', this.href)">删除</a>
+				</td>
+			</tr>
+		</c:forEach>
+		</tbody>
+	</table>
+	<div class="pagination">${page}</div>
+<script>
+	//状态修改
+	function updateStatus(status,id){
+		var msg='确定启用该轮播图吗?';
+		if('2'==status){
+			msg='确定停用该轮播图吗?';
+		}
+		top.$.jBox.confirm(msg,'系统提示',function(v,h,f){
+			if(v=='ok'){
+				$.post("${ctx}/hehe/cmHeheImage/updateStatus",{'status':status,'id':id}, function(data) {
+					if(true==data.success){
+						$.jBox.tip(data.msg, 'info');
+					} else {
+						$.jBox.tip(data.msg,'error');
+					}
+					$("#searchForm").submit();
+				},"JSON");//这里返回的类型有:json,html,xml,text
+			}
+			return;
+		},{buttonsFocus:1,persistent: true});
+	}
+
+	//修改排序值
+	function changeSort(id, sortThis) {
+		var value = sortThis.value;
+		$("#preferredProductSort" + id).val(id + "-" + value);
+	}
+
+	//批量保存排序
+	function batchSaveSort() {
+		var items = new Array();
+		var $items = $('.check-item');
+		$items.each(function(){
+			items.push($(this).val());
+		});
+		//保存批量排序
+		$.post("${ctx}/hehe/cmHeheImage/batchSaveSort?sortList="+items, function(data) {
+			if(true==data.success){
+				$.jBox.tip(data.msg, 'info');
+				window.location.href = "${ctx}/hehe/cmHeheImage";
+			} else {
+				$.jBox.tip(data.msg,'error');
+			}
+		},"JSON");//这里返回的类型有:json,html,xml,text
+	}
+
+	/**
+	 * @param obj
+	 * jquery控制input只能输入数字
+	 */
+	function onlynum(obj) {
+		obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+	}
+</script>
+</body>
+</html>

+ 301 - 0
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheProductForm.jsp

@@ -0,0 +1,301 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+	<title>呵呵商品管理</title>
+	<meta name="decorator" content="default"/>
+	<script type="text/javascript">
+		$(document).ready(function() {
+			//$("#name").focus();
+			$("#inputForm").validate({
+				submitHandler: function (form) {
+					var productId = $('#productId').val();
+					if (productId.length == 0) {
+						alertx("请选择商品");
+						return false;
+					}
+					loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function (error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+		});
+	</script>
+</head>
+<body>
+	<ul class="nav nav-tabs">
+		<li><a href="${ctx}/hehe/cmHeheProduct/">商品列表</a></li>
+		<li class="active"><a href="${ctx}/hehe/cmHeheProduct/form?id=${cmHeheProduct.id}">${not empty cmHeheProduct.id?'编辑':'添加'}</a></li>
+	</ul><br/>
+	<form:form id="inputForm" modelAttribute="cmHeheProduct" action="${ctx}/hehe/cmHeheProduct/save" method="post" class="form-horizontal">
+		<form:hidden path="id"/>
+		<form:hidden path="productId" id="productId"/>
+		<sys:message content="${message}"/>
+		<div class="control-group">
+			<label class="control-label"><font color="red">*</font>商品:</label>
+			<div class="controls" id="addProduct">
+				<a href="JavaScript:;" onclick="showSelect()">请选择加入呵呵商城的商品</a>
+			</div>
+			<table id="contentTable" class="table table-striped table-bordered table-condensed" hidden="hidden">
+				<thead>
+					<tr>
+						<th>图片</th>
+						<th>商品名称</th>
+						<th>供应商</th>
+						<th>操作</th>
+					</tr>
+				</thead>
+				<tbody>
+					<tr>
+						<td><img id="mainImage" src="${cmHeheProduct.mainImage}" width="50px" height="50px"></td>
+						<td style="text-align: center" id="name">${cmHeheProduct.name}</td>
+						<td id="shopName">${cmHeheProduct.shopName}</td>
+						<td><a href="javascript:void(0);" onclick="deleteProduct()">删除</a></td>
+					</tr>
+				</tbody>
+			</table>
+		</div>
+		<div id="productInfo" hidden="hidden">
+			<div class="control-group">
+				<label class="control-label"><font color="red">*</font>售价:</label>
+				<div class="controls">
+					<input type="number" style="width:100px;" min="0" id="price" name="price" value="${cmHeheProduct.price}" required onblur="checkPrice(this)">
+				</div>
+			</div>
+			<div class="control-group">
+				<label class="control-label"><font color="red">*</font>是否含税:</label>
+				<div class="controls">
+					<form:radiobutton id="includedTax1" path="includedTax" value="1" label="含税" onclick="chageIncludedTax()"/>&nbsp;&nbsp;&nbsp;&nbsp;
+					<form:radiobutton id="includedTax0" path="includedTax" value="0" label="不含税" onclick="chageIncludedTax()"/>
+				</div>
+				<br>
+				<div class="controls">
+					<form:radiobutton id="invoiceType1" path="invoiceType" value="1" label="增值税专用发票" onclick="showTaxPoint()"/>&nbsp;&nbsp;&nbsp;&nbsp;
+					<form:radiobutton id="invoiceType2" path="invoiceType" value="2" label="增值税普通发票" onclick="showTaxPoint()"/>&nbsp;&nbsp;&nbsp;&nbsp;
+					<span id="invoiceTypeShow"><form:radiobutton id="invoiceType3" path="invoiceType" value="3" label="不能开票" onclick="showTaxPoint()"/></span>
+				</div>
+			</div>
+			<div class="control-group taxPointShow">
+				<label class="control-label"><font color="red">*</font>机构税率:</label>
+				<div class="controls">
+					<input type="number" style="width:100px;" id="clubTaxPoint" name="clubTaxPoint" value="${cmHeheProduct.clubTaxPoint}" required>%
+				</div>
+			</div>
+			<div class="control-group taxPointShow">
+				<label class="control-label"><font color="red">*</font>供应商税率:</label>
+				<div class="controls">
+					<input type="number" style="width:100px;" id="shopTaxPoint" name="shopTaxPoint" value="${cmHeheProduct.shopTaxPoint}" required>%
+				</div>
+			</div>
+			<div class="control-group">
+				<label class="control-label"><font color="red">*</font>成本价类型:</label>
+				<div class="controls" id="costType">
+						${cmHeheProduct.costType eq 1 ? '固定成本' : '比例成本'}
+				</div>
+			</div>
+			<div class="control-group" id="costPriceShow">
+				<label class="control-label"><font color="red">*</font>成本价:</label>
+				<div class="controls" id="costPrice">
+					${cmHeheProduct.costPrice}
+				</div>
+			</div>
+			<div class="control-group" id="costProportionalShow">
+				<label class="control-label"><font color="red">*</font>比例成本百分比:</label>
+				<div class="controls" id="costProportional">
+					${cmHeheProduct.costProportional}%
+				</div>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label"><font color="red">*</font>排序:</label>
+			<div class="controls">
+				<form:input path="sort" htmlEscape="false" class="input-xlarge required" onkeyup="onlynum(this)"/>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label"><font color="red">*</font>推荐状态:</label>
+			<div class="controls">
+				<form:select path="recommend" class="input-small required">
+					<form:option value="" label="请选择"/>
+					<form:option value="0" label="不推荐"/>
+					<form:option value="1" label="推荐"/>
+				</form:select>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label"><font color="red">*</font>商品状态:</label>
+			<div class="controls">
+				<form:select path="validFlag" class="input-small required">
+					<form:option value="" label="请选择"/>
+					<form:option value="1" label="已上架"/>
+					<form:option value="2" label="已下架"/>
+				</form:select>
+			</div>
+		</div>
+		<div class="form-actions">
+			<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
+			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+		</div>
+	</form:form>
+
+<script>
+	$(function () {
+		//初始化商品信息
+		if (${not empty cmHeheProduct.id}){
+			$('#contentTable').show();
+			$('#productInfo').show();
+			$('#addProduct').hide();
+			chageIncludedTax();
+			changeCostPriceShow(${cmHeheProduct.costType});
+			showTaxPoint();
+		}
+	});
+
+
+	//选择添加商品
+	function showSelect() {
+		var url = '';
+		var title = '';
+		url = "${ctx}/hehe/cmHeheProduct/findProductPage";
+		title = "选择商品";
+		top.$.jBox("iframe:" + url, {
+			iframeScrolling: 'yes',
+			width: $(top.document).width() - 600,
+			height: $(top.document).height() - 160,
+			persistent: true,
+			title: title,
+			buttons: {"确定": '1', "关闭": '-1'},
+			submit: function (v, h, f) {
+				//确定
+				var $jboxFrame = top.$('#jbox-iframe');
+				var $mainFrame = top.$('#mainFrame');
+				if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
+					var items = $jboxFrame[0].contentWindow.getCheckedItems(0);
+					if (items.length > 0) {
+						console.log(items);
+						$('#contentTable').show();
+						$('#productInfo').show();
+						$('#addProduct').hide();
+						var productId = items[0].productId;
+						var mainImage = items[0].mainImage;
+						var name = items[0].name;
+						var shopName = items[0].shopName;
+						var price = items[0].price;
+						var includedTax = items[0].includedTax;
+						var invoiceType = items[0].invoiceType;
+						var clubTaxPoint = items[0].clubTaxPoint;
+						var shopTaxPoint = items[0].shopTaxPoint;
+						var costType = items[0].costType;
+						var costPrice = items[0].costPrice;
+						var costProportional = items[0].costProportional;
+						$("#mainImage").attr("src", mainImage);
+						$("#shopName").text(shopName);
+						$("#productId").val(productId);
+						$("#name").text(name);
+						$("#price").val(price);
+						if (includedTax == 1) {
+							$('#includedTax1').attr('checked', true);
+						} else {
+							$('#includedTax0').attr('checked', true);
+						}
+						if (invoiceType == 1) {
+							$('#invoiceType1').attr('checked', true);
+						} else if (invoiceType == 2) {
+							$('#invoiceType2').attr('checked', true);
+						} else {
+							$('#invoiceType3').attr('checked', true);
+						}
+						$("#clubTaxPoint").val(clubTaxPoint);
+						$("#shopTaxPoint").val(shopTaxPoint);
+						if (costType == 1) {
+							$('#costType').text('固定成本');
+						} else {
+							$('#costType').text('比例成本');
+						}
+						$("#costPrice").text(costPrice);
+						$("#costProportional").text(costProportional + '%');
+						chageIncludedTax();
+						changeCostPriceShow(costType);
+						showTaxPoint();
+					} else {
+						top.$.jBox.tip("请先勾选商品...");
+						return false;
+					}
+				}
+				return true;
+			}
+		});
+	}
+
+	//是否含税显示
+	function chageIncludedTax() {
+		var includedTax = $("input[name='includedTax']:checked").val();
+		if (includedTax == 1) {
+			$('#invoiceTypeShow').hide();
+			var invoiceType = $("input[name='invoiceType']:checked").val();
+			if (invoiceType == 3) {
+				$('#invoiceType1').attr('checked', true);
+				showTaxPoint();
+			}
+		} else {
+			$('#invoiceTypeShow').show();
+		}
+	}
+
+	// 是否固定成本
+	function changeCostPriceShow(costType) {
+		if (costType == 1) {
+			$("#costPriceShow").show();
+			$("#costProportionalShow").hide();
+		} else {
+			$("#costPriceShow").hide();
+			$("#costProportionalShow").show();
+		}
+	}
+
+	//税率显示
+	function showTaxPoint() {
+		var invoiceType = $("input[name='invoiceType']:checked").val();
+		if (invoiceType == 3) {
+			$('.taxPointShow').hide();
+		} else {
+			$('.taxPointShow').show();
+		}
+	}
+
+	//删除商品
+	function deleteProduct() {
+		$('#contentTable').hide();
+		$('#productInfo').hide();
+		$('#addProduct').show();
+		$('#productId').val('');
+	}
+
+	/**
+	 * @param obj
+	 * jquery控制input只能输入数字
+	 */
+	function onlynum(obj) {
+		obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+	}
+
+	/**
+	 * @param obj
+	 * jquery检验售价
+	 */
+	function checkPrice(obj) {
+		if (obj.value == '0') {
+			obj.value = '';
+		}
+	}
+</script>
+</body>
+</html>

+ 179 - 0
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheProductList.jsp

@@ -0,0 +1,179 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+	<title>呵呵商品管理</title>
+	<meta name="decorator" content="default"/>
+	<style type="text/css">
+		.table th{text-align: center;}
+		.table td{text-align: center;}
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function() {
+			
+		});
+		function page(n,s){
+			$("#pageNo").val(n);
+			$("#pageSize").val(s);
+			$("#searchForm").submit();
+        	return false;
+        }
+	</script>
+</head>
+<body>
+	<ul class="nav nav-tabs">
+		<li class="active"><a href="${ctx}/hehe/cmHeheProduct/">商品列表</a></li>
+	</ul>
+	<form:form id="searchForm" modelAttribute="cmHeheProduct" action="${ctx}/hehe/cmHeheProduct/" method="post" class="breadcrumb form-search">
+		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+		<div class="ul-form">
+			 <label>商品ID:</label>
+				<form:input path="id" htmlEscape="false" class="input-medium"/>
+			<label>商品名称:</label>
+				<form:input path="name" htmlEscape="false" class="input-medium"/>
+			<label>供应商名称:</label>
+				<form:input path="shopName" htmlEscape="false" class="input-medium"/>
+			 <label>商品状态:</label>
+				<form:select path="validFlag" class="input-small">
+					<form:option value="" label="请选择"/>
+					<form:option value="1" label="已上架"/>
+					<form:option value="2" label="已下架"/>
+				</form:select>
+			 <label>是否含税:</label>
+				<form:select path="includedTax" class="input-small">
+					<form:option value="" label="请选择"/>
+					<form:option value="0" label="不含税"/>
+					<form:option value="1" label="含税"/>
+				</form:select>
+			 <label>发票:</label>
+				<form:select path="invoiceType" class="input-small">
+					<form:option value="" label="请选择"/>
+					<form:option value="1" label="增值税专用发票"/>
+					<form:option value="2" label="增值税普通发票"/>
+					<form:option value="3" label="不能开票"/>
+				</form:select>
+			<br><br>
+			<label>推荐状态:</label>
+			<form:select path="recommend" class="input-small">
+				<form:option value="" label="请选择"/>
+				<form:option value="0" label="不推荐"/>
+				<form:option value="1" label="推荐"/>
+			</form:select>
+			&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+			<input class="btn btn-primary" type="button" value="一键排序" onclick="batchSaveSort()" style="margin-left: 15px"/>
+			&nbsp;&nbsp;<input class="btn btn-primary" style="width: 80px" onclick="window.location='${ctx}/hehe/cmHeheProduct/form'" value="上线商品"/>
+			<div class="clearfix"></div>
+		</div>
+		<div style="margin-top: 10px">
+			<label><font color="#a9a9a9">注:排序值越小越靠前</font></label>
+		</div>
+	</form:form>
+	<sys:message content="${message}"/>
+	<table id="contentTable" class="table table-striped table-bordered table-condensed">
+		<thead>
+			<tr>
+				<th>商品ID</th>
+				<th>商品图片</th>
+				<th>商品名称</th>
+				<th>供应商名称</th>
+				<th>售价</th>
+				<th>成本价</th>
+				<th>是否含税</th>
+				<th>商品状态</th>
+				<th>排序值</th>
+				<th>推荐状态</th>
+				<th>添加时间</th>
+				<th>操作</th>
+			</tr>
+		</thead>
+		<tbody>
+		<c:forEach items="${page.list}" var="cmHeheProduct">
+			<tr>
+				<input class="check-item" type="hidden" id="preferredProductSort${cmHeheProduct.id}" value='${cmHeheProduct.id}-${cmHeheProduct.sort}'/>
+				<td>
+					${cmHeheProduct.id}
+				</td>
+				<td>
+					<img src="${cmHeheProduct.mainImage}" width="50px" height="50px">
+				</td>
+				<td>
+						${cmHeheProduct.name}
+				</td>
+				<td>
+						${cmHeheProduct.shopName}
+				</td>
+				<td>
+						${cmHeheProduct.price}
+				</td>
+				<td>
+						${cmHeheProduct.costPrice}
+				</td>
+				<td>
+					${cmHeheProduct.includedTax eq 0 ? "不含税" : "含税"}-
+					${cmHeheProduct.invoiceType eq 1 ? "增值税专用发票" : cmHeheProduct.invoiceType eq 2 ? "增值税普通发票" : "不能开票"}
+				</td>
+				<td>
+					<c:if test="${cmHeheProduct.validFlag eq 1}">
+						<font color="green"><b>已上架</b></font>
+					</c:if>
+					<c:if test="${cmHeheProduct.validFlag eq 2}">
+						<font color="red"><b>已下架</b></font>
+					</c:if>
+				</td>
+				<td>
+						<input id="sort" name="sort" style="width:50px;" value="${cmHeheProduct.sort}" onkeyup="onlynum(this)" onchange="changeSort(${cmHeheProduct.id},this)">
+				</td>
+				<td>
+					<img src="/static/images/${cmHeheProduct.recommend eq "1" ? "yes" : "no"}.gif" width="15px" border="none"/>
+				</td>
+				<td>
+					<fmt:formatDate value="${cmHeheProduct.addTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
+				</td>
+				<td>
+    				<a href="${ctx}/hehe/cmHeheProduct/form?id=${cmHeheProduct.id}">编辑</a>
+					<a href="${ctx}/hehe/cmHeheProduct/updateValidFlag?id=${cmHeheProduct.id}" onclick="return confirmx('确认要${cmHeheProduct.validFlag eq 1 ? "下架":"上架"}该商品吗?', this.href)">${cmHeheProduct.validFlag eq 1 ? '下架':'上架'}</a>
+					<a href="${ctx}/hehe/cmHeheProduct/updateRecommend?id=${cmHeheProduct.id}" onclick="return confirmx('${cmHeheProduct.recommend eq 0 ? "确定将该商品设为推荐商品吗?":"确定取消推荐吗?"}', this.href)">${cmHeheProduct.recommend eq 0 ? '设为':'取消'}推荐</a>
+					<a href="${ctx}/hehe/cmHeheProduct/delete?id=${cmHeheProduct.id}" onclick="return confirmx('确认要删除该商品吗?', this.href)">删除</a>
+				</td>
+			</tr>
+		</c:forEach>
+		</tbody>
+	</table>
+	<div class="pagination">${page}</div>
+
+<script>
+	//修改排序值
+	function changeSort(id, sortThis) {
+		var value = sortThis.value;
+		$("#preferredProductSort" + id).val(id + "-" + value);
+	}
+
+	//批量保存排序
+	function batchSaveSort() {
+		var items = new Array();
+		var $items = $('.check-item');
+		$items.each(function(){
+			items.push($(this).val());
+		});
+		//保存批量排序
+		$.post("${ctx}/hehe/cmHeheProduct/batchSaveSort?sortList="+items, function(data) {
+			if(true==data.success){
+				$.jBox.tip(data.msg, 'info');
+				window.location.href = "${ctx}/hehe/cmHeheProduct";
+			} else {
+				$.jBox.tip(data.msg,'error');
+			}
+		},"JSON");//这里返回的类型有:json,html,xml,text
+	}
+
+	/**
+	 * @param obj
+	 * jquery控制input只能输入数字
+	 */
+	function onlynum(obj) {
+		obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+	}
+</script>
+</body>
+</html>

+ 80 - 0
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheUserAllList.jsp

@@ -0,0 +1,80 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+    <title>呵呵用户管理</title>
+    <meta name="decorator" content="default"/>
+    <style type="text/css">
+        .table th{text-align: center;}
+        .table td{text-align: center;}
+    </style>
+    <script type="text/javascript">
+        $(document).ready(function() {
+
+        });
+        function page(n,s){
+            $("#pageNo").val(n);
+            $("#pageSize").val(s);
+            $("#searchForm").submit();
+            return false;
+        }
+    </script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+    <li class="active"><a href="${ctx}/hehe/cmHeheUser/userList">用户列表</a></li>
+</ul>
+<form:form id="searchForm" modelAttribute="cmHeheUser" action="${ctx}/hehe/cmHeheUser/userList" method="post" class="breadcrumb form-search">
+    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+    <div class="ul-form">
+        <label>微信昵称:</label>
+        <form:input path="nickName" htmlEscape="false" maxlength="32" class="input-medium"/>
+        <label>手机号:</label>
+        <form:input path="mobile" htmlEscape="false" maxlength="20" class="input-medium"/>
+        <label>身份:</label>
+        <form:select path="userIdentity" class="input-small">
+            <form:option value="" label="请选择"/>
+            <form:option value="1" label="普通用户"/>
+            <form:option value="2" label="分销者"/>
+        </form:select>
+        &nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+        <div class="clearfix"></div>
+    </div>
+</form:form>
+<sys:message content="${message}"/>
+<table id="contentTable" class="table table-striped table-bordered table-condensed">
+    <thead>
+    <tr>
+        <th>微信昵称</th>
+        <th>手机号</th>
+        <th>身份</th>
+        <th>openID</th>
+        <th>注册时间</th>
+    </tr>
+    </thead>
+    <tbody>
+    <c:forEach items="${page.list}" var="cmHeheUser">
+        <tr>
+            <td>
+                    ${cmHeheUser.nickName}
+            </td>
+            <td>
+                    ${cmHeheUser.mobile}
+            </td>
+            <td>
+                    ${cmHeheUser.userIdentity eq 1 ? "普通用户" : "分销者"}
+            </td>
+            <td>
+                    ${cmHeheUser.openId}
+            </td>
+            <td>
+                <fmt:formatDate value="${cmHeheUser.addTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
+            </td>
+        </tr>
+    </c:forEach>
+    </tbody>
+</table>
+<div class="pagination">${page}</div>
+</body>
+</html>

+ 74 - 0
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheUserForm.jsp

@@ -0,0 +1,74 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+	<title>呵呵用户管理</title>
+	<meta name="decorator" content="default"/>
+	<script type="text/javascript">
+		$(document).ready(function() {
+			//$("#name").focus();
+			$("#inputForm").validate({
+				submitHandler: function(form){
+					debugger
+					let val = $("#mobile").val();
+					if (!val.startsWith("1") || val.length != 11) {
+						alertx("请输入正确的手机号");
+					} else {
+						loading('正在提交,请稍等...');
+						form.submit();
+					}
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function(error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+		});
+	</script>
+</head>
+<body>
+	<ul class="nav nav-tabs">
+		<li><a href="${ctx}/hehe/cmHeheUser/">分销者列表</a></li>
+		<li class="active"><a href="${ctx}/hehe/cmHeheUser/form?id=${cmHeheUser.id}">${not empty cmHeheUser.id?'编辑':'添加'}分销者</a></li>
+	</ul><br/>
+	<form:form id="inputForm" modelAttribute="cmHeheUser" action="${ctx}/hehe/cmHeheUser/save" method="post" class="form-horizontal">
+		<form:hidden path="id"/>
+		<sys:message content="${message}"/>		
+		<div class="control-group">
+			<label class="control-label"><font color="red">*</font>姓名:</label>
+			<div class="controls">
+				<form:input path="name" htmlEscape="false" placeholder="最多输入15个汉字" maxlength="15" class="input-xlarge required"/>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label"><font color="red">*</font>手机号:</label>
+			<div class="controls">
+				<form:input path="mobile" htmlEscape="false" maxlength="11" class="input-xlarge required"/>
+			</div>
+		</div>
+		<c:if test="${not empty cmHeheUser.openId}">
+			<div class="control-group">
+				<label class="control-label">微信昵称:</label>
+				<div class="controls">
+					${cmHeheUser.nickName}
+				</div>
+			</div>
+			<div class="control-group">
+				<label class="control-label">openID:</label>
+				<div class="controls">
+						${cmHeheUser.openId}
+				</div>
+			</div>
+		</c:if>
+		<div class="form-actions">
+			<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
+			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+		</div>
+	</form:form>
+</body>
+</html>

+ 80 - 0
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheUserList.jsp

@@ -0,0 +1,80 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+	<title>呵呵用户管理</title>
+	<meta name="decorator" content="default"/>
+	<style type="text/css">
+		.table th{text-align: center;}
+		.table td{text-align: center;}
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function() {
+			
+		});
+		function page(n,s){
+			$("#pageNo").val(n);
+			$("#pageSize").val(s);
+			$("#searchForm").submit();
+        	return false;
+        }
+	</script>
+</head>
+<body>
+	<ul class="nav nav-tabs">
+		<li class="active"><a href="${ctx}/hehe/cmHeheUser/">分销者列表</a></li>
+	</ul>
+	<form:form id="searchForm" modelAttribute="cmHeheUser" action="${ctx}/hehe/cmHeheUser/" method="post" class="breadcrumb form-search">
+		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+		<div class="ul-form">
+			 <label>姓名:</label>
+				<form:input path="name" htmlEscape="false" maxlength="30" class="input-medium"/>
+			 <label>手机号:</label>
+				<form:input path="mobile" htmlEscape="false" maxlength="20" class="input-medium"/>
+			&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+			&nbsp;&nbsp;<input class="btn btn-primary" style="width: 80px" onclick="window.location='${ctx}/hehe/cmHeheUser/form'" value="添加分销者"/>
+			<div class="clearfix"></div>
+		</div>
+	</form:form>
+	<sys:message content="${message}"/>
+	<table id="contentTable" class="table table-striped table-bordered table-condensed">
+		<thead>
+			<tr>
+				<th>姓名</th>
+				<th>手机号</th>
+				<th>微信昵称</th>
+				<th>openID</th>
+				<th>添加时间</th>
+				<th>操作</th>
+			</tr>
+		</thead>
+		<tbody>
+		<c:forEach items="${page.list}" var="cmHeheUser">
+			<tr>
+				<td>
+					${cmHeheUser.name}
+				</td>
+				<td>
+					${cmHeheUser.mobile}
+				</td>
+				<td>
+					${cmHeheUser.nickName}
+				</td>
+				<td>
+					${cmHeheUser.openId}
+				</td>
+				<td>
+					<fmt:formatDate value="${cmHeheUser.addTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
+				</td>
+				<td>
+    				<a href="${ctx}/hehe/cmHeheUser/form?id=${cmHeheUser.id}">编辑</a>
+					<a href="${ctx}/hehe/cmHeheUser/activityProductList?userId=${cmHeheUser.userId}">活动商品</a>
+				</td>
+			</tr>
+		</c:forEach>
+		</tbody>
+	</table>
+	<div class="pagination">${page}</div>
+</body>
+</html>

+ 136 - 0
src/main/webapp/WEB-INF/views/modules/hehe/heheAddProduct.jsp

@@ -0,0 +1,136 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<html>
+<head>
+    <title>选择商品</title>
+    <meta name="decorator" content="default"/>
+    <style type="text/css">
+        .table td i {
+            margin: 0 2px;
+        }
+    </style>
+
+    <script type="text/javascript">
+        $(document).ready(function () {
+            $("#searchForm").validate({
+                submitHandler: function (form) {
+                    var isSubMitFlag = true;
+                    var productID = $("#productID").val();
+                    if (isNaN(productID) || productID.indexOf('0') == 0 ) {
+                        alertx("请输入正确的商品ID");
+                        isSubMitFlag = false;
+                        return false;
+                    }
+                    if (isSubMitFlag) {
+                        form.submit();
+                    }
+                }
+            })
+        });
+    </script>
+</head>
+<body>
+<form:form id="searchForm" modelAttribute="product" action="${ctx}/hehe/cmHeheProduct/findProductPage" method="post"
+           class="breadcrumb form-search">
+    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+    <div class="ul-form">
+        <label>商品ID:</label>
+        <form:input path="productID" id="productID" htmlEscape="false" maxlength="8" class="input-mini" onkeyup="onlynum(this)"/>
+        <label>商品名称:</label>
+        <form:input path="name" htmlEscape="false" class="input-medium" maxlength="20"/>
+        <label>供应商名称:</label>
+        <form:input path="shopName" htmlEscape="false" class="input-medium" maxlength="20"/>
+        &nbsp;&nbsp;  <input id="btnSubmit" class="btn btn-primary" type="submit" value="搜索"/>
+        <div class="clearfix"></div>
+    </div>
+</form:form>
+<sys:message content="${message}"/>
+<table class="table table-striped table-bordered table-condensed table-hover">
+    <tr>
+        <th style="width:20px;"></th>
+        <th>商品ID</th>
+        <th>商品图片</th>
+        <th>商品名称</th>
+        <th>供应商名称</th>
+    </tr>
+    <tbody>
+    <c:if test="${not empty page.list}">
+        <c:forEach items="${page.list}" var="item">
+            <tr id="${item.productID}" class="itemtr">
+                <th>
+                    <input class="check-item" type="radio" name="info" value='${item.productID}'/>
+                </th>
+                <td>${item.productID}</td>
+                <td><img class="mainImage" src="${item.mainImage}" width="50px" height="50px"></td>
+                <td class="name">${item.name}</td>
+                <td id="shopName">${item.shopName}</td>
+                <input type="hidden" value="${item.price1}" id="price">
+                <input type="hidden" value="${item.includedTax}" id="includedTax">
+                <input type="hidden" value="${item.invoiceType}" id="invoiceType">
+                <input type="hidden" value="${item.taxPoint}" id="clubTaxPoint">
+                <input type="hidden" value="${item.supplierTaxPoint}" id="shopTaxPoint">
+                <input type="hidden" value="${item.costCheckFlag}" id="costType">
+                <input type="hidden" value="${item.costPrice}" id="costPrice">
+                <input type="hidden" value="${item.costProportional}" id="costProportional">
+            </tr>
+        </c:forEach>
+    </c:if>
+    </tbody>
+</table>
+<c:if test="${empty  page.list}">
+    <p style="text-align: center;"><font color="#1e90ff">暂无数据……</font></p>
+</c:if>
+<div class="pagination">${page}</div>
+<script type="text/javascript">
+    $(document).ready(function () {
+        //弹出框去滚动条
+        top.$('#jbox-content').css("overflow-y", "hidden");
+        show_title(30);
+    });
+
+    function page(n, s) {
+        $("#pageNo").val(n);
+        $("#pageSize").val(s);
+        $("#searchForm").submit();
+        return false;
+    }
+
+    function getCheckedItems() {
+        var items = new Array();
+        var $items = $('.check-item:checked');
+        $items.each(function () {
+            items.push({
+                productId: $(this).val(),
+                mainImage: $(this).parents(".itemtr").find(".mainImage").attr("src"),
+                name: $(this).parents(".itemtr").find(".name").text(),
+                shopName: $(this).parents(".itemtr").find("#shopName").text(),
+                price: $(this).parents(".itemtr").find("#price").val(),
+                includedTax: $(this).parents(".itemtr").find("#includedTax").val(),
+                invoiceType: $(this).parents(".itemtr").find("#invoiceType").val(),
+                clubTaxPoint: $(this).parents(".itemtr").find("#clubTaxPoint").val(),
+                shopTaxPoint: $(this).parents(".itemtr").find("#shopTaxPoint").val(),
+                costType: $(this).parents(".itemtr").find("#costType").val(),
+                costPrice: $(this).parents(".itemtr").find("#costPrice").val(),
+                costProportional: $(this).parents(".itemtr").find("#costProportional").val()
+            })
+        });
+        return items;
+    }
+
+    function clickAllSelect(ckb) {
+        var isChecked = ckb.checked;
+        $(".check-item").attr('checked', isChecked);
+    }
+
+    /**
+     * @param obj
+     * jquery控制input只能输入数字
+     */
+    function onlynum(obj) {
+        obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+    }
+</script>
+</body>
+</html>
+

+ 825 - 0
src/main/webapp/WEB-INF/views/modules/hehe/heheNewOrderDetail.jsp

@@ -0,0 +1,825 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<html>
+<head>
+    <title>订单列表</title>
+    <meta name="decorator" content="default"/>
+    <%--<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>--%>
+    <style type="text/css">
+        *{margin:0;padding:0}
+        a{list-style:none;text-decoration:none}
+        body{background-color:rgb(255,255,255)}
+        h3{line-height:20px;padding:20px 0 20px 15px;border-bottom:1px solid #CCCCCC}
+        .now-status p{padding:20px}
+        .now-status span{display:inline-block;width:160px;line-height:35px;margin-right:15px;cursor:pointer;border:1px solid #CCCCCC;text-align:center;border-radius:5px}
+        .buyInfo p{padding:15px 5px 0}
+        .buyInfo p label{width:60px;display:inline-block}
+        .buyInfo p span{padding-left:10px}
+        .table th{background-color:#CCCCCC}
+        .table th,.table td{font-weight:normal;border:1px solid #CCCCCC;height:35px;text-align:center}
+        .table td .div-img{box-sizing:border-box}
+        .table td .div-img img{width:100px;height:100px;vertical-align:middle}
+        .table td .div-img span{}
+        .div-order span{width:260px;display:inline-block;margin-right:50px}
+        .text-result p{padding-top:15px}
+        .text-cost p{padding:20px 0}
+        .moeny-cost p{padding:10px 0 0 0;text-align:left}
+        .moeny-cost p label{display:inline-block}
+        .Staging table{width:100%;border-collapse:collapse;margin-top:20px}
+        .Staging table th,.Staging table td{font-weight:normal;border:1px solid #000;height:35px;text-align:center;width:10%}
+        .change-info{position:fixed;top:0%;left:50%;transform:translateX(-50%);z-index:999;width:800px;background-color:#fff;box-shadow:0px 0px 15px #ccc}
+        .item-div label{width:260px;text-align:right;display:inline-block;margin-right:50px}
+        .item-div input{width:300px;line-height:35px;height:35px;box-sizing:border-box;border:1px solid #CCCCCC;display:inline-block}
+        .item-div select{width:90px;height:35px;margin-right:10px}
+        .item-div textarea{border:1px solid #CCCCCC;margin-top:20px;width:300px;height:80px;resize:none;display:block}
+        .layer-status span{display:inline-block;width:80px;line-height:35px;background-color:#00A6C7;text-align:center;color:#fff;cursor:pointer}
+        .layer-status span:nth-of-type(1){}
+        .layer-status span:nth-of-type(2){margin-left:72px}
+        .same-style{position:fixed;top:20%;left:50%;transform:translateX(-50%);width:500px;background-color:#fff;z-index:999;box-shadow:0 0 15px #666}
+        .reason-cancel label{margin-right:20px}
+        .reason-cancel textarea{width:270px;height:80px;resize:none;vertical-align:text-top;border:1px solid #CCCCCC}
+        .order-details-heading{background:#eee}
+        .order-details-heading td{white-space:nowrap;padding:0 10px}
+        .order-rows,.order-details-heading{width:100%;border-bottom:1px solid #ccc;border-left:1px solid #ccc;border-right:1px solid #ccc;color:#666;padding:10px;line-height:30px}
+        .order-details-heading{border-top:1px solid #ccc}
+        .order-details-heading span,.order-rows span{margin-right:80px}
+        .order-details-heading span{width:230px;margin-right:0px;display:inline-block}
+        .order-details-heading span label,.order-rows span label{font-weight:bold}
+        .order-rows .supplier-img{width:100px}
+        .operation-wrapper{position:relative}
+        .operation-btn{cursor:pointer}
+        .operation-block{background:#fff;width:125px;position:absolute;left:35px;top:30px;padding:10px;border:1px solid #666;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;z-index:999;display:none}
+        .operation-block a{display:block;padding:3px 0}
+        .print-wrapper{display:inline-block}
+        .supplier-product-name,.supplier-product-alias{width:200px;line-height:20px}
+        .supplier-product-info{width:50%;display:inline-block;position:relative;top:50%;transform:translateY(30%)}
+        .supplier-product-promotionInfo{width:20%;display:inline-block;position:relative;top:50%;transform:translateY(30%)}
+        .supplier-product-item{margin-bottom:10px}
+        .supplier-product-alias{display:inline-block;margin-top:5px}
+        .supplier-name{display:inline-block;vertical-align:middle;margin:0 10px}
+        #auditBox{padding:20px;line-height:30px}
+        #auditBox p{font-size:16px;margin:0 0 0 0}
+        #auditBox .note-div{font-size:16px}
+        .downSpan{display:block;margin-left:5px;margin-bottom:-8px}
+        .upSpan{display:block;margin-left:5px;margin-top:-8px}
+        .promotionsName{margin:2px}
+        .ladderPrice>span{text-decoration:underline;color:red}
+        .ladderPrice .list{display:none;position:absolute;z-index:999;background:#FFF;white-space:nowrap;border:1px solid #EEE;padding:10px 0;color:#333}
+        .ladderPrice:hover .list{display:block}
+        .ladderPrice .list span{margin:0 20px;width:60px;text-align:center;display:inline-block}
+        .ladderPrice .list span.price{color:red}
+        .weishaIcon {background:darkorange;color:white;margin:0 0px;padding:0 3px;font-style:normal;font-size: 12px; display:inline-block;border-radius:2px}
+    </style>
+    <script type="text/javascript" src="${ctxStatic}/QRCode/jquery.qrcode.min.js"></script>
+    <script type="text/javascript" src="static/common/clipboard.min.js"></script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+    <li><a href="${ctx}/hehe/new/order/orderList">订单列表</a></li>
+    <li class="active"><a href="${ctx}/hehe/new/order/detail?id=${order.orderID}">订单详情</a></li>
+</ul>
+<sys:message content="${message}"/>
+<table class="order-details-heading">
+    <tr>
+        <td>下单时间: ${order.orderTime}</td>
+        <td>订单号(ID): ${order.orderNo}(${order.orderID})</td>
+        <td>返佣订单: ${(order.rebateOrder ne '0' || order.rebateFlag eq '1')?'是':'否'}</td>
+    </tr>
+    <tr>
+        <td>订单类型: <c:if test="${order.orderType == 1}">自主订单</c:if><c:if test="${order.orderType == 0}">协销订单</c:if></td>
+        <td>订单来源: ${fns:getDictLabel(order.orderSource,"bp_orderSource","" )}</td>
+        <td>订单状态:
+            <c:if test="${order.status eq 11 || order.status eq 12 || order.status eq 13 ||order.status eq 21 ||order.status eq 22 ||
+				order.status eq 23 || order.status eq 31 ||order.status eq 32 ||order.status eq 33}">
+                交易中
+            </c:if>
+            <c:if test="${order.status eq 0 || order.status eq 4 || order.status eq 5 || order.status eq 6 || order.status eq 7}">
+                ${fns:getDictLabel(order.status,"order_status","" )}
+                <c:if test="${order.status eq 0}">
+                    <span id="time" style="color: red"></span>
+                </c:if>
+            </c:if>
+        </td>
+    </tr>
+    <tr>
+        <c:if test="${order.status ne 0}">
+            <td>
+                收款状态:
+                <c:if test="${order.receiptStatus == 1}">
+                    <font color="red">待收款</font>
+                </c:if>
+                <c:if test="${order.receiptStatus == 2}">
+                    <font color="#ff8c00">部分收款</font>
+                </c:if>
+                <c:if test="${order.receiptStatus == 3}">
+                    <font color="green">已收款</font>
+                </c:if>
+                <%--抹平明细--%>
+                    <c:if test="${order.confirmType eq 1}">
+                        <c:if test="${order.receiptOrderFlag}">
+                            <font color="red">(一款多单:少收抹平金额未知)</font>
+                        </c:if>
+                        <c:if test="${!order.receiptOrderFlag}">
+                            <font color="red">(少收抹平:
+                                ¥<fmt:formatNumber value="${order.payableAmount - (empty order.orderReceivedAmount ? 0 : order.orderReceivedAmount)}" pattern="#0.00"/>)
+                            </font>
+                        </c:if>
+                    </c:if>
+                    <c:if test="${order.confirmType eq 2}">
+                        <c:if test="${order.receiptOrderFlag}">
+                            <font color="red">(一款多单:多收抹平金额未知)</font>
+                        </c:if>
+                        <c:if test="${!order.receiptOrderFlag}">
+                            <font color="red">(多收抹平:
+                                ¥<fmt:formatNumber value="${(empty order.orderReceivedAmount ? 0 : order.orderReceivedAmount) - order.payableAmount}" pattern="#0.00"/>)
+                            </font>
+                        </c:if>
+                    </c:if>
+                    <c:if test="${order.confirmType eq 3}">
+                        <c:if test="${order.receiptOrderFlag}">
+                             <font color="red">(一款多单:多收退余额)</font>
+                        </c:if>
+                        <c:if test="${!order.receiptOrderFlag}">
+                            <font color="red">(多收退余额&nbsp;&nbsp;${order.associationType eq 2 ? "(自动)" : ""}:
+                                ¥<fmt:formatNumber value="${(empty order.returnBalanceAmount ? 0 : order.returnBalanceAmount)}" pattern="#0.00"/>)
+                            </font>
+                        </c:if>
+                    </c:if>
+                </td>
+            <td>发货状态:
+                <c:if test="${order.sendOutStatus == 1}">
+                    <font color="red">待发货</font>
+                </c:if>
+                <c:if test="${order.sendOutStatus == 2}">
+                    <font color="#ff8c00">部分发货</font>
+                </c:if>
+                <c:if test="${order.sendOutStatus == 3}">
+                    <font color="green">已发货</font>
+                </c:if></td>
+            <td>付款状态:
+                <c:if test="${order.payStatus == 1}">
+                    <font color="red">待付款</font>
+                </c:if>
+                <c:if test="${order.payStatus == 2}">
+                    <font color="#ff8c00">部分付款</font>
+                </c:if>
+                <c:if test="${order.payStatus == 3}">
+                    <font color="green">已付款</font>
+                </c:if></td>
+            </td>
+        </c:if>
+    </tr>
+    <tr>
+        <c:if test="${order.status ne 0}">
+            <td>
+                退款状态:
+                <c:if test="${order.refundType == 0}">
+                    无退款
+                </c:if>
+                <c:if test="${order.refundType == 1}">
+                    部分退款
+                </c:if>
+                <c:if test="${order.refundType == 2}">
+                    已退款
+                </c:if>
+            </td>
+        </c:if>
+        <td>机构:${order.buyer}<c:if test="${order.organizeID == 3}"><em class="weishaIcon">维沙</em></c:if></td>
+        <td>收货人: ${order.bpOrderUserinfo.shouHuoRen}</td>
+    </tr>
+    <tr>
+        <td>手机: ${order.bpOrderUserinfo.mobile}</td>
+        <td>
+            地址: ${fns:appendLast(fns:appendLast1(order.bpOrderUserinfo.province,order.bpOrderUserinfo.city,order.bpOrderUserinfo.town), order.bpOrderUserinfo.address)}</td>
+        <fmt:setLocale value="zh_CN" scope="session"/>
+        <td>订单金额:<fmt:formatNumber value="${order.payTotalFee}" type="currency"/></td>
+    </tr>
+    <tr>
+        <td>
+            应收金额:<fmt:formatNumber value="${order.payableAmount}" type="currency"/>
+            <span style="color: red">
+                <c:if test="${order.balancePayFee gt 0}">
+                    <a href="${ctx}/user/cmUserBalanceRecord/userBalanceRecord?userId=${order.userID}" style="color: red;text-decoration: underline">
+                        (账户余额抵扣: <fmt:formatNumber value="${order.balancePayFee}" type="currency"/>)
+                    </a>
+                </c:if>
+                <c:if test="${order.balancePayFee le 0}">
+                        (账户余额抵扣: <fmt:formatNumber value="${order.balancePayFee}" type="currency"/>)
+                </c:if>
+
+
+            </span>
+        </td>
+        <td>
+            已收金额:
+            <c:if test="${order.receiptStatus eq 1}">
+                ¥0.00
+            </c:if>
+            <c:if test="${order.receiptStatus ne 1}">
+                <fmt:formatNumber value="${receiptAmount}" type="currency"/>
+            </c:if>
+            <c:if test="${order.receiptStatus == 3 && order.confirmType != null && order.confirmType != ''}">
+            </c:if>
+        </td>
+        <td>
+            退款金额(已完成):<fmt:formatNumber value="${returnValue}" type="currency"/>
+            <span style="color: red">
+                    (原<fmt:formatNumber value="${returnedPurchaseFee}" type="currency"/>,折扣取消
+                    <c:if test="${order.discountFee gt returnedPurchaseFee}"><fmt:formatNumber
+                            value="${returnedPurchaseFee}" type="currency"/></c:if>
+                    <c:if test="${order.discountFee le returnedPurchaseFee}"><fmt:formatNumber
+                            value="${order.discountFee}" type="currency"/></c:if>)
+                </span>
+        </td>
+    </tr>
+    <tr>
+        <td>
+            经理折扣:
+            <c:if test="${order.discountFee gt 0}">
+                <c:if test="${order.discountFee gt returnedPurchaseFee}">
+                    <fmt:formatNumber value="${order.discountFee - returnedPurchaseFee}" type="currency"/>
+                </c:if>
+                <c:if test="${order.discountFee le returnedPurchaseFee}">
+                    ¥0.00
+                </c:if>
+                <span style="color: red">
+                        (原<fmt:formatNumber value="${order.discountFee}" type="currency"/>,折扣取消
+                        <c:if test="${order.discountFee gt returnedPurchaseFee}">
+                            <fmt:formatNumber value="${returnedPurchaseFee}" type="currency"/>
+                        </c:if>
+                        <c:if test="${order.discountFee le returnedPurchaseFee}">
+                            <fmt:formatNumber value="${order.discountFee}" type="currency"/>
+                        </c:if>)
+                    </span>
+            </c:if>
+            <c:if test="${order.discountFee le 0}">¥0.00</c:if>
+        </td>
+        <td>运费:
+            <c:if test="${order.freight == 0}">
+                包邮
+            </c:if>
+            <c:if test="${order.freight == -1}">
+                到付
+            </c:if>
+            <c:if test="${order.freight == -2}">
+                仪器到付-产品包邮
+            </c:if>
+            <c:if test="${order.freight != -1 && order.freight != 0 && order.freight != -2}">
+                <fmt:formatNumber value="${order.freight}" type="currency"/>
+            </c:if>
+        </td>
+        <td style="position: relative;"><a class="operation-btn btn">功能</a>
+            <div class="operation-block">
+                <shiro:hasPermission name="order:order:edit">
+                    <%--包含订单充值商品就不显示--%>
+                    <c:if test="${empty order.rechargeGoods}">
+                        <c:if test="${order.status == 11 || order.status == 12 || order.status == 21 || order.status == 22 || order.status == 31 || order.status == 32}">
+                            <a href="${ctx}/order/toDeliveryPage?id=${order.orderID}">发货</a>
+                        </c:if>
+                        <c:if test="${order.receiptStatus == 2 && order.status != 6 && order.status != 7}">
+                            <a href="javascript:void(0);" onclick="collection(${order.orderID})">抹平收款</a>
+                        </c:if>
+                    </c:if>
+                    <c:if test="${(order.organizeID == 0 or order.organizeID > 2) && order.status == 11 && order.payStatus == 1}">
+                        <a href="javascript:void(0);"
+                           onclick="modelShow('${order.orderID}')">编辑经理折扣</a>
+                    </c:if>
+                </shiro:hasPermission>
+                <shiro:hasPermission name="order:order:applyrefound">
+                    <c:if test="${order.status == 12 || order.status == 13 || order.status == 21 || order.status == 22 || order.status == 23 || order.status == 31 || order.status == 32 || order.status == 33 || order.status == 4 || order.status == 5}">
+                        <%--  返佣订单不能申请退款(退货) --%>
+                        <c:if test="${order.rebateOrder == '0'}">
+                            <c:if test="${order.toAudit eq 1}">
+                                <%--如果存在审核收款则不允许申请:1不能申请,其它可以申请--%>
+                                <c:if test="${order.toAudit eq 1}">
+                                    <%--弹窗提示--%>
+                                    <a href="#" onclick="return alertx('订单存在未审核的收款,暂不能退款。请将收款审核通过后再操作退款。')">申请退款</a>
+                                </c:if>
+                            </c:if>
+                            <c:if test="${order.toAudit ne 1}">
+                                <c:if test="${order.applyReturnedPurchaseFlag eq 1}">
+                                    <a href="${ctx}/bulkpurchase/cmRefundsProduct/applyRefound.rpc?orderID=${order.orderID}"
+                                       <c:if test="${order.status == 21 || order.status == 22 || order.status == 23}">onclick="return confirmx('部分收款的订单、申请退款只能申请全部退款!', this.href)"
+                                    </c:if>
+                                    >申请退款</a>
+                                </c:if>
+                                <c:if test="${order.applyReturnedPurchaseFlag ne 1}">
+                                    <font title="存在未处理完的申请,请前往退款列表处理!">申请退款</font>
+                                </c:if>
+                            </c:if>
+                        </c:if>
+                    </c:if>
+                </shiro:hasPermission>
+
+                <shiro:hasPermission name="order:order:edit">
+                    <c:if test="${order.status ne 0}">
+                        <a href="${ctx}/order/printOrder?orderID=${order.orderID}">打印发货单</a>
+                    </c:if>
+                    <a href="${ctx}/order/exportOrder?id=${order.orderID}">订单导出</a>
+                    <a href="${ctx}/order/cmOrderRemark/remarksViewNew.rpc?orderID=${order.orderID}&source=2">订单备注</a>
+                    <%--包含订单充值商品就不显示--%>
+                    <c:if test="${empty order.rechargeGoods}">
+                        <c:if test="${order.status ne 0 && order.status ne 11 && order.status ne 21 && order.status ne 6 && order.status ne 4}">
+                            <a href="${ctx}/order/logisticsDetails?orderID=${order.orderID}">发货记录</a>
+                        </c:if>
+                        <c:if test="${order.status ne 0 && order.status ne 11 && order.status ne 6}">
+                            <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${order.orderID}&from=2">收退款记录
+                            </a>
+                        </c:if>
+                        <c:if test="${order.status ne 0 && order.status ne 11 && order.status ne 6}">
+                            <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRecturnRecordByOrderID.rpc?orderID=${order.orderID}">退款(退货)记录
+                            </a>
+                        </c:if>
+                    </c:if>
+                </shiro:hasPermission>
+            </div>
+        </td>
+    </tr>
+    <c:if test="${order.promotionFullReduction gt 0 || order.promotionalGiftsCount gt 0}">
+        <tr>
+            <c:if test="${order.promotionFullReduction gt 0}">
+                <td>促销满减:¥${order.promotionFullReduction}</td>
+            </c:if>
+            <c:if test="${order.promotionalGiftsCount gt 0}">
+                <td>赠品总数:${order.promotionalGiftsCount}</td>
+            </c:if>
+        </tr>
+    </c:if>
+    <c:if test="${order.discountFee gt 0 and returnedPurchaseFee gt 0}">
+        <tr>
+            <td style="color: red">说明:因退货,经理折扣收回,用于抵扣退款。</td>
+        </tr>
+    </c:if>
+</table>
+<textarea id="copyValue" style="display: none"></textarea>
+<c:forEach items="${order.newShopOrders}" var="shopOrder">
+    <div class="order-rows">
+        <span><label>下单时间:</label>${order.orderTime}</span>
+        <span><label>子订单号(ID):</label>${shopOrder.shopOrderNo}(${shopOrder.shopOrderID})</span>
+        <span><label>子订单金额:</label><fmt:formatNumber value="${shopOrder.needPayAmount}" type="currency"/></span>
+        <c:if test="${shopOrder.postFeeCos eq '0'}">
+            <div class="print-wrapper">
+                <a href="${ctx}/order/printOrder?shopOrderID=${shopOrder.shopOrderID}">打印</a>
+                <a href="${ctx}/order/exportSubOrder?shopOrderID=${shopOrder.shopOrderID}">导出</a>
+                <c:if test="${order.status ne '0'}">
+                    <a onclick="copyText('${shopOrder.shopOrderID}')" style="cursor:pointer;">供应商订单二维码</a>
+                </c:if>
+            </div>
+            <c:if test="${order.status ne 0 && order.status ne 11}">
+                <div class="delivery-wrapper">
+                        <span>发货状态:
+                            <c:if test="${shopOrder.sendOutStatus == 1}">
+                                <font color="red">待发货</font>
+                            </c:if>
+                            <c:if test="${shopOrder.sendOutStatus == 2}">
+                                <font color="#ff8c00">部分发货</font>
+                            </c:if>
+                            <c:if test="${shopOrder.sendOutStatus == 3}">
+                                <font color="green">已发货</font>
+                            </c:if>
+                        </span>
+                    <span>付款状态:<c:if test="${shopOrder.payStatus == 1}">
+                        <font color="red">待付款</font>
+                    </c:if>
+                                        <c:if test="${shopOrder.payStatus == 2}">
+                                            <font color="#ff8c00">部分付款</font>
+                                        </c:if>
+                                        <c:if test="${shopOrder.payStatus == 3}">
+                                            <font color="green">已付款</font>
+                                        </c:if></span>
+                    <c:if test="${shopOrder.payStatus == 3 or shopOrder.payStatus == 2}">
+                                <span>已付金额: <fmt:formatNumber value="${shopOrder.payed}" type="currency"/>
+                                </span>
+                    </c:if>
+                </div>
+            </c:if>
+            <c:if test="${not empty shopOrder.note}">
+                <div><label>留言:</label>${shopOrder.note}</div>
+            </c:if>
+        </c:if>
+    </div>
+
+    <div class="order-rows">
+        <span><label>供应商:</label>${shopOrder.shopName}</span>
+        <c:if test="${shopOrder.shopPromotion ne null && shopOrder.shopPromotion.type eq 3}">
+            <c:if test="${shopOrder.shopPromotion.mode eq 2}">
+                <span><label style="background-color: #F60;color: white">${shopOrder.shopPromotion.name}</label> 满<fmt:formatNumber value="${shopOrder.shopPromotion.touchPrice}" pattern="#,##0.00" maxFractionDigits="2"/>,减<fmt:formatNumber value="${shopOrder.shopPromotion.reducedPrice}" pattern="#,##0.00" maxFractionDigits="2"/></span>
+            </c:if>
+            <c:if test="${shopOrder.shopPromotion.mode eq 3}">
+                <span><label style="background-color: purple;color: white">${shopOrder.shopPromotion.name}</label> 满<fmt:formatNumber value="${shopOrder.shopPromotion.touchPrice}" pattern="#,##0.00" maxFractionDigits="2"/>,赠送商品</span>
+            </c:if>
+        </c:if>
+        <div>
+            <c:forEach items="${shopOrder.newOrderProducts}" var="op">
+                <div class="supplier-product-item">
+                    <%--二手订单详情--%>
+                    <c:if test="${order.secondHandOrderFlag eq 1}">
+                        <a href="${fns:getConfig('wwwServer')}product-${op.productID}.html" target="_blank">
+                        <img class="supplier-img" src="${op.image}"/>
+                        </a>
+                    </c:if>
+                    <%--正常订单详情--%>
+                    <c:if test="${order.secondHandOrderFlag ne 1}">
+                        <a href="${fns:getConfig('wwwServer')}product-${op.productID}.html" target="_blank">
+                         <img class="supplier-img" src="${op.image}"/>
+                        </a>
+                    </c:if>
+                    <div class="supplier-name">
+                        <c:if test="${op.name eq op.aliasName}">
+                            <div class="supplier-product-name">${op.name}</div>
+                        </c:if>
+                        <c:if test="${op.name ne op.aliasName}">
+                            <div class="supplier-product-name">${op.name}</div>
+                            <div class="supplier-product-alias">${op.aliasName}</div>
+                        </c:if>
+                        <c:if test="${op.productType eq 1}">
+                            <div class="supplier-product-name"><label style="color: red">协商赠品</label></div>
+                        </c:if>
+                        <c:if test="${op.productType eq 2}">
+                            <div class="supplier-product-name"><label style="color: red">促销赠品</label></div>
+                        </c:if>
+                        <c:if test="${op.includedTax eq 1}">
+                            <div class="supplier-product-name"><label style="color: red">(含税)</label></div>
+                        </c:if>
+                        <c:if test="${op.includedTax ne '' and op.includedTax eq 0}">
+                            <c:if test="${op.invoiceType eq 3}">
+                                <div class="supplier-product-name"><label style="color: red">(不含税-不能开票)</label></div>
+                            </c:if>
+                            <c:if test="${op.invoiceType eq 2 or op.invoiceType eq 1}">
+                                <div class="supplier-product-name"><label style="color: red">(不含税-能开票)</label></div>
+                            </c:if>
+                        </c:if>
+                    </div>
+                    <c:if test="${op.productID ne 999}">
+                        <div class="supplier-product-info">
+                            <span>单价:
+                                <c:if test="${op.productPromotion.mode eq 1}">
+                                    <label style="text-decoration: line-through"><fmt:formatNumber value="${op.price}" type="currency"/></label></span>
+                                </c:if>
+                                <c:if test="${op.productPromotion.mode ne 1}">
+                                    <fmt:formatNumber value="${op.price}" type="currency"/>
+                                </c:if>
+                                <c:if test="${op.ladderPriceFlag eq 1 || op.isActProduct eq 2}">
+                                    <a href="javascript:;" class="ladderPrice"><span> (阶梯价格)</span>
+                                        <c:if test="${not empty op.orderProductLadderPriceList}">
+                                            <div class="list">
+                                                <p><span>起订量</span><span>价格</span></p>
+                                                <c:forEach items="${op.orderProductLadderPriceList}" var="ladderPrice">
+                                                    <p data-num="${ladderPrice.buyNum}"><span>${ladderPrice.buyNumRangeShow}</span><span class="price">${ladderPrice.buyPrice}</span></p>
+                                                </c:forEach>
+                                            </div>
+                                        </c:if>
+                                    </a>
+                                </c:if>
+                            </span>
+                            <span>折扣: ${op.discount}%</span>
+                            <span>折后单价:
+                                <c:if test="${op.productPromotion.mode eq 1}">
+                                    <label style="text-decoration: line-through"><fmt:formatNumber value="${op.discountPrice}" type="currency"/></label></span>
+                                </c:if>
+                                <c:if test="${op.productPromotion.mode ne 1}">
+                                    <fmt:formatNumber value="${op.discountPrice}" type="currency"/></span>
+                                </c:if>
+                            <span>数量:  x${op.num}</span>
+                            <br>
+                            <span>税率:  ${(op.includedTax != '' and op.includedTax eq 0 and op.invoiceType eq 3)?'---': op.taxRate ne null?op.taxRate:0.0}%</span>
+                            <span>税费:  ${(op.includedTax eq 1 or (op.includedTax != '' and op.includedTax eq 0 and op.invoiceType eq 3))?'---': empty op.totalAddedValueTax ?0.00:(op.totalAddedValueTax)}</span>
+                            <span>总额:  <fmt:formatNumber value="${op.totalFee}" type="currency"/></span>
+                            <c:if test="${order.sendOutStatus == 2 || order.sendOutStatus == 3}">
+                                <span>已发/已收  ${(op.num == null ? 0 : op.num)+ (op.presentNum == null ? 0 : op.presentNum)- (op.notOutStore == null ? 0 : op.notOutStore)}/${op.receivedNum}</span>
+                            </c:if>
+                            <c:if test="${fns:hasReturn(order.status)}">
+                                <span>退款(退货)中/已完成  ${op.returningNum}/${op.returnedNum}</span>
+                            </c:if>
+                            <c:if test="${op.heUserId > 0}">
+                                <span><font color="red">分销者:  ${op.heUserName}</font></span>
+                            </c:if>
+                        </div>
+                        <c:if test="${op.productPromotion ne null}">
+                            <c:if test="${op.productPromotion.type eq 2}">
+                                <div class="supplier-product-promotionInfo">
+                                    <table>
+                                        <tr >
+                                            <td rowspan="2">
+                                                <c:if test="${op.productPromotion.mode eq 2}">
+                                                    <label style="background-color: #F60;color: white"><label class="promotionsName">${op.productPromotion.name}</label></label>
+                                                </c:if>
+                                                <c:if test="${op.productPromotion.mode eq 3}">
+                                                    <label style="background-color: purple;color: white"><label class="promotionsName">${op.productPromotion.name}</label></label>
+                                                </c:if>
+                                            </td>
+                                            <td>
+                                                <span class="downSpan">${op.productPromotion.description}</span>
+                                                <c:if test="${op.productPromotion.mode eq 2}">
+                                                    <span class="upSpan"> 满<fmt:formatNumber value="${op.productPromotion.touchPrice}" pattern="#,##0.00" maxFractionDigits="2"/>,减<fmt:formatNumber value="${op.productPromotion.reducedPrice}" pattern="#,##0.00" maxFractionDigits="2"/></span>
+                                                </c:if>
+                                                <c:if test="${op.productPromotion.mode eq 3}">
+                                                    <span class="upSpan"> 满<fmt:formatNumber value="${op.productPromotion.touchPrice}" pattern="#,##0.00" maxFractionDigits="2"/>,赠送商品</span>
+                                                </c:if>
+                                            </td>
+                                        </tr>
+                                    </table>
+                                </div>
+                            </c:if>
+                            <c:if test="${op.productPromotion.type eq 1}">
+                                <div class="supplier-product-promotionInfo">
+                                    <table>
+                                        <tr>
+                                            <c:if test="${op.productPromotion.mode eq 1}">
+                                                <td><label style="background-color: green;color: white"><label class="promotionsName">${op.productPromotion.name}</label></label></td>
+                                                <td> 优惠价: <label style="color: red"><fmt:formatNumber value="${op.productPromotion.touchPrice}" pattern="#,##0.00" maxFractionDigits="2"/></label></td>
+                                            </c:if>
+                                            <c:if test="${op.productPromotion.mode eq 2}">
+                                                <td><label style="background-color: #F60;color: white"><label class="promotionsName">${op.productPromotion.name}</label></label></td>
+                                                <td> 满<fmt:formatNumber value="${op.productPromotion.touchPrice}" pattern="#,##0.00" maxFractionDigits="2"/>,减<fmt:formatNumber value="${op.productPromotion.reducedPrice}" pattern="#,##0.00" maxFractionDigits="2"/></td>
+                                            </c:if>
+                                            <c:if test="${op.productPromotion.mode eq 3}">
+                                                <td><label style="background-color: purple;color: white"><label class="promotionsName">${op.productPromotion.name}</label></label></td>
+                                                <td> 满<fmt:formatNumber value="${op.productPromotion.touchPrice}" pattern="#,##0.00" maxFractionDigits="2"/>,赠送商品</td>
+                                            </c:if>
+                                        </tr>
+                                    </table>
+                                </div>
+                            </c:if>
+                        </c:if>
+                    </c:if>
+                    <c:if test="${op.productID eq 999}">
+                        <span>数量:  x${op.num}</span>
+                    </c:if>
+                    <br>
+                </div>
+            </c:forEach>
+        </div>
+    </div>
+
+</c:forEach>
+<script type="text/javascript">
+    (function () {
+        $('body').click(function (e) {
+            var target = $(e.target),
+                $block = $('.operation-block');
+            if (target.is('.operation-btn')) {
+                if ($block.css('display') === 'none') {
+                    $block.show();
+                } else {
+                    $block.hide();
+                }
+            }
+            if (!target.is('.operation-block') && !target.is('.operation-btn')) {
+                $block.hide();
+            }
+        });
+
+        $('.clauseId').each(function () {
+            var self = $(this);
+            if (!self.prop("checked")) {
+                self.parent().hide();
+            } else {
+                self.hide();
+            }
+        });
+
+        $('#invoice1, #invoice2, #invoice3').each(function () {
+            var self = $(this);
+            if (!self.prop("checked")) {
+                self.next().remove();
+                self.remove();
+            } else {
+                self.remove();
+            }
+        })
+    })();
+
+    function openClauseInfo(index) {
+        var content = $("#clauseContent" + index).val();
+        if (content == '') {
+            return false;
+        }
+        $.jBox(content, {
+            title: $("#clauseName" + index).val(),
+            width: $(top.document).width() - 440,
+            height: $(top.document).height() - 240,
+            buttons: {'关闭': true}
+        });
+    }
+
+    //编辑经理折扣
+    function modelShow(orderID) {
+        top.$.jBox("iframe:${ctx}/order/DiscountFee?orderID=" + orderID, {
+            iframeScrolling: 'yes',
+            top: 150,
+            width: 480,
+            height: 250,
+            persistent: true,
+            title: "编辑经理折扣",
+            buttons: {"确认": '1', "取消": '-1'},
+            submit: function (v, h, f) {
+                //确定
+                var $jboxFrame = top.$('#jbox-iframe');
+                var $mainFrame = top.$('#mainFrame');
+                if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
+                    var rechargeInfo = $jboxFrame[0].contentWindow.submit();
+                    var split = rechargeInfo.split(",");
+                    var payTotalFee = split[0];
+                    var discountFee = split[1];
+                    //取值,然后调用后台接口传入参数,最后刷新页面
+                    if (payTotalFee <= 0) {
+                        return false;
+                    }
+                    $.post("${ctx}/order/saveDiscountFee", {
+                        'discountFee': discountFee,
+                        'orderID': orderID,
+                        'payTotalFee': payTotalFee
+                    }, function (data) {
+                        if (true == data.success) {
+                            refresh(data.msg);
+                        } else {
+                            alertx(data.msg, 1000);
+                        }
+                    }, "JSON");//这里返回的类型有:json,html,xml,text
+                }
+                return true;
+            }, closed: function () {/* 窗口关闭后执行的函数 */
+            }
+        });
+    }
+
+    //订单商品备注
+    function remarks(orderID, shopOrderID) {
+        top.$.jBox("iframe:${ctx}/order/cmOrderRemark/remarksView?orderID=" + orderID + "&shopOrderID=" + shopOrderID, {
+            iframeScrolling: 'yes',
+            top: 150,
+            width: 400,
+            height: 480,
+            persistent: true,
+            title: "订单备注信息",
+            buttons: {"确认": '1', "关闭": '-1'},
+            submit: function (v, h, f) {
+                //确定
+                var $jboxFrame = top.$('#jbox-iframe');
+                var $mainFrame = top.$('#mainFrame');
+                if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
+                    var remarks = $jboxFrame[0].contentWindow.submit();
+                    if ('' == remarks) {
+                        alertx("备注信息不能为空!!!")
+                        return false;
+                    }
+                    saveRemarks(remarks, orderID, shopOrderID);
+                    return true;
+                }
+                return true;
+            },
+            loaded: function (h) {   //隐藏滚动条
+                $(".jbox-content", top.document).css("overflow-y", "hidden");
+            }
+        });
+    }
+
+    function saveRemarks(remarks, orderID, shopOrderID) {
+        $.post("${ctx}/order/cmOrderRemark/addRemarks", {
+            "remarks": remarks, "orderID": orderID, "shopOrderID": shopOrderID
+        }, function (data) {
+            if (true == data.success) {
+                refresh(data.msg);
+            } else {
+                $.jBox.tip(data.msg, 'error');
+            }
+        }, "JSON");//这里返回的类型有:json,html,xml,text
+    }
+
+    // 二维码分享
+    function QRCodewin(orderId, orderNo) {
+        var html = '<div style="padding:10px;">订单号:' + orderNo + '' +
+            '<div class="code" style="text-align: center;"></div>' +
+            '</div>';
+        $.jBox(html, {
+            title: "订单二维码分享",
+            width: $(top.document).width() - 1700,
+            height: $(top.document).height() - 1600,
+            buttons: {'关闭': true}
+        });
+
+        var enCodeRedirectUrl;
+        var redirectUrl = '${fns:getConfig('caimei.crm.server')}oauth.action?orderId=' + orderId;
+        $.ajax({
+            url: "${ctx}/bulkpurchase/contractOrder/enCode",
+            data: {"redirectUrl": redirectUrl},
+            type: "POST",
+            async: false,
+            success: function (data) {
+                enCodeRedirectUrl = data.enCodeRedirectUrl;
+            }
+        });
+        var shareUrl = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=${fns:getConfig('weixin.appId')}&redirect_uri=' + enCodeRedirectUrl + '&response_type=code&scope=snsapi_base&state=bulkpurchase#wechat_redirect';
+        $('.code').qrcode({
+            width: 150,
+            height: 150,
+            text: shareUrl
+        });
+    }
+
+    //刷新页面
+    function refresh(msg) {
+        $.jBox.tip(msg, 'info', {timeout: 1000});
+        setTimeout(function () {
+            window.location.href = "${ctx}/order/detail?id=${order.orderID}"
+        },1000)
+    }
+</script>
+<script>
+    if ("${time}" != "") {
+        window.onload = clock;
+
+        function clock() {
+            var today = new Date(),//当前时间
+                h = today.getHours(),
+                m = today.getMinutes(),
+                s = today.getSeconds();
+            var stopTime = new Date("${time}"),//结束时间
+                stopH = stopTime.getHours(),
+                stopM = stopTime.getMinutes(),
+                stopS = stopTime.getSeconds();
+            var shenyu = stopTime.getTime() - today.getTime(),//倒计时毫秒数
+                shengyuD = parseInt(shenyu / (60 * 60 * 24 * 1000)),//转换为天
+                D = parseInt(shenyu) - parseInt(shengyuD * 60 * 60 * 24 * 1000),//除去天的毫秒数
+                shengyuH = parseInt(D / (60 * 60 * 1000)),//除去天的毫秒数转换成小时
+                H = D - shengyuH * 60 * 60 * 1000,//除去天、小时的毫秒数
+                shengyuM = parseInt(H / (60 * 1000)),//除去天的毫秒数转换成分钟
+                M = H - shengyuM * 60 * 1000;//除去天、小时、分的毫秒数
+            S = parseInt((shenyu - shengyuD * 60 * 60 * 24 * 1000 - shengyuH * 60 * 60 * 1000 - shengyuM * 60 * 1000) / 1000)//除去天、小时、分的毫秒数转化为秒
+            document.getElementById("time").innerHTML = ("(剩余" + shengyuD + "天" + shengyuH + "小时" + shengyuM + "分" + S + "秒)" + "<br>");
+            setTimeout(clock, 500);
+        }
+    }
+
+    function copyText(shopOrderID) {
+        $.post("${ctx}/order/shopOrderLink", {'shopOrderId': shopOrderID}, function (data) {
+            if (data.success) {
+                var imageSrc = "data:image/jpeg|png|gif;base64," + data.imageBuffer;
+                top.$.jBox.info('<img  width="150px" height="150px" style="margin-left: 65px;" src=' + imageSrc + '>', '小程序扫码发货');
+            } else {
+                alertx(data.msg);
+            }
+        });
+
+
+    }
+
+    $(document).ready(function () {
+        if ($(".operation-block").length > 0) {
+            var length = $(".operation-block").length;
+            for (var i = 0; i < length; i++) {
+                var b = $(".operation-block").get(i);
+                if ($(b).html().trim() == '') {
+                    $(b).hide();
+                    $(b).prev().hide();
+                }
+            }
+        }
+        if ($('.supplier-product-name').html() == $('.supplier-product-alias').html()) {
+            $('.supplier-product-alias').remove();
+        }
+    })
+
+    //抹平收款
+    function collection(orderId) {
+        $.post("${ctx}/order/gatheringData", {
+            'orderId': orderId
+        }, function (data) {
+            if (true == data.success) {
+                var html = "<div id='auditBox'>" +
+                    "<P>确定抹平收款吗?抹平后该订单将变为已收款状态</p>" +
+                    "<P><span>订单金额:<b>¥" + Number(data.payTotalFee).toFixed(2) + "</b></span></p>" +
+                    "<P><span>应收金额:<b>¥" + Number(data.payableAmount).toFixed(2) + "</b><span style='color:#FF0000'>(账户余额抵扣: ¥<b>" + Number(data.balancePayFee).toFixed(2) + "</b>)</span></span></p>" +
+                    "<P><span>已收金额:<b>¥" + Number(data.associateAmount).toFixed(2) + "</b></span></p>" +
+                    "<div><div class='note-div'><span style='color:#FF0000'>*</span>备注</div></div>" +
+                    "<textarea name='auditNote' style='width: 100%;min-height:60px;'></textarea>" +
+                    "<div class='note-div' style='display: none' id='noteError'><span style='color:#FF0000'>请填写备注</span> </div>" +
+                    "</div>";
+                $.jBox(html, {
+                    title: "确认提示", width: 500, height: 400, buttons: {"确定": '1', "取消": '-1'},
+                    submit: function (v, h, f) {
+                        if ('1' == v) {
+                            var content = document.getElementsByName("auditNote")[0].value;
+                            if (content == '' || content == null) {
+                                document.getElementById('noteError').style.display = 'block';
+                                return false;
+                            }
+                            $.post("${ctx}/order/smoothOutCollection", {
+                                'orderID': orderId,
+                                'balanceAccountsRemark': content
+                            });
+                            window.location.href = "${ctx}/order/detail?id="+orderId;
+                        }
+                    }
+                });
+
+            } else {
+                $.jBox.tip(data.msg, 'error');
+            }
+        }, "JSON");//这里返回的类型有:json,html,xml,text
+    };
+</script>
+</body>
+</html>

+ 974 - 0
src/main/webapp/WEB-INF/views/modules/hehe/heheNewOrderList.jsp

@@ -0,0 +1,974 @@
+<%@ page import="java.util.Date" %>
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<html>
+<head>
+    <title>订单管理</title>
+    <meta name="decorator" content="default"/>
+    <style type="text/css">
+        .table th {
+            text-align: center;
+        }
+
+        .table td {
+            text-align: center;
+        }
+
+        .data-title {
+            width: 100%;
+            display: table;
+        }
+
+        .data-title ul li {
+            word-break: break-all;
+            display: table-cell;
+            width: 100px;
+            border: 1px solid #000;
+            text-align: center;
+            height: 35px;
+            vertical-align: middle;
+            border-right: 0;
+            border-bottom: 0
+        }
+
+        .data-title ul {
+            margin-bottom: 0 !important;
+            display: table-row;
+        }
+
+        .data-title ul li:last-of-type {
+            width: 120px;
+            border-right: 1px solid #000000;
+        }
+
+        .data-title ul:last-of-type li {
+            border-bottom: 1px solid #000000
+        }
+
+        .data-title ul li:nth-child(6) {
+            width: 80px
+        }
+
+        .spileOrder li:nth-of-type(1) {
+            position: relative
+        }
+
+        .san {
+            width: 10px;
+            height: 10px;
+            border-top: 2px solid #000;
+            border-right: 2px solid #000;
+            transform: rotate(45deg);
+            position: absolute;
+            right: -2px;
+            top: 50%;
+            margin-top: -5px;
+            cursor: pointer
+        }
+
+        .red-waring {
+            margin: 0 !important;
+            background-color: #f3f3f3 !important;
+        }
+
+        .red-waring li {
+            border-color: red !important;
+        }
+
+        #biao1 {
+            position: absolute;
+            left: -9999px;
+            top: -9999px;
+            z-index: -99;
+            width: 1px;
+            height: 1px;
+        }
+
+        .operation-btn {
+            cursor: pointer;
+        }
+
+        .operation-block {
+            background: #fff;
+            position: absolute;
+            right: 2px;
+            padding: 10px;
+            border: 1px solid #666;
+            -webkit-border-radius: 5px;
+            -moz-border-radius: 5px;
+            border-radius: 5px;
+            z-index: 999;
+            display: none;
+        }
+
+        .operation-block a {
+            display: block;
+            padding: 3px 0;
+        }
+
+        .refund-selector {
+            width: 150px;
+            height: 26px;
+            line-height: 26px;
+            text-indent: 10px;
+            background: #fff;
+            display: inline-block;
+            -webkit-border-radius: 3px;
+            -moz-border-radius: 3px;
+            border-radius: 3px;
+            border: 1px solid #ccc;
+            vertical-align: middle;
+            position: relative;
+            cursor: pointer;
+        }
+
+        .refund-selector ul {
+            z-index: 999;
+        }
+
+        .refund-selector li {
+            width: 100%;
+            text-indent: 10px;
+        }
+
+        .refund-selector li:hover {
+            background: #3875d7;
+            color: #fff;
+        }
+
+        .refund-arrow {
+            display: inline-block;
+            width: 18px;
+            height: 100%;
+            position: absolute;
+            right: 0;
+            top: 0;
+            border-left: 1px solid #aaa;
+            border-radius: 0 4px 4px 0;
+            background-clip: padding-box;
+            background: #eee;
+            background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #ccc), color-stop(0.6, #eee));
+            background-image: -webkit-linear-gradient(center bottom, #ccc 0, #eee 60%);
+            background-image: -moz-linear-gradient(center bottom, #ccc 0, #eee 60%);
+            filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#cccccc', GradientType=0);
+            background-image: linear-gradient(top, #ccc 0, #eee 60%);
+        }
+
+        .refund-arrow b {
+            display: block;
+            width: 100%;
+            height: 100%;
+            background: url('/static/jquery-select2/3.4/select2.png') no-repeat 0 1px;
+        }
+
+        .refund-block1, .refund-block2 {
+            width: 100%;
+            position: absolute;
+            background: #fff;
+            -webkit-border-radius: 3px;
+            -moz-border-radius: 3px;
+            border-radius: 3px;
+            border: 1px solid #ccc;
+            margin: 0;
+            color: #666;
+            display: none;
+        }
+
+        .refund-more {
+            position: relative;
+        }
+
+        .refund-block1 {
+            top: 26px;
+        }
+
+        .refund-block2 {
+            left: 100%;
+            top: 0;
+        }
+
+        .refund-selector .refund-more:hover .refund-block2 {
+            display: block;
+        }
+
+        #searchForm {
+            line-height: 40px;
+        }
+
+        #searchForm .ul-form {
+            overflow: visible;
+        }
+
+        #searchForm {
+            white-space: nowrap;
+        }
+
+        #searchForm label {
+            margin-top: 15px;
+        }
+
+        .ul-form {
+            white-space: nowrap;
+            margin-left: -10px !important;
+        }
+
+        .ul-form label {
+            width: 90px;
+            text-align: right;
+        }
+
+        .time-space-symbols {
+            width: 100px;
+            display: inline-block;
+            text-align: center;
+        }
+
+        #btnSubmit {
+            width: 128px;
+            margin-left: 152px;
+        }
+
+        .select-ele {
+            width: 177px;
+        }
+
+        #auditBox {
+            padding: 20px;
+            line-height: 30px
+        }
+
+        #auditBox p {
+            font-size: 16px;
+            margin: 0 0 0 0;
+        }
+
+        #auditBox .note-div {
+            font-size: 16px;
+        }
+
+        .weishaIcon {
+            background: darkorange;
+            color: white;
+            margin: 0 0px;
+            padding: 0 3px;
+            font-style: normal;
+            font-size: 12px;
+            display: inline-block;
+            border-radius: 2px
+        }
+    </style>
+    <script type="text/javascript" src="${ctxStatic}/QRCode/jquery.qrcode.min.js"></script>
+    <script type="text/javascript" src="static/common/clipboard.min.js"></script>
+    <script type="text/javascript">
+        function copyUrl2() {
+            var Url2 = document.getElementById("biao1");
+            Url2.select(); // 选择对象
+            document.execCommand("Copy"); // 执行浏览器复制命令
+//            alert("已复制好,可贴粘。");
+        }
+
+        $(document).ready(function () {
+            var lab = '';
+            var val = '';
+            var startRefundTime = $('#startRefundTime');
+            var endRefundTime = $('#endRefundTime');
+            startRefundTime.attr('disabled', 'disabled');
+            endRefundTime.attr('disabled', 'disabled');
+            startRefundTime.val('');
+            endRefundTime.val('');
+            switch ('${orderRefundType}') {
+                case '':
+                    lab = '全部';
+                    val = '';
+                    break;
+                case '0':
+                    lab = '无';
+                    val = '0';
+                    break;
+                case '1':
+                    lab = '全部状态';
+                    val = '1';
+                    break;
+                case '11':
+                    lab = '退款(退货)中';
+                    val = '11';
+                    break;
+                case '12':
+                    lab = '已完成';
+                    val = '12';
+                    startRefundTime.removeAttr('disabled');
+                    endRefundTime.removeAttr('disabled');
+                    startRefundTime.val('${startRefundTime}');
+                    endRefundTime.val('${endRefundTime}');
+                    break;
+                case '13':
+                    lab = '已取消';
+                    val = '13';
+                    break;
+                default:
+            }
+            $("#orderRefundType").val(val);
+            $('.refund-val').text(lab);
+            $('body').click(function (e) {
+                var target = $(e.target),
+                    opBlockEle = target.siblings('.operation-block');
+                if ((target.is('.operation-btn') && opBlockEle.css('display') == 'block') ||
+                    (!target.is('.operation-block') && !target.is('.operation-btn'))) {
+                    $('.operation-block').hide();
+                } else {
+                    $('.operation-block').hide();
+                    opBlockEle.show();
+                }
+            });
+
+            $('.refund-selector').on('click', function () {
+                var block1 = $('.refund-block1');
+                if (block1.css('display') === 'none') {
+                    $('.refund-block1').show();
+                }
+            });
+
+            $('.refund-options').on('click', function (e) {
+                var val = $(this).text();
+                $("#orderRefundType").val($(this).data('v'));
+                var startRefundTime = $('#startRefundTime');
+                var endRefundTime = $('#endRefundTime');
+                if ($(this).data('v') == '12') {
+                    startRefundTime.removeAttr('disabled');
+                    endRefundTime.removeAttr('disabled');
+                } else {
+                    startRefundTime.attr('disabled', 'disabled');
+                    endRefundTime.attr('disabled', 'disabled');
+                    startRefundTime.val('');
+                    endRefundTime.val('');
+                }
+                $('.refund-val').text(val);
+                $('.refund-block1').hide();
+                e.stopPropagation();
+            })
+            if ($(".operation-block").length > 0) {
+                var length = $(".operation-block").length;
+                for (var i = 0; i < length; i++) {
+                    var b = $(".operation-block").get(i);
+                    if ($(b).html().trim() == '') {
+                        $(b).hide();
+                        $(b).prev().hide();
+                    }
+                }
+            }
+
+        });
+
+        function page(n, s) {
+            $("#pageNo").val(n);
+            $("#pageSize").val(s);
+            $("#searchForm").submit();
+            return false;
+        }
+
+        // 二维码分享
+        function QRCodewin(orderId, orderNo) {
+            var html = '<div style="padding:10px;">订单号:' + orderNo + '' +
+                '<div class="code" style="text-align: center;"></div>' +
+                '</div>';
+            $.jBox(html, {
+                title: "订单二维码分享",
+                width: $(top.document).width() - 1700,
+                height: $(top.document).height() - 1600,
+                buttons: {'关闭': true}
+            });
+
+            var enCodeRedirectUrl;
+            var redirectUrl = '${fns:getConfig('caimei.crm.server')}oauth.action?orderId=' + orderId;
+            $.ajax({
+                url: "${ctx}/bulkpurchase/contractOrder/enCode",
+                data: {"redirectUrl": redirectUrl},
+                type: "POST",
+                async: false,
+                success: function (data) {
+                    enCodeRedirectUrl = data.enCodeRedirectUrl;
+                }
+            });
+            var shareUrl = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=${fns:getConfig('weixin.appId')}&redirect_uri=' + enCodeRedirectUrl + '&response_type=code&scope=snsapi_base&state=bulkpurchase#wechat_redirect';
+            $('.code').qrcode({
+                width: 150,
+                height: 150,
+                text: shareUrl
+            });
+        }
+
+        // 供应商链接
+        function shareShopLink(shopOrderID) {
+            var cpTxt = '${fns:getConfig('caimei.crm.server')}supplier/order/shopAuthorizedOrder.rpc?shopOrderID=' + shopOrderID;
+
+            var html = '<div style="padding:10px;">' + cpTxt +
+                '<div class="code" style="text-align: center;"></div>' +
+                '</div>';
+            $('#biao1').val(cpTxt);//设置值
+            $.jBox(html, {
+                title: "复制以下链接,可分享订单信息",
+                width: $(top.document).width() - 1400,
+                height: $(top.document).height() - 1600,
+                buttons: {'复制': 1, '关闭': true},
+//                buttons: { '关闭': true },
+                submit: function (v, h, f) {
+                    if (v == 1) {
+                        copyUrl2()
+//                        alert("1")
+//                        window.clipboardData.setData("text" , cpTxt);
+                    }
+                }
+            });
+        }
+
+        // 终止备注信息
+        function orderRemarkswin(orderStopRemarks) {
+            var html = "<div style='padding:10px;'><textarea id='remarks' name='remarks' rows='5' cols='12' readonly='true'>" + orderStopRemarks + "</textarea></div>";
+            $.jBox(html, {
+                title: "备注",
+                width: $(top.document).width() - 1600,
+                height: $(top.document).height() - 1600,
+                buttons: {'关闭': true}
+            });
+        }
+
+        // 订单终止弹窗
+        function orderStopwin(id, flag) {
+            var html = "<div style='padding:10px;'><font color='red'>*</font>备注:<textarea id='remarks' name='remarks' rows='5' cols='12'></textarea></div>";
+            var submit = function (v, h, f) {
+                if (f.remarks == '') {
+                    $.jBox.tip("请输入您填写备注信息", 'error', {focusId: "remarks"});
+                    return false;
+                }
+//				$.jBox.tip("备注:" + f.remarks);
+                location.href = "${ctx}/bulkpurchase/contractOrder/saveOrderStopInfo?id=" + id + "&flag=" + flag + "&orderStopRemarks=" + f.remarks;
+                return true;
+            };
+
+            $.jBox(html, {title: "确认终止订单?", submit: submit});
+        }
+
+
+        // 未分期确认订单
+        function openwin(id, flag) {
+            var submit = function (v, h, f) {
+                if (v == true) {
+                    location.href = "${ctx}/bulkpurchase/contractOrder/saveConfirmFlag?id=" + id + "&flag=" + flag;
+                }
+                return true;// close
+            };
+            // 自定义按钮
+            $.jBox.confirm("客户已确认了吗?", "确认订单", submit, {buttons: {'确认': true, '取消': false}});
+        }
+
+        // 分期确认订单
+        function stagesOpenwin(id, flag) {
+            var submit = function (v, h, f) {
+                if (v == true) {
+                    location.href = "${ctx}/bulkpurchase/contractOrder/saveStagesConfirmFlag?id=" + id + "&flag=" + flag;
+                }
+                return true;// close
+            };
+            // 自定义按钮
+            $.jBox.confirm("确认此订单可以生成?", "确认订单", submit, {buttons: {'确认': true, '取消': false}});
+        }
+
+        //编辑经理折扣
+        function modelShow(orderID) {
+            top.$.jBox("iframe:${ctx}/order/DiscountFee?orderID=" + orderID, {
+                iframeScrolling: 'yes',
+                top: 150,
+                width: 480,
+                height: 300,
+                persistent: true,
+                title: "编辑经理折扣",
+                buttons: {"确认": '1', "取消": '-1'},
+                submit: function (v, h, f) {
+                    //确定
+                    var $jboxFrame = top.$('#jbox-iframe');
+                    var $mainFrame = top.$('#mainFrame');
+                    if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
+                        var rechargeInfo = $jboxFrame[0].contentWindow.submit();
+                        var split = rechargeInfo.split(",");
+                        var payTotalFee = split[0];
+                        var discountFee = split[1];
+                        //取值,然后调用后台接口传入参数,最后刷新页面
+                        if (payTotalFee <= 0) {
+                            return false;
+                        }
+                        $.post("${ctx}/order/saveDiscountFee", {
+                            'discountFee': discountFee,
+                            'orderID': orderID,
+                            'payTotalFee': payTotalFee
+                        }, function (data) {
+                            if (true == data.success) {
+                                refresh();
+                                $.jBox.tip(data.msg, 'info', {timeout: 1000});
+                            } else {
+                                alertx(data.msg, 1000);
+                            }
+                        }, "JSON");//这里返回的类型有:json,html,xml,text
+                    }
+                    return true;
+                }, loaded: function (h) {   //隐藏滚动条
+                    $(".jbox-content", top.document).css("overflow-y", "hidden");
+                }
+            });
+        }
+
+
+        //订单商品备注
+        function remarks(orderID, shopOrderID) {
+            top.$.jBox("iframe:${ctx}/order/cmOrderRemark/remarksView?orderID=" + orderID + "&shopOrderID=" + shopOrderID, {
+                iframeScrolling: 'yes',
+                top: 150,
+                width: 400,
+                height: 480,
+                persistent: true,
+                title: "订单备注信息",
+                buttons: {"确认": '1', "关闭": '-1'},
+                submit: function (v, h, f) {
+                    //确定
+                    var $jboxFrame = top.$('#jbox-iframe');
+                    var $mainFrame = top.$('#mainFrame');
+                    if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
+                        var remarks = $jboxFrame[0].contentWindow.submit();
+//                        var arr = item.split(",");
+//                        var remarks = arr[0];
+                        if ('' == remarks) {
+                            alertx("备注信息不能为空!!!")
+                            return false;
+                        }
+                        saveRemarks(remarks, orderID, shopOrderID);
+                        return true;
+                    }
+                    return true;
+                },
+                loaded: function (h) {   //隐藏滚动条
+                    $(".jbox-content", top.document).css("overflow-y", "hidden");
+                }
+            });
+        }
+
+
+        function saveRemarks(remarks, orderID, shopOrderID) {
+            $.post("${ctx}/order/cmOrderRemark/addRemarks", {
+                "remarks": remarks, "orderID": orderID, "shopOrderID": shopOrderID
+            }, function (data) {
+                if (true == data.success) {
+                    refresh();
+                    $.jBox.tip(data.msg, 'info');
+                } else {
+                    $.jBox.tip(data.msg, 'error');
+                }
+            }, "JSON");//这里返回的类型有:json,html,xml,text
+        }
+
+        //修改订单状态弹窗
+        function updateOrderStatus(orderId) {
+            top.$.jBox("iframe:${ctx}/bulkpurchase/contractOrder/orderStatusEdit?orderId=" + orderId, {
+                iframeScrolling: 'yes',
+                top: 150,
+                width: 400,
+                height: 230,
+                persistent: true,
+                title: "更新订单状态",
+                buttons: {"确认修改": '1', "关闭": '-1'},
+                submit: function (v, h, f) {
+                    //确定
+                    var $jboxFrame = top.$('#jbox-iframe');
+                    var $mainFrame = top.$('#mainFrame');
+                    if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
+                        var item = $jboxFrame[0].contentWindow.submit();
+                        var arr = item.split(",");
+                        var orderStatus = arr[0];
+                        var updateDate = arr[1];
+                        if (updateDate == "") {
+                            alertx("时间不能为空!!!")
+                            return false;
+                        }
+                        saveOrderStatus(orderStatus, updateDate, orderId);
+
+                        return true;
+                    }
+                    return true;
+                }
+            });
+        }
+
+        function saveOrderStatus(orderStatus, updateDate, orderId) {
+            $.post("${ctx}/bulkpurchase/contractOrder/saveOrderStatus", {
+                'orderStatus': orderStatus, "updateDate": updateDate, "orderId": orderId
+            }, function (data) {
+                if (true == data.success) {
+                    refresh();
+                    $.jBox.tip(data.msg, 'info');
+                } else {
+                    $.jBox.tip(data.msg, 'error');
+                }
+            }, "JSON");//这里返回的类型有:json,html,xml,text
+        }
+
+        function refresh() {
+            window.location.href = "${ctx}/order/orderList/";
+        }
+
+        function checkfun() {
+            var orderID = $('#orderID').val();
+            var reg = /^[0-9]*$/;
+            if (!reg.test(orderID) && orderID.trim() != "") {
+                alertx("请输入正确的订单ID!");
+                // $('#orderID').val("");
+                return false;
+            }
+            return true;
+        }
+
+        //抹平收款
+        function collection(orderId) {
+            $.post("${ctx}/order/gatheringData", {
+                'orderId': orderId
+            }, function (data) {
+                if (true == data.success) {
+                    var html = "<div id='auditBox'>" +
+                        "<P>确定抹平收款吗?抹平后该订单将变为已收款状态</p>" +
+                        "<P><span>订单金额:<b>¥" + Number(data.payTotalFee).toFixed(2) + "</b></span></p>" +
+                        "<P><span>应收金额:<b>¥" + Number(data.payableAmount).toFixed(2) + "</b><span style='color:#FF0000'>(账户余额抵扣: ¥<b>" + Number(data.balancePayFee).toFixed(2) + "</b>)</span></span></p>" +
+                        "<P><span>已收金额:<b>¥" + Number(data.associateAmount).toFixed(2) + "</b></span></p>" +
+                        "<div><div class='note-div'><span style='color:#FF0000'>*</span>备注</div></div>" +
+                        "<textarea name='auditNote' style='width: 100%;min-height:60px;'></textarea>" +
+                        "<div class='note-div' style='display: none' id='noteError'><span style='color:#FF0000'>请填写备注</span> </div>" +
+                        "</div>";
+                    $.jBox(html, {
+                        title: "确认提示", width: 500, height: 400, buttons: {"确定": '1', "取消": '-1'},
+                        submit: function (v, h, f) {
+                            if ('1' == v) {
+                                var content = document.getElementsByName("auditNote")[0].value;
+                                if (content == '' || content == null) {
+                                    document.getElementById('noteError').style.display = 'block';
+                                    return false;
+                                }
+                                $.post("${ctx}/order/smoothOutCollection", {
+                                    'orderID': orderId,
+                                    'balanceAccountsRemark': content
+                                });
+                                window.location.href = "${ctx}/order/detail?id=" + orderId;
+                            }
+                        }
+                    });
+
+                } else {
+                    $.jBox.tip(data.msg, 'error');
+                }
+            }, "JSON");//这里返回的类型有:json,html,xml,text
+        };
+    </script>
+</head>
+<body>
+<textarea cols="20" rows="10" id="biao1"></textarea>
+<ul class="nav nav-tabs">
+    <li class="active"><a href="${ctx}/hehe/new/order/orderList">订单列表</a></li>
+</ul>
+<sys:message content="${message}"/>
+<form:form id="searchForm" modelAttribute="newOrder" onsubmit="return checkfun()" action="${ctx}/hehe/new/order/orderList"
+           method="post" class="breadcrumb form-search">
+    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+    <div class="ul-form">
+        <div class="flex-wrap">
+            <div class="item">
+                <label>订单ID:</label>
+                <form:input path="orderID" id="orderID" htmlEscape="false" maxlength="30" class="input-medium"/>
+            </div>
+            <div class="item">
+                <label>订单编号:</label>
+                <form:input path="orderNo" htmlEscape="false" maxlength="30" class="input-medium"/>
+            </div>
+            <div class="item">
+                <label>买家:</label>
+                <form:input path="buyer" maxlength="20" class="input-medium"/>
+            </div>
+            <div class="item">
+                <label>收货人:</label>
+                <form:input path="receiver" maxlength="20" class="input-medium"/>
+            </div>
+            <div class="item">
+                <label>订单状态:</label>
+                <form:select path="status" class="select-ele input-medium required">
+                    <form:option value="" label="所有"/>
+                    <form:options items="${fns:getDictList('order_status')}" itemLabel="label" itemValue="value"
+                                  htmlEscape="false"/>
+                </form:select>
+            </div>
+            <div class="item">
+                <label>收款状态:</label>
+                <form:select path="receiptStatus" class="select-ele input-medium required">
+                    <form:option value="" label="所有"/>
+                    <form:options items="${fns:getDictList('receiptStatus')}" itemLabel="label" itemValue="value"
+                                  htmlEscape="false"/>
+                </form:select>
+            </div>
+            <div class="item">
+                <label>发货状态:</label>
+                <form:select path="sendOutStatus" class="select-ele input-medium required">
+                    <form:option value="" label="所有"/>
+                    <form:options items="${fns:getDictList('sendOutStatus')}" itemLabel="label" itemValue="value"
+                                  htmlEscape="false"/>
+                </form:select>
+            </div>
+            <div class="item">
+                <label>付款状态:</label>
+                <form:select path="payStatus" class="select-ele input-medium required">
+                    <form:option value="" label="所有"/>
+                    <form:options items="${fns:getDictList('payStatus')}" itemLabel="label" itemValue="value"
+                                  htmlEscape="false"/>
+                </form:select>
+            </div>
+
+            <div class="item">
+                <label>退款状态:</label>
+                <form:select path="refundType" class="select-ele input-medium required">
+                    <form:option value="" label="所有"/>
+                    <form:option value="0" label="无退款"/>
+                    <form:option value="1" label="部分退款"/>
+                    <form:option value="2" label="已退款"/>
+                </form:select>
+            </div>
+            <div class="item">
+                <label>待审核退款:</label>
+                <form:select path="returnedPurchaseStatus" class="select-ele input-medium required">
+                    <form:option value="" label="所有"/>
+                    <form:option value="1" label="有"/>
+                    <form:option value="0" label="无"/>
+                </form:select>
+            </div>
+            <div class="item">
+                <label>分销者:</label>
+                <form:select path="userID" class="select-ele input-medium required">
+                    <form:option value="" label="所有"/>
+                    <form:options items="${heUsers}" itemLabel="name" itemValue="userId" htmlEscape="false"/>
+                </form:select>
+            </div>
+            <div class="item">
+                <label class="control-label">下单时间:</label>
+                <form:input path="startTime" type="text" maxlength="10" class="input-medium Wdate" value="${startTime}"
+                            onclick="WdatePicker({dateFmt:'yyyy-MM-dd ',isShowClear:false});"/>
+                至
+                <form:input path="endTime" type="text" maxlength="10" class="input-medium Wdate" value="${endTime}"
+                            onclick="WdatePicker({dateFmt:'yyyy-MM-dd ',isShowClear:false});"/>
+            </div>
+            <div class="item">
+                <input id="btnSubmit" class="btn btn-primary" type="submit" value="查询" style="margin-left: 20px;"/>
+            </div>
+        </div>
+    </div>
+</form:form>
+
+<fmt:formatDate value="<%=new Date()%>" var="currDate" pattern="yyyy-MM-dd"/>
+<fmt:formatDate value="<%=new Date()%>" var="monthFirst" pattern="yyyy-MM-01"/>
+<div class="data-title">
+    <ul>
+        <li>订单ID</li>
+        <li>订单编号</li>
+        <li>买家</li>
+        <li>收货人</li>
+        <li>订单状态</li>
+        <li>收款状态</li>
+        <li>付款状态</li>
+        <li>发货状态</li>
+        <li>退款状态</li>
+        <li>待审核退款</li>
+        <li>订单金额</li>
+        <li>下单时间</li>
+        <li>操作</li>
+    </ul>
+    <c:forEach items="${page.list}" var="order">
+        <%--颜色区分分期不分期订单以及终止订单--%>
+        <ul class="spileOrder" data-id="${order.orderNo}">
+            <li>${order.orderID}</li>
+            <li style="position: relative">${order.orderNo}
+            </li>
+            <li>
+                    ${order.buyer}
+            </li>
+            <li>${order.receiver}</li>
+            <li class="sd-li">
+                <c:if test="${order.status eq 11 || order.status eq 12 || order.status eq 13 ||order.status eq 21 ||order.status eq 22 ||
+				order.status eq 23 || order.status eq 31 ||order.status eq 32 ||order.status eq 33}">
+                    交易中<br>(${fns:getDictLabel(order.status,"order_detail_status","" )})
+                </c:if>
+                <c:if test="${order.status eq 0 || order.status eq 4 || order.status eq 5 || order.status eq 6 || order.status eq 7}">${fns:getDictLabel(order.status,"order_detail_status","" )}</c:if>
+            </li>
+            <li>
+                <c:if test="${order.receiptStatus == 1}">
+                    <font color="red">待收款</font>
+                </c:if>
+                <c:if test="${order.receiptStatus == 2}">
+                    <font color="#ff8c00">部分收款</font>
+                </c:if>
+                <c:if test="${order.receiptStatus == 3}">
+                    <font color="green">已收款</font>
+                </c:if>
+                <br>
+                    <%--抹平明细--%>
+                <c:if test="${order.confirmType eq 1}">
+                    <c:if test="${order.receiptOrderFlag}">
+                        一款多单:少收抹平金额未知
+                    </c:if>
+                    <c:if test="${!order.receiptOrderFlag}">
+                        <font>少收抹平:<br>
+                            ¥<fmt:formatNumber
+                                    value="${order.payableAmount - (empty order.orderReceivedAmount ? 0 : order.orderReceivedAmount)}"
+                                    pattern="#0.00"/>
+                        </font>
+                    </c:if>
+                </c:if>
+                <c:if test="${order.confirmType eq 2}">
+                    <c:if test="${order.receiptOrderFlag}">
+                        一款多单:多收抹平金额未知
+                    </c:if>
+                    <c:if test="${!order.receiptOrderFlag}">
+                        <font>多收抹平:<br>
+                            ¥<fmt:formatNumber
+                                    value="${(empty order.orderReceivedAmount ? 0 : order.orderReceivedAmount) - order.payableAmount}"
+                                    pattern="#0.00"/>
+                        </font>
+                    </c:if>
+                </c:if>
+                <c:if test="${order.confirmType eq 3}">
+                    <c:if test="${order.receiptOrderFlag}">
+                        一款多单:多收退余额
+                    </c:if>
+                    <c:if test="${!order.receiptOrderFlag}">
+                        <font>多收退余额&nbsp;&nbsp;${order.associationType eq 2 ? "(自动)" : ""}:<br>
+                            ¥<fmt:formatNumber
+                                    value="${(empty order.returnBalanceAmount ? 0 : order.returnBalanceAmount)}"
+                                    pattern="#0.00"/>
+                        </font>
+                    </c:if>
+                </c:if>
+            </li>
+            <li>
+                <c:if test="${order.payStatus == 1}">
+                    待付款
+                </c:if>
+                <c:if test="${order.payStatus == 2}">
+                    部分付款
+                </c:if>
+                <c:if test="${order.payStatus == 3}">
+                    已付款
+                </c:if>
+            </li>
+            <li>
+                <c:if test="${order.sendOutStatus == 1}">
+                    待发货
+                </c:if>
+                <c:if test="${order.sendOutStatus == 2}">
+                    部分发货
+                </c:if>
+                <c:if test="${order.sendOutStatus == 3}">
+                    已发货
+                </c:if>
+            </li>
+            <li>
+                <c:if test="${order.refundType == 1}">
+                    部分退款
+                </c:if>
+                <c:if test="${order.refundType == 2}">
+                    已退款
+                </c:if>
+                <c:if test="${order.refundType ne 1 and order.refundType ne 2 }">
+                    无退款
+                </c:if>
+            </li>
+            <li>
+                <c:if test="${order.returnedPurchaseStatus == 1}">
+                    <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRecturnRecordByOrderID.rpc?orderID=${order.orderID}">
+                        有
+                    </a>
+                </c:if>
+                <c:if test="${order.returnedPurchaseStatus == 0}">
+                    无
+                </c:if>
+            </li>
+            <li><fmt:formatNumber value="${order.payTotalFee}" type="currency"/></li>
+                <%-- 订单金额 --%>
+            <li>${order.orderTime}</li>
+            <li class="operation-wrap">
+                <a href="${ctx}/hehe/new/order/detail?id=${order.orderID}">查看详情</a>
+                <a class="operation-btn">功能</a>
+                <div class="operation-block">
+                    <shiro:hasPermission name="order:order:edit">
+                        <%--包含订单充值商品就不显示--%>
+                        <c:if test="${empty order.rechargeGoods}">
+                            <c:if test="${order.status == 11 || order.status == 12 || order.status == 21 || order.status == 22 || order.status == 31 || order.status == 32}">
+                                <a href="${ctx}/order/toDeliveryPage?id=${order.orderID}">发货</a>
+                            </c:if>
+                            <c:if test="${order.receiptStatus == 2 && order.status != 6 && order.status != 7}">
+                                <a href="javascript:void(0);" onclick="collection(${order.orderID})">抹平收款</a>
+                            </c:if>
+                        </c:if>
+                        <c:if test="${(order.organizeID == 0 or order.organizeID > 2) && order.status == 11 && order.payStatus == 1}">
+                            <a href="javascript:void(0);"
+                               onclick="modelShow('${order.orderID}')">编辑经理折扣</a>
+                        </c:if>
+                    </shiro:hasPermission>
+
+                    <shiro:hasPermission name="order:order:applyrefound">
+                        <c:if test="${order.status == 12 || order.status == 13 || order.status == 21 || order.status == 22 || order.status == 23 || order.status == 31 || order.status == 32 || order.status == 33 || order.status == 4 || order.status == 5}">
+                            <%--  返佣订单不能申请退款(退货) --%>
+                            <c:if test="${order.rebateOrder == '0'}">
+                                <%--如果存在审核收款则不允许申请:1不能申请,其它可以申请--%>
+                                <c:if test="${order.toAudit eq 1}">
+                                    <%--弹窗提示--%>
+                                    <a href="#" onclick="return alertx('订单存在未审核的收款,暂不能退款。请将收款审核通过后再操作退款。')">申请退款</a>
+                                </c:if>
+                                <c:if test="${order.toAudit ne 1}">
+                                    <%--如果存在退款记录在待审核或者审核不通过记录不允许继续退款--%>
+                                    <c:if test="${order.applyReturnedPurchaseFlag eq 1}">
+                                        <a href="${ctx}/bulkpurchase/cmRefundsProduct/applyRefound.rpc?orderID=${order.orderID}"
+                                           <c:if test="${order.status == 21 || order.status == 22 || order.status == 23}">onclick="return confirmx('部分收款的订单、申请退款只能申请全部退款!', this.href)"
+                                        </c:if>
+                                        >
+                                            申请退款
+                                        </a>
+                                    </c:if>
+                                    <c:if test="${order.applyReturnedPurchaseFlag ne 1}">
+                                        <font title="存在未处理完的申请,请前往退款列表处理!">申请退款</font>
+                                    </c:if>
+                                </c:if>
+                            </c:if>
+                        </c:if>
+                    </shiro:hasPermission>
+
+                    <shiro:hasPermission name="order:order:edit">
+                        <c:if test="${order.status ne 0}">
+                            <a href="${ctx}/order/printOrder?orderID=${order.orderID}">打印发货单</a>
+                        </c:if>
+                        <%--<a href="/">供应商链接</a>--%>
+                        <a href="${ctx}/order/exportOrder?id=${order.orderID}">订单导出</a>
+                        <a href="${ctx}/order/cmOrderRemark/remarksViewNew.rpc?orderID=${order.orderID}&source=1">订单备注</a>
+                        <%--包含订单充值商品就不显示--%>
+                        <c:if test="${empty order.rechargeGoods}">
+                            <c:if test="${order.status ne 0 && order.status ne 11 && order.status ne 21 && order.status ne 6 && order.status ne 4}">
+                                <a href="${ctx}/order/logisticsDetails?orderID=${order.orderID}">发货记录</a>
+                            </c:if>
+                            <c:if test="${order.status ne 0 && order.status ne 11 && order.status ne 6}">
+                                <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${order.orderID}&from=1">收退款记录
+                                </a>
+                            </c:if>
+                            <c:if test="${order.status ne 0 && order.status ne 11 && order.status ne 6}">
+                                <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRecturnRecordByOrderID.rpc?orderID=${order.orderID}">退款(退货)记录
+                                </a>
+                            </c:if>
+                        </c:if>
+                    </shiro:hasPermission>
+                </div>
+            </li>
+        </ul>
+    </c:forEach>
+</div>
+
+<div class="pagination">${page}</div>
+</body>
+</html>

+ 186 - 0
src/main/webapp/WEB-INF/views/modules/hehe/userActivityProductList.jsp

@@ -0,0 +1,186 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<html>
+<head>
+    <title>活动商品管理</title>
+    <meta name="decorator" content="default"/>
+    <style type="text/css">
+        .table th {
+            text-align: center;
+        }
+
+        .table td {
+            text-align: center;
+        }
+    </style>
+    <script type="text/javascript">
+        $(document).ready(function () {
+
+        });
+
+        function page(n, s) {
+            $("#pageNo").val(n);
+            $("#pageSize").val(s);
+            $("#searchForm").submit();
+            return false;
+        }
+    </script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+    <li><a href="${ctx}/hehe/cmHeheUser/">分销者列表</a></li>
+    <li class="active"><a href="${ctx}/hehe/cmHeheUser/activityProductList?userId=${activityProduct.userId}">活动商品</a>
+    </li>
+</ul>
+<form:form id="searchForm" modelAttribute="cmHeheActivityProduct" action="${ctx}/hehe/cmHeheUser/activityProductList"
+           method="post" class="breadcrumb form-search">
+    <input type="hidden" name="userId" value="${activityProduct.userId}"/>
+    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+    <div class="ul-form">
+        <label>商品名称:</label>
+        <form:input path="name" htmlEscape="false" class="input-medium"/>
+        <label>供应商名称:</label>
+        <form:input path="shopName" htmlEscape="false" class="input-medium"/>
+        &nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+        <input class="btn btn-primary" type="button" value="一键排序" onclick="batchSaveSort()" style="margin-left: 15px"/>
+        &nbsp;&nbsp;<input class="btn btn-primary" style="width: 80px" onclick="showSelect()" value="添加商品"/>
+        <div class="clearfix"></div>
+    </div>
+</form:form>
+<sys:message content="${message}"/>
+<table id="contentTable" class="table table-striped table-bordered table-condensed">
+    <thead>
+    <tr>
+        <th>图片</th>
+        <th>名称</th>
+        <th>供应商</th>
+        <th>售价</th>
+        <th>活动价</th>
+        <th>排序</th>
+        <th>操作</th>
+    </tr>
+    </thead>
+    <tbody>
+    <c:forEach items="${page.list}" var="cmHeheActivityProduct">
+        <tr>
+            <input class="check-item" type="hidden" id="preferredProductSort${cmHeheActivityProduct.id}"
+                   value='${cmHeheActivityProduct.id}-${cmHeheActivityProduct.sort}'/>
+            <td>
+                <img class="mainImage" src="${cmHeheActivityProduct.mainImage}" width="50px" height="50px">
+            </td>
+            <td>
+                    ${cmHeheActivityProduct.name}
+            </td>
+            <td>
+                    ${cmHeheActivityProduct.shopName}
+            </td>
+            <td>
+                    ${cmHeheActivityProduct.price}
+            </td>
+            <td>
+                <c:if test="${cmHeheActivityProduct.activityLadderList.size() eq 1}">
+                    <label>¥${cmHeheActivityProduct.activityLadderList[0].buyPrice}(购买数≥${cmHeheActivityProduct.activityLadderList[0].buyNum})</label><br>
+                </c:if>
+                <c:if test="${cmHeheActivityProduct.activityLadderList.size() eq 2}">
+                    <label>¥${cmHeheActivityProduct.activityLadderList[0].buyPrice}(购买数${cmHeheActivityProduct.activityLadderList[0].buyNum}-${cmHeheActivityProduct.activityLadderList[1].buyNum})</label><br>
+                    <label>¥${cmHeheActivityProduct.activityLadderList[1].buyPrice}(购买数≥${cmHeheActivityProduct.activityLadderList[1].buyNum})</label><br>
+                </c:if>
+                <c:if test="${cmHeheActivityProduct.activityLadderList.size() eq 3}">
+                    <label>¥${cmHeheActivityProduct.activityLadderList[0].buyPrice}(购买数${cmHeheActivityProduct.activityLadderList[0].buyNum}-${cmHeheActivityProduct.activityLadderList[1].buyNum})</label><br>
+                    <label>¥${cmHeheActivityProduct.activityLadderList[1].buyPrice}(购买数${cmHeheActivityProduct.activityLadderList[1].buyNum}-${cmHeheActivityProduct.activityLadderList[2].buyNum})</label><br>
+                    <label>¥${cmHeheActivityProduct.activityLadderList[2].buyPrice}(购买数≥${cmHeheActivityProduct.activityLadderList[2].buyNum})</label><br>
+                </c:if>
+            </td>
+            <td>
+                <input id="sort" name="sort" style="width:50px;" value="${cmHeheActivityProduct.sort}"
+                       onkeyup="onlynum(this)" onchange="changeSort(${cmHeheActivityProduct.id},this)">
+            </td>
+            <td>
+                <a href="${ctx}/hehe/cmHeheUser/deleteActivityProduct?userId=${cmHeheActivityProduct.userId}&productId=${cmHeheActivityProduct.productId}"
+                   onclick="return confirmx('确认要删除该商品吗?', this.href)">删除</a>
+            </td>
+        </tr>
+    </c:forEach>
+    </tbody>
+</table>
+<div class="pagination">${page}</div>
+
+<script>
+    //选择添加
+    function showSelect() {
+        var url = '';
+        var title = '';
+        url = "${ctx}/hehe/cmHeheUser/findProductPage";
+        title = "添加商品";
+        top.$.jBox("iframe:" + url + "?userId=${activityProduct.userId}", {
+            iframeScrolling: 'yes',
+            width: $(top.document).width() - 600,
+            height: $(top.document).height() - 160,
+            persistent: true,
+            title: title,
+            buttons: {"确定": '1', "关闭": '-1'},
+            submit: function (v, h, f) {
+                //确定
+                var $jboxFrame = top.$('#jbox-iframe');
+                var $mainFrame = top.$('#mainFrame');
+                if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
+                    var items = $jboxFrame[0].contentWindow.getCheckedItems();
+                    if (items.length > 0) {
+                        console.log(items);
+                        //添加数据
+                        $.post("${ctx}/hehe/cmHeheUser/addActivityProducts?userId=${activityProduct.userId}&productIds=" + items, function (data) {
+                            if (true == data.success) {
+                                $.jBox.tip(data.info, 'info');
+                                setTimeout(function () {
+                                    window.location.href = "${ctx}/hehe/cmHeheUser/activityProductList?userId=${activityProduct.userId}"
+                                }, 1300);
+                            } else {
+                                $.jBox.tip(data.info, 'error');
+                            }
+                        }, "JSON");//这里返回的类型有:json,html,xml,text
+                        return true;
+                    } else {
+                        top.$.jBox.tip("请先勾选商品...");
+                        return false;
+                    }
+                }
+                return true;
+            }
+        });
+    }
+
+    //修改排序值
+    function changeSort(id, sortThis) {
+        var value = sortThis.value;
+        $("#preferredProductSort" + id).val(id + "-" + value);
+    }
+
+    //批量保存排序
+    function batchSaveSort() {
+        var items = new Array();
+        var $items = $('.check-item');
+        $items.each(function () {
+            items.push($(this).val());
+        });
+        //保存批量排序
+        $.post("${ctx}/hehe/cmHeheUser/batchSaveSort?sortList=" + items, function (data) {
+            if (true == data.success) {
+                $.jBox.tip(data.msg, 'info');
+                window.location.href = "${ctx}/hehe/cmHeheUser/activityProductList?userId=${activityProduct.userId}";
+            } else {
+                $.jBox.tip(data.msg, 'error');
+            }
+        }, "JSON");//这里返回的类型有:json,html,xml,text
+    }
+
+    /**
+     * @param obj
+     * jquery控制input只能输入数字
+     */
+    function onlynum(obj) {
+        obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+    }
+</script>
+</body>
+</html>

+ 4 - 1
src/main/webapp/WEB-INF/views/modules/order/cmDiscernReceiptForm.jsp

@@ -272,7 +272,10 @@
 								<c:if test="${orderInfo.organizeID == 1}">
                                     <span class="org-note">星范</span>
                                 </c:if>
-									${orderInfo.customerName}<c:if test="${orderInfo.organizeID == 3}"><em class="weishaIcon">维沙</em></c:if>
+									${orderInfo.customerName}
+                    <c:if test="${orderInfo.organizeID == 3}">
+                        <em class="weishaIcon">维沙</em>
+                    </c:if>
 							</span>
                 <span><label>订单状态:</label>
 								<c:if test="${orderInfo.receiptStatus == 1}">待收款</c:if>

+ 5 - 4
src/main/webapp/WEB-INF/views/modules/order/cmDiscernReceiptList.jsp

@@ -218,11 +218,12 @@
                 <c:if test="${cmDiscernReceipt.organizeID == 1}">
                     <span class="org-note">星范</span>
                 </c:if>
-                <c:if test="${empty cmDiscernReceipt.userName}">
-                    ${cmDiscernReceipt.name}<c:if test="${cmDiscernReceipt.organizeID == 3}"><em class="weishaIcon">维沙</em></c:if>
+                    ${cmDiscernReceipt.name}
+                <c:if test="${cmDiscernReceipt.receiptOrderType eq 2}">
+                    <font color="red">(呵呵商城)</font>
                 </c:if>
-                <c:if test="${not empty cmDiscernReceipt.userName}">
-                    ${cmDiscernReceipt.name}<c:if test="${cmDiscernReceipt.organizeID == 3}"><em class="weishaIcon">维沙</em></c:if>
+                <c:if test="${cmDiscernReceipt.organizeID == 3}">
+                    <em class="weishaIcon">维沙</em>
                 </c:if>
             </td>
             <td>${cmDiscernReceipt.orderType}</td>

+ 7 - 1
src/main/webapp/WEB-INF/views/modules/order/cmPayFormList.jsp

@@ -128,7 +128,13 @@
 						<c:if test="${shopOrder.organizeID eq 1}">
 							<span class="org-note">星范</span>
 						</c:if>
-						${shopOrder.clubName}<c:if test="${shopOrder.organizeID == 3}"><em class="weishaIcon">维沙</em></c:if><br>
+						${shopOrder.clubName}
+						<c:if test="${shopOrder.orderType eq 2}">
+							<span><font color="red">(呵呵商城)</font></span>
+						</c:if>
+						<c:if test="${shopOrder.organizeID == 3}">
+							<em class="weishaIcon">维沙</em>
+						</c:if><br>
 					</c:forEach>
 				</td>
 

+ 5 - 1
src/main/webapp/WEB-INF/views/modules/order/cmPayShopDetail.jsp

@@ -151,7 +151,11 @@
 				</tr>
 				<tr>
 					<td>${s.shopName}</td>
-					<td colspan="3">${s.clubName}<c:if test="${s.organizeID == 3}"><em class="weishaIcon">维沙</em></c:if></td>
+					<td colspan="3">
+							${s.clubName}
+						<c:if test="${s.orderType eq 2}"><font color="red">(呵呵商城)</font></c:if>
+						<c:if test="${s.organizeID == 3}"><em class="weishaIcon">维沙</em></c:if>
+					</td>
 					<td>
                         <c:if test="${s.freight == 0}">
                             包邮

+ 4 - 1
src/main/webapp/WEB-INF/views/modules/order/cmPayShopForm.jsp

@@ -166,7 +166,10 @@
 				</tr>
 				<tr>
 					<td>${s.shopName}</td>
-					<td colspan="3">${s.buyer}<c:if test="${s.organizeID == 3}"><em class="weishaIcon">维沙</em></c:if></td>
+					<td colspan="3">
+							${s.buyer}
+						<c:if test="${s.orderType eq 2}"><font color="red">(呵呵商城)</font></c:if>
+						<c:if test="${s.organizeID == 3}"><em class="weishaIcon">维沙</em></c:if></td>
 					<td>
                         <c:if test="${s.freight == 0}">
                             包邮

+ 3 - 1
src/main/webapp/WEB-INF/views/modules/order/cmPayShopList.jsp

@@ -455,7 +455,9 @@
                     <td>${s.shopName}</td>
                     <td colspan="3">
                         <c:if test="${s.organizeID eq 1}"><span class="org-note">星范</span></c:if>
-                            ${s.clubName}<c:if test="${s.organizeID == 3}"><em class="weishaIcon">维沙</em></c:if>
+                            ${s.clubName}
+                        <c:if test="${s.orderType eq 2}"><font color="red">(呵呵商城)</font></c:if>
+                        <c:if test="${s.organizeID == 3}"><em class="weishaIcon">维沙</em></c:if>
                     </td>
                     <td>
                         <c:if test="${s.freight == 0}">

+ 13 - 11
src/main/webapp/WEB-INF/views/modules/order/cmReturnedPurchaseList.jsp

@@ -89,10 +89,10 @@
 </head>
 <body>
 	<ul class="nav nav-tabs">
-		<li class="active"><a href="${ctx}/order/cmReturnedPurchase/">退款列表</a></li>
-		<%--<shiro:hasPermission name="order:cmReturnedPurchase:edit"><li><a href="${ctx}/order/cmReturnedPurchase/form">退货退款添加</a></li></shiro:hasPermission>--%>
+		<li class="active"><a href="${ctx}/order/cmReturnedPurchase/list?orderType=${orderType}">退款列表</a></li>
 	</ul>
 	<form:form id="searchForm" modelAttribute="cmReturnedPurchase" action="${ctx}/order/cmReturnedPurchase/" method="post" class="breadcrumb form-search">
+		<input id="orderType" name="orderType" type="hidden" value="${orderType}"/>
 		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
 		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
 		<div class="ul-form">
@@ -103,7 +103,7 @@
 				<form:input path="orderID" htmlEscape="false" maxlength="9" onchange="onlynum(this)" class="input-medium"/>
 				<label><font title="主订单编号">订单编号:</font></label>
 				<form:input path="orderNo" htmlEscape="false" maxlength="25" class="input-medium"/>
-				<label>机构:</label>
+				<label>${empty orderType ? "机构" : "买家"}:</label>
 				<form:input path="name" htmlEscape="false" maxlength="20" class="input-medium"/>
 			</div>
 			<div>
@@ -121,13 +121,15 @@
 					<form:options items="${fns:getDictList('cm_returned_purchase_status')}" itemLabel="label" itemValue="value"
 								  htmlEscape="false"/>
 				</form:select>
-				<label>组织:</label>
-				<form:select path="organizeID"  class="select-ele input-medium required">
-					<form:option value="" label="请选择"/>
-					<form:option value="0" label="采美"/>
-					<form:options items="${cmUserOrganizeList}" itemLabel="organizeName" itemValue="id"
-								  htmlEscape="false"/>
-				</form:select>
+				<c:if test="${empty orderType}">
+					<label>组织:</label>
+					<form:select path="organizeID"  class="select-ele input-medium required">
+						<form:option value="" label="请选择"/>
+						<form:option value="0" label="采美"/>
+						<form:options items="${cmUserOrganizeList}" itemLabel="organizeName" itemValue="id"
+									  htmlEscape="false"/>
+					</form:select>
+				</c:if>
 				<div class="clearfix"></div>
 			</div>
 			<div><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询" style="margin-left: 986px;"/></div>
@@ -139,7 +141,7 @@
 			<tr>
 				<th>退款编号</th>
 				<th>退款审核状态</th>
-				<th>机构</th>
+				<th>${empty orderType ? "机构" : "买家"}</th>
 				<th>订单编号(ID)</th>
 				<th>退款金额</th>
 				<th class="refund-type-title">退款方式</th>