From 484af8e8420ccdf8041644e93a2c4a72f020fc65 Mon Sep 17 00:00:00 2001 From: cun-nan <19819293608@163.com> Date: Wed, 9 Oct 2024 15:38:12 +0800 Subject: [PATCH] 10.9 --- .../fuint/business/order/entity/OilOrder.java | 14 +- .../service/impl/OilOrderServiceImpl.java | 236 +++++++++--------- .../views/cashier/NewComponents/credit.vue | 13 +- gasStation-uni/pages/refuel/refuel.vue | 166 ++++++++---- .../pagesHome/memberRecharge/index.vue | 116 ++++++++- 5 files changed, 368 insertions(+), 177 deletions(-) diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/entity/OilOrder.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/entity/OilOrder.java index 97fd89990..cddc47095 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/entity/OilOrder.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/entity/OilOrder.java @@ -90,13 +90,19 @@ public class OilOrder extends BaseEntity implements Serializable { */ private Double discountAmount; /** - * 优惠金额 + * 储值卡消费金额 */ private Double balanceAmount; + /** + * 等级金额 + */ private Double levelAmount; + /** + * 营销活动优惠金额 + */ private Double activeAmount; /** - * 优惠金额 + * 囤油卡消费升数 */ private Double oilCardAmount; /** @@ -144,11 +150,13 @@ public class OilOrder extends BaseEntity implements Serializable { * 退款备注 */ private String refundRemark; + /** + * 码牌二维码的sn号 + */ private String oilTagSn; /** * 油罐id */ -// @TableField(exist = false) private Integer tankId; /** * 商户号 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java index ebae65108..38539cc52 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java @@ -16,6 +16,7 @@ import com.fuint.api.fuyou.entity.ReceiveParameterPos; import com.fuint.api.fuyou.service.FyPayService; import com.fuint.api.fuyou.service.MerchantConfigService; import com.fuint.api.fuyou.service.OilConfigService; +import com.fuint.business.commission.service.CommissionRecordService; import com.fuint.business.commission.service.StaffCommissionService; import com.fuint.business.convenienceSore.entity.LJGoods; import com.fuint.business.convenienceSore.entity.SaleDetail; @@ -128,6 +129,8 @@ public class OilOrderServiceImpl extends ServiceImpl i @Autowired private StaffCommissionService staffCommissionService; @Autowired + private CommissionRecordService commissionRecordService; + @Autowired private GrowthValueChangeService growthValueChangeService; @Autowired private ChainStoreConfigService chainStoreConfigService; @@ -157,6 +160,7 @@ public class OilOrderServiceImpl extends ServiceImpl i private SysDeptMapper sysDeptMapper; @Resource private MtStoreMapper mtStoreMapper; + @Override public IPage selectOilOrderList(Page page, OilOrder order) { AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); @@ -165,12 +169,14 @@ public class OilOrderServiceImpl extends ServiceImpl i IPage oilOrderIPage = baseMapper.selectOilOrderList(page, order); return oilOrderIPage; } + @Resource OilGunMapper oilGunMapper; @Resource OilNameMapper oilNameMapper; @Resource OilTankMapper oilTankMapper; + @Override public IPage selectOilOrderListByZtDz(Page page, OilOrder order) { if (ObjectUtil.isEmpty(order.getDeptId())) { @@ -189,7 +195,7 @@ public class OilOrderServiceImpl extends ServiceImpl i record.setStoreName(mtStore.getName()); } OilGun oilGun = oilGunMapper.queryById(Integer.valueOf(record.getOilGunNum())); - if (ObjectUtil.isNotEmpty(oilGun)){ + if (ObjectUtil.isNotEmpty(oilGun)) { record.setGunName(oilGun.getGunName()); } OilName oilName = oilNameMapper.selectOilNameById(Integer.valueOf(record.getOils())); @@ -203,7 +209,8 @@ public class OilOrderServiceImpl extends ServiceImpl i } return oilOrderIPage; } -// 查询油品分析 列表 + + // 查询油品分析 列表 @Override public IPage selectOilOrderFenXiListByZtDz(Page page, OilOrderVo order) { if (ObjectUtil.isEmpty(order.getDeptId())) { @@ -239,8 +246,9 @@ public class OilOrderServiceImpl extends ServiceImpl i } return oilOrderIPage; } -// 查询油品分析 累计 - public Map selectOilOrderFenXiDataByZtDz(OilOrderVo order){ + + // 查询油品分析 累计 + public Map selectOilOrderFenXiDataByZtDz(OilOrderVo order) { if (ObjectUtil.isEmpty(order.getDeptId())) { AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); order.setDeptId(nowAccountInfo.getDeptId()); @@ -485,16 +493,16 @@ public class OilOrderServiceImpl extends ServiceImpl i LJOrder ljOrder1 = null; String transactionType = null; - if (oilAmount>0 && goodsAmount>0){ + if (oilAmount > 0 && goodsAmount > 0) { transactionType = "5"; - }else if (oilAmount>0) { + } else if (oilAmount > 0) { transactionType = "4"; - }else if (goodsAmount>0) { + } else if (goodsAmount > 0) { transactionType = "2"; } // 根据店铺id查询商户配置信息 - MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(storeId,transactionType,oilGunId); + MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(storeId, transactionType, oilGunId); if (ObjectUtil.isEmpty(merchantConfig) && !payType.equals("CASH") && !payType.equals("credit") && !map.get("allAmount").equals("0")) { @@ -1184,89 +1192,89 @@ public class OilOrderServiceImpl extends ServiceImpl i String status = "unpaid"; - if ( lockupAmount>0.0) { - OilOrder order = new OilOrder(); - OilOrder oilOrder = null; + if (lockupAmount > 0.0) { + OilOrder order = new OilOrder(); + OilOrder oilOrder = null; - // 添加收银台订单信息 - CashierOrder cashierOrder = new CashierOrder(); - boolean flag = false; - if (cardBalance >= lockupAmount){ - flag = true; - status = "paid"; - }else { - flag = false; - status = "payFail"; + // 添加收银台订单信息 + CashierOrder cashierOrder = new CashierOrder(); + boolean flag = false; + if (cardBalance >= lockupAmount) { + flag = true; + status = "paid"; + } else { + flag = false; + status = "payFail"; + } + Double oilLiters = 0.0; + for (int i = 0; i < oilOrders.size(); i++) { + Double amount = Double.valueOf(oilOrders.get(i).get("amount").toString()); + Double oilPrice = Double.valueOf(oilOrders.get(i).get("oilPrice").toString()); + Double oilNum = amount / oilPrice; + oilLiters += oilNum; + if (i == 0) { + order.setOrderType("主订单"); + order.setOrderAmount(amount); + order.setPayAmount(amount); + order.setOrderNo(orderNo); + } else { + order.setOrderType("子订单"); + order.setOrderAmount(amount); + order.setPayAmount(0.0); + order.setOrderNo(orderNo + "1"); } - Double oilLiters = 0.0; - for (int i = 0; i < oilOrders.size(); i++) { - Double amount = Double.valueOf(oilOrders.get(i).get("amount").toString()); - Double oilPrice = Double.valueOf(oilOrders.get(i).get("oilPrice").toString()); - Double oilNum = amount / oilPrice; - oilLiters += oilNum; - if (i == 0) { - order.setOrderType("主订单"); - order.setOrderAmount(amount); - order.setPayAmount(amount); - order.setOrderNo(orderNo); - } else { - order.setOrderType("子订单"); - order.setOrderAmount(amount); - order.setPayAmount(0.0); - order.setOrderNo(orderNo + "1"); - } - order.setStoreId(accountInfo.getStoreId()); - order.setUserId(userId); - order.setCommissionAmount(Double.valueOf(map.get("commissionAmount"))); - if (ObjectUtil.isNotEmpty(map.get("staffId"))) - order.setStaffId(Integer.valueOf(map.get("staffId"))); - order.setTerminal(map.get("terminal")); - order.setOils((String) oilOrders.get(i).get("oilName")); - order.setOilGunNum(oilOrders.get(i).get("gunName").toString()); - order.setOilNum(oilNum); + order.setStoreId(accountInfo.getStoreId()); + order.setUserId(userId); + order.setCommissionAmount(Double.valueOf(map.get("commissionAmount"))); + if (ObjectUtil.isNotEmpty(map.get("staffId"))) + order.setStaffId(Integer.valueOf(map.get("staffId"))); + order.setTerminal(map.get("terminal")); + order.setOils((String) oilOrders.get(i).get("oilName")); + order.setOilGunNum(oilOrders.get(i).get("gunName").toString()); + order.setOilNum(oilNum); // order.setDiscountAmount(Double.valueOf(map.get("oilDiscount"))); - order.setPayUser(userVo1.getMobile()); - order.setPayType(map.get("payType")); - order.setInvoicing("未开票"); - order.setOrderStatus(status); - if (flag) order.setPayTime(new Date()); + order.setPayUser(userVo1.getMobile()); + order.setPayType(map.get("payType")); + order.setInvoicing("未开票"); + order.setOrderStatus(status); + if (flag) order.setPayTime(new Date()); - this.addOilTrack(oilOrders.get(i), accountInfo.getStoreId()); - if (ObjectUtil.isNotEmpty(this.selectOilOrderByOrderNo(orderNo))) { - baseMapper.updateById(order); - } else { - baseMapper.insert(order); - } - - oilOrder = this.selectOilOrderByOrderNo(orderNo); - this.updateGrowthValue1(oilAmount, 0.0, userId, Integer.valueOf(oilOrder.getOils()), 0.0, storeId, orderNo); + this.addOilTrack(oilOrders.get(i), accountInfo.getStoreId()); + if (ObjectUtil.isNotEmpty(this.selectOilOrderByOrderNo(orderNo))) { + baseMapper.updateById(order); + } else { + baseMapper.insert(order); } - if (flag) { + oilOrder = this.selectOilOrderByOrderNo(orderNo); + this.updateGrowthValue1(oilAmount, 0.0, userId, Integer.valueOf(oilOrder.getOils()), 0.0, storeId, orderNo); + } - if (ObjectUtil.isNotEmpty(map.get("staffId"))) - cashierOrder.setStaffId(Integer.valueOf(map.get("staffId"))); - cashierOrder.setStoreId(accountInfo.getStoreId()); - cashierOrder.setPayUser(userVo1.getMobile()); - cashierOrder.setAmount(oilAmount); - cashierOrder.setOilPayAmount(oilAmount); - cashierOrder.setPayAmount(oilAmount); - cashierOrder.setStatus(status); - cashierOrder.setPayTime(new Date()); - cashierOrder.setOrderNo(orderNo); - cashierOrder.setOilOrderAmount(oilAmount); - cashierOrder.setTerminal(map.get("terminal")); - cashierOrder.setOilOrderId(oilOrder.getId()); - cashierOrder.setSeekZero(0.0); - cashierOrder.setPayType(map.get("payType")); - cashierOrderService.insertCashierOrder(cashierOrder); - this.insertAllOrderInfo(orderNo, storeId, oilAmount, oilAmount, 0.0, map.get("payType"), userId, "PC", "1", status); - if (ObjectUtil.isNotEmpty(map.get("staffId"))) - staffCommissionService.countStaffCommission(Integer.valueOf(map.get("staffId")), storeId, oilAmount, oilAmount, "1", orderNo); - res.put("success", "success"); - }else { - res.put("error", "储值卡余额不足!"); - } + if (flag) { + + if (ObjectUtil.isNotEmpty(map.get("staffId"))) + cashierOrder.setStaffId(Integer.valueOf(map.get("staffId"))); + cashierOrder.setStoreId(accountInfo.getStoreId()); + cashierOrder.setPayUser(userVo1.getMobile()); + cashierOrder.setAmount(oilAmount); + cashierOrder.setOilPayAmount(oilAmount); + cashierOrder.setPayAmount(oilAmount); + cashierOrder.setStatus(status); + cashierOrder.setPayTime(new Date()); + cashierOrder.setOrderNo(orderNo); + cashierOrder.setOilOrderAmount(oilAmount); + cashierOrder.setTerminal(map.get("terminal")); + cashierOrder.setOilOrderId(oilOrder.getId()); + cashierOrder.setSeekZero(0.0); + cashierOrder.setPayType(map.get("payType")); + cashierOrderService.insertCashierOrder(cashierOrder); + this.insertAllOrderInfo(orderNo, storeId, oilAmount, oilAmount, 0.0, map.get("payType"), userId, "PC", "1", status); + if (ObjectUtil.isNotEmpty(map.get("staffId"))) + staffCommissionService.countStaffCommission(Integer.valueOf(map.get("staffId")), storeId, oilAmount, oilAmount, "1", orderNo); + res.put("success", "success"); + } else { + res.put("error", "储值卡余额不足!"); + } } else { @@ -1362,7 +1370,7 @@ public class OilOrderServiceImpl extends ServiceImpl i UserBalance balance = userBalanceService.selectUserBalance(userId, store.getChainStoreId()); // 根据用户id查询用户信息 LJUserVo userVo1 = userService.selectUserById(userId, storeId); - if (ObjectUtil.isEmpty(userVo1)){ + if (ObjectUtil.isEmpty(userVo1)) { res.put("error", "当前会员不存在!"); return res; } @@ -1859,7 +1867,7 @@ public class OilOrderServiceImpl extends ServiceImpl i @Override public int updateOrderStatus(String orderNo, String status) throws Exception { int row = 0; - String staffId =""; + String staffId = ""; OilOrder oilOrder = this.selectOilOrderByOrderNo(orderNo); Integer userId = oilOrder.getUserId(); LJUser user = null; @@ -1880,7 +1888,7 @@ public class OilOrderServiceImpl extends ServiceImpl i Integer tagCodeId = oilTag.getTagCodeId(); TagCode tagCode = tagCodeService.getById(tagCodeId); String[] staffIds = tagCode.getCollection().split("staffId"); - if (staffIds.length > 1){ + if (staffIds.length > 1) { staffId = staffIds[1]; oilOrder.setStaffId(Integer.parseInt(staffId)); } @@ -1930,12 +1938,16 @@ public class OilOrderServiceImpl extends ServiceImpl i userId = cardValudChildrens.getUserId(); } } - if (ObjectUtil.isNotEmpty(userId)) this.updateGrowthValue(oilOrder.getOrderAmount(), oilOrder.getPayAmount(), userId, Integer.valueOf(oilOrder.getOils()), null, oilOrder.getStoreId(), orderNo); + if (ObjectUtil.isNotEmpty(userId)) + this.updateGrowthValue(oilOrder.getOrderAmount(), oilOrder.getPayAmount(), userId, Integer.valueOf(oilOrder.getOils()), null, oilOrder.getStoreId(), orderNo); this.addOilTracks(oilOrder, oilOrder.getStoreId()); this.updateCardAndActiveById(oilOrder.getStoreId(), oilOrder.getUserId(), oilOrder.getActiveId(), oilOrder.getCouponId(), oilOrder.getActiveType(), oilOrder.getOrderAmount(), oilOrder.getPayAmount(), Integer.valueOf(oilOrder.getOils())); - if (ObjectUtil.isNotEmpty(userId)) this.insertCardBalance(oilOrder.getOrderAmount() - oilOrder.getDiscountAmount() - oilOrder.getPayAmount(), userId, oilOrder.getStoreId(), orderNo); - if (ObjectUtil.isNotEmpty(oilOrder.getStaffId())) + if (ObjectUtil.isNotEmpty(userId)) + this.insertCardBalance(oilOrder.getOrderAmount() - oilOrder.getDiscountAmount() - oilOrder.getPayAmount(), userId, oilOrder.getStoreId(), orderNo); + if (ObjectUtil.isNotEmpty(oilOrder.getStaffId())) { staffCommissionService.countStaffCommission(oilOrder.getStaffId(), oilOrder.getStoreId(), oilOrder.getOrderAmount(), oilOrder.getPayAmount(), "1", orderNo); + commissionRecordService.addRecord(oilOrder.getStoreId(),"1",oilOrder.getStaffId(),oilOrder.getOrderAmount(), oilOrder.getPayAmount(),"0","油品出售",orderNo); + } } row = baseMapper.updateById(oilOrder); } @@ -2566,12 +2578,12 @@ public class OilOrderServiceImpl extends ServiceImpl i oilOrderVo.setTerminal("POS"); oilOrderVo.setOrderStatus("unpaid"); oilOrderVo.setOrderType("主订单"); - if (ObjectUtil.isNotEmpty(oilOrderVo.getOrderNo())){ + if (ObjectUtil.isNotEmpty(oilOrderVo.getOrderNo())) { OilOrder oilOrder = this.selectOilOrderByOrderNo(oilOrderVo.getOrderNo()); oilOrderVo.setId(oilOrder.getId()); oilOrderVo.setOrderNo(orderNo); baseMapper.updateById(oilOrderVo); - }else { + } else { oilOrderVo.setOrderNo(orderNo); baseMapper.insert(oilOrderVo); } @@ -2588,61 +2600,61 @@ public class OilOrderServiceImpl extends ServiceImpl i receiveParameterPos.setOilCardAmount(oilOrderVo.getOilCardAmount1()); receiveParameterPos.setOilGunId(oilOrderVo.getOilGunNum()); Map mainScan = fyPayService.mainScan(receiveParameterPos); - res.put("oilOrder",this.selectOilOrderByOrderNo(orderNo)); - res.put("scanCode",mainScan); + res.put("oilOrder", this.selectOilOrderByOrderNo(orderNo)); + res.put("scanCode", mainScan); return res; } @Override - public List selectProportion(Map map,List storeIds) { + public List selectProportion(Map map, List storeIds) { String startTime = map.get("startTime"); String endTime = map.get("endTime"); OilOrderVo oilOrderVo = new OilOrderVo(); - Map map1 = new HashMap<>(); - map1.put("beginTime",startTime); - map1.put("endTime",endTime); + Map map1 = new HashMap<>(); + map1.put("beginTime", startTime); + map1.put("endTime", endTime); oilOrderVo.setParams(map1); - return baseMapper.selectOilsCount(oilOrderVo,storeIds); + return baseMapper.selectOilsCount(oilOrderVo, storeIds); } @Override - public List selectListByGroup(UserGroup userGroup,Integer userId) { + public List selectListByGroup(UserGroup userGroup, Integer userId) { QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("store_id",userGroup.getStoreId()); - queryWrapper.eq("order_status","paid"); - queryWrapper.eq("user_id",userId); - if (ObjectUtil.isNotEmpty(userGroup.getConsumeCycle())){ + queryWrapper.eq("store_id", userGroup.getStoreId()); + queryWrapper.eq("order_status", "paid"); + queryWrapper.eq("user_id", userId); + if (ObjectUtil.isNotEmpty(userGroup.getConsumeCycle())) { // 查询7天的数据 - if (userGroup.getConsumeCycle().equals("1")){ + if (userGroup.getConsumeCycle().equals("1")) { LocalDate now = LocalDate.now(); LocalDate sevenDaysAgo = now.minus(7, ChronoUnit.DAYS); queryWrapper.ge("create_time", sevenDaysAgo); queryWrapper.le("create_time", now); - }else if (userGroup.getConsumeCycle().equals("2")){ + } else if (userGroup.getConsumeCycle().equals("2")) { // 查询15天的数据 LocalDate now = LocalDate.now(); LocalDate sevenDaysAgo = now.minus(15, ChronoUnit.DAYS); queryWrapper.ge("create_time", sevenDaysAgo); queryWrapper.le("create_time", now); - }else if (userGroup.getConsumeCycle().equals("3")){ + } else if (userGroup.getConsumeCycle().equals("3")) { // 查询15天的数据 LocalDate now = LocalDate.now(); LocalDate sevenDaysAgo = now.minus(30, ChronoUnit.DAYS); queryWrapper.ge("create_time", sevenDaysAgo); queryWrapper.le("create_time", now); - }else if (userGroup.getConsumeCycle().equals("4")){ + } else if (userGroup.getConsumeCycle().equals("4")) { // 查询15天的数据 LocalDate now = LocalDate.now(); LocalDate sevenDaysAgo = now.minus(60, ChronoUnit.DAYS); queryWrapper.ge("create_time", sevenDaysAgo); queryWrapper.le("create_time", now); - }else if (userGroup.getConsumeCycle().equals("5")){ + } else if (userGroup.getConsumeCycle().equals("5")) { // 查询15天的数据 LocalDate now = LocalDate.now(); LocalDate sevenDaysAgo = now.minus(90, ChronoUnit.DAYS); queryWrapper.ge("create_time", sevenDaysAgo); queryWrapper.le("create_time", now); - }else if (userGroup.getConsumeCycle().equals("6")){ + } else if (userGroup.getConsumeCycle().equals("6")) { // 查询15天的数据 LocalDate now = LocalDate.now(); LocalDate sevenDaysAgo = now.minus(180, ChronoUnit.DAYS); @@ -2650,11 +2662,11 @@ public class OilOrderServiceImpl extends ServiceImpl i queryWrapper.le("create_time", now); } } - if (ObjectUtil.isNotEmpty(userGroup.getConsumeAmountFront()) && ObjectUtil.isNotEmpty(userGroup.getConsumeAmountAfter())){ + if (ObjectUtil.isNotEmpty(userGroup.getConsumeAmountFront()) && ObjectUtil.isNotEmpty(userGroup.getConsumeAmountAfter())) { queryWrapper.ge("pay_amount", userGroup.getConsumeAmountFront()); queryWrapper.le("pay_amount", userGroup.getConsumeAmountAfter()); } - if (ObjectUtil.isNotEmpty(userGroup.getAverageConsumeFront()) && ObjectUtil.isNotEmpty(userGroup.getAverageConsumeAfter())){ + if (ObjectUtil.isNotEmpty(userGroup.getAverageConsumeFront()) && ObjectUtil.isNotEmpty(userGroup.getAverageConsumeAfter())) { queryWrapper.ge("pay_amount", userGroup.getAverageConsumeFront()); queryWrapper.le("pay_amount", userGroup.getAverageConsumeAfter()); } diff --git a/fuintCashierWeb/src/views/cashier/NewComponents/credit.vue b/fuintCashierWeb/src/views/cashier/NewComponents/credit.vue index f140236e5..6fc52299b 100644 --- a/fuintCashierWeb/src/views/cashier/NewComponents/credit.vue +++ b/fuintCashierWeb/src/views/cashier/NewComponents/credit.vue @@ -205,10 +205,10 @@
@@ -1062,10 +1062,7 @@ import {getLodop} from "@/api/LodopFuncs"; this.$modal.msgSuccess("删除成功"); }).catch(() => {}); }, - getCreditUnits(val){ - if (val!=undefined){ - this.queryParams2.page = val - } + getCreditUnits(){ let dateRange = [] if (this.beginTime && this.endTime) { dateRange.push(this.beginTime.toLocaleDateString()) diff --git a/gasStation-uni/pages/refuel/refuel.vue b/gasStation-uni/pages/refuel/refuel.vue index f5950c64a..b48b8bff7 100644 --- a/gasStation-uni/pages/refuel/refuel.vue +++ b/gasStation-uni/pages/refuel/refuel.vue @@ -51,32 +51,40 @@ 支付方式 - + 会员卡类型 - 储值卡(余额:{{user.cardBalance}}) + + 囤油卡(余额:{{chooseCard.fuelAmount}}) + + 车队卡(余额:{{chooseCard.totalBalance}}) + 储值卡(余额:{{user.cardBalance}}) + - - - + + - + 微信 - - + + @@ -88,7 +96,7 @@ 优惠券 - -20.00 + -{{oilOrder.discountAmount}} @@ -109,7 +117,7 @@ - ¥{{oilOrder.payAmount}} + ¥{{oilOrder.orderAmount - oilOrder.discountAmount}} 共优惠¥{{oilOrder.discountAmount || 0}} @@ -143,24 +151,26 @@ - - - - 油品消费满减券 + + + + + {{item.name}} + + ¥{{item.disAmount}} - ¥10 - - - 有效期:2024-08-05 14:15:12~2024-08-15 14:15:11 - 满200可用 - - - - - 以下支付方式可用:微信、支付宝、云闪付、pos刷卡、会以下支付方式可用:微信、支付宝、云闪付、pos刷卡、会以下支付方式可用:微信、支付宝、云闪付、pos刷卡、会以下支付方式可用:微信、支付宝、云闪付、pos刷卡、会以下支付方式可用:微信、支付宝、云闪付、pos刷卡、会以下支付方式可用:微信、支付宝、云闪付、pos刷卡、会以下支付方式可用:微信、支付宝、云闪付、pos刷卡 + + 有效期:2024-08-05 14:15:12~2024-08-15 14:15:11 + 满200可用 + + + + + 以下支付方式可用:微信、支付宝、云闪付、pos刷卡、会以下支付方式可用:微信、支付宝、云闪付、pos刷卡、会以下支付方式可用:微信、支付宝、云闪付、pos刷卡、会以下支付方式可用:微信、支付宝、云闪付、pos刷卡、会以下支付方式可用:微信、支付宝、云闪付、pos刷卡、会以下支付方式可用:微信、支付宝、云闪付、pos刷卡、会以下支付方式可用:微信、支付宝、云闪付、pos刷卡 + + 适用详情 - 适用详情 @@ -197,7 +207,7 @@ 选择会员卡类型 - + 储值卡 充值 @@ -208,7 +218,7 @@ + v-for="(item,index) in oilCardList" :key="index" @click="chooseUserCard('fule_card',item)"> 囤油卡 充值 @@ -218,8 +228,9 @@ - - + + {{item.fleetName}} 充值 @@ -272,11 +283,20 @@ - 消费应支付{{oilOrder.payAmount}}元 - 会员-储值卡(余额:{{user.cardBalance}}) + 消费应支付{{oilOrder.orderAmount - oilOrder.discountAmount + }}元 + + 会员-储值卡(余额:{{user.cardBalance}}) + + 会员-囤油卡(余额:{{chooseCard.fuelAmount}}) + + 会员-车队卡(余额:{{chooseCard.totalBalance}}) + 微信 + 支付宝 - - + + @@ -428,7 +448,9 @@ orderInfo: {}, user: {}, oilCardList: [], - fleetList: [] + fleetList: [], + chooseCard: null, + cardPayType: 'card_value' } }, components: { @@ -496,6 +518,18 @@ }, methods: { + // 选择会员卡 + chooseUserCard(payType, data) { + this.oilOrder.payType = payType + this.cardPayType = payType + if (data) { + this.chooseCard = data + } else { + this.chooseCard = null + } + this.cardType = false + console.log(this.chooseCard, 515); + }, // 获取储值卡信息 getOilCard() { request({ @@ -508,6 +542,19 @@ this.fleetList = res.data.fleetInfoUniVos }) }, + // 获取消费有礼信息 + getConsume(){ + request({ + url: "pay/paycenter/cashRegisterSpendWisely", + method: 'post', + data:{ + storeId:this.storeId, + userId:uni.getStorageSync("userId"), + } + }).then(res => { + console.log(res, 555); + }) + }, // 支付接口 payment() { this.ifLogin = this.AppToken ? true : false @@ -659,6 +706,7 @@ if (this.oilOrder.orderAmount) { this.oilOrder.payAmount = this.oilOrder.orderAmount - this.oilOrder.discountAmount this.oilOrder.oilNum = (this.oilOrder.orderAmount / this.oilPrice).toFixed(2) + this.getCouponList() } }, getCouponList() { @@ -668,13 +716,20 @@ data: { userId: uni.getStorageSync('userId'), oilId: this.oilOrder.oils, - oilAmount: this.oilOrder.amount, + oilAmount: this.oilOrder.orderAmount, oilLiter: this.oilOrder.oilNum, payWay: this.oilOrder.payType, + oilId:this.oilOrder.oils }, }).then((res) => { - - }).catch(err => {}) + console.log(res, 701); + this.couponList = res.data + }) + }, + // 选择优惠券 + chooseCoupon(data){ + this.oilOrder.discountAmount = data.disAmount + this.oilOrder.couponId = data.id }, Couponclose() { this.selectCoupon = false @@ -730,19 +785,36 @@ }) return; } + let _this = this request({ url: "business/petrolStationManagement/oilTank/" + uni.getStorageSync('tankId'), method: 'get', }).then((res) => { - if (res.data.storedQuantity - this.oilOrder.oilNum < 0) { + if (res.data.storedQuantity - _this.oilOrder.oilNum < 0) { uni.showToast({ title: "所加油的升数大于油罐内的升数,请重新选择加油升数", icon: "none" }) return; } else { - this.ConfirmPayment = true - this.addOrder() + _this.ConfirmPayment = true + if (_this.oilOrder.payType == 'card_value') { + _this.oilOrder.balanceAmount = _this.oilOrder.payAmount + _this.oilOrder.payAmount = 0 + } + if (_this.oilOrder.payType == 'fule_card') { + _this.oilOrder.oilCardAmount = _this.oilOrder.oilNum + _this.oilOrder.payAmount = 0 + } + if (_this.oilOrder.payType == 'car_card_value') { + _this.oilOrder.balanceAmount = _this.oilOrder.payAmount + _this.oilOrder.payAmount = 0 + } + if (_this.oilOrder.payType == 'car_fule_card') { + _this.oilOrder.oilCardAmount = _this.oilOrder.oilNum + _this.oilOrder.payAmount = 0 + } + _this.addOrder() } }) @@ -1483,14 +1555,22 @@ } + .anxuan1 { + + border: 1px solid #FF9655 !important; + + + } + .dian { width: 7px; height: 7px; border-radius: 50%; background: #999999; + } - - + .dian1 { + background: #FF9655 !important; } .sm-size { diff --git a/gasStation-uni/pagesHome/memberRecharge/index.vue b/gasStation-uni/pagesHome/memberRecharge/index.vue index 70e34a0ad..1ddab597a 100644 --- a/gasStation-uni/pagesHome/memberRecharge/index.vue +++ b/gasStation-uni/pagesHome/memberRecharge/index.vue @@ -90,7 +90,10 @@ - + + 立即充值{{rechargeOrder.balance}}元 + + 立即充值{{rechargeOrder.balance}}元 @@ -116,7 +119,7 @@ export default { data() { return { - type: 'balance', + type: 'oilCard', show: false, windex: 0, storeId: uni.getStorageSync("storeId"), @@ -146,6 +149,15 @@ balance: 0, types: 0 }, + rechargeCardOrder: { + payType: uni.getStorageSync("appltType"), + mtStaffId: '', + id: '', + storeId: uni.getStorageSync("storeId"), + chainStoreId: uni.getStorageSync("chainStoreId"), + cardFavorableId: '', + cardRecordId: '', + }, isEdit: true, describe: [], // 小程序类型 微信 WECHAT 支付宝 ALIPAY @@ -159,15 +171,99 @@ this.getDescribe() }, methods: { + //囤油卡充值 + addFuleCarRecords() { + let _this = this + request({ + url: 'business/marketingActivity/cardFuelRecord/addFuleCarRecords', + method: 'post', + data: _this.rechargeCardOrder, + }).then(res => { + if (res.code == 200) { + console.log(res, _this.appltType) + if (_this.appltType == "WECHAT") { + if (!res.data.reservedPayInfo) { + uni.showToast({ + title: '支付失败,请联系商家', + icon: "none" + }) + return; + } + + let payProvider = "wxpay" + _this.orderInfo = JSON.parse(res.data.reservedPayInfo); + uni.requestPayment({ + // 微信支付provider: 'wxpay' 支付宝支付 'alipay' + provider: payProvider, + timeStamp: _this.orderInfo.timeStamp, + nonceStr: _this.orderInfo.nonceStr, + package: _this.orderInfo.package, + signType: 'MD5', + paySign: _this.orderInfo.paySign, + success: function(res) { + console.log('success:', res); + uni.reLaunch({ + url: '/pagesRefuel/orderSuccess/index' + }) + }, + fail: function(err) { + request({ + url: "/business/marketingActivity/cardFuleOrders/updateOrderStatus", + method: 'post', + data: { + "orderNo": res.data.orderNo, + "status": "payFail" + }, + }).then((res) => { + uni.showToast({ + title: "支付失败!", + icon: "error" + }) + }) + console.log('fail:', err); + } + }); + } + + if (_this.appltType == "ALIPAY") { + if (!res.data.reservedTransactionId) { + uni.showToast({ + title: '支付失败,请联系商家', + icon: "none" + }) + return; + } + my.tradePay({ + tradeNO: res.data.reservedTransactionId + }, function(resp) { + if (resp.resultCode == '9000') { + console.log("支付成功") + uni.reLaunch({ + url: '/pagesRefuel/orderSuccess/index' + }) + } else { + request({ + url: "/business/marketingActivity/cardFuleOrders/updateOrderStatus", + method: 'post', + data: { + "orderNo": res.data.orderNo, + "status": "payFail" + }, + }).then((res) => { + uni.showToast({ + title: "支付失败!", + icon: "error" + }) + }) + console.log('支付失败,' + resp.resultCode); + } + }); + } + } + }) + }, // 调用充值接口 goRecharge() { - if (this.type == 'oilCard') { - uni.showToast({ - icon: 'error', - title: "暂未开发!" - }) - return; - } let _this = this request({ url: 'business/marketingActivity/cardValueRecord', @@ -212,7 +308,6 @@ title: "支付失败!", icon: "error" }) - // console.log('fail:', err); } }); } @@ -338,7 +433,6 @@ } } if (this.type == 'oilCard') { - } } }