礼品卡兑换

This commit is contained in:
齐天大圣 2023-12-08 13:13:21 +08:00
parent 68c0ab29e7
commit 9d1eb21787
6 changed files with 196 additions and 26 deletions

View File

@ -249,12 +249,12 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
cardFavorableLambdaQueryWrapper.eq(CardFavorable::getId,cardFavorableRecord.getCardFavorableId()); cardFavorableLambdaQueryWrapper.eq(CardFavorable::getId,cardFavorableRecord.getCardFavorableId());
//cardFavorableLambdaQueryWrapper.in(CardFavorable::getOilType,transferDTO.getOilName()); //cardFavorableLambdaQueryWrapper.in(CardFavorable::getOilType,transferDTO.getOilName());
cardFavorableLambdaQueryWrapper.le(CardFavorable::getSatisfiedAmount,transferDTO.getOilPrice() * transferDTO.getOilLiters()); cardFavorableLambdaQueryWrapper.le(CardFavorable::getSatisfiedAmount,transferDTO.getOilPrice() * transferDTO.getOilLiters());
OilName oilName = oilNameService.selectOilNameById(transferDTO.getOilName()); //OilName oilName = oilNameService.selectOilNameById(transferDTO.getOilName());
List<CardFavorable> list1 = cardFavorableService.list(cardFavorableLambdaQueryWrapper); List<CardFavorable> list1 = cardFavorableService.list(cardFavorableLambdaQueryWrapper);
if (list1.size()>0) { if (list1.size()>0) {
CardFavorable cardFavorable = list1.get(0); CardFavorable cardFavorable = list1.get(0);
//符合油号判断 //符合油号判断
if (cardFavorable.getOilType().contains(oilName.getOilName())) { if (cardFavorable.getOilType().contains(String.valueOf(transferDTO.getOilName()))) {
if (cardFavorable.getTimeType().equals("0") && if (cardFavorable.getTimeType().equals("0") &&
new Date().getTime() <= cardFavorable.getCreateTime().getTime() + 86400000L * cardFavorable.getValidityZero()) { new Date().getTime() <= cardFavorable.getCreateTime().getTime() + 86400000L * cardFavorable.getValidityZero()) {
BeanUtils.copyProperties(cardFavorable, exchangeFavorableVO); BeanUtils.copyProperties(cardFavorable, exchangeFavorableVO);

View File

@ -95,5 +95,16 @@ public class CardGiftController extends BaseController {
public ResponseObject selectStatistics(@PathVariable Integer storeId) { public ResponseObject selectStatistics(@PathVariable Integer storeId) {
return getSuccessResult(this.cardGiftService.selectStatistics(storeId)); return getSuccessResult(this.cardGiftService.selectStatistics(storeId));
} }
/**
* 礼品卡兑换
*
* @param cardGift 实体对象
* @return 修改结果
*/
@GetMapping("exchange")
public ResponseObject exchange(@Param("cardGift") CardGift cardGift) {
return getSuccessResult(this.cardGiftService.exchange(cardGift));
}
} }

View File

@ -37,5 +37,12 @@ public interface CardGiftService extends IService<CardGift> {
* @return * @return
*/ */
IPage select(Page page, CardGift cardGift); IPage select(Page page, CardGift cardGift);
/**
* 礼品卡兑换
* @param cardGift
* @return
*/
CardGift exchange(CardGift cardGift);
} }

View File

@ -131,5 +131,26 @@ public class CardGiftServiceImpl extends ServiceImpl<CardGiftMapper, CardGift> i
queryWrapper.orderByDesc(CardGift::getCreateTime); queryWrapper.orderByDesc(CardGift::getCreateTime);
return page(page, queryWrapper); return page(page, queryWrapper);
} }
/**
* 礼品卡兑换
* @param cardGift
* @return
*/
@Override
public CardGift exchange(CardGift cardGift) {
LambdaQueryWrapper<CardGift> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(CardGift::getNumber,cardGift.getNumber());
queryWrapper.eq(CardGift::getStatus,"1");
//验证兑换卡的卡密
CardGift one = getOne(queryWrapper);
if (ObjectUtils.isNotEmpty(one) && ObjectUtils.isNotEmpty(cardGift.getCardPassword()) && cardGift.getCardPassword().equals(one.getCardPassword())){
one.setStatus("2");
updateById(one);
return one;
}else {
return cardGift;
}
}
} }

View File

@ -25,6 +25,9 @@
<view class="g-box" v-for="(item,index) in datas" :key="index" v-if="title == '满减营销活动'"> <view class="g-box" v-for="(item,index) in datas" :key="index" v-if="title == '满减营销活动'">
<text>{{item.fullminusActiveDescribe || ""}}</text> <text>{{item.fullminusActiveDescribe || ""}}</text>
</view> </view>
<view class="g-box" v-for="(item,index) in datas" :key="index" v-if="title == '储值卡充值活动'">
<text>{{item.discountActiveDescribe || ""}}</text>
</view>
<view class="g-box" v-if="title == '新人有礼活动'"> <view class="g-box" v-if="title == '新人有礼活动'">
<text>{{datas.newlywedsActiveDescribe || ""}}</text> <text>{{datas.newlywedsActiveDescribe || ""}}</text>
</view> </view>
@ -117,6 +120,17 @@
} }
}) })
} }
if (name == '储值卡充值活动') {
request({
url: '/business/marketingActivity/cardValue/appletList',
method: 'get',
}).then(res => {
if (res.code == 200) {
this.datas = res.data
uni.hideLoading();
}
})
}
}, },

View File

@ -15,7 +15,7 @@
</view> </view>
</view> </view>
<!-- 储值充值 --> <!-- 储值充值 -->
<view class="boxback" v-if="actinput == 0 || actinput == 1 "> <view class="boxback" v-if="actinput == 0">
<view class="box-cz"> <view class="box-cz">
<view class="box-jg" :class="{ 'actbox' : actindex == index }" v-for="(item,index) in cardValueList" <view class="box-jg" :class="{ 'actbox' : actindex == index }" v-for="(item,index) in cardValueList"
:key="index" :key="index"
@ -31,10 +31,6 @@
<view class="huisize" v-for="(item,index) in shuomingList" :key="index"> <view class="huisize" v-for="(item,index) in shuomingList" :key="index">
{{index+1}}.{{item || "" }} {{index+1}}.{{item || "" }}
</view> </view>
<!-- <view class="huisize" v-if="giftBalance">2.赠送金额{{giftBalance}}</view>
<view class="huisize" v-if="points">3.赠送积分{{points}}</view>
<view class="huisize" v-if="growthValue">4.赠送成长值{{growthValue}}</view> -->
<!-- <view class="huisize" v-if="fringeBenefit">{{index + 1}}.{{fringeBenefit}}</view> -->
</view> </view>
<view class="box-gang"> <view class="box-gang">
<view class="">推荐员工</view> <view class="">推荐员工</view>
@ -43,23 +39,105 @@
<uni-icons type="right" size="14"></uni-icons> <uni-icons type="right" size="14"></uni-icons>
</view> </view>
<!-- 底部 -->
<view class="bottom-box">
<view class="anniu">
<text>立即充值</text>
</view>
<view class="dibu">
<view class="">充值记录</view>
<uni-icons type="right" color="#1678ff" size="14"></uni-icons>
</view>
<view class="box-hui">
<view style="margin-bottom: 15px;">服务说明</view>
<view class="huisize">1.该服务为储蓄卡直充服务仅限本站使用</view>
<view class="huisize">2.请确认充值类型正确后再付款一经充值不支持退款 </view>
</view>
</view>
</view> </view>
</view> </view>
<!-- 囤油充值 --> <!-- 囤油充值 -->
<view class="boxback" v-if="actinput == 1">
<view class="box-cz">
<view class="box-jg" :class="{ 'actbox' : actindex == index }" v-for="(item,index) in cardFuleList"
:key="index"
@click="fuleindex(index,item.rechargeBalance,item.points)">
<view class="s-title" :class="{ 'actsize' : actindex == index }">油品:{{item.type}}
</view>
<view class="s-title" :class="{ 'actsize' : actindex == index }">油号:{{item.oilType}}
</view>
<view class="min-size" :class="{ 'actsize' : actindex == index }">单价<text
style="font-weight: bold;"></text>{{item.incomeLitres}}/</view>
<view class="min-size" :class="{ 'actsize' : actindex == index }">总价{{item.rechargeBalance}}
</view>
<view class="min-size" :class="{ 'actsize' : actindex == index }">升数:{{item.incomeLitres}}L
</view>
</view>
</view>
<view class="box-hui">
<view style="margin-bottom: 15px;">充值{{text}}元权益</view>
<view class="huisize" v-for="(item,index) in shuomingFList" :key="index">
{{index+1}}.{{item || "" }}
</view>
</view>
<view class="box-gang">
<view class="">推荐员工</view>
<view class=""></view>
<view class="" @click="show = true">
<uni-icons type="right" size="14"></uni-icons>
</view>
</view>
<!-- 底部 -->
<view class="bottom-box">
<view class="anniu">
<text>立即充值</text>
</view>
<view class="dibu">
<view class="">充值记录</view>
<uni-icons type="right" color="#1678ff" size="14"></uni-icons>
</view>
<view class="box-hui">
<view style="margin-bottom: 15px;">服务说明</view>
<view class="huisize">1.该服务为储蓄卡直充服务仅限本站使用</view>
<view class="huisize">2.请确认充值类型正确后再付款一经充值不支持退款 </view>
</view>
</view>
</view>
<!-- 礼品充值 --> <!-- 礼品充值 -->
<view class="boxback" style="box-sizing: border-box; padding: 1px; " v-if="actinput == 2 "> <view class="boxback" style="box-sizing: border-box; padding: 1px; " v-if="actinput == 2 ">
<view class="inputbox"> <view class="inputbox">
<view class="cadname">卡号</view> <view class="cadname">卡号</view>
<!-- <input type="text" placeholder="请输入礼品卡卡号" /> --> <input type="text" placeholder="请输入礼品卡卡号" />
</view> </view>
<view class="inputbox"> <view class="inputbox">
<view class="cadname">卡密</view> <view class="cadname">卡密</view>
<!-- <input type="text" placeholder="请输入礼品卡卡密" /> --> <input type="text" placeholder="请输入礼品卡卡密" />
</view> </view>
<view class="bottom-box">
<view class="anniu">
<text>立即兑换</text>
</view>
<view class="dibu">
<view class="">兑换记录</view>
<uni-icons type="right" color="#1678ff" size="14"></uni-icons>
</view>
<view class="box-hui">
<view style="margin-bottom: 15px;">服务说明</view>
<view class="huisize">1.该服务为储蓄卡直充服务仅限本站使用</view>
<view class="huisize">2.请确认充值类型正确后再付款一经充值不支持退款 </view>
</view>
</view>
</view> </view>
<!-- 底部 --> <!-- 底部 -->
<view class="bottom-box"> <!-- <view class="bottom-box">
<view class="anniu"> <view class="anniu">
<text>立即充值</text> <text>立即充值</text>
</view> </view>
@ -73,7 +151,7 @@
<view class="huisize">1.该服务为储蓄卡直充服务仅限本站使用</view> <view class="huisize">1.该服务为储蓄卡直充服务仅限本站使用</view>
<view class="huisize">2.请确认充值类型正确后再付款一经充值不支持退款 </view> <view class="huisize">2.请确认充值类型正确后再付款一经充值不支持退款 </view>
</view> </view>
</view> </view>-->
<u-picker :show="show" :columns="columns" @confirm="confirm" @cancel="cancel"></u-picker> <u-picker :show="show" :columns="columns" @confirm="confirm" @cancel="cancel"></u-picker>
@ -83,6 +161,7 @@
<script> <script>
import request from '../../utils/request' import request from '../../utils/request'
import {getValue} from "@dcloudio/uni-ui/lib/uni-forms/utils";
export default { export default {
data() { data() {
return { return {
@ -93,10 +172,16 @@
text: "", text: "",
fringeBenefit: "", fringeBenefit: "",
giftBalance: "", giftBalance: "",
rechargeBalance: "",
incomeLitres: "",
lockupPrice: "",
type: "",
oilType: "",
points: "", points: "",
growthValue: "", growthValue: "",
show: false, show: false,
shuomingList: [], shuomingList: [],
shuomingFList: [],
columns: [ columns: [
['员工一', '员工二', '员工三'] ['员工一', '员工二', '员工三']
], ],
@ -112,6 +197,7 @@
], ],
cardValueList: [], cardValueList: [],
cardFuleList: [],
actinput: 0, actinput: 0,
} }
@ -121,7 +207,7 @@
}, },
onShow() { onShow() {
this.getValueCars(); this.getValueCars();
// this.xzindex(index, text, fringeBenefit, giftBalance, points, growthValue) //this.getFuelCars();
}, },
methods: { methods: {
confirm(e) { confirm(e) {
@ -148,24 +234,35 @@
if (growthValue) { if (growthValue) {
this.shuomingList.push('赠送' + growthValue + '成长值') this.shuomingList.push('赠送' + growthValue + '成长值')
} }
this.actindex = index this.actindex = index
// this.text = text
// this.fringeBenefit = fringeBenefit
// this.giftBalance = giftBalance
// this.points = points
// this.growthValue = growthValue
}, },
fuleindex(index, text, points,) {
this.shuomingFList = []
console.log(this.shuomingFList);
if (text) {
this.text = text
}
if (points) {
this.shuomingFList.push('赠送' + points + '积分')
}
this.actindex = index
},
getindex(index) { getindex(index) {
this.actinput = index this.actinput = index
if (index==0){
this.getValueCars();
}
if (index==1){
this.getFuelCars();
}
}, },
goback() { goback() {
uni.navigateBack() uni.navigateBack()
}, },
//
getValueCars() { getValueCars() {
request({ request({
url: '/business/marketingActivity/cardValue', url: 'business/marketingActivity/cardValue',
method: 'get', method: 'get',
data: { data: {
activeStatus: '1' activeStatus: '1'
@ -177,11 +274,29 @@
this.xzindex(0, this.cardValueList[0].rechargeBalance, this.cardValueList[0].fringeBenefit, this.xzindex(0, this.cardValueList[0].rechargeBalance, this.cardValueList[0].fringeBenefit,
this.cardValueList[0].giftBalance, this.cardValueList[0].points, this this.cardValueList[0].giftBalance, this.cardValueList[0].points, this
.cardValueList[0].growthValue) .cardValueList[0].growthValue)
} }
}) })
} },
//
getFuelCars() {
request({
url: 'business/marketingActivity/cardFuelDiesel',
method: 'get',
data: {
activeStatus: '1'
},
}).then(res => {
this.cardValueList = []
if (res.code == 200) {
this.cardFuleList = res.data.records
this.fuleindex(0, this.cardValueList[0].rechargeBalance, this.cardValueList[0].fringeBenefit,
this.cardFuleList[0].rechargeBalance, this.cardFuleList[0].points, this
.cardFuleList[0].lockupPrice, this
.cardFuleList[0].incomeLitres)
}
})
}
} }
} }
</script> </script>
@ -314,12 +429,14 @@
.s-title { .s-title {
width: 100%; width: 100%;
text-align: center; text-align: center;
font-size: 12px;
font-weight: bold;
} }
.min-size { .min-size {
width: 100%; width: 100%;
font-size: 12px; font-size: 10px;
color: e2e2e2; //color: #e2e2e2;
text-align: center; text-align: center;
} }