小程序我的券
This commit is contained in:
parent
273f13cae9
commit
e00b708435
@ -2,9 +2,9 @@ package com.fuint.business.marketingActivity.cardFavorable.controller;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.fuint.business.marketingActivity.cardFavorable.dto.CardFavorableDTO;
|
import com.fuint.business.marketingActivity.cardFavorable.dto.CardFavorableDTO;
|
||||||
|
import com.fuint.business.marketingActivity.cardFavorable.dto.CardFavorableDTOS;
|
||||||
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable;
|
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable;
|
||||||
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService;
|
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService;
|
||||||
import com.fuint.framework.web.BaseController;
|
import com.fuint.framework.web.BaseController;
|
||||||
@ -60,7 +60,7 @@ public class CardFavorableController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 新增数据
|
* 新增数据
|
||||||
*
|
*
|
||||||
* @param cardFavorable 实体对象
|
* @param cardFavorableDTO 实体对象
|
||||||
* @return 新增结果
|
* @return 新增结果
|
||||||
*/
|
*/
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@ -89,5 +89,21 @@ public class CardFavorableController extends BaseController {
|
|||||||
public ResponseObject delete(@RequestParam("idList") List<Long> idList) {
|
public ResponseObject delete(@RequestParam("idList") List<Long> idList) {
|
||||||
return getSuccessResult(this.cardFavorableService.removeByIds(idList));
|
return getSuccessResult(this.cardFavorableService.removeByIds(idList));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*查询优惠券接口(小程序端)
|
||||||
|
* @param pageNo
|
||||||
|
* @param pageSize
|
||||||
|
* @param cardFavorable
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("applet")
|
||||||
|
public ResponseObject selectAllByCondition(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
|
||||||
|
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
|
||||||
|
@Param("cardFuelDiesel") CardFavorableDTOS cardFavorableDTOS) {
|
||||||
|
Page page = new Page(pageNo, pageSize);
|
||||||
|
return getSuccessResult(this.cardFavorableService.selectAllByCondition(page,cardFavorableDTOS));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.fuint.business.marketingActivity.cardFavorable.dto;
|
||||||
|
|
||||||
|
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CardFavorableDTOS extends CardFavorable implements Serializable {
|
||||||
|
|
||||||
|
private String couponType;
|
||||||
|
private Integer useStatus;
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.fuint.business.marketingActivity.cardFavorable.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class QueryDTO implements Serializable {
|
||||||
|
//券名称
|
||||||
|
private String couponName;
|
||||||
|
}
|
@ -1,9 +1,14 @@
|
|||||||
package com.fuint.business.marketingActivity.cardFavorable.mapper;
|
package com.fuint.business.marketingActivity.cardFavorable.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.fuint.business.marketingActivity.cardFavorable.dto.CardFavorableDTOS;
|
||||||
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
|
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
|
||||||
|
import com.fuint.business.marketingActivity.cardFavorable.vo.CouponVO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (CardFavorableRecord)表数据库访问层
|
* (CardFavorableRecord)表数据库访问层
|
||||||
@ -18,5 +23,11 @@ public interface CardFavorableRecordMapper extends BaseMapper<CardFavorableRecor
|
|||||||
*/
|
*/
|
||||||
HashMap<String,Integer> selectTotal(@Param("storeId")Integer storeId,@Param("id")Integer id);
|
HashMap<String,Integer> selectTotal(@Param("storeId")Integer storeId,@Param("id")Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询优惠券接口(小程序)
|
||||||
|
* @param cardFavorableDTOS
|
||||||
|
*/
|
||||||
|
// List<CouponVO> selectAllByCondition(Integer id);
|
||||||
|
IPage<CouponVO> selectAllByCondition(@Param("page") Page page, @Param("cardFavorableDTOS") CardFavorableDTOS cardFavorableDTOS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,5 +22,55 @@
|
|||||||
where store_id = #{storeId}
|
where store_id = #{storeId}
|
||||||
and card_favorable_id = #{id}
|
and card_favorable_id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAllByCondition" resultType="com.fuint.business.marketingActivity.cardFavorable.vo.CouponVO">
|
||||||
|
SELECT
|
||||||
|
card_favorables.couponType,
|
||||||
|
card_favorables.couponName,
|
||||||
|
card_favorables.id,
|
||||||
|
card_favorables.couponAmount,
|
||||||
|
card_favorables.couponContent
|
||||||
|
from
|
||||||
|
(SELECT
|
||||||
|
'优惠券' AS couponType,
|
||||||
|
cf.NAME couponName ,cf.id id,cf.discount_amount couponAmount,cf.satisfied_amount couponContent
|
||||||
|
FROM
|
||||||
|
card_favorable cf
|
||||||
|
LEFT JOIN card_favorable_record cfr ON cf.id = cfr.card_favorable_id
|
||||||
|
WHERE
|
||||||
|
cfr.mt_user_id = #{cardFavorableDTOS.id} UNION ALL
|
||||||
|
SELECT
|
||||||
|
'兑换券' AS couponType,
|
||||||
|
ce.NAME couponName, ce.id id, ce.count couponAmount, ce.use_instructions couponContent
|
||||||
|
FROM
|
||||||
|
card_exchange_record cer
|
||||||
|
LEFT JOIN card_exchange ce ON cer.card_exchange_id = ce.id
|
||||||
|
WHERE
|
||||||
|
cer.mt_user_id = #{cardFavorableDTOS.id}
|
||||||
|
and ce.type = 0 UNION ALL
|
||||||
|
SELECT
|
||||||
|
'洗车券' AS couponType,
|
||||||
|
ce.NAME couponName, ce.id id, ce.count couponAmount, ce.use_instructions couponContent
|
||||||
|
FROM
|
||||||
|
card_exchange_record cer
|
||||||
|
LEFT JOIN card_exchange ce ON cer.card_exchange_id = ce.id
|
||||||
|
WHERE
|
||||||
|
cer.mt_user_id = #{cardFavorableDTOS.id}
|
||||||
|
and ce.type = 1 UNION ALL
|
||||||
|
SELECT
|
||||||
|
'洗车卡' AS couponType,
|
||||||
|
ce.NAME couponName, ce.id id, ce.count couponAmount, ce.use_instructions couponContent
|
||||||
|
FROM
|
||||||
|
card_exchange_record cer
|
||||||
|
LEFT JOIN card_exchange ce ON cer.card_exchange_id = ce.id
|
||||||
|
WHERE
|
||||||
|
cer.mt_user_id = #{cardFavorableDTOS.id}
|
||||||
|
and ce.type = 2) AS card_favorables
|
||||||
|
<where>
|
||||||
|
<if test="cardFavorableDTOS.couponType != null">
|
||||||
|
and card_favorables.couponType = #{cardFavorableDTOS.couponType}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.fuint.business.marketingActivity.cardFavorable.dto.CardFavorableDTO;
|
import com.fuint.business.marketingActivity.cardFavorable.dto.CardFavorableDTO;
|
||||||
|
import com.fuint.business.marketingActivity.cardFavorable.dto.CardFavorableDTOS;
|
||||||
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable;
|
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable;
|
||||||
import com.fuint.business.marketingActivity.cardFavorable.vo.CardFavorableVO;
|
import com.fuint.business.marketingActivity.cardFavorable.vo.CardFavorableVO;
|
||||||
|
|
||||||
@ -45,5 +46,13 @@ public interface CardFavorableService extends IService<CardFavorable> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Boolean updateOneById(CardFavorableDTO cardFavorableDTO);
|
Boolean updateOneById(CardFavorableDTO cardFavorableDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询优惠券接口(小程序)
|
||||||
|
* @param page
|
||||||
|
* @param cardFavorable
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
IPage selectAllByCondition(Page page, CardFavorableDTOS cardFavorableDTOS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,11 +5,15 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.fuint.business.marketingActivity.cardFavorable.dto.CardFavorableDTO;
|
import com.fuint.business.marketingActivity.cardFavorable.dto.CardFavorableDTO;
|
||||||
|
import com.fuint.business.marketingActivity.cardFavorable.dto.CardFavorableDTOS;
|
||||||
import com.fuint.business.marketingActivity.cardFavorable.mapper.CardFavorableMapper;
|
import com.fuint.business.marketingActivity.cardFavorable.mapper.CardFavorableMapper;
|
||||||
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable;
|
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable;
|
||||||
|
import com.fuint.business.marketingActivity.cardFavorable.mapper.CardFavorableRecordMapper;
|
||||||
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService;
|
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService;
|
||||||
import com.fuint.business.marketingActivity.cardFavorable.vo.CardFavorableVO;
|
import com.fuint.business.marketingActivity.cardFavorable.vo.CardFavorableVO;
|
||||||
|
import com.fuint.business.marketingActivity.cardFavorable.vo.CouponVO;
|
||||||
import com.fuint.business.store.service.StoreService;
|
import com.fuint.business.store.service.StoreService;
|
||||||
|
import com.fuint.common.dto.AccountInfo;
|
||||||
import com.fuint.common.util.TokenUtil;
|
import com.fuint.common.util.TokenUtil;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
@ -17,6 +21,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (CardFavorable)表服务实现类
|
* (CardFavorable)表服务实现类
|
||||||
@ -29,6 +34,8 @@ public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, C
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private StoreService storeService;
|
private StoreService storeService;
|
||||||
|
@Resource
|
||||||
|
private CardFavorableRecordMapper cardFavorableRecordMapper;
|
||||||
/**
|
/**
|
||||||
* 新增数据
|
* 新增数据
|
||||||
* @param cardFavorableDTO
|
* @param cardFavorableDTO
|
||||||
@ -143,5 +150,21 @@ public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, C
|
|||||||
}
|
}
|
||||||
return updateById(cardFavorable);
|
return updateById(cardFavorable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询优惠券接口(小程序)
|
||||||
|
* @param page
|
||||||
|
* @param cardFavorable
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IPage selectAllByCondition(Page page, CardFavorableDTOS cardFavorableDTOS) {
|
||||||
|
//获取登录用户id
|
||||||
|
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||||
|
Integer id = nowAccountInfo.getId();
|
||||||
|
cardFavorableDTOS.setId(id);
|
||||||
|
IPage<CouponVO> couponVOS = cardFavorableRecordMapper.selectAllByCondition(page,cardFavorableDTOS);
|
||||||
|
return couponVOS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.fuint.business.marketingActivity.cardFavorable.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CouponVO implements Serializable {
|
||||||
|
//券id
|
||||||
|
private Integer id;
|
||||||
|
//券类型
|
||||||
|
private String couponType;
|
||||||
|
//券金额
|
||||||
|
private String couponAmount;
|
||||||
|
//券名称
|
||||||
|
private String couponName;
|
||||||
|
//券内容
|
||||||
|
private String couponContent;
|
||||||
|
//使用状态 0:未使用 1:已使用 2:已失效
|
||||||
|
private String useStatus;
|
||||||
|
//券有效期
|
||||||
|
private String couponTime;
|
||||||
|
//券开始时间
|
||||||
|
private String startTime;
|
||||||
|
//券结束时间
|
||||||
|
private String endTime;
|
||||||
|
}
|
@ -16,14 +16,14 @@
|
|||||||
<view class="">{{item.name}}</view>
|
<view class="">{{item.name}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="card-box" v-for="(item,index) in 3" :key="index">
|
<view class="card-box" v-for="(item,index) in cardsList" :key="index">
|
||||||
<view class="left-img">
|
<view class="left-img">
|
||||||
<view class="huiz">¥120</view>
|
<view class="huiz">¥{{item.couponAmount}}</view>
|
||||||
<view class="cbai">优惠券</view>
|
<view class="cbai">{{item.couponType}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="right-box">
|
<view class="right-box">
|
||||||
<view class="title">新用户专享5折券</view>
|
<view class="title">{{item.couponName}}</view>
|
||||||
<view class="hui-size">部分产品可用、满240可用、此券定期可用...</view>
|
<view class="hui-size">{{item.couponContent}}</view>
|
||||||
<view class="dis-bt">
|
<view class="dis-bt">
|
||||||
<view class="hui-size">有效期:2023-11-30</view>
|
<view class="hui-size">有效期:2023-11-30</view>
|
||||||
<view class="anniu">
|
<view class="anniu">
|
||||||
@ -39,9 +39,18 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import request from "../../utils/request";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
cardsList: [],
|
||||||
|
query: {
|
||||||
|
couponType: '',
|
||||||
|
useStatus: 0,
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10
|
||||||
|
},
|
||||||
title: '',
|
title: '',
|
||||||
tabindex: 0,
|
tabindex: 0,
|
||||||
tapList: [{
|
tapList: [{
|
||||||
@ -71,16 +80,48 @@
|
|||||||
|
|
||||||
components: {
|
components: {
|
||||||
|
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.getGiftRecords()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
click(item) {
|
click(item) {
|
||||||
console.log('item', item);
|
console.log('item', item);
|
||||||
|
|
||||||
|
this.cardsList = []
|
||||||
|
if (item.name == "全部") {
|
||||||
|
this.query.couponType = ''
|
||||||
|
this.getGiftRecords()
|
||||||
|
} else {
|
||||||
|
this.query.couponType = item.name
|
||||||
|
console.log(this.query.couponType);
|
||||||
|
this.getGiftRecords()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
gettabingex(index) {
|
gettabingex(index) {
|
||||||
|
// useStatus
|
||||||
this.tabindex = index
|
this.tabindex = index
|
||||||
|
console.log(index);
|
||||||
|
this.cardsList = []
|
||||||
|
this.query.useStatus = index
|
||||||
|
this.getGiftRecords()
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
goback() {
|
goback() {
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
|
},
|
||||||
|
getGiftRecords() {
|
||||||
|
request({
|
||||||
|
url: 'business/marketingActivity/cardFavorable/applet',
|
||||||
|
method: 'get',
|
||||||
|
params: this.query
|
||||||
|
}).then(res => {
|
||||||
|
console.log(res)
|
||||||
|
if (res.code == 200) {
|
||||||
|
this.cardsList = res.data.records
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -222,4 +263,4 @@
|
|||||||
background: #ecf5ff !important;
|
background: #ecf5ff !important;
|
||||||
color: #8179ff;
|
color: #8179ff;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
Loading…
Reference in New Issue
Block a user