BUG + 收银台调整
This commit is contained in:
parent
eabfb9bd1f
commit
e8a4da0826
@ -9,6 +9,15 @@ export function listCardCoupon(query) {
|
||||
})
|
||||
}
|
||||
|
||||
// 查询优惠券剩余数量>0的
|
||||
export function getCardCouponNum(query) {
|
||||
return request({
|
||||
url: 'cardCoupon/queryByNum',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 根据id优惠券活动列表
|
||||
export function getCardCoupon(id) {
|
||||
return request({
|
||||
|
@ -256,7 +256,7 @@ import {
|
||||
} from "@/api/EventMarketing/activeConsumption";
|
||||
import {listUserGrade} from "@/api/staff/user/usergrade";
|
||||
import {getOilNameList} from "@/api/order/oilnumgun";
|
||||
import {listCardCoupon} from "@/api/EventMarketing/cardCoupon";
|
||||
import {getCardCouponNum} from "@/api/EventMarketing/cardCoupon";
|
||||
import {listUserLabel} from "@/api/staff/user/userlabel";
|
||||
|
||||
export default {
|
||||
@ -538,8 +538,8 @@ export default {
|
||||
|
||||
},
|
||||
getCardCoupon() {
|
||||
listCardCoupon({status: 1}).then(res => {
|
||||
this.cardCouponList = res.data.records
|
||||
getCardCouponNum({status: 1}).then(res => {
|
||||
this.cardCouponList = res.data
|
||||
})
|
||||
},
|
||||
addPoints(orderType) {
|
||||
|
@ -125,7 +125,7 @@ import {
|
||||
getActiveFullminus,
|
||||
updateActiveFullminus
|
||||
} from "@/api/EventMarketing/activeFullminus";
|
||||
import {listCardCoupon} from "@/api/EventMarketing/cardCoupon";
|
||||
import {getCardCouponNum} from "@/api/EventMarketing/cardCoupon";
|
||||
|
||||
export default {
|
||||
name: "ActiveNewlyweds",
|
||||
@ -255,8 +255,8 @@ export default {
|
||||
}
|
||||
},
|
||||
getCardCoupon() {
|
||||
listCardCoupon({status: 1}).then(res => {
|
||||
this.cardCouponList = res.data.records
|
||||
getCardCouponNum({status: 1}).then(res => {
|
||||
this.cardCouponList = res.data
|
||||
console.log("数据",this.cardCouponList)
|
||||
})
|
||||
},
|
||||
|
@ -134,7 +134,7 @@ import {
|
||||
} from "@/api/EventMarketing/activeNewlyweds";
|
||||
import {getoilName, listExchange, listFavorable, looklook, looklooklook} from "@/api/EventMarketing/activeConsumption";
|
||||
import QRCode from "qrcodejs2";
|
||||
import {listCardCoupon} from "@/api/EventMarketing/cardCoupon";
|
||||
import {getCardCouponNum} from "@/api/EventMarketing/cardCoupon";
|
||||
import {listUserGrade} from "@/api/staff/user/usergrade";
|
||||
import {addActiveBirthday, editActiveBirthday, getActiveBirthday} from "@/api/EventMarketing/activeBirthday";
|
||||
|
||||
@ -281,8 +281,8 @@ export default {
|
||||
})
|
||||
},
|
||||
getCardCoupon() {
|
||||
listCardCoupon({status: 1}).then(res => {
|
||||
this.cardCouponList = res.data.records
|
||||
getCardCouponNum({status: 1}).then(res => {
|
||||
this.cardCouponList = res.data
|
||||
})
|
||||
},
|
||||
getInfo() {
|
||||
|
@ -119,7 +119,7 @@ import {
|
||||
} from "@/api/EventMarketing/activeNewlyweds";
|
||||
import {getoilName, listExchange, listFavorable, looklook, looklooklook} from "@/api/EventMarketing/activeConsumption";
|
||||
import QRCode from "qrcodejs2";
|
||||
import {listCardCoupon} from "@/api/EventMarketing/cardCoupon";
|
||||
import {getCardCouponNum} from "@/api/EventMarketing/cardCoupon";
|
||||
import {
|
||||
getActiveRecommendInfo,
|
||||
insertActiveRecommend,
|
||||
@ -259,8 +259,8 @@ export default {
|
||||
}
|
||||
},
|
||||
getCardCoupon() {
|
||||
listCardCoupon({status: 1}).then(res => {
|
||||
this.cardCouponList = res.data.records
|
||||
getCardCouponNum({status: 1}).then(res => {
|
||||
this.cardCouponList = res.data
|
||||
})
|
||||
},
|
||||
getInfo() {
|
||||
|
@ -158,7 +158,7 @@ import {
|
||||
} from "@/api/EventMarketing/activeNewlyweds";
|
||||
import {getoilName, listExchange, listFavorable, looklook, looklooklook} from "@/api/EventMarketing/activeConsumption";
|
||||
import QRCode from "qrcodejs2";
|
||||
import {listCardCoupon} from "@/api/EventMarketing/cardCoupon";
|
||||
import {getCardCouponNum} from "@/api/EventMarketing/cardCoupon";
|
||||
import {listUserGrade} from "@/api/staff/user/usergrade";
|
||||
import {addActivePopUp, editActivePopUp, getActivePopUp} from "@/api/EventMarketing/activePopUp";
|
||||
|
||||
@ -350,8 +350,8 @@ export default {
|
||||
})
|
||||
},
|
||||
getCardCoupon(){
|
||||
listCardCoupon({status:1}).then(res => {
|
||||
this.cardCouponList = res.data.records
|
||||
getCardCouponNum({status:1}).then(res => {
|
||||
this.cardCouponList = res.data
|
||||
})
|
||||
},
|
||||
getInfo(){
|
||||
|
@ -146,7 +146,7 @@ import {
|
||||
} from "@/api/EventMarketing/activeNewlyweds";
|
||||
import {getoilName, listExchange, listFavorable, looklook, looklooklook} from "@/api/EventMarketing/activeConsumption";
|
||||
import QRCode from "qrcodejs2";
|
||||
import {listCardCoupon} from "@/api/EventMarketing/cardCoupon";
|
||||
import {getCardCouponNum} from "@/api/EventMarketing/cardCoupon";
|
||||
import {listUserGrade} from "@/api/staff/user/usergrade";
|
||||
import {getOilNameList, oilNumberList} from "@/api/order/oilnumgun";
|
||||
import {
|
||||
@ -330,8 +330,8 @@ export default {
|
||||
})
|
||||
},
|
||||
getCardCoupon(){
|
||||
listCardCoupon({status:1}).then(res => {
|
||||
this.cardCouponList = res.data.records
|
||||
getCardCouponNum({status:1}).then(res => {
|
||||
this.cardCouponList = res.data
|
||||
})
|
||||
},
|
||||
getInfo(){
|
||||
|
@ -133,7 +133,7 @@ import {
|
||||
} from "@/api/EventMarketing/activeNewlyweds";
|
||||
import {getoilName, listExchange, listFavorable, looklook, looklooklook} from "@/api/EventMarketing/activeConsumption";
|
||||
import QRCode from "qrcodejs2";
|
||||
import {listCardCoupon} from "@/api/EventMarketing/cardCoupon";
|
||||
import {getCardCouponNum} from "@/api/EventMarketing/cardCoupon";
|
||||
import {listUserGrade} from "@/api/staff/user/usergrade";
|
||||
import {
|
||||
addActiveUserRecharge,
|
||||
@ -283,8 +283,8 @@ export default {
|
||||
})
|
||||
},
|
||||
getCardCoupon(){
|
||||
listCardCoupon({status:1}).then(res => {
|
||||
this.cardCouponList = res.data.records
|
||||
getCardCouponNum({status:1}).then(res => {
|
||||
this.cardCouponList = res.data
|
||||
})
|
||||
},
|
||||
getInfo(){
|
||||
|
@ -319,6 +319,7 @@
|
||||
mt_goods god
|
||||
left JOIN supplier sup on god.supplier_id = sup.id
|
||||
<where>
|
||||
god.stock > 0 and
|
||||
<foreach collection="map" item="value" index="key" open="" close="" separator=" AND ">
|
||||
<if test="value != null and value != ''">
|
||||
${key} = #{value}
|
||||
|
@ -62,6 +62,15 @@ public class CardCouponController extends BaseController {
|
||||
return getSuccessResult(this.cardCouponService.pageVo(page, cardCoupon));
|
||||
|
||||
}
|
||||
// 查询 优惠券 剩余数量 >0 的
|
||||
@GetMapping("/queryByNum")
|
||||
public ResponseObject queryByNum(@Param("cardCoupon") CardCoupon cardCoupon) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
cardCoupon.setStoreId(nowAccountInfo.getStoreId());
|
||||
return getSuccessResult(this.cardCouponService.queryByNum(cardCoupon));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 不分页查询在使用中的优惠卷
|
||||
*
|
||||
@ -220,7 +229,7 @@ public class CardCouponController extends BaseController {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
cardCouponUser.setStoreId(nowAccountInfo.getStoreId());
|
||||
cardCouponUser.setChainStoreId(nowAccountInfo.getChainStoreId());
|
||||
return getSuccessResult(cardCouponService.sendCoupon(cardCouponUser));
|
||||
return cardCouponService.sendCoupon(cardCouponUser);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,6 +19,7 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface CardCouponMapper extends BaseMapper<CardCoupon> {
|
||||
IPage<CardCoupon> pageVo(Page page, @Param("cardCoupon") CardCoupon cardCoupon);
|
||||
List<CardCoupon> queryByNum(@Param("cardCoupon") CardCoupon cardCoupon);
|
||||
|
||||
IPage<CardCouponUniVo> selectAllByPageAndStoreId(Page page, @Param("cardCoupon")CardCoupon cardCoupon);
|
||||
IPage<CardCouponUniVo> selectAllByPageAndIds(Page page,@Param("ids") List<Integer> ids);
|
||||
@ -30,5 +31,7 @@ public interface CardCouponMapper extends BaseMapper<CardCoupon> {
|
||||
*/
|
||||
List<CardCouponUniVo> selectByStoreIdCount(CardCouponUniVo cardCouponUniVos);
|
||||
List<CardCoupon> getCanUseCoupon(@Param("cardCoupon") CardCoupon cardCoupon);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -42,5 +42,8 @@ public interface CardCouponUserMapper extends BaseMapper<CardCouponUser> {
|
||||
IPage<CardCouponUserVo> queryPage(Page page,@Param("entity") CardCouponUserVo cardCouponUserVo);
|
||||
|
||||
List<CardCouponUniVo> selectCouponCount(@Param("storeId") Integer storeId,@Param("userId") Integer userId);
|
||||
|
||||
List<CardCouponUser> selectCardCouponUserList(@Param("params") Map<String, Object> params);
|
||||
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
FROM
|
||||
card_coupon cc
|
||||
<where>
|
||||
cc.tf_total - cc.tf_get_num >0
|
||||
<if test="cardCoupon.storeId!=null and cardCoupon.storeId!=''">
|
||||
and cc.store_id = #{cardCoupon.storeId}
|
||||
</if>
|
||||
@ -121,5 +120,31 @@
|
||||
</where>
|
||||
order by cc.create_time desc
|
||||
</select>
|
||||
<select id="queryByNum" resultType="com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon">
|
||||
SELECT
|
||||
cc.*
|
||||
FROM
|
||||
card_coupon cc
|
||||
<where>
|
||||
cc.tf_total - cc.tf_get_num >0
|
||||
<if test="cardCoupon.storeId!=null and cardCoupon.storeId!=''">
|
||||
and cc.store_id = #{cardCoupon.storeId}
|
||||
</if>
|
||||
<if test="cardCoupon.name!=null and cardCoupon.name!=''">
|
||||
and cc.name like concat('%',#{cardCoupon.name},'%')
|
||||
</if>
|
||||
<if test="cardCoupon.status!=null and cardCoupon.status!=''">
|
||||
and cc.status = #{cardCoupon.status}
|
||||
</if>
|
||||
<if test="cardCoupon.type!=null and cardCoupon.type!=''">
|
||||
and cc.type = #{cardCoupon.type}
|
||||
</if>
|
||||
<if test="cardCoupon.putType!=null and cardCoupon.putType!=''">
|
||||
and cc.put_type = #{cardCoupon.putType}
|
||||
</if>
|
||||
</where>
|
||||
order by cc.create_time desc
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
@ -37,4 +37,24 @@
|
||||
WHERE store_id = #{storeId} AND mt_user_id = #{userId}
|
||||
group by card_coupon_id
|
||||
</select>
|
||||
<select id="selectCardCouponUserList"
|
||||
resultType="com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser">
|
||||
select * from card_coupon_user
|
||||
<where>
|
||||
<if test="params.mtUserId != null and params.mtUserId != ''">
|
||||
and mt_user_id = #{params.mtUserId}
|
||||
</if>
|
||||
<if test="params.cardCouponId != null and params.cardCouponId != ''">
|
||||
and card_coupon_id = #{params.cardCouponId}
|
||||
</if>
|
||||
<if test="params.createTimeStart != null">
|
||||
and create_time >= #{params.createTimeStart}
|
||||
</if>
|
||||
<if test="params.createTimeEnd != null">
|
||||
and create_time <= #{params.createTimeEnd}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon;
|
||||
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser;
|
||||
import com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponUniVo;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -17,6 +18,9 @@ import java.util.List;
|
||||
*/
|
||||
public interface CardCouponService extends IService<CardCoupon> {
|
||||
IPage<CardCoupon> pageVo(Page page, CardCoupon cardCoupon);
|
||||
|
||||
List<CardCoupon> queryByNum(CardCoupon cardCoupon);
|
||||
|
||||
List<CardCoupon> getCanUseCoupon(CardCoupon cardCoupon);
|
||||
|
||||
|
||||
@ -28,7 +32,7 @@ public interface CardCouponService extends IService<CardCoupon> {
|
||||
int isOnLine(Integer id);
|
||||
|
||||
IPage selectAllByPageAndStoreId(Page page, CardCoupon cardCoupon);
|
||||
int sendCoupon(CardCouponUser cardCouponUser);
|
||||
ResponseObject sendCoupon(CardCouponUser cardCouponUser);
|
||||
|
||||
CardCoupon selectOneBuId(Integer id);
|
||||
|
||||
|
@ -27,8 +27,10 @@ import com.fuint.business.userManager.service.LJUserService;
|
||||
import com.fuint.business.userManager.vo.LJUserVo;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@ -43,13 +45,15 @@ import java.util.stream.Collectors;
|
||||
public class CardCouponServiceImpl extends ServiceImpl<CardCouponMapper, CardCoupon> implements CardCouponService {
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private CardCouponMapper cardCouponMapper;
|
||||
@Autowired
|
||||
private CardCouponUserMapper cardCouponUserMapper;
|
||||
@Autowired
|
||||
private LJUserService userService;
|
||||
@Autowired
|
||||
private UserBalanceMapper userBalanceMapper;
|
||||
|
||||
@Override
|
||||
public IPage<CardCoupon> pageVo(Page page, CardCoupon cardCoupon) {
|
||||
IPage<CardCoupon> cardCouponIPage = baseMapper.pageVo(page, cardCoupon);
|
||||
@ -57,6 +61,11 @@ public class CardCouponServiceImpl extends ServiceImpl<CardCouponMapper, CardCou
|
||||
return cardCouponIPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CardCoupon> queryByNum(CardCoupon cardCoupon) {
|
||||
return baseMapper.queryByNum(cardCoupon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CardCoupon> getCanUseCoupon(CardCoupon cardCoupon) {
|
||||
return baseMapper.getCanUseCoupon(cardCoupon);
|
||||
@ -65,7 +74,7 @@ public class CardCouponServiceImpl extends ServiceImpl<CardCouponMapper, CardCou
|
||||
@Override
|
||||
public int isOnLine(Integer id) {
|
||||
CardCoupon cardCoupon = baseMapper.selectById(id);
|
||||
if (ObjectUtil.isEmpty( cardCoupon)) {
|
||||
if (ObjectUtil.isEmpty(cardCoupon)) {
|
||||
return 0;
|
||||
}
|
||||
cardCoupon.setStatus(cardCoupon.getStatus().equals("0") ? "1" : "0");
|
||||
@ -85,7 +94,7 @@ public class CardCouponServiceImpl extends ServiceImpl<CardCouponMapper, CardCou
|
||||
IPage<CardCouponUniVo> cardCouponUniVos = baseMapper.selectAllByPageAndStoreId(page, cardCoupon);
|
||||
|
||||
//用户拥有的优惠券以及数量
|
||||
List<CardCouponUniVo> list= cardCouponUserMapper.selectCouponCount(cardCoupon.getStoreId(), nowAccountInfo.getId());
|
||||
List<CardCouponUniVo> list = cardCouponUserMapper.selectCouponCount(cardCoupon.getStoreId(), nowAccountInfo.getId());
|
||||
Map<Integer, Integer> map = list.stream().collect(Collectors.toMap(CardCouponUniVo::getId, CardCouponUniVo::getCount));
|
||||
|
||||
CardCouponUniVo cardCouponUniVo1 = new CardCouponUniVo();
|
||||
@ -106,7 +115,7 @@ public class CardCouponServiceImpl extends ServiceImpl<CardCouponMapper, CardCou
|
||||
//循环店铺优惠券
|
||||
for (CardCouponUniVo coupon : cardCouponUniVos.getRecords()) {
|
||||
Integer getNum = 0;
|
||||
if (ObjectUtil.isNotEmpty(coupon.getTfGetNum())){
|
||||
if (ObjectUtil.isNotEmpty(coupon.getTfGetNum())) {
|
||||
getNum = coupon.getTfGetNum();
|
||||
}
|
||||
//判断当前用户是否符合会员等级
|
||||
@ -117,13 +126,13 @@ public class CardCouponServiceImpl extends ServiceImpl<CardCouponMapper, CardCou
|
||||
//查询该优惠券是否已到达限制数量
|
||||
if ((getNum < coupon.getTfTotal())) {
|
||||
Integer count = 0;
|
||||
if (ObjectUtil.isNotEmpty(cardCouponMap.get(coupon.getId()))){
|
||||
if (ObjectUtil.isNotEmpty(cardCouponMap.get(coupon.getId()))) {
|
||||
count = cardCouponMap.get(coupon.getId());
|
||||
}
|
||||
if (count < coupon.getDayGetLimit()) {
|
||||
Integer getNumLimit = coupon.getGetNumLimit();
|
||||
Integer userCount = 0;
|
||||
if (ObjectUtil.isNotEmpty(map.get(coupon.getId()))){
|
||||
if (ObjectUtil.isNotEmpty(map.get(coupon.getId()))) {
|
||||
userCount = map.get(coupon.getId());
|
||||
}
|
||||
if (userCount < getNumLimit) {
|
||||
@ -142,19 +151,46 @@ public class CardCouponServiceImpl extends ServiceImpl<CardCouponMapper, CardCou
|
||||
}
|
||||
|
||||
@Override
|
||||
public int sendCoupon(CardCouponUser cardCouponUser) {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResponseObject sendCoupon(CardCouponUser cardCouponUser) {
|
||||
LJUserVo ljUserVo = userService.selectUserById(cardCouponUser.getMtUserId(), cardCouponUser.getStoreId());
|
||||
//查询 当前用户领取优惠券次数 总次数 每日次数
|
||||
HashMap<String, Object> m1 = new HashMap<>();
|
||||
m1.put("cardCouponId", cardCouponUser.getCardCouponId());
|
||||
m1.put("mtUserId", cardCouponUser.getMtUserId());
|
||||
List<CardCouponUser> list = cardCouponUserMapper.selectCardCouponUserList(m1);
|
||||
|
||||
m1.put("createTimeStart", com.fuint.common.util.DateUtil.getTodayMidnight());
|
||||
m1.put("createTimeEnd", com.fuint.common.util.DateUtil.getTomorrowMidnight());
|
||||
List<CardCouponUser> list2 = cardCouponUserMapper.selectCardCouponUserList(m1);
|
||||
|
||||
//查询 优惠券 信息
|
||||
CardCoupon card = cardCouponMapper.selectById(cardCouponUser.getCardCouponId());
|
||||
|
||||
if (card.getGetNumLimit() <= list.size()) {
|
||||
return new ResponseObject(500, "领取失败,超出总领取上限", null);
|
||||
}
|
||||
|
||||
if (card.getDayGetLimit() <= list2.size()) {
|
||||
return new ResponseObject(500, "领取失败,超出每日领取上限", null);
|
||||
}
|
||||
// 修改优惠券领取数量
|
||||
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")){
|
||||
if (cardCoupon.getTimeType().equals("1")) {
|
||||
cardCouponUser.setStartTime(new Date());
|
||||
cardCouponUser.setEndTime(DateUtil.offsetDay(new Date(),cardCoupon.getValidityDay()));
|
||||
}else {
|
||||
cardCouponUser.setEndTime(DateUtil.offsetDay(new Date(), cardCoupon.getValidityDay()));
|
||||
} else {
|
||||
cardCouponUser.setStartTime(cardCoupon.getEffectiveDateStart());
|
||||
cardCouponUser.setEndTime(cardCoupon.getEffectiveDateEnd());
|
||||
}
|
||||
return cardCouponUserMapper.insert(cardCouponUser);
|
||||
return new ResponseObject(200, "领取成功", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -201,7 +237,7 @@ public class CardCouponServiceImpl extends ServiceImpl<CardCouponMapper, CardCou
|
||||
DateTime now = DateUtil.date();
|
||||
effectiveDateStart = now;
|
||||
effectiveDateEnd = DateUtil.offsetDay(now, validityDay);
|
||||
}else {
|
||||
} else {
|
||||
effectiveDateStart = cardCoupon.getEffectiveDateStart();
|
||||
effectiveDateEnd = cardCoupon.getEffectiveDateEnd();
|
||||
}
|
||||
@ -248,7 +284,6 @@ public class CardCouponServiceImpl extends ServiceImpl<CardCouponMapper, CardCou
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
|
||||
private static void extracted(CardCouponUniVo coupon) {
|
||||
//计算领取的比例
|
||||
double scale = (coupon.getTfGetNum() == null ? 0 : coupon.getTfGetNum() * 1.0 / coupon.getTfTotal()) * 100;
|
||||
|
@ -111,7 +111,7 @@ public class PayCenterServiceImpl implements PayCenterService {
|
||||
private ActiveUserConsumeChildService activeUserConsumeChildService;
|
||||
|
||||
/**
|
||||
* 收银台获取可用优惠券和可以参加的优惠活动
|
||||
* 收银台获取可以参加的优惠活动
|
||||
*
|
||||
* @param map 请求参数
|
||||
* @return java.lang.Object
|
||||
@ -149,8 +149,6 @@ public class PayCenterServiceImpl implements PayCenterService {
|
||||
Double oilPrice = Double.valueOf(map.get("oilPrice"));
|
||||
//加油金额(不含商品金额)
|
||||
Double oilAmount = Double.valueOf(map.get("oilAmount"));
|
||||
//订单总额(含商品金额)
|
||||
Double orderAmount = Double.valueOf(map.get("orderAmount"));
|
||||
//油升数
|
||||
Double oilLiter = Double.valueOf(map.get("oilLiter"));
|
||||
//支付方式
|
||||
@ -170,14 +168,14 @@ public class PayCenterServiceImpl implements PayCenterService {
|
||||
}
|
||||
try {
|
||||
//2.2 查可参加的立减营销
|
||||
actList.addAll(this.getLijianAct(nowDate, userId, gradeId, storeId, labelIdList, oilAmount, oilLiter, oilId, payWay));
|
||||
actList.addAll(this.getLijianAct(nowDate, userId, gradeId, storeId, labelIdList, oilAmount, oilLiter, oilId, payWay));
|
||||
} catch (Exception e) {
|
||||
//测试用,数据问题先忽略
|
||||
System.out.println("立减营销" + e);
|
||||
}
|
||||
try {
|
||||
//2.3 查可参加的折扣营销(会员折扣)
|
||||
actList.addAll(this.getZhekouAct(nowDate, gradeId, storeId, oilAmount, payWay));
|
||||
actList.addAll(this.getZhekouAct(nowDate, gradeId, storeId, oilAmount, payWay));
|
||||
} catch (Exception e) {
|
||||
//测试用,数据问题先忽略
|
||||
e.printStackTrace();
|
||||
@ -264,7 +262,7 @@ public class PayCenterServiceImpl implements PayCenterService {
|
||||
* @param gradeId 会员等级
|
||||
* @param storeId 店铺id
|
||||
* @param labelIdList 会员标签id集和
|
||||
* @param oilAmount 当前加油金额
|
||||
* @param orderAmount 订单金额
|
||||
* @param oilLiter 当前加油升数
|
||||
* @param oilId 当前加油选择的油号id
|
||||
* @param payWay 支付方式
|
||||
@ -273,7 +271,7 @@ public class PayCenterServiceImpl implements PayCenterService {
|
||||
* @date 17:28 2024/9/21
|
||||
**/
|
||||
private List<ActivityVO> getLijianAct(Date nowDate, Integer userId, Integer gradeId, Integer storeId,
|
||||
List<Integer> labelIdList, Double oilAmount, Double oilLiter,
|
||||
List<Integer> labelIdList, Double orderAmount, Double oilLiter,
|
||||
Integer oilId, String payWay) {
|
||||
/*1.先查满足条件的所有生效中的活动规则*/
|
||||
List<ActiveSubPriceRespVO> activeSubPriceList = activeSubPriceService.selectAllAct(storeId, nowDate);
|
||||
@ -288,7 +286,8 @@ public class PayCenterServiceImpl implements PayCenterService {
|
||||
//适用当前油号的
|
||||
.filter(rule -> checkUtil.checkOilLijian(rule.getApplyOilType(), rule.getApplyOil(), oilId))
|
||||
//适用当前支付方式的
|
||||
.filter(rule -> rule.getPaymentType().contains(payWay)).collect(Collectors.toList());
|
||||
.filter(rule -> rule.getPaymentType().contains(payWay))
|
||||
.collect(Collectors.toList());
|
||||
/*3.再次过滤,这里过滤掉用户已经超出参加次数限制的*/
|
||||
//符合条件的活动规则,查询当前会员已经参与的记录,此处查立减营销的参与记录
|
||||
List<String> actTypeList = Arrays.asList("3".split(StrUtil.COMMA));
|
||||
@ -313,7 +312,11 @@ public class PayCenterServiceImpl implements PayCenterService {
|
||||
activityVO.setType("3");
|
||||
activityVO.setActName(rule.getActiveName());
|
||||
activityVO.setPayTypes(rule.getPaymentType());
|
||||
activityVO.setDisAmount(checkUtil.computeDisAmountLijian(rule, oilAmount, oilLiter));
|
||||
Double aDouble = checkUtil.computeDisAmountLijian(rule, orderAmount, oilLiter);
|
||||
if (aDouble <= 0){
|
||||
continue;
|
||||
}
|
||||
activityVO.setDisAmount(checkUtil.computeDisAmountLijian(rule, orderAmount, oilLiter));
|
||||
rtnList.add(activityVO);
|
||||
}
|
||||
}
|
||||
@ -422,6 +425,8 @@ public class PayCenterServiceImpl implements PayCenterService {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
Integer storeId = nowAccountInfo.getStoreId();
|
||||
int userId = Integer.parseInt(map.get("userId"));
|
||||
//查询出用户信息
|
||||
UserBalance userBalance = userBalanceService.selectUserBalanceByStorId(userId, storeId);
|
||||
//油号id
|
||||
Integer oilId = Integer.valueOf(map.getOrDefault("oilId", "99999"));
|
||||
//加油金额(不含商品金额)
|
||||
@ -430,6 +435,7 @@ public class PayCenterServiceImpl implements PayCenterService {
|
||||
Double oilLiter = Double.valueOf(map.getOrDefault("oilLiter", "0"));
|
||||
//支付方式
|
||||
String payWay = map.get("payWay");
|
||||
//还需要 加油升数 订单金额
|
||||
if ("after_pay".equals(payWay)) {
|
||||
//挂账,不可以用优惠券
|
||||
return new ArrayList<>();
|
||||
@ -448,12 +454,15 @@ public class PayCenterServiceImpl implements PayCenterService {
|
||||
List<CardCouponVO> filteredList = couponVOList.stream()
|
||||
//当前时间在 适用时间段内 或者 当前时间不在 不适用时间段内的
|
||||
.filter(rule -> this.checkTimeCouponPrex(rule, nowDate))
|
||||
//过滤会员等级
|
||||
.filter(rule -> checkUtil.checkGradeId(userBalance.getGradeId(), rule.getMembershipLevel()))
|
||||
//如果是油品券,需要过滤出当前油品可用的
|
||||
.filter(rule -> checkUtil.checkOilCoupon(rule, oilId))
|
||||
//如果是油品券,需要过滤出达到满减条件的
|
||||
.filter(rule -> checkUtil.checkMaxCoupon(rule, oilAmount, oilLiter))
|
||||
//如果是单品立减券,需要过滤出当前选择的商品可用且满足最低消费金额的
|
||||
.filter(rule -> checkUtil.checkGoodsCoupon(rule, finalGoodsList)).collect(Collectors.toList());
|
||||
//直接 去掉类型是 2,5 卡券类型 1代金券、2兑换券、3折扣券、4油品立减券、5单品代金券
|
||||
.filter(rule -> rule != null && !Arrays.asList("2", "5").contains(rule.getType()))
|
||||
.collect(Collectors.toList());
|
||||
if (filteredList.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
@ -691,14 +700,14 @@ public class PayCenterServiceImpl implements PayCenterService {
|
||||
// 此活动上架 收银台可送 且 已领取 + 活动发放数量 < 总数量 且 未超过 总上限 当日上限
|
||||
if (card.getStatus().equals("1") &&
|
||||
card.getSySend().equals("1") &&
|
||||
card.getTfGetNum()+child.getGiftCardTotal() < card.getTfTotal() &&
|
||||
card.getTfGetNum() + child.getGiftCardTotal() < card.getTfTotal() &&
|
||||
list1.size() < card.getGetNumLimit() &&
|
||||
list2.count() < card.getDayGetLimit()) {
|
||||
// 将优惠卷 与 当前用户关联 并且 优惠卷 领取数量 + 方法数量
|
||||
card.setTfGetNum(card.getTfGetNum() + child.getGiftCardTotal());
|
||||
cardCouponService.updateById(card);
|
||||
|
||||
for (int i = 0; i <child.getGiftCardTotal() ; i++) {
|
||||
for (int i = 0; i < child.getGiftCardTotal(); i++) {
|
||||
CardCouponUser cardUser = new CardCouponUser();
|
||||
cardUser.setChainStoreId(invitationBalance.getChainStoreId());
|
||||
cardUser.setStoreId(invitationBalance.getStoreId());
|
||||
@ -1061,9 +1070,9 @@ public class PayCenterServiceImpl implements PayCenterService {
|
||||
.filter(cardCouponUser -> checkUtil.isBetween(cardCouponUser.getCreateTime(), DateUtil.getTodayMidnight(), DateUtil.getTomorrowMidnight()));
|
||||
|
||||
// 此 优惠卷 上架 收银台可送 且 活动发放数量+已领取 < 总数量 且 未超过 总上限 当日上限 先都判断一下不为 null 防止空指针
|
||||
card.setTfGetNum( (card.getTfGetNum() == null) ? 0 : card.getTfGetNum());
|
||||
card.setTfGetNum((card.getTfGetNum() == null) ? 0 : card.getTfGetNum());
|
||||
|
||||
if ( card.getStatus().equals("1") &&
|
||||
if (card.getStatus().equals("1") &&
|
||||
card.getSySend().equals("1") &&
|
||||
(child.getGiftCardTotal() + card.getTfGetNum()) < card.getTfTotal() &&
|
||||
list1.size() < card.getGetNumLimit() &&
|
||||
@ -1071,7 +1080,7 @@ public class PayCenterServiceImpl implements PayCenterService {
|
||||
) {
|
||||
|
||||
// 将优惠卷 与 当前用户关联 并且 优惠卷 领取数量 + 活动设定赠送优惠卷数量
|
||||
card.setTfGetNum(card.getTfGetNum()+child.getGiftCardTotal());
|
||||
card.setTfGetNum(card.getTfGetNum() + child.getGiftCardTotal());
|
||||
cardCouponService.updateById(card);
|
||||
// 并且 循环 添加多张优惠卷与用户领取记录表
|
||||
for (int i = 0; i < child.getGiftCardTotal(); i++) {
|
||||
@ -1152,6 +1161,22 @@ public class PayCenterServiceImpl implements PayCenterService {
|
||||
}
|
||||
|
||||
|
||||
public Boolean filterCardCouponVOType(CardCouponVO cardCouponVO) {
|
||||
// 卡券类型 1代金券、2兑换券、3折扣券、4油品立减券、5单品代金券
|
||||
if ("1".equals(cardCouponVO.getType()) || "3".equals(cardCouponVO.getType()) || "4".equals(cardCouponVO.getType())) {
|
||||
|
||||
|
||||
|
||||
} else if ("2".equals(cardCouponVO.getType())) {
|
||||
|
||||
|
||||
} else if ("5".equals(cardCouponVO.getType())) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 推荐消费有礼 活动时间前置处理 0永久有效;1自定义
|
||||
@ -1203,7 +1228,7 @@ public class PayCenterServiceImpl implements PayCenterService {
|
||||
**/
|
||||
private Boolean checkTimeCouponPrex(CardCouponVO rule, Date nowDate) {
|
||||
|
||||
if (rule.getAvailableDay() ==null && rule.getAvailableWeek() == null){
|
||||
if (StringUtils.isEmpty(rule.getAvailableDay()) && StringUtils.isEmpty(rule.getAvailableWeek()) ) {
|
||||
return true;
|
||||
}
|
||||
String startTimeStr;
|
||||
@ -1212,12 +1237,14 @@ public class PayCenterServiceImpl implements PayCenterService {
|
||||
//适用时间
|
||||
startTimeStr = checkUtil.getTimeFromDate(rule.getAvailablePeriodStart());
|
||||
endTimeStr = checkUtil.getTimeFromDate(rule.getAvailablePeriodEnd());
|
||||
return checkUtil.checkTime(rule.getAvailableType(), "1".equals(rule.getAvailableType()) ? rule.getAvailableWeek() : rule.getAvailableDay(), startTimeStr, endTimeStr, nowDate);
|
||||
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());
|
||||
return checkUtil.checkTimeReverse(rule.getUnAvailableType(), "1".equals(rule.getUnAvailableType()) ? rule.getUnAvailableWeek() : rule.getUnAvailableDay(), startTimeStr, endTimeStr, nowDate);
|
||||
Boolean aBoolean = checkUtil.checkTimeReverse(rule.getUnAvailableType(), "1".equals(rule.getUnAvailableType()) ? rule.getUnAvailableWeek() : rule.getUnAvailableDay(), startTimeStr, endTimeStr, nowDate);
|
||||
return aBoolean;
|
||||
} else {
|
||||
//超出预设值范围,不可用
|
||||
return false;
|
||||
|
@ -63,7 +63,7 @@ public class CheckUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断某活动设置的可用会员等级(可以通用 就是比较 某个数值 是否在某组字符串中含有)
|
||||
* 判断某活动设置的可用会员等级(可以通用 就是比较 某个字符串 是否在某组字符串中含有)
|
||||
*
|
||||
* @param gradeId 当前会员的等级
|
||||
* @param gradeIds 活动设置的会员等级Ids
|
||||
@ -414,6 +414,8 @@ public class CheckUtil {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 判断当前加油的油号是否符合优惠券预设的油号----优惠券专用
|
||||
*
|
||||
@ -450,20 +452,20 @@ public class CheckUtil {
|
||||
* 判断当前加油金额或者加油升数是否达到满减条件----优惠券专用
|
||||
*
|
||||
* @param couponVO 优惠券对象
|
||||
* @param oilAmount 加油金额
|
||||
* @param orderAmount 订单金额
|
||||
* @param oilLiter 加油升数
|
||||
* @return java.lang.Boolean
|
||||
* @author vinjor-M
|
||||
* @date 14:42 2024/9/21
|
||||
**/
|
||||
public Boolean checkMaxCoupon(CardCouponVO couponVO, Double oilAmount, Double oilLiter) {
|
||||
public Boolean checkMaxCoupon(CardCouponVO couponVO, Double orderAmount, Double oilLiter) {
|
||||
//代金券、折扣券、油品立减券才需要判断加油升数、加油金额是否达到满减条件
|
||||
List<String> couponTypeList = Arrays.asList("1", "3", "4");
|
||||
if (couponTypeList.contains(couponVO.getType())) {
|
||||
Double thisValue;
|
||||
if ("1".equals(couponVO.getUseType())) {
|
||||
//加油金额
|
||||
thisValue = oilAmount;
|
||||
//订单金额
|
||||
thisValue = orderAmount;
|
||||
} else if ("2".equals(couponVO.getUseType())) {
|
||||
//加油升数
|
||||
thisValue = oilLiter;
|
||||
@ -777,15 +779,15 @@ public class CheckUtil {
|
||||
* 根据优惠券优惠规则,计算优惠金额,,四舍五入保留2位小数--优惠券专用
|
||||
*
|
||||
* @param coupon 优惠券
|
||||
* @param oilAmount 加油总价
|
||||
* @param orderAmount 订单金额
|
||||
* @param oilLiter 加油升数
|
||||
* @return java.lang.Double
|
||||
* @author vinjor-M
|
||||
* @date 16:35 2024/9/21
|
||||
**/
|
||||
public Double computeDisAmountCoupon(CardCouponVO coupon, Double oilAmount, Double oilLiter) {
|
||||
public Double computeDisAmountCoupon(CardCouponVO coupon, Double orderAmount, Double oilLiter) {
|
||||
//默认优惠后总价等于原来的总价
|
||||
Double newOilAmount = oilAmount;
|
||||
Double newOilAmount = orderAmount;
|
||||
//优惠金额
|
||||
Double disAmount = 0.0;
|
||||
DecimalFormat df = new DecimalFormat("#.00");
|
||||
@ -796,7 +798,7 @@ public class CheckUtil {
|
||||
} else if ("3".equals(coupon.getType())) {
|
||||
//折扣券,打折
|
||||
newOilAmount = newOilAmount * coupon.getZkData();
|
||||
disAmount = oilAmount - newOilAmount;
|
||||
disAmount = orderAmount - newOilAmount;
|
||||
if (disAmount > coupon.getZkMaxAmount()) {
|
||||
//超出折扣最大优惠金额
|
||||
disAmount = coupon.getZkMaxAmount();
|
||||
|
@ -73,7 +73,7 @@
|
||||
<div style="color: #F4F5F9">|</div>
|
||||
<div class="three_box">合计:¥{{ orderAmount }}</div>
|
||||
</div>
|
||||
<div class="d-top">
|
||||
<div class="d-top" v-loading="loadingPreferential">
|
||||
<div class="d-b">
|
||||
|
||||
<el-checkbox v-model="showAct">活动优惠 <i class="el-icon-arrow-down"></i></el-checkbox>
|
||||
@ -131,7 +131,9 @@
|
||||
<div class="box-bottom">
|
||||
<div>
|
||||
<div class="price_">¥{{ realAmount }}</div>
|
||||
<div class="price_prefer">优惠合计:¥{{ disTotal }}</div>
|
||||
<div class="price_prefer" style="font-size: 14px">油品优惠:¥-{{ parseFloat(disOil).toFixed(2)}}</div>
|
||||
<div class="price_prefer" style="font-size: 14px">商品优惠:¥-{{ parseFloat(disGoods).toFixed(2) }}</div>
|
||||
<div class="price_prefer">优惠合计:¥-{{ parseFloat(disTotal).toFixed(2) }}</div>
|
||||
</div>
|
||||
<div class="anniu" @click="settlement()" :class="{ disabled: !isClickable }">立即结算</div>
|
||||
</div>
|
||||
@ -212,7 +214,7 @@
|
||||
</div>
|
||||
<div class="stock_name">{{ item.stock }}</div>
|
||||
<div class="u-price_name">{{ item.retailPrice }}</div>
|
||||
<div class="u-price_name">{{ item.retailPrice }}</div>
|
||||
<div class="u-price_name">{{ item.memberPrice}}</div>
|
||||
<div class="num_name">
|
||||
<el-input-number v-model="goodsList[index].num" @change="handleCilone(goodsList[index])" :max=item.stock
|
||||
size="mini" :min="1">
|
||||
@ -584,6 +586,9 @@ export default {
|
||||
dicts: ['CardCoupon_type'],
|
||||
data() {
|
||||
return {
|
||||
disOil: 0.00,
|
||||
disGoods: 0.00,
|
||||
loadingPreferential: false,
|
||||
dialogVisible:false,
|
||||
isClickable: false, // 默认不可点击
|
||||
payForm: {
|
||||
@ -715,6 +720,40 @@ export default {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
//监听 会员登录 刷新一下商品会员价 计算
|
||||
chooseVipUser:{
|
||||
deep: true,
|
||||
handler(newVal) {
|
||||
this.goodsList = this.goodsList.map(
|
||||
item => {
|
||||
return item;
|
||||
}
|
||||
)
|
||||
}
|
||||
},
|
||||
//监听商品列表 变化计算商品优惠
|
||||
goodsList: {
|
||||
handler(newVal) {
|
||||
//如果会员不为空
|
||||
if (this.chooseVipUser.hasOwnProperty("id")) {
|
||||
this.disGoods = 0.00;
|
||||
// 计算商品会员价
|
||||
console.log("走了啊", this.goodsList);
|
||||
this.goodsList.forEach(item => {
|
||||
const memberPrice = Number(item.retailPrice - item.memberPrice);
|
||||
const num = Number(item.num);
|
||||
const product = (memberPrice * num).toFixed(2); // 固定为两位小数
|
||||
this.disGoods = (parseFloat(this.disGoods) + parseFloat(product)).toFixed(2);
|
||||
});
|
||||
|
||||
// 优惠总金额赋值
|
||||
this.disTotal = 0.00;
|
||||
this.disTotal = (parseFloat(this.disGoods) + parseFloat(this.disOil)).toFixed(2);
|
||||
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
//监听结算金额 是否获取
|
||||
realAmount: {
|
||||
handler(newVal) {
|
||||
@ -776,6 +815,8 @@ export default {
|
||||
console.log('油枪发生变化', newValue);
|
||||
if (newValue && newValue.hasOwnProperty("oilNameId")) {
|
||||
this.orderAmount = (Number(newValue.amount) + Number(this.getGoodsNum)).toFixed(2)
|
||||
// 保留两位小数
|
||||
this.oilLiter = (this.oilGunClearing.amount / this.oilGunClearing.oilPrice).toFixed(2)
|
||||
} else {
|
||||
this.orderAmount = this.getGoodsNum
|
||||
}
|
||||
@ -795,8 +836,7 @@ export default {
|
||||
} else {
|
||||
this.orderAmount = newVal
|
||||
}
|
||||
//刷新可用优惠券
|
||||
this.getCoupon()
|
||||
//商品 没有优惠券了 当前页面不能使用
|
||||
}
|
||||
},
|
||||
components: {
|
||||
@ -821,8 +861,6 @@ export default {
|
||||
},
|
||||
getGoodsItem() {
|
||||
if (this.oilGunClearing.amount && this.oilGunClearing.amount !== undefined) {
|
||||
// 保留两位小数
|
||||
this.oilLiter = (this.oilGunClearing.amount / this.oilGunClearing.oilPrice).toFixed(2)
|
||||
// 8号枪(21.03L/191.7936元)
|
||||
return `${this.oilGunClearing.gunName}(${this.oilLiter}L/${this.oilGunClearing.amount}元)`
|
||||
|
||||
@ -858,6 +896,11 @@ export default {
|
||||
},
|
||||
|
||||
sendCouponClick() {
|
||||
console.log("数量",this.sendCoupon.tfTotal - this.sendCoupon.tfGetNum)
|
||||
if (this.sendCoupon.tfTotal - this.sendCoupon.tfGetNum <=0){
|
||||
this.$message.error("优惠券已领完")
|
||||
return
|
||||
}
|
||||
//this.sendCoupon this.chooseVipUser.id
|
||||
this.sendCoupon.mtUserId = this.chooseVipUser.id
|
||||
this.sendCoupon.fromType = "4"
|
||||
@ -866,8 +909,14 @@ export default {
|
||||
this.sendCoupon.status = null
|
||||
sendCouponFun(this.sendCoupon).then(
|
||||
res => {
|
||||
this.$message.success("赠送成功")
|
||||
this.freeTicket = false
|
||||
if (res.code == 200){
|
||||
this.$message.success("赠送成功")
|
||||
this.freeTicket = false
|
||||
}
|
||||
else {
|
||||
this.$message.error(res.msg)
|
||||
}
|
||||
|
||||
}
|
||||
)
|
||||
},
|
||||
@ -893,13 +942,18 @@ export default {
|
||||
* */
|
||||
getDisTotal() {
|
||||
this.disTotal = 0.00
|
||||
this.disOil = 0.00
|
||||
if ("" != this.chooseCouponId) {
|
||||
this.disTotal += this.chooseCoupon.disAmount
|
||||
this.disOil = parseFloat(this.disOil)+ parseFloat(this.chooseCoupon.disAmount);
|
||||
}
|
||||
if ("" != this.chooseActId) {
|
||||
this.disTotal += this.chooseAct.disAmount
|
||||
this.disOil = parseFloat(this.disOil)+ parseFloat(this.chooseAct.disAmount);
|
||||
}
|
||||
this.disTotal = (this.disTotal).toFixed(2)
|
||||
|
||||
console.log("油品优惠金额", this.disOil);
|
||||
console.log("商品优惠金额", this.disGoods);
|
||||
|
||||
this.disTotal = parseFloat(this.disOil)+ parseFloat(this.disGoods);
|
||||
},
|
||||
/**
|
||||
* 监听活动选择切换
|
||||
@ -1448,7 +1502,7 @@ export default {
|
||||
oilId: this.oilGunClearing.oilNameId,
|
||||
oilPrice: this.oilGunClearing.oilPrice,
|
||||
oilAmount: this.oilGunClearing.amount,
|
||||
orderAmount: this.orderAmount,
|
||||
// orderAmount: this.orderAmount,
|
||||
payWay: this.payType,
|
||||
oilLiter: this.oilLiter
|
||||
}
|
||||
@ -1464,13 +1518,15 @@ export default {
|
||||
/**
|
||||
* @description 油枪金额和商品金额发生变化,请求后端查询可用优惠券
|
||||
* 传入后台的参数,会员的用户id、加油油号、加油订单金额(不包括商品金额)、加油订单总金额(包括商品金额)、加油总升数
|
||||
* 修改后 会员的用户id、加油油号、加油订单金额、加油总升数 (现在收银台 使用优惠券 是必须有油品才行)
|
||||
* @author vinjor-m
|
||||
* @date 2024年9月19日
|
||||
*/
|
||||
getCoupon() {
|
||||
this.loadingPreferential = true;
|
||||
this.chooseCouponId = ''
|
||||
//组装请求参数
|
||||
if (this.chooseVipUser.hasOwnProperty("id") && (this.goodsList.length > 0 || (this.oilGunClearing != '' && this.oilGunClearing.hasOwnProperty("oilNameId")))) {
|
||||
//组装请求参数 必须有会员id 以及 商品 和 油品的任意一种
|
||||
if (this.chooseVipUser.hasOwnProperty("id") && this.oilGunClearing != '' && this.oilGunClearing.hasOwnProperty("oilNameId") ) {
|
||||
//已选择会员且(选了商品或者加了油)
|
||||
let dataObj = {
|
||||
userId: this.chooseVipUser.id,
|
||||
@ -1479,7 +1535,7 @@ export default {
|
||||
if (this.oilGunClearing != '' && this.oilGunClearing.hasOwnProperty("oilNameId")) {
|
||||
//加油油枪有值
|
||||
dataObj['oilId'] = this.oilGunClearing.oilNameId
|
||||
dataObj['oilAmount'] = this.oilGunClearing.amount
|
||||
dataObj['oilAmount'] = this.oilGunClearing.amount
|
||||
dataObj['oilLiter'] = this.oilLiter
|
||||
}
|
||||
if (this.goodsList.length > 0) {
|
||||
@ -1500,9 +1556,11 @@ export default {
|
||||
getCouponList(dataObj).then(res => {
|
||||
console.log("返回的可用的优惠券", res)
|
||||
this.couponList = res.data
|
||||
this.loadingPreferential = false;
|
||||
})
|
||||
} else {
|
||||
this.couponList = []
|
||||
this.loadingPreferential = false;
|
||||
}
|
||||
},
|
||||
restVipUser() {
|
||||
@ -2048,6 +2106,7 @@ export default {
|
||||
},
|
||||
handleSelect(row) {
|
||||
let bo1 = true
|
||||
console.log('当前选择的商品',row)
|
||||
// 如果 item 存在 goodsList 则 属性+1 不存在直接添加到数组
|
||||
// 使用 map 生成新数组 防止vue监听不到数组内数据变化
|
||||
this.goodsList = this.goodsList.map(
|
||||
|
Loading…
Reference in New Issue
Block a user