This commit is contained in:
齐天大圣 2024-04-09 09:23:11 +08:00
parent aa935c4946
commit 15d263d203
17 changed files with 505 additions and 313 deletions

View File

@ -275,16 +275,15 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="互斥功能" prop="exclusiveFunction" style="margin-left: 10px"> <el-form-item label="互斥功能" prop="exclusiveFunctionList" style="margin-left: 10px">
<el-radio-group v-model="form.exclusiveFunction" @input="radioCile"> <el-checkbox-group v-model="form.exclusiveFunctionList">
<el-radio label="0">满减活动</el-radio> <el-checkbox label="0">满减活动</el-checkbox>
<el-radio label="1">储值卡付款</el-radio> <el-checkbox label="1">储值卡付款</el-checkbox>
<el-radio label="2">会员等级</el-radio> <el-checkbox label="2">会员等级</el-checkbox>
<el-radio label=""></el-radio> </el-checkbox-group>
</el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="会员等级" prop="region" v-if="form.exclusiveFunction == '2' " > <el-form-item label="会员等级" prop="region" v-if="form.exclusiveFunctionList && form.exclusiveFunctionList.length>0 && form.exclusiveFunctionList.includes('2') " >
<el-select v-model="form.membershipLevel" multiple placeholder="会员等级" > <el-select v-model="form.membershipLevel" multiple placeholder="会员等级" >
<el-option v-for="(item,index) in vipname" :key="index" :label="item.name" :value="item.id.toString()"></el-option> <el-option v-for="(item,index) in vipname" :key="index" :label="item.name" :value="item.id.toString()"></el-option>
</el-select> </el-select>
@ -473,6 +472,7 @@ export default {
checkDateType: null, checkDateType: null,
checkTime: [], checkTime: [],
checkOutTime: null, checkOutTime: null,
exclusiveFunctionList: [],
exclusiveFunction: null, exclusiveFunction: null,
claimRule: null, claimRule: null,
count: null, count: null,
@ -650,6 +650,7 @@ export default {
checkDateType: null, checkDateType: null,
checkTime: [], checkTime: [],
checkOutTime: null, checkOutTime: null,
exclusiveFunctionList:[],
exclusiveFunction: null, exclusiveFunction: null,
claimRule: null, claimRule: null,
count: null, count: null,

View File

@ -25,6 +25,8 @@ public class ActiveConsumptionVO implements Serializable {
private double amount; private double amount;
//折扣 //折扣
private String activeGift; private String activeGift;
private String participationAcount;
//券id //券id
private Integer vouchersId; private Integer vouchersId;
private Integer limitAcount;
} }

View File

@ -7,7 +7,7 @@ import java.math.BigDecimal;
@Data @Data
public class PaymentActiveDTO implements Serializable { public class PaymentActiveDTO implements Serializable {
//支付类型 0储值卡 1没用储值卡 //支付类型 0储值卡 1囤油卡 2.其他
private String type; private String type;
//支付金额 //支付金额
private BigDecimal amount; private BigDecimal amount;

View File

@ -9,7 +9,9 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumption; import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumption;
import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumptionChild; import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumptionChild;
import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumptionRecord;
import com.fuint.business.marketingActivity.activeConsumption.service.ActiveConsumptionChildService; import com.fuint.business.marketingActivity.activeConsumption.service.ActiveConsumptionChildService;
import com.fuint.business.marketingActivity.activeConsumption.service.ActiveConsumptionRecordService;
import com.fuint.business.marketingActivity.activeConsumption.service.ActiveConsumptionService; import com.fuint.business.marketingActivity.activeConsumption.service.ActiveConsumptionService;
import com.fuint.business.marketingActivity.activeConsumption.vo.ActiveConsumptionAppletVO; import com.fuint.business.marketingActivity.activeConsumption.vo.ActiveConsumptionAppletVO;
import com.fuint.business.marketingActivity.activeDiscount.entity.ActiveDiscount; import com.fuint.business.marketingActivity.activeDiscount.entity.ActiveDiscount;
@ -595,18 +597,21 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
List<CardFavorableRecordVO> canUserCardFavorableList1 = cardFavorableRecordMapper.getCanUserCardFavorableList(paymentActiveDTO); List<CardFavorableRecordVO> canUserCardFavorableList1 = cardFavorableRecordMapper.getCanUserCardFavorableList(paymentActiveDTO);
List<CardFavorableRecordVO> canUserCardFavorableList = new ArrayList<>(); List<CardFavorableRecordVO> canUserCardFavorableList = new ArrayList<>();
//如果是储值卡付款直接过滤掉 //如果是储值卡付款直接过滤掉
if (paymentActiveDTO.getType().equals("0")) { for (CardFavorableRecordVO cardFavorableRecordVO : canUserCardFavorableList1) {
if (paymentActiveDTO.getType().equals("0") && ObjectUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && !cardFavorableRecordVO.getExclusiveFunction().contains("1")){
canUserCardFavorableList.add(cardFavorableRecordVO);
}else if(!paymentActiveDTO.getType().equals("0")){
canUserCardFavorableList.add(cardFavorableRecordVO);
}
}
/* if () {
// canUserCardFavorableList = canUserCardFavorableList.stream().filter(cardFavorableRecordVO -> ObjectUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction())) // canUserCardFavorableList = canUserCardFavorableList.stream().filter(cardFavorableRecordVO -> ObjectUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()))
// .filter(cardFavorableRecordVO ->cardFavorableRecordVO.getExclusiveFunction().equals("0")) // .filter(cardFavorableRecordVO ->cardFavorableRecordVO.getExclusiveFunction().equals("0"))
// .collect(Collectors.toList()); // .collect(Collectors.toList());
for (CardFavorableRecordVO cardFavorableRecordVO : canUserCardFavorableList1) {
if (ObjectUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && !cardFavorableRecordVO.getExclusiveFunction().equals("1")){ }else {
canUserCardFavorableList.add(cardFavorableRecordVO);
}else if (ObjectUtils.isEmpty(cardFavorableRecordVO.getExclusiveFunction())){ }*/
canUserCardFavorableList.add(cardFavorableRecordVO);
}
}
}
//会员等级当前优惠力度最大 //会员等级当前优惠力度最大
//无限制条件的活动列表 //无限制条件的活动列表
@ -640,23 +645,26 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
//优惠券 //优惠券
if (CollectionUtils.isNotEmpty(canUserCardFavorableList)) { if (CollectionUtils.isNotEmpty(canUserCardFavorableList)) {
for (CardFavorableRecordVO cardFavorableRecordVO : canUserCardFavorableList) { for (CardFavorableRecordVO cardFavorableRecordVO : canUserCardFavorableList) {
if (StringUtils.isEmpty(cardFavorableRecordVO.getExclusiveFunction())) { /*if (StringUtils.isEmpty(cardFavorableRecordVO.getExclusiveFunction())) {
cardFavorableRecordVOS.add(cardFavorableRecordVO); cardFavorableRecordVOS.add(cardFavorableRecordVO);
} }
if (StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && cardFavorableRecordVO.getExclusiveFunction().equals("0")) { if (StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && cardFavorableRecordVO.getExclusiveFunction().contains("0")) {
cardFavorableRecordVOS.add(cardFavorableRecordVO); cardFavorableRecordVOS.add(cardFavorableRecordVO);
} }*/
boolean flag = false; boolean flag = false;
if (StringUtils.isNotEmpty(cardFavorableRecordVO.getMembershipLevel()) && StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && cardFavorableRecordVO.getExclusiveFunction().equals("2")) { if (StringUtils.isNotEmpty(cardFavorableRecordVO.getMembershipLevel()) && StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && cardFavorableRecordVO.getExclusiveFunction().contains("2")) {
String membershipLevel = cardFavorableRecordVO.getMembershipLevel(); String membershipLevel = cardFavorableRecordVO.getMembershipLevel();
for (String s : membershipLevel.split(",")) { for (String s : membershipLevel.split(",")) {
if (paymentActiveDTO.getMtUserLevel().toString().equals(s)){ if (paymentActiveDTO.getMtUserLevel().toString().equals(s)){
flag = true; flag = true;
break;
} }
} }
if (!flag){ if (!flag){
cardFavorableRecordVOS.add(cardFavorableRecordVO); cardFavorableRecordVOS.add(cardFavorableRecordVO);
} }
}else if (StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && !cardFavorableRecordVO.getExclusiveFunction().contains("2")){
cardFavorableRecordVOS.add(cardFavorableRecordVO);
} }
} }
} }
@ -665,8 +673,8 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
if (ObjectUtil.isNotEmpty(activeDiscountPayVO.getParticipationCondition()) if (ObjectUtil.isNotEmpty(activeDiscountPayVO.getParticipationCondition())
&& !activeDiscountPayVO.getParticipationCondition().equals("1")) { && !activeDiscountPayVO.getParticipationCondition().equals("1")) {
for (CardFavorableRecordVO cardFavorableRecordVO : canUserCardFavorableList) { for (CardFavorableRecordVO cardFavorableRecordVO : canUserCardFavorableList) {
if (StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && cardFavorableRecordVO.getExclusiveFunction().equals("2") if (StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && cardFavorableRecordVO.getExclusiveFunction().contains("2")
&& StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && !cardFavorableRecordVO.getExclusiveFunction().equals("0")) { && StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && !cardFavorableRecordVO.getExclusiveFunction().contains("0")) {
ActiveDiscountPayVO activeDiscountPayVO1 = new ActiveDiscountPayVO(); ActiveDiscountPayVO activeDiscountPayVO1 = new ActiveDiscountPayVO();
BeanUtils.copyProperties(activeDiscountPayVO, activeDiscountPayVO1); BeanUtils.copyProperties(activeDiscountPayVO, activeDiscountPayVO1);
activeDiscountPayVO1.setCouponId(cardFavorableRecordVO.getId()); activeDiscountPayVO1.setCouponId(cardFavorableRecordVO.getId());
@ -679,7 +687,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
activeDiscountPayVO1.setCardFavorableAmount(BigDecimal.valueOf(cardFavorableRecordVO.getDiscountAmount())); activeDiscountPayVO1.setCardFavorableAmount(BigDecimal.valueOf(cardFavorableRecordVO.getDiscountAmount()));
activeDiscountPayVO1.setCardFavorableInfo(cardFavorableRecordVO.getCardFavorableName()); activeDiscountPayVO1.setCardFavorableInfo(cardFavorableRecordVO.getCardFavorableName());
cardAndDisPays.add(activeDiscountPayVO1); cardAndDisPays.add(activeDiscountPayVO1);
} else if (StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && cardFavorableRecordVO.getExclusiveFunction().equals("0")) { } else if (StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && cardFavorableRecordVO.getExclusiveFunction().contains("0")) {
ActiveDiscountPayVO activeDiscountPayVO1 = new ActiveDiscountPayVO(); ActiveDiscountPayVO activeDiscountPayVO1 = new ActiveDiscountPayVO();
BeanUtils.copyProperties(activeDiscountPayVO, activeDiscountPayVO1); BeanUtils.copyProperties(activeDiscountPayVO, activeDiscountPayVO1);
String[] split = cardFavorableRecordVO.getOilType().split(","); String[] split = cardFavorableRecordVO.getOilType().split(",");
@ -719,7 +727,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
activeDiscountPayVO1.setCardFavorableAmount(BigDecimal.valueOf(cardFavorableRecordVO.getDiscountAmount())); activeDiscountPayVO1.setCardFavorableAmount(BigDecimal.valueOf(cardFavorableRecordVO.getDiscountAmount()));
activeDiscountPayVO1.setCardFavorableInfo(cardFavorableRecordVO.getCardFavorableName()); activeDiscountPayVO1.setCardFavorableInfo(cardFavorableRecordVO.getCardFavorableName());
cardAndComPays.add(activeDiscountPayVO1); cardAndComPays.add(activeDiscountPayVO1);
} else if (StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && cardFavorableRecordVO.getExclusiveFunction().equals("0")) { } else if (StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && cardFavorableRecordVO.getExclusiveFunction().contains("0")) {
ActiveDiscountPayVO activeDiscountPayVO1 = new ActiveDiscountPayVO(); ActiveDiscountPayVO activeDiscountPayVO1 = new ActiveDiscountPayVO();
BeanUtils.copyProperties(activeDiscountPayVO, activeDiscountPayVO1); BeanUtils.copyProperties(activeDiscountPayVO, activeDiscountPayVO1);
String[] split = cardFavorableRecordVO.getOilType().split(","); String[] split = cardFavorableRecordVO.getOilType().split(",");
@ -982,18 +990,48 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
return paymentActiveVO; return paymentActiveVO;
} }
@Resource
private ActiveConsumptionRecordService activeConsumptionRecordService;
@Override @Override
public void activeConsumption (PaymentActiveDTO paymentActiveDTO) throws Exception { public void activeConsumption (PaymentActiveDTO paymentActiveDTO) throws Exception {
//消费有礼 //消费有礼
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
ArrayList<ActiveConsumptionVO> activeConsumptionVOS1 = new ArrayList<>(); ArrayList<ActiveConsumptionVO> activeConsumptionVOS1 = new ArrayList<>();
List<ActiveConsumptionVO> activeConsumptionVOS = oilOrderMapper.selectActiveConsumption(paymentActiveDTO.getStoreId(), paymentActiveDTO.getAmount()); List<ActiveConsumptionVO> activeConsumptionVOS = oilOrderMapper.selectActiveConsumption(paymentActiveDTO.getStoreId(), paymentActiveDTO.getOrderAmount());
if (CollectionUtils.isNotEmpty(activeConsumptionVOS)) { if (CollectionUtils.isNotEmpty(activeConsumptionVOS)) {
for (ActiveConsumptionVO activeConsumptionVO : activeConsumptionVOS) { for (ActiveConsumptionVO activeConsumptionVO : activeConsumptionVOS) {
if (activeConsumptionVO.getParticipationAcount().equals("1")){
Integer limitAcount = activeConsumptionVO.getLimitAcount();
//查询这个人参与过几次
LambdaQueryWrapper<ActiveConsumptionRecord> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ActiveConsumptionRecord::getActiveConsumptionId,activeConsumptionVO.getActiveId());
queryWrapper.eq(ActiveConsumptionRecord::getStoreId,paymentActiveDTO.getStoreId());
if (ObjectUtils.isNotEmpty(paymentActiveDTO.getUserId())){
queryWrapper.eq(ActiveConsumptionRecord::getUserId,paymentActiveDTO.getUserId());
}else {
queryWrapper.eq(ActiveConsumptionRecord::getUserId,nowAccountInfo.getId());
}
List<ActiveConsumptionRecord> list = activeConsumptionRecordService.list(queryWrapper);
if (CollectionUtils.isNotEmpty(list) && list.size() >= limitAcount){
continue;
}
ActiveConsumptionRecord activeConsumptionRecord = new ActiveConsumptionRecord();
activeConsumptionRecord.setActiveConsumptionId(activeConsumptionVO.getActiveId());
if (ObjectUtils.isNotEmpty(paymentActiveDTO.getUserId())){
activeConsumptionRecord.setUserId(paymentActiveDTO.getUserId());
}else {
activeConsumptionRecord.setUserId(nowAccountInfo.getId());
}
activeConsumptionRecord.setStoreId(paymentActiveDTO.getStoreId());
activeConsumptionRecordService.save(activeConsumptionRecord);
}
BigDecimal amount = new BigDecimal(activeConsumptionVO.getAmount()); BigDecimal amount = new BigDecimal(activeConsumptionVO.getAmount());
if (ObjectUtils.isNotEmpty(activeConsumptionVO.getMoneyType()) && activeConsumptionVO.getMoneyType().equals("1") if (ObjectUtils.isNotEmpty(activeConsumptionVO.getMoneyType()) && activeConsumptionVO.getMoneyType().equals("1")
&& paymentActiveDTO.getOrderAmount() >= activeConsumptionVO.getAmount()) { && paymentActiveDTO.getOrderAmount() >= activeConsumptionVO.getAmount()) {
activeConsumptionVOS1.add(activeConsumptionVO); activeConsumptionVOS1.add(activeConsumptionVO);
} }
if (ObjectUtils.isNotEmpty(activeConsumptionVO.getMoneyType()) && activeConsumptionVO.getMoneyType().equals("2") if (ObjectUtils.isNotEmpty(activeConsumptionVO.getMoneyType()) && activeConsumptionVO.getMoneyType().equals("2")
&& paymentActiveDTO.getAmount().compareTo(amount) > 0) { && paymentActiveDTO.getAmount().compareTo(amount) > 0) {
activeConsumptionVOS1.add(activeConsumptionVO); activeConsumptionVOS1.add(activeConsumptionVO);

View File

@ -8,6 +8,7 @@ import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* (CardFavorable)表实体类 * (CardFavorable)表实体类
@ -76,6 +77,7 @@ public class CardFavorableDTO extends Model<CardFavorableDTO> {
private Date checkOutTime; private Date checkOutTime;
//互斥功能 0满减活动 1储值卡付款 //互斥功能 0满减活动 1储值卡付款
private String exclusiveFunction; private String exclusiveFunction;
private List<String> exclusiveFunctionList;
//领取规则 0每人限领一张 1每人每日限领一张 //领取规则 0每人限领一张 1每人每日限领一张
private String claimRule; private String claimRule;
//发放数量 //发放数量

View File

@ -1,6 +1,7 @@
package com.fuint.business.marketingActivity.cardFavorable.entity; package com.fuint.business.marketingActivity.cardFavorable.entity;
import java.util.Date; import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
@ -78,6 +79,7 @@ public class CardFavorable extends Model<CardFavorable> {
private Date checkOutTime; private Date checkOutTime;
//互斥功能 0满减活动 1储值卡付款 //互斥功能 0满减活动 1储值卡付款
private String exclusiveFunction; private String exclusiveFunction;
//领取规则 0每人限领一张 1每人每日限领一张 //领取规则 0每人限领一张 1每人每日限领一张
private String claimRule; private String claimRule;
//发放数量 //发放数量

View File

@ -58,6 +58,8 @@ public class CardFavorableRecord extends Model<CardFavorableRecord> {
//更新时间 //更新时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
private Date updateTime; private Date updateTime;
//优惠类型 0满减券 1折扣券
private String discountType;
//优惠金额 //优惠金额
private Double discountAmount; private Double discountAmount;
//满足金额 //满足金额

View File

@ -94,11 +94,12 @@
card_favorables.endTime, card_favorables.endTime,
card_favorables.createTime, card_favorables.createTime,
card_favorables.useStatus, card_favorables.useStatus,
card_favorables.exclusiveFunction card_favorables.exclusiveFunction,
card_favorables.satisfiedAmount
from from
(SELECT (SELECT
'优惠券' AS couponType, '优惠券' AS couponType,
cf.NAME couponName ,cf.id id,cf.discount_amount couponAmount,cf.card_detail couponContent,cf.instruction instruction, cf.NAME couponName ,cf.id id,cfr.discount_amount couponAmount,cfr.satisfied_amount satisfiedAmount, cf.card_detail couponContent,cf.instruction instruction,
cfr.id cardRecordId, cfr.end_time endTime, cf.exclusive_function exclusiveFunction,cfr.status useStatus,cfr.create_time createTime cfr.id cardRecordId, cfr.end_time endTime, cf.exclusive_function exclusiveFunction,cfr.status useStatus,cfr.create_time createTime
FROM FROM
card_favorable cf card_favorable cf
@ -115,7 +116,7 @@
and cf.type != 1 UNION ALL and cf.type != 1 UNION ALL
SELECT SELECT
'兑换券' AS couponType, '兑换券' AS couponType,
ce.NAME couponName, ce.id id, ce.count couponAmount, ce.card_detail couponContent,ce.use_instructions instruction,cer.id cardRecordId, ce.NAME couponName, ce.id id, ce.count couponAmount, cer.gift_name couponContent,cer.active_id satisfiedAmount,ce.use_instructions instruction,cer.id cardRecordId,
cer.out_time endTime, ce.qr_code_link exclusiveFunction,cer.status useStatus,cer.create_time createTime cer.out_time endTime, ce.qr_code_link exclusiveFunction,cer.status useStatus,cer.create_time createTime
FROM FROM
card_exchange_record cer card_exchange_record cer
@ -132,7 +133,7 @@
and cer.store_id = #{cardFavorableDTOS.storeId} UNION ALL and cer.store_id = #{cardFavorableDTOS.storeId} UNION ALL
SELECT SELECT
'洗车券' AS couponType, '洗车券' AS couponType,
ce.NAME couponName, ce.id id, ce.count couponAmount, ce.card_detail couponContent, ce.use_instructions instruction, ce.NAME couponName, ce.id id, ce.count couponAmount, cer.gift_name couponContent,cer.active_id satisfiedAmount, ce.use_instructions instruction,
cer.id cardRecordId, cer.out_time endTime, ce.qr_code_link exclusiveFunction,cer.status useStatus,cer.create_time createTime cer.id cardRecordId, cer.out_time endTime, ce.qr_code_link exclusiveFunction,cer.status useStatus,cer.create_time createTime
FROM FROM
card_exchange_record cer card_exchange_record cer
@ -146,16 +147,7 @@
<if test="cardFavorableDTOS.useStatus == 0"> <if test="cardFavorableDTOS.useStatus == 0">
and cer.status = #{cardFavorableDTOS.useStatus} and cer.status = #{cardFavorableDTOS.useStatus}
</if> </if>
and cer.store_id = #{cardFavorableDTOS.storeId} UNION ALL and cer.store_id = #{cardFavorableDTOS.storeId}
SELECT
'洗车卡' AS couponType,
ce.NAME couponName, ce.id id, ce.count couponAmount, ce.use_instructions couponContent,ce.use_instructions instruction,cer.id cardRecordId,
cer.out_time endTime, ce.qr_code_link exclusiveFunction,cer.status useStatus,cer.create_time createTime
FROM
card_exchange_record cer
LEFT JOIN card_exchange ce ON cer.card_exchange_id = ce.id
WHERE
cer.mt_user_id = #{cardFavorableDTOS.id}
<if test="cardFavorableDTOS.useStatus!=null and cardFavorableDTOS.useStatus != ''"> <if test="cardFavorableDTOS.useStatus!=null and cardFavorableDTOS.useStatus != ''">
and cer.status = #{cardFavorableDTOS.useStatus} and cer.status = #{cardFavorableDTOS.useStatus}
</if> </if>
@ -177,13 +169,13 @@
cf.id id, cf.id id,
cf.NAME cardFavorableName, cf.NAME cardFavorableName,
cf.type type, cf.type type,
cf.discount_amount discountAmount, cfr.discount_amount discountAmount,
cf.oil_type oilType, cf.oil_type oilType,
cf.satisfied_amount satisfiedAmount, cfr.satisfied_amount satisfiedAmount,
cf.exclusive_function exclusiveFunction, cf.exclusive_function exclusiveFunction,
cf.membership_level membershipLevel, cf.membership_level membershipLevel,
(case cf.discount_type when'1'then cf.satisfied_amount * (1-(cf.special_discount * ${paymentActiveDTO.amount})) (case cf.discount_type when'1'then cfr.satisfied_amount * (1-(cfr.special_discount * ${paymentActiveDTO.amount}))
when '0' then cf.discount_amount when '0' then cfr.discount_amount
end) as amount end) as amount
FROM FROM
card_favorable cf card_favorable cf

View File

@ -83,6 +83,12 @@ public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, C
userLevel +=s+","; userLevel +=s+",";
} }
} }
String exclusion = "";
List<String> exclusiveFunctionList = cardFavorableDTO.getExclusiveFunctionList();
for (String s : exclusiveFunctionList) {
exclusion+=s + ",";
}
cardFavorable.setExclusiveFunction(exclusion);
cardFavorable.setMembershipLevel(userLevel); cardFavorable.setMembershipLevel(userLevel);
return save(cardFavorable); return save(cardFavorable);
} }
@ -251,6 +257,8 @@ public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, C
.map(String::valueOf) .map(String::valueOf)
.toArray(String[]::new)); .toArray(String[]::new));
} }
String[] split = favorable.getExclusiveFunction().split(",");
cardFavorableVO.setExclusiveFunctionList(Arrays.asList(split));
return cardFavorableVO; return cardFavorableVO;
} }
@ -288,6 +296,12 @@ public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, C
cardFavorable.setCardDetail(""+cardFavorableDTO.getSatisfiedAmount()+""+cardFavorableDTO.getSpecialDiscount()+""); cardFavorable.setCardDetail(""+cardFavorableDTO.getSatisfiedAmount()+""+cardFavorableDTO.getSpecialDiscount()+"");
} }
cardFavorable.setInstruction("消费可用!"); cardFavorable.setInstruction("消费可用!");
String exclusive = "";
List<String> exclusiveFunctionList = cardFavorableDTO.getExclusiveFunctionList();
for (String s : exclusiveFunctionList) {
exclusive += s + ',';
}
cardFavorable.setExclusiveFunction(exclusive);
return updateById(cardFavorable); return updateById(cardFavorable);
} }
@ -305,6 +319,13 @@ public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, C
cardFavorableDTOS.setId(id); cardFavorableDTOS.setId(id);
IPage<CouponVO> couponVOS = cardFavorableRecordMapper.selectAllByCondition(page,cardFavorableDTOS); IPage<CouponVO> couponVOS = cardFavorableRecordMapper.selectAllByCondition(page,cardFavorableDTOS);
List<CouponVO> records = couponVOS.getRecords(); List<CouponVO> records = couponVOS.getRecords();
for (CouponVO record : records) {
if (record.getCouponType().equals("优惠券")){
record.setCouponContent(""+record.getSatisfiedAmount()+""+record.getCouponAmount()+"");
}else {
record.setCouponContent("可兑换:"+record.getCouponContent());
}
}
//有效期 //有效期
List<CouponVO> collect = records.stream().filter(s -> s.getEndTime().getTime() < System.currentTimeMillis()).collect(Collectors.toList()); List<CouponVO> collect = records.stream().filter(s -> s.getEndTime().getTime() < System.currentTimeMillis()).collect(Collectors.toList());
if (ObjectUtils.isNotEmpty(collect)){ if (ObjectUtils.isNotEmpty(collect)){

View File

@ -8,6 +8,7 @@ import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* (CardFavorable)表实体类 * (CardFavorable)表实体类
@ -28,6 +29,7 @@ public class CardFavorableVO extends Model<CardFavorableVO> {
//是否在线 0在线 1 下线 //是否在线 0在线 1 下线
private String isonline; private String isonline;
private String[] membershipLevel; private String[] membershipLevel;
private List<String> exclusiveFunctionList;
//优惠券名称 //优惠券名称
private String name; private String name;
//卡券类型 0油品券 1商品券 2通用券 //卡券类型 0油品券 1商品券 2通用券

View File

@ -18,6 +18,7 @@ public class CouponVO implements Serializable {
private String exclusiveFunction; private String exclusiveFunction;
//券金额 //券金额
private String couponAmount; private String couponAmount;
private String satisfiedAmount;
//券名称 //券名称
private String couponName; private String couponName;
//券内容 //券内容

View File

@ -110,7 +110,7 @@ public interface OilOrderMapper extends BaseMapper<OilOrder> {
* @param amount * @param amount
* @return * @return
*/ */
List<ActiveConsumptionVO> selectActiveConsumption(@Param("storeId") Integer storeId, @Param("amount")BigDecimal amount); List<ActiveConsumptionVO> selectActiveConsumption(@Param("storeId") Integer storeId, @Param("amount")Double amount);
Map<String, String> orderStatistics( @Param("order") OilOrder order); Map<String, String> orderStatistics( @Param("order") OilOrder order);

View File

@ -475,6 +475,8 @@
ac.participation_condition_money amount, ac.participation_condition_money amount,
ac.adapt_user_type adaptUserType, ac.adapt_user_type adaptUserType,
ac.money_type moneyType, ac.money_type moneyType,
ac.participation_acount participationAcount,
ac.limit_acount limitAcount,
acc.active_gift activeGift, acc.active_gift activeGift,
acc.vouchers_id vouchersId acc.vouchers_id vouchersId
FROM FROM

View File

@ -27,6 +27,7 @@ import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountVO;
import com.fuint.business.marketingActivity.activeExchange.vo.PaymentActiveVO; import com.fuint.business.marketingActivity.activeExchange.vo.PaymentActiveVO;
import com.fuint.business.marketingActivity.activeFullminus.service.ActiveFullminusService; import com.fuint.business.marketingActivity.activeFullminus.service.ActiveFullminusService;
import com.fuint.business.marketingActivity.activeFullminus.vo.ActiveFullminusVO; import com.fuint.business.marketingActivity.activeFullminus.vo.ActiveFullminusVO;
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService; import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService;
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService; import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService;
import com.fuint.business.marketingActivity.cardFavorable.vo.CardFavorableVO; import com.fuint.business.marketingActivity.cardFavorable.vo.CardFavorableVO;
@ -282,6 +283,19 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
if (StringUtils.isNotEmpty(map.get("cardFavorableId"))){ if (StringUtils.isNotEmpty(map.get("cardFavorableId"))){
cardFavorableId = Integer.valueOf(map.get("cardFavorableId")); cardFavorableId = Integer.valueOf(map.get("cardFavorableId"));
} }
if (ObjectUtils.isNotEmpty(cardFavorableId) && StringUtils.isNotEmpty(map.get("userId"))){
Integer userId = Integer.valueOf(map.get("userId"));
LambdaQueryWrapper<CardFavorableRecord> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(CardFavorableRecord::getMtUserId, userId);
queryWrapper.eq(CardFavorableRecord::getCardFavorableId, cardFavorableId);
queryWrapper.eq(CardFavorableRecord::getStoreId, storeId);
queryWrapper.eq(CardFavorableRecord::getStatus, 0);
List<CardFavorableRecord> list = cardFavorableRecordService.list(queryWrapper);
list.get(0).setStatus("1");
cardFavorableRecordService.updateById(list.get(0));
}
Integer recordId = null; Integer recordId = null;
if (StringUtils.isNotEmpty(map.get("recordId"))){ if (StringUtils.isNotEmpty(map.get("recordId"))){
recordId = Integer.valueOf(map.get("recordId")); recordId = Integer.valueOf(map.get("recordId"));
@ -462,7 +476,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
if (ObjectUtil.isNotEmpty(jsonObjects.get(i).get("type"))){ if (ObjectUtil.isNotEmpty(jsonObjects.get(i).get("type"))){
order.setActiveType(jsonObjects.get(i).get("type").toString()); order.setActiveType(jsonObjects.get(i).get("type").toString());
} }
if (payType.equals("CASH") || payType.equals("credit")){ if (payType.equals("CASH") || payType.equals("credit") || payType.equals("balance")){
order.setPayTime(new Date()); order.setPayTime(new Date());
this.addOilTrack(jsonObjects.get(i),storeId); this.addOilTrack(jsonObjects.get(i),storeId);
this.updateCardAndActiveById(storeId,userId,order.getActiveId(),order.getCouponId(),order.getActiveType(),order.getOrderAmount(),order.getPayAmount(), Integer.valueOf(order.getOils())); this.updateCardAndActiveById(storeId,userId,order.getActiveId(),order.getCouponId(),order.getActiveType(),order.getOrderAmount(),order.getPayAmount(), Integer.valueOf(order.getOils()));
@ -1105,6 +1119,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
@Override @Override
public Map<String, Object> appletPay(Map<String, String> map) throws Exception { public Map<String, Object> appletPay(Map<String, String> map) throws Exception {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
String orderNo = map.get("orderNo"); String orderNo = map.get("orderNo");
// 支付金额 // 支付金额
Double payAmount = Double.valueOf(map.get("payAmount")); Double payAmount = Double.valueOf(map.get("payAmount"));
@ -1146,6 +1161,18 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
// 获取油品信息 // 获取油品信息
OilNumber oilNumber = oilNumberService.selectOilNumberByOilName(oilOrder.getOils(), oilOrder.getStoreId()); OilNumber oilNumber = oilNumberService.selectOilNumberByOilName(oilOrder.getOils(), oilOrder.getStoreId());
if (ObjectUtils.isNotEmpty(cardFavorableId)){
Integer userId = nowAccountInfo.getId();
LambdaQueryWrapper<CardFavorableRecord> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(CardFavorableRecord::getMtUserId, userId);
queryWrapper.eq(CardFavorableRecord::getCardFavorableId, cardFavorableId);
queryWrapper.eq(CardFavorableRecord::getStoreId, nowAccountInfo.getStoreId());
queryWrapper.eq(CardFavorableRecord::getStatus, 0);
List<CardFavorableRecord> list = cardFavorableRecordService.list(queryWrapper);
list.get(0).setStatus("1");
cardFavorableRecordService.updateById(list.get(0));
}
boolean result = false; boolean result = false;
Integer userId = oilOrder.getUserId(); Integer userId = oilOrder.getUserId();
@ -1512,6 +1539,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
String refuelMoney1 = balance.getRefuelMoney(); String refuelMoney1 = balance.getRefuelMoney();
JSONArray objects = JSONArray.parseArray(refuelMoney); JSONArray objects = JSONArray.parseArray(refuelMoney);
JSONArray objects1 = JSONArray.parseArray(refuelMoney1); JSONArray objects1 = JSONArray.parseArray(refuelMoney1);
if (ObjectUtils.isNotEmpty(objects1)){
for (int i = 0;i<objects1.size();i++){ for (int i = 0;i<objects1.size();i++){
if (!((JSONObject)objects1.get(i)).get("refuelMoney").toString().equals(((JSONObject)objects.get(i)).get("refuelMoney").toString())){ if (!((JSONObject)objects1.get(i)).get("refuelMoney").toString().equals(((JSONObject)objects.get(i)).get("refuelMoney").toString())){
Double oilBalance = Double.valueOf(((JSONObject) objects1.get(i)).get("refuelMoney").toString()) - Double.valueOf(((JSONObject) objects.get(i)).get("refuelMoney").toString()); Double oilBalance = Double.valueOf(((JSONObject) objects1.get(i)).get("refuelMoney").toString()) - Double.valueOf(((JSONObject) objects.get(i)).get("refuelMoney").toString());
@ -1519,6 +1547,8 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
this.insertOilBalance(userid,storeId,oilName.getId().toString(),oilName.getOilType(),oilBalance,afterOilBalance,orderNo); this.insertOilBalance(userid,storeId,oilName.getId().toString(),oilName.getOilType(),oilBalance,afterOilBalance,orderNo);
} }
} }
}
balance.setRefuelMoney(refuelMoney); balance.setRefuelMoney(refuelMoney);
} }
// 查询会员等级列表信息 // 查询会员等级列表信息

View File

@ -11,6 +11,7 @@ import com.fuint.business.storeInformation.entity.LJStore;
import com.fuint.business.storeInformation.service.ILJStoreService; import com.fuint.business.storeInformation.service.ILJStoreService;
import com.fuint.business.userManager.entity.LJUser; import com.fuint.business.userManager.entity.LJUser;
import com.fuint.business.userManager.service.LJUserService; import com.fuint.business.userManager.service.LJUserService;
import com.fuint.common.annotation.ExpirationCheck;
import com.fuint.common.dto.AccountInfo; import com.fuint.common.dto.AccountInfo;
import com.fuint.common.dto.UserDto; import com.fuint.common.dto.UserDto;
import com.fuint.common.enums.AdminRoleEnum; import com.fuint.common.enums.AdminRoleEnum;
@ -118,6 +119,19 @@ public class BackendLoginController extends BaseController {
return getFailureResult(201,"请登录终台端!"); return getFailureResult(201,"请登录终台端!");
} }
LambdaQueryWrapper<SysDept> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(SysDept::getDeptId,one.getDeptId());
SysDept one1 = iSysDeptService.getOne(queryWrapper1);
if (ObjectUtils.isNotEmpty(one1) && ObjectUtils.isNotEmpty(one1.getTurnoverType()) && one1.getTurnoverType().equals("2")){
if (ObjectUtils.isNotEmpty(one1.getTurnoverEndTime())){
Date date = new Date();
Date turnoverEndTime = one1.getTurnoverEndTime();
if (date.compareTo(turnoverEndTime)>0){
return getFailureResult(201,"请付费后再登录!");
}
}
}
Boolean captchaVerify = captchaService.checkCodeByUuid(captchaCode, uuid); Boolean captchaVerify = captchaService.checkCodeByUuid(captchaCode, uuid);
if (!captchaVerify) { if (!captchaVerify) {
return getFailureResult(201,"图形验证码有误"); return getFailureResult(201,"图形验证码有误");
@ -156,6 +170,7 @@ public class BackendLoginController extends BaseController {
@ApiOperation(value = "终台登录") @ApiOperation(value = "终台登录")
@RequestMapping(value="/doLogins", method = RequestMethod.POST) @RequestMapping(value="/doLogins", method = RequestMethod.POST)
@OperationServiceLog(description = "登录后台系统") @OperationServiceLog(description = "登录后台系统")
@ExpirationCheck
public ResponseObject doLogins(HttpServletRequest request, @RequestBody LoginRequest loginRequest) { public ResponseObject doLogins(HttpServletRequest request, @RequestBody LoginRequest loginRequest) {
String userAgent = request.getHeader("user-agent"); String userAgent = request.getHeader("user-agent");
String accountName = loginRequest.getUsername(); String accountName = loginRequest.getUsername();
@ -173,7 +188,7 @@ public class BackendLoginController extends BaseController {
LambdaQueryWrapper<SysDept> queryWrapper1 = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SysDept> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(SysDept::getDeptId,one.getDeptId()); queryWrapper1.eq(SysDept::getDeptId,one.getDeptId());
SysDept one1 = iSysDeptService.getOne(queryWrapper1); SysDept one1 = iSysDeptService.getOne(queryWrapper1);
if (ObjectUtils.isNotEmpty(one1) && ObjectUtils.isNotEmpty(one1.getTurnoverType()) && one1.getTurnoverType().equals("2")){ if (ObjectUtils.isNotEmpty(one1) && ObjectUtils.isNotEmpty(one1.getTurnoverType()) && one1.getTurnoverType().equals("3")){
if (ObjectUtils.isNotEmpty(one1.getTurnoverEndTime())){ if (ObjectUtils.isNotEmpty(one1.getTurnoverEndTime())){
Date date = new Date(); Date date = new Date();
Date turnoverEndTime = one1.getTurnoverEndTime(); Date turnoverEndTime = one1.getTurnoverEndTime();

View File

@ -76,8 +76,8 @@
</view> </view>
</view> --> </view> -->
<swiper class="swiper" style="width: 100%;height: 70px;" circular <swiper class="swiper" style="width: 100%;height: 70px;" circular :autoplay="autoplay"
:autoplay="autoplay" :interval="interval" :vertical="true" :duration="duration"> :interval="interval" :vertical="true" :duration="duration">
<swiper-item class="conttainer-box" v-for="(item,index) in oilTypeList" :key="index"> <swiper-item class="conttainer-box" v-for="(item,index) in oilTypeList" :key="index">
<view class="c-box-box1"> <view class="c-box-box1">
<view class="">{{item.oilName||''}}</view> <view class="">{{item.oilName||''}}</view>
@ -102,10 +102,10 @@
<view class="station-title" style="display: flex;justify-content: space-between;"> <view class="station-title" style="display: flex;justify-content: space-between;">
{{store.name}}{{store.description ? "("+store.description+")" : ""}} {{store.name}}{{store.description ? "("+store.description+")" : ""}}
<!-- <view class="" @click="goChooseAddress" style="width: 22%;font-size: 14px;font-weight: 400;"> <view class="" @click="goChooseAddress" style="width: 22%;font-size: 14px;font-weight: 400;">
<view style="font-size: 12px;">切换位置 <uni-icons type="right" color="#304fff" <view style="font-size: 12px;">切换位置 <uni-icons type="right" color="#304fff"
size="14"></uni-icons> </view> size="14"></uni-icons> </view>
</view> --> </view>
</view><!--顺通石化加油站(工业南路站)--> </view><!--顺通石化加油站(工业南路站)-->
<view style="display: flex;"> <view style="display: flex;">
<view class="bule-icon" v-if="welfare.length!=0" v-for="(item,index) in welfare" :key="index"> <view class="bule-icon" v-if="welfare.length!=0" v-for="(item,index) in welfare" :key="index">

View File

@ -43,7 +43,8 @@
<view class="desc"> <view class="desc">
<view style="display: flex;"> <view style="display: flex;">
储值卡 储值卡
<span style="display: flex;">(<span v-if="isUseChildCard">主卡</span>余额{{user.cardBalance}})</span> <span style="display: flex;">(<span
v-if="isUseChildCard">主卡</span>余额{{user.cardBalance}})</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;">
@ -62,7 +63,8 @@
- {{oilCardRedece}}L - {{oilCardRedece}}L
<span style="margin-left: 8px;margin-top: 8px;"> <span style="margin-left: 8px;margin-top: 8px;">
<u-checkbox-group> <u-checkbox-group>
<u-checkbox v-model="checkOilCard" :checked="checkOilCard" @change="changeOilCard" :disabled="refuelBalance==0"></u-checkbox> <u-checkbox v-model="checkOilCard" :checked="checkOilCard" @change="changeOilCard"
:disabled="refuelBalance==0"></u-checkbox>
</u-checkbox-group> </u-checkbox-group>
</span> </span>
</span> </span>
@ -111,7 +113,8 @@
</view> </view>
<!-- <view class="desc" v-if="!isFullPreferential && !isGradePreferential && !isOilStorageCard && !isStoreValueCard">无优惠</view> --> <!-- <view class="desc" v-if="!isFullPreferential && !isGradePreferential && !isOilStorageCard && !isStoreValueCard">无优惠</view> -->
<view style="margin: 10px 20px 0;color: red;font-size: 12px;" v-if="fullRedece>0 || gradeRedece>0 || couponRedece>0">已为您计算出最大优惠</view> <view style="margin: 10px 20px 0;color: red;font-size: 12px;"
v-if="fullRedece>0 || gradeRedece>0 || couponRedece>0">已为您计算出最大优惠</view>
<view style="margin: 10px 20px 0;color: red;font-size: 12px;">囤油卡不参与任何优惠活动</view> <view style="margin: 10px 20px 0;color: red;font-size: 12px;">囤油卡不参与任何优惠活动</view>
</view> </view>
@ -336,7 +339,10 @@
request({ request({
url: "/business/allOrderInfo/orderStatus", url: "/business/allOrderInfo/orderStatus",
method: 'post', method: 'post',
data: {"orderNo":_this.orderNo,"status":"payFail"}, data: {
"orderNo": _this.orderNo,
"status": "payFail"
},
}).then((ress) => {}) }).then((ress) => {})
uni.showToast({ uni.showToast({
title: res.data.error, title: res.data.error,
@ -349,7 +355,10 @@
request({ request({
url: "/business/allOrderInfo/orderStatus", url: "/business/allOrderInfo/orderStatus",
method: 'post', method: 'post',
data: {"orderNo":_this.orderNo,"status":"payFail"}, data: {
"orderNo": _this.orderNo,
"status": "payFail"
},
}).then((ress) => {}) }).then((ress) => {})
uni.showToast({ uni.showToast({
// title:res.data.msg, // title:res.data.msg,
@ -417,14 +426,18 @@
// }) // })
uni.navigateTo({ uni.navigateTo({
url: '/pagesRefuel/orderSuccess/index?orderNo='+_this.orderNo, url: '/pagesRefuel/orderSuccess/index?orderNo=' + _this
.orderNo,
}) })
}, },
fail: function(err) { fail: function(err) {
request({ request({
url: "/business/allOrderInfo/orderStatus", url: "/business/allOrderInfo/orderStatus",
method: 'post', method: 'post',
data: {"orderNo":res.data.data.orderNo,"status":"payFail"}, data: {
"orderNo": res.data.data.orderNo,
"status": "payFail"
},
}).then((res) => { }).then((res) => {
uni.showToast({ uni.showToast({
title: "支付失败!", title: "支付失败!",
@ -436,7 +449,9 @@
}); });
} }
if (_this.appltType == "ALIPAY") { if (_this.appltType == "ALIPAY") {
my.tradePay({ tradeNO: res.data.data.reservedTransactionId }, function(resp){ my.tradePay({
tradeNO: res.data.data.reservedTransactionId
}, function(resp) {
if (resp.resultCode == '9000') { if (resp.resultCode == '9000') {
console.log("支付成功") console.log("支付成功")
// 使 // 使
@ -454,13 +469,17 @@
// }) // })
uni.navigateTo({ uni.navigateTo({
url: '/pagesRefuel/orderSuccess/index?orderNo='+_this.orderNo, url: '/pagesRefuel/orderSuccess/index?orderNo=' + _this
.orderNo,
}) })
} else { } else {
request({ request({
url: "/business/allOrderInfo/orderStatus", url: "/business/allOrderInfo/orderStatus",
method: 'post', method: 'post',
data: {"orderNo":res.data.data.orderNo,"status":"payFail"}, data: {
"orderNo": res.data.data.orderNo,
"status": "payFail"
},
}).then((res) => { }).then((res) => {
uni.showToast({ uni.showToast({
title: "支付失败!", title: "支付失败!",
@ -522,13 +541,18 @@
this.isStoreValueCard = true; this.isStoreValueCard = true;
if (val == 0) { if (val == 0) {
// 使 // 使
if (this.user.cardBalance >= (this.oilOrder.orderAmount - this.fullRedece - this.couponRedece - this.gradeRedece)){ if (this.user.cardBalance >= (this.oilOrder.orderAmount - this.fullRedece - this.couponRedece -
this.balanceRedece = (this.oilOrder.orderAmount - this.fullRedece - this.couponRedece - this.gradeRedece).toFixed(2) this.gradeRedece)) {
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 - this.fullRedece - this.couponRedece - this.gradeRedece-this.balanceRedece).toFixed(2) this.deductAmount = (this.oilOrder.orderAmount - this.fullRedece - this.couponRedece - this
this.payAmount = (this.oilOrder.orderAmount - this.fullRedece - this.couponRedece - this.gradeRedece-this.balanceRedece).toFixed(2) .gradeRedece - this.balanceRedece).toFixed(2)
console.log(this.oilOrder.orderAmount, this.fullRedece, this.couponRedece, this.gradeRedece,this.balanceRedece,111); this.payAmount = (this.oilOrder.orderAmount - this.fullRedece - this.couponRedece - this
.gradeRedece - this.balanceRedece).toFixed(2)
console.log(this.oilOrder.orderAmount, this.fullRedece, this.couponRedece, this.gradeRedece,
this.balanceRedece, 111);
} }
} else { } else {
// 使 // 使
@ -543,13 +567,17 @@
this.balanceRedece = residueAmount this.balanceRedece = residueAmount
} else { } else {
this.balanceRedece = this.user.cardBalance this.balanceRedece = this.user.cardBalance
this.payAmount = ((residueAmount*100).toFixed(0) - (this.balanceRedece*100).toFixed(0))/100 this.payAmount = ((residueAmount * 100).toFixed(0) - (this.balanceRedece * 100).toFixed(0)) /
100
} }
} }
} else { } else {
this.deductAmount = (this.oilOrder.orderAmount - this.fullRedece - this.couponRedece - this.gradeRedece).toFixed(2) this.deductAmount = (this.oilOrder.orderAmount - this.fullRedece - this.couponRedece - this
this.payAmount = (this.oilOrder.orderAmount - this.fullRedece - this.couponRedece - this.gradeRedece).toFixed(2) .gradeRedece).toFixed(2)
console.log(this.oilOrder.orderAmount, this.fullRedece, this.couponRedece, this.gradeRedece,this.balanceRedece,222); this.payAmount = (this.oilOrder.orderAmount - this.fullRedece - this.couponRedece - this.gradeRedece)
.toFixed(2)
console.log(this.oilOrder.orderAmount, this.fullRedece, this.couponRedece, this.gradeRedece, this
.balanceRedece, 222);
} }
}, },
// 使 // 使
@ -560,30 +588,41 @@
request({ request({
url: "business/userManager/userGrade/isUse", url: "business/userManager/userGrade/isUse",
method: 'post', method: 'post',
data:{userId:userId,gradeId:gradeId,storeId:that.oilOrder.storeId} data: {
userId: userId,
gradeId: gradeId,
storeId: that.oilOrder.storeId
}
}).then((res) => { }).then((res) => {
if (res.data) { if (res.data) {
if (res.data.fixingLevel) { if (res.data.fixingLevel) {
if (res.data.fixingLevel.discountType == "自定义优惠") { if (res.data.fixingLevel.discountType == "自定义优惠") {
if (that.oilType == "汽油") { if (that.oilType == "汽油") {
// //
let gasolineRule = JSON.parse(res.data.fixingLevel.gasolineRule).sort((a,b) => a.gasolineRule1 - b.gasolineRule1); let gasolineRule = JSON.parse(res.data.fixingLevel.gasolineRule).sort((a, b) =>
a.gasolineRule1 - b.gasolineRule1);
if (res.data.fixingLevel.gasolineDiscount == "满减优惠") { if (res.data.fixingLevel.gasolineDiscount == "满减优惠") {
if (gasolineRule.length > 1) { if (gasolineRule.length > 1) {
for (let i = 1; i < gasolineRule.length; i++) { for (let i = 1; i < gasolineRule.length; i++) {
if (that.oilOrder.orderAmount >= gasolineRule[gasolineRule.length-1].gasolineRule1){ if (that.oilOrder.orderAmount >= gasolineRule[gasolineRule.length -
that.gradeRedece = gasolineRule[gasolineRule.length-1].gasolineRule2 1].gasolineRule1) {
that.gradeRedece = gasolineRule[gasolineRule.length - 1]
.gasolineRule2
that.isGradePreferential = true that.isGradePreferential = true
break; break;
} }
if (that.oilOrder.orderAmount >= gasolineRule[i - 1].gasolineRule1 && that.oilOrder.orderAmount < gasolineRule[i].gasolineRule1) { if (that.oilOrder.orderAmount >= gasolineRule[i - 1]
.gasolineRule1 && that.oilOrder.orderAmount < gasolineRule[i]
.gasolineRule1) {
that.gradeRedece = gasolineRule[i - 1].gasolineRule2 that.gradeRedece = gasolineRule[i - 1].gasolineRule2
that.isGradePreferential = true that.isGradePreferential = true
} }
} }
} else { } else {
if (that.oilOrder.orderAmount >= gasolineRule[gasolineRule.length-1].gasolineRule1){ if (that.oilOrder.orderAmount >= gasolineRule[gasolineRule.length - 1]
that.gradeRedece = gasolineRule[gasolineRule.length-1].gasolineRule2 .gasolineRule1) {
that.gradeRedece = gasolineRule[gasolineRule.length - 1]
.gasolineRule2
that.isGradePreferential = true that.isGradePreferential = true
} }
} }
@ -591,20 +630,29 @@
if (res.data.fixingLevel.gasolineDiscount == "每升优惠") { if (res.data.fixingLevel.gasolineDiscount == "每升优惠") {
if (gasolineRule.length > 1) { if (gasolineRule.length > 1) {
for (let i = 1; i < gasolineRule.length; i++) { for (let i = 1; i < gasolineRule.length; i++) {
if (that.oilOrder.orderAmount >= gasolineRule[gasolineRule.length-1].gasolineRule1){ if (that.oilOrder.orderAmount >= gasolineRule[gasolineRule.length -
1].gasolineRule1) {
// //
that.gradeRedece = (that.oilOrder.orderAmount/that.oilPrice * gasolineRule[gasolineRule.length-1].gasolineRule3).toFixed(2) that.gradeRedece = (that.oilOrder.orderAmount / that.oilPrice *
gasolineRule[gasolineRule.length - 1].gasolineRule3)
.toFixed(2)
that.isGradePreferential = true that.isGradePreferential = true
break; break;
} }
if (that.oilOrder.orderAmount >= gasolineRule[i - 1].gasolineRule1 && that.oilOrder.orderAmount < gasolineRule[i].gasolineRule1) { if (that.oilOrder.orderAmount >= gasolineRule[i - 1]
that.gradeRedece = (that.oilOrder.orderAmount/that.oilPrice * gasolineRule[i - 1].gasolineRule3).toFixed(2) .gasolineRule1 && that.oilOrder.orderAmount < gasolineRule[i]
.gasolineRule1) {
that.gradeRedece = (that.oilOrder.orderAmount / that.oilPrice *
gasolineRule[i - 1].gasolineRule3).toFixed(2)
that.isGradePreferential = true that.isGradePreferential = true
} }
} }
} else { } else {
if (that.oilOrder.orderAmount >= gasolineRule[gasolineRule.length-1].gasolineRule1){ if (that.oilOrder.orderAmount >= gasolineRule[gasolineRule.length - 1]
that.gradeRedece = (that.oilOrder.orderAmount/that.oilPrice * gasolineRule[gasolineRule.length-1].gasolineRule3).toFixed(2) .gasolineRule1) {
that.gradeRedece = (that.oilOrder.orderAmount / that.oilPrice *
gasolineRule[gasolineRule.length - 1].gasolineRule3)
.toFixed(2)
that.isGradePreferential = true that.isGradePreferential = true
} }
} }
@ -612,22 +660,27 @@
} }
if (that.oilType == "柴油") { if (that.oilType == "柴油") {
// //
let dieselRule = JSON.parse(res.data.fixingLevel.dieselRule).sort((a,b) => a.dieselRule1 - b.dieselRule1); let dieselRule = JSON.parse(res.data.fixingLevel.dieselRule).sort((a, b) => a
.dieselRule1 - b.dieselRule1);
if (res.data.fixingLevel.dieselDiscount == "满减优惠") { if (res.data.fixingLevel.dieselDiscount == "满减优惠") {
if (dieselRule.length > 1) { if (dieselRule.length > 1) {
for (let i = 1; i < dieselRule.length; i++) { for (let i = 1; i < dieselRule.length; i++) {
if (that.oilOrder.orderAmount >= dieselRule[dieselRule.length-1].dieselRule1){ if (that.oilOrder.orderAmount >= dieselRule[dieselRule.length - 1]
that.gradeRedece = dieselRule[dieselRule.length-1].dieselRule2 .dieselRule1) {
that.gradeRedece = dieselRule[dieselRule.length - 1]
.dieselRule2
that.isGradePreferential = true that.isGradePreferential = true
break; break;
} }
if (that.oilOrder.orderAmount >= dieselRule[i - 1].dieselRule1 && that.oilOrder.orderAmount < dieselRule[i].dieselRule1) { if (that.oilOrder.orderAmount >= dieselRule[i - 1].dieselRule1 &&
that.oilOrder.orderAmount < dieselRule[i].dieselRule1) {
that.gradeRedece = dieselRule[i - 1].dieselRule2 that.gradeRedece = dieselRule[i - 1].dieselRule2
that.isGradePreferential = true that.isGradePreferential = true
} }
} }
} else { } else {
if (that.oilOrder.orderAmount >= dieselRule[dieselRule.length-1].dieselRule1){ if (that.oilOrder.orderAmount >= dieselRule[dieselRule.length - 1]
.dieselRule1) {
that.gradeRedece = dieselRule[dieselRule.length - 1].dieselRule2 that.gradeRedece = dieselRule[dieselRule.length - 1].dieselRule2
that.isGradePreferential = true that.isGradePreferential = true
} }
@ -636,20 +689,27 @@
if (res.data.fixingLevel.dieselDiscount == "每升优惠") { if (res.data.fixingLevel.dieselDiscount == "每升优惠") {
if (dieselRule.length > 1) { if (dieselRule.length > 1) {
for (let i = 1; i < dieselRule.length; i++) { for (let i = 1; i < dieselRule.length; i++) {
if (that.oilOrder.orderAmount >= dieselRule[dieselRule.length-1].dieselRule1){ if (that.oilOrder.orderAmount >= dieselRule[dieselRule.length - 1]
.dieselRule1) {
// //
that.gradeRedece = (that.oilOrder.orderAmount/that.oilPrice * dieselRule[dieselRule.length-1].dieselRule3).toFixed(2) that.gradeRedece = (that.oilOrder.orderAmount / that.oilPrice *
dieselRule[dieselRule.length - 1].dieselRule3).toFixed(
2)
that.isGradePreferential = true that.isGradePreferential = true
break; break;
} }
if (that.oilOrder.orderAmount >= dieselRule[i - 1].dieselRule1 && that.oilOrder.orderAmount < dieselRule[i].dieselRule1) { if (that.oilOrder.orderAmount >= dieselRule[i - 1].dieselRule1 &&
that.gradeRedece = (that.oilOrder.orderAmount/that.oilPrice * dieselRule[i - 1].dieselRule3).toFixed(2) that.oilOrder.orderAmount < dieselRule[i].dieselRule1) {
that.gradeRedece = (that.oilOrder.orderAmount / that.oilPrice *
dieselRule[i - 1].dieselRule3).toFixed(2)
that.isGradePreferential = true that.isGradePreferential = true
} }
} }
} else { } else {
if (that.oilOrder.orderAmount >= dieselRule[dieselRule.length-1].dieselRule1){ if (that.oilOrder.orderAmount >= dieselRule[dieselRule.length - 1]
that.gradeRedece = (that.oilOrder.orderAmount/that.oilPrice * dieselRule[dieselRule.length-1].dieselRule3).toFixed(2) .dieselRule1) {
that.gradeRedece = (that.oilOrder.orderAmount / that.oilPrice *
dieselRule[dieselRule.length - 1].dieselRule3).toFixed(2)
that.isGradePreferential = true that.isGradePreferential = true
} }
} }
@ -657,23 +717,30 @@
} }
if (that.oilType == "天然气") { if (that.oilType == "天然气") {
// //
let naturalGasRule = JSON.parse(res.data.fixingLevel.naturalGasRule).sort((a,b) => a.naturalGasRule1 - b.naturalGasRule1); let naturalGasRule = JSON.parse(res.data.fixingLevel.naturalGasRule).sort((a,
b) => a.naturalGasRule1 - b.naturalGasRule1);
if (res.data.fixingLevel.naturalGasDiscount == "满减优惠") { if (res.data.fixingLevel.naturalGasDiscount == "满减优惠") {
if (naturalGasRule.length > 1) { if (naturalGasRule.length > 1) {
for (let i = 1; i < naturalGasRule.length; i++) { for (let i = 1; i < naturalGasRule.length; i++) {
if (that.oilOrder.orderAmount >= naturalGasRule[naturalGasRule.length-1].naturalGasRule1){ if (that.oilOrder.orderAmount >= naturalGasRule[naturalGasRule
that.gradeRedece = naturalGasRule[naturalGasRule.length-1].naturalGasRule2 .length - 1].naturalGasRule1) {
that.gradeRedece = naturalGasRule[naturalGasRule.length - 1]
.naturalGasRule2
that.isGradePreferential = true that.isGradePreferential = true
break; break;
} }
if (that.oilOrder.orderAmount >= naturalGasRule[i - 1].naturalGasRule1 && that.oilOrder.orderAmount < naturalGasRule[i].naturalGasRule1) { if (that.oilOrder.orderAmount >= naturalGasRule[i - 1]
.naturalGasRule1 && that.oilOrder.orderAmount < naturalGasRule[
i].naturalGasRule1) {
that.gradeRedece = naturalGasRule[i - 1].naturalGasRule2 that.gradeRedece = naturalGasRule[i - 1].naturalGasRule2
that.isGradePreferential = true that.isGradePreferential = true
} }
} }
} else { } else {
if (that.oilOrder.orderAmount >= naturalGasRule[naturalGasRule.length-1].naturalGasRule1){ if (that.oilOrder.orderAmount >= naturalGasRule[naturalGasRule.length -
that.gradeRedece = naturalGasRule[naturalGasRule.length-1].naturalGasRule2 1].naturalGasRule1) {
that.gradeRedece = naturalGasRule[naturalGasRule.length - 1]
.naturalGasRule2
that.isGradePreferential = true that.isGradePreferential = true
} }
} }
@ -681,20 +748,29 @@
if (res.data.fixingLevel.naturalGasDiscount == "每升优惠") { if (res.data.fixingLevel.naturalGasDiscount == "每升优惠") {
if (naturalGasRule.length > 1) { if (naturalGasRule.length > 1) {
for (let i = 1; i < naturalGasRule.length; i++) { for (let i = 1; i < naturalGasRule.length; i++) {
if (that.oilOrder.orderAmount >= naturalGasRule[naturalGasRule.length-1].naturalGasRule1){ if (that.oilOrder.orderAmount >= naturalGasRule[naturalGasRule
.length - 1].naturalGasRule1) {
// //
that.gradeRedece = (that.oilOrder.orderAmount/that.oilPrice * naturalGasRule[naturalGasRule.length-1].naturalGasRule3).toFixed(2) that.gradeRedece = (that.oilOrder.orderAmount / that.oilPrice *
naturalGasRule[naturalGasRule.length - 1]
.naturalGasRule3).toFixed(2)
that.isGradePreferential = true that.isGradePreferential = true
break; break;
} }
if (that.oilOrder.orderAmount >= naturalGasRule[i - 1].naturalGasRule1 && that.oilOrder.orderAmount < naturalGasRule[i].naturalGasRule1) { if (that.oilOrder.orderAmount >= naturalGasRule[i - 1]
that.gradeRedece = (that.oilOrder.orderAmount/that.oilPrice * naturalGasRule[i - 1].naturalGasRule3).toFixed(2) .naturalGasRule1 && that.oilOrder.orderAmount < naturalGasRule[
i].naturalGasRule1) {
that.gradeRedece = (that.oilOrder.orderAmount / that.oilPrice *
naturalGasRule[i - 1].naturalGasRule3).toFixed(2)
that.isGradePreferential = true that.isGradePreferential = true
} }
} }
} else { } else {
if (that.oilOrder.orderAmount >= naturalGasRule[naturalGasRule.length-1].naturalGasRule1){ if (that.oilOrder.orderAmount >= naturalGasRule[naturalGasRule.length -
that.gradeRedece = (that.oilOrder.orderAmount/that.oilPrice * naturalGasRule[naturalGasRule.length-1].naturalGasRule3).toFixed(2) 1].naturalGasRule1) {
that.gradeRedece = (that.oilOrder.orderAmount / that.oilPrice *
naturalGasRule[naturalGasRule.length - 1].naturalGasRule3)
.toFixed(2)
that.isGradePreferential = true that.isGradePreferential = true
} }
} }
@ -759,7 +835,10 @@
request({ request({
url: "business/userManager/user/storeUser", url: "business/userManager/user/storeUser",
method: 'post', method: 'post',
data:{storeId:_this.oilOrder.storeId,userId:id} data: {
storeId: _this.oilOrder.storeId,
userId: id
}
}).then((res) => { }).then((res) => {
if (res.data.isUseChild == 'yes') { if (res.data.isUseChild == 'yes') {
_this.isUseChildCard = true _this.isUseChildCard = true
@ -790,7 +869,7 @@
getPaymentPreferential(gradeId) { getPaymentPreferential(gradeId) {
let type = 0; let type = 0;
if (this.balanceRedece == 0) { if (this.balanceRedece == 0) {
type = 1 type = 2
} else { } else {
type = 0 type = 0
} }
@ -823,7 +902,8 @@
if (res.data.activeFavorableAmount) { if (res.data.activeFavorableAmount) {
this.fullRedece = res.data.activeFavorableAmount this.fullRedece = res.data.activeFavorableAmount
} }
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.chooseCardBalance(0) this.chooseCardBalance(0)
// this.payAmount = (this.payAmount - this.fullRedece - this.couponRedece - this.gradeRedece).toFixed(2) // this.payAmount = (this.payAmount - this.fullRedece - this.couponRedece - this.gradeRedece).toFixed(2)
@ -916,12 +996,14 @@
font-size: 18px; font-size: 18px;
line-height: 40px; line-height: 40px;
} }
.imgIcon { .imgIcon {
width: 30px; width: 30px;
height: 30px; height: 30px;
border-radius: 50%; border-radius: 50%;
margin-top: 10px; margin-top: 10px;
} }
.desc { .desc {
height: 35px; height: 35px;
line-height: 35px; line-height: 35px;