From b840bd3e99562536aebe94a3fc43d7a604482e0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BD=90=E5=A4=A9=E5=A4=A7=E5=9C=A3?= <17615834396@163.com> Date: Tue, 16 Jan 2024 16:08:41 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=BF=87=E6=BB=A4=E5=95=86=E5=93=81?= =?UTF-8?q?=E5=88=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/xml/CardFavorableRecordMapper.xml | 11 ++++++----- .../marketingActivity/cardFavorable/vo/CouponVO.java | 2 ++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/mapper/xml/CardFavorableRecordMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/mapper/xml/CardFavorableRecordMapper.xml index c5aaf483d..3439694e2 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/mapper/xml/CardFavorableRecordMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/mapper/xml/CardFavorableRecordMapper.xml @@ -63,11 +63,12 @@ card_favorables.couponAmount, card_favorables.couponContent, card_favorables.cardRecordId, - card_favorables.endTime + card_favorables.endTime, + card_favorables.exclusiveFunction from (SELECT '优惠券' AS couponType, - cf.NAME couponName ,cf.id id,cf.discount_amount couponAmount,cf.satisfied_amount couponContent,cfr.id cardRecordId, cfr.end_time endTime + cf.NAME couponName ,cf.id id,cf.discount_amount couponAmount,cf.satisfied_amount couponContent,cfr.id cardRecordId, cfr.end_time endTime, cf.exclusive_function exclusiveFunction FROM card_favorable cf LEFT JOIN card_favorable_record cfr ON cf.id = cfr.card_favorable_id @@ -78,7 +79,7 @@ and cf.type != 1 UNION ALL SELECT '兑换券' AS couponType, - ce.NAME couponName, ce.id id, ce.count couponAmount, ce.use_instructions couponContent,cer.id cardRecordId, cer.out_time endTime + ce.NAME couponName, ce.id id, ce.count couponAmount, ce.use_instructions couponContent,cer.id cardRecordId, cer.out_time endTime, ce.qr_code_link exclusiveFunction FROM card_exchange_record cer LEFT JOIN card_exchange ce ON cer.card_exchange_id = ce.id @@ -89,7 +90,7 @@ and cer.store_id = #{cardFavorableDTOS.storeId} UNION ALL SELECT '洗车券' AS couponType, - ce.NAME couponName, ce.id id, ce.count couponAmount, ce.use_instructions couponContent,cer.id cardRecordId, cer.out_time endTime + ce.NAME couponName, ce.id id, ce.count couponAmount, ce.use_instructions couponContent,cer.id cardRecordId, cer.out_time endTime, ce.qr_code_link exclusiveFunction FROM card_exchange_record cer LEFT JOIN card_exchange ce ON cer.card_exchange_id = ce.id @@ -100,7 +101,7 @@ and cer.store_id = #{cardFavorableDTOS.storeId} UNION ALL SELECT '洗车卡' AS couponType, - ce.NAME couponName, ce.id id, ce.count couponAmount, ce.use_instructions couponContent,cer.id cardRecordId, cer.out_time endTime + ce.NAME couponName, ce.id id, ce.count couponAmount, ce.use_instructions couponContent,cer.id cardRecordId, cer.out_time endTime, ce.qr_code_link exclusiveFunction FROM card_exchange_record cer LEFT JOIN card_exchange ce ON cer.card_exchange_id = ce.id diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/vo/CouponVO.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/vo/CouponVO.java index bd6f9170c..845978241 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/vo/CouponVO.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/vo/CouponVO.java @@ -14,6 +14,8 @@ public class CouponVO implements Serializable { private Integer cardRecordId; //券类型 private String couponType; + //互斥功能 0:满减活动 1:储值卡付款 + private String exclusiveFunction; //券金额 private String couponAmount; //券名称 From 1321922b30833ab0075edc9be8fcf8526ab0f2df Mon Sep 17 00:00:00 2001 From: cun-nan <19819293608@163.com> Date: Tue, 16 Jan 2024 16:10:03 +0800 Subject: [PATCH 2/2] bug --- .../pagesRefuel/orderDetail/index.vue | 177 ++++++++++++++---- 1 file changed, 144 insertions(+), 33 deletions(-) diff --git a/gasStation-uni/pagesRefuel/orderDetail/index.vue b/gasStation-uni/pagesRefuel/orderDetail/index.vue index d484ed2dd..23b79610c 100644 --- a/gasStation-uni/pagesRefuel/orderDetail/index.vue +++ b/gasStation-uni/pagesRefuel/orderDetail/index.vue @@ -38,15 +38,6 @@ - - - 囤油卡 - (余额:{{refuelBalance}}L) - - - - {{oilCardRedece}}L - - @@ -54,7 +45,32 @@ (主卡余额:¥{{user.cardBalance}}) - -¥{{balanceRedece}} + + -¥{{balanceRedece}} + + + + + + + + + + + + + 囤油卡 + (余额:{{refuelBalance}}L) + + + + - {{oilCardRedece}}L + + + + + + @@ -64,19 +80,33 @@ - -¥{{fullRedece}} + + -¥{{fullRedece}} + + + + + + - + @@ -84,7 +114,14 @@ - -¥{{gradeRedece}} + + -¥{{gradeRedece}} + + + + + + 无优惠 @@ -189,6 +226,8 @@ isGradePreferential:false, // 是否存在可使用的满减或折扣优惠 isFullPreferential:false, + // 是否存在可使用的优惠券 + isCoupons:false, transferDTO:{ type:0, amount:0, @@ -198,11 +237,24 @@ }, fixingLevel:{}, isUseChildCard:false, + cardsList:[], + query: { + storeId: uni.getStorageSync("storeId"), + couponType: '', + useStatus: 0, + pageNo: 1, + pageSize: 10 + }, + checkBalance:false, + checkOilCard:false, + checkFull:false, + checkCoupon:false, + checkGrade:false, } }, onLoad(e) { this.orderNo = e.orderNo - // this.orderNo = "234520240113160238a6efad" + // this.orderNo = "2345202401161204280406d3" }, onShow() { this.getOilOrder(); @@ -211,13 +263,52 @@ }, methods: { + // 选择储值卡 + changeBalance(val){ + console.log("balance",this.checkBalance,val); + }, + // 选择囤油卡 + changeOilCard(val){ + console.log("oilcard",this.checkBalance,val); + if (val){ + // this.payAmount = this.deductAmount - this.gradeRedece + } + }, + // 选择满减或折扣 + changeFull(val){ + console.log("balance",this.checkBalance,val); + if (val){ + this.payAmount = this.deductAmount - this.fullRedece + }else{ + this.payAmount = this.deductAmount + } + }, + // 选择优惠券 + changeCoupon(val){ + console.log("balance",this.checkBalance,val); + if (val){ + this.payAmount = this.deductAmount - this.couponRedece + }else{ + this.payAmount = this.deductAmount + } + }, + // 选择会员等级 + changeGrade(val){ + console.log("balance",this.checkBalance,val); + if (val){ + this.payAmount = this.deductAmount - this.gradeRedece + }else{ + this.payAmount = this.deductAmount + } + }, + // 支付接口 payment(){ let map = { orderNo : this.orderNo, payAmount : this.payAmount, // payAmount : "0.01", - discountAmount : this.fullRedece+this.gradeRedece+this.couponRedece, + discountAmount : (this.fullRedece*100+this.gradeRedece*100+this.couponRedece*100)/100, oilCardAmount : JSON.stringify(this.refuelMoneyAfter), oilCardLiters : this.oilCardRedece, balanceAmount : this.balanceRedece, @@ -232,7 +323,6 @@ method: 'post', data: map, }).then(res => { - // console.log(res,_this.appltType) let payProvider = "wxpay" if (_this.appltType== "WECHAT"){ payProvider = "wxpay" @@ -244,9 +334,7 @@ url: "/business/allOrderInfo/orderStatus", method: 'post', data: {"orderNo":_this.orderNo,"status":"payFail"}, - }).then((ress)=>{ - console.log(ress); - }) + }).then((ress)=>{}) uni.showToast({ title:res.data.error, icon:"none" @@ -321,10 +409,13 @@ // 查看是否有可使用的囤油卡 chooseRefuelMoney(){ + console.log("oilCard"); let falg = false; for(let i = 0;i0 ){ + falg = true + } this.refuelBalance = this.refuelMoney[i].refuelMoney if (this.refuelMoney[i].refuelMoney>0){ this.isOilStorageCard = true @@ -335,23 +426,26 @@ }else{ this.oilCardRedece = this.refuelMoney[i].refuelMoney this.refuelMoneyAfter[i].refuelMoney = 0 - this.chooseCardBalance(1) + if (falg) { + this.chooseCardBalance(1) + } } } } if (falg == false) { this.chooseCardBalance(0) - this.chooseGrade(this.user.id,this.user.gradeId) + // this.chooseGrade(this.user.id,this.user.gradeId) } }, // 查看是否有可使用的储值卡金额 chooseCardBalance(val){ + console.log("balance"); if (this.user.cardBalance>0) { this.isStoreValueCard = true; if (val == 0) { // 没有使用囤油卡 - if (this.user.cardBalance >= this.oilOrder.orderAmount){ - this.balanceRedece = this.oilOrder.orderAmount + if (this.user.cardBalance >= (this.oilOrder.orderAmount - this.couponRedece)){ + this.balanceRedece = this.oilOrder.orderAmount - this.couponRedece } else { this.balanceRedece = this.user.cardBalance this.deductAmount = (this.oilOrder.orderAmount*100-this.balanceRedece*100)/100 @@ -380,6 +474,7 @@ }, // 查看是否有可使用的会员等级优惠 chooseGrade(userId,gradeId){ + console.log("userGrade"); let that = this; request({ url: "business/userManager/userGrade/isUse", @@ -676,6 +771,7 @@ }, // 查看是否有可使用的优惠活动 chooseFullOrCoupon(){ + console.log("full"); this.transferDTO.amount = this.deductAmount this.transferDTO.mtUserLevel = this.userGrade.id this.transferDTO.oilId = this.oilId @@ -685,7 +781,6 @@ method: 'post', data:_this.transferDTO, }).then((res) => { - // console.log(res) if (res.data.amount>0){ _this.payAmount = res.data.amount - _this.gradeRedece _this.fullRedece = res.data.favorableAmount @@ -693,10 +788,28 @@ } }) }, + // 查看是否有可使用的优惠券 + chooseCoupons(){ + console.log("coupons"); + request({ + url: 'business/marketingActivity/cardFavorable/applet', + method: 'get', + params: this.query + }).then(res => { + if (res.data.records) { + console.log(res.data.records); + this.cardsList = res.data.records + if (this.cardsList.length>0){ + this.couponRedece = this.cardsList[0].couponAmount + } + } + }) + }, // 计算用户应付金额 countPayMent(){ - this.payAmount = this.deductAmount - this.gradeRedece - this.fullRedece - this.couponRedece; + this.payAmount = this.deductAmount; + console.log("111",this.deductAmount, this.gradeRedece, this.fullRedece, this.couponRedece); }, // 根据店铺id查询用户信息 @@ -714,15 +827,14 @@ } _this.user = res.data.userVo; _this.user = res.data.userVo; - // console.log(res.data.userVo.refuelMoney); - if (res.data.userVo.refuelMoney!=null && res.data.userVo.refuelMoney!=""){ + if (res.data.userVo.refuelMoney){ _this.refuelMoney = JSON.parse(res.data.userVo.refuelMoney) _this.refuelMoneyAfter = JSON.parse(res.data.userVo.refuelMoney) _this.chooseRefuelMoney() }else{ _this.chooseCardBalance(0) - _this.chooseGrade(res.data.userVo.gradeId) } + _this.chooseGrade(res.data.userVo.id,res.data.userVo.gradeId) }) }, // 获取油品订单 @@ -735,12 +847,12 @@ orderNo: _this.orderNo }, }).then((res) => { - // console.log(res) if(res.data!=null){ _this.oilOrder = res.data _this.getStaffList(res.data.staffId) _this.getStore(res.data.storeId) _this.getOilNumber(res.data.storeId) + _this.chooseCoupons() _this.getUser(res.data.userId) } }) @@ -776,7 +888,6 @@ method: 'get', }).then((res) => { res.data.forEach(item => { - // console.log(item); if (item.oilName == _this.oilOrder.oils) { _this.oilPrice = item.gbPrice; _this.oilName = item.oilNames;