This commit is contained in:
cun-nan 2024-09-24 15:14:23 +08:00
parent 33caa53b65
commit ae6c9ef867
11 changed files with 268 additions and 47 deletions

View File

@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser;
import com.fuint.business.marketingActivity.cardCoupon.service.CardCouponUserService;
import com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponUserVo;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.web.bind.annotation.*;
@ -88,5 +89,13 @@ public class CardCouponUserController extends BaseController {
public ResponseObject delete(@RequestParam("idList") List<Long> idList) {
return getSuccessResult(this.cardCouponUserService.removeByIds(idList));
}
@GetMapping("queryPage")
public ResponseObject queryPage(CardCouponUserVo cardCouponUserVo,
@RequestParam(value = "page",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize) {
Page page =new Page(pageNo,pageSize);
return getSuccessResult(cardCouponUserService.queryPage(page, cardCouponUserVo));
}
}

View File

@ -1,7 +1,10 @@
package com.fuint.business.marketingActivity.cardCoupon.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.cardCoupon.entity.CardCouponUser;
import com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponUserVo;
import com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -27,5 +30,13 @@ public interface CardCouponUserMapper extends BaseMapper<CardCouponUser> {
* @return java.util.List<com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponVO>
**/
List<CardCouponVO> selectAllList(@Param("storeId") Integer storeId,@Param("userId") Integer userId,@Param("nowDate") String nowDate);
/**
* 小程序查询优惠券列表信息
* @param page
* @param cardCouponUserVo
* @return
*/
IPage<CardCouponUserVo> queryPage(Page page,@Param("entity") CardCouponUserVo cardCouponUserVo);
}

View File

@ -16,4 +16,17 @@
AND cc.`type` != '2'
AND main.start_time &lt;= #{nowDate} AND main.end_time &gt;= #{nowDate}
</select>
<select id="queryPage" resultType="com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponUserVo">
SELECT ccu.*,cc.`name` couponName,cc.type,cc.use_condition FROM card_coupon_user ccu
LEFT JOIN card_coupon cc ON ccu.card_coupon_id = cc.id
<where>
ccu.mt_user_id = #{entity.mtUserId}
<if test="entity.storeId != null and entity.storeId != ''">
and ccu.store_id = #{entity.storeId}
</if>
<if test="entity.status != null and entity.status != ''">
and ccu.status = #{entity.status}
</if>
</where>
</select>
</mapper>

View File

@ -1,7 +1,10 @@
package com.fuint.business.marketingActivity.cardCoupon.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.cardCoupon.entity.CardCouponUser;
import com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponUserVo;
import com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponVO;
import io.swagger.models.auth.In;
@ -33,5 +36,13 @@ public interface CardCouponUserService extends IService<CardCouponUser> {
* @return java.util.List<com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponVO>
**/
List<CardCouponVO> selectAllList(Integer storeId, Integer userId, Date nowDate);
/**
* 小程序分页查询优惠券信息列表
* @param page
* @param cardCouponUserVo
* @return
*/
IPage<CardCouponUserVo> queryPage(Page page,CardCouponUserVo cardCouponUserVo);
}

View File

@ -3,13 +3,18 @@ package com.fuint.business.marketingActivity.cardCoupon.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
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.cardCoupon.entity.CardCoupon;
import com.fuint.business.marketingActivity.cardCoupon.mapper.CardCouponUserMapper;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser;
import com.fuint.business.marketingActivity.cardCoupon.service.CardCouponService;
import com.fuint.business.marketingActivity.cardCoupon.service.CardCouponUserService;
import com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponUserVo;
import com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponVO;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -29,27 +34,29 @@ public class CardCouponUserServiceImpl extends ServiceImpl<CardCouponUserMapper,
private CardCouponService cardCouponService;
@Autowired
private CardCouponUserMapper cardCouponUserMapper;
/**
* 判断用户是否还能领取该优惠卷
*
* @param couponId 优惠卷id
* @param userId 用户主键
* @param userId 用户主键
* @return true false 不能
*/
@Override
public boolean userCanGet(Integer couponId, Integer userId) {
CardCoupon cardCoupon = cardCouponService.getById(couponId);
if (cardCoupon.getTfTotal()<=cardCoupon.getTfGetNum()){
if (cardCoupon.getTfTotal() <= cardCoupon.getTfGetNum()) {
//领取数量大于策略中的送出总量
return false;
return false;
}
String nowDate = DateUtil.format(new Date(), "yyyy-MM-dd");
LambdaQueryWrapper<CardCouponUser> queryWrapper =new LambdaQueryWrapper<>();
queryWrapper.eq(CardCouponUser::getCardCouponId,couponId).eq(CardCouponUser::getMtUserId,userId);
LambdaQueryWrapper<CardCouponUser> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(CardCouponUser::getCardCouponId, couponId).eq(CardCouponUser::getMtUserId, userId);
List<CardCouponUser> list = this.list(queryWrapper);
if (CollectionUtil.isEmpty(list)){
list =new ArrayList<>();
if (CollectionUtil.isEmpty(list)) {
list = new ArrayList<>();
}
if (list.size()>=cardCoupon.getGetNumLimit()){
if (list.size() >= cardCoupon.getGetNumLimit()) {
//当前用户领取已到达上限
return false;
}
@ -72,7 +79,71 @@ public class CardCouponUserServiceImpl extends ServiceImpl<CardCouponUserMapper,
**/
@Override
public List<CardCouponVO> selectAllList(Integer storeId, Integer userId, Date nowDate) {
return cardCouponUserMapper.selectAllList(storeId,userId, DateUtil.formatDate(nowDate));
return cardCouponUserMapper.selectAllList(storeId, userId, DateUtil.formatDate(nowDate));
}
@Override
public IPage<CardCouponUserVo> queryPage(Page page, CardCouponUserVo cardCouponUserVo) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
cardCouponUserVo.setMtUserId(nowAccountInfo.getId());
IPage<CardCouponUserVo> cardCouponUserVoIPage = baseMapper.queryPage(page, cardCouponUserVo);
for (CardCouponUserVo record : cardCouponUserVoIPage.getRecords()) {
// 未使用
if (record.getStatus().equals("0")) {
if (record.getType().equals("1")) {
record.setBgImg("http://47.94.122.58:83/coup1.png");
}
if (record.getType().equals("2")) {
record.setBgImg("http://47.94.122.58:83/coup5.png");
}
if (record.getType().equals("3")) {
record.setBgImg("http://47.94.122.58:83/coup2.png");
}
if (record.getType().equals("4")) {
record.setBgImg("http://47.94.122.58:83/coup3.png");
}
if (record.getType().equals("5")) {
record.setBgImg("http://47.94.122.58:83/coup4.png");
}
}
// 已核销
if (record.getStatus().equals("1")) {
if (record.getType().equals("1")) {
record.setBgImg("http://47.94.122.58:83/youp1.png");
}
if (record.getType().equals("2")) {
record.setBgImg("http://47.94.122.58:83/youp5.png");
}
if (record.getType().equals("3")) {
record.setBgImg("http://47.94.122.58:83/youp2.png");
}
if (record.getType().equals("4")) {
record.setBgImg("http://47.94.122.58:83/youp3.png");
}
if (record.getType().equals("5")) {
record.setBgImg("http://47.94.122.58:83/youp4.png");
}
}
// 已过期
if (record.getStatus().equals("2")) {
if (record.getType().equals("1")) {
record.setBgImg("http://47.94.122.58:83/qoup1.png");
}
if (record.getType().equals("2")) {
record.setBgImg("http://47.94.122.58:83/qoup5.png");
}
if (record.getType().equals("3")) {
record.setBgImg("http://47.94.122.58:83/qoup2.png");
}
if (record.getType().equals("4")) {
record.setBgImg("http://47.94.122.58:83/qoup3.png");
}
if (record.getType().equals("5")) {
record.setBgImg("http://47.94.122.58:83/qoup4.png");
}
}
}
return cardCouponUserVoIPage;
}
}

View File

@ -0,0 +1,26 @@
package com.fuint.business.marketingActivity.cardCoupon.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser;
import lombok.Data;
@Data
public class CardCouponUserVo extends CardCouponUser {
/**
* 优惠券名称
*/
private String couponName;
/**
* 卡券类型 1代金券2兑换券3折扣券4油品立减券5单品代金券
*/
private String type;
/**
* 使用条件
*/
private String useCondition;
/**
* 背景图
*/
@TableField(exist = false)
private String bgImg;
}

View File

@ -7,24 +7,29 @@
<view class="my-icons"></view>
</view>
<!-- 顶部区域 -->
<view class="box-xianze" v-for="(item,index) in dataList" :key="index">
<view class="box-left" @click="choose(item)">
<view class="box-xianze" v-for="(item,index) in 3" :key="index">
<view class="" @click="choose(item)">
<view style="display: flex;align-items: center;margin-bottom: 5px;">
<view v-if="item.ifDefault == 1" class="tapl">默认</view>
<view class="">{{item.address}}</view>
</view>
<view style="display: flex;align-items: center; font-size: 14px; color: #666666;">
<view class=""> {{item.name}}</view>
<view class=""> {{item.mobile}}</view>
<view class="">{{item.address || '地址'}}</view>
<view class=""> {{item.name || '名称'}}</view>
<view class=""> {{item.mobile || '手机号'}}</view>
</view>
</view>
<view class="box-right" @click="goedit(item)">
<u-icon name="edit-pen-fill" size="22"></u-icon>
<view class="box-xia">
<view class="box-left">
<u-checkbox v-model="checked" shape="circle" label="默认信息"></u-checkbox>
</view>
<view class="box-right" @click="goedit(item)">
<u-icon name="edit-pen-fill" size="12"></u-icon>
<view>编辑</view>
<u-icon name="trash" size="12"></u-icon>
<view>删除</view>
</view>
</view>
</view>
<view class="bottom-anniu" @click="goedit()">
<view class="">新增收货地址</view>
<view class="">新增预留信息</view>
</view>
</view>
@ -40,7 +45,7 @@
return {
title: '',
dataList: '',
checked: false,
}
},
onShow() {
@ -122,18 +127,18 @@
.bottom-anniu {
width: 90%;
height: 50px;
height: 40px;
display: flex;
align-items: center;
background: #1678ff;
background: #FF9655;
color: white;
justify-content: center;
position: fixed;
bottom: 15px;
bottom: 40px;
left: 50%;
transform: translateX(-50%);
border-radius: 8px;
border-radius: 50px;
}
@ -143,20 +148,17 @@
margin: 10px auto;
padding: 10px;
box-sizing: border-box;
display: flex;
justify-content: space-between;
}
.box-left {
width: 85%;
}
.box-left {}
.box-right {
width: 15px;
width: 60%;
display: flex;
align-items: center;
justify-content: center;
justify-content: space-between;
font-size: 14px;
color: #333333;
}
.tapl {
@ -170,4 +172,10 @@
border: 1px solid #1678ff;
font-size: 14px;
}
.box-xia {
display: flex;
justify-content: space-between;
margin-top: 20px;
}
</style>

View File

@ -34,18 +34,18 @@
<view class="hui-time">
<view style="color: #FC1708; font-size: 14px;">
<span
v-if="item.exchangeMethod == '积分' || item.exchangeMethod == '积分+金额' || item.exchangeMethod == '积分+加钱购'">{{item.exchangePoints}}</span>
v-if="item.exchangeMethod == '积分' || item.exchangeMethod == '积分+金额' || item.exchangeMethod == '积分+加钱购'">{{item.exchangePoints}}积分</span>
<span v-if="item.exchangeMethod == '积分+金额'">+</span>
<span
v-if="item.exchangeMethod == '金额' || item.exchangeMethod == '积分+金额'">{{item.exchangeAmount}}</span>
<span>积分</span>
<!-- <span>积分</span> -->
</view>
</view>
<view style="display: flex;align-items: center;justify-content: space-between;">
<view class="hui_">
3.5
{{item.market || 0}}
</view>
<view class="anniux">
<text v-if="!item.remainingInventory || item.remainingInventory==0"
@ -109,7 +109,7 @@
methods: {
transferIndex(index, categoryId) {
this.qhindex = index
if (categoryId == undefined || categoryId == null) {
if (!categoryId) {
this.query.categoryId = ''
} else {
this.query.categoryId = categoryId
@ -139,6 +139,9 @@
}).then((res) => {
if (res.code == 200) {
this.integralGiftList = res.data.records
console.log(res.data, 142);
}else{
this.integralGiftList = []
}
})
},
@ -493,4 +496,4 @@
color: #999;
text-decoration: line-through
}
</style>
</style>

View File

@ -6,13 +6,14 @@
<view class="">积分余额</view>
<view class="d-s">{{cardBalance.points || 0}}<u-icon name="arrow-right"></u-icon> </view>
</view>
<view class="f-box" v-for="(item,index) in 3" :key="index" @click="goDetails()">
<view class="f-top">中建锦绣二期站可用</view>
<view class="f-box" v-for="(item,index) in integralGiftList" :key="index" @click="goDetails(item)">
<view class="f-top">{{item.storeName}}可用</view>
<view class="f-bs">
<image src="../../static/logo.png" style="width: 60px; height: 60px; "></image>
<image v-if="item.coverImage" :src="baseUrl+item.coverImage" mode="aspectFit" style="width: 60px; height: 60px; "></image>
<image v-else src="../../static/logo.png" style="width: 60px; height: 60px; "></image>
<view class="r-box">
<view class="">
<view class="m_">虚拟</view>
<view class="m_">{{item.giftName}}</view>
<view class="p_">300ml瓶装</view>
<view class="q_">兑换券</view>
</view>
@ -26,15 +27,21 @@
</view>
</view>
</view>
<u-empty v-if="integralGiftList.length == 0" style="margin: 5px auto;" mode="data"
icon="http://cdn.uviewui.com/uview/empty/data.png">
</u-empty>
</view>
</view>
</template>
<script>
import config from '@/config'
import request from '../../utils/request'
export default {
data() {
return {
baseUrl: config.baseUrl,
query: {
chainStoreId: '',
couponType: '',
@ -43,13 +50,66 @@
pageSize: 10
},
cardBalance: {},
queryParam: {
storeId: uni.getStorageSync('storeId'),
status: '启用',
categoryId: '',
giftName: '',
deliveryMethod: '',
page: 1,
pageSize: 30
},
integralGiftList:[],
total:0
}
},
onPullDownRefresh() {
//
this.queryParam = {
storeId: uni.getStorageSync('storeId'),
status: '启用',
categoryId: '',
giftName: '',
deliveryMethod: '',
page: 1,
pageSize: 30
}
this.getIntegralGiftList()
uni.stopPullDownRefresh()
},
onReachBottom() {
//
if (this.queryParam.page >= this.total) {
uni.showToast({
title: '没有下一页数据',
icon: 'none'
})
} else {
this.queryParam.page++
this.getIntegralGiftList()
}
},
onShow() {
this.query.chainStoreId = uni.getStorageSync('chainStoreId');
this.getUserBalance()
this.getIntegralGiftList()
},
methods: {
//
getIntegralGiftList() {
request({
url: 'business/integral/integralGift/queryByPageByStoreId',
method: 'get',
params: this.queryParam
}).then((res) => {
if (res.code == 200) {
this.integralGiftList = res.data.records
this.total = res.data.total
console.log(res,100);
}
})
},
//
getUserBalance() {
request({
@ -67,7 +127,7 @@
url: '/pagesMy/integral/integral'
})
},
goDetails() {
goDetails(data) {
uni.navigateTo({
url: '/pagesHome/PointsRedemption/details'
})

View File

@ -12,13 +12,20 @@
</view>
<view class="bai-box">
<view class="box-title">{{goodsInfo.giftName}}</view>
<view class="price_num">100积分</view>
<view class="price_num">
<span
v-if="goodsInfo.exchangeMethod == '积分' || goodsInfo.exchangeMethod == '积分+金额' || goodsInfo.exchangeMethod == '积分+加钱购'">{{goodsInfo.exchangePoints}}积分</span>
<span v-if="goodsInfo.exchangeMethod == '积分+金额'">+</span>
<span
v-if="goodsInfo.exchangeMethod == '金额' || goodsInfo.exchangeMethod == '积分+金额'">{{goodsInfo.exchangeAmount}}</span>
</view>
<view class="dt-box">
<view class="hui_">
3.5
{{goodsInfo.market}}
</view>
<view class="or_size">
门店自提
<view class="or_size" v-if="goodsInfo.deliveryMethod">
{{JSON.parse(goodsInfo.deliveryMethod)}}
</view>
</view>
</view>
@ -64,6 +71,7 @@
}
})
uni.$emit('un')
console.log(this.goodsInfo,67);
},
methods: {

View File

@ -163,6 +163,7 @@
}
})
uni.$emit('un')
console.log(this.goodsInfo,166);
// storeId
this.getInfoByStoreId()
},