提交 26c9b5c9 authored 作者: luojie's avatar luojie

修改优惠券的发放,弃用数据库优惠券类型,用枚举来代替

上级 6a85fd61
......@@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
......@@ -119,17 +120,6 @@ public class TbCfCouponController {
return R.ok().put("list", list);
}
/**
*
* @param categoryId
* @return
*/
@RequestMapping("/queryByCouponCategoryId")
@ResponseBody
public R queryByItemType(@RequestParam("categoryId") String categoryId){
List<TbCfCouponCategoryEntity> list = tbCfCouponCategoryService.queryByCouponCategoryId(categoryId);
return R.ok().put("list",list);
}
/**
* 优惠券领取情况
*/
......
......@@ -2,9 +2,11 @@ package com.platform.controller;
import com.platform.entity.TbCfCouponIssueEntity;
import com.platform.entity.TbCfIssueCouponEntity;
import com.platform.entity.TbCfToiCouponEntity;
import com.platform.entity.TbCfUserInfoEntity;
import com.platform.service.TbCfCouponIssueService;
import com.platform.service.TbCfIssueCouponService;
import com.platform.service.TbCfToiCouponService;
import com.platform.utils.PageUtils;
import com.platform.utils.Query;
import com.platform.utils.R;
......@@ -30,7 +32,7 @@ public class TbCfCouponIssueController {
@Autowired
private TbCfCouponIssueService tbCfCouponIssueService;
@Autowired
private TbCfIssueCouponService tbCfIssueCouponService;
private TbCfToiCouponService tbCfToiCouponService;
/**
* 查看列表
*/
......@@ -67,7 +69,7 @@ public class TbCfCouponIssueController {
@RequestMapping("/save")
@RequiresPermissions("tbcfcouponissue:save")
@ResponseBody
public R save(@RequestBody TbCfCouponIssueEntity tbCfCouponIssue,TbCfIssueCouponEntity tbCfIssueCoupon) {
public R save(@RequestBody TbCfCouponIssueEntity tbCfCouponIssue,TbCfToiCouponEntity tbCfToiCoupon) {
tbCfCouponIssueService.save(tbCfCouponIssue);
int status = tbCfCouponIssueService.queryByStatus(tbCfCouponIssue.getCouponIssueId());
List<TbCfUserInfoEntity> userList= tbCfCouponIssueService.queryByUserStatus(status);
......@@ -75,15 +77,12 @@ public class TbCfCouponIssueController {
for (int i = 0; i < userList.size(); i++) {
HashMap<String, String> map = new HashMap<String, String>();
map.put("userId", userList.get(i).getUserId());
map.put("nick", userList.get(i).getNick());
list.add(map);
}
for (HashMap<String, String> m : list) {
String userId = m.get("userId");
String nick = m.get("nick");
tbCfIssueCouponService.save(tbCfCouponIssue, tbCfIssueCoupon, userId, nick);
tbCfToiCouponService.saveAndSubmit(tbCfCouponIssue, tbCfToiCoupon, userId);
}
return R.ok();
}
......
package com.platform.controller;
import com.platform.entity.*;
import com.platform.service.TbCfCouponIssueService;
import com.platform.service.TbCfToiCouponService;
import com.platform.utils.PageUtils;
import com.platform.utils.Query;
import com.platform.utils.R;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Controller
*
* @author lipengjun
* @date 2019-11-20 19:37:20
*/
@Controller
@RequestMapping(value = "tbcftoicoupon",produces = "application/json; charset=utf-8")
public class TbCfToiCouponController {
@Autowired
private TbCfToiCouponService tbCfToiCouponService;
/**
* 查看列表
*/
@RequestMapping("/list")
@RequiresPermissions("tbcftoicoupon:list")
@ResponseBody
public R list(@RequestParam Map<String, Object> params) {
//查询列表数据
Query query = new Query(params);
List<TbCfToiCouponEntity> tbCfToicouponList = tbCfToiCouponService.queryList(query);
int total = tbCfToiCouponService.queryTotal(query);
PageUtils pageUtil = new PageUtils(tbCfToicouponList,total, query.getLimit(), query.getPage());
return R.ok().put("page", pageUtil);
}
/**
* 查看信息
*/
@RequestMapping("/info/{toitableId}")
@RequiresPermissions("tbcftoicoupon:info")
@ResponseBody
public R info(@PathVariable("toitableId") String toitableId) {
TbCfToiCouponEntity tbCfToicoupon = tbCfToiCouponService.queryObject(toitableId);
return R.ok().put("tbCfToicoupon", tbCfToicoupon);
}
/**
* 保存
*/
@RequestMapping("/save")
@RequiresPermissions("tbcftoicoupon:save")
@ResponseBody
public R save(@RequestBody TbCfToiCouponEntity tbCfToicoupon) {
tbCfToiCouponService.save(tbCfToicoupon);
return R.ok();
}
/* *//**
* 保存并发放 提交
*//*
@RequestMapping("/saveAndSubmit")
@RequiresPermissions("tbcftoicoupon:saveAndSubmit")
@ResponseBody
public R saveAndSubmit(@RequestBody TbCfToiCouponEntity tbCfToiCoupon, TbCfCouponIssueEntity tbCfCouponIssue) {
tbCfCouponIssueService.save(tbCfCouponIssue);
int status = tbCfCouponIssueService.queryByStatus(tbCfCouponIssue.getCouponIssueId());
List<TbCfUserInfoEntity> userList= tbCfCouponIssueService.queryByUserStatus(status);
List<HashMap<String, String>> list=new ArrayList<>();
for (int i = 0; i < userList.size(); i++) {
HashMap<String, String> map = new HashMap<String, String>();
map.put("userId", userList.get(i).getUserId());
map.put("nick", userList.get(i).getNick());
list.add(map);
}
for (HashMap<String, String> m : list) {
String userId = m.get("userId");
tbCfToiCouponService.saveAndSubmit(tbCfCouponIssue, tbCfToiCoupon,userId);
}
return R.ok();
}*/
/**
* 修改
*/
@RequestMapping("/update")
@RequiresPermissions("tbcftoicoupon:update")
@ResponseBody
public R update(@RequestBody TbCfToiCouponEntity tbCfToicoupon) {
tbCfToiCouponService.update(tbCfToicoupon);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
@RequiresPermissions("tbcftoicoupon:delete")
@ResponseBody
public R delete(@RequestBody String[] toitableIds) {
tbCfToiCouponService.deleteBatch(toitableIds);
return R.ok();
}
/**
* 查看所有列表
*/
@RequestMapping("/queryAll")
@ResponseBody
public R queryAll(@RequestParam Map<String, Object> params) {
List<TbCfToiCouponEntity> list = tbCfToiCouponService.queryList(params);
return R.ok().put("list", list);
}
}
......@@ -10,19 +10,16 @@ import java.util.List;
//转换时间,正式版删除!!!!!!
public class Test {
public static void main(String[] args) throws Exception {
String res = "2019-11-01";
String res1 = "2019-11-25";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date date = simpleDateFormat.parse(res);
Date date1 = simpleDateFormat.parse(res1);
long it = date.getTime()/1000;
long it1 = date1.getTime()/1000;
String s = String.valueOf(it);
String s1 = String.valueOf(it1);
System.out.println(s);
System.out.println(s1);
}
/* public static void main(String[] args) throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
Calendar c = Calendar.getInstance();
c.add(Calendar.DATE, + 7);
Date time = c.getTime();
Date endDate = sdf.parse(sdf.format(time));
Date startDate=sdf.parse(sdf.format(new Date()));
System.out.println(startDate);
System.out.println(endDate);
}*/
/* public static void main(String[] args) throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
......
package com.platform.dao;
import com.platform.entity.TbCfToiCouponEntity;
/**
* Dao
*
* @author lipengjun
* @date 2019-11-20 19:37:20
*/
public interface TbCfToiCouponDao extends BaseDao<TbCfToiCouponEntity> {
int saveAndSubmit(TbCfToiCouponEntity tbCfToiCoupon);
}
......@@ -297,6 +297,8 @@ public class TbCfCouponEntity implements Serializable {
public Date getEndTime() {
return endTime;
}
/**
* 设置:有效开始时间
*/
......
package com.platform.entity;
import java.io.Serializable;
import java.util.Date;
/**
* 实体
* 表名 tb_cf_toicoupon
*
* @author lipengjun
* @date 2019-11-20 19:37:20
*/
public class TbCfToiCouponEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 发放/领取表id
*/
private String toitableId;
/**
* 优惠券id
*/
private String couponId;
/**
* 用户id
*/
private String userId;
/**
* 创建时间
*/
private Date createTime;
/**
* 标识(1发放,2领取,3注册)
*/
private Integer identification;
/**
* 是否已使用(0已使用,1未使用)
*/
private Integer enableFlag;
/**
* 设置:发放/领取表id
*/
public void setToitableId(String toitableId) {
this.toitableId = toitableId;
}
/**
* 获取:发放/领取表id
*/
public String getToitableId() {
return toitableId;
}
/**
* 设置:优惠券id
*/
public void setCouponId(String couponId) {
this.couponId = couponId;
}
/**
* 获取:优惠券id
*/
public String getCouponId() {
return couponId;
}
/**
* 设置:用户id
*/
public void setUserId(String userId) {
this.userId = userId;
}
/**
* 获取:用户id
*/
public String getUserId() {
return userId;
}
/**
* 设置:创建时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取:创建时间
*/
public Date getCreateTime() {
return createTime;
}
/**
* 设置:标识(1发放,2领取,3注册)
*/
public void setIdentification(Integer identification) {
this.identification = identification;
}
/**
* 获取:标识(1发放,2领取,3注册)
*/
public Integer getIdentification() {
return identification;
}
/**
* 设置:是否已使用(0已使用,1未使用)
*/
public void setEnableFlag(Integer enableFlag) {
this.enableFlag = enableFlag;
}
/**
* 获取:是否已使用(0已使用,1未使用)
*/
public Integer getEnableFlag() {
return enableFlag;
}
}
......@@ -4,6 +4,7 @@ import com.platform.entity.TbCfCouponEntity;
import com.platform.vo.CouponIssueVo;
import com.platform.vo.CouponTakeVo;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
......@@ -42,7 +43,7 @@ public interface TbCfCouponService {
* @param tbCfCoupon 实体
* @return 保存条数
*/
int save(TbCfCouponEntity tbCfCoupon);
int save(TbCfCouponEntity tbCfCoupon) ;
/**
* 根据主键更新实体
......
package com.platform.service;
import com.platform.entity.TbCfCouponIssueEntity;
import com.platform.entity.TbCfToiCouponEntity;
import java.util.List;
import java.util.Map;
/**
* Service接口
*
* @author lipengjun
* @date 2019-11-20 19:37:20
*/
public interface TbCfToiCouponService {
/**
* 根据主键查询实体
*
* @param id 主键
* @return 实体
*/
TbCfToiCouponEntity queryObject(String toitableId);
/**
* 分页查询
*
* @param map 参数
* @return list
*/
List<TbCfToiCouponEntity> queryList(Map<String, Object> map);
/**
* 分页统计总数
*
* @param map 参数
* @return 总数
*/
int queryTotal(Map<String, Object> map);
/**
* 保存实体
*
* @param tbCfToicoupon 实体
* @return 保存条数
*/
int save(TbCfToiCouponEntity tbCfToicoupon);
/**
* 根据主键更新实体
*
* @param tbCfToicoupon 实体
* @return 更新条数
*/
int update(TbCfToiCouponEntity tbCfToicoupon);
/**
* 根据主键删除
*
* @param toitableId
* @return 删除条数
*/
int delete(String toitableId);
/**
* 根据主键批量删除
*
* @param toitableIds
* @return 删除条数
*/
int deleteBatch(String[] toitableIds);
/**
* 保存用户的优惠券
* @param tbCfCouponIssue
* @param tbCfToiCoupon
* @param userId
* @return
*/
int saveAndSubmit(TbCfCouponIssueEntity tbCfCouponIssue, TbCfToiCouponEntity tbCfToiCoupon, String userId);
}
......@@ -10,6 +10,9 @@ import com.platform.vo.CouponTakeVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -41,7 +44,7 @@ public class TbCfCouponServiceImpl implements TbCfCouponService {
}
@Override
public int save(TbCfCouponEntity tbCfCoupon) {
public int save(TbCfCouponEntity tbCfCoupon){
tbCfCoupon.setCouponId(IdUtil.createIdbyUUID());
tbCfCoupon.setTakeCount(0);
tbCfCoupon.setUsedCount(0);
......@@ -50,6 +53,7 @@ public class TbCfCouponServiceImpl implements TbCfCouponService {
return tbCfCouponDao.save(tbCfCoupon);
}
@Override
public int update(TbCfCouponEntity tbCfCoupon) {
return tbCfCouponDao.update(tbCfCoupon);
......
package com.platform.service.impl;
import com.platform.dao.TbCfToiCouponDao;
import com.platform.entity.TbCfCouponIssueEntity;
import com.platform.entity.TbCfToiCouponEntity;
import com.platform.service.TbCfToiCouponService;
import com.platform.utils.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* Service实现类
*
* @author lipengjun
* @date 2019-11-20 19:37:20
*/
@Service("tbCfToiCouponService")
public class TbCfToiCouponServiceImpl implements TbCfToiCouponService {
@Autowired
private TbCfToiCouponDao tbCfToiCouponDao;
@Override
public TbCfToiCouponEntity queryObject(String toitableId) {
return tbCfToiCouponDao.queryObject(toitableId);
}
@Override
public List<TbCfToiCouponEntity> queryList(Map<String, Object> map) {
return tbCfToiCouponDao.queryList(map);
}
@Override
public int queryTotal(Map<String, Object> map) {
return tbCfToiCouponDao.queryTotal(map);
}
@Override
public int save(TbCfToiCouponEntity tbCfToicoupon) {
tbCfToicoupon.setToitableId(IdUtil.createIdbyUUID());
return tbCfToiCouponDao.save(tbCfToicoupon);
}
@Override
public int update(TbCfToiCouponEntity tbCfToicoupon) {
return tbCfToiCouponDao.update(tbCfToicoupon);
}
@Override
public int delete(String toitableId) {
return tbCfToiCouponDao.delete(toitableId);
}
@Override
public int deleteBatch(String[] toitableIds) {
return tbCfToiCouponDao.deleteBatch(toitableIds);
}
@Override
public int saveAndSubmit(TbCfCouponIssueEntity tbCfCouponIssue, TbCfToiCouponEntity tbCfToiCoupon, String userId) {
tbCfToiCoupon.setToitableId(IdUtil.createIdbyUUID());
tbCfToiCoupon.setCouponId(tbCfCouponIssue.getCouponId());
tbCfToiCoupon.setUserId(userId);
tbCfToiCoupon.setCreateTime(new Date());
tbCfToiCoupon.setIdentification(1);
tbCfToiCoupon.setEnableFlag(1);
return tbCfToiCouponDao.saveAndSubmit(tbCfToiCoupon);
}
}
......@@ -47,6 +47,10 @@ public class CouponIssueVo implements Serializable {
*/
private Integer enableFlag;
/**
* 标识(1发放,2领取,3注册)
*/
private Integer identification;
public String getCouponId() {
return couponId;
}
......@@ -110,4 +114,17 @@ public class CouponIssueVo implements Serializable {
public void setEnableFlag(Integer enableFlag) {
this.enableFlag = enableFlag;
}
/**
* 设置:标识(1发放,2领取,3注册)
*/
public void setIdentification(Integer identification) {
this.identification = identification;
}
/**
* 获取:标识(1发放,2领取,3注册)
*/
public Integer getIdentification() {
return identification;
}
}
......@@ -58,7 +58,6 @@
select
a.coupon_id,
a.coupon_category_id ,
b.coupon_category_name ,
a.coupon_use,
a.coupon_title,
a.coupon_icon,
......@@ -78,7 +77,7 @@
a.update_user_id,
a.update_time,
a.coupon_vaild
from tb_cf_coupon a LEFT JOIN tb_cf_coupon_category b on a.coupon_category_id =b.coupon_category_id
from tb_cf_coupon a
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
......@@ -100,7 +99,6 @@
select
a.coupon_id,
a.coupon_category_id ,
b.coupon_category_name ,
a.coupon_use,
a.coupon_title,
a.coupon_icon,
......@@ -120,7 +118,7 @@
a.update_user_id,
a.update_time,
a.coupon_vaild
from tb_cf_coupon a LEFT JOIN tb_cf_coupon_category b on a.coupon_category_id =b.coupon_category_id
from tb_cf_coupon a
WHERE 1=1 and a.coupon_vaild=0
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
......@@ -245,19 +243,21 @@
where
t2.coupon_id=#{couponId} and t3.user_id=t2.user_id and t1.coupon_id=t2.coupon_id
</select>
<!--优惠券领取情况-->
<!--优惠券发放/领取情况-->
<select id="getCouponIssueList" resultType="com.platform.vo.CouponIssueVo">
select
select
t2.coupon_id,
t2.create_time,
t2.enable_flag,
t1.coupon_category_id,
t1.coupon_title,
t1.coupon_icon,
t3.nick,
t3.account
from tb_cf_coupon t1,tb_cf_issue_coupon t2,tb_cf_user_info t3
t3.nick,
t3.account,
t2.identification
from tb_cf_coupon t1
left join tb_cf_toicoupon t2 on t1.coupon_id=t2.coupon_id
left join tb_cf_user_info t3 on t2.user_id=t3.user_id
where
t2.coupon_id=#{couponId} and t3.user_id=t2.user_id and t1.coupon_id=t2.coupon_id
t2.coupon_id=#{couponId}
</select>
</mapper>
\ No newline at end of file
<?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.platform.dao.TbCfToiCouponDao">
<resultMap type="com.platform.entity.TbCfToiCouponEntity" id="tbCfToiCouponMap">
<result property="toitableId" column="toitable_id"/>
<result property="couponId" column="coupon_id"/>
<result property="userId" column="user_id"/>
<result property="createTime" column="create_time"/>
<result property="identification" column="identification"/>
<result property="enableFlag" column="enable_flag"/>
</resultMap>
<select id="queryObject" resultType="com.platform.entity.TbCfToiCouponEntity">
select
`toitable_id`,
`coupon_id`,
`user_id`,
`create_time`,
`identification`,
`enable_flag`
from tb_cf_toicoupon
where toitable_id = #{id}
</select>
<select id="queryList" resultType="com.platform.entity.TbCfToiCouponEntity">
select
`toitable_id`,
`coupon_id`,
`user_id`,
`create_time`,
`identification`,
`enable_flag`
from tb_cf_toicoupon
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
<choose>
<when test="sidx != null and sidx.trim() != ''">
order by ${sidx} ${order}
</when>
<otherwise>
order by toitable_id desc
</otherwise>
</choose>
<if test="offset != null and limit != null">
limit #{offset}, #{limit}
</if>
</select>
<select id="queryTotal" resultType="int">
select count(*) from tb_cf_toicoupon
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
</select>
<insert id="save" parameterType="com.platform.entity.TbCfToiCouponEntity">
insert into tb_cf_toicoupon(
`toitable_id`,
`coupon_id`,
`user_id`,
`create_time`,
`identification`,
`enable_flag`)
values(
#{toitableId},
#{couponId},
#{userId},
#{createTime},
#{identification},
#{enableFlag})
</insert>
<insert id="saveAndSubmit" parameterType="com.platform.entity.TbCfToiCouponEntity">
insert into tb_cf_toicoupon(
`toitable_id`,
`coupon_id`,
`user_id`,
`create_time`,
`identification`,
`enable_flag`)
values(
#{toitableId},
#{couponId},
#{userId},
#{createTime},
#{identification},
#{enableFlag})
</insert>
<update id="update" parameterType="com.platform.entity.TbCfToiCouponEntity">
update tb_cf_toicoupon
<set>
<if test="couponId != null">`coupon_id` = #{couponId}, </if>
<if test="userId != null">`user_id` = #{userId}, </if>
<if test="createTime != null">`create_time` = #{createTime}, </if>
<if test="identification != null">`identification` = #{identification}, </if>
<if test="enableFlag != null">`enable_flag` = #{enableFlag}</if>
</set>
where toitable_id = #{toitableId}
</update>
<delete id="delete">
delete from tb_cf_toicoupon where toitable_id = #{value}
</delete>
<delete id="deleteBatch">
delete from tb_cf_toicoupon where toitable_id in
<foreach item="toitableId" collection="array" open="(" separator="," close=")">
#{toitableId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
......@@ -10,4 +10,4 @@ jdbc.maxActive=30
jdbc.minPoolSize=2
jdbc.maxIdleTime=30000
jdbc.idleConnectionTestPeriod=100
\ No newline at end of file
jdbc.idleConnectionTestPeriod=100
\ No newline at end of file
......@@ -27,9 +27,9 @@
<i-button @click="reloadSearch">重置</i-button>
</div>
<div class="buttons-group">
<i-button type="info" @click="insertcoupon">新增优惠券类型</i-button>
<!--<i-button type="info" @click="insertcoupon">新增优惠券类型</i-button>-->
<!-- <i-button type="info" @click="showTake">查看领取情况</i-button>-->
<i-button type="info" @click="showIssue">查看发放情况</i-button>
<i-button type="info" @click="showToi">查看发放情况</i-button>
<!--<i-button type="info" @click="showUse"><i class="fa fa-plus"></i>&nbsp;查看使用情况</i-button>-->
#if($shiro.hasPermission("tbcfcoupon:save"))
<i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
......@@ -52,10 +52,10 @@
<p slot="title">{{title}}</p>
<i-form ref="formValidate" :model="tbCfCoupon" :rules="ruleValidate" :label-width="80">
<Form-item label="优惠券类型" prop="couponCategoryId">
<i-select placeholder="优惠券类型" v-model="tbCfCoupon.couponCategoryId" @on-change="changeCouponCategory">
<i-select placeholder="优惠券类型" v-model="tbCfCoupon.couponCategoryId">
<i-option
v-for="(el,i) in CouponCategory" :key = 'i'
:value="el.couponCategoryId">{{el.couponCategoryName}}</i-option>
v-for="(el,i) in cateGoryOptions" :key = 'i'
:value="el.value">{{el.label}}</i-option>
</i-select>
</Form-item>
<Form-item label="设置是否为注册就送该优惠券" prop="couponVaild">
......@@ -224,13 +224,14 @@
</el-table>
</el-dialog>
<!-- 发放详情 -->
<el-dialog :title="issueTitle" :visible.sync="issueVisible" width="80%">
<el-table :data="issueData">
<el-dialog :title="toiTitle" :visible.sync="toiVisible" width="80%">
<el-table :data="toiData">
<el-table-column property="couponTitle" label="标题" width="200"></el-table-column>
<el-table-column property="nick" label="用户昵称"></el-table-column>
<el-table-column property="account" label="用户账号"></el-table-column>
<el-table-column property="createTime" label="领取时间"></el-table-column>
<el-table-column property="enableFlag" label="是否已经使用"></el-table-column>
<el-table-column property="enableFlag" label="是否已经使用(0已使用,1未使用)"></el-table-column>
<el-table-column property="identification" label="1发放,2领取,3注册)"></el-table-column>
</el-table>
</el-dialog>
......
......@@ -509,6 +509,27 @@ moneyFormat = function (cellvalue) {
}*/
return '$'+cellvalue;
};
/**
* 优惠券类型翻译
* @param cellvalue
*/
couponFormat = function (cellvalue){
var returnStr="未知"
if(!!cellvalue||cellvalue=='0'){
if(cellvalue=='10'){
returnStr="购物返券";
}else if(cellvalue=='20'){
returnStr="注册返券";
}else if(cellvalue=='30'){
returnStr="邀请返券";
}else if(cellvalue=='40'){
returnStr="用户领券";
}else if(cellvalue=='50'){
returnStr="发放优惠券";
}
}
return returnStr;
};
/**
* 有效无效过期翻译
* @param cellvalue
......
......@@ -3,22 +3,21 @@ $(function () {
url: '../tbcfcoupon/list',
colModel: [
{label: 'couponId', name: 'couponId', index: 'coupon_id', key: true, hidden: true},
{label: '优惠券类型Id ', name: 'couponCategoryId', index: 'couponCategoryId', width: 80 ,hidden:true},
{label: '优惠券类型 ', name: 'couponCategoryName', index: 'couponCategoryName', width: 70 },
{label: '优惠券类型 ', name: 'couponCategoryId', index: 'couponCategory_id', width: 60,formatter: "select", editoptions:{value:"10:购物返券;20:注册返券;30:邀请返券;40:用户领券"}},
{label: '可用于类目', name: 'couponUse', index: 'coupon_use', width: 80, hidden: true},
{label: '优惠券标题', name: 'couponTitle', index: 'coupon_title', width: 80},
{label: '优惠券图片地址', name: 'couponIcon', index: 'coupon_icon', width: 70},
{label: '优惠券图片地址', name: 'couponIcon', index: 'coupon_icon', width: 70, hidden: true},
{label: '那些站点可以使用', name: 'withStationId', index: 'with_station_id', width: 80, hidden: true},
{label: '满多少金额可以使用', name: 'withAmount', index: 'with_amount', width: 80},
{label: '抵扣金额', name: 'deductAmount', index: 'deduct_amount', width: 50},
{label: '发券数量', name: 'quato', index: 'quato', width: 80},
{label: '发券数量', name: 'quato', index: 'quato', width: 50},
{label: '已领取数量', name: 'takeCount', index: 'take_count', width: 80, hidden: true},
{label: '已使用数量', name: 'usedCount', index: 'used_count', width: 80, hidden: true},
{label: '发放开始时间', name: 'startTime', index: 'start_time', width: 80},
{label: '发放结束时间', name: 'endTime', index: 'end_time', width: 80},
{label: '有效开始时间', name: 'validStartTime', index: 'valid_start_time', width: 80},
{label: '有效结束时间', name: 'validEndTime', index: 'valid_end_time', width: 80},
{label: '有效标志', name: 'status', index: 'status', width: 50,formatter:stateFormat},
{label: '有效标志', name: 'status', index: 'status', width: 40,formatter:stateFormat},
{label: '创建人', name: 'createUserId', index: 'create_user_id', width: 80, hidden: true},
{label: '创建时间', name: 'createTime', index: 'create_time', width: 80},
{label: '修改人', name: 'updateUserId', index: 'update_user_id', width: 80, hidden: true},
......@@ -50,13 +49,26 @@ let vm = new Vue({
el: '#rrapp',
data: {
takeVisible:false,
issueVisible:false,
toiVisible:false,
useVisible:false,
takeTitle:"领取详情(已领取数:0)",
issueTitle:"领取详情(已领取数:0)",
toiTitle:"发放/领取详情(数量:0)",
//领取优惠券情况
takeData:[],
issueData:[],
toiData:[],
cateGoryOptions:[{
value:'10',
label:'购物返券'
},{
value:'20',
label:'注册返券'
},{
value:'30',
label:'邀请返券'
},{
value:'40',
label:'用户领券'
}],
userStatusOptions:[{
value:'10',
label:'未下单的用户'
......@@ -128,7 +140,7 @@ let vm = new Vue({
}
},
methods: {
changeCouponCategory(){
/* changeCouponCategory(){
let url = `/africa_shop/tbcfcouponcategory/queryByCouponCategoryId?categoryId=${this.tbCfCoupon.couponCategoryId}`;
console.log('url',url)
let that = this;
......@@ -144,7 +156,7 @@ let vm = new Vue({
}
}
});
},
},*/
query: function () {
vm.reload();
},
......@@ -164,7 +176,7 @@ let vm = new Vue({
vm.getInfo(couponId);
},
saveOrUpdate: function (event) {
let url = vm.tbCfCoupon.couponId == null ? "../tbcfcoupon/save" : "../tbcfcoupon/update";
let url = vm.tbCfCoupon.couponId == null ? "../tbcfcoupon/save" : "../tbcfcoupon/update";
Ajax.request({
url: url,
params: JSON.stringify(vm.tbCfCoupon),
......@@ -243,13 +255,13 @@ let vm = new Vue({
vm.takeVisible = true;
vm.getCouponTakeList(couponId);
},
//获取发放详情
showIssue: function () {
//获取发放/领取详情
showToi: function () {
let couponId = getSelectedRow("#jqGrid");
if (couponId == null) {
return;
}
vm.issueVisible = true;
vm.toiVisible = true;
vm.getCouponIssueList(couponId);
},
//获取优惠券领取情况
......@@ -267,18 +279,18 @@ let vm = new Vue({
}
});
},
//获取优惠券发放情况
//获取优惠券发放/领取情况
getCouponIssueList: function (couponId) {
Ajax.request({
url: "../tbcfcoupon/issue/" + couponId,
async: true,
successCallback: function (r6) {
vm.issueData = r6.list;
vm.toiData = r6.list;
var length=0;
if(!!vm.issueData) {
length=vm.issueData.length;
if(!!vm.toiData) {
length=vm.toiData.length;
}
vm.issueTitle="领取详情(已领取数:"+length+")";
vm.toiTitle="发放/领取详情(数量:"+length+")";
}
});
},
......@@ -291,7 +303,6 @@ let vm = new Vue({
edit: function(){
this.showEdit=false
vm.title = "设置优惠券发放";
vm.reload();
vm.tbCfCoupon = {};
},
......
......@@ -10,7 +10,10 @@ public enum CouponCategoryEnum implements EnumItemable<CouponCategoryEnum> {
SHOP("购物返券", 10),
REGISTER("注册返券", 20),
INVITE("邀请返券", 30);
INVITE("邀请返券", 30),
TAKE("用户领券", 40),
ISSUE("发放优惠券", 50);
private String label;
private Integer value;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论