营销活动

This commit is contained in:
13405411873 2024-10-09 17:32:17 +08:00
parent 3d087f8f5c
commit 89fe6b7fa8
11 changed files with 270 additions and 193 deletions

View File

@ -190,7 +190,6 @@ public class FyPayServiceImpl implements FyPayService {
String str = reqMap.get("sign"); String str = reqMap.get("sign");
if (Utils.verifySign(reqMap, str)) { if (Utils.verifySign(reqMap, str)) {
OilOrder oilOrder = oilOrderService.selectOilOrderByOrderNo(orderNo); OilOrder oilOrder = oilOrderService.selectOilOrderByOrderNo(orderNo);
List<OilOrder> list = oilOrderService.selectOilOrder(orderNo);
LJOrder goodsOrder = goodsOrderService.selectGoodsOrder(orderNo); LJOrder goodsOrder = goodsOrderService.selectGoodsOrder(orderNo);
CashierOrder cashierOrder = cashierOrderService.selectCashierOrder(orderNo); CashierOrder cashierOrder = cashierOrderService.selectCashierOrder(orderNo);
String transactionType = null; String transactionType = null;
@ -281,32 +280,6 @@ public class FyPayServiceImpl implements FyPayService {
receiveParameter.setType("7"); receiveParameter.setType("7");
receiveParameter.setContent("挂账订单"); receiveParameter.setContent("挂账订单");
} }
if (!ArrayUtil.isEmpty(list)) {
if (list.size() > 1) {
Double oilLiters = 0.0;
for (OilOrder order : list) {
oilLiters += order.getOilNum();
}
for (OilOrder order : list) {
if (order.getOrderType().equals("主订单")) {
if (ObjectUtil.isNotEmpty(order.getStaffId()))
staffCommissionService.countStaffCommission(order.getStaffId(), order.getStoreId(), order.getOrderAmount(), order.getPayAmount(), "1", orderNo);
}
// 添加多个油品订单
order.setOrderStatus("paid");
order.setPayTime(date);
oilOrderService.updateOilOrder(order);
oilOrderService.updateCardAndActiveById(order.getStoreId(), order.getUserId(), order.getActiveId(), order.getCouponId(), order.getActiveType(), order.getOrderAmount(), order.getPayAmount(), Integer.valueOf(order.getOils()));
// 修改油罐容量
List<JSONObject> jsonObjects = JSONArray.parseArray(map1.get("oilOrder"), JSONObject.class);
for (JSONObject jsonObject : jsonObjects) {
oilOrderService.addOilTrack(jsonObject, oilOrder.getStoreId());
}
}
}
}
if ("CVR".equals(type)) { if ("CVR".equals(type)) {
//储值卡订单 //储值卡订单
payStates = "paid"; payStates = "paid";
@ -351,14 +324,6 @@ public class FyPayServiceImpl implements FyPayService {
receiveParameter.setType("7"); receiveParameter.setType("7");
receiveParameter.setContent("挂账订单"); receiveParameter.setContent("挂账订单");
} }
if (!ArrayUtil.isEmpty(list)) {
if (list.size() > 1) {
for (OilOrder order : list) {
order.setOrderStatus("payFail");
oilOrderService.updateOilOrder(order);
}
}
}
if ("CVR".equals(type)) { if ("CVR".equals(type)) {
payStates = "payFail"; payStates = "payFail";
cardValueOrdersService.updateOrderStatus(orderNo,payStatus); cardValueOrdersService.updateOrderStatus(orderNo,payStatus);
@ -413,7 +378,7 @@ public class FyPayServiceImpl implements FyPayService {
//储值卡 //储值卡
Integer id = Integer.parseInt(map1.get("orderId")); Integer id = Integer.parseInt(map1.get("orderId"));
cardValueRecordService.editPayStatus(id, payStates); cardValueRecordService.editPayStatus(id, payStates);
cardValueOrdersService.updateBalance(orderNo,payStatus); //cardValueOrdersService.updateBalance(orderNo,payStatus);
CardValueRecord byId = cardValueRecordService.getById(id); CardValueRecord byId = cardValueRecordService.getById(id);
receiveParameter.setType("3"); receiveParameter.setType("3");
if (byId.getMtUserId() != null) { if (byId.getMtUserId() != null) {
@ -449,13 +414,12 @@ public class FyPayServiceImpl implements FyPayService {
this.insertAllOrderInfo(receiveParameter, payStatus,discountAmount,payChannel,merchantConfig); this.insertAllOrderInfo(receiveParameter, payStatus,discountAmount,payChannel,merchantConfig);
} }
if (ObjectUtil.isNotEmpty(merchantConfig)) { if (ObjectUtil.isNotEmpty(merchantConfig)) {
//添加配置记录信息 //添加配置记录信息
MerchantConfigRecord merchantConfigRecord = new MerchantConfigRecord(); MerchantConfigRecord merchantConfigRecord = new MerchantConfigRecord();
merchantConfigRecord.setMerchantId(merchantConfig.getId()); merchantConfigRecord.setMerchantId(merchantConfig.getId());
if (payStatus.equals("paid")) { if (payStatus.equals("paid")) {
merchantConfigRecord.setIsSuccess("yes"); merchantConfigRecord.setIsSuccess("yes");
} else { }else {
merchantConfigRecord.setIsSuccess("no"); merchantConfigRecord.setIsSuccess("no");
} }
merchantConfigRecord.setAmount(allAmount / 100.0); merchantConfigRecord.setAmount(allAmount / 100.0);

View File

@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.api.ApiController; import com.baomidou.mybatisplus.extension.api.ApiController;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon; import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser;
import com.fuint.business.marketingActivity.cardCoupon.service.CardCouponService; import com.fuint.business.marketingActivity.cardCoupon.service.CardCouponService;
import com.fuint.business.marketingActivity.cardGiftActive.entity.CardGiftActive; import com.fuint.business.marketingActivity.cardGiftActive.entity.CardGiftActive;
import com.fuint.business.petrolStationManagement.entity.OilName; import com.fuint.business.petrolStationManagement.entity.OilName;
@ -214,6 +215,13 @@ public class CardCouponController extends BaseController {
return getSuccessResult(this.cardCouponService.selectAllByPageAndStoreId(page, cardCoupon)); return getSuccessResult(this.cardCouponService.selectAllByPageAndStoreId(page, cardCoupon));
} }
@PostMapping("/sendCoupon")
public ResponseObject sendCoupon(@RequestBody CardCouponUser cardCouponUser) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
cardCouponUser.setStoreId(nowAccountInfo.getStoreId());
cardCouponUser.setChainStoreId(nowAccountInfo.getChainStoreId());
return getSuccessResult(cardCouponService.sendCoupon(cardCouponUser));
}
// @GetMapping("getCouponOne") // @GetMapping("getCouponOne")
// public ResponseObject getCouponOne(Integer id) { // public ResponseObject getCouponOne(Integer id) {

View File

@ -30,7 +30,7 @@ public class CardCouponUser extends Model<CardCouponUser> {
private Integer mtUserId; private Integer mtUserId;
//会员手机号码 //会员手机号码
private String mobile; private String mobile;
//来源类型 1储值卡2囤油卡.... //来源类型 1储值卡2囤油卡 3消费有礼赠送4收银台赠送
private String fromType; private String fromType;
//活动id //活动id
private Integer activeId; private Integer activeId;

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon; import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser;
import com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponUniVo; import com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponUniVo;
import java.util.List; import java.util.List;
@ -27,7 +28,7 @@ public interface CardCouponService extends IService<CardCoupon> {
int isOnLine(Integer id); int isOnLine(Integer id);
IPage selectAllByPageAndStoreId(Page page, CardCoupon cardCoupon); IPage selectAllByPageAndStoreId(Page page, CardCoupon cardCoupon);
int sendCoupon(CardCouponUser cardCouponUser);
CardCoupon selectOneBuId(Integer id); CardCoupon selectOneBuId(Integer id);
/** /**

View File

@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon; import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser;
import com.fuint.business.marketingActivity.cardCoupon.mapper.CardCouponMapper; import com.fuint.business.marketingActivity.cardCoupon.mapper.CardCouponMapper;
import com.fuint.business.marketingActivity.cardCoupon.mapper.CardCouponUserMapper; import com.fuint.business.marketingActivity.cardCoupon.mapper.CardCouponUserMapper;
import com.fuint.business.marketingActivity.cardCoupon.service.CardCouponService; import com.fuint.business.marketingActivity.cardCoupon.service.CardCouponService;
@ -20,15 +21,14 @@ import com.fuint.business.petrolStationManagement.entity.OilName;
import com.fuint.business.petrolStationManagement.mapper.OilNameMapper; import com.fuint.business.petrolStationManagement.mapper.OilNameMapper;
import com.fuint.business.store.entity.MtStore; import com.fuint.business.store.entity.MtStore;
import com.fuint.business.store.mapper.MtStoreMapper; import com.fuint.business.store.mapper.MtStoreMapper;
import com.fuint.business.userManager.service.LJUserService;
import com.fuint.business.userManager.vo.LJUserVo;
import com.fuint.common.dto.AccountInfo; import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil; import com.fuint.common.util.TokenUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -40,14 +40,12 @@ import java.util.stream.Collectors;
@Service("cardCouponService") @Service("cardCouponService")
public class CardCouponServiceImpl extends ServiceImpl<CardCouponMapper, CardCoupon> implements CardCouponService { public class CardCouponServiceImpl extends ServiceImpl<CardCouponMapper, CardCoupon> implements CardCouponService {
@Autowired
private MtStoreMapper mtStoreMapper;
@Autowired @Autowired
private CardCouponUserMapper cardCouponUserMapper; private CardCouponUserMapper cardCouponUserMapper;
@Autowired @Autowired
private OilNameMapper oilNameMapper; private LJUserService userService;
@Override @Override
public IPage<CardCoupon> pageVo(Page page, CardCoupon cardCoupon) { public IPage<CardCoupon> pageVo(Page page, CardCoupon cardCoupon) {
return baseMapper.pageVo( page, cardCoupon); return baseMapper.pageVo( page, cardCoupon);
@ -128,6 +126,22 @@ public class CardCouponServiceImpl extends ServiceImpl<CardCouponMapper, CardCou
return cardCouponUniVoIPage; return cardCouponUniVoIPage;
} }
@Override
public int sendCoupon(CardCouponUser cardCouponUser) {
LJUserVo ljUserVo = userService.selectUserById(cardCouponUser.getMtUserId(), cardCouponUser.getStoreId());
cardCouponUser.setMobile(ljUserVo.getMobile());
//通过优惠卷策略计算 开始时间 结束时间
CardCoupon cardCoupon = this.getById(cardCouponUser.getCardCouponId());
if (cardCoupon.getTimeType().equals("1")){
cardCouponUser.setStartTime(new Date());
cardCouponUser.setEndTime(DateUtil.offsetDay(new Date(),cardCoupon.getValidityDay()));
}else {
cardCouponUser.setStartTime(cardCoupon.getEffectiveDateStart());
cardCouponUser.setEndTime(cardCoupon.getEffectiveDateEnd());
}
return cardCouponUserMapper.insert(cardCouponUser);
}
@Override @Override
public CardCoupon selectOneBuId(Integer id) { public CardCoupon selectOneBuId(Integer id) {
return baseMapper.selectById(id); return baseMapper.selectById(id);

View File

@ -47,14 +47,17 @@ import com.fuint.business.order.service.OilBalanceChangeService;
import com.fuint.business.petrolStationManagement.service.OilNameService; import com.fuint.business.petrolStationManagement.service.OilNameService;
import com.fuint.business.storeInformation.entity.LJStore; 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.MtUserFuel;
import com.fuint.business.userManager.entity.UserBalance; import com.fuint.business.userManager.entity.UserBalance;
import com.fuint.business.userManager.mapper.LJUserMapper; import com.fuint.business.userManager.mapper.LJUserMapper;
import com.fuint.business.userManager.mapper.UserBalanceMapper; import com.fuint.business.userManager.mapper.UserBalanceMapper;
import com.fuint.business.userManager.service.IMtUserFuelService;
import com.fuint.business.userManager.service.UserBalanceService; import com.fuint.business.userManager.service.UserBalanceService;
import com.fuint.business.userManager.vo.LJUserVo; import com.fuint.business.userManager.vo.LJUserVo;
import com.fuint.common.util.RedisLock; import com.fuint.common.util.RedisLock;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
@ -118,6 +121,8 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
private StaffCommissionService staffCommissionService; private StaffCommissionService staffCommissionService;
@Resource @Resource
private CardValueOrdersService cardValueOrdersService; private CardValueOrdersService cardValueOrdersService;
@Resource
private IMtUserFuelService userFuelService;
/** /**
* 通过ID查询单条数据 * 通过ID查询单条数据
* *
@ -188,6 +193,35 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
*/ */
@Override @Override
public boolean editPayStatus(Integer id, String payStatus) { public boolean editPayStatus(Integer id, String payStatus) {
//增加用户的余额
if (payStatus.equals("paid")){
//支付成功的处理 判断当前支付订单是否不是成功
CardFuelRecord record = cardFuelRecordMapper.selectById(id);
if (StringUtils.isNotEmpty(record.getPayStatus())&&!record.getPayStatus().equals("paid")){
return true;
}
//处理当前用户的余额
UserBalance userBalance = userBalanceService.selectUserBalanceByStorId(record.getMtUserId(), record.getStoreId());
userBalance.setPoints(userBalance.getPoints()+record.getPoints());
//囤油卡数据
LambdaQueryWrapper<MtUserFuel> queryWrapper =new LambdaQueryWrapper<>();
queryWrapper.eq(MtUserFuel::getMtUserId,record.getMtUserId())
.eq(MtUserFuel::getStoreId,record.getStoreId()).eq(MtUserFuel::getOilName,record.getOilNumberId());
MtUserFuel mtUserFuel = userFuelService.getOne(queryWrapper);
if (ObjectUtils.isNotEmpty(mtUserFuel)){
mtUserFuel.setFuelAmount(mtUserFuel.getFuelAmount()+record.getIncomeLitres());
}else {
mtUserFuel =new MtUserFuel();
mtUserFuel.setFuelAmount(record.getIncomeLitres());
mtUserFuel.setOilName(String.valueOf(record.getOilNumberId()));
mtUserFuel.setMtUserId(record.getMtUserId());
mtUserFuel.setStoreId(record.getStoreId());
mtUserFuel.setChainStoreId(record.getChainStoreId());
}
userFuelService.saveOrUpdate(mtUserFuel);
}
CardFuelRecord cardFuelRecord = new CardFuelRecord(); CardFuelRecord cardFuelRecord = new CardFuelRecord();
cardFuelRecord.setId(id); cardFuelRecord.setId(id);
cardFuelRecord.setPayStatus(payStatus); cardFuelRecord.setPayStatus(payStatus);
@ -251,15 +285,10 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
Date from = Date.from(instant1); Date from = Date.from(instant1);
cardFuelRecordDTO.setExpireTime(from); cardFuelRecordDTO.setExpireTime(from);
} }
cardFuelRecordDTO.setExpireTime(cardFuelRecordDTO.getExpireTime()); cardFuelRecordDTO.setExpireTime(cardFuelRecordDTO.getExpireTime());
if (ObjectUtil.isEmpty(cardFuelRecordDTO.getMtStaffId())) { if (ObjectUtil.isEmpty(cardFuelRecordDTO.getMtStaffId())) {
cardFuelRecordDTO.setMtStaffId(nowAccountInfo.getStaffId()); cardFuelRecordDTO.setMtStaffId(nowAccountInfo.getStaffId());
} }
LJStaff ljStaff = iljStaffService.selectStaffById(cardFuelRecordDTO.getMtStaffId()); LJStaff ljStaff = iljStaffService.selectStaffById(cardFuelRecordDTO.getMtStaffId());
if (ObjectUtil.isNotEmpty(ljStaff)) { if (ObjectUtil.isNotEmpty(ljStaff)) {
cardFuelRecordDTO.setStaffMobile(ljStaff.getMobile()); cardFuelRecordDTO.setStaffMobile(ljStaff.getMobile());
@ -623,7 +652,6 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
if (map.get("code").equals("success")){ if (map.get("code").equals("success")){
return JSONObject.parseObject(JSONObject.toJSONString(map.get("data")),ReturnParameter.class); return JSONObject.parseObject(JSONObject.toJSONString(map.get("data")),ReturnParameter.class);
}else { }else {
// throw new Exception(map.get("msg").toString());
return new ReturnParameter(); return new ReturnParameter();
} }
} }

View File

@ -60,9 +60,11 @@ import com.fuint.business.order.service.CardBalanceChangeService;
import com.fuint.business.order.service.GrowthValueChangeService; import com.fuint.business.order.service.GrowthValueChangeService;
import com.fuint.business.storeInformation.entity.LJStore; 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.LJUserGrade;
import com.fuint.business.userManager.entity.MtUserGradeChild; import com.fuint.business.userManager.entity.MtUserGradeChild;
import com.fuint.business.userManager.entity.UserBalance; import com.fuint.business.userManager.entity.UserBalance;
import com.fuint.business.userManager.mapper.LJUserMapper; import com.fuint.business.userManager.mapper.LJUserMapper;
import com.fuint.business.userManager.service.LJUserGradeService;
import com.fuint.business.userManager.service.MtUserGradeChildService; import com.fuint.business.userManager.service.MtUserGradeChildService;
import com.fuint.business.userManager.service.UserBalanceService; import com.fuint.business.userManager.service.UserBalanceService;
import com.fuint.business.userManager.vo.LJUserVo; import com.fuint.business.userManager.vo.LJUserVo;
@ -76,6 +78,7 @@ import com.fuint.repository.model.MtStaff;
import io.lettuce.core.dynamic.annotation.Param; import io.lettuce.core.dynamic.annotation.Param;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.redisson.api.RLock; import org.redisson.api.RLock;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -147,6 +150,8 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
@Resource @Resource
@Lazy @Lazy
private CardFuelRecordService fuelRecordService; private CardFuelRecordService fuelRecordService;
@Autowired
private LJUserGradeService userGradeService;
/** /**
* 储值卡充值新增 * 储值卡充值新增
@ -517,8 +522,11 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
} }
//赠送成长值 //赠送成长值
cardValueRecordDTO.setGrowthValue(Optional.ofNullable(selectCard.getGrowthValue()).orElse(0)); cardValueRecordDTO.setGrowthValue(Optional.ofNullable(selectCard.getGrowthValue()).orElse(0));
if (ObjectUtils.isEmpty(cardValueRecordDTO.getMtStaffId()) || cardValueRecordDTO.getMtStaffId() == 0) { if (ObjectUtils.isEmpty(selectCard.getChooseStaff()) || selectCard.getChooseStaff() == 0) {
cardValueRecordDTO.setMtStaffId(nowAccountInfo.getStaffId()); cardValueRecordDTO.setMtStaffId(nowAccountInfo.getStaffId());
cardValueRecordDTO.setRealName(nowAccountInfo.getRealName());
LJUserVo ljUserVo1 = ljUserMapper.selectUserById(nowAccountInfo.getId());
cardValueRecordDTO.setStaffMobile(ljUserVo1.getMobile());
}else { }else {
LJStaff staff = mtStaffService.getById(selectCard.getChooseStaff()); LJStaff staff = mtStaffService.getById(selectCard.getChooseStaff());
cardValueRecordDTO.setRealName(staff.getRealName()); cardValueRecordDTO.setRealName(staff.getRealName());
@ -541,7 +549,6 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
//囤油卡 //囤油卡
CardFuelRecordDTO cardFuelRecordDTO =new CardFuelRecordDTO(); CardFuelRecordDTO cardFuelRecordDTO =new CardFuelRecordDTO();
cardFuelRecordDTO.setCardFuelId(selectCard.getSelectCardId()); cardFuelRecordDTO.setCardFuelId(selectCard.getSelectCardId());
cardFuelRecordDTO.setMtStaffId(ljUserVo.getId());
cardFuelRecordDTO.setPayStatus(payStatus); cardFuelRecordDTO.setPayStatus(payStatus);
cardFuelRecordDTO.setMtUserId(ljUserVo.getId()); cardFuelRecordDTO.setMtUserId(ljUserVo.getId());
cardFuelRecordDTO.setName(ljUserVo.getName()); cardFuelRecordDTO.setName(ljUserVo.getName());
@ -563,10 +570,13 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
//赠送积分 //赠送积分
cardFuelRecordDTO.setPoints(Optional.ofNullable(selectCard.getPoints()).orElse(0)); cardFuelRecordDTO.setPoints(Optional.ofNullable(selectCard.getPoints()).orElse(0));
//赠送成长值 cardFuelRecordDTO.setPaymentType(selectCard.getPaymentType());
cardFuelRecordDTO.setGrowthValue(Optional.ofNullable(selectCard.getGrowthValue()).orElse(0)); cardFuelRecordDTO.setPayChannel(selectCard.getPayChannel());
if (ObjectUtils.isEmpty(cardFuelRecordDTO.getMtStaffId()) || cardFuelRecordDTO.getMtStaffId() == 0) { if (ObjectUtils.isEmpty(selectCard.getChooseStaff()) || selectCard.getChooseStaff() == 0) {
cardFuelRecordDTO.setMtStaffId(nowAccountInfo.getStaffId()); cardFuelRecordDTO.setMtStaffId(nowAccountInfo.getStaffId());
cardFuelRecordDTO.setRealName(nowAccountInfo.getRealName());
LJUserVo ljUserVo1 = ljUserMapper.selectUserById(nowAccountInfo.getId());
cardFuelRecordDTO.setStaffMobile(ljUserVo1.getMobile());
}else { }else {
LJStaff staff = mtStaffService.getById(selectCard.getChooseStaff()); LJStaff staff = mtStaffService.getById(selectCard.getChooseStaff());
cardFuelRecordDTO.setRealName(staff.getRealName()); cardFuelRecordDTO.setRealName(staff.getRealName());
@ -574,6 +584,7 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
cardFuelRecordDTO.setStaffMobile(staff.getMobile()); cardFuelRecordDTO.setStaffMobile(staff.getMobile());
} }
fuelRecordService.insert(cardFuelRecordDTO); fuelRecordService.insert(cardFuelRecordDTO);
orderId = cardFuelRecordDTO.getId();
res = JSONObject.parseObject(JSONObject.toJSONString(cardFuelRecordDTO)); res = JSONObject.parseObject(JSONObject.toJSONString(cardFuelRecordDTO));
} }
@ -769,31 +780,21 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
} }
}catch (Exception e) { }catch (Exception e) {
redisLock.unlock(lockKey); redisLock.unlock(lockKey);
e.printStackTrace(); e.printStackTrace();
continue;
} }
} }
//会员等级充值送券 //会员等级充值送券
giveCoupon(cardValueRecord.getMtUserId(),cardValueRecord.getStoreId(),ljUserVos,ljStaff); giveCoupon(cardValueRecord.getMtUserId(),cardValueRecord.getStoreId(),ljUserVos,ljStaff);
// 修改订单的处理状态 (避免二次执行) // 修改订单的处理状态 (避免二次执行)
CardValueRecord updateCardValueRecord = new CardValueRecord(); CardValueRecord updateCardValueRecord = new CardValueRecord();
updateCardValueRecord.setId(id); updateCardValueRecord.setId(id);
updateCardValueRecord.setStatus("1"); updateCardValueRecord.setStatus("1");
cardValueRecord.setStatus("1"); cardValueRecord.setStatus("1");
baseMapper.updateById(updateCardValueRecord); baseMapper.updateById(updateCardValueRecord);
redisLock.unlock(lockKey); redisLock.unlock(lockKey);
} }
// else {
// return cardValueRecord;
// }
return cardValueRecord; return cardValueRecord;
} }
//添加余额明细表 //添加余额明细表
@ -884,11 +885,30 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
// 成长值变动 // 成长值变动
//支付 //支付
@Transactional(rollbackFor = Exception.class)
public boolean editPayStatus(Integer id, String payStatus) { public boolean editPayStatus(Integer id, String payStatus) {
//增加用户的余额
if (payStatus.equals("paid")){
//支付成功的处理 判断当前支付订单是否不是成功
CardValueRecord record = baseMapper.selectById(id);
if (StringUtils.isNotEmpty(record.getPayStatus())&&!record.getPayStatus().equals("paid")){
return true;
}
//处理当前用户的余额
UserBalance userBalance = userBalanceService.selectUserBalanceByStorId(record.getMtUserId(), record.getStoreId());
userBalance.setCardBalance(userBalance.getCardBalance()+record.getRechargeBalance());
userBalance.setGiveAmount(userBalance.getGiveAmount()+record.getGiftBalance());
userBalance.setPoints(userBalance.getPoints()+record.getPoints());
userBalance.setGrowthValue(userBalance.getGrowthValue()+record.getGrowthValue());
userBalance.setRechargeNum(userBalance.getRechargeNum()+1);
//处理会员的等级
List<LJUserGrade> records = userGradeService.selectUserGradeAll(userBalance.getStoreId());
}
CardValueRecord cardValueRecord = new CardValueRecord(); CardValueRecord cardValueRecord = new CardValueRecord();
cardValueRecord.setId(id); cardValueRecord.setId(id);
cardValueRecord.setPayStatus(payStatus); cardValueRecord.setPayStatus(payStatus);
int i = baseMapper.updateById(cardValueRecord); int i = baseMapper.updateById(cardValueRecord);
// staffCommissionService.countStaffCommission(cardValueOrders.getStaffId(),cardValueOrders.getStoreId(),cardValueOrders.getAmount(),cardValueOrders.getPayAmount(),"3",cardValueOrders.getOrderNo()); // staffCommissionService.countStaffCommission(cardValueOrders.getStaffId(),cardValueOrders.getStoreId(),cardValueOrders.getAmount(),cardValueOrders.getPayAmount(),"3",cardValueOrders.getOrderNo());
return i>0; return i>0;
} }

View File

@ -407,49 +407,36 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
Double seekZero = Double.valueOf(map.get("seekZero")); Double seekZero = Double.valueOf(map.get("seekZero"));
// 油枪id // 油枪id
String oilGunId = map.get("oilGunId"); String oilGunId = map.get("oilGunId");
log.info("11111111111111111111111285:", map.get("levelAmount"));
Double levelAmount = Double.valueOf(map.get("levelAmount")); Double levelAmount = Double.valueOf(map.get("levelAmount"));
Double activeAmount = Double.valueOf(map.get("activeAmount")); Double activeAmount = Double.valueOf(map.get("activeAmount"));
Double oilCardAmount1 = Double.valueOf(map.get("oilCardAmount1")); Double oilCardAmount1 = Double.valueOf(map.get("oilCardAmount1"));
// 优惠券id // 优惠券 用户 id
Integer cardFavorableId = null; Integer couponUserId = null;
if (StringUtils.isNotEmpty(map.get("cardFavorableId"))) { if (StringUtils.isNotEmpty(map.get("couponUserId"))) {
cardFavorableId = Integer.valueOf(map.get("cardFavorableId")); couponUserId = Integer.valueOf(map.get("couponUserId"));
}
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"));
} }
// 付款用户 //付款用户
String payUser = null; String payUser = null;
if (ObjectUtil.isNotEmpty(map.get("payUser")) && !map.get("payUser").equals("[]")) { if (ObjectUtil.isNotEmpty(map.get("payUser")) && !map.get("payUser").equals("[]")) {
payUser = map.get("payUser"); payUser = map.get("payUser");
} else { } else {
payUser = "散客"; payUser = "散客";
} }
// 油品优惠金额 //油品优惠金额
Double oilDiscount = Double.valueOf(map.get("oilDiscount")); Double oilDiscount = Double.valueOf(map.get("oilDiscount"));
// 商品优惠金额 // 商品优惠金额
Double goodsDiscount = Double.valueOf(map.get("goodsDiscount")); Double goodsDiscount = Double.valueOf(map.get("goodsDiscount"));
// 员工id //员工id
Integer staffId = null; Integer staffId = null;
if (ObjectUtil.isNotEmpty(map.get("staffId"))) { if (ObjectUtil.isNotEmpty(map.get("staffId"))) {
staffId = Integer.valueOf(map.get("staffId")); staffId = Integer.valueOf(map.get("staffId"));
} }
// 会员消费金额储值卡需要减少的金额 // 会员消费金额储值卡需要减少的金额
Double consumeAmount = Double.valueOf(map.get("consumeAmount")); Double consumeAmount = Double.valueOf(map.get("consumeAmount"));
Integer userId = null; Integer userId = null;
Boolean isMember = false; Boolean isMember = false;
@ -546,7 +533,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
orderService.insertGoodOrder(ljOrder); orderService.insertGoodOrder(ljOrder);
// 查询商品订单号 //查询商品订单号
LJOrder ljOrder2 = orderService.selectGoodsOrder(orderNo); LJOrder ljOrder2 = orderService.selectGoodsOrder(orderNo);
if (payType.equals("CASH") || payType.equals("credit")) { if (payType.equals("CASH") || payType.equals("credit")) {
// 添加商品订单记录表 // 添加商品订单记录表
@ -630,16 +617,13 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
order.setPayTime(new Date()); order.setPayTime(new Date());
order.setOrderStatus("paid"); order.setOrderStatus("paid");
} }
// if (ObjectUtil.isNotEmpty(this.selectOilOrderByOrderNo(orderNo))){
// baseMapper.updateById(order);
// }else {
baseMapper.insert(order); baseMapper.insert(order);
// }
oilOrder1 = this.selectOilOrderByOrderNo(orderNo); oilOrder1 = this.selectOilOrderByOrderNo(orderNo);
} }
} }
// 添加收银台订单信息 // 添加收银台订单信息
CashierOrder cashierOrder = new CashierOrder(); CashierOrder cashierOrder = new CashierOrder();
cashierOrder.setStaffId(staffId); cashierOrder.setStaffId(staffId);
cashierOrder.setStoreId(storeId); cashierOrder.setStoreId(storeId);
@ -1586,13 +1570,12 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
public OilOrder addOilOrder(OilOrder oilOrder) { public OilOrder addOilOrder(OilOrder oilOrder) {
// AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); // AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo1(); AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo1();
// 根据日期生成订单信息 //根据日期生成订单信息
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String timestamp = dateFormat.format(new Date()); String timestamp = dateFormat.format(new Date());
String randomString = UUID.randomUUID().toString().replace("-", "").substring(0, 6); String randomString = UUID.randomUUID().toString().replace("-", "").substring(0, 6);
String orderNo = "2345" + timestamp + randomString; String orderNo = "2345" + timestamp + randomString;
//添加油品订单信息
// 添加油品订单信息
oilOrder.setOrderNo(orderNo); oilOrder.setOrderNo(orderNo);
oilOrder.setOrderStatus("unpaid"); oilOrder.setOrderStatus("unpaid");
oilOrder.setOrderType("主订单"); oilOrder.setOrderType("主订单");
@ -1616,7 +1599,6 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
LJUserVo userVo = userService.selectUserById(oilOrder.getUserId(), oilOrder.getStoreId()); LJUserVo userVo = userService.selectUserById(oilOrder.getUserId(), oilOrder.getStoreId());
oilOrder.setPayUser(userVo.getMobile()); oilOrder.setPayUser(userVo.getMobile());
// baseMapper.insert(oilOrder);
if (ObjectUtil.isNotEmpty(this.selectOilOrderByOrderNo(orderNo))) { if (ObjectUtil.isNotEmpty(this.selectOilOrderByOrderNo(orderNo))) {
baseMapper.updateById(oilOrder); baseMapper.updateById(oilOrder);
} else { } else {
@ -1629,15 +1611,15 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
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(); 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"));
// 优惠金额 //优惠金额
String discountAmount = map.get("discountAmount"); String discountAmount = map.get("discountAmount");
// 囤油卡消费后的信息 //囤油卡消费后的信息
String oilCardAmount = map.get("oilCardAmount"); String oilCardAmount = map.get("oilCardAmount");
// 囤油卡消费升数 //囤油卡消费升数
Double oilCardLiters = Double.valueOf(map.get("oilCardLiters")); Double oilCardLiters = Double.valueOf(map.get("oilCardLiters"));
// 是否使用囤油卡 //是否使用囤油卡
String isOilStorageCard = map.get("isOilStorageCard"); String isOilStorageCard = map.get("isOilStorageCard");
// 储值卡消费金额 // 储值卡消费金额
String balanceAmount = map.get("balanceAmount"); String balanceAmount = map.get("balanceAmount");
@ -2044,7 +2026,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
private void updateGrowthValue(Double oilAmount, Double oilActualPay, Integer userid, Integer oilId, String refuelMoney, Integer storeId, String orderNo) { private void updateGrowthValue(Double oilAmount, Double oilActualPay, Integer userid, Integer oilId, String refuelMoney, Integer storeId, String orderNo) {
if (ObjectUtil.isNotEmpty(oilId)) { if (ObjectUtil.isNotEmpty(oilId)) {
OilName oilName = oilNameService.selectOilNameById(oilId); OilName oilName = oilNameService.selectOilNameById(oilId);
// 获取成长值增长数值 //获取成长值增长数值
Integer gasGrowthValue = null; Integer gasGrowthValue = null;
Integer dieselGrowthValue = null; Integer dieselGrowthValue = null;
Integer naturalGrowthValue = null; Integer naturalGrowthValue = null;
@ -2053,33 +2035,6 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
LJStore store = storeService.selectStoreByStoreId(storeId); LJStore store = storeService.selectStoreByStoreId(storeId);
UserBalance balance = userBalanceService.selectUserBalance(userid, store.getChainStoreId()); UserBalance balance = userBalanceService.selectUserBalance(userid, store.getChainStoreId());
int growth = balance.getGrowthValue(); int growth = balance.getGrowthValue();
// if (refuelMoney==null){
// String refuelMoney1 = balance.getRefuelMoney();
// if (ObjectUtil.isNotEmpty(refuelMoney1) && ObjectUtil.isNotEmpty(refuelMoney)){
// JSONArray objects = JSONArray.parseArray(refuelMoney);
// JSONArray objects1 = JSONArray.parseArray(refuelMoney1);
// List<RefuelMoney> list = new ArrayList<>();
// for (int i = 0;i<objects.size();i++){
// if (((JSONObject)objects.get(i)).get("oilType").toString().equals(oilId)){
// RefuelMoney refuelMoney2 = new RefuelMoney();
// refuelMoney2.setType(((JSONObject) objects.get(i)).get("type").toString());
// refuelMoney2.setOilType(((JSONObject) objects.get(i)).get("oilType").toString());
// refuelMoney2.setRefuelMoney(((JSONObject) objects.get(i)).get("refuelMoney").toString());
// list.add(refuelMoney2);
// Double oilBalance = 0.0;
// Double afterOilBalance = 0.0;
// if (!refuelMoney1.equals(refuelMoney)){
// oilBalance = Double.valueOf(((JSONObject) objects1.get(i)).get("refuelMoney").toString()) - Double.valueOf(((JSONObject) objects.get(i)).get("refuelMoney").toString());
// afterOilBalance = Double.valueOf(((JSONObject) objects.get(i)).get("refuelMoney").toString());
// this.insertOilBalance(userid,storeId,oilName.getId().toString(),oilName.getOilType(),oilBalance,afterOilBalance,orderNo);
// }
// }
// }
// balance.setRefuelMoney(JSONObject.toJSONString(list));
// }
// }else {
// balance.setRefuelMoney(refuelMoney);
// }
if (ObjectUtil.isNotEmpty(refuelMoney) && !refuelMoney.equals("null")) { if (ObjectUtil.isNotEmpty(refuelMoney) && !refuelMoney.equals("null")) {
String refuelMoney1 = balance.getRefuelMoney(); String refuelMoney1 = balance.getRefuelMoney();
JSONArray objects = JSONArray.parseArray(refuelMoney); JSONArray objects = JSONArray.parseArray(refuelMoney);
@ -2096,7 +2051,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
balance.setRefuelMoney(refuelMoney); balance.setRefuelMoney(refuelMoney);
} }
// 查询会员等级列表信息 //查询会员等级列表信息
Page page = new Page(1, 20); Page page = new Page(1, 20);
LJUserGrade ljUserGrade1 = new LJUserGrade(); LJUserGrade ljUserGrade1 = new LJUserGrade();
List<LJUserGrade> records = userGradeService.selectUserGradeAll(storeId); List<LJUserGrade> records = userGradeService.selectUserGradeAll(storeId);
@ -2106,7 +2061,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
Integer addVal = (int) (gasGrowthValue * oilAmount); Integer addVal = (int) (gasGrowthValue * oilAmount);
addGrowthVal = addVal; addGrowthVal = addVal;
growthAfter = growth + addVal; growthAfter = growth + addVal;
// 如果会员成长值达到会员等级成长值则修改会员的会员等级信息 //如果会员成长值达到会员等级成长值则修改会员的会员等级信息
for (int i = 1; i < records.size(); i++) { for (int i = 1; i < records.size(); i++) {
if (growthAfter < records.get(i).getGrowthValue()) { if (growthAfter < records.get(i).getGrowthValue()) {
balance.setGradeId(records.get(i - 1).getId()); balance.setGradeId(records.get(i - 1).getId());
@ -2119,7 +2074,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
Integer addVal = (int) (dieselGrowthValue * oilAmount); Integer addVal = (int) (dieselGrowthValue * oilAmount);
addGrowthVal = addVal; addGrowthVal = addVal;
growthAfter = growth + addVal; growthAfter = growth + addVal;
// 如果会员成长值达到会员等级成长值则修改会员的会员等级信息 //如果会员成长值达到会员等级成长值则修改会员的会员等级信息
for (int i = 0; i < records.size(); i++) { for (int i = 0; i < records.size(); i++) {
if (growthAfter < records.get(i).getGrowthValue()) { if (growthAfter < records.get(i).getGrowthValue()) {
balance.setGradeId(records.get(i - 1).getId()); balance.setGradeId(records.get(i - 1).getId());
@ -2132,7 +2087,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
Integer addVal = (int) (naturalGrowthValue * oilAmount); Integer addVal = (int) (naturalGrowthValue * oilAmount);
addGrowthVal = addVal; addGrowthVal = addVal;
growthAfter = growth + addVal; growthAfter = growth + addVal;
// 如果会员成长值达到会员等级成长值则修改会员的会员等级信息 //如果会员成长值达到会员等级成长值则修改会员的会员等级信息
for (int i = 0; i < records.size(); i++) { for (int i = 0; i < records.size(); i++) {
if (growthAfter < records.get(i).getGrowthValue()) { if (growthAfter < records.get(i).getGrowthValue()) {
balance.setGradeId(records.get(i - 1).getId()); balance.setGradeId(records.get(i - 1).getId());
@ -2142,9 +2097,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
balance.setGrowthValue(growthAfter); balance.setGrowthValue(growthAfter);
} else { } else {
} }
// 修改用户成长值 // 修改用户成长值
Integer consumeNum = balance.getConsumeNum();
// balance.setConsumeNum(consumeNum+1);
userBalanceService.updateUserBalance(balance); userBalanceService.updateUserBalance(balance);
this.insertGrowthValueChange(userid, storeId, addGrowthVal, growthAfter, orderNo); this.insertGrowthValueChange(userid, storeId, addGrowthVal, growthAfter, orderNo);

View File

@ -374,7 +374,15 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
@Override @Override
public List<LJUserVo> userListByPhone(String mobile) { public List<LJUserVo> userListByPhone(String mobile) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
return baseMapper.userListByPhone(mobile, nowAccountInfo.getStoreId()); List<LJUserVo> ljUserVos = baseMapper.userListByPhone(mobile, nowAccountInfo.getStoreId());
ljUserVos.forEach(it->{
//在查询囤油卡信息
LambdaQueryWrapper<MtUserFuel> queryWrapper =new LambdaQueryWrapper<>();
queryWrapper.eq(MtUserFuel::getStoreId,nowAccountInfo.getStoreId()).eq(MtUserFuel::getMtUserId,it.getId());
List<MtUserFuel> list = userFuelService.list(queryWrapper);
it.setUserFuels(list);
});
return ljUserVos;
} }
@Resource @Resource

View File

@ -65,3 +65,10 @@ export function getCouponList(data) {
data: data data: data
}) })
} }
export function sendCouponFun(data) {
return request({
url: '/cardCoupon/sendCoupon',
method: 'post',
data: data
})
}

View File

@ -131,7 +131,7 @@
<div class="price_">{{realAmount}}</div> <div class="price_">{{realAmount}}</div>
<div class="price_prefer">优惠合计:{{disTotal}}</div> <div class="price_prefer">优惠合计:{{disTotal}}</div>
</div> </div>
<div class="anniu">立即结算</div> <div class="anniu" @click="settlement()">立即结算</div>
</div> </div>
</div> </div>
@ -249,23 +249,23 @@
</div> </div>
<div class="wrap-tc"> <div class="wrap-tc">
<div class="tc_wa" :class="{'tc-active' : freeIndex == index }" @click="setFreeIndex(index)" <div class="tc_wa" :class="{'tc-active' : item.id == sendCoupon.id }" @click="setFreeIndex(item)" v-for="(item,index) in sendCouponList">
v-for="(item,index) in freeTicketList">{{ item.name }} {{ item.name }}
</div> </div>
</div> </div>
</div> </div>
<div class="right_tc"> <div class="right_tc">
<div style="font-weight: 600;font-size: 16px;color: #333333;text-align: center;margin-bottom: 15px"> <div style="font-weight: 600;font-size: 16px;color: #333333;text-align: center;margin-bottom: 15px">
优惠价格固定1元 {{sendCoupon.name}}
</div> </div>
<div style="font-weight: 600;font-size: 16px;color: #333333;margin-bottom: 10px">油品立减券</div> <div style="font-weight: 600;font-size: 16px;color: #333333;margin-bottom: 10px">{{sendCoupon.type}}</div>
<div style="margin-bottom: 10px">可用时间周一至周日 全天</div>
<div style="display: flex"> <div style="display: flex">
<div style="width: 70px">可用日期</div> <div style="width: 70px">日期规则</div>
<div style="width: 150px">2024-09-01 12:00:00至2024-09-01 12:00:00</div> <div style="width: 150px"> {{sendCoupon.dateText}}</div>
</div> </div>
<div style="font-weight: 600;font-size: 16px;color: #333333;margin-bottom: 5px">使用规则</div> <div style="font-weight: 600;font-size: 16px;color: #333333;margin-bottom: 5px">使用规则</div>
<div>优惠说明价值10元代金券一张消费满100可用</div> <div>{{sendCoupon.ruleText}}</div>
<div style="margin-top: 20px;text-align: end"> <div style="margin-top: 20px;text-align: end">
</div> </div>
@ -274,7 +274,7 @@
</div> </div>
<div style="display: flex;justify-content: center"> <div style="display: flex;justify-content: center">
<el-button type="primary" >确定赠送</el-button> <el-button type="primary" @click="sendCouponClick()" >确定赠送</el-button>
</div> </div>
@ -538,7 +538,14 @@ import pickUp from './newHomeComponents/pickUpTheOrder.vue'
import accountPending from './newHomeComponents/accountPending.vue' import accountPending from './newHomeComponents/accountPending.vue'
import memberRecharge from './newHomeComponents/memberRecharge.vue' import memberRecharge from './newHomeComponents/memberRecharge.vue'
import refuelingAmount from './newHomeComponents/refuelingAmount.vue' import refuelingAmount from './newHomeComponents/refuelingAmount.vue'
import { cashRegisterList, cashRegisterGoodsList,getActivityList,getCouponList,getCanUseCoupon } from '@/api/newHome/newHome.js' import {
cashRegisterList,
cashRegisterGoodsList,
getActivityList,
getCouponList,
getCanUseCoupon,
sendCouponFun
} from '@/api/newHome/newHome.js'
import {QRCodeByStoreId} from "@/api/staff/qrcode"; import {QRCodeByStoreId} from "@/api/staff/qrcode";
import {userListByPhone} from "@/api/cashier/user"; import {userListByPhone} from "@/api/cashier/user";
@ -551,6 +558,7 @@ import {
import {getReturnCode} from "@/api/print"; import {getReturnCode} from "@/api/print";
export default { export default {
dicts: ['CardCoupon_type'],
data() { data() {
return { return {
payForm:{ payForm:{
@ -559,6 +567,7 @@ export default {
authCode:null, authCode:null,
seekZero:0.00 seekZero:0.00
}, },
sendCoupon:{},
// //
activityList:[], activityList:[],
// //
@ -613,32 +622,6 @@ export default {
showCoupon: true, showCoupon: true,
freeTicket:false, freeTicket:false,
freeIndex:0, freeIndex:0,
freeTicketList:[
{
name: '油品券',
num: '0'
},
{
name: '储值卡券',
num: '0'
},
{
name: '会员卡券',
num: '0'
},
{
name: '油品券',
num: '0'
},
{
name: '储值卡券',
num: '0'
},
{
name: '会员卡券',
num: '0'
},
],
nums:0, nums:0,
payList: [ payList: [
], ],
@ -676,6 +659,7 @@ export default {
// //
vipUserList:[], vipUserList:[],
chooseVipUser:{}, chooseVipUser:{},
couponTypeList:[],
cardValueForm:{ cardValueForm:{
cardValueId: '', // id cardValueId: '', // id
mtStaffId: '', // mtStaffId: '', //
@ -785,6 +769,7 @@ export default {
this.getGoodsList() this.getGoodsList()
this.getQRCodeInfoByStoreId(0); this.getQRCodeInfoByStoreId(0);
this.getPayList() this.getPayList()
this.getCouponType()
}, },
computed: { computed: {
@ -820,6 +805,18 @@ export default {
}, },
methods: { methods: {
sendCouponClick(){
//this.sendCoupon this.chooseVipUser.id
this.sendCoupon.mtUserId = this.chooseVipUser.id
this.sendCoupon.fromType = "4"
this.sendCoupon.cardCouponId = this.sendCoupon.id
sendCouponFun(this.sendCoupon).then(
res=>{
this.$message.success("赠送成功")
this.freeTicket = false
}
)
},
handleCilone(value){ handleCilone(value){
console.log(value) console.log(value)
}, },
@ -901,23 +898,14 @@ export default {
}, },
async collection1() { async collection1() {
let makeChange = 0 let makeChange = 0
if (!this.payForm.authCode && this.payForm.paymentType !== "CASH") { if (!this.payForm.authCode && this.payForm.paymentType !== "CASH") {
this.$message.error('请先扫码'); this.$message.error('请先扫码');
return return
}else {
if (this.payForm.authCode<this.payForm.amount || this.seekZero<0){
this.$modal.msgError("请输入正确的金额");
return;
}
if (!this.payForm.authCode){
this.$modal.msgError("请输入正确的金额");
return;
}
makeChange = this.seekZero
} }
// id // id
this.payForm.mtUserId = this.chooseVipUser.id if (this.chooseVipUser.id){
this.payForm.mtUserId = this.chooseVipUser.id
}
// //
this.payForm.seekZero = makeChange this.payForm.seekZero = makeChange
this.payForm.payChannel = 'cashier' this.payForm.payChannel = 'cashier'
@ -1022,6 +1010,14 @@ export default {
this.isPay = true this.isPay = true
//this.getCode(this.realyPayBills, this.flag) //this.getCode(this.realyPayBills, this.flag)
}, },
//
async settlement(){
this.payForm.realyPayBills = this.realAmount
this.payForm.paymentType = this.payWay
this.flag = 3
this.openConfirm = true;
this.isPay = true
},
// //
getCode(amount,flag) { getCode(amount,flag) {
console.log("payType",this.payForm.payType) // console.log("payType",this.payForm.payType) //
@ -1323,12 +1319,90 @@ export default {
addVip() { addVip() {
this.newMember = true this.newMember = true
}, },
setFreeIndex(index){ setFreeIndex(data){
this.freeIndex = index //
let dateText="";
if (data.availableOrUn==0){
dateText+="适用时间 "
}else {
dateText+="不适用时间 "
}
if (data.availableType==1){
//
dateText+="每周 "
}else {
dateText+="每月 "
}
if (data.availableOrUn==0){
dateText+=data.availableDay +" 可用"
}else {
dateText+=data.availableDay +" 不可用"
}
data.dateText = dateText
let amountRule = "";
if (data.type==1){
amountRule += "消费条件: "
if (data.useType=="1"){
amountRule +="订单金额"
}else {
amountRule +="实收金额"
}
amountRule +="满足金额 "+data.reachAmount
amountRule +="优惠 "+data.reduceAmount
}else if (data.type==2){
amountRule += "兑换内容: "+data.exchangeContent
}else if (data.type==3) {
amountRule = "";
amountRule += "优惠条件: "
if (data.useType == "1") {
amountRule += "订单金额"
} else {
amountRule += "实收金额"
}
amountRule += "金额起 " + data.zkStartAmount
amountRule += "金额止 " + data.zkEndAmount
amountRule += data.zkData * 10 + "折"
}else if (data.type==4) {
amountRule = "";
amountRule += "消费条件: "
if (data.useType == "1") {
amountRule += "订单金额"
} else {
amountRule += "实收金额"
}
amountRule += "金额满 " + data.reachAmount+" 每"+data.ljOilNum +"L,减"+data.ljOilAmount+"元"
}else if (data.type==5) {
amountRule += "消费条件: "
if (data.useType=="1"){
amountRule +="订单金额"
}else {
amountRule +="实收金额"
}
amountRule +="满足金额 "+data.reachAmount
amountRule +="优惠 "+data.reduceAmount
}
data.ruleText = amountRule
console.log(amountRule,dateText,this.couponTypeList)
let tempType=""
for (const item of this.couponTypeList) {
if (item.dictValue==data.type){
tempType = item.dictLabel
}
}
data.type = tempType
this.sendCoupon = data
},
//
getCouponType(){
getDicts("CardCoupon_type").then( response => {
this.couponTypeList = response.data;
})
}, },
addFreeTicket(){ addFreeTicket(){
getCanUseCoupon().then(res=>{ getCanUseCoupon().then(res=>{
this.s this.sendCouponList = res.data
}) })
this.freeTicket = true this.freeTicket = true
}, },