This commit is contained in:
cun-nan 2024-10-09 15:38:12 +08:00
parent d1cd87e387
commit 484af8e842
5 changed files with 368 additions and 177 deletions

View File

@ -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;
/**
* 商户号

View File

@ -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<OilOrderMapper, OilOrder> 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<OilOrderMapper, OilOrder> i
private SysDeptMapper sysDeptMapper;
@Resource
private MtStoreMapper mtStoreMapper;
@Override
public IPage<OilOrder> selectOilOrderList(Page page, OilOrder order) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
@ -165,12 +169,14 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
IPage<OilOrder> oilOrderIPage = baseMapper.selectOilOrderList(page, order);
return oilOrderIPage;
}
@Resource
OilGunMapper oilGunMapper;
@Resource
OilNameMapper oilNameMapper;
@Resource
OilTankMapper oilTankMapper;
@Override
public IPage<OilOrder> selectOilOrderListByZtDz(Page page, OilOrder order) {
if (ObjectUtil.isEmpty(order.getDeptId())) {
@ -189,7 +195,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> 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<OilOrderMapper, OilOrder> i
}
return oilOrderIPage;
}
// 查询油品分析 列表
// 查询油品分析 列表
@Override
public IPage<OilOrderVo> selectOilOrderFenXiListByZtDz(Page page, OilOrderVo order) {
if (ObjectUtil.isEmpty(order.getDeptId())) {
@ -239,8 +246,9 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
}
return oilOrderIPage;
}
// 查询油品分析 累计
public Map<String,String> selectOilOrderFenXiDataByZtDz(OilOrderVo order){
// 查询油品分析 累计
public Map<String, String> 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<OilOrderMapper, OilOrder> 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<OilOrderMapper, OilOrder> 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<OilOrderMapper, OilOrder> 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<OilOrderMapper, OilOrder> 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<OilOrderMapper, OilOrder> 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<OilOrderMapper, OilOrder> 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<OilOrderMapper, OilOrder> 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<OilOrderMapper, OilOrder> i
receiveParameterPos.setOilCardAmount(oilOrderVo.getOilCardAmount1());
receiveParameterPos.setOilGunId(oilOrderVo.getOilGunNum());
Map<String, String> 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<OilOrderVo> selectProportion(Map<String, String> map,List<Integer> storeIds) {
public List<OilOrderVo> selectProportion(Map<String, String> map, List<Integer> storeIds) {
String startTime = map.get("startTime");
String endTime = map.get("endTime");
OilOrderVo oilOrderVo = new OilOrderVo();
Map<String , Object> map1 = new HashMap<>();
map1.put("beginTime",startTime);
map1.put("endTime",endTime);
Map<String, Object> 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<OilOrder> selectListByGroup(UserGroup userGroup,Integer userId) {
public List<OilOrder> 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<OilOrderMapper, OilOrder> 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());
}

View File

@ -205,10 +205,10 @@
</el-table>
<div class="pagination-box">
<pagination
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.pageSize"
@pagination="getList"
:total="total3"
:page.sync="queryParams2.page"
:limit.sync="queryParams2.pageSize"
@pagination="getCreditUnits()"
/>
</div>
</div>
@ -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())

View File

@ -51,32 +51,40 @@
<view class="title_">
支付方式
</view>
<view class="d-bs">
<view class="d-bs" @click="oilOrder.payType=cardPayType">
<image src="../../static/icon/hyk.png" style="width: 35px; height: 35px; "></image>
<view class="br-box">
<view style="font-size: 14px;">
<view class="">会员卡类型</view>
<view class="d-bs" style="align-items: center;border-bottom: none;"
@click="cardType = true">
<view style="font-size: 12px;">储值卡余额{{user.cardBalance}}</view>
<view style="font-size: 12px;" v-if="chooseCard && chooseCard.fuelAmount>=0">
囤油卡余额{{chooseCard.fuelAmount}}</view>
<view style="font-size: 12px;" v-if="chooseCard && chooseCard.totalBalance>=0">
车队卡余额{{chooseCard.totalBalance}}</view>
<view style="font-size: 12px;" v-if="!chooseCard">储值卡余额{{user.cardBalance}}
</view>
<view style="line-height: 20px;">
<u-icon name="arrow-right" size="12px"></u-icon>
</view>
</view>
</view>
<view class="anxuan">
<view class="dian"></view>
<view class="anxuan"
:class="{'anxuan1': oilOrder.payType!='ALIPAY' && oilOrder.payType!='WECHAT'}">
<view class="dian"
:class="{'dian1': oilOrder.payType!='ALIPAY' && oilOrder.payType!='WECHAT'}"></view>
</view>
</view>
</view>
<view class="d-bs">
<view class="d-bs" @click="oilOrder.payType=appltType">
<image src="../../static/icon/wz.png" style="width: 35px; height: 35px; "></image>
<view class="br-box">
<view class="">微信</view>
<view class="anxuan">
<view class="dian"></view>
<view class="anxuan"
:class="{'anxuan1': oilOrder.payType=='ALIPAY' || oilOrder.payType=='WECHAT'}">
<view class="dian"
:class="{'dian1': oilOrder.payType=='ALIPAY' || oilOrder.payType=='WECHAT'}"></view>
</view>
</view>
</view>
@ -88,7 +96,7 @@
<view class="d-bs" style="box-sizing: border-box; padding: 20px;" @click="selectCoupon = true">
<view class="">优惠券</view>
<view class="d-s">
<view class="">-20.00</view>
<view class="">-{{oilOrder.discountAmount}}</view>
<u-icon name="arrow-right"></u-icon>
</view>
</view>
@ -109,7 +117,7 @@
<!-- 支付信息 -->
<view class="bs-box">
<view class="">
<view class="onetitle">¥{{oilOrder.payAmount}}</view>
<view class="onetitle">¥{{oilOrder.orderAmount - oilOrder.discountAmount}}</view>
<view class="orsize">共优惠¥{{oilOrder.discountAmount || 0}}</view>
</view>
<view class="d-s">
@ -143,24 +151,26 @@
</view>
</view>
<view class="couponBox" v-if="tabIndex == 0">
<view class="cou_top">
<view class="d-s">
<view class="qaz"></view>
<view class="c_title">油品消费满减券</view>
<view v-for="(item,index) in couponList" @click="chooseCoupon(item)">
<view class="cou_top">
<view class="d-s">
<view class="qaz"></view>
<view class="c_title">{{item.name}}</view>
</view>
<view class="c-r-num">¥{{item.disAmount}}</view>
</view>
<view class="c-r-num">¥10</view>
</view>
<view class="cou_top">
<view class="sm_size">有效期2024-08-05 14:15:12~2024-08-15 14:15:11</view>
<view class="sm_r-zie">满200可用</view>
</view>
<view class="dashed_box"></view>
<view class="cou_top">
<view class="sb_size" :class="{ 'sb_xl' : RandR == true }">
以下支付方式可用微信支付宝云闪付pos刷卡会以下支付方式可用微信支付宝云闪付pos刷卡会以下支付方式可用微信支付宝云闪付pos刷卡会以下支付方式可用微信支付宝云闪付pos刷卡会以下支付方式可用微信支付宝云闪付pos刷卡会以下支付方式可用微信支付宝云闪付pos刷卡会以下支付方式可用微信支付宝云闪付pos刷卡
<view class="cou_top">
<view class="sm_size">有效期2024-08-05 14:15:12~2024-08-15 14:15:11</view>
<view class="sm_r-zie">满200可用</view>
</view>
<view class="dashed_box"></view>
<view class="cou_top">
<view class="sb_size" :class="{ 'sb_xl' : RandR == true }">
以下支付方式可用微信支付宝云闪付pos刷卡会以下支付方式可用微信支付宝云闪付pos刷卡会以下支付方式可用微信支付宝云闪付pos刷卡会以下支付方式可用微信支付宝云闪付pos刷卡会以下支付方式可用微信支付宝云闪付pos刷卡会以下支付方式可用微信支付宝云闪付pos刷卡会以下支付方式可用微信支付宝云闪付pos刷卡
</view>
<view class="sm_r-zie" style="height: 14px; " @click="RandR =! RandR">适用详情 <u-icon
name="arrow-right" color="#E02020" size="10"></u-icon> </view>
</view>
<view class="sm_r-zie" style="height: 14px; " @click="RandR =! RandR">适用详情 <u-icon
name="arrow-right" color="#E02020" size="10"></u-icon> </view>
</view>
</view>
<view class="couponBox_h" v-if="tabIndex == 1">
@ -197,7 +207,7 @@
<u-popup :show="cardType" closeable="true" mode="bottom" :round="10" @close="cardTypeclose">
<view class="popup-box">
<view class="p_title">选择会员卡类型</view>
<view class="c_pox">
<view class="c_pox" @click="chooseUserCard('card_value')">
<view class="c_bs" style="margin-bottom: 15px;">
<view class="">储值卡</view>
<view class="anniubai">充值</view>
@ -208,7 +218,7 @@
</view>
</view>
<view class="c_pox" style="background: url('../../static/imgs/tyktc.png'); "
v-for="(item,index) in oilCardList" :key="index">
v-for="(item,index) in oilCardList" :key="index" @click="chooseUserCard('fule_card',item)">
<view class="c_bs" style="margin-bottom: 15px; ">
<view class="">囤油卡</view>
<view class="anniubai" style="color: #70D0C7;">充值</view>
@ -218,8 +228,9 @@
<!-- <view class="">NO.xxxxxxxxxxxxxxxxx</view> -->
</view>
</view>
<view class="c_pox">
<view class="c_bs" style="margin-bottom: 15px;" v-for="(item,index) in fleetList" :key="index">
<view class="c_pox" v-for="(item,index) in fleetList" :key="index"
@click="chooseUserCard(item.cardType=='储值卡' ? 'car_card_value' : 'car_fule_card',item)">
<view class="c_bs" style="margin-bottom: 15px;">
<view class="">{{item.fleetName}}</view>
<view class="anniubai">充值</view>
</view>
@ -272,11 +283,20 @@
<image src="../../static/imgs/zficon.png" style="width: 36px; height: 36px; "></image>
<view class="p_ds" style="width: 85%;">
<view class="">
<view class="">消费应支付{{oilOrder.payAmount}}</view>
<view class="sm-size">会员-储值卡余额{{user.cardBalance}}</view>
<view class="">消费应支付{{oilOrder.orderAmount - oilOrder.discountAmount
}}</view>
<view class="sm-size" v-if="oilOrder.payType=='card_value'">
会员-储值卡余额{{user.cardBalance}}</view>
<view class="sm-size" v-if="oilOrder.payType=='fule_card'">
会员-囤油卡余额{{chooseCard.fuelAmount}}</view>
<view class="sm-size"
v-if="oilOrder.payType=='car_card_value' || oilOrder.payType=='car_fule_card'">
会员-车队卡余额{{chooseCard.totalBalance}}</view>
<view class="sm-size" v-if="oilOrder.payType=='WECHAT'">微信</view>
<view class="sm-size" v-if="oilOrder.payType=='ALIPAY'">支付宝</view>
</view>
<view class="anxuan">
<view class="dian"></view>
<view class="anxuan anxuan1">
<view class="dian dian1"></view>
</view>
</view>
</view>
@ -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 {

View File

@ -90,7 +90,10 @@
<view style="width: 100%; height: 88px; "></view>
<view class="bottom_">
<view class="anniu_" @click="goRecharge()">
<view class="anniu_" v-if="type=='balance'" @click="goRecharge()">
立即充值{{rechargeOrder.balance}}
</view>
<view class="anniu_" v-if="type=='oilCard'" @click="addFuleCarRecords()">
立即充值{{rechargeOrder.balance}}
</view>
</view>
@ -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') {
}
}
}