From af1a1a25f097f0655f4845b85bd57802c97b7f8d Mon Sep 17 00:00:00 2001 From: cun-nan <19819293608@163.com> Date: Sat, 20 Jan 2024 18:11:29 +0800 Subject: [PATCH] bug --- .../entity/ActiveDiscountRecords.java | 4 + .../impl/ActiveExchangeServiceImpl.java | 13 +- .../activeExchange/vo/PaymentActiveVO.java | 4 + .../entity/ActiveFullminusRecords.java | 4 + .../CardFavorableRecordController.java | 2 +- .../impl/CardFavorableRecordServiceImpl.java | 16 +- .../src/api/cashier/preferential.js | 9 + .../views/cashier/NewComponents/homeindex.vue | 378 ++++++++++-------- .../pagesRefuel/orderDetail/index.vue | 43 +- 9 files changed, 272 insertions(+), 201 deletions(-) diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscountRecords/entity/ActiveDiscountRecords.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscountRecords/entity/ActiveDiscountRecords.java index 935c9c588..6560d9951 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscountRecords/entity/ActiveDiscountRecords.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeDiscountRecords/entity/ActiveDiscountRecords.java @@ -1,6 +1,9 @@ package com.fuint.business.marketingActivity.activeDiscountRecords.entity; import java.util.Date; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.extension.activerecord.Model; import java.io.Serializable; @@ -13,6 +16,7 @@ import java.io.Serializable; @SuppressWarnings("serial") public class ActiveDiscountRecords extends Model { //主键id + @TableId(type = IdType.AUTO) private Integer id; //活动id private Integer activeDiscountId; diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java index dc55aee1e..cc2758c3c 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java @@ -456,11 +456,15 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { List activeFuletVOLists = oilOrderMapper.selectActiveFules(storeId,paymentActiveDTO.getAmount(),paymentActiveDTO.getOilId(),paymentActiveDTO.getMtUserLevel()); activeFuletVOList.addAll(activeFuletVOLists); //优惠券 + if (ObjectUtils.isNotEmpty(paymentActiveDTO.getUserId())){ + userId = paymentActiveDTO.getUserId(); + } paymentActiveDTO.setUserId(userId); + List canUserCardFavorableList = cardFavorableRecordMapper.getCanUserCardFavorableList(paymentActiveDTO); //如果是储值卡付款,直接过滤掉 if(paymentActiveDTO.getType().equals("0")){ - canUserCardFavorableList = canUserCardFavorableList.stream().filter(cardFavorableRecordVO -> cardFavorableRecordVO.getExclusiveFunction().equals("1")) + canUserCardFavorableList = canUserCardFavorableList.stream().filter(cardFavorableRecordVO -> cardFavorableRecordVO.getExclusiveFunction().equals("0")) .collect(Collectors.toList()); } //会员等级当前优惠力度最大 @@ -616,8 +620,10 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { activeDiscountPayVOS.add(activeDiscountPayVO2); } //3.活动和活动+优惠券的组合比较 - if (CollectionUtils.isNotEmpty(activeDiscountPayVOS)){ - ActiveDiscountPayVO activeDiscountPayVO3 = activeDiscountPayVOS.stream().max(Comparator.comparingDouble(ActiveDiscountPayVO::getDiscounts)).get(); + ActiveDiscountPayVO activeDiscountPayVO3 = new ActiveDiscountPayVO(); + if (CollectionUtils.isNotEmpty(activeDiscountPayVOS)) { + activeDiscountPayVO3 = activeDiscountPayVOS.stream().max(Comparator.comparingDouble(ActiveDiscountPayVO::getDiscounts)).get(); + } //4. 3和优惠券比较 if(ObjectUtils.isNotEmpty(activeDiscountPayVO3)){ finalAmount = activeDiscountPayVO3.getDiscounts(); @@ -646,7 +652,6 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { //return paymentActiveVO2; } } - } //会员等级优惠 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/vo/PaymentActiveVO.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/vo/PaymentActiveVO.java index 65c8f2555..1beb4c41e 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/vo/PaymentActiveVO.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/vo/PaymentActiveVO.java @@ -9,6 +9,10 @@ import java.math.BigDecimal; public class PaymentActiveVO implements Serializable { //活动id private Integer activeId; + //活动id + private Integer storeId; + //活动id + private Integer userId; //活动信息 private String activeInfo; //1满减2折扣 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeFullminusRecords/entity/ActiveFullminusRecords.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeFullminusRecords/entity/ActiveFullminusRecords.java index 9cbdccf16..eaa510bf2 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeFullminusRecords/entity/ActiveFullminusRecords.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeFullminusRecords/entity/ActiveFullminusRecords.java @@ -1,6 +1,9 @@ package com.fuint.business.marketingActivity.activeFullminusRecords.entity; import java.util.Date; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.extension.activerecord.Model; import java.io.Serializable; @@ -13,6 +16,7 @@ import java.io.Serializable; @SuppressWarnings("serial") public class ActiveFullminusRecords extends Model { //主键id + @TableId(type = IdType.AUTO) private Integer id; //活动id private Integer activeFullminusId; diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/controller/CardFavorableRecordController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/controller/CardFavorableRecordController.java index e05be9cbb..fff34649a 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/controller/CardFavorableRecordController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/controller/CardFavorableRecordController.java @@ -122,7 +122,7 @@ public class CardFavorableRecordController extends BaseController { * @param paymentActiveVO 实体对象 * @return 修改结果 */ - @PutMapping("updateCardAndActiveById") + @PostMapping("updateCardAndActiveById") public ResponseObject updateCardAndActiveById(@RequestBody PaymentActiveVO paymentActiveVO) { return getSuccessResult(this.cardFavorableRecordService.updateCardAndActiveById(paymentActiveVO)); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/impl/CardFavorableRecordServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/impl/CardFavorableRecordServiceImpl.java index 30c667149..e4ad73b8f 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/impl/CardFavorableRecordServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/impl/CardFavorableRecordServiceImpl.java @@ -239,23 +239,29 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl
- +
-
{{item.type}}
+
{{ getName(oilNameList,item.oilName) }}_{{getName1(gunList,item.gunName)}}
-
-¥{{ item.reduce }}
-
满{{ item.full }}元,打{{ item.discount }}折
-
满{{ item.full }}元,减{{ item.reduce }}元
+
-¥{{ item.discount }}
+
满减优惠
+
折扣优惠
@@ -83,13 +83,13 @@ style="color: black;font-size: 16px" v-model="checkAll1" @change="handleCheckAllChange1">
- 满减活动 + 活动优惠
-¥{{ fullReduction }}
-
+
- +
-
{{item.type}}
+
{{ getName(oilNameList,item.oilName) }}_{{getName1(gunList,item.gunName)}}
-
-¥{{ oilDiscount }}
-
消费满{{ item.full }}元,立减{{ item.reduce }}元
-
消费满{{ item.full }}元,每升优惠{{ item.liters }}元
+
-¥{{ item.discount }}
+ +
@@ -120,7 +120,7 @@
-¥{{ oilDiscount }}
-
+
- 储值卡 @@ -145,26 +145,26 @@
-¥{{ consumeAmount }}
-
+
-
- - -
-
{{item.name}}
-
-
-¥{{ item.reduce }}
-
满{{ item.full }}元,减{{ item.reduce }}元
-
-
-
-
-
+ + + + + + + + + + + + + +
¥{{ +oilActualPay + (+goodsActualPay) }}
-
优惠合计:{{ oilDiscount + goodsDiscount }}元/{{consumeRefuelMoney}}L
+
优惠合计:{{ oilDiscount + goodsDiscount + fullReduction + couponAmount }}元/{{consumeRefuelMoney}}L
立即结算
@@ -446,7 +446,7 @@ ¥{{ +oilActualPay + (+goodsActualPay) }}
- 合计金额:{{ oilAmount + goodsAmount }}元、优惠合计{{ oilDiscount + goodsDiscount }}元 + 合计金额:{{ oilAmount + goodsAmount }}元、优惠合计{{ oilDiscount + goodsDiscount + fullReduction + couponAmount }}元
@@ -765,7 +765,7 @@ import {getOilGun, getOilTank} from "@/api/cashier/oilGuns"; import {listCardFavorableRecord} from "@/api/cashier/cardfavorablerecord"; import {getOilNumberById, oilNumberList} from "@/api/cashier/oilnumber"; - import {getPaymentActive, selectCoupon, selectPreferential} from "@/api/cashier/preferential"; + import {getPaymentActive, selectCoupon, selectPreferential, usePaymentActive} from "@/api/cashier/preferential"; import {addHangBill} from "@/api/cashier/hangbill"; import {addCreditUnit, listCreditUnit} from "@/api/cashier/creditunit"; import {getSysConfig} from "@/api/staff/user/sysconfig"; @@ -1041,6 +1041,8 @@ oilPrice:"", oilLiters:"", }, + preferentialData1:{}, + oilPreferentialData:[], // 挂账单位信息 unitList:[], // 表单校验 @@ -1213,37 +1215,39 @@ }, // 选择优惠信息 handleCheckAllChange1(val) { - if (this.exclusion == 0){ - if (val){ - this.checkAll5 = false; - this.couponAmount = 0; - } - } let list = [] this.fullReduceDiscount.forEach(item => { - list.push(item.type) + list.push(item.gunName) }) if (val){ this.fullReduction = 0; this.fullReduceDiscount.forEach(item => { - this.fullReduction += +item.reduce + this.fullReduction += +item.discount }) - this.isUseFull = false; + + this.checkAll3 = false + this.consumeRefuelMoney = 0; + this.isOilStorageCard = false; }else { this.fullReduction = 0; - this.isUseFull = true; } this.checkedCities1 = val ? list : []; this.isIndeterminate1 = false; - this.isDefaultUseCard(); + this.countAmountFull(); }, handleCheckedCitiesChange1(value) { + if (value.length>0){ + this.checkAll3 = false + this.consumeRefuelMoney = 0; + this.isOilStorageCard = false; + } + this.fullReduction = 0; this.fullReduceDiscount.forEach(item => { let reduces = 0 for (let i = 0; i < value.length; i++){ - if (item.type == value[i]){ - reduces = item.reduce + if (item.gunName == value[i]){ + reduces = item.discount } } this.fullReduction += +reduces @@ -1251,31 +1255,40 @@ let checkedCount = value.length; this.checkAll1 = checkedCount === this.fullReduceDiscount.length; this.isIndeterminate1 = checkedCount > 0 && checkedCount < this.fullReduceDiscount.length; - this.isDefaultUseCard(); + this.countAmountFull(); }, handleCheckAllChange2(val) { let list = [] this.gradeDiscount.forEach(item => { - list.push(item.type) + list.push(item.gunName) }) if (val){ + this.oilDiscount = 0 this.gradeDiscount.forEach(item => { - this.oilDiscount += +item.reduce + this.oilDiscount += +item.discount }) + this.checkAll3 = false + this.consumeRefuelMoney = 0; + this.isOilStorageCard = false; }else { this.oilDiscount = 0 } this.checkedCities2 = val ? list : []; this.isIndeterminate2 = false; - this.isDefaultUseCard(); + this.countAmountFull(); }, handleCheckedCitiesChange2(value) { + if (value.length>0){ + this.checkAll3 = false + this.consumeRefuelMoney = 0; + this.isOilStorageCard = false; + } this.oilDiscount = 0 this.gradeDiscount.forEach(item => { let reduces = 0 for (let i = 0; i < value.length; i++){ - if (item.type == value[i]){ - reduces = item.reduce + if (item.gunName == value[i]){ + reduces = item.discount } } this.oilDiscount += +reduces @@ -1283,7 +1296,7 @@ let checkedCount = value.length; this.checkAll2 = checkedCount === this.gradeDiscount.length; this.isIndeterminate2 = checkedCount > 0 && checkedCount < this.gradeDiscount.length; - this.isDefaultUseCard(); + this.countAmountFull(); }, handleCheckAllChange3(val) { if (val==false){ @@ -1296,79 +1309,53 @@ } this.isDefaultUseCard(); }, - handleCheckedCitiesChange3(value) { - let checkedCount = value.length; - this.checkAll3 = checkedCount === this.cities3.length; - this.isIndeterminate3 = checkedCount > 0 && checkedCount < this.cities3.length; - }, handleCheckAllChange4(val) { if (val==false){ + this.countAmountUnBalance(); this.consumeAmount = 0; this.isUseBalance = true; }else { + this.countAmountFull(); this.isUseBalance = false; } - this.isDefaultUseCard(); - }, - handleCheckedCitiesChange4(value) { - let checkedCount = value.length; - this.checkAll4 = checkedCount === this.cities4.length; - this.isIndeterminate4 = checkedCount > 0 && checkedCount < this.cities4.length; }, handleCheckAllChange5(val) { - if (this.exclusion == 0){ - if (val){ - this.checkAll1 = false; - this.fullReduction = 0; - this.isUseFull = true; - this.checkedCities5 = this.couponDiscount[0].name; - }else { - this.isUseFull = false; - this.checkedCities5 = "" - } - }else if (this.exclusion == 0){ - if (val){ - this.checkAll4 = false; - this.consumeAmount = 0; - this.isUseBalance = true; - this.checkedCities5 = this.couponDiscount[0].name; - }else { - this.isUseBalance = false; - this.checkedCities5 = "" - } - } if (val){ - this.couponAmount = 0 - this.couponAmount = this.couponDiscount[0].reduce - this.useCouponIds = "" - this.couponIds.forEach(item => { - if (item.name = this.couponDiscount[0].name){ - this.useCouponIds = item.id - } + // this.couponAmount = 0 + this.couponDiscount.forEach(item => { + this.couponAmount = item.discount }) - this.checkedCities5 = this.couponDiscount[0].name; + + this.checkAll3 = false + this.consumeRefuelMoney = 0; + this.isOilStorageCard = false; }else { - this.useCouponIds = "" this.couponAmount = 0 - this.checkedCities5 = "" + if (this.balance>0){ + this.checkAll4 = true + } } - this.isDefaultUseCard(); + this.countAmountFull(); }, handleCheckedCitiesChange5(value) { + if (value.length>0){ + this.checkAll3 = false + this.consumeRefuelMoney = 0; + this.isOilStorageCard = false; + } this.couponAmount = 0; this.couponDiscount.forEach(item => { - if (item.name == value){ - this.couponAmount = item.reduce - } - }) - this.useCouponIds = "" - this.couponIds.forEach(item => { - if (item.name == value){ - this.useCouponIds = item.id + let reduces = 0 + if (item.gunName == value){ + reduces = item.discount } + this.couponAmount = reduces }) + // let checkedCount = value.length; this.checkAll5 = true; - this.isDefaultUseCard(); + this.checkedCities5 = value + // this.isIndeterminate5 = checkedCount > 0 && checkedCount < this.couponDiscount.length; + this.countAmountFull(); }, // 模糊查询商品信息 querySearch(queryString, cb) { @@ -1442,6 +1429,15 @@ this.goodsActualPay = this.goodsAmount - this.goodsDiscount this.isSure = false; this.handleChange(); + // 数据清零 + this.refuelMoney = null + this.oilDiscount = 0 + this.couponAmount = 0 + this.fullReduction = 0 + this.fullReduceDiscount = [] + this.gradeDiscount = [] + this.couponDiscount = [] + this.oilPreferentialData = [] }, // 根据会员等级信息获取等级优惠信息 getGrade(userId,gradeId){ @@ -1918,7 +1914,7 @@ if (data.refuelMoney){ // 使用囤油卡 this.refuelMoney = JSON.parse(data.refuelMoney) - this.changeRefuelMoney(); + await this.changeRefuelMoney(); } // await this.getGrade(data.id,data.gradeId) // if (!this.isFixingLevel){ @@ -1930,7 +1926,10 @@ // this.getCoupon(); // } // } - this.getOilCoupon() + if (this.balance>0){ + this.checkAll4 = true + } + await this.getOilCoupon() }, getOilCoupon(){ let type = 0; @@ -1939,18 +1938,65 @@ }else { type = 0; } + // 数据清零 + this.oilDiscount = 0 + this.couponAmount = 0 + this.fullReduction = 0 + this.fullReduceDiscount = [] + this.gradeDiscount = [] + this.couponDiscount = [] + this.oilPreferentialData = [] + this.paymentActive.type = type this.paymentActive.mtUserLevel = this.member.gradeId this.paymentActive.userId = this.member.id let _this = this this.oilOrder.forEach(item => { - console.log(item) _this.paymentActive.amount = item.amount _this.paymentActive.oilId = item.oilName _this.paymentActive.storeId = item.storeId getPaymentActive(_this.paymentActive).then(res => { - console.log(res) + let discount = {type:"",discount:0,oilName:item.oilName,gunName:item.gunName} + let oilData = {oilName:item.oilName,oilPreferential: {}} + // this.preferentialData1 = res.data + oilData.oilPreferential = res.data + _this.oilPreferentialData.push(oilData) + // if (_this.consumeRefuelMoney==0){ + if (res.data.memberFavorableAmount){ + discount.discount = res.data.memberFavorableAmount + _this.gradeDiscount.push(discount) + if(!this.isOilStorageCard) { + _this.oilDiscount += res.data.memberFavorableAmount + _this.checkAll2 = true + this.checkedCities2.push(discount.oilName) + } + } + if (res.data.cardFavorableAmount){ + discount.discount = res.data.cardFavorableAmount + _this.couponDiscount.push(discount) + if(!this.isOilStorageCard) { + _this.couponAmount = res.data.cardFavorableAmount + _this.checkAll5 = true + _this.checkedCities5.push(discount.gunName) + } + } + if (res.data.activeFavorableAmount){ + discount.discount = res.data.activeFavorableAmount + discount.type = res.data.type + _this.fullReduceDiscount.push(discount) + if(!this.isOilStorageCard) { + _this.fullReduction += res.data.activeFavorableAmount + _this.checkAll1 = true + this.checkedCities1.push(discount.oilName) + } + } + // } + console.log(_this.couponAmount,222) + if(!this.isOilStorageCard){ + this.countAmountFull() + } + console.log(discount,_this.gradeDiscount,_this.couponDiscount,_this.fullReduceDiscount,"1264") }) }) }, @@ -2059,23 +2105,25 @@ } console.log("囤油卡",this.isOilStorageCard,this.hoardAmount,this.balance,this.oilAmount,this.oilActualPay,this.consumeAmount) }, - // 使用优惠券不使用满减 + // 不使用囤油卡 countAmountFull(){ if (this.isMember){ - // 满减互斥 - if (this.balance >= (this.oilAmount - this.oilDiscount - this.couponAmount)){ + // if (this.balance>0){ + // this.checkAll4 = true + // } + if (this.balance >= (this.oilAmount - this.oilDiscount - this.couponAmount - this.fullReduction)){ this.oilActualPay = 0 - this.consumeAmount = this.oilAmount - this.oilDiscount - this.couponAmount + this.consumeAmount = this.oilAmount - this.oilDiscount - this.couponAmount - this.fullReduction }else { - this.oilActualPay = (this.oilAmount -this.balance - this.oilDiscount - this.couponAmount).toFixed(2) + this.oilActualPay = this.oilAmount - this.oilDiscount - this.couponAmount - this.fullReduction - this.balance this.consumeAmount = this.balance } }else { - this.oilActualPay = (this.oilAmount - this.oilDiscount).toFixed(2) + this.oilActualPay = this.oilAmount.toFixed(2) } - console.log("优惠券",this.oilAmount, this.oilDiscount,this.couponAmount) + console.log("不使用囤油卡",this.oilAmount, this.oilDiscount,this.couponAmount,this.fullReduction) }, - // 使用优惠券和满减不使用储值卡 + // 不使用储值卡 countAmountUnBalance(){ if (this.isMember){ this.oilActualPay = (this.oilAmount - this.fullReduction - this.oilDiscount - this.couponAmount).toFixed(2) @@ -2083,7 +2131,7 @@ this.oilActualPay = (this.oilAmount - this.oilDiscount).toFixed(2) } this.consumeAmount = 0 - console.log("优惠券和满减",this.oilAmount , this.fullReduction , this.oilDiscount , this.couponAmount) + console.log("不使用储值卡",this.oilAmount , this.fullReduction , this.oilDiscount , this.couponAmount) }, // 使用储值卡不使用优惠券 || 使用满减不使用优惠券 countAmountBalance(){ @@ -2102,60 +2150,7 @@ }, // 判断互斥限制 isExclusion(){ - if (this.exclusion == 1){ - // 不使用满减 - if (this.isUseBalance){ - this.countAmountFull() - return; - } - // 储值卡互斥 - if (this.isUseBalance){ - this.countAmountUnBalance() - return; - }else { - this.countAmountBalance() - return; - } - }else if (this.exclusion == 0){ - // 满减互斥 - // 不使用储值卡 - if (this.isUseBalance){ - this.countAmountUnBalance() - return; - } - if (this.isUseFull){ - this.countAmountFull() - return; - }else { - this.countAmountBalance() - return; - } - }else { - // 无互斥 - // 不使用储值卡 - if (this.isUseBalance){ - this.countAmountUnBalance() - return; - } - // 不使用满减 - if (this.isUseBalance){ - this.countAmountFull() - return; - } - // 使用囤油卡 - // if (this.isOilStorageCard){ - // this.checkAll1 = false; - // this.fullReduction = 0; - // this.checkAll2 = false; - // this.checkedCities2 = []; - // this.oilDiscount = 0; - // this.checkAll5 = false; - // this.couponAmount = 0; - // this.countOilCard(); - // return; - // } - this.countAmountBalance(); - } + }, // 默认使用囤油卡 isDefaultUseCard(){ @@ -2173,7 +2168,7 @@ this.checkAll4 = true; } }else { - this.isExclusion() + this.countAmountFull() } }, // 调用优惠参数接口 @@ -2375,7 +2370,7 @@ }) }, // 油品订单信息 - getOilOrder(){ + async getOilOrder(){ this.dialogVisibleamount = false this.form.oilType = this.oilNameID; this.form.type = this.type; @@ -2389,7 +2384,7 @@ } // 校验油罐内油是否足够 - getOilTank(this.form.tankId).then(res => { + await getOilTank(this.form.tankId).then(res => { if (res.data.storedQuantity-this.form.liters<0){ this.$modal.msgError("所加油的升数大于油罐内的升数,请重新选择加油升数") return; @@ -2419,7 +2414,9 @@ // this.preferential(); // this.getCoupon(); // } - + if (this.balance>0){ + this.checkAll4 = true + } this.getOilCoupon() } } @@ -2427,6 +2424,9 @@ }, // 囤油卡变化后总金额的变化 changeRefuelMoney(){ + this.oilDiscount = 0 + this.couponAmount = 0 + this.fullReduction = 0 let _this = this; _this.consumeRefuelMoney = 0; _this.oilActualPay = 0; @@ -2657,6 +2657,13 @@ _this.isPay = true; _this.seekZero = 0 _this.amount = 0 + _this.resetting1() + for (let i =0;i<_this.oilPreferentialData.length;i++){ + _this.oilPreferentialData[i].oilPreferential.storeId = response.data.oilOrder.storeId + _this.oilPreferentialData[i].oilPreferential.userId = response.data.oilOrder.userId + _this.oilPreferentialData[i].oilPreferential.cardFavorableId = _this.oilPreferentialData[_this.oilPreferentialData.length-1].cardFavorableId + usePaymentActive(_this.oilPreferentialData[i].oilPreferential).then(res => {}) + } return; } } @@ -2666,6 +2673,7 @@ _this.isPay = true; _this.seekZero = 0 _this.amount = 0 + _this.resetting1() return; } } @@ -2786,6 +2794,14 @@ _this.amount = 0 _this.loading = false; + if (response.data.oilOrderAmount>0){ + for (let i =0;i<_this.oilPreferentialData.length;i++){ + _this.oilPreferentialData[i].oilPreferential.storeId = response.data.oilOrder.storeId + _this.oilPreferentialData[i].oilPreferential.userId = response.data.oilOrder.userId + _this.oilPreferentialData[i].oilPreferential.cardFavorableId = _this.oilPreferentialData[_this.oilPreferentialData.length-1].cardFavorableId + usePaymentActive(_this.oilPreferentialData[i].oilPreferential).then(res => {}) + } + } clearInterval(timer); } if (response.data.status == "payFail"){ @@ -2967,6 +2983,18 @@ oilNumberList().then(response => { this.oilNumberList = response.data.records; }) + },// 获取油枪名称 + getName1(oilNameList,id){ + let name = "" + let _this = this; + if(oilNameList!=null && oilNameList!=""){ + oilNameList.forEach(item => { + if (item.id == id){ + name = item.gunName; + } + }) + } + return name; }, }, diff --git a/gasStation-uni/pagesRefuel/orderDetail/index.vue b/gasStation-uni/pagesRefuel/orderDetail/index.vue index 85ce59fcb..31c9928c4 100644 --- a/gasStation-uni/pagesRefuel/orderDetail/index.vue +++ b/gasStation-uni/pagesRefuel/orderDetail/index.vue @@ -89,7 +89,7 @@ 优惠券优惠 - (优惠券) + @@ -278,7 +278,6 @@ type: "", }; }else{ - this.chooseCardBalance(0) this.oilCardRedece = 0 this.getPaymentPreferential(this.user.gradeId) } @@ -324,6 +323,14 @@ return; } if(res.data.success == "ok"){ + _this.preferentialData.storeId = _this.oilOrder.storeId + request({ + url: "business/marketingActivity/cardFavorableRecord/updateCardAndActiveById", + method: 'post', + data: _this.preferentialData, + }).then((res)=>{ + console.log(res); + }) uni.reLaunch({ url: '/pagesRefuel/orderSuccess/index' }) @@ -353,10 +360,11 @@ success: function (res) { console.log('success'); // 支付成功后调用修改使用后的优惠券情况 + _this.preferentialData.storeId = _this.oilOrder.storeId request({ url: "business/marketingActivity/cardFavorableRecord/updateCardAndActiveById", - method: 'put', - data: {"paymentActiveVO":_this.preferentialData}, + method: 'post', + data: _this.preferentialData, }).then((res)=>{ console.log(res); }) @@ -384,10 +392,11 @@ if(resp.resultCode == '9000'){ console.log("支付成功") // 支付成功后调用修改使用后的优惠券情况 + _this.preferentialData.storeId = _this.oilOrder.storeId request({ url: "business/marketingActivity/cardFavorableRecord/updateCardAndActiveById", - method: 'put', - data: {"paymentActiveVO":_this.preferentialData}, + method: 'post', + data: _this.preferentialData, }).then((res)=>{ console.log(res); }) @@ -442,23 +451,23 @@ this.chooseCardBalance(0) // this.chooseGrade(this.user.id,this.user.gradeId) } - }, - // 查看是否有可使用的储值卡金额 - chooseCardBalance(val){ if (this.oilCardRedece==0){ this.getPaymentPreferential(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.fullRedece - this.couponRedece - this.gradeRedece).toFixed(2)){ + this.balanceRedece = (this.oilOrder.orderAmount - this.fullRedece - this.couponRedece - this.gradeRedece).toFixed(2) } else { this.balanceRedece = this.user.cardBalance - this.deductAmount = (this.oilOrder.orderAmount*100-this.balanceRedece*100)/100 - this.payAmount = (this.oilOrder.orderAmount*100-this.balanceRedece*100)/100 + this.deductAmount = (this.oilOrder.orderAmount - this.fullRedece - this.couponRedece - this.gradeRedece-this.balanceRedece).toFixed(2) + this.payAmount = (this.oilOrder.orderAmount - this.fullRedece - this.couponRedece - this.gradeRedece-this.balanceRedece).toFixed(2) } }else{ // 使用囤油卡 @@ -477,8 +486,8 @@ } } }else{ - this.deductAmount = this.oilOrder.orderAmount - this.payAmount = this.oilOrder.orderAmount + this.deductAmount = (this.oilOrder.orderAmount - this.fullRedece - this.couponRedece - this.gradeRedece).toFixed(2) + this.payAmount = (this.oilOrder.orderAmount - this.fullRedece - this.couponRedece - this.gradeRedece).toFixed(2) } }, // 查看是否有可使用的会员等级优惠 @@ -842,6 +851,7 @@ _this.chooseRefuelMoney() }else{ _this.chooseCardBalance(0) + _this.getPaymentPreferential(this.user.gradeId) } // _this.chooseGrade(res.data.userVo.id,res.data.userVo.gradeId) }) @@ -884,7 +894,8 @@ } console.log(this.gradeRedece,this.couponRedece,this.fullRedece,res.data.memberFavorableAmount,"2231"); - this.payAmount = (this.payAmount - this.fullRedece - this.couponRedece - this.gradeRedece).toFixed(2) + this.chooseCardBalance(0) + // this.payAmount = (this.payAmount - this.fullRedece - this.couponRedece - this.gradeRedece).toFixed(2) }) }, // 获取油品订单