营销活动

This commit is contained in:
13405411873 2024-10-08 11:38:41 +08:00
parent aadf0ddd5f
commit 2fc94aad3d
27 changed files with 519 additions and 224 deletions

View File

@ -259,13 +259,13 @@
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="110px" class="demo-ruleForm">
<div style="display: flex; align-items: center ">
<el-form-item label="油品油号" prop="oilType">
<el-select v-model="ruleForm.oilType" placeholder="请选择" @change="getoiltype" >
<el-form-item label="油品油号" prop="oilNumberId">
<el-select v-model="ruleForm.oilNumberId" placeholder="请选择" @change="getoiltype" >
<el-option
v-for="dict in oilList"
:key="dict.id.toString()"
:key="dict.id"
:label="dict.oilName"
:value="dict.id.toString()">
:value="dict.id">
</el-option>
</el-select>
</el-form-item>
@ -466,7 +466,7 @@
tableData: [],
oilList:[],
ruleForm:{
oilType:2,
oilNumberId:null,
lockupPrice: "" ,
lockPrice: "" ,
lockMoney: "" ,
@ -492,7 +492,7 @@
pageSize:10,
},
rules:{
oilType: [
oilNumberId: [
{ required: true, message: '不能为空', trigger: 'blur' },
],
rechargeBalance: [
@ -603,7 +603,6 @@
this.oilList = []
oilName(this.queryParams.type).then(res=>{
this.oilList = res.data.records
console.log('我的油站' ,res)
})
this.getlist()
},
@ -658,10 +657,7 @@
})
},
postadd(formName){
if( this.ruleForm.oilType =='' || this.ruleForm.rechargeBalance =='' || this.ruleForm.points =='' ){
this.$message.error("必填项不能为空")
return
}
this.ruleForm.type = this.queryParams.type
this.ruleForm.status = '1'
// this.ruleForm.startTime = this.ruleForm.startTime.toLocaleDateString()

View File

@ -279,15 +279,9 @@ export default {
Cookies.remove('rememberMe');
}
app.$store.dispatch("Login", this.loginForm).then(() => {
// Cookies.set("DUTY_ROLE_CODE", res.data.dutyRoleCode);
console.log(1234567890)
// if (Cookies.get("DUTY_ROLE_CODE") && Cookies.get("DUTY_ROLE_CODE") == 2) {
// // if (sessionStorage.getItem('IS_ZT_LOGIN')&& sessionStorage.getItem('IS_ZT_LOGIN') == 2) {
// location.replace(this.cashierUrl);
// }else {
if (Cookies.get("IS_ZT_LOGIN")) {
const data = JSON.parse(Cookies.get("IS_ZT_LOGIN"))
console.log("dataJSON",data)
console.log("url",this.ztUrl+"resource_oilbank?token="+data.token)
location.replace(this.ztUrl+"resource_oilbank?token="+data.token);
}else if (Cookies.get("IS_CA_LOGIN")){
const data = JSON.parse(Cookies.get("IS_CA_LOGIN"))
@ -296,14 +290,8 @@ export default {
}else {
app.$router.push({ path: this.redirect || "/" }).catch(()=>{});
}
// }
}).catch(() => {
app.loading = false;
// if (app.captchaOnOff) {
// app.getCode();
// }
});
}
});

View File

@ -19,6 +19,7 @@ import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRe
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelRecord;
import com.fuint.business.marketingActivity.cardFule.service.CardFuelRecordService;
import com.fuint.business.marketingActivity.cardFuleOrders.service.CardFuleOrdersService;
import com.fuint.business.marketingActivity.cardValue.entity.CardValueRecord;
import com.fuint.business.marketingActivity.cardValue.service.CardValueRecordService;
import com.fuint.business.marketingActivity.cardValueOrders.service.CardValueOrdersService;
@ -65,6 +66,8 @@ public class FyPayServiceImpl implements FyPayService {
@Resource
private CardValueOrdersService cardValueOrdersService;
@Resource
private CardFuleOrdersService fuleOrdersService;
/**
* 条码支付
@ -305,19 +308,17 @@ public class FyPayServiceImpl implements FyPayService {
}
}
if ("CVR".equals(type)) {
//储值卡订单
payStates = "paid";
receiveParameter.setType("2");
if (ObjectUtil.isNotEmpty(goodsOrder) && ObjectUtil.isNotEmpty(goodsOrder.getUserId())) {
receiveParameter.setUserId(goodsOrder.getUserId());
}
// if (!ObjectUtil.isEmpty(map1.get("orderId"))) {
//
// }
}
if ("CFR".equals(type)) {
//囤油卡订单
payStates = "paid";
cardValueOrdersService.updateBalance(orderNo,payStatus);
}
if ("IOS".equals(type)) { // 积分商城
payStates = "paid";
@ -360,13 +361,11 @@ public class FyPayServiceImpl implements FyPayService {
}
if ("CVR".equals(type)) {
payStates = "payFail";
if (!ObjectUtil.isEmpty(map1.get("orderId"))) {
}
cardValueOrdersService.updateOrderStatus(orderNo,payStatus);
}
if ("CFR".equals(type)) {
payStates = "payFail";
cardValueOrdersService.updateBalance(orderNo,payStatus);
}
if ("IOS".equals(type)) {
payStates = "payFail";
@ -411,12 +410,10 @@ public class FyPayServiceImpl implements FyPayService {
cashierOrderService.updateCashierOrder(cashierOrder);
}
if ("CVR".equals(type) && !ObjectUtil.isEmpty(map1.get("orderId"))) {
// 储值卡
//储值卡
Integer id = Integer.parseInt(map1.get("orderId"));
cardValueRecordService.editPayStatus(id, payStates);
cardValueOrdersService.updateBalance(orderNo,payStatus);
CardValueRecord byId = cardValueRecordService.getById(id);
receiveParameter.setType("3");
if (byId.getMtUserId() != null) {
@ -425,10 +422,9 @@ public class FyPayServiceImpl implements FyPayService {
receiveParameter.setContent("储值卡订单");
}
if ("CFR".equals(type) && !ObjectUtil.isEmpty(map1.get("orderId"))) {
// 囤油卡
//囤油卡
Integer id = Integer.parseInt(map1.get("orderId"));
cardFuelRecordService.editPayStatus(id, payStates);
cardValueOrdersService.updateBalance(orderNo,payStatus);
CardFuelRecord cardFuelRecord = cardFuelRecordService.queryById(id);
receiveParameter.setType("5");
if (cardFuelRecord.getMtUserId() != null) {
@ -437,10 +433,9 @@ public class FyPayServiceImpl implements FyPayService {
receiveParameter.setContent("囤油卡订单");
}
if ("IOS".equals(type)) {
// 积分商城
//积分商城
String storeId = ObjectUtil.isEmpty(map1.get("storeId")) ? "-1" : map1.get("storeId");
integralOrdersService.editPayStatus(orderNo, payStates, Integer.parseInt(storeId));
IntegralOrders integralOrders = integralOrdersService.queryIntegralOrdersByOrderNo(orderNo, Integer.parseInt(storeId));
receiveParameter.setType("4");
if (integralOrders.getUserId() != null) {
@ -448,7 +443,6 @@ public class FyPayServiceImpl implements FyPayService {
}
receiveParameter.setContent("积分订单");
}
if (!reqMap.get("trans_stat").equals("USERPAYING")) {
String payChannel = "cashier";
if (ObjectUtil.isNotEmpty(map1.get("payChannel"))) payChannel = map1.get("payChannel");
@ -456,7 +450,7 @@ public class FyPayServiceImpl implements FyPayService {
}
if (ObjectUtil.isNotEmpty(merchantConfig)) {
// 添加配置记录信息
//添加配置记录信息
MerchantConfigRecord merchantConfigRecord = new MerchantConfigRecord();
merchantConfigRecord.setMerchantId(merchantConfig.getId());
if (payStatus.equals("paid")) {

View File

@ -1,5 +1,6 @@
package com.fuint.business.cashierGoods.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fuint.framework.entity.BaseEntity;
import lombok.Data;

View File

@ -60,6 +60,19 @@ public class CardCouponController extends BaseController {
cardCoupon.setStoreId(nowAccountInfo.getStoreId());
return getSuccessResult(this.cardCouponService.pageVo(page, cardCoupon));
}
/**
* 不分页查询在使用中的优惠卷
*
* @param cardCoupon 查询实体
* @return 所有数据
*/
@GetMapping("/getCanUseCoupon")
public ResponseObject getCanUseCoupon(CardCoupon cardCoupon) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
cardCoupon.setStoreId(nowAccountInfo.getStoreId());
return getSuccessResult(this.cardCouponService.getCanUseCoupon(cardCoupon));
}
/**

View File

@ -29,5 +29,6 @@ public interface CardCouponMapper extends BaseMapper<CardCoupon> {
* @return
*/
List<CardCouponUniVo> selectByStoreIdCount(CardCouponUniVo cardCouponUniVos);
List<CardCoupon> getCanUseCoupon(@Param("cardCoupon") CardCoupon cardCoupon);
}

View File

@ -107,5 +107,18 @@
</foreach>
</where>
</select>
<select id="getCanUseCoupon" resultType="com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon"
parameterType="com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon">
SELECT
cc.*
FROM
card_coupon cc
<where>
and cc.store_id = #{cardCoupon.storeId}
and cc.status = '1'
and cc.sy_send = '1'
</where>
order by cc.create_time desc
</select>
</mapper>

View File

@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon;
import com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponUniVo;
import java.util.List;
/**
* 油站优惠卷表2024(CardCoupon)表服务接口
*
@ -14,6 +16,8 @@ import com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponUniVo;
*/
public interface CardCouponService extends IService<CardCoupon> {
IPage<CardCoupon> pageVo(Page page, CardCoupon cardCoupon);
List<CardCoupon> getCanUseCoupon(CardCoupon cardCoupon);
/**
* 上下架

View File

@ -53,6 +53,11 @@ public class CardCouponServiceImpl extends ServiceImpl<CardCouponMapper, CardCou
return baseMapper.pageVo( page, cardCoupon);
}
@Override
public List<CardCoupon> getCanUseCoupon(CardCoupon cardCoupon) {
return baseMapper.getCanUseCoupon(cardCoupon);
}
@Override
public int isOnLine(Integer id) {
CardCoupon cardCoupon = baseMapper.selectById(id);

View File

@ -67,7 +67,11 @@ public class CardFuelDieselController extends BaseController {
Page page = new Page(pageNo, pageSize);
return getSuccessResult(this.cardFuelDieselService.select(page, cardFuelDiesel));
}
@GetMapping("fuelCardList")
public ResponseObject fuelCardList(CardFuelDiesel cardFuelDiesel) {
return getSuccessResult(this.cardFuelDieselService.fuelCardList(cardFuelDiesel));
}
/**
* 分页查询所有数据(小程序端)
* @param pageNo
@ -145,7 +149,7 @@ public class CardFuelDieselController extends BaseController {
//油品名称
String type = cardFuelDiesel.getType();
String oilType = cardFuelDiesel.getOilType();
OilName oilName1 = oilNameService.selectOilNameById(Integer.parseInt(oilType));
OilName oilName1 = oilNameService.selectOilNameById(cardFuelDiesel.getOilNumberId());
String oilName = oilName1.getOilName();
activeApplet.setOilName(type+"-"+oilName);
//时间
@ -213,8 +217,7 @@ public class CardFuelDieselController extends BaseController {
//油品名称
String type = cardFuelDiesel.getType();
String oilType = cardFuelDiesel.getOilType();
OilName oilName1 = oilNameService.selectOilNameById(Integer.parseInt(oilType));
OilName oilName1 = oilNameService.selectOilNameById(cardFuelDiesel.getOilNumberId());
String oilName = oilName1.getOilName();
activeApplet.setOilName(type+"-"+oilName);
//时间

View File

@ -30,7 +30,8 @@ public class CardFuelDiesel extends Model<CardFuelDiesel> {
private String status;
//油卡类型 0汽油卡 1柴油卡 2天然气
private String type;
//油品类型00# 1-10# 2京0#
//油号id
private Integer oilNumberId;
private String oilType;
//锁价单价
private Double lockupPrice;

View File

@ -149,6 +149,7 @@ public class CardFuelRecord extends BaseEntity {
private String actualPayment;
private String makeChange;
private String payChannel;

View File

@ -14,5 +14,6 @@ import java.util.List;
public interface CardFuelDieselMapper extends BaseMapper<CardFuelDiesel> {
List<CardFuelDiesel> countOilType(Integer storeId);
List<CardFuelDiesel> fuelCardList(CardFuelDiesel cardFuelDiesel);
}

View File

@ -12,5 +12,8 @@
where cf.store_id = #{storeId}
group by cf.oil_type
</select>
<select id="fuelCardList" resultType="com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel">
</select>
</mapper>

View File

@ -25,7 +25,7 @@ public interface CardFuelDieselService extends IService<CardFuelDiesel> {
* @return
*/
IPage select(Page page, CardFuelDiesel cardFuelDiesel);
List<CardFuelDiesel> fuelCardList (CardFuelDiesel cardFuelDiesel);
IPage selectAllApplet(Page page, CardFuelDiesel cardFuelDiesel);
List<CardFuelDieselVO> selectAllAppletByStorId(CardFuelDiesel cardFuelDiesel);
}

View File

@ -1,5 +1,6 @@
package com.fuint.business.marketingActivity.cardFule.service.impl;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -8,6 +9,7 @@ import com.fuint.business.marketingActivity.cardFule.mapper.CardFuelDieselMapper
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
import com.fuint.business.marketingActivity.cardFule.service.CardFuelDieselService;
import com.fuint.business.marketingActivity.cardFule.vo.CardFuelDieselVO;
import com.fuint.business.marketingActivity.cardValue.entity.CardValue;
import com.fuint.business.petrolStationManagement.entity.OilName;
import com.fuint.business.petrolStationManagement.entity.OilNumber;
import com.fuint.business.petrolStationManagement.service.OilNameService;
@ -79,11 +81,11 @@ public class CardFuelDieselServiceImpl extends ServiceImpl<CardFuelDieselMapper,
List<CardFuelDiesel> records = page2.getRecords();
//返回囤油卡状态
for (CardFuelDiesel record : records) {
OilNumber oilPrice = oilNumberService.getOilPrice(Integer.parseInt(record.getOilType()));
OilNumber oilPrice = oilNumberService.getOilPrice(record.getOilNumberId());
record.setGbPrice(oilPrice.getGbPrice());
record.setOilPrice(oilPrice.getOilPrice());
if (ObjectUtils.isNotEmpty(record.getOilType())){
record.setType(record.getType()+" "+oilNameService.selectOilNameById(Integer.parseInt(record.getOilType())).getOilName());
if (ObjectUtils.isNotEmpty(record.getOilNumberId())){
record.setType(record.getType()+" "+oilNameService.selectOilNameById(record.getOilNumberId()).getOilName());
}
record.setStatus(record.getStatus().equals("1") ? "true" : "false");
if(ObjectUtils.isNotEmpty(record.getActiveTime()) && "1".equals(record.getActiveTime())){
@ -102,6 +104,24 @@ public class CardFuelDieselServiceImpl extends ServiceImpl<CardFuelDieselMapper,
return page1;
}
@Override
public List<CardFuelDiesel> fuelCardList(CardFuelDiesel cardFuelDiesel) {
//获取当前登录用户
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
String nowTime = DateUtil.format(new Date(), "yyyy-MM-dd")+" 00:00:00";
LambdaQueryWrapper<CardFuelDiesel> queryWrapper =new LambdaQueryWrapper<>();
queryWrapper.eq(CardFuelDiesel::getStoreId,nowAccountInfo.getStoreId()).eq(CardFuelDiesel::getActiveStatus,"1").and(it->{
return it.eq(CardFuelDiesel::getActiveTime,"1").or(item->{
return item .eq(CardFuelDiesel::getActiveTime,"2")
.le(CardFuelDiesel::getStartTime,nowTime).ge(CardFuelDiesel::getEndTime,nowTime);
});
}).orderByAsc(CardFuelDiesel::getRechargeBalance);
if(ObjectUtils.isNotEmpty(cardFuelDiesel.getOilNumberId())){
queryWrapper.eq(CardFuelDiesel::getOilNumberId,cardFuelDiesel.getOilNumberId());
}
return this.list(queryWrapper);
}
/**
* 分页查询所有数据(小程序端)
@ -128,10 +148,10 @@ public class CardFuelDieselServiceImpl extends ServiceImpl<CardFuelDieselMapper,
List<CardFuelDiesel> records = page1.getRecords();
ArrayList<CardFuelDiesel> cardFuelDiesels = new ArrayList<>();
for (CardFuelDiesel record : records) {
OilNumber oilPrice = oilNumberService.getOilPrice(Integer.parseInt(record.getOilType()));
OilNumber oilPrice = oilNumberService.getOilPrice(record.getOilNumberId());
record.setGbPrice(oilPrice.getGbPrice());
record.setOilPrice(oilPrice.getOilPrice());
OilName oilName = oilNameService.selectOilNameById(Integer.parseInt(record.getOilType()));
OilName oilName = oilNameService.selectOilNameById(record.getOilNumberId());
record.setOilType(oilName.getOilName());
Date startTime = record.getStartTime();
Date endTime = record.getEndTime();

View File

@ -57,6 +57,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import com.fuint.common.util.TokenUtil;
@ -638,6 +639,7 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
private CardBalanceChangeService cardBalanceChangeService;
@Resource
@Lazy
private CardValueRecordService cardValueRecordService;
/**
* 屯油卡充值后续处理

View File

@ -5,6 +5,7 @@ package com.fuint.business.marketingActivity.cardValue.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardValue.dto.CardValueRecordDTO;
import com.fuint.business.marketingActivity.cardValue.dto.SelectCard;
import com.fuint.business.marketingActivity.cardValue.entity.CardValueRecord;
import com.fuint.business.marketingActivity.cardValue.service.CardValueRecordService;
import com.fuint.business.order.entity.LJOrder;
@ -135,6 +136,11 @@ public class CardValueRecordController extends BaseController {
return getSuccessResult(this.cardValueRecordService.prepaidCardTopUp(cardValueRecordDTO));
}
@PostMapping("rechargeCard")
public ResponseObject rechargeCard(@RequestBody SelectCard selectCard) {
return getSuccessResult(this.cardValueRecordService.rechargeCard(selectCard));
}
/**
* 查询支付状态 修改相关关联表
* @param id

View File

@ -0,0 +1,47 @@
package com.fuint.business.marketingActivity.cardValue.dto;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;
import java.util.List;
@Data
public class SelectCard {
//卡的主键
private Integer selectCardId;
//充值的会员主键
private Integer mtUserId;
// 0储值卡 1囤油卡 2礼品卡
private String cardType;
//充值本金
private BigDecimal rechargeBalance;
//赠送金额
private BigDecimal giftBalance;
//赠送积分
private Integer points;
//赠送成长值
private Integer growthValue;
//提成员工 主键
private Integer chooseStaff;
//充值备注
private String desc;
//支付方式
private String paymentType;
//礼品卡卡号
private String giftCardNo;
//礼品卡卡密
private String giftCardPwd;
//用户出示的支付授权码
private String authCode;
//找零金额
private BigDecimal seekZero;
//储值卡赠送的优惠卷
List<CardCoupon> cardCouponList;
//支付通道 支付渠道小程序applet/收银台cashier/POS端POS
private String payChannel;
private String orderNo;
}

View File

@ -51,6 +51,7 @@ public class CardValueRecord extends Model<CardValueRecord> {
private Double rechargeBalance;
//储值卡赠送金额
private Double giftBalance;
private String remark;
// private Double lockupPrice;
//积分
private Integer points;
@ -90,6 +91,8 @@ public class CardValueRecord extends Model<CardValueRecord> {
private String actualPayment;
private String makeChange;
//赠送优惠卷的主键
private String couponIds;
/** 请求参数 */

View File

@ -1,11 +1,13 @@
package com.fuint.business.marketingActivity.cardValue.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.api.fuyou.entity.ReturnParameter;
import com.fuint.business.integral.entity.IntegralDetail;
import com.fuint.business.marketingActivity.cardValue.dto.CardValueRecordDTO;
import com.fuint.business.marketingActivity.cardValue.dto.SelectCard;
import com.fuint.business.marketingActivity.cardValue.entity.CardValueRecord;
import com.fuint.business.member.entity.LJStaff;
import com.fuint.business.order.entity.CashierOrder;
@ -48,7 +50,7 @@ public interface CardValueRecordService extends IService<CardValueRecord> {
* @return
*/
CardValueRecordDTO prepaidCardTopUp(CardValueRecordDTO cardValueRecordDTO);
JSONObject rechargeCard(SelectCard selectCard);
CardValueRecord checkTheStatusOfYourPayment(Integer id) throws Exception;

View File

@ -1,5 +1,7 @@
package com.fuint.business.marketingActivity.cardValue.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSONObject;
@ -20,6 +22,7 @@ import com.fuint.business.commission.service.CommissionRecordService;
import com.fuint.business.commission.service.StaffCommissionService;
import com.fuint.business.integral.entity.IntegralDetail;
import com.fuint.business.integral.service.IntegralDetailService;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon;
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchange;
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchangeRecord;
import com.fuint.business.marketingActivity.cardExchange.service.CardExchangeRecordService;
@ -29,7 +32,12 @@ import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRe
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService;
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService;
import com.fuint.business.marketingActivity.cardFavorable.vo.CardFavorableVO;
import com.fuint.business.marketingActivity.cardFule.dto.CardFuelRecordDTO;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
import com.fuint.business.marketingActivity.cardFule.service.CardFuelDieselService;
import com.fuint.business.marketingActivity.cardFule.service.CardFuelRecordService;
import com.fuint.business.marketingActivity.cardValue.dto.CardValueRecordDTO;
import com.fuint.business.marketingActivity.cardValue.dto.SelectCard;
import com.fuint.business.marketingActivity.cardValue.entity.CardValueChild;
import com.fuint.business.marketingActivity.cardValue.mapper.CardValueChildMapper;
import com.fuint.business.marketingActivity.cardValue.mapper.CardValueRecordMapper;
@ -78,11 +86,13 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* 储值充值表(CardValueRecord)表服务实现类
@ -109,14 +119,10 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
@Resource
private IntegralDetailService integralDetailService;
@Resource
private CommissionRecordService commissionRecordService;
@Resource
StaffCommissionService staffCommissionService;
@Resource
CardValueRecordMapper cardValueRecordMapper;
@Resource
RocketUtil rocketUtil;
@Resource
private MtStaffMapper mtStaffMapper;
@Resource
private CardValueOrdersService cardValueOrdersService;
@ -136,6 +142,11 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
private MtUserGradeChildService userGradeChildService;
@Resource
private GrowthValueChangeService growthValueChangeService;
@Resource
private CardFuelDieselService fuelDieselService;
@Resource
@Lazy
private CardFuelRecordService fuelRecordService;
/**
* 储值卡充值新增
@ -358,9 +369,7 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
@Override
@Transactional
public CardValueRecordDTO prepaidCardTopUp(CardValueRecordDTO cardValueRecordDTO) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
// 添加储存充值
if ("CASH".equals(cardValueRecordDTO.getPaymentType())) {
cardValueRecordDTO.setPayStatus("paid");
@ -418,8 +427,6 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
if (flag) {
Integer allAmount = (int) (theAmountToBePaid*100);
System.out.println("allAmount1:"+allAmount);
// Integer allAmount = (int) (0.01*100);
MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(nowAccountInfo.getStoreId(),"1",null);
// 处理支付需要的数据
Map<String,String> map = new HashMap<>();
@ -436,7 +443,6 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
map.put("orderId",cardValueRecordDTO.getId().toString());
map.put("storeId",nowAccountInfo.getStoreId().toString());
map.put("payChannel",cardValueRecordDTO.getPayChannel());
// 调用支付接口
try {
fyPayService.pay(map);
@ -444,8 +450,6 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
e.printStackTrace();
}
}
// Map<String, Object> msg = new HashMap<>();
// msg.put("tag","cardTag");
// msg.put("orderId",cardValueRecordDTO.getId().toString());
@ -460,6 +464,159 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
return cardValueRecordDTO;
}
/**
* z
* @param selectCard
* @return
*/
@Override
public JSONObject rechargeCard(SelectCard selectCard) {
JSONObject res = new JSONObject();
Integer orderId=null;
//支付状态 初始为未支付
String payStatus="unpaid";
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
// 添加储存充值
if ("CASH".equals(selectCard.getPaymentType())) {
payStatus = "paid";
}
// 根据日期生成支付编号
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String timestamp = dateFormat.format(new Date());
String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6);
String orderNo = "2345"+timestamp+randomString;
//获取充值的会员
LJUserVo ljUserVo = ljUserMapper.selectUserById(selectCard.getMtUserId());
if (selectCard.getCardType().equals("0")){
//储值卡充值
CardValueRecordDTO cardValueRecordDTO =new CardValueRecordDTO();
cardValueRecordDTO.setCardValueId(selectCard.getSelectCardId());
cardValueRecordDTO.setRechargeType("0");
cardValueRecordDTO.setPayStatus(payStatus);
cardValueRecordDTO.setMtUserId(ljUserVo.getId());
cardValueRecordDTO.setName(ljUserVo.getName());
cardValueRecordDTO.setMobile(ljUserVo.getMobile());
cardValueRecordDTO.setPaymentNo(orderNo);
cardValueRecordDTO.setStoreId(nowAccountInfo.getStoreId());
cardValueRecordDTO.setChainStoreId(nowAccountInfo.getChainStoreId());
cardValueRecordDTO.setRemark(selectCard.getDesc());
cardValueRecordDTO.setPayChannel(selectCard.getPayChannel());
//储值卡面额
cardValueRecordDTO.setBidBalance(selectCard.getRechargeBalance().doubleValue());
//充值金额
cardValueRecordDTO.setRechargeBalance(selectCard.getRechargeBalance().doubleValue());
//赠送金额
cardValueRecordDTO.setGiftBalance(Optional.of(selectCard.getGiftBalance().doubleValue()).orElse(0d));
//赠送积分
cardValueRecordDTO.setPoints(Optional.ofNullable(selectCard.getPoints()).orElse(0));
//赠送优惠卷
if (CollectionUtil.isNotEmpty(selectCard.getCardCouponList())){
cardValueRecordDTO.setCouponIds(
ArrayUtil.join(selectCard.getCardCouponList().stream().map(CardCoupon::getId).collect(Collectors.toList()),",")
);
}
//赠送成长值
cardValueRecordDTO.setGrowthValue(Optional.ofNullable(selectCard.getGrowthValue()).orElse(0));
if (ObjectUtils.isEmpty(cardValueRecordDTO.getMtStaffId()) || cardValueRecordDTO.getMtStaffId() == 0) {
cardValueRecordDTO.setMtStaffId(nowAccountInfo.getStaffId());
}else {
LJStaff staff = mtStaffService.getById(selectCard.getChooseStaff());
cardValueRecordDTO.setRealName(staff.getRealName());
cardValueRecordDTO.setMtStaffId(selectCard.getChooseStaff());
cardValueRecordDTO.setStaffMobile(staff.getMobile());
}
baseMapper.insert(cardValueRecordDTO);
orderId = cardValueRecordDTO.getId();
// 当为现金支付时插入到总的订单表
if ("CASH".equals(cardValueRecordDTO.getPaymentType())) {
cardValueRecordDTO.setRealyPayBills(cardValueRecordDTO.getRechargeBalance());
AllOrderInfo allOrderInfo = getAllOrderInfo(cardValueRecordDTO);
allOrderInfo.setPaymentChannel("现金支付");
allOrderInfoService.insertAllOrderInfo(allOrderInfo);
}
res = JSONObject.parseObject(JSONObject.toJSONString(cardValueRecordDTO));
} else if (selectCard.getCardType().equals("1")) {
CardFuelDiesel fuelDiesel = fuelDieselService.getById(selectCard.getSelectCardId());
//囤油卡
CardFuelRecordDTO cardFuelRecordDTO =new CardFuelRecordDTO();
cardFuelRecordDTO.setCardFuelId(selectCard.getSelectCardId());
cardFuelRecordDTO.setMtStaffId(ljUserVo.getId());
cardFuelRecordDTO.setPayStatus(payStatus);
cardFuelRecordDTO.setMtUserId(ljUserVo.getId());
cardFuelRecordDTO.setName(ljUserVo.getName());
cardFuelRecordDTO.setMobile(ljUserVo.getMobile());
cardFuelRecordDTO.setPaymentNo(orderNo);
cardFuelRecordDTO.setStoreId(nowAccountInfo.getStoreId());
cardFuelRecordDTO.setChainStoreId(nowAccountInfo.getChainStoreId());
cardFuelRecordDTO.setRemark(selectCard.getDesc());
cardFuelRecordDTO.setPayChannel(selectCard.getPayChannel());
cardFuelRecordDTO.setOilType(fuelDiesel.getOilType());
cardFuelRecordDTO.setOilNumberId(fuelDiesel.getOilNumberId());
//锁定单价
cardFuelRecordDTO.setLockupPrice(BigDecimal.valueOf(fuelDiesel.getRechargeBalance()/fuelDiesel.getIncomeLitres()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
//所得升数
cardFuelRecordDTO.setIncomeLitres(fuelDiesel.getIncomeLitres());
//充值金额
cardFuelRecordDTO.setRechargeBalance(selectCard.getRechargeBalance().doubleValue());
//赠送积分
cardFuelRecordDTO.setPoints(Optional.ofNullable(selectCard.getPoints()).orElse(0));
//赠送成长值
cardFuelRecordDTO.setGrowthValue(Optional.ofNullable(selectCard.getGrowthValue()).orElse(0));
if (ObjectUtils.isEmpty(cardFuelRecordDTO.getMtStaffId()) || cardFuelRecordDTO.getMtStaffId() == 0) {
cardFuelRecordDTO.setMtStaffId(nowAccountInfo.getStaffId());
}else {
LJStaff staff = mtStaffService.getById(selectCard.getChooseStaff());
cardFuelRecordDTO.setRealName(staff.getRealName());
cardFuelRecordDTO.setMtStaffId(selectCard.getChooseStaff());
cardFuelRecordDTO.setStaffMobile(staff.getMobile());
}
fuelRecordService.insert(cardFuelRecordDTO);
res = JSONObject.parseObject(JSONObject.toJSONString(cardFuelRecordDTO));
}
double epsilon = 1e-10; // 阈值
double theAmountToBePaid = 0.0;
boolean flag = false;
// 先判断是否为自定义金额
if (!ObjectUtil.isEmpty(selectCard.getRechargeBalance())
&& selectCard.getRechargeBalance().doubleValue() > epsilon
&& "unpaid".equals(payStatus)){
theAmountToBePaid = selectCard.getRechargeBalance().doubleValue();
flag = true;
}
if (flag) {
int allAmount = (int) (theAmountToBePaid*100);
MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(nowAccountInfo.getStoreId(),"1",null);
// 处理支付需要的数据
Map<String,String> map = new HashMap<>();
map.put("authCode",selectCard.getAuthCode());
map.put("allAmount", Integer.toString(allAmount));
map.put("orderNo",orderNo);
map.put("payType",selectCard.getPaymentType());
map.put("insCd",merchantConfig.getInsCd());
map.put("mchntCd",merchantConfig.getMchntCd());
map.put("goodsDes",merchantConfig.getMerchantName());
map.put("publicKey",merchantConfig.getPublicKey());
map.put("privateKey",merchantConfig.getPrivateKey());
map.put("type","CVR");
map.put("orderId",orderId.toString());
map.put("storeId",nowAccountInfo.getStoreId().toString());
map.put("payChannel",selectCard.getPayChannel());
// 调用支付接口
try {
fyPayService.pay(map);
} catch (Exception e){
e.printStackTrace();
}
}
return res;
}
private static AllOrderInfo getAllOrderInfo(CardValueRecordDTO cardValueRecordDTO) {
AllOrderInfo allOrderInfo = new AllOrderInfo();
allOrderInfo.setOrderNo(cardValueRecordDTO.getPaymentNo());
@ -468,6 +625,7 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
allOrderInfo.setGoodsMoney(cardValueRecordDTO.getGiftBalance());
allOrderInfo.setPayMoney(cardValueRecordDTO.getRealyPayBills());
allOrderInfo.setPayType("CASH");
allOrderInfo.setPayChannel(cardValueRecordDTO.getPayChannel());
allOrderInfo.setUserId(cardValueRecordDTO.getMtUserId());
if (ObjectUtil.isNotEmpty(cardValueRecordDTO.getPayChannel())) {
allOrderInfo.setPayChannel(cardValueRecordDTO.getPayChannel());
@ -484,6 +642,8 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
return allOrderInfo;
}
@Autowired
private RedisLock redisLock;
@Resource
@ -729,7 +889,7 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
cardValueRecord.setId(id);
cardValueRecord.setPayStatus(payStatus);
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;
}

View File

@ -23,6 +23,7 @@ import com.fuint.business.marketingActivity.cardExchange.entity.CardExchange;
import com.fuint.business.marketingActivity.cardExchange.mapper.CardExchangeMapper;
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable;
import com.fuint.business.marketingActivity.cardFavorable.mapper.CardFavorableMapper;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
import com.fuint.business.marketingActivity.cardValue.dto.CardValueDTO;
import com.fuint.business.marketingActivity.cardValue.entity.CardValueChild;
import com.fuint.business.marketingActivity.cardValue.mapper.CardValueMapper;
@ -546,11 +547,13 @@ public class CardValueServiceImpl extends ServiceImpl<CardValueMapper, CardValue
public List<CardValue> cardValueList(CardValue cardValue) {
//获取当前登录用户
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
String nowTime = DateUtil.format(new Date(), "yyyy-MM-dd")+"00:00:00";
String nowTime = DateUtil.format(new Date(), "yyyy-MM-dd")+" 00:00:00";
LambdaQueryWrapper<CardValue> queryWrapper =new LambdaQueryWrapper<>();
queryWrapper.eq(CardValue::getStoreId,nowAccountInfo.getStoreId()).eq(CardValue::getIsonline,"0").eq(CardValue::getActiveStatus,"1").and(it->{
return it.eq(CardValue::getActiveTime,"1").or().eq(CardValue::getActiveTime,"2")
.ge(CardValue::getStartTime,nowTime).le(CardValue::getEndTime,nowTime);
queryWrapper.eq(CardValue::getStoreId,nowAccountInfo.getStoreId()).eq(CardValue::getActiveStatus,"1").and(it->{
return it.eq(CardValue::getActiveTime,"1").or(item->{
return item .eq(CardValue::getActiveTime,"2")
.le(CardValue::getStartTime,nowTime).ge(CardValue::getEndTime,nowTime);
});
}).orderByAsc(CardValue::getRechargeBalance);
return this.list(queryWrapper);
}

View File

@ -35,6 +35,15 @@ export function getPrepaidCardTopUpApi(query) {
data: query
})
}
// 储值卡购买
export function rechargeCard(data) {
return request({
url: 'business/marketingActivity/cardValueRecord/rechargeCard',
method: 'post',
data: data
})
}
// 余额插入订单
export function getCheckTheStatusOfYourPaymentApi(query) {

View File

@ -7,7 +7,21 @@ export function cashRegisterList() {
method: 'get',
})
}
export function fuelCardList(query) {
return request({
url: 'business/marketingActivity/cardFuelDiesel/fuelCardList',
method: 'get',
params: query
})
}
export function getCanUseCoupon(query) {
return request({
url: '/cardCoupon/getCanUseCoupon',
method: 'get',
params: query
})
}
//根据当前店铺id获取商品列表
export function cashRegisterGoodsList() {
return request({
@ -22,6 +36,14 @@ export function cardValueList() {
method: 'get',
})
}
// 查询油号
export function oilName(oilType) {
return request({
url: '/business/petrolStationManagement/oilNumber/getList2?oilType='+oilType,
method: 'get',
})
}
export function getCoupons(param) {
return request({
url: '/business/marketingActivity/cardValue/getCoupons',

View File

@ -538,7 +538,7 @@ import pickUp from './newHomeComponents/pickUpTheOrder.vue'
import accountPending from './newHomeComponents/accountPending.vue'
import memberRecharge from './newHomeComponents/memberRecharge.vue'
import refuelingAmount from './newHomeComponents/refuelingAmount.vue'
import { cashRegisterList, cashRegisterGoodsList,getActivityList,getCouponList } from '@/api/newHome/newHome.js'
import { cashRegisterList, cashRegisterGoodsList,getActivityList,getCouponList,getCanUseCoupon } from '@/api/newHome/newHome.js'
import {QRCodeByStoreId} from "@/api/staff/qrcode";
import {userListByPhone} from "@/api/cashier/user";
@ -546,9 +546,7 @@ import { VueClipboard } from 'vue-clipboard2';
import {getDicts} from "@/api/dict/data";
import {
getCheckTheStatusOfYourPaymentApi,
getCheckTheStatusOfYourPaymentByFuelApi,
getPrepaidCardTopUpApi,
getPrepaidFuelTopUpApi
rechargeCard
} from "@/api/cashier/cardSet";
import {getReturnCode} from "@/api/print";
@ -557,7 +555,7 @@ export default {
return {
payForm:{
realyPayBills:0.00,
paymentType:null,
paymentType:'ALIPAY',
authCode:null,
seekZero:0.00
},
@ -678,10 +676,29 @@ export default {
//
vipUserList:[],
chooseVipUser:{},
cardValueForm:{},
cardValueForm:{
cardValueId: '', // id
mtStaffId: '', //
realName: '',
staffMobile: '',
amount: '', //
bidBalance: '', //
rechargeBalance: '', //
giftBalance: '',//
points: '', //
growthValue: '', //
remark: '',
paymentType: 'WECHAT', //
royaltyType: '',//
percentageCommissions: null,
amountCommission: null,
rechargeType: '0'
},
selectCard:{},
flag:1,
jishuqi:0,
continuePolling: true, //
sendCouponList:[]
}
},
watch: {
@ -848,13 +865,43 @@ export default {
this.getDisTotal()
console.log("选中的优惠券",this.chooseCoupon)
},
//
handClose1() {
this.isPay = true,
this.isPaySuccess = false,
this.isQuery = true
this.openConfirm = false
this.payForm.authCode = null
this.payForm.seekZero = 0
this.iniz()
},
iniz() {
this.cardValueForm = {
cardValueId: '', // id
mtStaffId: '', //
realName: '',
staffMobile: '',
amount: '', //
bidBalance: '', //
rechargeBalance: '', //
giftBalance: '',//
points: '', //
growthValue: '', //
remark: '',
paymentType: 'WECHAT', //
royaltyType: '',//
percentageCommissions: null,
amountCommission: null,
rechargeType: '0'
}
},
async collection1() {
let actualPayment = 0
let makeChange = 0
let userForm = this.chooseVipUser
if (this.flag === 1) {
if (!this.payForm.authCode && this.payForm.paymentType !== "CASH") {
this.$message.error('请先扫码');
return
@ -867,22 +914,15 @@ export default {
this.$modal.msgError("请输入正确的金额");
return;
}
actualPayment = this.payForm.authCode
makeChange = this.seekZero
}
// id
this.cardValueForm.mtUserId = userForm.id
this.cardValueForm.name = userForm.name
this.cardValueForm.mobile = userForm.mobile
//
this.cardValueForm.authCode = this.payForm.authCode
this.cardValueForm.realyPayBills = this.realyPayBills
this.cardValueForm.actualPayment = actualPayment
this.cardValueForm.makeChange = makeChange
this.payForm.mtUserId = this.chooseVipUser.id
//
this.payForm.seekZero = makeChange
this.payForm.payChannel = 'cashier'
let id;
await getPrepaidCardTopUpApi(this.cardValueForm).then(response => {
await rechargeCard(this.payForm).then(response => {
if (response.data != null) {
this.loading = true;
id = response.data.id
@ -934,85 +974,6 @@ export default {
this_.isAwait = true;
}, 15000)
} else if (this.flag === 2) {
if (!this.payForm.authCode && this.cardFuelDieselForm.paymentType !== "CASH") {
this.$message.error('请先扫码');
return
}else {
if (this.payForm.authCode<this.cardValueForm.amount || this.seekZero<0){
this.$modal.msgError("请输入正确的金额");
return;
}
if (!this.payForm.authCode){
this.$modal.msgError("请输入正确的金额");
return;
}
actualPayment = this.payForm.authCode
makeChange = this.seekZero
}
this.cardFuelDieselForm.mtUserId = userForm.id
this.cardFuelDieselForm.name = userForm.name
this.cardFuelDieselForm.mobile = userForm.mobile
this.cardFuelDieselForm.authCode = this.payForm.authCode
this.cardFuelDieselForm.actualPayment = actualPayment
this.cardFuelDieselForm.makeChange = makeChange
let id;
await getPrepaidFuelTopUpApi(this.cardFuelDieselForm).then(response => {
if (response.data != null) {
this.loading = true;
id = response.data.id
}
});
let timer = setInterval(async () => {
getCheckTheStatusOfYourPaymentByFuelApi(id).then(async response => {
if (response.data != null) {
if (response.data.payStatus == "unpaid") {
this_.isQuery = true;
}
if (response.data.payStatus == "paid") {
this_.isPaySuccess = true;
this_.isQuery = false;
this_.rechargeOilCard = true
// await this.printLocally2()
await this.fuelDieselReport()
await this.getMemberAfter();
clearInterval(timer);
}
if (response.data.payStatus == "payFail") {
this_.isPaySuccess = false;
this_.isQuery = false;
clearInterval(timer);
}
}
})
}, 500);
let timer2 = setInterval(function () {
if (this_.isQuery == false || !this_.openConfirm) {
this_.loading = false;
this_.isPay = false;
clearInterval(timer);
clearInterval(timer2);
}
}, 500)
setTimeout(function () {
clearInterval(timer2);
clearInterval(timer);
this_.loading = false;
this_.isPay = false;
this_.isPaySuccess = false;
this_.isAwait = true;
}, 15000)
let this_ = this
}
this.$forceUpdate();
},
@ -1032,16 +993,23 @@ export default {
this.$message.error('请选择支付方式');
return
}
if (!selectCard.paymentType) {
this.$message.error('请选择输入充值本金');
return
}
if (!selectCard.paymentType) {
if (!selectCard.rechargeBalance) {
this.$message.error('请选择输入充值本金');
return
}
this.payForm.rechargeBalance = selectCard.rechargeBalance
this.payForm.realyPayBills = selectCard.rechargeBalance
this.payForm.selectCardId = selectCard.id
this.payForm.cardType = selectCard.cardType
this.payForm.paymentType = selectCard.paymentType
this.payForm.giftBalance = selectCard.giftBalance
this.payForm.points = selectCard.points
this.payForm.growthValue = selectCard.growthValue
this.payForm.chooseStaff = selectCard.chooseStaff
this.payForm.desc = selectCard.desc
this.payForm.giftCardNo = selectCard.giftCardNo
this.payForm.giftCardPwd = selectCard.giftCardPwd
this.payForm.cardCouponList = selectCard.cardCouponList
if (selectCard.cardType == 0){
this.flag = 1
}else if(selectCard.cardType == 1){
@ -1150,17 +1118,7 @@ export default {
this.couponList=[]
}
},
copyToClipboard(textToCopy) {
VueClipboard(textToCopy).then(() => {
this.$message.success("复制成功")
//
}, () => {
console.log('复制失败');
//
});
},
restVipUser(){
restVipUser(){
this.userInfo = false
this.chooseVipUser = {}
this.userMobile = ''
@ -1369,6 +1327,9 @@ export default {
this.freeIndex = index
},
addFreeTicket(){
getCanUseCoupon().then(res=>{
this.s
})
this.freeTicket = true
},
addMemberRecharge() {

View File

@ -1,5 +1,5 @@
<script>
import {cardValueList,getCoupons} from "@/api/newHome/newHome";
import {cardValueList,fuelCardList,getCoupons,oilName} from "@/api/newHome/newHome";
import {number} from "echarts/lib/export";
import { queryStaffs} from "@/api/staff/staff";
import {getDicts} from "@/api/dict/data";
@ -9,7 +9,12 @@ export default {
},
data() {
return {
selectCard:{cardCouponList:[]},
selectCard:{
cardCouponList:[],
cardType:0,
oilNumberId:null
},
oilList:[],
tabList:[
{
name:'电子储值卡',
@ -24,8 +29,6 @@ export default {
num:2
}
],
tabIndex:0,
kIndex:0,
ruleForm: {
text1:'',
text2:'',
@ -48,6 +51,7 @@ export default {
],
},
cardList:[],
fuelCardList:[],
staffList:[],
//
payList:[],
@ -55,9 +59,42 @@ export default {
}
},
methods:{
chooseFuel(data){
this.$set(this.selectCard,'id',data.id)
this.$set(this.selectCard,'points',data.points)
this.$set(this.selectCard,'rechargeBalance',data.rechargeBalance)
},
changeFuelId(){
this.$set(this.selectCard,'id',null)
this.$set(this.selectCard,'points',null)
this.getFuelCards()
},
getOilList(){
this.oilList = []
oilName('汽油').then(res=>{
this.oilList = res.data.records
if (this.oilList&&this.oilList.length>0){
this.$set(this.selectCard,'oilNumberId',this.oilList[0].id)
this.getFuelCards()
}
})
},
getFuelCards(){
let data ={
oilNumberId: this.selectCard.oilNumberId
}
fuelCardList(data).then(res=>{
this.fuelCardList = res.data
if( this.fuelCardList&& this.fuelCardList.length>0){
this.chooseFuel(this.fuelCardList[0])
}
})
},
//
getPayList(){
getDicts("payment_type").then( response => {
console.log(response.data,61)
this.payList = response.data;
})
},
@ -68,28 +105,33 @@ export default {
);
},
selectTab(index){
this.tabIndex = index
this.selectCard={
cardCouponList:[],
cardType:0,
oilNumberId:null
},
this.selectCard.cardType = index
this.getCardValueList()
},
chooseActive(data,index){
this.kIndex = index
chooseActive(data){
data.cardType = this.selectCard.cardType
this.selectCard = data
this.selectCard.cardCouponList = []
this.getCouponList(data.id)
},
getCardValueList(){
let that = this
cardValueList().then(res=>{
this.kIndex = 0
this.cardList = res.data
if (this.cardList&&this.cardList.length>0) {
this.chooseActive(this.cardList[0],0)
this.chooseActive(this.cardList[0])
that.getCouponList(this.cardList[0].id);
}
})
this.getStaffList()
this.getPayList()
this.getOilList()
},
getCouponList(cardValueId){
console.log({userId:this.userId,cardValueId:cardValueId},72)
@ -104,19 +146,19 @@ export default {
<template>
<div>
<div class="top-dd">
<div class="tab-dv" v-for="(item,index) in tabList" :key="index" :class="{ 'active' :tabIndex==index}" @click="selectTab(index)" >
<div class="tab-dv" v-for="(item,index) in tabList" :key="index" :class="{ 'active':selectCard.cardType==item.num}" @click="selectTab(item.num)" >
{{item.name}}
</div>
</div>
<div v-if="tabIndex == 0">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px" class="demo-ruleForm">
<div v-if="selectCard.cardType == 0">
<el-form :model="selectCard" :rules="rules" ref="ruleForm" label-width="120px" class="demo-ruleForm">
<el-form-item label="充值金额" prop="price" style="margin-bottom: 10px" >
</el-form-item>
<div class="d-s">
<div class="k_kang" v-for="(item,index) in cardList" :key="index" @click="chooseActive(item,index)" >
<div class="k_kang" v-for="(item,index) in cardList" :key="index" @click="chooseActive(item)" >
{{item.activeName}}
<img src="../imgs/r-j.png" class="p-img" v-if="kIndex == index" >
<img src="../imgs/r-j.png" class="p-img" v-if="selectCard.id == item.id" >
</div>
</div>
<el-form-item label="充值本金" prop="region" >
@ -198,54 +240,48 @@ export default {
</el-form-item>
<el-form-item label="支付方式" prop="resource">
<el-radio-group v-model="selectCard.paymentType">
<el-radio v-for="item in payList" v-if="item.dictValue!='APPLET_CODE'" :label="item.dictValue">{{item.dictLabel}}</el-radio>
<el-radio v-for="item in payList" v-if="['APPLET_CODE','card_value','fule_card','car_card_value','car_fule_card','after_pay'].indexOf(item.dictValue)<0" :label="item.dictValue">{{item.dictLabel}}</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
</div>
<div v-if="tabIndex == 1">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px" class="demo-ruleForm">
<div v-if="selectCard.cardType == 1">
<el-form :model="selectCard" :rules="rules" ref="selectCard" label-width="120px" class="demo-ruleForm">
<el-form-item label="油品油号" prop="resource">
<el-radio-group v-model="ruleForm.resource">
<el-radio label="汽油98#"></el-radio>
<el-radio label="汽油95#"></el-radio>
<el-radio label="汽油92#"></el-radio>
<el-radio-group v-model="selectCard.oilNumberId" @input="changeFuelId()">
<el-radio :label="item.id" v-for="item in oilList">{{item.oilName}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="充值金额" prop="price" >
</el-form-item>
<div class="d-s">
<div class="k_kang" v-for="(item,index) in kangList" :key="index" @click="setIndex(index)" >
{{item}}
<img src="../imgs/r-j.png" class="p-img" v-if="kIndex == index" >
<div class="k_kang" v-for="(item,index) in fuelCardList" :key="index" @click="chooseFuel(item)" >
{{'充值'+item.rechargeBalance+'元,锁定'+item.lockPrice+'元/升'}}
<img src="../imgs/r-j.png" class="p-img" v-if="selectCard.id == item.id" >
</div>
</div>
<el-form-item label="赠送积分" prop="region" >
<el-input v-model="ruleForm.text4" style="width: 330px">
<el-input v-model="selectCard.points" style="width: 330px">
<template slot="append">积分</template>
</el-input>
</el-form-item>
<el-form-item label="提成员工" prop="region" >
<el-select v-model="ruleForm.region" placeholder="请选择提成员工" style="width: 330px">
<el-option label="员工一" value="shanghai"></el-option>
<el-option label="员工二" value="beijing"></el-option>
<el-select filterable v-model="selectCard.chooseStaff" placeholder="请选择提成员工" style="width: 330px">
<el-option v-for="data in staffList" :label="data.realName" :value="data.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="充值备注" prop="desc" style="width: 450px">
<el-input type="textarea" v-model="ruleForm.desc"></el-input>
<el-input type="textarea" v-model="selectCard.desc"></el-input>
</el-form-item>
<el-form-item label="支付方式" prop="resource">
<el-radio-group v-model="ruleForm.resource">
<el-radio label="支付宝"></el-radio>
<el-radio label="微信"></el-radio>
<el-radio label="银联二维码"></el-radio>
<el-radio label="现金"></el-radio>
<el-radio-group v-model="selectCard.paymentType">
<el-radio v-for="item in payList" v-if="['APPLET_CODE','card_value','fule_card','car_card_value','car_fule_card','after_pay'].indexOf(item.dictValue)<0" :label="item.dictValue">{{item.dictLabel}}</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
</div>
<div v-if="tabIndex == 2">
<div v-if="selectCard.cardType == 2">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<el-form-item label="礼品卡号" prop="name">
<el-input v-model="ruleForm.name" placeholder="扫描或输入礼品卡号" style="width: 390px" ></el-input>