bug
This commit is contained in:
parent
83a0e8367a
commit
af1a1a25f0
@ -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<ActiveDiscountRecords> {
|
||||
//主键id
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
//活动id
|
||||
private Integer activeDiscountId;
|
||||
|
@ -456,11 +456,15 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
|
||||
List<ActiveDiscountPayVO> 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<CardFavorableRecordVO> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//会员等级优惠
|
||||
|
||||
|
@ -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折扣
|
||||
|
@ -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<ActiveFullminusRecords> {
|
||||
//主键id
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
//活动id
|
||||
private Integer activeFullminusId;
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -239,23 +239,29 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
|
||||
//优惠券
|
||||
boolean flag = false;
|
||||
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())){
|
||||
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")){
|
||||
ActiveFullminusRecords activeFullminusRecords = new ActiveFullminusRecords();
|
||||
activeFullminusRecords.setActiveFullminusId(paymentActiveVO.getActiveId());
|
||||
activeFullminusRecords.setUserId(nowAccountInfo.getId());
|
||||
activeFullminusRecords.setStoreId(nowAccountInfo.getStoreId());
|
||||
activeFullminusRecords.setUserId(userId);
|
||||
activeFullminusRecords.setStoreId(paymentActiveVO.getStoreId());
|
||||
flag = activeFullminusRecordsService.save(activeFullminusRecords);
|
||||
}
|
||||
//折扣活动
|
||||
if (ObjectUtils.isNotEmpty(paymentActiveVO.getActiveId()) && paymentActiveVO.getType().equals("2")){
|
||||
ActiveDiscountRecords activeDiscountRecords = new ActiveDiscountRecords();
|
||||
activeDiscountRecords.setActiveDiscountId(paymentActiveVO.getActiveId());
|
||||
activeDiscountRecords.setUserId(nowAccountInfo.getId());
|
||||
activeDiscountRecords.setStoreId(nowAccountInfo.getStoreId());
|
||||
activeDiscountRecords.setUserId(userId);
|
||||
activeDiscountRecords.setStoreId(paymentActiveVO.getStoreId());
|
||||
flag = activeDiscountRecordsService.save(activeDiscountRecords);
|
||||
}
|
||||
return flag;
|
||||
|
@ -27,3 +27,12 @@ export function getPaymentActive(data) {
|
||||
})
|
||||
}
|
||||
|
||||
// 查询优惠券信息
|
||||
export function usePaymentActive(data) {
|
||||
return request({
|
||||
url: '/business/marketingActivity/cardFavorableRecord/updateCardAndActiveById',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -62,13 +62,13 @@
|
||||
<div>
|
||||
<div v-if="fullReduceDiscount.length>0">
|
||||
<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="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="color: red">-¥{{ item.reduce }}</div>
|
||||
<div style="color: grey" v-if="item.discount!=0">满{{ item.full }}元,打{{ item.discount }}折</div>
|
||||
<div style="color: grey" v-else>满{{ item.full }}元,减{{ item.reduce }}元</div>
|
||||
<div style="color: red">-¥{{ item.discount }}</div>
|
||||
<div style="color: grey" v-if="item.type!=1">满减优惠</div>
|
||||
<div style="color: grey" v-if="item.type!=2">折扣优惠</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-checkbox>
|
||||
@ -83,13 +83,13 @@
|
||||
style="color: black;font-size: 16px"
|
||||
v-model="checkAll1" @change="handleCheckAllChange1">
|
||||
</el-checkbox><!--:indeterminate="isIndeterminate1"-->
|
||||
满减活动
|
||||
活动优惠
|
||||
</div>
|
||||
</el-popover>
|
||||
</div>
|
||||
<div>-¥{{ fullReduction }}</div>
|
||||
</div>
|
||||
<div class="center-left-hj" v-show="isMember">
|
||||
<div class="center-left-hj" v-show="isMember && gradeDiscount.length>0">
|
||||
<div>
|
||||
<el-popover
|
||||
placement="bottom-start"
|
||||
@ -97,13 +97,13 @@
|
||||
trigger="click">
|
||||
<div>
|
||||
<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="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="color: red">-¥{{ oilDiscount }}</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 style="color: red">-¥{{ item.discount }}</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>
|
||||
</div>
|
||||
</el-checkbox>
|
||||
@ -120,7 +120,7 @@
|
||||
</div>
|
||||
<div>-¥{{ oilDiscount }}</div>
|
||||
</div>
|
||||
<div class="center-left-hj" v-show="isMember">
|
||||
<div class="center-left-hj" v-show="isMember && refuelMoney">
|
||||
<div>
|
||||
<el-checkbox
|
||||
style="color: black;font-size: 16px"
|
||||
@ -137,7 +137,7 @@
|
||||
</div>
|
||||
<div class="center-left-hj" v-show="isMember">
|
||||
<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">
|
||||
</el-checkbox>
|
||||
储值卡
|
||||
@ -145,26 +145,26 @@
|
||||
</div>
|
||||
<div>-¥{{ consumeAmount }}</div>
|
||||
</div>
|
||||
<div class="center-left-hj" v-show="isMember">
|
||||
<div class="center-left-hj" v-show="isMember && couponDiscount.length>0">
|
||||
<div>
|
||||
<el-popover
|
||||
placement="bottom-start"
|
||||
width="400"
|
||||
trigger="click">
|
||||
<div>
|
||||
<el-radio-group v-model="checkedCities5" @input="handleCheckedCitiesChange5">
|
||||
<el-radio v-for="(item,index) in couponDiscount"
|
||||
:label="item.name" :key="index" style="display: flex;">
|
||||
<div style="display: flex;justify-content: space-between;height: 40px;line-height: 40px;">
|
||||
<div style="width: 200px">{{item.name}}</div>
|
||||
<div style="line-height: 20px;width:150px;font-size: 12px;text-align: right">
|
||||
<div style="color: red">-¥{{ item.reduce }}</div>
|
||||
<div style="color: grey">满{{ item.full }}元,减{{ item.reduce }}元</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<!-- <div>-->
|
||||
<!-- <el-radio-group v-model="checkedCities5" @input="handleCheckedCitiesChange5">-->
|
||||
<!-- <el-radio v-for="(item,index) in couponDiscount"-->
|
||||
<!-- :label="item.gunName" :key="index" style="display: flex;">-->
|
||||
<!-- <div style="display: flex;justify-content: space-between;height: 40px;line-height: 40px;">-->
|
||||
<!-- <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="color: red">-¥{{ item.discount }}</div>-->
|
||||
<!--<!– <div style="color: grey">满{{ item.full }}元,减{{ item.reduce }}元</div>–>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </el-radio>-->
|
||||
<!-- </el-radio-group>-->
|
||||
<!-- </div>-->
|
||||
<div slot="reference">
|
||||
<el-checkbox
|
||||
style="color: black;font-size: 16px"
|
||||
@ -208,7 +208,7 @@
|
||||
<div class="center-left-bottom">
|
||||
<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>
|
||||
<el-button class="center-left-lv" :disabled="(oilAmount + goodsAmount)==0" @click="settlement">立即结算</el-button>
|
||||
</div>
|
||||
@ -446,7 +446,7 @@
|
||||
¥{{ +oilActualPay + (+goodsActualPay) }}
|
||||
</div>
|
||||
<div style="text-align: center;margin-bottom: 10px">
|
||||
合计金额:{{ oilAmount + goodsAmount }}元、优惠合计{{ oilDiscount + goodsDiscount }}元
|
||||
合计金额:{{ oilAmount + goodsAmount }}元、优惠合计{{ oilDiscount + goodsDiscount + fullReduction + couponAmount }}元
|
||||
</div>
|
||||
<div v-if="map.payType != 'CASH'">
|
||||
<div>
|
||||
@ -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;
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -89,7 +89,7 @@
|
||||
<view class="desc" v-if="preferentialData.cardFavorableAmount">
|
||||
<view style="display: flex;">
|
||||
优惠券优惠
|
||||
<span style="display: flex;">(优惠券)</span>
|
||||
<!-- <span style="display: flex;">(优惠券)</span> -->
|
||||
</view>
|
||||
<view style="display: flex;">
|
||||
<span style="margin-right: 10px;display: flex;">
|
||||
@ -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)
|
||||
})
|
||||
},
|
||||
// 获取油品订单
|
||||
|
Loading…
Reference in New Issue
Block a user