This commit is contained in:
cun-nan 2024-01-20 18:11:29 +08:00
parent 83a0e8367a
commit af1a1a25f0
9 changed files with 272 additions and 201 deletions

View File

@ -1,6 +1,9 @@
package com.fuint.business.marketingActivity.activeDiscountRecords.entity; package com.fuint.business.marketingActivity.activeDiscountRecords.entity;
import java.util.Date; import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model; import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.io.Serializable; import java.io.Serializable;
@ -13,6 +16,7 @@ import java.io.Serializable;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class ActiveDiscountRecords extends Model<ActiveDiscountRecords> { public class ActiveDiscountRecords extends Model<ActiveDiscountRecords> {
//主键id //主键id
@TableId(type = IdType.AUTO)
private Integer id; private Integer id;
//活动id //活动id
private Integer activeDiscountId; private Integer activeDiscountId;

View File

@ -456,11 +456,15 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
List<ActiveDiscountPayVO> activeFuletVOLists = oilOrderMapper.selectActiveFules(storeId,paymentActiveDTO.getAmount(),paymentActiveDTO.getOilId(),paymentActiveDTO.getMtUserLevel()); List<ActiveDiscountPayVO> activeFuletVOLists = oilOrderMapper.selectActiveFules(storeId,paymentActiveDTO.getAmount(),paymentActiveDTO.getOilId(),paymentActiveDTO.getMtUserLevel());
activeFuletVOList.addAll(activeFuletVOLists); activeFuletVOList.addAll(activeFuletVOLists);
//优惠券 //优惠券
if (ObjectUtils.isNotEmpty(paymentActiveDTO.getUserId())){
userId = paymentActiveDTO.getUserId();
}
paymentActiveDTO.setUserId(userId); paymentActiveDTO.setUserId(userId);
List<CardFavorableRecordVO> canUserCardFavorableList = cardFavorableRecordMapper.getCanUserCardFavorableList(paymentActiveDTO); List<CardFavorableRecordVO> canUserCardFavorableList = cardFavorableRecordMapper.getCanUserCardFavorableList(paymentActiveDTO);
//如果是储值卡付款直接过滤掉 //如果是储值卡付款直接过滤掉
if(paymentActiveDTO.getType().equals("0")){ 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()); .collect(Collectors.toList());
} }
//会员等级当前优惠力度最大 //会员等级当前优惠力度最大
@ -616,8 +620,10 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
activeDiscountPayVOS.add(activeDiscountPayVO2); activeDiscountPayVOS.add(activeDiscountPayVO2);
} }
//3.活动和活动+优惠券的组合比较 //3.活动和活动+优惠券的组合比较
if (CollectionUtils.isNotEmpty(activeDiscountPayVOS)){ ActiveDiscountPayVO activeDiscountPayVO3 = new ActiveDiscountPayVO();
ActiveDiscountPayVO activeDiscountPayVO3 = activeDiscountPayVOS.stream().max(Comparator.comparingDouble(ActiveDiscountPayVO::getDiscounts)).get(); if (CollectionUtils.isNotEmpty(activeDiscountPayVOS)) {
activeDiscountPayVO3 = activeDiscountPayVOS.stream().max(Comparator.comparingDouble(ActiveDiscountPayVO::getDiscounts)).get();
}
//4. 3和优惠券比较 //4. 3和优惠券比较
if(ObjectUtils.isNotEmpty(activeDiscountPayVO3)){ if(ObjectUtils.isNotEmpty(activeDiscountPayVO3)){
finalAmount = activeDiscountPayVO3.getDiscounts(); finalAmount = activeDiscountPayVO3.getDiscounts();
@ -646,7 +652,6 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
//return paymentActiveVO2; //return paymentActiveVO2;
} }
} }
}
//会员等级优惠 //会员等级优惠

View File

@ -9,6 +9,10 @@ import java.math.BigDecimal;
public class PaymentActiveVO implements Serializable { public class PaymentActiveVO implements Serializable {
//活动id //活动id
private Integer activeId; private Integer activeId;
//活动id
private Integer storeId;
//活动id
private Integer userId;
//活动信息 //活动信息
private String activeInfo; private String activeInfo;
//1满减2折扣 //1满减2折扣

View File

@ -1,6 +1,9 @@
package com.fuint.business.marketingActivity.activeFullminusRecords.entity; package com.fuint.business.marketingActivity.activeFullminusRecords.entity;
import java.util.Date; import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model; import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.io.Serializable; import java.io.Serializable;
@ -13,6 +16,7 @@ import java.io.Serializable;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class ActiveFullminusRecords extends Model<ActiveFullminusRecords> { public class ActiveFullminusRecords extends Model<ActiveFullminusRecords> {
//主键id //主键id
@TableId(type = IdType.AUTO)
private Integer id; private Integer id;
//活动id //活动id
private Integer activeFullminusId; private Integer activeFullminusId;

View File

@ -122,7 +122,7 @@ public class CardFavorableRecordController extends BaseController {
* @param paymentActiveVO 实体对象 * @param paymentActiveVO 实体对象
* @return 修改结果 * @return 修改结果
*/ */
@PutMapping("updateCardAndActiveById") @PostMapping("updateCardAndActiveById")
public ResponseObject updateCardAndActiveById(@RequestBody PaymentActiveVO paymentActiveVO) { public ResponseObject updateCardAndActiveById(@RequestBody PaymentActiveVO paymentActiveVO) {
return getSuccessResult(this.cardFavorableRecordService.updateCardAndActiveById(paymentActiveVO)); return getSuccessResult(this.cardFavorableRecordService.updateCardAndActiveById(paymentActiveVO));
} }

View File

@ -239,23 +239,29 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
//优惠券 //优惠券
boolean flag = false; boolean flag = false;
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer userId = null;
if (StringUtils.isNotEmpty(paymentActiveVO.getUserId().toString())){
userId = paymentActiveVO.getUserId();
}else {
userId = nowAccountInfo.getId();
}
if (ObjectUtils.isNotEmpty(paymentActiveVO.getCardFavorableId())){ if (ObjectUtils.isNotEmpty(paymentActiveVO.getCardFavorableId())){
flag = cardFavorableRecordMapper.updateCardAndActiveById(paymentActiveVO.getCardFavorableId(),nowAccountInfo.getId(),nowAccountInfo.getStoreId()); flag = cardFavorableRecordMapper.updateCardAndActiveById(paymentActiveVO.getCardFavorableId(),userId,paymentActiveVO.getStoreId());
} }
//满减活动 //满减活动
if (ObjectUtils.isNotEmpty(paymentActiveVO.getActiveId()) && paymentActiveVO.getType().equals("1")){ if (ObjectUtils.isNotEmpty(paymentActiveVO.getActiveId()) && paymentActiveVO.getType().equals("1")){
ActiveFullminusRecords activeFullminusRecords = new ActiveFullminusRecords(); ActiveFullminusRecords activeFullminusRecords = new ActiveFullminusRecords();
activeFullminusRecords.setActiveFullminusId(paymentActiveVO.getActiveId()); activeFullminusRecords.setActiveFullminusId(paymentActiveVO.getActiveId());
activeFullminusRecords.setUserId(nowAccountInfo.getId()); activeFullminusRecords.setUserId(userId);
activeFullminusRecords.setStoreId(nowAccountInfo.getStoreId()); activeFullminusRecords.setStoreId(paymentActiveVO.getStoreId());
flag = activeFullminusRecordsService.save(activeFullminusRecords); flag = activeFullminusRecordsService.save(activeFullminusRecords);
} }
//折扣活动 //折扣活动
if (ObjectUtils.isNotEmpty(paymentActiveVO.getActiveId()) && paymentActiveVO.getType().equals("2")){ if (ObjectUtils.isNotEmpty(paymentActiveVO.getActiveId()) && paymentActiveVO.getType().equals("2")){
ActiveDiscountRecords activeDiscountRecords = new ActiveDiscountRecords(); ActiveDiscountRecords activeDiscountRecords = new ActiveDiscountRecords();
activeDiscountRecords.setActiveDiscountId(paymentActiveVO.getActiveId()); activeDiscountRecords.setActiveDiscountId(paymentActiveVO.getActiveId());
activeDiscountRecords.setUserId(nowAccountInfo.getId()); activeDiscountRecords.setUserId(userId);
activeDiscountRecords.setStoreId(nowAccountInfo.getStoreId()); activeDiscountRecords.setStoreId(paymentActiveVO.getStoreId());
flag = activeDiscountRecordsService.save(activeDiscountRecords); flag = activeDiscountRecordsService.save(activeDiscountRecords);
} }
return flag; return flag;

View File

@ -27,3 +27,12 @@ export function getPaymentActive(data) {
}) })
} }
// 查询优惠券信息
export function usePaymentActive(data) {
return request({
url: '/business/marketingActivity/cardFavorableRecord/updateCardAndActiveById',
method: 'post',
data: data
})
}

View File

@ -62,13 +62,13 @@
<div> <div>
<div v-if="fullReduceDiscount.length>0"> <div v-if="fullReduceDiscount.length>0">
<el-checkbox-group v-model="checkedCities1" @change="handleCheckedCitiesChange1"> <el-checkbox-group v-model="checkedCities1" @change="handleCheckedCitiesChange1">
<el-checkbox v-for="(item,index) in fullReduceDiscount" :label="item.type" :key="index"> <el-checkbox v-for="(item,index) in fullReduceDiscount" :label="item.gunName" :key="index">
<div style="display: flex;justify-content: space-between;height: 40px;line-height: 40px;"> <div style="display: flex;justify-content: space-between;height: 40px;line-height: 40px;">
<div style="width: 200px">{{item.type}}</div> <div style="width: 200px">{{ getName(oilNameList,item.oilName) }}_{{getName1(gunList,item.gunName)}}</div>
<div style="line-height: 20px;width:150px;font-size: 12px;text-align: right"> <div style="line-height: 20px;width:150px;font-size: 12px;text-align: right">
<div style="color: red">-{{ item.reduce }}</div> <div style="color: red">-{{ item.discount }}</div>
<div style="color: grey" v-if="item.discount!=0">{{ item.full }}{{ item.discount }}</div> <div style="color: grey" v-if="item.type!=1">满减优惠</div>
<div style="color: grey" v-else>{{ item.full }}{{ item.reduce }}</div> <div style="color: grey" v-if="item.type!=2">折扣优惠</div>
</div> </div>
</div> </div>
</el-checkbox> </el-checkbox>
@ -83,13 +83,13 @@
style="color: black;font-size: 16px" style="color: black;font-size: 16px"
v-model="checkAll1" @change="handleCheckAllChange1"> v-model="checkAll1" @change="handleCheckAllChange1">
</el-checkbox><!--:indeterminate="isIndeterminate1"--> </el-checkbox><!--:indeterminate="isIndeterminate1"-->
满减活动 活动优惠
</div> </div>
</el-popover> </el-popover>
</div> </div>
<div>-{{ fullReduction }}</div> <div>-{{ fullReduction }}</div>
</div> </div>
<div class="center-left-hj" v-show="isMember"> <div class="center-left-hj" v-show="isMember && gradeDiscount.length>0">
<div> <div>
<el-popover <el-popover
placement="bottom-start" placement="bottom-start"
@ -97,13 +97,13 @@
trigger="click"> trigger="click">
<div> <div>
<el-checkbox-group v-model="checkedCities2" @change="handleCheckedCitiesChange2"> <el-checkbox-group v-model="checkedCities2" @change="handleCheckedCitiesChange2">
<el-checkbox v-for="(item,index) in gradeDiscount" :label="item.type" :key="index"> <el-checkbox v-for="(item,index) in gradeDiscount" :label="item.gunName" :key="index">
<div style="display: flex;justify-content: space-between;height: 40px;line-height: 40px;"> <div style="display: flex;justify-content: space-between;height: 40px;line-height: 40px;">
<div style="width: 200px">{{item.type}}</div> <div style="width: 200px">{{ getName(oilNameList,item.oilName) }}_{{getName1(gunList,item.gunName)}}</div>
<div style="line-height: 20px;width:150px;font-size: 12px;text-align: right"> <div style="line-height: 20px;width:150px;font-size: 12px;text-align: right">
<div style="color: red">-{{ oilDiscount }}</div> <div style="color: red">-{{ item.discount }}</div>
<div v-if="item.type=='满减优惠'" style="color: grey">消费满{{ item.full }}立减{{ item.reduce }}</div> <!-- <div v-if="item.type=='满减优惠'" style="color: grey">消费满{{ item.full }}立减{{ item.reduce }}</div>-->
<div v-else style="color: grey">消费满{{ item.full }}每升优惠{{ item.liters }}</div> <!-- <div v-else style="color: grey">消费满{{ item.full }}每升优惠{{ item.liters }}</div>-->
</div> </div>
</div> </div>
</el-checkbox> </el-checkbox>
@ -120,7 +120,7 @@
</div> </div>
<div>-{{ oilDiscount }}</div> <div>-{{ oilDiscount }}</div>
</div> </div>
<div class="center-left-hj" v-show="isMember"> <div class="center-left-hj" v-show="isMember && refuelMoney">
<div> <div>
<el-checkbox <el-checkbox
style="color: black;font-size: 16px" style="color: black;font-size: 16px"
@ -137,7 +137,7 @@
</div> </div>
<div class="center-left-hj" v-show="isMember"> <div class="center-left-hj" v-show="isMember">
<div> <div>
<el-checkbox style="color: black;font-size: 16px" <el-checkbox style="color: black;font-size: 16px" :disabled="balance==0"
v-model="checkAll4" @change="handleCheckAllChange4"> v-model="checkAll4" @change="handleCheckAllChange4">
</el-checkbox> </el-checkbox>
储值卡 储值卡
@ -145,26 +145,26 @@
</div> </div>
<div>-{{ consumeAmount }}</div> <div>-{{ consumeAmount }}</div>
</div> </div>
<div class="center-left-hj" v-show="isMember"> <div class="center-left-hj" v-show="isMember && couponDiscount.length>0">
<div> <div>
<el-popover <el-popover
placement="bottom-start" placement="bottom-start"
width="400" width="400"
trigger="click"> trigger="click">
<div> <!-- <div>-->
<el-radio-group v-model="checkedCities5" @input="handleCheckedCitiesChange5"> <!-- <el-radio-group v-model="checkedCities5" @input="handleCheckedCitiesChange5">-->
<el-radio v-for="(item,index) in couponDiscount" <!-- <el-radio v-for="(item,index) in couponDiscount"-->
:label="item.name" :key="index" style="display: flex;"> <!-- :label="item.gunName" :key="index" style="display: flex;">-->
<div style="display: flex;justify-content: space-between;height: 40px;line-height: 40px;"> <!-- <div style="display: flex;justify-content: space-between;height: 40px;line-height: 40px;">-->
<div style="width: 200px">{{item.name}}</div> <!-- <div style="width: 200px">{{ getName(oilNameList,item.oilName) }}_{{getName1(gunList,item.gunName)}}</div>-->
<div style="line-height: 20px;width:150px;font-size: 12px;text-align: right"> <!-- <div style="line-height: 20px;width:150px;font-size: 12px;text-align: right">-->
<div style="color: red">-{{ item.reduce }}</div> <!-- <div style="color: red">-{{ item.discount }}</div>-->
<div style="color: grey">{{ item.full }}{{ item.reduce }}</div> <!--&lt;!&ndash; <div style="color: grey">{{ item.full }}{{ item.reduce }}</div>&ndash;&gt;-->
</div> <!-- </div>-->
</div> <!-- </div>-->
</el-radio> <!-- </el-radio>-->
</el-radio-group> <!-- </el-radio-group>-->
</div> <!-- </div>-->
<div slot="reference"> <div slot="reference">
<el-checkbox <el-checkbox
style="color: black;font-size: 16px" style="color: black;font-size: 16px"
@ -208,7 +208,7 @@
<div class="center-left-bottom"> <div class="center-left-bottom">
<div> <div>
<div class="bottom-price">{{ +oilActualPay + (+goodsActualPay) }}</div> <div class="bottom-price">{{ +oilActualPay + (+goodsActualPay) }}</div>
<div class="price-red">优惠合计{{ oilDiscount + goodsDiscount }}/{{consumeRefuelMoney}}L</div> <div class="price-red">优惠合计{{ oilDiscount + goodsDiscount + fullReduction + couponAmount }}/{{consumeRefuelMoney}}L</div>
</div> </div>
<el-button class="center-left-lv" :disabled="(oilAmount + goodsAmount)==0" @click="settlement">立即结算</el-button> <el-button class="center-left-lv" :disabled="(oilAmount + goodsAmount)==0" @click="settlement">立即结算</el-button>
</div> </div>
@ -446,7 +446,7 @@
{{ +oilActualPay + (+goodsActualPay) }} {{ +oilActualPay + (+goodsActualPay) }}
</div> </div>
<div style="text-align: center;margin-bottom: 10px"> <div style="text-align: center;margin-bottom: 10px">
合计金额{{ oilAmount + goodsAmount }}优惠合计{{ oilDiscount + goodsDiscount }} 合计金额{{ oilAmount + goodsAmount }}优惠合计{{ oilDiscount + goodsDiscount + fullReduction + couponAmount }}
</div> </div>
<div v-if="map.payType != 'CASH'"> <div v-if="map.payType != 'CASH'">
<div> <div>
@ -765,7 +765,7 @@
import {getOilGun, getOilTank} from "@/api/cashier/oilGuns"; import {getOilGun, getOilTank} from "@/api/cashier/oilGuns";
import {listCardFavorableRecord} from "@/api/cashier/cardfavorablerecord"; import {listCardFavorableRecord} from "@/api/cashier/cardfavorablerecord";
import {getOilNumberById, oilNumberList} from "@/api/cashier/oilnumber"; 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 {addHangBill} from "@/api/cashier/hangbill";
import {addCreditUnit, listCreditUnit} from "@/api/cashier/creditunit"; import {addCreditUnit, listCreditUnit} from "@/api/cashier/creditunit";
import {getSysConfig} from "@/api/staff/user/sysconfig"; import {getSysConfig} from "@/api/staff/user/sysconfig";
@ -1041,6 +1041,8 @@
oilPrice:"", oilPrice:"",
oilLiters:"", oilLiters:"",
}, },
preferentialData1:{},
oilPreferentialData:[],
// //
unitList:[], unitList:[],
// //
@ -1213,37 +1215,39 @@
}, },
// //
handleCheckAllChange1(val) { handleCheckAllChange1(val) {
if (this.exclusion == 0){
if (val){
this.checkAll5 = false;
this.couponAmount = 0;
}
}
let list = [] let list = []
this.fullReduceDiscount.forEach(item => { this.fullReduceDiscount.forEach(item => {
list.push(item.type) list.push(item.gunName)
}) })
if (val){ if (val){
this.fullReduction = 0; this.fullReduction = 0;
this.fullReduceDiscount.forEach(item => { 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 { }else {
this.fullReduction = 0; this.fullReduction = 0;
this.isUseFull = true;
} }
this.checkedCities1 = val ? list : []; this.checkedCities1 = val ? list : [];
this.isIndeterminate1 = false; this.isIndeterminate1 = false;
this.isDefaultUseCard(); this.countAmountFull();
}, },
handleCheckedCitiesChange1(value) { handleCheckedCitiesChange1(value) {
if (value.length>0){
this.checkAll3 = false
this.consumeRefuelMoney = 0;
this.isOilStorageCard = false;
}
this.fullReduction = 0; this.fullReduction = 0;
this.fullReduceDiscount.forEach(item => { this.fullReduceDiscount.forEach(item => {
let reduces = 0 let reduces = 0
for (let i = 0; i < value.length; i++){ for (let i = 0; i < value.length; i++){
if (item.type == value[i]){ if (item.gunName == value[i]){
reduces = item.reduce reduces = item.discount
} }
} }
this.fullReduction += +reduces this.fullReduction += +reduces
@ -1251,31 +1255,40 @@
let checkedCount = value.length; let checkedCount = value.length;
this.checkAll1 = checkedCount === this.fullReduceDiscount.length; this.checkAll1 = checkedCount === this.fullReduceDiscount.length;
this.isIndeterminate1 = checkedCount > 0 && checkedCount < this.fullReduceDiscount.length; this.isIndeterminate1 = checkedCount > 0 && checkedCount < this.fullReduceDiscount.length;
this.isDefaultUseCard(); this.countAmountFull();
}, },
handleCheckAllChange2(val) { handleCheckAllChange2(val) {
let list = [] let list = []
this.gradeDiscount.forEach(item => { this.gradeDiscount.forEach(item => {
list.push(item.type) list.push(item.gunName)
}) })
if (val){ if (val){
this.oilDiscount = 0
this.gradeDiscount.forEach(item => { this.gradeDiscount.forEach(item => {
this.oilDiscount += +item.reduce this.oilDiscount += +item.discount
}) })
this.checkAll3 = false
this.consumeRefuelMoney = 0;
this.isOilStorageCard = false;
}else { }else {
this.oilDiscount = 0 this.oilDiscount = 0
} }
this.checkedCities2 = val ? list : []; this.checkedCities2 = val ? list : [];
this.isIndeterminate2 = false; this.isIndeterminate2 = false;
this.isDefaultUseCard(); this.countAmountFull();
}, },
handleCheckedCitiesChange2(value) { handleCheckedCitiesChange2(value) {
if (value.length>0){
this.checkAll3 = false
this.consumeRefuelMoney = 0;
this.isOilStorageCard = false;
}
this.oilDiscount = 0 this.oilDiscount = 0
this.gradeDiscount.forEach(item => { this.gradeDiscount.forEach(item => {
let reduces = 0 let reduces = 0
for (let i = 0; i < value.length; i++){ for (let i = 0; i < value.length; i++){
if (item.type == value[i]){ if (item.gunName == value[i]){
reduces = item.reduce reduces = item.discount
} }
} }
this.oilDiscount += +reduces this.oilDiscount += +reduces
@ -1283,7 +1296,7 @@
let checkedCount = value.length; let checkedCount = value.length;
this.checkAll2 = checkedCount === this.gradeDiscount.length; this.checkAll2 = checkedCount === this.gradeDiscount.length;
this.isIndeterminate2 = checkedCount > 0 && checkedCount < this.gradeDiscount.length; this.isIndeterminate2 = checkedCount > 0 && checkedCount < this.gradeDiscount.length;
this.isDefaultUseCard(); this.countAmountFull();
}, },
handleCheckAllChange3(val) { handleCheckAllChange3(val) {
if (val==false){ if (val==false){
@ -1296,79 +1309,53 @@
} }
this.isDefaultUseCard(); this.isDefaultUseCard();
}, },
handleCheckedCitiesChange3(value) {
let checkedCount = value.length;
this.checkAll3 = checkedCount === this.cities3.length;
this.isIndeterminate3 = checkedCount > 0 && checkedCount < this.cities3.length;
},
handleCheckAllChange4(val) { handleCheckAllChange4(val) {
if (val==false){ if (val==false){
this.countAmountUnBalance();
this.consumeAmount = 0; this.consumeAmount = 0;
this.isUseBalance = true; this.isUseBalance = true;
}else { }else {
this.countAmountFull();
this.isUseBalance = false; 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) { 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){ if (val){
this.couponAmount = 0 // this.couponAmount = 0
this.couponAmount = this.couponDiscount[0].reduce this.couponDiscount.forEach(item => {
this.useCouponIds = "" this.couponAmount = item.discount
this.couponIds.forEach(item => {
if (item.name = this.couponDiscount[0].name){
this.useCouponIds = item.id
}
}) })
this.checkedCities5 = this.couponDiscount[0].name;
this.checkAll3 = false
this.consumeRefuelMoney = 0;
this.isOilStorageCard = false;
}else { }else {
this.useCouponIds = ""
this.couponAmount = 0 this.couponAmount = 0
this.checkedCities5 = "" if (this.balance>0){
this.checkAll4 = true
}
} }
this.isDefaultUseCard(); this.countAmountFull();
}, },
handleCheckedCitiesChange5(value) { handleCheckedCitiesChange5(value) {
if (value.length>0){
this.checkAll3 = false
this.consumeRefuelMoney = 0;
this.isOilStorageCard = false;
}
this.couponAmount = 0; this.couponAmount = 0;
this.couponDiscount.forEach(item => { this.couponDiscount.forEach(item => {
if (item.name == value){ let reduces = 0
this.couponAmount = item.reduce if (item.gunName == value){
} reduces = item.discount
})
this.useCouponIds = ""
this.couponIds.forEach(item => {
if (item.name == value){
this.useCouponIds = item.id
} }
this.couponAmount = reduces
}) })
// let checkedCount = value.length;
this.checkAll5 = true; this.checkAll5 = true;
this.isDefaultUseCard(); this.checkedCities5 = value
// this.isIndeterminate5 = checkedCount > 0 && checkedCount < this.couponDiscount.length;
this.countAmountFull();
}, },
// //
querySearch(queryString, cb) { querySearch(queryString, cb) {
@ -1442,6 +1429,15 @@
this.goodsActualPay = this.goodsAmount - this.goodsDiscount this.goodsActualPay = this.goodsAmount - this.goodsDiscount
this.isSure = false; this.isSure = false;
this.handleChange(); 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){ getGrade(userId,gradeId){
@ -1918,7 +1914,7 @@
if (data.refuelMoney){ if (data.refuelMoney){
// 使 // 使
this.refuelMoney = JSON.parse(data.refuelMoney) this.refuelMoney = JSON.parse(data.refuelMoney)
this.changeRefuelMoney(); await this.changeRefuelMoney();
} }
// await this.getGrade(data.id,data.gradeId) // await this.getGrade(data.id,data.gradeId)
// if (!this.isFixingLevel){ // if (!this.isFixingLevel){
@ -1930,7 +1926,10 @@
// this.getCoupon(); // this.getCoupon();
// } // }
// } // }
this.getOilCoupon() if (this.balance>0){
this.checkAll4 = true
}
await this.getOilCoupon()
}, },
getOilCoupon(){ getOilCoupon(){
let type = 0; let type = 0;
@ -1939,18 +1938,65 @@
}else { }else {
type = 0; 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.type = type
this.paymentActive.mtUserLevel = this.member.gradeId this.paymentActive.mtUserLevel = this.member.gradeId
this.paymentActive.userId = this.member.id this.paymentActive.userId = this.member.id
let _this = this let _this = this
this.oilOrder.forEach(item => { this.oilOrder.forEach(item => {
console.log(item)
_this.paymentActive.amount = item.amount _this.paymentActive.amount = item.amount
_this.paymentActive.oilId = item.oilName _this.paymentActive.oilId = item.oilName
_this.paymentActive.storeId = item.storeId _this.paymentActive.storeId = item.storeId
getPaymentActive(_this.paymentActive).then(res => { 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) console.log("囤油卡",this.isOilStorageCard,this.hoardAmount,this.balance,this.oilAmount,this.oilActualPay,this.consumeAmount)
}, },
// 使使 // 使
countAmountFull(){ countAmountFull(){
if (this.isMember){ if (this.isMember){
// // if (this.balance>0){
if (this.balance >= (this.oilAmount - this.oilDiscount - this.couponAmount)){ // this.checkAll4 = true
// }
if (this.balance >= (this.oilAmount - this.oilDiscount - this.couponAmount - this.fullReduction)){
this.oilActualPay = 0 this.oilActualPay = 0
this.consumeAmount = this.oilAmount - this.oilDiscount - this.couponAmount this.consumeAmount = this.oilAmount - this.oilDiscount - this.couponAmount - this.fullReduction
}else { }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 this.consumeAmount = this.balance
} }
}else { }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(){ countAmountUnBalance(){
if (this.isMember){ if (this.isMember){
this.oilActualPay = (this.oilAmount - this.fullReduction - this.oilDiscount - this.couponAmount).toFixed(2) 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.oilActualPay = (this.oilAmount - this.oilDiscount).toFixed(2)
} }
this.consumeAmount = 0 this.consumeAmount = 0
console.log("优惠券和满减",this.oilAmount , this.fullReduction , this.oilDiscount , this.couponAmount) console.log("不使用储值卡",this.oilAmount , this.fullReduction , this.oilDiscount , this.couponAmount)
}, },
// 使使 || 使使 // 使使 || 使使
countAmountBalance(){ countAmountBalance(){
@ -2102,60 +2150,7 @@
}, },
// //
isExclusion(){ 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(){ isDefaultUseCard(){
@ -2173,7 +2168,7 @@
this.checkAll4 = true; this.checkAll4 = true;
} }
}else { }else {
this.isExclusion() this.countAmountFull()
} }
}, },
// //
@ -2375,7 +2370,7 @@
}) })
}, },
// //
getOilOrder(){ async getOilOrder(){
this.dialogVisibleamount = false this.dialogVisibleamount = false
this.form.oilType = this.oilNameID; this.form.oilType = this.oilNameID;
this.form.type = this.type; 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){ if (res.data.storedQuantity-this.form.liters<0){
this.$modal.msgError("所加油的升数大于油罐内的升数,请重新选择加油升数") this.$modal.msgError("所加油的升数大于油罐内的升数,请重新选择加油升数")
return; return;
@ -2419,7 +2414,9 @@
// this.preferential(); // this.preferential();
// this.getCoupon(); // this.getCoupon();
// } // }
if (this.balance>0){
this.checkAll4 = true
}
this.getOilCoupon() this.getOilCoupon()
} }
} }
@ -2427,6 +2424,9 @@
}, },
// //
changeRefuelMoney(){ changeRefuelMoney(){
this.oilDiscount = 0
this.couponAmount = 0
this.fullReduction = 0
let _this = this; let _this = this;
_this.consumeRefuelMoney = 0; _this.consumeRefuelMoney = 0;
_this.oilActualPay = 0; _this.oilActualPay = 0;
@ -2657,6 +2657,13 @@
_this.isPay = true; _this.isPay = true;
_this.seekZero = 0 _this.seekZero = 0
_this.amount = 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; return;
} }
} }
@ -2666,6 +2673,7 @@
_this.isPay = true; _this.isPay = true;
_this.seekZero = 0 _this.seekZero = 0
_this.amount = 0 _this.amount = 0
_this.resetting1()
return; return;
} }
} }
@ -2786,6 +2794,14 @@
_this.amount = 0 _this.amount = 0
_this.loading = false; _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); clearInterval(timer);
} }
if (response.data.status == "payFail"){ if (response.data.status == "payFail"){
@ -2967,6 +2983,18 @@
oilNumberList().then(response => { oilNumberList().then(response => {
this.oilNumberList = response.data.records; 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;
}, },
}, },

View File

@ -89,7 +89,7 @@
<view class="desc" v-if="preferentialData.cardFavorableAmount"> <view class="desc" v-if="preferentialData.cardFavorableAmount">
<view style="display: flex;"> <view style="display: flex;">
优惠券优惠 优惠券优惠
<span style="display: flex;">(优惠券)</span> <!-- <span style="display: flex;">(优惠券)</span> -->
</view> </view>
<view style="display: flex;"> <view style="display: flex;">
<span style="margin-right: 10px;display: flex;"> <span style="margin-right: 10px;display: flex;">
@ -278,7 +278,6 @@
type: "", type: "",
}; };
}else{ }else{
this.chooseCardBalance(0)
this.oilCardRedece = 0 this.oilCardRedece = 0
this.getPaymentPreferential(this.user.gradeId) this.getPaymentPreferential(this.user.gradeId)
} }
@ -324,6 +323,14 @@
return; return;
} }
if(res.data.success == "ok"){ 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({ uni.reLaunch({
url: '/pagesRefuel/orderSuccess/index' url: '/pagesRefuel/orderSuccess/index'
}) })
@ -353,10 +360,11 @@
success: function (res) { success: function (res) {
console.log('success'); console.log('success');
// 使 // 使
_this.preferentialData.storeId = _this.oilOrder.storeId
request({ request({
url: "business/marketingActivity/cardFavorableRecord/updateCardAndActiveById", url: "business/marketingActivity/cardFavorableRecord/updateCardAndActiveById",
method: 'put', method: 'post',
data: {"paymentActiveVO":_this.preferentialData}, data: _this.preferentialData,
}).then((res)=>{ }).then((res)=>{
console.log(res); console.log(res);
}) })
@ -384,10 +392,11 @@
if(resp.resultCode == '9000'){ if(resp.resultCode == '9000'){
console.log("支付成功") console.log("支付成功")
// 使 // 使
_this.preferentialData.storeId = _this.oilOrder.storeId
request({ request({
url: "business/marketingActivity/cardFavorableRecord/updateCardAndActiveById", url: "business/marketingActivity/cardFavorableRecord/updateCardAndActiveById",
method: 'put', method: 'post',
data: {"paymentActiveVO":_this.preferentialData}, data: _this.preferentialData,
}).then((res)=>{ }).then((res)=>{
console.log(res); console.log(res);
}) })
@ -442,23 +451,23 @@
this.chooseCardBalance(0) this.chooseCardBalance(0)
// this.chooseGrade(this.user.id,this.user.gradeId) // this.chooseGrade(this.user.id,this.user.gradeId)
} }
},
// 使
chooseCardBalance(val){
if (this.oilCardRedece==0){ if (this.oilCardRedece==0){
this.getPaymentPreferential(this.user.gradeId) this.getPaymentPreferential(this.user.gradeId)
} }
},
// 使
chooseCardBalance(val){
console.log("balance"); console.log("balance");
if (this.user.cardBalance>0) { if (this.user.cardBalance>0) {
this.isStoreValueCard = true; this.isStoreValueCard = true;
if (val == 0) { if (val == 0) {
// 使 // 使
if (this.user.cardBalance >= this.oilOrder.orderAmount){ if (this.user.cardBalance >= (this.oilOrder.orderAmount - this.fullRedece - this.couponRedece - this.gradeRedece).toFixed(2)){
this.balanceRedece = this.oilOrder.orderAmount this.balanceRedece = (this.oilOrder.orderAmount - this.fullRedece - this.couponRedece - this.gradeRedece).toFixed(2)
} else { } else {
this.balanceRedece = this.user.cardBalance this.balanceRedece = this.user.cardBalance
this.deductAmount = (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*100-this.balanceRedece*100)/100 this.payAmount = (this.oilOrder.orderAmount - this.fullRedece - this.couponRedece - this.gradeRedece-this.balanceRedece).toFixed(2)
} }
}else{ }else{
// 使 // 使
@ -477,8 +486,8 @@
} }
} }
}else{ }else{
this.deductAmount = this.oilOrder.orderAmount this.deductAmount = (this.oilOrder.orderAmount - this.fullRedece - this.couponRedece - this.gradeRedece).toFixed(2)
this.payAmount = this.oilOrder.orderAmount this.payAmount = (this.oilOrder.orderAmount - this.fullRedece - this.couponRedece - this.gradeRedece).toFixed(2)
} }
}, },
// 使 // 使
@ -842,6 +851,7 @@
_this.chooseRefuelMoney() _this.chooseRefuelMoney()
}else{ }else{
_this.chooseCardBalance(0) _this.chooseCardBalance(0)
_this.getPaymentPreferential(this.user.gradeId)
} }
// _this.chooseGrade(res.data.userVo.id,res.data.userVo.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"); 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)
}) })
}, },
// //