优惠统计

This commit is contained in:
齐天大圣 2024-05-21 09:50:27 +08:00
parent 9e2a581288
commit 226cab681e
2 changed files with 91 additions and 68 deletions

View File

@ -9,13 +9,13 @@ import com.fuint.business.marketingActivity.favorableRecords.entity.FavorableRec
import com.fuint.business.marketingActivity.favorableRecords.service.FavorableRecordsService; import com.fuint.business.marketingActivity.favorableRecords.service.FavorableRecordsService;
import com.fuint.common.dto.AccountInfo; import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil; import com.fuint.common.util.TokenUtil;
import com.sun.org.apache.bcel.internal.generic.NEW;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* 优惠记录表(FavorableRecords)表服务实现类 * 优惠记录表(FavorableRecords)表服务实现类
@ -55,17 +55,18 @@ public class FavorableRecordsServiceImpl extends ServiceImpl<FavorableRecordsMap
Long deptId = nowAccountInfo.getDeptId(); Long deptId = nowAccountInfo.getDeptId();
LambdaQueryWrapper<FavorableRecords> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<FavorableRecords> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(FavorableRecords::getStoreId, nowAccountInfo.getStoreId()); queryWrapper.eq(FavorableRecords::getStoreId, nowAccountInfo.getStoreId());
queryWrapper.eq(FavorableRecords::getChainStoreId, nowAccountInfo.getChainStoreId()); List<FavorableRecords> list = list(queryWrapper);
if (ObjectUtils.isNotEmpty(favorableRecords.getFavFrom())){ //优惠次数
queryWrapper.eq(FavorableRecords::getFavFrom, favorableRecords.getFavFrom()); objectObjectHashMap.put("count", list.size());
}
if (ObjectUtils.isNotEmpty(favorableRecords.getFavType())){ double allTotalCount = 0.0;
queryWrapper.eq(FavorableRecords::getFavType, favorableRecords.getFavType());
} for (FavorableRecords records : list) {
if (ObjectUtils.isNotEmpty(favorableRecords.getFavConsumptionType())){ allTotalCount += records.getFavMoney();
queryWrapper.eq(FavorableRecords::getFavConsumptionType, favorableRecords.getFavConsumptionType());
} }
objectObjectHashMap.put("allMoney",allTotalCount);
return objectObjectHashMap; return objectObjectHashMap;
} }
} }

View File

@ -18,9 +18,9 @@
</view> </view>
<!-- 储值充值 --> <!-- 储值充值 -->
<view class="boxback" v-if="actinput == 0"> <view class="boxback" v-if="actinput == 0">
<swiper class="swiper" style="width: 100%;height: 70px;" circular <swiper class="swiper" style="width: 100%;height: 70px;" circular :autoplay="autoplay"
:autoplay="autoplay" :interval="interval" :vertical="true" :duration="duration"> :interval="interval" :vertical="true" :duration="duration">
<swiper-item class="conttainer-box" v-for="(item,index) in actList" :key="index"> <swiper-item class="conttainer-box" v-for="(item,index) in actList" :key="index">
<view class="box_s"> <view class="box_s">
{{item.discountActiveDescribe || ''}} {{item.discountActiveDescribe || ''}}
</view> </view>
@ -89,26 +89,42 @@
</view> </view>
<!-- 囤油充值 --> <!-- 囤油充值 -->
<view class="boxback" v-if="actinput == 1"> <view class="boxback" v-if="actinput == 1">
<swiper class="swiper" style="width: 100%;height: 70px;" circular <swiper class="swiper" style="width: 100%;height: 70px;" circular :autoplay="autoplay"
:autoplay="autoplay" :interval="interval" :vertical="true" :duration="duration"> :interval="interval" :vertical="true" :duration="duration">
<swiper-item class="conttainer-box" v-for="(item,index) in cardList" :key="index"> <swiper-item class="conttainer-box" v-for="(item,index) in cardList" :key="index">
<view class="box_s"> <view class="box_s">
{{item.discountActiveDescribe || ''}} {{item.discountActiveDescribe || ''}}
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>
<view class="box-cz" style="margin-top: 20px;"> <view class="box-cz" style="margin-top: 20px;">
<view :class="{ 'actbox' : actindex == index }" v-for="(item,index) in cardFuleList" <view :class="{ 'actbox' : actindex == index }" v-for="(item,index) in cardFuleList" style="display: flex;justify-content: space-around;width: 98%;border-radius: 8px;border: 1px solid #e2e2e2;
style="display: flex;justify-content: space-around;width: 98%;border-radius: 8px;border: 1px solid #e2e2e2; box-sizing: border-box;padding: 10px;margin: 5px;height: 60px;line-height: 18px;" :key="index"
box-sizing: border-box;padding: 10px;margin: 5px;height: 60px;line-height: 18px;" @click="fuleindex(index,item.rechargeBalance,item.points,item.id)">
:key="index" @click="fuleindex(index,item.rechargeBalance,item.points,item.id)"> <view style="font-size: 16px;font-weight: bold;line-height: 40px;"
<view style="font-size: 16px;font-weight: bold;line-height: 40px;" :class="{ 'actsize' : actindex == index }">{{item.oilType}}</view> :class="{ 'actsize' : actindex == index }">{{item.oilType}}</view>
<!-- <view style="font-size: 12px;font-weight: bold;margin: 0 5px;" :class="{ 'actsize' : actindex == index }">:</view> --> <!-- <view style="font-size: 12px;font-weight: bold;margin: 0 5px;" :class="{ 'actsize' : actindex == index }">:</view> -->
<view class="min-size1" :class="{ 'actsize' : actindex == index }"><view>国标油价</view><view>{{item.gbPrice}}/L</view></view> <view class="min-size1" :class="{ 'actsize' : actindex == index }">
<view class="min-size1" :class="{ 'actsize' : actindex == index }"><view>本站油价</view><view>{{item.oilPrice}}/L</view></view> <view>国标油价</view>
<view class="min-size1" :class="{ 'actsize' : actindex == index }"><view>锁价</view><view>{{item.lockupPrice}}/L</view></view> <view>{{item.gbPrice}}/L</view>
<view class="min-size1" :class="{ 'actsize' : actindex == index }"><view>总升数</view><view>{{item.incomeLitres || 0}}L</view></view> </view>
<view class="min-size1" style="color: red;" :class="{ 'actsize' : actindex == index }"><view>总价</view><view>{{item.rechargeBalance}}</view></view> <view class="min-size1" :class="{ 'actsize' : actindex == index }">
<view>本站油价</view>
<view>{{item.oilPrice}}/L</view>
</view>
<view class="min-size1" :class="{ 'actsize' : actindex == index }">
<view>锁价活动价</view>
<view>{{item.lockPrice}}/L</view>
</view>
<view class="min-size1" :class="{ 'actsize' : actindex == index }">
<view>锁价满足金额</view>
<view>{{item.rechargeBalance}}</view>
</view>
<!-- <view class="min-size1" :class="{ 'actsize' : actindex == index }"><view>总升数</view><view>{{item.incomeLitres || 0}}L</view></view> -->
<!-- <view class="min-size1" style="color: red;" :class="{ 'actsize' : actindex == index }">
<view>总价</view>
<view>{{item.rechargeBalance}}</view>
</view> -->
</view> </view>
</view> </view>
<view class="box-hui"> <view class="box-hui">
@ -282,15 +298,16 @@
this.getStaffList() this.getStaffList()
}, },
methods: { methods: {
changeBalance(){ changeBalance() {
if (this.cardValueList.length>0) { if (this.cardValueList.length > 0) {
this.cardValueList.forEach((item,index) => { this.cardValueList.forEach((item, index) => {
console.log(this.balance>=item.rechargeBalance,111); console.log(this.balance >= item.rechargeBalance, 111);
if (this.balance>=item.rechargeBalance){ if (this.balance >= item.rechargeBalance) {
this.xzindex(index,this.balance,item.fringeBenefit,item.giftBalance,item.points,item.growthValue,item.count,item.id); this.xzindex(index, this.balance, item.fringeBenefit, item.giftBalance, item.points,
item.growthValue, item.count, item.id);
} }
}) })
if (this.balance<this.cardValueList[0].rechargeBalance){ if (this.balance < this.cardValueList[0].rechargeBalance) {
this.text = "" this.text = ""
this.shuomingList = [] this.shuomingList = []
} }
@ -298,12 +315,13 @@
}, },
activen() { activen() {
request({ request({
url: 'business/marketingActivity/cardValue/appletList?storeId='+uni.getStorageSync("storeId")+"&&activeStatus=1", url: 'business/marketingActivity/cardValue/appletList?storeId=' + uni.getStorageSync(
"storeId") + "&&activeStatus=1",
method: 'get', method: 'get',
}).then(res => { }).then(res => {
if (res.code == 200) { if (res.code == 200) {
console.log(res,111); console.log(res, 111);
this.actList = res.data this.actList = res.data
} }
}) })
@ -349,14 +367,14 @@
if (res.code == 200) { if (res.code == 200) {
console.log(res, _this.appltType) console.log(res, _this.appltType)
if (_this.appltType == "WECHAT") { if (_this.appltType == "WECHAT") {
if(!res.data.reservedPayInfo){ if (!res.data.reservedPayInfo) {
uni.showToast({ uni.showToast({
title:'支付失败,请联系商家', title: '支付失败,请联系商家',
icon:"none" icon: "none"
}) })
return; return;
} }
let payProvider = "wxpay" let payProvider = "wxpay"
_this.orderInfo = JSON.parse(res.data.reservedPayInfo); _this.orderInfo = JSON.parse(res.data.reservedPayInfo);
uni.requestPayment({ uni.requestPayment({
@ -393,10 +411,10 @@
} }
if (_this.appltType == "ALIPAY") { if (_this.appltType == "ALIPAY") {
if(!res.data.reservedTransactionId){ if (!res.data.reservedTransactionId) {
uni.showToast({ uni.showToast({
title:'支付失败,请联系商家', title: '支付失败,请联系商家',
icon:"none" icon: "none"
}) })
return; return;
} }
@ -433,7 +451,7 @@
}, },
// //
addValueCarRecords() { addValueCarRecords() {
if (this.types==0){ if (this.types == 0) {
if (this.carValueId == '') { if (this.carValueId == '') {
uni.showToast({ uni.showToast({
title: "当前店铺暂未设置电子囤油卡储值优惠,请先联系商家", title: "当前店铺暂未设置电子囤油卡储值优惠,请先联系商家",
@ -441,8 +459,8 @@
}) })
return return
} }
}else{ } else {
if (!this.balance || this.balance<=0) { if (!this.balance || this.balance <= 0) {
uni.showToast({ uni.showToast({
title: "请填写充值金额并确保充值金额大于0", title: "请填写充值金额并确保充值金额大于0",
icon: "error" icon: "error"
@ -450,8 +468,8 @@
return return
} }
} }
let _this = this let _this = this
request({ request({
@ -473,10 +491,10 @@
if (res.code === 200) { if (res.code === 200) {
if (_this.appltType == "WECHAT") { if (_this.appltType == "WECHAT") {
if(!res.data.reservedPayInfo){ if (!res.data.reservedPayInfo) {
uni.showToast({ uni.showToast({
title:'支付失败,请联系商家', title: '支付失败,请联系商家',
icon:"none" icon: "none"
}) })
return; return;
} }
@ -505,20 +523,20 @@
"status": "payFail" "status": "payFail"
}, },
}).then((res) => {}) }).then((res) => {})
uni.showToast({ uni.showToast({
title: "支付失败!", title: "支付失败!",
icon: "error" icon: "error"
}) })
// console.log('fail:', err); // console.log('fail:', err);
} }
}); });
} }
} }
if (_this.appltType == "ALIPAY") { if (_this.appltType == "ALIPAY") {
if(!res.data.reservedTransactionId){ if (!res.data.reservedTransactionId) {
uni.showToast({ uni.showToast({
title:'支付失败,请联系商家', title: '支付失败,请联系商家',
icon:"none" icon: "none"
}) })
return; return;
} }
@ -605,8 +623,10 @@
this.types = index this.types = index
if (index == 0) { if (index == 0) {
// this.getValueCars(); // this.getValueCars();
if (this.cardValueList.length>0) if (this.cardValueList.length > 0)
this.xzindex(0,this.cardValueList[0].rechargeBalance,this.cardValueList[0].fringeBenefit,this.cardValueList[0].giftBalance,this.cardValueList[0].points,this.cardValueList[0].growthValue,this.cardValueList[0].count,this.cardValueList[0].id) this.xzindex(0, this.cardValueList[0].rechargeBalance, this.cardValueList[0].fringeBenefit, this
.cardValueList[0].giftBalance, this.cardValueList[0].points, this.cardValueList[0].growthValue,
this.cardValueList[0].count, this.cardValueList[0].id)
} }
if (index == 1) { if (index == 1) {
// this.getFuelCars(); // this.getFuelCars();
@ -637,7 +657,7 @@
// .growthValue, res.data.records[0] // .growthValue, res.data.records[0]
// .count, res.data.records[0].id) // .count, res.data.records[0].id)
this.cardValueList = res.data this.cardValueList = res.data
console.log(res.data,22); console.log(res.data, 22);
this.xzindex(0, res.data[0].rechargeBalance, res.data[0].fringeBenefit, this.xzindex(0, res.data[0].rechargeBalance, res.data[0].fringeBenefit,
res.data[0].giftBalance, res.data[0].points, res.data[0] res.data[0].giftBalance, res.data[0].points, res.data[0]
.growthValue, res.data[0] .growthValue, res.data[0]
@ -666,11 +686,12 @@
// //
getFuelCarList() { getFuelCarList() {
request({ request({
url: 'business/marketingActivity/cardFuelDiesel/appletList?storeId='+uni.getStorageSync("storeId"), url: 'business/marketingActivity/cardFuelDiesel/appletList?storeId=' + uni.getStorageSync(
"storeId"),
method: 'get', method: 'get',
}).then(res => { }).then(res => {
if (res.code == 200) { if (res.code == 200) {
console.log(res,111); console.log(res, 111);
this.cardList = res.data this.cardList = res.data
} }
}) })
@ -678,7 +699,7 @@
// //
exchangeGift() { exchangeGift() {
request({ request({
url: '/business/marketingActivity/cardGift/exchange?number=' + this.number + "&cardPassword=" + url: '/business/marketingActivity/cardGift/exchange?number=' + this.number + "&cardPassword=" +
this.cardPassword + "&storeId=" + uni.getStorageSync("storeId"), this.cardPassword + "&storeId=" + uni.getStorageSync("storeId"),
method: 'get', method: 'get',
}).then(res => { }).then(res => {
@ -689,7 +710,7 @@
} else { } else {
this.shows = true this.shows = true
this.message = '兑换成功!', this.message = '兑换成功!',
this.money = res.data.cardAmount + '元' this.money = res.data.cardAmount + '元'
this.number = "" this.number = ""
this.cardPassword = "" this.cardPassword = ""
} }
@ -706,7 +727,7 @@
}, },
goRechargeRecords(val) { goRechargeRecords(val) {
uni.navigateTo({ uni.navigateTo({
url: '/pagesMy/Recharge/Recharge?index='+val url: '/pagesMy/Recharge/Recharge?index=' + val
}) })
}, },
// //
@ -872,6 +893,7 @@
//color: #e2e2e2; //color: #e2e2e2;
text-align: center; text-align: center;
} }
.min-size1 { .min-size1 {
font-size: 12px; font-size: 12px;
//color: #e2e2e2; //color: #e2e2e2;
@ -937,4 +959,4 @@
border-radius: 6px; border-radius: 6px;
background: #f4f5f6; background: #f4f5f6;
} }
</style> </style>