This commit is contained in:
zhaohengkun 2024-10-24 09:30:33 +08:00
parent 2c0eee83cf
commit 9eceda0858
16 changed files with 603 additions and 279 deletions

View File

@ -34,7 +34,7 @@ public class IntegralOrders extends BaseEntity {
*/
private String orderNumber;
/**
* 关联商品id
* 积分商城 商品表id
*/
// @JsonProperty("giftId")
private Integer giftId;

View File

@ -26,6 +26,10 @@ import com.fuint.business.integral.vo.IntegralGiftVO;
import com.fuint.business.integral.vo.IntegralOrdersExcel;
import com.fuint.business.integral.vo.IntegralOrdersRequest;
import com.fuint.business.integral.vo.IntegralOrdersVO;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser;
import com.fuint.business.marketingActivity.cardCoupon.service.CardCouponService;
import com.fuint.business.marketingActivity.cardCoupon.service.CardCouponUserService;
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchangeRecord;
import com.fuint.business.marketingActivity.cardExchange.service.CardExchangeRecordService;
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
@ -48,6 +52,7 @@ import com.fuint.business.userManager.vo.LJUserVo;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.RedisLock;
import com.fuint.common.util.TokenUtil;
import com.fuint.framework.web.ResponseObject;
import com.fuint.system.dept.mapper.SysDeptMapper;
import com.fuint.system.dict.entity.SysDictData;
import com.fuint.system.dict.entity.SysDictType;
@ -463,15 +468,17 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
@Autowired
private RedisLock redisLock;
@Autowired
private CardCouponService cardCouponService;
@Autowired
private CardCouponUserService cardCouponUserService;
@Override
@Transactional
public IntegralOrders checkTheStatusOfYourPaymentByIntegral(String orderNo) throws Exception {
// AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
// 查询订单信息
// List<IntegralOrders> listByOrderNo = integralOrdersDao.getListByOrderNo2(orderNo, nowAccountInfo.getStoreId());
List<IntegralOrders> listByOrderNo = integralOrdersDao.getListByOrderNo2(orderNo);
// 加锁 processing_status
String lockKey = "IntegralOrders" + orderNo;
Boolean isLock = redisLock.tryLock(lockKey, 5000, TimeUnit.MILLISECONDS);
@ -488,44 +495,19 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
totalPoints = totalPoints.add(new BigDecimal(integralOrders.getIntegral()));
// 加兑换卷和优惠券判断
IntegralGift integralGift = integralGiftService.queryById(integralOrders.getGiftId());
if (integralGift.getGiftType().equals("兑换券")) {
// 兑换卷处理
// integralGift.getVoucherId();
CardExchangeRecord cardExchangeRecord = new CardExchangeRecord();
cardExchangeRecord.setCardExchangeId(integralGift.getVoucherId());
cardExchangeRecord.setStoreId(integralOrders.getStoreId());
cardExchangeRecord.setMtUserId(integralOrders.getUserId());
cardExchangeRecord.setName(ljUserVos.getName());
cardExchangeRecord.setMobile(ljUserVos.getMobile());
cardExchangeRecord.setPhoto(ljUserVos.getAvatar());
if (ObjectUtil.isNotEmpty(ljStaff)) {
cardExchangeRecord.setMtStaffId(ljStaff.getId());
cardExchangeRecord.setRealName(ljStaff.getRealName());
cardExchangeRecord.setStaffMobile(ljStaff.getMobile());
}
if (integralGift.getGiftType().equals("电子券")) {
CardCoupon cardCoupon = cardCouponService.selectOneBuId(integralGift.getCouponId());
ResponseObject responseObject = cardCouponService.sendCoupon2(new CardCouponUser());
cardExchangeRecord.setStatus("0");
cardExchangeRecord.setExchangeFrom("积分兑换");
cardExchangeRecordService.addCardExchangeRecord(cardExchangeRecord);
} else if (integralGift.getGiftType().equals("优惠券")) {
// 优惠卷处理
CardFavorableRecord cardFavorableRecord = new CardFavorableRecord();
cardFavorableRecord.setCardFavorableId(integralGift.getCouponId());
cardFavorableRecord.setStoreId(integralOrders.getStoreId());
cardFavorableRecord.setMtUserId(integralOrders.getUserId());
cardFavorableRecord.setName(ljUserVos.getName());
cardFavorableRecord.setMobile(ljUserVos.getMobile());
cardFavorableRecord.setStatus("0");
cardFavorableRecord.setExchangeFrom("积分兑换");
cardFavorableRecordService.addCardFavorableRecord(cardFavorableRecord);
} else if (integralGift.getGiftType().equals("实物商品")) {
// 修改商品库存并增加记录
// LJGoodsDto goods = new LJGoodsDto();
// goods.setId(integralGift.getGoodsId());
// goods.setDocument("积分兑换");
// goods.setNumberOfChanges(-integralOrders.getExchangeQuantity());
// goods.setGoodsNo(integralOrders.getOrderNumber());
// ljGoodsService.editGoodsInventory(goods);
LJGoodsDto goods = new LJGoodsDto();
goods.setId(integralGift.getGoodsId());
goods.setDocument("积分兑换");
goods.setNumberOfChanges(-integralOrders.getExchangeQuantity());
goods.setGoodsNo(integralOrders.getOrderNumber());
ljGoodsService.editGoodsInventory(goods);
}
// 处理积分库存
@ -690,6 +672,7 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
/**
* 生成核销码
*
* @return
*/
public static String generateUniqueRandomNumber() {

View File

@ -57,9 +57,11 @@
</select>
<select id="selectUserCardVerification" resultType="map">
SELECT
userCard.id as id ,
mtUser.NAME as mobile ,
userCard.verification_code as ticketCode ,
card.name as exchangeName
card.name as exchangeName,
card.exchange_content as exchangeContent
FROM
( SELECT * FROM card_coupon_user WHERE mobile = #{str} OR verification_code = #{str} ) userCard
INNER JOIN card_coupon card ON userCard.card_coupon_id = card.id

View File

@ -33,6 +33,7 @@ public interface CardCouponService extends IService<CardCoupon> {
IPage selectAllByPageAndStoreId(Page page, CardCoupon cardCoupon);
ResponseObject sendCoupon(CardCouponUser cardCouponUser);
ResponseObject sendCoupon2(CardCouponUser cardCouponUser);
CardCoupon selectOneBuId(Integer id);

View File

@ -200,6 +200,32 @@ public class CardCouponServiceImpl extends ServiceImpl<CardCouponMapper, CardCou
return new ResponseObject(200, "领取成功", null);
}
@Override
public ResponseObject sendCoupon2(CardCouponUser cardCouponUser) {
LJUserVo ljUserVo = userService.selectUserById(cardCouponUser.getMtUserId(), cardCouponUser.getStoreId());
//查询 优惠券 信息
CardCoupon card = cardCouponMapper.selectById(cardCouponUser.getCardCouponId());
// 修改优惠券领取数量
card.setTfGetNum(card.getTfGetNum() + 1);
card.setCreateTime(null);
cardCouponMapper.updateById(card);
// 给用户添加 优惠券
cardCouponUser.setMobile(ljUserVo.getMobile());
//通过优惠卷策略计算 开始时间 结束时间
CardCoupon cardCoupon = this.getById(cardCouponUser.getCardCouponId());
if (cardCoupon.getTimeType().equals("1")) {
cardCouponUser.setStartTime(new Date());
cardCouponUser.setEndTime(DateUtil.offsetDay(new Date(), cardCoupon.getValidityDay()));
} else {
cardCouponUser.setStartTime(cardCoupon.getEffectiveDateStart());
cardCouponUser.setEndTime(cardCoupon.getEffectiveDateEnd());
}
cardCouponUserService.insert(cardCouponUser);
return new ResponseObject(200, "领取成功", null);
}
@Override
public CardCoupon selectOneBuId(Integer id) {
return baseMapper.selectById(id);

View File

@ -149,6 +149,17 @@ public class CardExchangeRecordController extends BaseController {
return getSuccessResult(this.cardExchangeRecordService.updateById(cardExchangeRecord));
}
/**
* 核销 只能核销 兑换券
*
*/
@GetMapping("/writeOff")
public ResponseObject writeOff(@RequestParam(value = "id",required = true) Integer id) {
return getSuccessResult("核销成功");
}
/**
* 删除数据
*

View File

@ -0,0 +1,56 @@
package com.fuint.business.marketingActivity.cardExchange.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardExchange.entity.VerificationRecord;
import com.fuint.business.marketingActivity.cardExchange.service.VerificationRecordService;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 核销记录
*/
@RestController
@RequestMapping("business/marketingActivity/verificationRecord")
public class VerificationRecordController extends BaseController {
@Autowired
private VerificationRecordService verificationRecordService;
/**
* 核销 只能核销 兑换券
*/
@GetMapping("/writeOff")
public ResponseObject writeOff(@RequestParam(value = "id", required = true) Integer id) {
Boolean aBoolean = verificationRecordService.writeOff(id);
if (aBoolean) {
return getFailureResult(200, "核销成功");
} else {
return getFailureResult(500, "核销失败");
}
}
/**
* 查询核销历史
*/
@PostMapping("/list")
public ResponseObject list(@RequestBody VerificationRecord verificationRecord,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
// 适用mybatis plus 分页
Page<VerificationRecord> page = new Page<>(pageNo, pageSize);
IPage<VerificationRecord> list = verificationRecordService.list(verificationRecord, page);
return getSuccessResult(list);
}
}

View File

@ -0,0 +1,51 @@
package com.fuint.business.marketingActivity.cardExchange.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fuint.framework.entity.BaseEntity;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 兑换券领取记录表(verificationRecord)表实体类
*/
@Data
public class VerificationRecord extends BaseEntity {
// 主键
@TableId(value = "ID", type = com.baomidou.mybatisplus.annotation.IdType.AUTO)
private Integer id;
// 店铺id
private Integer storeId;
// 用户优惠卷表 id
private Integer CardUserId;
// 用户id
private Integer mtUserId;
// 优惠券名称
private String cardName;
// 优惠券类型
private String cardType;
// 有效期
private String validity;
// 可用时间
private String usableTime;
// 兑换内容
private String content;
// 适用会员等级
private String memberLevel;
// 用户手机号
private String mobile;
// 开始日期
@TableField(exist = false)
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date startTime;
// 结束日期
@TableField(exist = false)
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date endTime;
}

View File

@ -0,0 +1,21 @@
package com.fuint.business.marketingActivity.cardExchange.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardExchange.entity.VerificationRecord;
import com.fuint.business.order.entity.CashierOrder;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
public interface VerificationRecordMapper extends BaseMapper<VerificationRecord> {
// 自定义条件查询
List<VerificationRecord> selectByMapper(@Param("map") Map map);
// 分页查询
public IPage<VerificationRecord> selectPageByMap(Page page,@Param("obj") VerificationRecord verificationRecord);
}

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fuint.business.marketingActivity.cardExchange.mapper.VerificationRecordMapper">
<select id="selectByMapper" resultType="com.fuint.business.marketingActivity.cardExchange.entity.VerificationRecord">
select * from verification_record
<where>
<if test="map.startTime != null">
and create_time &lt;= #{map.startTime}
</if>
<if test="map.endTime != null">
and create_time &gt;= #{map.endTime}
</if>
<if test="map.storeId != null">
and store_id = #{map.storeId}
</if>
<if test="map.mtUserId != null">
and mt_user_id = #{map.mtUserId}
</if>
<if test="map.cardUserId != null">
and card_user_id = #{map.cardUserId}
</if>
<if test="map.cardName != null and map.cardName != ''">
and card_name like concat('%',#{map.cardName},'%')
</if>
<if test="map.mobile != null and map.mobile != ''">
and mobile like concat('%',#{map.mobile},'%')
</if>
</where>
</select>
<select id="selectPageByMap" resultType="com.fuint.business.marketingActivity.cardExchange.entity.VerificationRecord" parameterType="com.fuint.business.marketingActivity.cardExchange.entity.VerificationRecord">
select * from verification_record
<where>
<if test="obj.startTime != null">
and create_time &gt;= #{obj.startTime}
</if>
<if test="obj.endTime != null">
and create_time &lt;= #{obj.endTime}
</if>
<if test="obj.cardName != null and obj.cardName != ''">
and card_name like concat('%',#{obj.cardName},'%')
</if>
<if test="obj.mobile != null and obj.mobile != ''">
and mobile like concat('%',#{obj.mobile},'%')
</if>
</where>
</select>
</mapper>

View File

@ -0,0 +1,17 @@
package com.fuint.business.marketingActivity.cardExchange.service;
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.business.marketingActivity.cardExchange.entity.VerificationRecord;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
public interface VerificationRecordService extends IService<VerificationRecord> {
Boolean writeOff(Integer id);
IPage<VerificationRecord> list(VerificationRecord verificationRecord, Page page);
}

View File

@ -0,0 +1,172 @@
package com.fuint.business.marketingActivity.cardExchange.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser;
import com.fuint.business.marketingActivity.cardCoupon.service.CardCouponService;
import com.fuint.business.marketingActivity.cardCoupon.service.CardCouponUserService;
import com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponVO;
import com.fuint.business.marketingActivity.cardExchange.entity.VerificationRecord;
import com.fuint.business.marketingActivity.cardExchange.service.VerificationRecordService;
import com.fuint.business.userManager.entity.UserBalance;
import com.fuint.business.userManager.mapper.UserBalanceMapper;
import com.fuint.business.userManager.service.UserBalanceService;
import com.fuint.common.util.StringUtils;
import com.fuint.pay.util.CheckUtil;
import com.fuint.repository.mapper.MtUserMapper;
import com.fuint.repository.model.MtUser;
import io.sentry.event.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fuint.business.marketingActivity.cardExchange.mapper.VerificationRecordMapper;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.*;
@Service
public class VerificationRecordServiceImpl extends ServiceImpl<VerificationRecordMapper, VerificationRecord> implements VerificationRecordService {
@Autowired
private CardCouponUserService cardCouponUserService;
@Autowired
private CardCouponService cardCouponService;
@Autowired
private UserBalanceMapper userBalanceMapper;
@Autowired
private MtUserMapper mtUserMapper;
@Autowired
private CheckUtil checkUtil;
/**
* 优惠券适用时间判断前置处理方法
*
* @param rule 规则对象
* @param nowDate 当前时间
* @return java.lang.Boolean
* @author vinjor-M
* @date 13:57 2024/9/25
**/
private Boolean checkTimeCouponPrex(CardCoupon rule, Date nowDate) {
if (StringUtils.isEmpty(rule.getAvailableDay()) && StringUtils.isEmpty(rule.getAvailableWeek())) {
return true;
}
String startTimeStr;
String endTimeStr;
if ("0".equals(rule.getAvailableOrUn())) {
//适用时间
startTimeStr = checkUtil.getTimeFromDate(rule.getAvailablePeriodStart());
endTimeStr = checkUtil.getTimeFromDate(rule.getAvailablePeriodEnd());
Boolean aBoolean = checkUtil.checkTime(rule.getAvailableType(), "1".equals(rule.getAvailableType()) ? rule.getAvailableWeek() : rule.getAvailableDay(), startTimeStr, endTimeStr, nowDate);
return aBoolean;
} else if ("1".equals(rule.getAvailableOrUn())) {
//不适用时间
startTimeStr = checkUtil.getTimeFromDate(rule.getUnAvailablePeriodStart());
endTimeStr = checkUtil.getTimeFromDate(rule.getUnAvailablePeriodEnd());
Boolean aBoolean = checkUtil.checkTimeReverse(rule.getUnAvailableType(), "1".equals(rule.getUnAvailableType()) ? rule.getUnAvailableWeek() : rule.getUnAvailableDay(), startTimeStr, endTimeStr, nowDate);
return aBoolean;
} else {
//超出预设值范围不可用
return false;
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean writeOff(Integer id) {
CardCouponUser byId = cardCouponUserService.getById(id);
if (byId == null || byId.getStatus().equals("1")) {
return false;
}
// 查询优惠券相关信息
CardCoupon cardCoupon = cardCouponService.selectOneBuId(byId.getCardCouponId());
// 查询被核销用户相关信息
HashMap<String, Object> m1 = new HashMap<>();
m1.put("store_id", byId.getStoreId());
m1.put("mt_user_id", byId.getMtUserId());
List<UserBalance> list = userBalanceMapper.selectByMap(m1);
UserBalance userBalance = list.get(0);
// 查询 mt 用户表
MtUser mtUser = mtUserMapper.selectById(byId.getMtUserId());
// 判断是否符合会员等级
String[] split = cardCoupon.getMembershipLevel().split(",");
if (!Arrays.asList(split).contains(userBalance.getGradeId().toString())) {
return false;
}
// 判断 适用时间段 / 不可用时间段
Date date = new Date();
Boolean aBoolean = this.checkTimeCouponPrex(cardCoupon, date);
if (!aBoolean) {
return false;
}
// 判断 使用次数
HashMap<String, Object> m2 = new HashMap<>();
m2.put("cardUserId", byId.getMtUserId());
m2.put("storeId", byId.getStoreId());
m2.put("cardUserId", byId.getId());
// 日期 要根据 优惠券 设置的 * 限制适用 * 次数 往前推*
// 获取当前日期时间
Calendar calendar = Calendar.getInstance();
// 往前推指定天数例如 7
calendar.add(Calendar.DAY_OF_MONTH, -cardCoupon.getLimitTotalDay());
// 获取往前推后的日期时间
Date previousDate = calendar.getTime();
m2.put("startTime", previousDate);
m2.put("endTime", date);
List<VerificationRecord> size = super.baseMapper.selectByMapper(m2);
// 判断 使用次数 是否超过限制
if (size.size() >= cardCoupon.getLimitTotalNum()) {
return false;
}
// 以上条件都符合
VerificationRecord ver = new VerificationRecord();
ver.setStoreId(byId.getStoreId());
ver.setCardUserId(byId.getId());
ver.setMtUserId(byId.getMtUserId());
ver.setCardName(cardCoupon.getName());
ver.setCardType(cardCoupon.getType());
ver.setMobile(mtUser.getMobile());
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
String startTimeStr = dateFormat.format(byId.getStartTime());
String endTimeStr = dateFormat.format(byId.getEndTime());
// 有效期
ver.setValidity(startTimeStr + " ~ " + endTimeStr);
// 可用时间 (暂时没法做)
// 兑换内容
ver.setContent(cardCoupon.getExchangeContent());
// 适用会员等级
ver.setMemberLevel(cardCoupon.getMembershipLevel());
boolean save = super.save(ver);
// 新增核销记录后 要把用户 的优惠券 状态 改掉 并且 优惠券表的 核销数量 +1
byId.setStatus("1");
cardCouponUserService.updateById(byId);
cardCoupon.setTfUseNum(cardCoupon.getTfUseNum() + 1);
cardCouponService.updateById(cardCoupon);
return true;
}
@Override
public IPage<VerificationRecord> list(VerificationRecord verificationRecord, Page page) {
IPage<VerificationRecord> verificationRecordIPage = super.baseMapper.selectPageByMap(page, verificationRecord);
return verificationRecordIPage;
}
}

View File

@ -34,11 +34,21 @@ export function updateRecord(data) {
data: data
})
}
// 核销
export function cardExchangeRecord(data) {
return request({
url: 'business/marketingActivity/cardExchangeRecord',
method: 'put',
url: 'business/marketingActivity/verificationRecord/writeOff',
method: 'get',
params: data
})
}
// 查询核销记录
export function getList(data,queryParams) {
return request({
url: 'business/marketingActivity/verificationRecord/list?pageNo='+queryParams.pageNo+'&pageSize='+queryParams.pageSize,
method: 'post',
data: data
})
}

View File

@ -12,7 +12,7 @@
<div style="font-weight: bold;margin-bottom: 2px">{{ chooseVipUser.name || '匿名' }}</div>
<div class="d-s">
<span>{{ chooseVipUser.mobile }}</span>
<sapn style="margin: 0px 5px">普通会员</sapn>
<span style="margin: 0px 5px">普通会员</span>
<el-popover
placement="bottom"
trigger="hover"
@ -181,109 +181,6 @@
</div>
</div>
<!-- 会员登录-->
<!-- <el-dialog-->
<!-- title="会员信息"-->
<!-- :visible.sync="dialogVisiblevip"-->
<!-- width="30%"-->
<!-- :close-on-click-modal="false"-->
<!-- >-->
<!-- <div>-->
<!-- <el-input placeholder="会员手机号、用户昵称" v-model="userNo"-->
<!-- clearable-->
<!-- @keyup.enter.native="getUser"-->
<!-- class="input-with-select" style="text-align: center;"-->
<!-- >-->
<!-- <el-select v-model="select1" slot="prepend" placeholder="请选择" style="width: 120px">-->
<!-- <el-option label="会员手机号" value="会员手机号"></el-option>-->
<!-- <el-option label="用户昵称" value="用户昵称"></el-option>-->
<!-- </el-select>-->
<!-- <el-button slot="append" @click="getUser">查询</el-button>-->
<!-- </el-input>-->
<!-- </div>-->
<!-- <el-row>-->
<!-- <el-descriptions title="会员信息" :column="2">-->
<!-- <el-descriptions-item label="手机号">{{ member.mobile ? member.mobile : '&#45;&#45;' }}</el-descriptions-item>-->
<!-- <el-descriptions-item label="会员昵称">{{ member.name ? member.name : '&#45;&#45;' }}</el-descriptions-item>-->
<!-- <el-descriptions-item label="积分">{{ member.points ? member.points : '&#45;&#45;' }}</el-descriptions-item>-->
<!-- &lt;!&ndash; <el-descriptions-item label="加油金余额">0</el-descriptions-item>&ndash;&gt;-->
<!-- <el-descriptions-item label="车牌号">{{ member.carNo ? member.carNo : '&#45;&#45;' }}</el-descriptions-item>-->
<!-- <el-descriptions-item label="会员备注">{{ member.remark ? member.remark : '&#45;&#45;' }}</el-descriptions-item>-->
<!-- </el-descriptions>-->
<!-- <el-descriptions title="会员等级">-->
<!-- <el-descriptions-item label="等级名称">{{ member.gradeId ? getGradeName(gradeList, member.gradeId) : '&#45;&#45;' }}-->
<!-- </el-descriptions-item>-->
<!-- </el-descriptions>-->
<!-- <el-descriptions title="储值余额">-->
<!-- <template slot="extra">-->
<!-- &lt;!&ndash; <span style="color: red;margin-right: 20px">余额充值</span>&ndash;&gt;-->
<!-- <span style="font-weight: bold">{{ member.cardBalance ? member.cardBalance : '&#45;&#45;' }}</span>-->
<!-- </template>-->
<!-- <el-descriptions-item v-if="member.cardBalance!=0" label="账户余额">-->
<!-- {{ member.cardBalance ? member.cardBalance : '&#45;&#45;' }}-->
<!-- </el-descriptions-item>-->
<!-- </el-descriptions>-->
<!-- </el-row>-->
<!-- <span slot="footer" class="dialog-footer">-->
<!-- <el-button @click="dialogVisiblevip = false"> </el-button>-->
<!-- <el-button type="primary" @click="chooseUser(member.mobile,member.id)"> </el-button>-->
<!-- </span>-->
<!-- </el-dialog>-->
<!-- 模糊查询会员列表信息-->
<!-- <el-dialog-->
<!-- title="请选择会员"-->
<!-- :visible.sync="dialogVisibleMember"-->
<!-- :close-on-click-modal="false"-->
<!-- >-->
<!-- <div class="wrap-wrap" style="height:700px;overflow-y: scroll;">-->
<!-- <el-table ref="tables" :data="memberList">-->
<!-- <el-table-column label="ID" align="center" prop="id" width="80"/>-->
<!-- <el-table-column label="头像" align="center" width="70">-->
<!-- <template slot-scope="scope">-->
<!-- <img v-if="scope.row.avatar" class="list-avatar" :src="baseUrl + scope.row.avatar">-->
<!-- <img v-else class="list-avatar" src="@/assets/images/avatar.png">-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="姓名" align="center" prop="name"/>-->
<!-- <el-table-column label="手机号" align="center" prop="mobile"/>-->
<!-- <el-table-column label="注册时间" align="center" prop="createTime">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ parseTime(scope.row.createTime) }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
<!-- <template slot-scope="scope">-->
<!-- <el-button-->
<!-- type="primary" round-->
<!-- @click="handleChoose(scope.row)"-->
<!-- >选择-->
<!-- </el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- </el-table>-->
<!-- </div>-->
<!-- </el-dialog>-->
<!-- 加油员姓名-->
<!-- <el-dialog-->
<!-- title="选择加油员"-->
<!-- :visible.sync="dialogVisible"-->
<!-- width="30%"-->
<!-- :close-on-click-modal="false"-->
<!-- >-->
<!-- <div class="wrap-wrap">-->
<!-- <div class="of-box" v-for="(item,index) in staffList" :key="index"-->
<!-- @click="chooseStaff(item),dialogVisible = false"-->
<!-- :style="{'background-color': item.color}"-->
<!-- >-->
<!-- <div class="of-title">{{ item.realName }}</div>-->
<!-- <div style="text-align: center;font-size: 17px">{{ item.mobile }}</div>-->
<!-- </div>-->
<!-- </div>-->
<!-- &lt;!&ndash; <span slot="footer" class="dialog-footer">&ndash;&gt;-->
<!-- &lt;!&ndash; <el-button @click="dialogVisible = false"> </el-button>&ndash;&gt;-->
<!-- &lt;!&ndash; &lt;!&ndash; <el-button type="primary" @click="dialogVisible = false"> </el-button>&ndash;&gt;&ndash;&gt;-->
<!-- &lt;!&ndash; </span>&ndash;&gt;-->
<!-- </el-dialog>-->
<!-- 购物车-->
<el-dialog title="购物车" :visible.sync="openShoppingCart" width="50%">
<el-alert
@ -636,25 +533,8 @@ export default {
this.paymentType = payType.dictValue
this.payType = payType.dictLabel + '支付'
},
//
//
async addGift(data) {
// if (data.giftType === "") {
// //()
//
// let stock = 1;
// if (data.markPurchases) {
// stock = data.markPurchases+1
// }
// await getDetermineTheInventoryOfTheProductApi({id:data.goodsId,
// stock:stock}).then(res=> {
// if (!res.data) {
// // data.markPurchases = data.markPurchases-1
// this.$message.error('');
// return
// }
// })
// }
if (this.shoppingCart.length != 0) {
//
let flag = false
@ -663,17 +543,14 @@ export default {
flag = true
}
})
if (data.exchangeMethod == '积分+加钱购' || flag) {
flag = false
this.shoppingCart.forEach(res => {
if (res.id != data.id) {
flag = true
return
}
})
}
if (flag) {
this.$message.error('“加钱购”商品仅支持在单商品结算时支持积分不足情况下使用加钱购进行付款,多个商品结算不支持“加钱够”计算')
this.$message.error('每次只能选择一种商品种类')
return
}
}
@ -800,9 +677,9 @@ export default {
this.allMoneyRatio = 0
this.giftList = ''
this.getGiftCategory()
await this.getGift()
this.restVipUser()
//
// this.restVipUser()
},
//
shoppingCartMethod() {
@ -1022,6 +899,8 @@ export default {
},
//
async settlement() {
console.log("购物车列表", this.shoppingCart)
if (this.shoppingCart.length < 1) {
this.$message.error('请先选择商品')
return
@ -1031,18 +910,18 @@ export default {
}
this.isPay = true
this.dialogVisiblej = true
if (this.paymentType !== 'CASH') {
console.log("当前应付金额", this.allAmout)
if (this.allAmout != 0) {
console.log("进去了")
//
await this.getSendPrintIndex(this.allAmout)
this.getCode(this.allAmout)
}
}
// if (this.paymentType !== 'CASH') {
//
// console.log("", this.allAmout)
// if (this.allAmout != 0) {
// console.log("")
// //
// // await this.getSendPrintIndex(this.allAmout)
// // this.getCode(this.allAmout)
//
// }
//
// }
},
//
getCode(amount) {

View File

@ -13,7 +13,7 @@
<div class="title_" >通过手机号查询会员可以核销的卡券或扫码核销扫码时请保证输入框有光标闪烁</div>
<div class="input_box" >
<div style="width: 40%;margin-right: 15px">
<el-input v-model="queryParams.mobile" placeholder="请输入会员手机号码或卡券核销码"></el-input>
<el-input ref="mobileRef" v-model="queryParams.mobile" placeholder="请输入会员手机号码或卡券核销码"></el-input>
</div>
<div >
<el-button type="primary" @click="getList">搜索 / 核销</el-button>
@ -27,6 +27,7 @@
<div class="box-hei">{{item.exchangeName}} </div>
<div class="box-hui"><span>领取人</span> <span>{{item.mobile || '匿名'}}</span> </div>
<div class="box-hui"><span>核销码</span> <span>{{item.ticketCode}}</span> </div>
<div class="box-hui"><span>兑换内容</span> <span>{{item.exchangeContent}}</span> </div>
<div class="box-hui"><span>有效期</span> <span>{{item.exchangeFrom}}</span> </div>
</div>
<div class="hx_">
@ -67,6 +68,10 @@ export default {
components:{
writeList
},
mounted() {
this.$refs.mobileRef.focus();
},
methods:{
getindex(index) {
this.tabindex = index
@ -93,13 +98,15 @@ export default {
}).then(() => {
let data = {
id:id,
status:1
}
cardExchangeRecord(data).then(res=>{
if(res.code == 200){
this.$message.success("核销成功")
this.getList()
}
else {
this.$message.error(res.msg)
}
})
}).catch(() => {
this.$message({
@ -107,13 +114,6 @@ export default {
message: '已取消核销'
});
});
}
}

View File

@ -1,45 +1,48 @@
<template>
<div>
<div class="top_new">
<el-form :model="queryParams" ref="queryForm" size="small" style="width: 100%" :inline="true" >
<el-form :model="from" ref="queryForm" size="small" style="width: 100%" :inline="true">
<el-form-item label="" prop="payUser">
<el-form-item label="优惠券名称">
<el-input
v-model="queryParams.payUser"
v-model="from.cardName"
placeholder="请选择优惠券名称"
clearable
/>
</el-form-item>
<el-form-item label="" prop="payUser">
<el-form-item label="手机号">
<el-input
v-model="queryParams.payUser"
v-model="from.mobile"
placeholder="请输入用户手机号"
clearable
/>
</el-form-item>
<el-form-item label="">
<el-form-item label="核销日期">
<el-date-picker
v-model="beginTime"
v-model="from.startTime"
style="width: 160px"
type="date"
placeholder="交易开始日期">
placeholder="开始日期"
value-format="yyyy-MM-dd"
>
</el-date-picker>
<el-date-picker
v-model="endTime"
v-model="from.endTime"
style="width: 160px"
type="date"
placeholder="交易结束日期">
placeholder="结束日期"
value-format="yyyy-MM-dd"
>
</el-date-picker>
</el-form-item>
<el-form-item >
<el-form-item>
</el-form-item>
</el-form>
<div style="height: 32px;width: 20%;display: flex;justify-content: flex-end">
<el-button type="primary" icon="el-icon-search" @click="">查询</el-button>
<el-button type="primary" icon="el-icon-search" @click="selectList">查询</el-button>
<el-button icon="el-icon-refresh" @click="">重置</el-button>
</div>
@ -48,72 +51,114 @@
<el-table
:data="list"
border
style="width: 100%">
style="width: 100%"
>
<el-table-column type="index" width="50" align="center" label="序号"/>
<el-table-column label="优惠券名称" align="center" prop="orderNo" width="220"/>
<el-table-column label="优惠券类型" align="center" prop="terminal"/>
<el-table-column label="用户手机号" align="center" prop="terminal"/>
<el-table-column label="有效日期" align="center" prop="terminal"/>
<el-table-column label="可用时间" align="center" prop="terminal"/>
<el-table-column label="兑换内容" align="center" prop="terminal"/>
<el-table-column label="使用条件" align="center" prop="terminal"/>
<el-table-column label="核销人" align="center" prop="terminal"/>
<el-table-column label="核销时间" align="center" prop="terminal"/>
<el-table-column label="操作" align="center" width="300" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button style="color: #fe8c4a" @click="patchwork(scope.row)"
type="text" >补打
</el-button>
<el-button style="color: #fe8c4a"
v-if="scope.row.status === 'paid'"
@click="refHandleRefund(scope.row.id)"
type="text">退款
</el-button>
</template>
</el-table-column>
<el-table-column label="优惠券名称" align="center" prop="cardName" width="220"/>
<el-table-column label="优惠券类型" align="center" prop="cardType"/>
<el-table-column label="用户手机号" align="center" prop="mobile"/>
<el-table-column label="有效日期" align="center" prop="validity"/>
<!-- <el-table-column label="可用时间" align="center" prop="terminal"/>-->
<el-table-column label="兑换内容" align="center" prop="content"/>
<el-table-column label="适用会员等级" align="center" prop="memberLevel"/>
<el-table-column label="核销人" align="center" prop="createBy"/>
<el-table-column label="核销时间" align="center" prop="createTime"/>
<!-- <el-table-column label="操作" align="center" width="300" class-name="small-padding fixed-width">-->
<!-- <template slot-scope="scope">-->
<!-- <el-button style="color: #fe8c4a" @click="patchwork(scope.row)"-->
<!-- type="text"-->
<!-- >补打-->
<!-- </el-button>-->
<!-- <el-button style="color: #fe8c4a"-->
<!-- v-if="scope.row.status === 'paid'"-->
<!-- @click="refHandleRefund(scope.row.id)"-->
<!-- type="text"-->
<!-- >退款-->
<!-- </el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table>
<div class="pagination-box">
<el-pagination
background
layout="prev, pager, next"
v-show="total>0"
layout="sizes, prev, pager, next"
v-show="total > 0"
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.pageSize"
@current-change="getList">
</el-pagination>
v-model:currentPage="queryParams.pageNo"
v-model:pageSize="queryParams.pageSize"
@size-change="handleSizeChange"
@current-change="pageList"
></el-pagination>
</div>
</div>
</div>
</template>
<script>
import { getList } from '@/api/online'
export default {
name: "order_Goods",
name: 'order_Goods',
data() {
return {
list:[],
beginTime:'',
endTime:'',
list: [],
beginTime: '',
endTime: '',
queryParams: {
page: 1,
pageSize: 10,
pageNo: 1,
pageSize: 10
},
total:0
from: {},
total: 0
}
},
methods:{
getList(){
created() {
this.selectList()
},
methods: {
//
pageList(pageNo){
this.queryParams.pageNo = pageNo || this.queryParams.pageNo
getList(this.from, this.queryParams).then(
res => {
this.list = res.data.records
this.total = res.data.total
}
)
},
// v-model @current-change selectList v-model
selectList() {
this.queryParams.pageNo = 1
getList(this.from, this.queryParams).then(
res => {
this.list = res.data.records
this.total = res.data.total
}
)
},
//
handleSizeChange(size) {
this.queryParams.pageSize = size
this.selectList()
}
}
}
}
}
</script>
<style scoped lang="scss">
.top_new{
.pagination-box {
width: 100%;
margin: 10px auto;
display: flex;
align-items: center;
justify-content: center;
}
.top_new {
display: flex;
justify-content: space-between;
background: #fff;
@ -126,6 +171,7 @@ export default {
padding: 15px;
border-radius: 8px;
}
.table-box {
width: 100%;
height: 66vh;