核销记录

This commit is contained in:
齐天大圣 2023-12-15 17:41:25 +08:00
parent 407af8365e
commit 79e2d77212
12 changed files with 372 additions and 21 deletions

View File

@ -1,6 +1,7 @@
package com.fuint.business.marketingActivity.cardExchange.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardExchange.dto.CardExchangeRecordDTO;
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchangeRecord;
import com.fuint.business.marketingActivity.cardExchange.service.CardExchangeRecordService;
import com.fuint.framework.web.BaseController;
@ -58,6 +59,21 @@ public class CardExchangeRecordController extends BaseController {
return getSuccessResult(this.cardExchangeRecordService.selectIsUsed(page,cardExchangeRecord));
}
/**
* 核销记录小程序端
* @param pageNo
* @param pageSize
* @param cardExchangeRecordDTO
* @return
*/
@GetMapping("selectCancelRecords")
public ResponseObject selectCancelRecords(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("cardFuelDiesel") CardExchangeRecordDTO cardExchangeRecordDTO) {
Page page = new Page(pageNo, pageSize);
return getSuccessResult(this.cardExchangeRecordService.selectCancelRecords(page,cardExchangeRecordDTO));
}
/**
* 通过主键查询单条数据
*

View File

@ -0,0 +1,12 @@
package com.fuint.business.marketingActivity.cardExchange.dto;
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchangeRecord;
import lombok.Data;
import java.io.Serializable;
@Data
public class CardExchangeRecordDTO extends CardExchangeRecord implements Serializable {
//卡券类型
private String cardType;
}

View File

@ -1,7 +1,12 @@
package com.fuint.business.marketingActivity.cardExchange.mapper;
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.cardExchange.dto.CardExchangeRecordDTO;
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchangeRecord;
import com.fuint.business.marketingActivity.cardExchange.vo.CardExchangeRecordVO;
import org.apache.ibatis.annotations.Param;
/**
* 兑换券领取记录表(CardExchangeRecord)表数据库访问层
@ -11,5 +16,12 @@ import com.fuint.business.marketingActivity.cardExchange.entity.CardExchangeReco
*/
public interface CardExchangeRecordMapper extends BaseMapper<CardExchangeRecord> {
/**
* 核销记录小程序端
* @param page
* @param cardExchangeRecordDTO
* @return
*/
IPage<CardExchangeRecordVO> selectCancelRecords(@Param("page") Page page, @Param("cardExchangeRecordDTO") CardExchangeRecordDTO cardExchangeRecordDTO);
}

View File

@ -0,0 +1,53 @@
<?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.fuint.business.marketingActivity.cardExchange.mapper.CardExchangeRecordMapper">
<select id="selectCancelRecords" resultType="com.fuint.business.marketingActivity.cardExchange.vo.CardExchangeRecordVO">
SELECT
card_favorables.couponType cardType,
card_favorables.couponName cardName,
card_favorables.id id,
card_favorables.updateTime updateTime,
card_favorables.couponContent cardContent
from
(SELECT
'兑换券' AS couponType,
ce.NAME couponName, ce.id id, ce.count couponAmount, ce.use_instructions couponContent,cer.update_time updateTime
FROM
card_exchange_record cer
LEFT JOIN card_exchange ce ON cer.card_exchange_id = ce.id
WHERE
cer.mt_user_id = #{cardExchangeRecordDTO.mtUserId}
and cer.store_id = #{cardExchangeRecordDTO.storeId}
and cer.status = 1
and ce.type = 0 UNION ALL
SELECT
'洗车券' AS couponType,
ce.NAME couponName, ce.id id, ce.count couponAmount, ce.use_instructions couponContent,cer.update_time updateTime
FROM
card_exchange_record cer
LEFT JOIN card_exchange ce ON cer.card_exchange_id = ce.id
WHERE
cer.mt_user_id = #{cardExchangeRecordDTO.mtUserId}
and cer.store_id = #{cardExchangeRecordDTO.storeId}
and cer.status = 1
and ce.type = 1 UNION ALL
SELECT
'洗车卡' AS couponType,
ce.NAME couponName, ce.id id, ce.count couponAmount, ce.use_instructions couponContent,cer.update_time updateTime
FROM
card_exchange_record cer
LEFT JOIN card_exchange ce ON cer.card_exchange_id = ce.id
WHERE
cer.mt_user_id = #{cardExchangeRecordDTO.mtUserId}
and cer.store_id = #{cardExchangeRecordDTO.storeId}
and cer.status = 1
and ce.type = 2) AS card_favorables
<where>
<if test="cardExchangeRecordDTO.cardType != null and cardExchangeRecordDTO.cardType != ''">
and card_favorables.couponType = #{cardExchangeRecordDTO.cardType}
</if>
</where>
</select>
</mapper>

View File

@ -3,7 +3,11 @@ package com.fuint.business.marketingActivity.cardExchange.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.marketingActivity.cardExchange.dto.CardExchangeRecordDTO;
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchangeRecord;
import com.fuint.business.marketingActivity.cardExchange.vo.CardExchangeRecordVO;
import java.util.List;
/**
* 兑换券领取记录表(CardExchangeRecord)表服务接口
@ -28,5 +32,13 @@ public interface CardExchangeRecordService extends IService<CardExchangeRecord>
* @return
*/
IPage selectIsUsed(Page page, CardExchangeRecord cardExchangeRecord);
/**
* 核销记录小程序端
* @param page
* @param cardExchangeRecord
* @return
*/
IPage<CardExchangeRecordVO> selectCancelRecords (Page page, CardExchangeRecordDTO cardExchangeRecordDTO);
}

View File

@ -4,15 +4,18 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.marketingActivity.cardExchange.dto.CardExchangeRecordDTO;
import com.fuint.business.marketingActivity.cardExchange.mapper.CardExchangeRecordMapper;
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchangeRecord;
import com.fuint.business.marketingActivity.cardExchange.service.CardExchangeRecordService;
import com.fuint.business.marketingActivity.cardExchange.vo.CardExchangeRecordVO;
import com.fuint.business.store.service.StoreService;
import com.fuint.common.util.TokenUtil;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 兑换券领取记录表(CardExchangeRecord)表服务实现类
@ -24,6 +27,8 @@ import javax.annotation.Resource;
public class CardExchangeRecordServiceImpl extends ServiceImpl<CardExchangeRecordMapper, CardExchangeRecord> implements CardExchangeRecordService {
@Resource
private StoreService storeService;
@Resource
private CardExchangeRecordMapper cardExchangeRecordMapper;
/**
* 分页查询
* @param page
@ -90,5 +95,18 @@ public class CardExchangeRecordServiceImpl extends ServiceImpl<CardExchangeRecor
queryWrapper.orderByDesc(CardExchangeRecord::getCreateTime);
return page(page, queryWrapper);
}
/**
* 核销记录小程序端
* @param page
* @param cardExchangeRecordDTO
* @return
*/
@Override
public IPage<CardExchangeRecordVO> selectCancelRecords(Page page, CardExchangeRecordDTO cardExchangeRecordDTO) {
cardExchangeRecordDTO.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
cardExchangeRecordDTO.setMtUserId(TokenUtil.getNowAccountInfo().getId());
return cardExchangeRecordMapper.selectCancelRecords(page,cardExchangeRecordDTO);
}
}

View File

@ -0,0 +1,19 @@
package com.fuint.business.marketingActivity.cardExchange.vo;
import lombok.Data;
import java.io.Serializable;
@Data
public class CardExchangeRecordVO implements Serializable {
//id
private Integer id;
//卡券类型
private String cardType;
//卡券名称
private String cardName;
//卡券内容
private String cardContent;
//兑换时间
private String updateTime;
}

View File

@ -23,23 +23,23 @@
<view class="my-top-box">
<view class="jg-box" @click="gomony()">
<view class="jg-box-title">储值余额</view>
<view class="jg-box-nmb">0.00</view>
<view class="jg-box-nmb">{{cardBalance}}</view>
</view>
<text style="color: #999999;">|</text>
<view class="jg-box" @click="gooil()">
<view class="jg-box-title">囤油升数</view>
<view class="jg-box-nmb">0.00</view>
<view class="jg-box-nmb">{{refuelMoney[0].refuelMoney}}</view>
</view>
<text style="color: #999999;">|</text>
<view class="jg-box" @click="toCoupons">
<view class="jg-box-title">卡券</view>
<view class="jg-box-nmb">0</view>
<view class="jg-box-nmb">{{cardsList.length}}</view>
</view>
<text style="color: #999999;">|</text>
<view class="jg-box" style="border: none;" @click="gointegral()">
<view class="jg-box-title">我的积分</view>
<view class="jg-box-nmb">0</view>
<view class="jg-box-nmb">{{myPoints}}</view>
</view>
</view>
</view>
@ -158,10 +158,16 @@
</view>
</template>
<script>
import request from "../../utils/request";
import tabbar from "../../components/tabbar/tabbar.vue"
export default {
data() {
return {
chainStoreId: uni.getStorageSync('chainStoreId'),
myPoints: 0,
cardsList: [],
refuelMoney: [],
cardBalance: 0.00,
title: '',
msg: "3",
@ -171,6 +177,11 @@
components: {
tabbar
},
onShow() {
this.getUserBalance();
this.getGiftRecords();
this.getUserInfoList()
},
methods: {
gomyorder(id) {
uni.navigateTo({
@ -247,6 +258,44 @@
url: '/pagesMy/feedback/feedback'
})
},
getUserBalance() {
request({
url: '/business/userManager/user/getUserBalance',
method: 'get',
}).then(res => {
console.log(res)
if (res.code == 200) {
this.cardBalance = res.data.cardBalance,
this.refuelMoney = JSON.parse(res.data.refuelMoney);
}
})
},
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
}
})
},
//
getUserInfoList() {
request({
url: '/business/userManager/user/getByUniApp',
method: 'get',
params: {
chainStoreId: this.chainStoreId
}
}).then((res) => {
if (res.code == 200) {
this.myPoints = res.data.points
}
})
},
toCoupons() {
uni.navigateTo({
url: '/pagesMy/Coupons/Coupons'
@ -360,7 +409,7 @@
}
.jg-box-nmb {
font-size: 18px;
font-size: 12px;
font-weight: bold;
}

View File

@ -321,7 +321,7 @@
},
goRechargeRecords() {
uni.navigateTo({
url: '/pagesHome/RechargeRecords/RechargeRecords'
url: '/pagesMy/Recharge/Recharge'
})
},
//

View File

@ -10,7 +10,7 @@
<view class="top-box">
<view class="kuangbox">使用规则 </view>
<view class="box-title">储值余额</view>
<view class="box-nmb">0.00</view>
<view class="box-nmb">{{cardBalance}}</view>
<view class="dis-bt">
<view class="">累计获得0.00</view>
<view class="">已经抵用0.00</view>
@ -18,7 +18,7 @@
</view>
<view class="box-gang">
<view class="">明细</view>
<view class="hui-anniu">全部 <u-icon name="arrow-down-fill" size="18"></u-icon> </view>
<!-- <view class="hui-anniu">全部 <u-icon name="arrow-down-fill" size="18"></u-icon> </view> -->
</view>
<view class="fuji">
@ -52,9 +52,11 @@
</template>
<script>
import request from "../../utils/request";
export default {
data() {
return {
cardBalance: 0.00,
title: '',
@ -63,6 +65,9 @@
components: {
},
onShow() {
this.getUserBalance()
},
methods: {
godetails() {
@ -70,6 +75,17 @@
url: '/pagesMy/details/details'
})
},
getUserBalance() {
request({
url: '/business/userManager/user/getUserBalance',
method: 'get',
}).then(res => {
console.log(res)
if (res.code == 200) {
this.cardBalance = res.data.cardBalance
}
})
},
goback() {
uni.navigateBack()
}

View File

@ -7,19 +7,19 @@
<view class="my-icons"></view>
</view>
<!-- 顶部区域 -->
<view class="top-box">
<view class="top-box" v-for="(item,index) in refuelMoney" :key="index">
<view class="kuangbox">使用规则 </view>
<view class="box-title">囤油升数</view>
<view class="box-nmb">0.00</view>
<view class="dis-bt">
<view class="box-nmb">{{item.type}} : {{item.oilType}}</view>
<view class="box-nmb">剩余升数: {{item.refuelMoney}}</view>
<!-- <view class="dis-bt">
<view class="">累计获得0.00</view>
<view class="">已经抵用0.00</view>
</view>
</view> -->
</view>
<view class="box-gang">
<view class="">明细</view>
<view class="hui-anniu">全部 <u-icon name="arrow-down-fill" size="18"></u-icon> </view>
<!-- <view class="hui-anniu">全部 <u-icon name="arrow-down-fill" size="18"></u-icon> </view> -->
</view>
<view class="fuji">
@ -53,9 +53,11 @@
</template>
<script>
import request from "../../utils/request";
export default {
data() {
return {
refuelMoney: [],
title: '',
@ -64,10 +66,25 @@
components: {
},
onShow() {
this.getUserBalance()
},
methods: {
goback() {
uni.navigateBack()
},
getUserBalance() {
request({
url: '/business/userManager/user/getUserBalance',
method: 'get',
}).then(res => {
console.log(res)
if (res.code == 200) {
this.cardBalance = res.data.cardBalance,
this.refuelMoney = JSON.parse(res.data.refuelMoney);
}
})
}
}
}

View File

@ -8,11 +8,41 @@
</view>
<!-- 顶部区域 -->
<view class="tap-top">
<view class="tap-box" :class="{ 'act' : tindex == index }" v-for="(item,index) in tapList" :key="index"
@click="tapindex(index)">
@click="tapindex(index,item.text)">
<view class="">{{ item.text }}</view>
<view class="gang" :class="{ 'lan' : tindex == index }"></view>
</view>
</view>
<view class="ail" v-if="cardsList.length != 0 ">
<view class="box-order" v-for="(item,index) in cardsList" :key="index">
<view class="or-box-top">
<view class="chengg" style="font-weight: bold;">兑换券</view>
</view>
<view class="but-box">
<view class="huis">卡类型</view>
<view class="">{{item.cardType || "暂无"}}</view>
</view>
<view class="but-box">
<view class="huis">核销卡名</view>
<view class="reds">{{item.cardName || "暂无"}}</view>
</view>
<view class="but-box">
<view class="huis">卡券内容</view>
<view class="reds">{{item.cardContent || "暂无"}}</view>
</view>
<view class="but-box">
<view class="huis">兑换时间</view>
<view class="">{{item.updateTime || "暂无"}}</view>
</view>
</view>
</view>
<u-empty v-if="list.length == 0 " mode="coupon" text="内容为空"
@ -24,20 +54,27 @@
</template>
<script>
import request from "../../utils/request";
export default {
data() {
return {
cardsList: [],
query: {
cardType: '',
pageNo: 1,
pageSize: 10
},
title: '',
tindex: 0,
list: [],
tapList: [{
text: "洗车券"
},
{
text: "兑换券"
},
{
text: "商家券"
text: "洗车券"
},
{
text: "洗车卡"
},
]
@ -47,15 +84,36 @@
components: {
},
onShow() {
this.getGiftRecords()
},
methods: {
tapindex(index) {
tapindex(index, item) {
this.cardsList = []
this.tindex = index
this.query.cardType = item
this.getGiftRecords()
},
getGiftRecords() {
request({
url: '/business/marketingActivity/cardExchangeRecord/selectCancelRecords',
method: 'get',
params: this.query
}).then(res => {
console.log(res)
if (res.code == 200) {
this.cardsList = res.data.records
console.log(cardsList)
}
})
},
goback() {
uni.navigateBack()
}
}
},
}
</script>
@ -92,6 +150,15 @@
top: 0px;
}
.but-box {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
margin: 5px 0px;
}
.tap-top {
width: 100%;
height: 50px;
@ -123,4 +190,64 @@
.lan {
background: #0000ff;
}
.box-order {
width: 95%;
border-radius: 8px;
background: #ffffff;
box-sizing: border-box;
padding: 10px;
margin: 10px auto;
}
.or-box-top {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 5px 0px;
border-bottom: 1px solid #e5e5e5;
}
.chengg {
color: #1678ff;
}
.but-box {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
margin: 5px 0px;
}
.reds {
color: red;
}
.huis {
color: #666666;
}
.end-box {
width: 100%;
display: flex;
align-items: center;
justify-content: flex-end;
}
.anniu {
width: 70px;
height: 25px;
background-color: #1678ff;
color: #ffffff;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
border-radius: 15px;
}
</style>