浏览代码

呵呵商城分享减免

Aslee 3 年之前
父节点
当前提交
4e969be5b1

+ 10 - 1
src/main/java/com/caimei/modules/hehe/dao/CmHeheReductionDao.java

@@ -1,8 +1,12 @@
 package com.caimei.modules.hehe.dao;
 
+import com.caimei.modules.hehe.entity.CmHeheReductionUser;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import com.caimei.modules.hehe.entity.CmHeheReduction;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * 呵呵商城分享减免DAO接口
@@ -11,5 +15,10 @@ import com.caimei.modules.hehe.entity.CmHeheReduction;
  */
 @MyBatisDao
 public interface CmHeheReductionDao extends CrudDao<CmHeheReduction> {
-	
+
+    void updateStatus(@Param("id") String id,@Param("status") Integer status);
+
+    void updateTime(CmHeheReduction cmHeheReduction);
+
+    List<CmHeheReductionUser> findUserList(CmHeheReductionUser cmHeheReductionUser);
 }

+ 24 - 15
src/main/java/com/caimei/modules/hehe/entity/CmHeheReduction.java

@@ -15,13 +15,15 @@ public class CmHeheReduction extends DataEntity<CmHeheReduction> {
 	
 	private static final long serialVersionUID = 1L;
 	private String name;		// 活动名称
-	private String reducedAmount;		// 减免金额
-	private String touchPrice;		// 减免条件
-	private String shareNum;		// 分享次数
+	private Double reducedAmount;		// 减免金额
+	private Double touchPrice;		// 减免条件
+	private Integer shareNum;		// 分享次数
 	private Date startTime;		// 上架时间
 	private Date endTime;		// 下架时间
 	private Date addTime;		// 添加时间
-	
+
+	private Integer status;		// 状态:1待上架,2已上架,3已下架
+
 	public CmHeheReduction() {
 		super();
 	}
@@ -38,31 +40,31 @@ public class CmHeheReduction extends DataEntity<CmHeheReduction> {
 	public void setName(String name) {
 		this.name = name;
 	}
-	
-	public String getReducedAmount() {
+
+	public Double getReducedAmount() {
 		return reducedAmount;
 	}
 
-	public void setReducedAmount(String reducedAmount) {
+	public void setReducedAmount(Double reducedAmount) {
 		this.reducedAmount = reducedAmount;
 	}
-	
-	public String getTouchPrice() {
+
+	public Double getTouchPrice() {
 		return touchPrice;
 	}
 
-	public void setTouchPrice(String touchPrice) {
+	public void setTouchPrice(Double touchPrice) {
 		this.touchPrice = touchPrice;
 	}
-	
-	public String getShareNum() {
+
+	public Integer getShareNum() {
 		return shareNum;
 	}
 
-	public void setShareNum(String shareNum) {
+	public void setShareNum(Integer shareNum) {
 		this.shareNum = shareNum;
 	}
-	
+
 	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
 	public Date getStartTime() {
 		return startTime;
@@ -89,5 +91,12 @@ public class CmHeheReduction extends DataEntity<CmHeheReduction> {
 	public void setAddTime(Date addTime) {
 		this.addTime = addTime;
 	}
-	
+
+	public Integer getStatus() {
+		return status;
+	}
+
+	public void setStatus(Integer status) {
+		this.status = status;
+	}
 }

+ 70 - 0
src/main/java/com/caimei/modules/hehe/entity/CmHeheReductionUser.java

@@ -0,0 +1,70 @@
+package com.caimei.modules.hehe.entity;
+
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+
+import java.util.Date;
+
+/**
+ * 呵呵商城分享减免用户Entity
+ * @author Aslee
+ * @version 2021-12-14
+ */
+public class CmHeheReductionUser extends DataEntity<CmHeheReductionUser> {
+
+	private static final long serialVersionUID = 1L;
+	private Integer reductionId;		// 分享减免id
+	private Integer userId;		// 用户id
+	private Integer shareType;		// 分享类型:1微信好友,2微信朋友圈
+	private Integer shareTime;		// 分享时间
+
+	private String nickName;		// 微信昵称
+	private String mobile;			// 手机号
+
+	public Integer getReductionId() {
+		return reductionId;
+	}
+
+	public void setReductionId(Integer reductionId) {
+		this.reductionId = reductionId;
+	}
+
+	public Integer getUserId() {
+		return userId;
+	}
+
+	public void setUserId(Integer userId) {
+		this.userId = userId;
+	}
+
+	public Integer getShareType() {
+		return shareType;
+	}
+
+	public void setShareType(Integer shareType) {
+		this.shareType = shareType;
+	}
+
+	public Integer getShareTime() {
+		return shareTime;
+	}
+
+	public void setShareTime(Integer shareTime) {
+		this.shareTime = shareTime;
+	}
+
+	public String getNickName() {
+		return nickName;
+	}
+
+	public void setNickName(String nickName) {
+		this.nickName = nickName;
+	}
+
+	public String getMobile() {
+		return mobile;
+	}
+
+	public void setMobile(String mobile) {
+		this.mobile = mobile;
+	}
+}

+ 40 - 2
src/main/java/com/caimei/modules/hehe/service/CmHeheReductionService.java

@@ -1,7 +1,10 @@
 package com.caimei.modules.hehe.service;
 
+import java.util.Date;
 import java.util.List;
 
+import com.caimei.modules.hehe.entity.CmHeheReduction;
+import com.caimei.modules.hehe.entity.CmHeheReductionUser;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -10,6 +13,8 @@ import com.thinkgem.jeesite.common.service.CrudService;
 import com.caimei.modules.hehe.entity.CmHeheReduction;
 import com.caimei.modules.hehe.dao.CmHeheReductionDao;
 
+import javax.annotation.Resource;
+
 /**
  * 呵呵商城分享减免Service
  * @author Aslee
@@ -18,6 +23,8 @@ import com.caimei.modules.hehe.dao.CmHeheReductionDao;
 @Service
 @Transactional(readOnly = true)
 public class CmHeheReductionService extends CrudService<CmHeheReductionDao, CmHeheReduction> {
+	@Resource
+	private CmHeheReductionDao cmHeheReductionDao;
 
 	public CmHeheReduction get(String id) {
 		return super.get(id);
@@ -28,7 +35,10 @@ public class CmHeheReductionService extends CrudService<CmHeheReductionDao, CmHe
 	}
 	
 	public Page<CmHeheReduction> findPage(Page<CmHeheReduction> page, CmHeheReduction cmHeheReduction) {
-		return super.findPage(page, cmHeheReduction);
+		Page<CmHeheReduction> reductionPage = super.findPage(page, cmHeheReduction);
+		List<CmHeheReduction> reductionList = reductionPage.getList();
+		reductionList.forEach(this::setReductionStatus);
+		return reductionPage;
 	}
 	
 	@Transactional(readOnly = false)
@@ -40,5 +50,33 @@ public class CmHeheReductionService extends CrudService<CmHeheReductionDao, CmHe
 	public void delete(CmHeheReduction cmHeheReduction) {
 		super.delete(cmHeheReduction);
 	}
-	
+
+	public void setReductionStatus(CmHeheReduction cmHeheReduction) {
+		Date date = new Date();
+		if (cmHeheReduction != null) {
+			if (date.compareTo(cmHeheReduction.getStartTime()) < 0) {
+				cmHeheReduction.setStatus(1);
+			} else if (date.compareTo(cmHeheReduction.getEndTime()) > 0) {
+				cmHeheReduction.setStatus(3);
+			} else {
+				cmHeheReduction.setStatus(2);
+			}
+		}
+	}
+
+	@Transactional(readOnly = false)
+	public void updateStatus(CmHeheReduction cmHeheReduction) {
+		cmHeheReductionDao.updateStatus(cmHeheReduction.getId(), cmHeheReduction.getStatus());
+	}
+
+	@Transactional(readOnly = false)
+	public void updateTime(CmHeheReduction cmHeheReduction) {
+		cmHeheReductionDao.updateTime(cmHeheReduction);
+	}
+
+	public Page<CmHeheReductionUser> getUserPage(Page<CmHeheReductionUser> userPage, CmHeheReductionUser cmHeheReductionUser) {
+		cmHeheReductionUser.setPage(userPage);
+		userPage.setList(cmHeheReductionDao.findUserList(cmHeheReductionUser));
+		return userPage;
+	}
 }

+ 1 - 1
src/main/java/com/caimei/modules/hehe/web/CmHeheCollageController.java

@@ -79,7 +79,7 @@ public class CmHeheCollageController extends BaseController {
 		Page<CmHeheCollageMember> page = cmHeheCollageService.getMemberPage(new Page<CmHeheCollageMember>(request, response), cmHeheCollageMember);
 		model.addAttribute("page", page);
 		model.addAttribute("cmHeheCollageMember", cmHeheCollageMember);
-		return "modules/hehe/cmHeheCollageList";
+		return "modules/hehe/cmHeheCollageMemberList";
 	}
 
 }

+ 35 - 4
src/main/java/com/caimei/modules/hehe/web/CmHeheReductionController.java

@@ -1,8 +1,12 @@
 package com.caimei.modules.hehe.web;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.caimei.modules.hehe.entity.CmHeheCollageMember;
+import com.caimei.modules.hehe.entity.CmHeheReductionUser;
+import com.caimei.modules.info.entity.Info;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -10,6 +14,7 @@ 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;
@@ -19,6 +24,9 @@ import com.thinkgem.jeesite.common.utils.StringUtils;
 import com.caimei.modules.hehe.entity.CmHeheReduction;
 import com.caimei.modules.hehe.service.CmHeheReductionService;
 
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * 呵呵商城分享减免Controller
  * @author Aslee
@@ -43,7 +51,6 @@ public class CmHeheReductionController extends BaseController {
 		return entity;
 	}
 	
-	@RequiresPermissions("hehe:cmHeheReduction:view")
 	@RequestMapping(value = {"list", ""})
 	public String list(CmHeheReduction cmHeheReduction, HttpServletRequest request, HttpServletResponse response, Model model) {
 		Page<CmHeheReduction> page = cmHeheReductionService.findPage(new Page<CmHeheReduction>(request, response), cmHeheReduction); 
@@ -51,14 +58,12 @@ public class CmHeheReductionController extends BaseController {
 		return "modules/hehe/cmHeheReductionList";
 	}
 
-	@RequiresPermissions("hehe:cmHeheReduction:view")
 	@RequestMapping(value = "form")
 	public String form(CmHeheReduction cmHeheReduction, Model model) {
 		model.addAttribute("cmHeheReduction", cmHeheReduction);
 		return "modules/hehe/cmHeheReductionForm";
 	}
 
-	@RequiresPermissions("hehe:cmHeheReduction:edit")
 	@RequestMapping(value = "save")
 	public String save(CmHeheReduction cmHeheReduction, Model model, RedirectAttributes redirectAttributes) {
 		if (!beanValidator(model, cmHeheReduction)){
@@ -69,7 +74,6 @@ public class CmHeheReductionController extends BaseController {
 		return "redirect:"+Global.getAdminPath()+"/hehe/cmHeheReduction/?repage";
 	}
 	
-	@RequiresPermissions("hehe:cmHeheReduction:delete")
 	@RequestMapping(value = "delete")
 	public String delete(CmHeheReduction cmHeheReduction, RedirectAttributes redirectAttributes) {
 		cmHeheReductionService.delete(cmHeheReduction);
@@ -77,4 +81,31 @@ public class CmHeheReductionController extends BaseController {
 		return "redirect:"+Global.getAdminPath()+"/hehe/cmHeheReduction/?repage";
 	}
 
+	@RequestMapping(value = "updateStatus")
+	@ResponseBody
+	public String updateStatus(CmHeheReduction cmHeheReduction) {
+		cmHeheReductionService.updateStatus(cmHeheReduction);
+		return "修改成功";
+	}
+
+	@RequestMapping(value = "resetTimePage")
+	public String toAuditPage() {
+		return "modules/hehe/resetTime";
+	}
+
+	@RequestMapping(value = "updateTime")
+	@ResponseBody
+	public String updateTime(CmHeheReduction cmHeheReduction) {
+		cmHeheReductionService.updateTime(cmHeheReduction);
+		return "修改成功";
+	}
+
+	@RequestMapping(value = "userList")
+	public String userList(CmHeheReductionUser cmHeheReductionUser, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<CmHeheReductionUser> page = cmHeheReductionService.getUserPage(new Page<CmHeheReductionUser>(request, response), cmHeheReductionUser);
+		model.addAttribute("page", page);
+		model.addAttribute("cmHeheReductionUser", cmHeheReductionUser);
+		return "modules/hehe/cmHeheReductionUserList";
+	}
+
 }

+ 1 - 0
src/main/resources/mappings/modules/hehe/CmHeheCollageMapper.xml

@@ -93,6 +93,7 @@
 		<if test="orderNo != null and orderNo != ''">
 			and (co.orderID = #{orderNo} or co.orderNo = #{orderNo})
 		</if>
+		order by cm.id
 	</select>
 
 	<insert id="insert" parameterType="CmHeheCollage"  keyProperty="id" useGeneratedKeys="true">

+ 47 - 4
src/main/resources/mappings/modules/hehe/CmHeheReductionMapper.xml

@@ -37,12 +37,24 @@
 					<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
 					<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
 			</if>
+			<if test="status != null">
+				<if test="status == 1">
+					and NOW() <![CDATA[ < ]]> a.startTime
+				</if>
+				<if test="status == 2">
+					and NOW() <![CDATA[ >= ]]> a.startTime and NOW() <![CDATA[ <= ]]> a.endTime
+				</if>
+				<if test="status == 3">
+					and NOW() <![CDATA[ > ]]> a.endTime
+				</if>
+			</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>
@@ -63,8 +75,24 @@
 			</otherwise>
 		</choose>
 	</select>
-	
-	<insert id="insert" parameterType="CmHeheReduction"  keyProperty="id" useGeneratedKeys="true">
+    <select id="findUserList" resultType="com.caimei.modules.hehe.entity.CmHeheReductionUser">
+        select ru.id,chu.nickName,chu.mobile,ru.shareType,ru.shareTime
+        from cm_hehe_reduction_user ru
+            left join cm_hehe_user chu on ru.userId = chu.id
+        where reductionId = #{reductionId}
+        <if test="nickName != null and nickName != ''">
+            and chu.nickName like concat('%',#{nickName},'%')
+        </if>
+        <if test="mobile != null and mobile != ''">
+            and chu.mobile like concat('%',#{mobile},'%')
+        </if>
+        <if test="shareType != null">
+            and ru.shareType = #{shareType}
+        </if>
+        order by shareTime desc
+    </select>
+
+    <insert id="insert" parameterType="CmHeheReduction"  keyProperty="id" useGeneratedKeys="true">
 		INSERT INTO cm_hehe_reduction(
 			name,
 			reducedAmount,
@@ -80,7 +108,7 @@
 			#{shareNum},
 			#{startTime},
 			#{endTime},
-			#{addTime}
+			NOW()
 		)
 	</insert>
 	
@@ -94,7 +122,22 @@
 			endTime = #{endTime}
 		WHERE id = #{id}
 	</update>
-	
+	<update id="updateStatus">
+		update cm_hehe_reduction set
+		<if test="status == 3">
+			endTime = NOW()
+		</if>
+		<if test="status == 2">
+			startTime = NOW()
+		</if>
+		where id = #{id}
+	</update>
+	<update id="updateTime">
+		update cm_hehe_reduction
+		set startTime = #{startTime}, endTime = #{endTime}
+		where id = #{id}
+	</update>
+
 	<delete id="delete">
 		DELETE FROM cm_hehe_reduction
 		WHERE id = #{id}

+ 0 - 2
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheCollageProductList.jsp

@@ -110,12 +110,10 @@
 	function updateProductStatus(id,status) {
 		var submit = function (v, h, f) {
 			if (v == true) {
-				debugger
 				$.post("${ctx}/hehe/cmHeheCollageProduct/updateStatus", {
 					'id': id,
 					'status': (status == 1 ? 0 : 1)
 				}, function (data) {
-					debugger
 					if (data.success) {
 						$.jBox.tip(data.msg, 'info');
 						setTimeout(function () {

+ 31 - 15
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheReductionForm.jsp

@@ -9,6 +9,18 @@
 			//$("#name").focus();
 			$("#inputForm").validate({
 				submitHandler: function(form){
+					var reducedAmount = $("#reducedAmount").val();
+					var touchPrice = $("#touchPrice").val();
+					if (reducedAmount >= touchPrice) {
+						alertx("减免金额必须小于减免条件金额");
+						return false;
+					}
+					var startTime = $("#startTime").val();
+					var endTime = $("#endTime").val();
+					if (startTime >= endTime) {
+						alertx("下架时间不能早于上架时间");
+						return false;
+					}
 					loading('正在提交,请稍等...');
 					form.submit();
 				},
@@ -27,54 +39,58 @@
 </head>
 <body>
 	<ul class="nav nav-tabs">
-		<li><a href="${ctx}/hehe/cmHeheReduction/">活动列表</a></li>
-		<li class="active"><a href="${ctx}/hehe/cmHeheReduction/form?id=${cmHeheReduction.id}">活动<shiro:hasPermission name="hehe:cmHeheReduction:edit">${not empty cmHeheReduction.id?'编辑':'添加'}</shiro:hasPermission><shiro:lacksPermission name="hehe:cmHeheReduction:edit">查看</shiro:lacksPermission></a></li>
+		<li><a href="${ctx}/hehe/cmHeheReduction/">分享减免活动列表</a></li>
+		<li class="active"><a href="${ctx}/hehe/cmHeheReduction/form?id=${cmHeheReduction.id}">活动${not empty cmHeheReduction.id?'编辑':'添加'}</a></li>
 	</ul><br/>
 	<form:form id="inputForm" modelAttribute="cmHeheReduction" action="${ctx}/hehe/cmHeheReduction/save" method="post" class="form-horizontal">
 		<form:hidden path="id"/>
-		<sys:message content="${message}"/>		
+		<sys:message content="${message}"/>
+		<div style="margin-bottom: 10px">
+			<label><font color="red">分享减免适合在某些节日或者主题活动时创建,且适用于所有用户以及商城全部商品。</font></label>
+		</div>
 		<div class="control-group">
-			<label class="control-label">活动名称:</label>
+			<label class="control-label"><font color="red">*</font>活动名称:</label>
 			<div class="controls">
-				<form:input path="name" htmlEscape="false" maxlength="30" class="input-xlarge "/>
+				<form:input path="name" htmlEscape="false" maxlength="30" class="input-xlarge required" placeholder="30个汉字以内"/>
 			</div>
 		</div>
 		<div class="control-group">
 			<label class="control-label">减免金额:</label>
 			<div class="controls">
-				<form:input path="reducedAmount" htmlEscape="false" class="input-xlarge "/>
+				<form:input path="reducedAmount" htmlEscape="false" class="input-xlarge number required"/>
 			</div>
 		</div>
 		<div class="control-group">
 			<label class="control-label">减免条件:</label>
 			<div class="controls">
-				<form:input path="touchPrice" htmlEscape="false" class="input-xlarge "/>
+				订单商品总额满
+				<form:input path="touchPrice" htmlEscape="false" class="input-xlarge number required"/> 元
 			</div>
 		</div>
 		<div class="control-group">
 			<label class="control-label">分享次数:</label>
 			<div class="controls">
-				<form:input path="shareNum" htmlEscape="false" class="input-xlarge "/>
+				<form:input path="shareNum" htmlEscape="false" min="1" class="input-xlarge digits required"/>
 			</div>
 		</div>
 		<div class="control-group">
 			<label class="control-label">上架时间:</label>
 			<div class="controls">
-				<input name="startTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate "
-					value="<fmt:formatDate value="${cmHeheReduction.startTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
-					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
+				<input id="startTime" name="startTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate required"
+					value="<fmt:formatDate value="${cmHeheReduction.startTime}" pattern="yyyy-MM-dd HH:mm"/>"
+					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',isShowClear:false});"/>
 			</div>
 		</div>
 		<div class="control-group">
 			<label class="control-label">下架时间:</label>
 			<div class="controls">
-				<input name="endTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate "
-					value="<fmt:formatDate value="${cmHeheReduction.endTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
-					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
+				<input id="endTime" name="endTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate required"
+					value="<fmt:formatDate value="${cmHeheReduction.endTime}" pattern="yyyy-MM-dd HH:mm"/>"
+					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',isShowClear:false});"/>
 			</div>
 		</div>
 		<div class="form-actions">
-			<shiro:hasPermission name="hehe:cmHeheReduction:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
+			<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>

+ 125 - 13
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheReductionList.jsp

@@ -22,8 +22,8 @@
 </head>
 <body>
 	<ul class="nav nav-tabs">
-		<li class="active"><a href="${ctx}/hehe/cmHeheReduction/">活动列表</a></li>
-		<shiro:hasPermission name="hehe:cmHeheReduction:edit"><li><a href="${ctx}/hehe/cmHeheReduction/form">活动添加</a></li></shiro:hasPermission>
+		<li class="active"><a href="${ctx}/hehe/cmHeheReduction/">分享减免活动列表</a></li>
+		<li><a href="${ctx}/hehe/cmHeheReduction/form">活动添加</a></li>
 	</ul>
 	<form:form id="searchForm" modelAttribute="cmHeheReduction" action="${ctx}/hehe/cmHeheReduction/" method="post" class="breadcrumb form-search">
 		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
@@ -31,6 +31,13 @@
 		<div class="ul-form">
 			 <label>活动名称:</label>
 				<form:input path="name" htmlEscape="false" maxlength="30" 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:option value="3" label="已下架"/>
+				</form:select>
 			&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
 			<div class="clearfix"></div>
 		</div>
@@ -39,21 +46,26 @@
 	<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>
-				<shiro:hasPermission name="hehe:cmHeheReduction:edit"><th>操作</th></shiro:hasPermission>
+				<th>操作</th>
 			</tr>
 		</thead>
 		<tbody>
 		<c:forEach items="${page.list}" var="cmHeheReduction">
 			<tr>
-				<td><a href="${ctx}/hehe/cmHeheReduction/form?id=${cmHeheReduction.id}">
+				<td>
+					${cmHeheReduction.id}
+				</td>
+				<td>
 					${cmHeheReduction.name}
-				</a></td>
+				</td>
 				<td>
 					${cmHeheReduction.reducedAmount}
 				</td>
@@ -61,24 +73,124 @@
 					${cmHeheReduction.touchPrice}
 				</td>
 				<td>
-					<fmt:formatDate value="${cmHeheReduction.startTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
+					<fmt:formatDate value="${cmHeheReduction.startTime}" pattern="yyyy-MM-dd HH:mm"/>
 				</td>
 				<td>
-					<fmt:formatDate value="${cmHeheReduction.endTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
+					<fmt:formatDate value="${cmHeheReduction.endTime}" pattern="yyyy-MM-dd HH:mm"/>
+				</td>
+				<td>
+					<font color="${cmHeheReduction.status eq 1?'#2FA4E7':cmHeheReduction.status eq 2?'#FF0000':'#999999'}">
+						${cmHeheReduction.status eq 1?'待上架':cmHeheReduction.status eq 2?'已上架':'已下架'}
+					</font>
 				</td>
 				<td>
 					<fmt:formatDate value="${cmHeheReduction.addTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
 				</td>
-				<shiro:hasPermission name="hehe:cmHeheReduction:edit"><td>
-    				<a href="${ctx}/hehe/cmHeheReduction/form?id=${cmHeheReduction.id}">编辑</a>
-    				<shiro:hasPermission name="hehe:cmHeheReduction:delete">
-					<a href="${ctx}/hehe/cmHeheReduction/delete?id=${cmHeheReduction.id}" onclick="return confirmx('确认要删除该活动吗?', this.href)">删除</a>
-					</shiro:hasPermission>
-				</td></shiro:hasPermission>
+				<td>
+					<a href="javascript:;" onclick="updateStatus(${cmHeheReduction.id},${cmHeheReduction.status})">
+							${cmHeheReduction.status eq 2?'下架':'上架'}
+					</a>
+    				<a href="javascript:;" onclick="editReduction(${cmHeheReduction.id},${cmHeheReduction.status})">编辑</a>
+					<a href="javascript:;" onclick="deleteReduction(${cmHeheReduction.id},${cmHeheReduction.status})">删除</a>
+					<a href="${ctx}/hehe/cmHeheReduction/userList?reductionId=${cmHeheReduction.id}">分享用户</a>
+				</td>
 			</tr>
 		</c:forEach>
 		</tbody>
 	</table>
 	<div class="pagination">${page}</div>
+<script>
+	function updateStatus(reductionId,status) {
+		if (status !== 3) {
+			if (status === 2) {
+				status = 3;
+			} else {
+				status = 2;
+			}
+			// 待上架活动上架及已上架活动下架
+			var submit = function (v, h, f) {
+				if (v == true) {
+					$.post("${ctx}/hehe/cmHeheReduction/updateStatus?id="+reductionId+"&status="+status,function (data) {
+						top.$.jBox.tip((2 === status?'上架':'下架')+'活动成功');
+						setTimeout(function () {
+							$("#searchForm").submit();
+						}, 1000);
+					});
+				}
+			};
+			if (2 == status) {
+				$.jBox.confirm("确定上架该活动吗?", "提示", submit, {buttons: {'确认': true, '取消': false}});
+			} else {
+				$.jBox.confirm("确定下架该活动吗?", "提示", submit, {buttons: {'确认': true, '取消': false}});
+			}
+		} else {
+			//已下架活动上架需重新设置上下架时间
+			var url = "${ctx}/hehe/cmHeheReduction/resetTimePage";
+			var title = "提示";
+			top.$.jBox("iframe:"+url, {
+				iframeScrolling: 'yes',
+				width: 800,
+				height: 350,
+				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) {
+							var startTime = items[0].startTime;
+							var endTime = items[0].endTime;
+							if (startTime === '') {
+								top.$.jBox.tip("请选择上架时间");
+								return false;
+							}
+							if (endTime === '') {
+								top.$.jBox.tip("请选择下架时间");
+								return false;
+							}
+							$.post("${ctx}/hehe/cmHeheReduction/updateTime?id="+reductionId+"&startTime=" + startTime + "&endTime=" + endTime, function (data) {
+								top.$.jBox.tip("修改成功");
+								setTimeout(function () {
+									$("#searchForm").submit();
+								}, 1000);
+							});
+						} else {
+							top.$.jBox.tip("请先勾选商品...");
+							return false;
+						}
+					}
+					return true;
+				}
+			});
+		}
+
+	}
+
+	function editReduction(reductionId,status) {
+		var href = "${ctx}/hehe/cmHeheReduction/form?id=" + reductionId;
+		if (status === 2) {
+			alertx('请下架后再编辑');
+		} else {
+			window.location.href = href;
+		}
+	}
+
+	function deleteReduction(reductionId,status) {
+		var href = "${ctx}/hehe/cmHeheReduction/delete?id=" + reductionId;
+		if (status === 2) {
+			alertx('请下架后再删除');
+		} else {
+			var submit = function (v, h, f) {
+				if (v == true) {
+					window.location.href = href;
+				}
+			}
+			$.jBox.confirm("确定要删除该活动吗?", "提示", submit, {buttons: {'确认': true, '取消': false}});
+		}
+	}
+</script>
 </body>
 </html>

+ 82 - 0
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheReductionUserList.jsp

@@ -0,0 +1,82 @@
+<%@ 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/cmHeheCollage/">拼团记录</a></li>
+		<li class="active"><a href="${ctx}/hehe/cmHeheCollage/memberList?collageId=${cmHeheReductionUser.collageId}">拼团记录</a></li>
+	</ul>
+	<form:form id="searchForm" modelAttribute="cmHeheReductionUser" action="${ctx}/hehe/cmHeheCollage/memberList" method="post" class="breadcrumb form-search">
+		<form:hidden path="collageId"/>
+		<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" class="input-medium"/>
+			 <label>手机号:</label>
+				<form:input path="mobile" htmlEscape="false" class="input-medium"/>
+			 <label>分享渠道:</label>
+				<form:select path="sharePath" 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="查询"/>
+			<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>ID</th>
+				<th>微信昵称</th>
+				<th>手机号</th>
+				<th>分享渠道</th>
+				<th>分享时间</th>
+			</tr>
+		</thead>
+		<tbody>
+		<c:forEach items="${page.list}" var="cmHeheReductionUser">
+			<tr>
+				<td>
+					${cmHeheReductionUser.id}
+				</td>
+				<td>
+					${cmHeheReductionUser.nickName}</font>
+				</td>
+				<td>
+					${cmHeheReductionUser.mobile}
+				</td>
+				<td>
+					${cmHeheReductionUser.sharePath eq 1 ? "微信好友" : "微信朋友圈"}
+				</td>
+				<td>
+					<fmt:formatDate value="${cmHeheReductionUser.shareTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
+				</td>
+			</tr>
+		</c:forEach>
+		</tbody>
+	</table>
+	<div class="pagination">${page}</div>
+</body>
+</html>

+ 185 - 0
src/main/webapp/WEB-INF/views/modules/hehe/resetTime.jsp

@@ -0,0 +1,185 @@
+<%@ 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>
+        .controls .new-tag {
+            display: inline-block;
+            width: 78px;
+            height: 30px;
+            border: 1px solid #e5e5e5;
+            border-radius: 5px;
+            margin: 7px;
+            text-align: center;
+            line-height: 30px;
+            font-size: 14px;
+            overflow: hidden;
+            text-overflow: ellipsis;
+            white-space: nowrap;
+            cursor: pointer;
+        }
+
+        .controls .new-tag.active {
+            border-color: #e15616;
+            color: #e15616;
+        }
+
+        #tagInput {
+            width: 263px;
+            margin: 7px;
+            display: inline-block;
+            height: 30px;
+        }
+
+        .controls .tags-operate .tag-add {
+            height: 40px;
+            line-height: 40px;
+            vertical-align: middle;
+        }
+
+        .upload {
+            position: relative;
+            display: inline-block;
+            background: #D0EEFF;
+            border: 1px solid #99D3F5;
+            border-radius: 4px;
+            padding: 4px 12px;
+            color: #1E88C7;
+            text-decoration: none;
+            text-indent: 0;
+            line-height: 20px;
+            margin-left: 20px;
+            cursor: pointer;
+            width: 52px;
+            height: 20px;
+        }
+
+        .upload input {
+            position: absolute;
+            width: 170px;
+            font-size: 20px;
+            right: 0;
+            top: 0;
+            opacity: 0;
+            cursor: pointer;
+        }
+
+        .upload:hover {
+            background: #AADFFD;
+            border-color: #78C3F3;
+            color: #004974;
+            text-decoration: none;
+        }
+
+        .add-submit {
+            position: relative;
+            display: inline;
+            background: #D0EEFF;
+            border: 1px solid #99D3F5;
+            border-radius: 4px;
+            padding: 4px 12px;
+            color: #1E88C7;
+            text-decoration: none;
+            text-indent: 0;
+            line-height: 20px;
+            margin-left: 20px;
+            cursor: pointer;
+            width: 52px;
+            height: 30px;
+        }
+
+        .add-submit input {
+            position: absolute;
+            width: 50px;
+            font-size: 20px;
+            right: 0;
+            top: 0;
+            opacity: 0;
+            cursor: pointer;
+        }
+
+        .add-submit:hover {
+            background: #AADFFD;
+            border-color: #78C3F3;
+            color: #004974;
+            text-decoration: none;
+        }
+
+        .upload-loading{
+            display: none;
+            width: 32px;
+            height: 32px;
+            margin-left: 10px;
+        }
+        .upload-loading img{
+            width: 16px;
+            height: 16px;
+            margin: 0 auto 0;
+        }
+
+        #file-list-display {
+            width: 600px;
+            height: auto;
+            float: left;
+            margin-left: 20px;
+        }
+
+        #file-list-display p {
+            line-height: 30px;
+            font-size: 14px;
+            color: #333333;
+            margin: 0;
+        }
+
+        #file-list-display p .del {
+            color: #2fa4e7;
+            font-size: 12px;
+            cursor: pointer;
+            margin-left: 20px;
+        }
+
+        .Main-content{
+            height: 100px;
+        }
+
+        .control-group{
+            margin-top: 40px;
+        }
+    </style>
+
+</head>
+<body>
+<form:form id="inputForm" modelAttribute="info" action="${ctx}/info/info/audit" method="post" class="form-horizontal">
+    <sys:message content="${message}"/>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>上架时间</label>
+        <div class="controls">
+            <input id="startTime" name="startTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate required"
+                   onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',isShowClear:false});"/>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>下架时间</label>
+        <div class="controls">
+            <input id="endTime" name="endTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate required"
+                   onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',isShowClear:false});"/>
+        </div>
+    </div>
+</form:form>
+
+<script>
+    function getCheckedItems() {
+        var items = new Array();
+        items.push({
+            startTime: $("#startTime").val(),
+            endTime: $("#endTime").val()
+        });
+        return items;
+    }
+
+</script>
+</body>
+</html>
+