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,13 +1539,16 @@ 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);
for (int i = 0;i<objects1.size();i++){ if (ObjectUtils.isNotEmpty(objects1)){
if (!((JSONObject)objects1.get(i)).get("refuelMoney").toString().equals(((JSONObject)objects.get(i)).get("refuelMoney").toString())){ for (int i = 0;i<objects1.size();i++){
Double oilBalance = Double.valueOf(((JSONObject) objects1.get(i)).get("refuelMoney").toString()) - Double.valueOf(((JSONObject) objects.get(i)).get("refuelMoney").toString()); if (!((JSONObject)objects1.get(i)).get("refuelMoney").toString().equals(((JSONObject)objects.get(i)).get("refuelMoney").toString())){
Double afterOilBalance = 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());
this.insertOilBalance(userid,storeId,oilName.getId().toString(),oilName.getOilType(),oilBalance,afterOilBalance,orderNo); Double afterOilBalance = Double.valueOf(((JSONObject) objects.get(i)).get("refuelMoney").toString());
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,9 +76,9 @@
</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">
@ -159,7 +159,7 @@
export default { export default {
data() { data() {
return { return {
isOpen:false, isOpen: false,
chainStoreId: '', chainStoreId: '',
indicatorDots: true, indicatorDots: true,
autoplay: true, autoplay: true,
@ -282,14 +282,14 @@
tabbar tabbar
}, },
methods: { methods: {
isRecharge(){ isRecharge() {
request({ request({
url: 'business/storeInformation/store/isRecharge', url: 'business/storeInformation/store/isRecharge',
method: 'get', method: 'get',
}).then(res => { }).then(res => {
if (res.data){ if (res.data) {
this.isOpen = true this.isOpen = true
}else{ } else {
this.isOpen = false this.isOpen = false
} }
}) })

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>
@ -161,8 +164,8 @@
// token // token
AppToken: uni.getStorageSync("App-Token"), AppToken: uni.getStorageSync("App-Token"),
// //
ifLogin:false, ifLogin: false,
gradeDis:"", gradeDis: "",
title: '', title: '',
value: true, value: true,
orderNo: "", orderNo: "",
@ -175,59 +178,59 @@
oilPrice: 0, oilPrice: 0,
// //
oilName: "", oilName: "",
oilNameId:"", oilNameId: "",
// //
oilType:"", oilType: "",
// id // id
oilId:"", oilId: "",
// //
user:{ user: {
cardBalance:0, cardBalance: 0,
}, },
// //
refuelBalance:0, refuelBalance: 0,
// //
userGrade:{}, userGrade: {},
balanceRedece:0, balanceRedece: 0,
oilCardRedece:0, oilCardRedece: 0,
gradeRedece:0, gradeRedece: 0,
fullRedece:0, fullRedece: 0,
couponRedece:0, couponRedece: 0,
// //
deductAmount:0, deductAmount: 0,
// //
refuelMoney:[], refuelMoney: [],
refuelMoneyAfter:[], refuelMoneyAfter: [],
// //
gradeDiscount:[], gradeDiscount: [],
// //
couponDiscount:[], couponDiscount: [],
// //
fullReduceDiscount:[], fullReduceDiscount: [],
// //
payAmount:0, payAmount: 0,
// //
orderInfo:{}, orderInfo: {},
// 使 // 使
isOilStorageCard:false, isOilStorageCard: false,
// 使 // 使
isStoreValueCard:false, isStoreValueCard: false,
// 使 // 使
isGradePreferential:false, isGradePreferential: false,
// 使 // 使
isFullPreferential:false, isFullPreferential: false,
// 使 // 使
isCoupons:false, isCoupons: false,
transferDTO:{ transferDTO: {
type:0, type: 0,
amount:0, amount: 0,
oilId:"", oilId: "",
mtUserLevel:"", mtUserLevel: "",
storeId:uni.getStorageSync("storeId") storeId: uni.getStorageSync("storeId")
}, },
fixingLevel:{}, fixingLevel: {},
isUseChildCard:false, isUseChildCard: false,
cardsList:[], cardsList: [],
query: { query: {
storeId: uni.getStorageSync("storeId"), storeId: uni.getStorageSync("storeId"),
couponType: '', couponType: '',
@ -235,12 +238,12 @@
pageNo: 1, pageNo: 1,
pageSize: 10 pageSize: 10
}, },
checkBalance:false, checkBalance: false,
checkOilCard:false, checkOilCard: false,
checkFull:false, checkFull: false,
checkCoupon:false, checkCoupon: false,
checkGrade:false, checkGrade: false,
preferentialData:{ preferentialData: {
activeFavorableAmount: "", activeFavorableAmount: "",
activeId: "", activeId: "",
activeInfo: "", activeInfo: "",
@ -251,7 +254,7 @@
type: "", type: "",
}, },
// //
isFixingLevel:false, isFixingLevel: false,
} }
}, },
onLoad(e) { onLoad(e) {
@ -266,9 +269,9 @@
}, },
methods: { methods: {
// //
changeOilCard(val){ changeOilCard(val) {
this.checkOilCard = val this.checkOilCard = val
if (val){ if (val) {
this.chooseRefuelMoney() this.chooseRefuelMoney()
this.fullRedece = 0; this.fullRedece = 0;
this.gradeRedece = 0; this.gradeRedece = 0;
@ -283,83 +286,89 @@
memberFavorableAmount: "", memberFavorableAmount: "",
type: "", type: "",
}; };
}else{ } else {
this.oilCardRedece = 0 this.oilCardRedece = 0
if (!this.isFixingLevel){ if (!this.isFixingLevel) {
this.getPaymentPreferential(this.user.gradeId) this.getPaymentPreferential(this.user.gradeId)
} }
} }
}, },
// //
payment(){ payment() {
if (this.isUseChildCard){ if (this.isUseChildCard) {
if(this.balanceRedece>0){ if (this.balanceRedece > 0) {
this.isUseChildCard = true this.isUseChildCard = true
}else{ } else {
this.isUseChildCard = false this.isUseChildCard = false
} }
} }
let map = { let map = {
orderNo : this.orderNo, orderNo: this.orderNo,
payAmount : this.payAmount, payAmount: this.payAmount,
// payAmount : "0.01", // payAmount : "0.01",
discountAmount : (this.fullRedece*100+this.gradeRedece*100+this.couponRedece*100)/100, discountAmount: (this.fullRedece * 100 + this.gradeRedece * 100 + this.couponRedece * 100) / 100,
oilCardAmount : JSON.stringify(this.refuelMoneyAfter), oilCardAmount: JSON.stringify(this.refuelMoneyAfter),
oilCardLiters : this.oilCardRedece, oilCardLiters: this.oilCardRedece,
balanceAmount : this.balanceRedece, balanceAmount: this.balanceRedece,
isOilStorageCard : this.isOilStorageCard, isOilStorageCard: this.isOilStorageCard,
tankId : uni.getStorageSync("tankId"), tankId: uni.getStorageSync("tankId"),
// tankId : 6, // tankId : 6,
isUseChildCard:this.isUseChildCard, isUseChildCard: this.isUseChildCard,
activeId:this.preferentialData.activeId, activeId: this.preferentialData.activeId,
cardFavorableId:this.preferentialData.cardFavorableId, cardFavorableId: this.preferentialData.cardFavorableId,
recordId:this.preferentialData.recordId, recordId: this.preferentialData.recordId,
type:this.preferentialData.type, type: this.preferentialData.type,
balanceAmountSale:this.balanceRedece, balanceAmountSale: this.balanceRedece,
oilCardAmountSale:this.oilCardRedece, oilCardAmountSale: this.oilCardRedece,
ifLogin:this.ifLogin ifLogin: this.ifLogin
}; };
let _this = this; let _this = this;
request({ request({
url: "business/oilOrder/appletPay", url: "business/oilOrder/appletPay",
method: 'post', method: 'post',
data: map, data: map,
}).then(res => { }).then(res => {
let payProvider = "wxpay" let payProvider = "wxpay"
if (_this.appltType== "WECHAT"){ if (_this.appltType == "WECHAT") {
payProvider = "wxpay" payProvider = "wxpay"
}else{ } else {
payProvider = "alipay" payProvider = "alipay"
} }
if(res.data.error){ if (res.data.error) {
request({ request({
url: "/business/allOrderInfo/orderStatus", url: "/business/allOrderInfo/orderStatus",
method: 'post', method: 'post',
data: {"orderNo":_this.orderNo,"status":"payFail"}, data: {
}).then((ress)=>{}) "orderNo": _this.orderNo,
"status": "payFail"
},
}).then((ress) => {})
uni.showToast({ uni.showToast({
title:res.data.error, title: res.data.error,
icon:"none" icon: "none"
}) })
// _this.goBack() // _this.goBack()
return; return;
} }
if(res.data.code=="error"){ if (res.data.code == "error") {
request({ request({
url: "/business/allOrderInfo/orderStatus", url: "/business/allOrderInfo/orderStatus",
method: 'post', method: 'post',
data: {"orderNo":_this.orderNo,"status":"payFail"}, data: {
}).then((ress)=>{}) "orderNo": _this.orderNo,
"status": "payFail"
},
}).then((ress) => {})
uni.showToast({ uni.showToast({
// title:res.data.msg, // title:res.data.msg,
title:"支付失败,请联系商家", title: "支付失败,请联系商家",
icon:"none" icon: "none"
}) })
// _this.goBack() // _this.goBack()
return; return;
} }
if(res.data.success == "ok"){ if (res.data.success == "ok") {
// _this.preferentialData.storeId = _this.oilOrder.storeId // _this.preferentialData.storeId = _this.oilOrder.storeId
// _this.preferentialData.orderAmount = _this.oilOrder.orderAmount // _this.preferentialData.orderAmount = _this.oilOrder.orderAmount
// _this.preferentialData.oilId = _this.oilOrder.oils // _this.preferentialData.oilId = _this.oilOrder.oils
@ -373,17 +382,17 @@
// url: '/pagesRefuel/orderSuccess/index' // url: '/pagesRefuel/orderSuccess/index'
// }) // })
uni.navigateTo({ uni.navigateTo({
url: '/pagesRefuel/orderSuccess/index?orderNo='+_this.orderNo, url: '/pagesRefuel/orderSuccess/index?orderNo=' + _this.orderNo,
}) })
return; return;
} }
if(res.data.resultMsg == "商户订单号重复"){ if (res.data.resultMsg == "商户订单号重复") {
uni.showToast({ uni.showToast({
title:"商户订单号重复,请重新选择订单信息进行支付!", title: "商户订单号重复,请重新选择订单信息进行支付!",
icon:"none" icon: "none"
}) })
} }
if (res.data.data.reservedPayInfo){ if (res.data.data.reservedPayInfo) {
_this.orderInfo = JSON.parse(res.data.data.reservedPayInfo); _this.orderInfo = JSON.parse(res.data.data.reservedPayInfo);
uni.requestPayment({ uni.requestPayment({
// provider: 'wxpay' 'alipay' // provider: 'wxpay' 'alipay'
@ -398,7 +407,7 @@
signType: 'MD5', signType: 'MD5',
// //
paySign: _this.orderInfo.paySign, paySign: _this.orderInfo.paySign,
success: function (res) { success: function(res) {
console.log('success'); console.log('success');
// 使 // 使
// _this.preferentialData.storeId = _this.oilOrder.storeId // _this.preferentialData.storeId = _this.oilOrder.storeId
@ -417,27 +426,33 @@
// }) // })
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: {
}).then((res)=>{ "orderNo": res.data.data.orderNo,
"status": "payFail"
},
}).then((res) => {
uni.showToast({ uni.showToast({
title:"支付失败!", title: "支付失败!",
icon:"error" icon: "error"
}) })
}) })
console.log('fail:',err); console.log('fail:', err);
} }
}); });
} }
if (_this.appltType== "ALIPAY") { if (_this.appltType == "ALIPAY") {
my.tradePay({ tradeNO: res.data.data.reservedTransactionId }, function(resp){ my.tradePay({
if(resp.resultCode == '9000'){ tradeNO: res.data.data.reservedTransactionId
}, function(resp) {
if (resp.resultCode == '9000') {
console.log("支付成功") console.log("支付成功")
// 使 // 使
// _this.preferentialData.storeId = _this.oilOrder.storeId // _this.preferentialData.storeId = _this.oilOrder.storeId
@ -454,20 +469,24 @@
// }) // })
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: {
}).then((res)=>{ "orderNo": res.data.data.orderNo,
"status": "payFail"
},
}).then((res) => {
uni.showToast({ uni.showToast({
title:"支付失败!", title: "支付失败!",
icon:"error" icon: "error"
}) })
}) })
console.log('支付失败,'+resp.resultCode); console.log('支付失败,' + resp.resultCode);
} }
}); });
} }
@ -475,24 +494,24 @@
}, },
// 使 // 使
chooseRefuelMoney(){ chooseRefuelMoney() {
console.log("oilCard"); console.log("oilCard");
let falg = false; let falg = false;
for(let i = 0;i<this.refuelMoney.length;i++){ for (let i = 0; i < this.refuelMoney.length; i++) {
if (this.refuelMoney[i].oilType == this.oilNameId){ if (this.refuelMoney[i].oilType == this.oilNameId) {
if( this.refuelMoney[i].refuelMoney>0 ){ if (this.refuelMoney[i].refuelMoney > 0) {
falg = true falg = true
} }
this.refuelBalance = this.refuelMoney[i].refuelMoney this.refuelBalance = this.refuelMoney[i].refuelMoney
if (this.refuelMoney[i].refuelMoney>0){ if (this.refuelMoney[i].refuelMoney > 0) {
this.isOilStorageCard = true this.isOilStorageCard = true
} }
if (this.refuelMoney[i].refuelMoney >= this.oilOrder.oilNum){ if (this.refuelMoney[i].refuelMoney >= this.oilOrder.oilNum) {
this.oilCardRedece = this.oilOrder.oilNum this.oilCardRedece = this.oilOrder.oilNum
this.refuelMoneyAfter[i].refuelMoney = this.refuelMoney[i].refuelMoney - this.oilOrder.oilNum this.refuelMoneyAfter[i].refuelMoney = this.refuelMoney[i].refuelMoney - this.oilOrder.oilNum
this.payAmount = 0 this.payAmount = 0
this.checkOilCard = true this.checkOilCard = true
}else{ } else {
this.oilCardRedece = this.refuelMoney[i].refuelMoney this.oilCardRedece = this.refuelMoney[i].refuelMoney
this.refuelMoneyAfter[i].refuelMoney = 0 this.refuelMoneyAfter[i].refuelMoney = 0
if (falg) { if (falg) {
@ -506,195 +525,252 @@
// this.chooseCardBalance(0) // this.chooseCardBalance(0)
// this.chooseGrade(this.user.id,this.user.gradeId) // this.chooseGrade(this.user.id,this.user.gradeId)
} }
if (this.oilCardRedece==0){ if (this.oilCardRedece == 0) {
if (!this.isFixingLevel){ if (!this.isFixingLevel) {
this.chooseCardBalance(0) this.chooseCardBalance(0)
this.getPaymentPreferential(this.user.gradeId) this.getPaymentPreferential(this.user.gradeId)
}else{ } else {
this.chooseCardBalance(0) this.chooseCardBalance(0)
} }
} }
}, },
// 使 // 使
chooseCardBalance(val){ chooseCardBalance(val) {
console.log("balance"); console.log("balance");
if (this.user.cardBalance>0) { if (this.user.cardBalance > 0) {
this.isStoreValueCard = true; this.isStoreValueCard = true;
if (val == 0) { if (val == 0) {
// 使 // 使
if (this.user.cardBalance >= (this.oilOrder.orderAmount - 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 {
// 使 // 使
// //
let residueAmount = 0 let residueAmount = 0
if(this.oilCardRedece>0){ if (this.oilCardRedece > 0) {
residueAmount = ((this.oilOrder.oilNum - this.oilCardRedece) * this.oilPrice).toFixed(2) residueAmount = ((this.oilOrder.oilNum - this.oilCardRedece) * this.oilPrice).toFixed(2)
}else{ } else {
residueAmount = this.oilOrder.orderAmount residueAmount = this.oilOrder.orderAmount
} }
if (this.user.cardBalance >= residueAmount){ if (this.user.cardBalance >= residueAmount) {
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);
} }
}, },
// 使 // 使
chooseGrade(userId,gradeId){ chooseGrade(userId, gradeId) {
console.log("userGrade"); console.log("userGrade");
let that = this; let that = this;
that.isFixingLevel = false that.isFixingLevel = false
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) =>
if (res.data.fixingLevel.gasolineDiscount == "满减优惠"){ a.gasolineRule1 - b.gasolineRule1);
if (gasolineRule.length > 1){ if (res.data.fixingLevel.gasolineDiscount == "满减优惠") {
for (let i = 1; i<gasolineRule.length; i++){ if (gasolineRule.length > 1) {
if (that.oilOrder.orderAmount >= gasolineRule[gasolineRule.length-1].gasolineRule1){ for (let i = 1; i < gasolineRule.length; i++) {
that.gradeRedece = gasolineRule[gasolineRule.length-1].gasolineRule2 if (that.oilOrder.orderAmount >= gasolineRule[gasolineRule.length -
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
} }
} }
} }
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
} }
} }
} }
} }
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
if (res.data.fixingLevel.dieselDiscount == "满减优惠"){ .dieselRule1 - b.dieselRule1);
if (dieselRule.length > 1){ if (res.data.fixingLevel.dieselDiscount == "满减优惠") {
for (let i = 1; i<dieselRule.length; i++){ if (dieselRule.length > 1) {
if (that.oilOrder.orderAmount >= dieselRule[dieselRule.length-1].dieselRule1){ for (let i = 1; i < dieselRule.length; i++) {
that.gradeRedece = dieselRule[dieselRule.length-1].dieselRule2 if (that.oilOrder.orderAmount >= dieselRule[dieselRule.length - 1]
.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]
that.gradeRedece = dieselRule[dieselRule.length-1].dieselRule2 .dieselRule1) {
that.gradeRedece = dieselRule[dieselRule.length - 1].dieselRule2
that.isGradePreferential = true that.isGradePreferential = true
} }
} }
} }
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
} }
} }
} }
} }
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,
if (res.data.fixingLevel.naturalGasDiscount == "满减优惠"){ b) => a.naturalGasRule1 - b.naturalGasRule1);
if (naturalGasRule.length > 1){ if (res.data.fixingLevel.naturalGasDiscount == "满减优惠") {
for (let i = 1; i<naturalGasRule.length; i++){ if (naturalGasRule.length > 1) {
if (that.oilOrder.orderAmount >= naturalGasRule[naturalGasRule.length-1].naturalGasRule1){ for (let i = 1; i < naturalGasRule.length; i++) {
that.gradeRedece = naturalGasRule[naturalGasRule.length-1].naturalGasRule2 if (that.oilOrder.orderAmount >= naturalGasRule[naturalGasRule
.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
} }
} }
} }
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
} }
} }
@ -711,7 +787,7 @@
}) })
}, },
// 使 // 使
chooseFullOrCoupon(){ chooseFullOrCoupon() {
console.log("full"); console.log("full");
this.transferDTO.amount = this.deductAmount this.transferDTO.amount = this.deductAmount
this.transferDTO.mtUserLevel = this.userGrade.id this.transferDTO.mtUserLevel = this.userGrade.id
@ -720,9 +796,9 @@
request({ request({
url: "business/marketingActivity/activeExchange/test", url: "business/marketingActivity/activeExchange/test",
method: 'post', method: 'post',
data:_this.transferDTO, data: _this.transferDTO,
}).then((res) => { }).then((res) => {
if (res.data.amount>0){ if (res.data.amount > 0) {
_this.payAmount = res.data.amount - _this.gradeRedece _this.payAmount = res.data.amount - _this.gradeRedece
_this.fullRedece = res.data.favorableAmount _this.fullRedece = res.data.favorableAmount
_this.isFullPreferential = true _this.isFullPreferential = true
@ -730,7 +806,7 @@
}) })
}, },
// 使 // 使
chooseCoupons(){ chooseCoupons() {
console.log("coupons"); console.log("coupons");
request({ request({
url: 'business/marketingActivity/cardFavorable/applet', url: 'business/marketingActivity/cardFavorable/applet',
@ -740,7 +816,7 @@
if (res.data.records) { if (res.data.records) {
console.log(res.data.records); console.log(res.data.records);
this.cardsList = res.data.records this.cardsList = res.data.records
if (this.cardsList.length>0){ if (this.cardsList.length > 0) {
this.couponRedece = this.cardsList[0].couponAmount this.couponRedece = this.cardsList[0].couponAmount
} }
} }
@ -748,38 +824,41 @@
}, },
// //
countPayMent(){ countPayMent() {
this.payAmount = this.deductAmount; this.payAmount = this.deductAmount;
// console.log("111",this.deductAmount, this.gradeRedece, this.fullRedece, this.couponRedece); // console.log("111",this.deductAmount, this.gradeRedece, this.fullRedece, this.couponRedece);
}, },
// id // id
async getUser(id){ async getUser(id) {
let _this = this; let _this = this;
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
}else{ } else {
_this.isUseChildCard = false _this.isUseChildCard = false
} }
_this.user = res.data.userVo; _this.user = res.data.userVo;
_this.user = res.data.userVo; _this.user = res.data.userVo;
_this.chooseGrade(_this.user.id,_this.user.gradeId); _this.chooseGrade(_this.user.id, _this.user.gradeId);
if (res.data.userVo.refuelMoney && res.data.userVo.refuelMoney!='null'){ if (res.data.userVo.refuelMoney && res.data.userVo.refuelMoney != 'null') {
_this.refuelMoney = JSON.parse(res.data.userVo.refuelMoney) _this.refuelMoney = JSON.parse(res.data.userVo.refuelMoney)
_this.refuelMoneyAfter = JSON.parse(res.data.userVo.refuelMoney) _this.refuelMoneyAfter = JSON.parse(res.data.userVo.refuelMoney)
_this.chooseRefuelMoney() _this.chooseRefuelMoney()
}else{ } else {
if (!this.isFixingLevel){ if (!this.isFixingLevel) {
_this.chooseCardBalance(0) _this.chooseCardBalance(0)
console.log(this.balanceRedece,154); console.log(this.balanceRedece, 154);
_this.getPaymentPreferential(this.user.gradeId) _this.getPaymentPreferential(this.user.gradeId)
}else{ } else {
_this.chooseCardBalance(0) _this.chooseCardBalance(0)
} }
} }
@ -787,11 +866,11 @@
// _this.chooseGrade(res.data.userVo.id,res.data.userVo.gradeId) // _this.chooseGrade(res.data.userVo.id,res.data.userVo.gradeId)
}) })
}, },
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
} }
let map = { let map = {
@ -811,19 +890,20 @@
request({ request({
url: "business/marketingActivity/activeExchange/getPaymentActive", url: "business/marketingActivity/activeExchange/getPaymentActive",
method: 'get', method: 'get',
params:map, params: map,
}).then((res) => { }).then((res) => {
this.preferentialData = res.data this.preferentialData = res.data
if (res.data.memberFavorableAmount){ if (res.data.memberFavorableAmount) {
this.gradeRedece = res.data.memberFavorableAmount this.gradeRedece = res.data.memberFavorableAmount
} }
if (res.data.cardFavorableAmount){ if (res.data.cardFavorableAmount) {
this.couponRedece = res.data.cardFavorableAmount this.couponRedece = res.data.cardFavorableAmount
} }
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)
@ -840,7 +920,7 @@
orderNo: _this.orderNo orderNo: _this.orderNo
}, },
}).then((res) => { }).then((res) => {
if(res.data){ if (res.data) {
// console.log(res); // console.log(res);
_this.oilOrder = res.data _this.oilOrder = res.data
// _this.getStaffList(res.data.staffId) // _this.getStaffList(res.data.staffId)
@ -851,7 +931,7 @@
if (_this.AppToken) { if (_this.AppToken) {
_this.getUser(res.data.userId) _this.getUser(res.data.userId)
_this.ifLogin = true _this.ifLogin = true
}else{ } else {
_this.ifLogin = false _this.ifLogin = false
_this.payAmount = _this.oilOrder.orderAmount _this.payAmount = _this.oilOrder.orderAmount
} }
@ -908,7 +988,7 @@
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.scc{ .scc {
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
margin-top: 10px; margin-top: 10px;
@ -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;