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优惠券活动列表
|
// 根据id优惠券活动列表
|
||||||
export function getCardCoupon(id) {
|
export function getCardCoupon(id) {
|
||||||
return request({
|
return request({
|
||||||
|
@ -256,7 +256,7 @@ import {
|
|||||||
} from "@/api/EventMarketing/activeConsumption";
|
} from "@/api/EventMarketing/activeConsumption";
|
||||||
import {listUserGrade} from "@/api/staff/user/usergrade";
|
import {listUserGrade} from "@/api/staff/user/usergrade";
|
||||||
import {getOilNameList} from "@/api/order/oilnumgun";
|
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";
|
import {listUserLabel} from "@/api/staff/user/userlabel";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -538,8 +538,8 @@ export default {
|
|||||||
|
|
||||||
},
|
},
|
||||||
getCardCoupon() {
|
getCardCoupon() {
|
||||||
listCardCoupon({status: 1}).then(res => {
|
getCardCouponNum({status: 1}).then(res => {
|
||||||
this.cardCouponList = res.data.records
|
this.cardCouponList = res.data
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
addPoints(orderType) {
|
addPoints(orderType) {
|
||||||
|
@ -125,7 +125,7 @@ import {
|
|||||||
getActiveFullminus,
|
getActiveFullminus,
|
||||||
updateActiveFullminus
|
updateActiveFullminus
|
||||||
} from "@/api/EventMarketing/activeFullminus";
|
} from "@/api/EventMarketing/activeFullminus";
|
||||||
import {listCardCoupon} from "@/api/EventMarketing/cardCoupon";
|
import {getCardCouponNum} from "@/api/EventMarketing/cardCoupon";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ActiveNewlyweds",
|
name: "ActiveNewlyweds",
|
||||||
@ -255,8 +255,8 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
getCardCoupon() {
|
getCardCoupon() {
|
||||||
listCardCoupon({status: 1}).then(res => {
|
getCardCouponNum({status: 1}).then(res => {
|
||||||
this.cardCouponList = res.data.records
|
this.cardCouponList = res.data
|
||||||
console.log("数据",this.cardCouponList)
|
console.log("数据",this.cardCouponList)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -134,7 +134,7 @@ import {
|
|||||||
} from "@/api/EventMarketing/activeNewlyweds";
|
} from "@/api/EventMarketing/activeNewlyweds";
|
||||||
import {getoilName, listExchange, listFavorable, looklook, looklooklook} from "@/api/EventMarketing/activeConsumption";
|
import {getoilName, listExchange, listFavorable, looklook, looklooklook} from "@/api/EventMarketing/activeConsumption";
|
||||||
import QRCode from "qrcodejs2";
|
import QRCode from "qrcodejs2";
|
||||||
import {listCardCoupon} from "@/api/EventMarketing/cardCoupon";
|
import {getCardCouponNum} from "@/api/EventMarketing/cardCoupon";
|
||||||
import {listUserGrade} from "@/api/staff/user/usergrade";
|
import {listUserGrade} from "@/api/staff/user/usergrade";
|
||||||
import {addActiveBirthday, editActiveBirthday, getActiveBirthday} from "@/api/EventMarketing/activeBirthday";
|
import {addActiveBirthday, editActiveBirthday, getActiveBirthday} from "@/api/EventMarketing/activeBirthday";
|
||||||
|
|
||||||
@ -281,8 +281,8 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
getCardCoupon() {
|
getCardCoupon() {
|
||||||
listCardCoupon({status: 1}).then(res => {
|
getCardCouponNum({status: 1}).then(res => {
|
||||||
this.cardCouponList = res.data.records
|
this.cardCouponList = res.data
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getInfo() {
|
getInfo() {
|
||||||
|
@ -119,7 +119,7 @@ import {
|
|||||||
} from "@/api/EventMarketing/activeNewlyweds";
|
} from "@/api/EventMarketing/activeNewlyweds";
|
||||||
import {getoilName, listExchange, listFavorable, looklook, looklooklook} from "@/api/EventMarketing/activeConsumption";
|
import {getoilName, listExchange, listFavorable, looklook, looklooklook} from "@/api/EventMarketing/activeConsumption";
|
||||||
import QRCode from "qrcodejs2";
|
import QRCode from "qrcodejs2";
|
||||||
import {listCardCoupon} from "@/api/EventMarketing/cardCoupon";
|
import {getCardCouponNum} from "@/api/EventMarketing/cardCoupon";
|
||||||
import {
|
import {
|
||||||
getActiveRecommendInfo,
|
getActiveRecommendInfo,
|
||||||
insertActiveRecommend,
|
insertActiveRecommend,
|
||||||
@ -259,8 +259,8 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
getCardCoupon() {
|
getCardCoupon() {
|
||||||
listCardCoupon({status: 1}).then(res => {
|
getCardCouponNum({status: 1}).then(res => {
|
||||||
this.cardCouponList = res.data.records
|
this.cardCouponList = res.data
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getInfo() {
|
getInfo() {
|
||||||
|
@ -158,7 +158,7 @@ import {
|
|||||||
} from "@/api/EventMarketing/activeNewlyweds";
|
} from "@/api/EventMarketing/activeNewlyweds";
|
||||||
import {getoilName, listExchange, listFavorable, looklook, looklooklook} from "@/api/EventMarketing/activeConsumption";
|
import {getoilName, listExchange, listFavorable, looklook, looklooklook} from "@/api/EventMarketing/activeConsumption";
|
||||||
import QRCode from "qrcodejs2";
|
import QRCode from "qrcodejs2";
|
||||||
import {listCardCoupon} from "@/api/EventMarketing/cardCoupon";
|
import {getCardCouponNum} from "@/api/EventMarketing/cardCoupon";
|
||||||
import {listUserGrade} from "@/api/staff/user/usergrade";
|
import {listUserGrade} from "@/api/staff/user/usergrade";
|
||||||
import {addActivePopUp, editActivePopUp, getActivePopUp} from "@/api/EventMarketing/activePopUp";
|
import {addActivePopUp, editActivePopUp, getActivePopUp} from "@/api/EventMarketing/activePopUp";
|
||||||
|
|
||||||
@ -350,8 +350,8 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
getCardCoupon(){
|
getCardCoupon(){
|
||||||
listCardCoupon({status:1}).then(res => {
|
getCardCouponNum({status:1}).then(res => {
|
||||||
this.cardCouponList = res.data.records
|
this.cardCouponList = res.data
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getInfo(){
|
getInfo(){
|
||||||
|
@ -146,7 +146,7 @@ import {
|
|||||||
} from "@/api/EventMarketing/activeNewlyweds";
|
} from "@/api/EventMarketing/activeNewlyweds";
|
||||||
import {getoilName, listExchange, listFavorable, looklook, looklooklook} from "@/api/EventMarketing/activeConsumption";
|
import {getoilName, listExchange, listFavorable, looklook, looklooklook} from "@/api/EventMarketing/activeConsumption";
|
||||||
import QRCode from "qrcodejs2";
|
import QRCode from "qrcodejs2";
|
||||||
import {listCardCoupon} from "@/api/EventMarketing/cardCoupon";
|
import {getCardCouponNum} from "@/api/EventMarketing/cardCoupon";
|
||||||
import {listUserGrade} from "@/api/staff/user/usergrade";
|
import {listUserGrade} from "@/api/staff/user/usergrade";
|
||||||
import {getOilNameList, oilNumberList} from "@/api/order/oilnumgun";
|
import {getOilNameList, oilNumberList} from "@/api/order/oilnumgun";
|
||||||
import {
|
import {
|
||||||
@ -330,8 +330,8 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
getCardCoupon(){
|
getCardCoupon(){
|
||||||
listCardCoupon({status:1}).then(res => {
|
getCardCouponNum({status:1}).then(res => {
|
||||||
this.cardCouponList = res.data.records
|
this.cardCouponList = res.data
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getInfo(){
|
getInfo(){
|
||||||
|
@ -133,7 +133,7 @@ import {
|
|||||||
} from "@/api/EventMarketing/activeNewlyweds";
|
} from "@/api/EventMarketing/activeNewlyweds";
|
||||||
import {getoilName, listExchange, listFavorable, looklook, looklooklook} from "@/api/EventMarketing/activeConsumption";
|
import {getoilName, listExchange, listFavorable, looklook, looklooklook} from "@/api/EventMarketing/activeConsumption";
|
||||||
import QRCode from "qrcodejs2";
|
import QRCode from "qrcodejs2";
|
||||||
import {listCardCoupon} from "@/api/EventMarketing/cardCoupon";
|
import {getCardCouponNum} from "@/api/EventMarketing/cardCoupon";
|
||||||
import {listUserGrade} from "@/api/staff/user/usergrade";
|
import {listUserGrade} from "@/api/staff/user/usergrade";
|
||||||
import {
|
import {
|
||||||
addActiveUserRecharge,
|
addActiveUserRecharge,
|
||||||
@ -283,8 +283,8 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
getCardCoupon(){
|
getCardCoupon(){
|
||||||
listCardCoupon({status:1}).then(res => {
|
getCardCouponNum({status:1}).then(res => {
|
||||||
this.cardCouponList = res.data.records
|
this.cardCouponList = res.data
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getInfo(){
|
getInfo(){
|
||||||
|
@ -319,6 +319,7 @@
|
|||||||
mt_goods god
|
mt_goods god
|
||||||
left JOIN supplier sup on god.supplier_id = sup.id
|
left JOIN supplier sup on god.supplier_id = sup.id
|
||||||
<where>
|
<where>
|
||||||
|
god.stock > 0 and
|
||||||
<foreach collection="map" item="value" index="key" open="" close="" separator=" AND ">
|
<foreach collection="map" item="value" index="key" open="" close="" separator=" AND ">
|
||||||
<if test="value != null and value != ''">
|
<if test="value != null and value != ''">
|
||||||
${key} = #{value}
|
${key} = #{value}
|
||||||
|
@ -62,6 +62,15 @@ public class CardCouponController extends BaseController {
|
|||||||
return getSuccessResult(this.cardCouponService.pageVo(page, cardCoupon));
|
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();
|
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||||
cardCouponUser.setStoreId(nowAccountInfo.getStoreId());
|
cardCouponUser.setStoreId(nowAccountInfo.getStoreId());
|
||||||
cardCouponUser.setChainStoreId(nowAccountInfo.getChainStoreId());
|
cardCouponUser.setChainStoreId(nowAccountInfo.getChainStoreId());
|
||||||
return getSuccessResult(cardCouponService.sendCoupon(cardCouponUser));
|
return cardCouponService.sendCoupon(cardCouponUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,6 +19,7 @@ import java.util.List;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface CardCouponMapper extends BaseMapper<CardCoupon> {
|
public interface CardCouponMapper extends BaseMapper<CardCoupon> {
|
||||||
IPage<CardCoupon> pageVo(Page page, @Param("cardCoupon") CardCoupon 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> selectAllByPageAndStoreId(Page page, @Param("cardCoupon")CardCoupon cardCoupon);
|
||||||
IPage<CardCouponUniVo> selectAllByPageAndIds(Page page,@Param("ids") List<Integer> ids);
|
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<CardCouponUniVo> selectByStoreIdCount(CardCouponUniVo cardCouponUniVos);
|
||||||
List<CardCoupon> getCanUseCoupon(@Param("cardCoupon") CardCoupon cardCoupon);
|
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);
|
IPage<CardCouponUserVo> queryPage(Page page,@Param("entity") CardCouponUserVo cardCouponUserVo);
|
||||||
|
|
||||||
List<CardCouponUniVo> selectCouponCount(@Param("storeId") Integer storeId,@Param("userId") Integer userId);
|
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
|
FROM
|
||||||
card_coupon cc
|
card_coupon cc
|
||||||
<where>
|
<where>
|
||||||
cc.tf_total - cc.tf_get_num >0
|
|
||||||
<if test="cardCoupon.storeId!=null and cardCoupon.storeId!=''">
|
<if test="cardCoupon.storeId!=null and cardCoupon.storeId!=''">
|
||||||
and cc.store_id = #{cardCoupon.storeId}
|
and cc.store_id = #{cardCoupon.storeId}
|
||||||
</if>
|
</if>
|
||||||
@ -121,5 +120,31 @@
|
|||||||
</where>
|
</where>
|
||||||
order by cc.create_time desc
|
order by cc.create_time desc
|
||||||
</select>
|
</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>
|
</mapper>
|
||||||
|
@ -37,4 +37,24 @@
|
|||||||
WHERE store_id = #{storeId} AND mt_user_id = #{userId}
|
WHERE store_id = #{storeId} AND mt_user_id = #{userId}
|
||||||
group by card_coupon_id
|
group by card_coupon_id
|
||||||
</select>
|
</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>
|
</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.CardCoupon;
|
||||||
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser;
|
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser;
|
||||||
import com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponUniVo;
|
import com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponUniVo;
|
||||||
|
import com.fuint.framework.web.ResponseObject;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -17,6 +18,9 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface CardCouponService extends IService<CardCoupon> {
|
public interface CardCouponService extends IService<CardCoupon> {
|
||||||
IPage<CardCoupon> pageVo(Page page, CardCoupon cardCoupon);
|
IPage<CardCoupon> pageVo(Page page, CardCoupon cardCoupon);
|
||||||
|
|
||||||
|
List<CardCoupon> queryByNum(CardCoupon cardCoupon);
|
||||||
|
|
||||||
List<CardCoupon> getCanUseCoupon(CardCoupon cardCoupon);
|
List<CardCoupon> getCanUseCoupon(CardCoupon cardCoupon);
|
||||||
|
|
||||||
|
|
||||||
@ -28,7 +32,7 @@ public interface CardCouponService extends IService<CardCoupon> {
|
|||||||
int isOnLine(Integer id);
|
int isOnLine(Integer id);
|
||||||
|
|
||||||
IPage selectAllByPageAndStoreId(Page page, CardCoupon cardCoupon);
|
IPage selectAllByPageAndStoreId(Page page, CardCoupon cardCoupon);
|
||||||
int sendCoupon(CardCouponUser cardCouponUser);
|
ResponseObject sendCoupon(CardCouponUser cardCouponUser);
|
||||||
|
|
||||||
CardCoupon selectOneBuId(Integer id);
|
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.business.userManager.vo.LJUserVo;
|
||||||
import com.fuint.common.dto.AccountInfo;
|
import com.fuint.common.dto.AccountInfo;
|
||||||
import com.fuint.common.util.TokenUtil;
|
import com.fuint.common.util.TokenUtil;
|
||||||
|
import com.fuint.framework.web.ResponseObject;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -43,13 +45,15 @@ import java.util.stream.Collectors;
|
|||||||
public class CardCouponServiceImpl extends ServiceImpl<CardCouponMapper, CardCoupon> implements CardCouponService {
|
public class CardCouponServiceImpl extends ServiceImpl<CardCouponMapper, CardCoupon> implements CardCouponService {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CardCouponMapper cardCouponMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CardCouponUserMapper cardCouponUserMapper;
|
private CardCouponUserMapper cardCouponUserMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private LJUserService userService;
|
private LJUserService userService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserBalanceMapper userBalanceMapper;
|
private UserBalanceMapper userBalanceMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<CardCoupon> pageVo(Page page, CardCoupon cardCoupon) {
|
public IPage<CardCoupon> pageVo(Page page, CardCoupon cardCoupon) {
|
||||||
IPage<CardCoupon> cardCouponIPage = baseMapper.pageVo(page, cardCoupon);
|
IPage<CardCoupon> cardCouponIPage = baseMapper.pageVo(page, cardCoupon);
|
||||||
@ -57,6 +61,11 @@ public class CardCouponServiceImpl extends ServiceImpl<CardCouponMapper, CardCou
|
|||||||
return cardCouponIPage;
|
return cardCouponIPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CardCoupon> queryByNum(CardCoupon cardCoupon) {
|
||||||
|
return baseMapper.queryByNum(cardCoupon);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CardCoupon> getCanUseCoupon(CardCoupon cardCoupon) {
|
public List<CardCoupon> getCanUseCoupon(CardCoupon cardCoupon) {
|
||||||
return baseMapper.getCanUseCoupon(cardCoupon);
|
return baseMapper.getCanUseCoupon(cardCoupon);
|
||||||
@ -142,8 +151,35 @@ public class CardCouponServiceImpl extends ServiceImpl<CardCouponMapper, CardCou
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int sendCoupon(CardCouponUser cardCouponUser) {
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public ResponseObject sendCoupon(CardCouponUser cardCouponUser) {
|
||||||
LJUserVo ljUserVo = userService.selectUserById(cardCouponUser.getMtUserId(), cardCouponUser.getStoreId());
|
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());
|
cardCouponUser.setMobile(ljUserVo.getMobile());
|
||||||
//通过优惠卷策略计算 开始时间 结束时间
|
//通过优惠卷策略计算 开始时间 结束时间
|
||||||
CardCoupon cardCoupon = this.getById(cardCouponUser.getCardCouponId());
|
CardCoupon cardCoupon = this.getById(cardCouponUser.getCardCouponId());
|
||||||
@ -154,7 +190,7 @@ public class CardCouponServiceImpl extends ServiceImpl<CardCouponMapper, CardCou
|
|||||||
cardCouponUser.setStartTime(cardCoupon.getEffectiveDateStart());
|
cardCouponUser.setStartTime(cardCoupon.getEffectiveDateStart());
|
||||||
cardCouponUser.setEndTime(cardCoupon.getEffectiveDateEnd());
|
cardCouponUser.setEndTime(cardCoupon.getEffectiveDateEnd());
|
||||||
}
|
}
|
||||||
return cardCouponUserMapper.insert(cardCouponUser);
|
return new ResponseObject(200, "领取成功", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -248,7 +284,6 @@ public class CardCouponServiceImpl extends ServiceImpl<CardCouponMapper, CardCou
|
|||||||
// }
|
// }
|
||||||
// return null;
|
// return null;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
private static void extracted(CardCouponUniVo coupon) {
|
private static void extracted(CardCouponUniVo coupon) {
|
||||||
//计算领取的比例
|
//计算领取的比例
|
||||||
double scale = (coupon.getTfGetNum() == null ? 0 : coupon.getTfGetNum() * 1.0 / coupon.getTfTotal()) * 100;
|
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;
|
private ActiveUserConsumeChildService activeUserConsumeChildService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 收银台获取可用优惠券和可以参加的优惠活动
|
* 收银台获取可以参加的优惠活动
|
||||||
*
|
*
|
||||||
* @param map 请求参数
|
* @param map 请求参数
|
||||||
* @return java.lang.Object
|
* @return java.lang.Object
|
||||||
@ -149,8 +149,6 @@ public class PayCenterServiceImpl implements PayCenterService {
|
|||||||
Double oilPrice = Double.valueOf(map.get("oilPrice"));
|
Double oilPrice = Double.valueOf(map.get("oilPrice"));
|
||||||
//加油金额(不含商品金额)
|
//加油金额(不含商品金额)
|
||||||
Double oilAmount = Double.valueOf(map.get("oilAmount"));
|
Double oilAmount = Double.valueOf(map.get("oilAmount"));
|
||||||
//订单总额(含商品金额)
|
|
||||||
Double orderAmount = Double.valueOf(map.get("orderAmount"));
|
|
||||||
//油升数
|
//油升数
|
||||||
Double oilLiter = Double.valueOf(map.get("oilLiter"));
|
Double oilLiter = Double.valueOf(map.get("oilLiter"));
|
||||||
//支付方式
|
//支付方式
|
||||||
@ -264,7 +262,7 @@ public class PayCenterServiceImpl implements PayCenterService {
|
|||||||
* @param gradeId 会员等级
|
* @param gradeId 会员等级
|
||||||
* @param storeId 店铺id
|
* @param storeId 店铺id
|
||||||
* @param labelIdList 会员标签id集和
|
* @param labelIdList 会员标签id集和
|
||||||
* @param oilAmount 当前加油金额
|
* @param orderAmount 订单金额
|
||||||
* @param oilLiter 当前加油升数
|
* @param oilLiter 当前加油升数
|
||||||
* @param oilId 当前加油选择的油号id
|
* @param oilId 当前加油选择的油号id
|
||||||
* @param payWay 支付方式
|
* @param payWay 支付方式
|
||||||
@ -273,7 +271,7 @@ public class PayCenterServiceImpl implements PayCenterService {
|
|||||||
* @date 17:28 2024/9/21
|
* @date 17:28 2024/9/21
|
||||||
**/
|
**/
|
||||||
private List<ActivityVO> getLijianAct(Date nowDate, Integer userId, Integer gradeId, Integer storeId,
|
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) {
|
Integer oilId, String payWay) {
|
||||||
/*1.先查满足条件的所有生效中的活动规则*/
|
/*1.先查满足条件的所有生效中的活动规则*/
|
||||||
List<ActiveSubPriceRespVO> activeSubPriceList = activeSubPriceService.selectAllAct(storeId, nowDate);
|
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 -> 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.再次过滤,这里过滤掉用户已经超出参加次数限制的*/
|
/*3.再次过滤,这里过滤掉用户已经超出参加次数限制的*/
|
||||||
//符合条件的活动规则,查询当前会员已经参与的记录,此处查立减营销的参与记录
|
//符合条件的活动规则,查询当前会员已经参与的记录,此处查立减营销的参与记录
|
||||||
List<String> actTypeList = Arrays.asList("3".split(StrUtil.COMMA));
|
List<String> actTypeList = Arrays.asList("3".split(StrUtil.COMMA));
|
||||||
@ -313,7 +312,11 @@ public class PayCenterServiceImpl implements PayCenterService {
|
|||||||
activityVO.setType("3");
|
activityVO.setType("3");
|
||||||
activityVO.setActName(rule.getActiveName());
|
activityVO.setActName(rule.getActiveName());
|
||||||
activityVO.setPayTypes(rule.getPaymentType());
|
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);
|
rtnList.add(activityVO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -422,6 +425,8 @@ public class PayCenterServiceImpl implements PayCenterService {
|
|||||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||||
Integer storeId = nowAccountInfo.getStoreId();
|
Integer storeId = nowAccountInfo.getStoreId();
|
||||||
int userId = Integer.parseInt(map.get("userId"));
|
int userId = Integer.parseInt(map.get("userId"));
|
||||||
|
//查询出用户信息
|
||||||
|
UserBalance userBalance = userBalanceService.selectUserBalanceByStorId(userId, storeId);
|
||||||
//油号id
|
//油号id
|
||||||
Integer oilId = Integer.valueOf(map.getOrDefault("oilId", "99999"));
|
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"));
|
Double oilLiter = Double.valueOf(map.getOrDefault("oilLiter", "0"));
|
||||||
//支付方式
|
//支付方式
|
||||||
String payWay = map.get("payWay");
|
String payWay = map.get("payWay");
|
||||||
|
//还需要 加油升数 订单金额
|
||||||
if ("after_pay".equals(payWay)) {
|
if ("after_pay".equals(payWay)) {
|
||||||
//挂账,不可以用优惠券
|
//挂账,不可以用优惠券
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
@ -448,12 +454,15 @@ public class PayCenterServiceImpl implements PayCenterService {
|
|||||||
List<CardCouponVO> filteredList = couponVOList.stream()
|
List<CardCouponVO> filteredList = couponVOList.stream()
|
||||||
//当前时间在 适用时间段内 或者 当前时间不在 不适用时间段内的
|
//当前时间在 适用时间段内 或者 当前时间不在 不适用时间段内的
|
||||||
.filter(rule -> this.checkTimeCouponPrex(rule, nowDate))
|
.filter(rule -> this.checkTimeCouponPrex(rule, nowDate))
|
||||||
|
//过滤会员等级
|
||||||
|
.filter(rule -> checkUtil.checkGradeId(userBalance.getGradeId(), rule.getMembershipLevel()))
|
||||||
//如果是油品券,需要过滤出当前油品可用的
|
//如果是油品券,需要过滤出当前油品可用的
|
||||||
.filter(rule -> checkUtil.checkOilCoupon(rule, oilId))
|
.filter(rule -> checkUtil.checkOilCoupon(rule, oilId))
|
||||||
//如果是油品券,需要过滤出达到满减条件的
|
//如果是油品券,需要过滤出达到满减条件的
|
||||||
.filter(rule -> checkUtil.checkMaxCoupon(rule, oilAmount, oilLiter))
|
.filter(rule -> checkUtil.checkMaxCoupon(rule, oilAmount, oilLiter))
|
||||||
//如果是单品立减券,需要过滤出当前选择的商品可用且满足最低消费金额的
|
//直接 去掉类型是 2,5 卡券类型 1代金券、2兑换券、3折扣券、4油品立减券、5单品代金券
|
||||||
.filter(rule -> checkUtil.checkGoodsCoupon(rule, finalGoodsList)).collect(Collectors.toList());
|
.filter(rule -> rule != null && !Arrays.asList("2", "5").contains(rule.getType()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
if (filteredList.isEmpty()) {
|
if (filteredList.isEmpty()) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
@ -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自定义
|
* 推荐消费有礼 活动时间前置处理 0永久有效;1自定义
|
||||||
@ -1203,7 +1228,7 @@ public class PayCenterServiceImpl implements PayCenterService {
|
|||||||
**/
|
**/
|
||||||
private Boolean checkTimeCouponPrex(CardCouponVO rule, Date nowDate) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
String startTimeStr;
|
String startTimeStr;
|
||||||
@ -1212,12 +1237,14 @@ public class PayCenterServiceImpl implements PayCenterService {
|
|||||||
//适用时间
|
//适用时间
|
||||||
startTimeStr = checkUtil.getTimeFromDate(rule.getAvailablePeriodStart());
|
startTimeStr = checkUtil.getTimeFromDate(rule.getAvailablePeriodStart());
|
||||||
endTimeStr = checkUtil.getTimeFromDate(rule.getAvailablePeriodEnd());
|
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())) {
|
} else if ("1".equals(rule.getAvailableOrUn())) {
|
||||||
//不适用时间
|
//不适用时间
|
||||||
startTimeStr = checkUtil.getTimeFromDate(rule.getUnAvailablePeriodStart());
|
startTimeStr = checkUtil.getTimeFromDate(rule.getUnAvailablePeriodStart());
|
||||||
endTimeStr = checkUtil.getTimeFromDate(rule.getUnAvailablePeriodEnd());
|
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 {
|
} else {
|
||||||
//超出预设值范围,不可用
|
//超出预设值范围,不可用
|
||||||
return false;
|
return false;
|
||||||
|
@ -63,7 +63,7 @@ public class CheckUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断某活动设置的可用会员等级(可以通用 就是比较 某个数值 是否在某组字符串中含有)
|
* 判断某活动设置的可用会员等级(可以通用 就是比较 某个字符串 是否在某组字符串中含有)
|
||||||
*
|
*
|
||||||
* @param gradeId 当前会员的等级
|
* @param gradeId 当前会员的等级
|
||||||
* @param gradeIds 活动设置的会员等级Ids
|
* @param gradeIds 活动设置的会员等级Ids
|
||||||
@ -414,6 +414,8 @@ public class CheckUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断当前加油的油号是否符合优惠券预设的油号----优惠券专用
|
* 判断当前加油的油号是否符合优惠券预设的油号----优惠券专用
|
||||||
*
|
*
|
||||||
@ -450,20 +452,20 @@ public class CheckUtil {
|
|||||||
* 判断当前加油金额或者加油升数是否达到满减条件----优惠券专用
|
* 判断当前加油金额或者加油升数是否达到满减条件----优惠券专用
|
||||||
*
|
*
|
||||||
* @param couponVO 优惠券对象
|
* @param couponVO 优惠券对象
|
||||||
* @param oilAmount 加油金额
|
* @param orderAmount 订单金额
|
||||||
* @param oilLiter 加油升数
|
* @param oilLiter 加油升数
|
||||||
* @return java.lang.Boolean
|
* @return java.lang.Boolean
|
||||||
* @author vinjor-M
|
* @author vinjor-M
|
||||||
* @date 14:42 2024/9/21
|
* @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");
|
List<String> couponTypeList = Arrays.asList("1", "3", "4");
|
||||||
if (couponTypeList.contains(couponVO.getType())) {
|
if (couponTypeList.contains(couponVO.getType())) {
|
||||||
Double thisValue;
|
Double thisValue;
|
||||||
if ("1".equals(couponVO.getUseType())) {
|
if ("1".equals(couponVO.getUseType())) {
|
||||||
//加油金额
|
//订单金额
|
||||||
thisValue = oilAmount;
|
thisValue = orderAmount;
|
||||||
} else if ("2".equals(couponVO.getUseType())) {
|
} else if ("2".equals(couponVO.getUseType())) {
|
||||||
//加油升数
|
//加油升数
|
||||||
thisValue = oilLiter;
|
thisValue = oilLiter;
|
||||||
@ -777,15 +779,15 @@ public class CheckUtil {
|
|||||||
* 根据优惠券优惠规则,计算优惠金额,,四舍五入保留2位小数--优惠券专用
|
* 根据优惠券优惠规则,计算优惠金额,,四舍五入保留2位小数--优惠券专用
|
||||||
*
|
*
|
||||||
* @param coupon 优惠券
|
* @param coupon 优惠券
|
||||||
* @param oilAmount 加油总价
|
* @param orderAmount 订单金额
|
||||||
* @param oilLiter 加油升数
|
* @param oilLiter 加油升数
|
||||||
* @return java.lang.Double
|
* @return java.lang.Double
|
||||||
* @author vinjor-M
|
* @author vinjor-M
|
||||||
* @date 16:35 2024/9/21
|
* @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;
|
Double disAmount = 0.0;
|
||||||
DecimalFormat df = new DecimalFormat("#.00");
|
DecimalFormat df = new DecimalFormat("#.00");
|
||||||
@ -796,7 +798,7 @@ public class CheckUtil {
|
|||||||
} else if ("3".equals(coupon.getType())) {
|
} else if ("3".equals(coupon.getType())) {
|
||||||
//折扣券,打折
|
//折扣券,打折
|
||||||
newOilAmount = newOilAmount * coupon.getZkData();
|
newOilAmount = newOilAmount * coupon.getZkData();
|
||||||
disAmount = oilAmount - newOilAmount;
|
disAmount = orderAmount - newOilAmount;
|
||||||
if (disAmount > coupon.getZkMaxAmount()) {
|
if (disAmount > coupon.getZkMaxAmount()) {
|
||||||
//超出折扣最大优惠金额
|
//超出折扣最大优惠金额
|
||||||
disAmount = coupon.getZkMaxAmount();
|
disAmount = coupon.getZkMaxAmount();
|
||||||
|
@ -73,7 +73,7 @@
|
|||||||
<div style="color: #F4F5F9">|</div>
|
<div style="color: #F4F5F9">|</div>
|
||||||
<div class="three_box">合计:¥{{ orderAmount }}</div>
|
<div class="three_box">合计:¥{{ orderAmount }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-top">
|
<div class="d-top" v-loading="loadingPreferential">
|
||||||
<div class="d-b">
|
<div class="d-b">
|
||||||
|
|
||||||
<el-checkbox v-model="showAct">活动优惠 <i class="el-icon-arrow-down"></i></el-checkbox>
|
<el-checkbox v-model="showAct">活动优惠 <i class="el-icon-arrow-down"></i></el-checkbox>
|
||||||
@ -131,7 +131,9 @@
|
|||||||
<div class="box-bottom">
|
<div class="box-bottom">
|
||||||
<div>
|
<div>
|
||||||
<div class="price_">¥{{ realAmount }}</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>
|
||||||
<div class="anniu" @click="settlement()" :class="{ disabled: !isClickable }">立即结算</div>
|
<div class="anniu" @click="settlement()" :class="{ disabled: !isClickable }">立即结算</div>
|
||||||
</div>
|
</div>
|
||||||
@ -212,7 +214,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="stock_name">{{ item.stock }}</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.retailPrice }}</div>
|
<div class="u-price_name">{{ item.memberPrice}}</div>
|
||||||
<div class="num_name">
|
<div class="num_name">
|
||||||
<el-input-number v-model="goodsList[index].num" @change="handleCilone(goodsList[index])" :max=item.stock
|
<el-input-number v-model="goodsList[index].num" @change="handleCilone(goodsList[index])" :max=item.stock
|
||||||
size="mini" :min="1">
|
size="mini" :min="1">
|
||||||
@ -584,6 +586,9 @@ export default {
|
|||||||
dicts: ['CardCoupon_type'],
|
dicts: ['CardCoupon_type'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
disOil: 0.00,
|
||||||
|
disGoods: 0.00,
|
||||||
|
loadingPreferential: false,
|
||||||
dialogVisible:false,
|
dialogVisible:false,
|
||||||
isClickable: false, // 默认不可点击
|
isClickable: false, // 默认不可点击
|
||||||
payForm: {
|
payForm: {
|
||||||
@ -715,6 +720,40 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
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: {
|
realAmount: {
|
||||||
handler(newVal) {
|
handler(newVal) {
|
||||||
@ -776,6 +815,8 @@ export default {
|
|||||||
console.log('油枪发生变化', newValue);
|
console.log('油枪发生变化', newValue);
|
||||||
if (newValue && newValue.hasOwnProperty("oilNameId")) {
|
if (newValue && newValue.hasOwnProperty("oilNameId")) {
|
||||||
this.orderAmount = (Number(newValue.amount) + Number(this.getGoodsNum)).toFixed(2)
|
this.orderAmount = (Number(newValue.amount) + Number(this.getGoodsNum)).toFixed(2)
|
||||||
|
// 保留两位小数
|
||||||
|
this.oilLiter = (this.oilGunClearing.amount / this.oilGunClearing.oilPrice).toFixed(2)
|
||||||
} else {
|
} else {
|
||||||
this.orderAmount = this.getGoodsNum
|
this.orderAmount = this.getGoodsNum
|
||||||
}
|
}
|
||||||
@ -795,8 +836,7 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.orderAmount = newVal
|
this.orderAmount = newVal
|
||||||
}
|
}
|
||||||
//刷新可用优惠券
|
//商品 没有优惠券了 当前页面不能使用
|
||||||
this.getCoupon()
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
@ -821,8 +861,6 @@ export default {
|
|||||||
},
|
},
|
||||||
getGoodsItem() {
|
getGoodsItem() {
|
||||||
if (this.oilGunClearing.amount && this.oilGunClearing.amount !== undefined) {
|
if (this.oilGunClearing.amount && this.oilGunClearing.amount !== undefined) {
|
||||||
// 保留两位小数
|
|
||||||
this.oilLiter = (this.oilGunClearing.amount / this.oilGunClearing.oilPrice).toFixed(2)
|
|
||||||
// 8号枪(21.03L/191.7936元)
|
// 8号枪(21.03L/191.7936元)
|
||||||
return `${this.oilGunClearing.gunName}(${this.oilLiter}L/${this.oilGunClearing.amount}元)`
|
return `${this.oilGunClearing.gunName}(${this.oilLiter}L/${this.oilGunClearing.amount}元)`
|
||||||
|
|
||||||
@ -858,6 +896,11 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
sendCouponClick() {
|
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 this.chooseVipUser.id
|
||||||
this.sendCoupon.mtUserId = this.chooseVipUser.id
|
this.sendCoupon.mtUserId = this.chooseVipUser.id
|
||||||
this.sendCoupon.fromType = "4"
|
this.sendCoupon.fromType = "4"
|
||||||
@ -866,9 +909,15 @@ export default {
|
|||||||
this.sendCoupon.status = null
|
this.sendCoupon.status = null
|
||||||
sendCouponFun(this.sendCoupon).then(
|
sendCouponFun(this.sendCoupon).then(
|
||||||
res => {
|
res => {
|
||||||
|
if (res.code == 200){
|
||||||
this.$message.success("赠送成功")
|
this.$message.success("赠送成功")
|
||||||
this.freeTicket = false
|
this.freeTicket = false
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
this.$message.error(res.msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
handleCilone(obj) {
|
handleCilone(obj) {
|
||||||
@ -893,13 +942,18 @@ export default {
|
|||||||
* */
|
* */
|
||||||
getDisTotal() {
|
getDisTotal() {
|
||||||
this.disTotal = 0.00
|
this.disTotal = 0.00
|
||||||
|
this.disOil = 0.00
|
||||||
if ("" != this.chooseCouponId) {
|
if ("" != this.chooseCouponId) {
|
||||||
this.disTotal += this.chooseCoupon.disAmount
|
this.disOil = parseFloat(this.disOil)+ parseFloat(this.chooseCoupon.disAmount);
|
||||||
}
|
}
|
||||||
if ("" != this.chooseActId) {
|
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,
|
oilId: this.oilGunClearing.oilNameId,
|
||||||
oilPrice: this.oilGunClearing.oilPrice,
|
oilPrice: this.oilGunClearing.oilPrice,
|
||||||
oilAmount: this.oilGunClearing.amount,
|
oilAmount: this.oilGunClearing.amount,
|
||||||
orderAmount: this.orderAmount,
|
// orderAmount: this.orderAmount,
|
||||||
payWay: this.payType,
|
payWay: this.payType,
|
||||||
oilLiter: this.oilLiter
|
oilLiter: this.oilLiter
|
||||||
}
|
}
|
||||||
@ -1464,13 +1518,15 @@ export default {
|
|||||||
/**
|
/**
|
||||||
* @description 油枪金额和商品金额发生变化,请求后端查询可用优惠券
|
* @description 油枪金额和商品金额发生变化,请求后端查询可用优惠券
|
||||||
* 传入后台的参数,会员的用户id、加油油号、加油订单金额(不包括商品金额)、加油订单总金额(包括商品金额)、加油总升数
|
* 传入后台的参数,会员的用户id、加油油号、加油订单金额(不包括商品金额)、加油订单总金额(包括商品金额)、加油总升数
|
||||||
|
* 修改后 会员的用户id、加油油号、加油订单金额、加油总升数 (现在收银台 使用优惠券 是必须有油品才行)
|
||||||
* @author vinjor-m
|
* @author vinjor-m
|
||||||
* @date 2024年9月19日
|
* @date 2024年9月19日
|
||||||
*/
|
*/
|
||||||
getCoupon() {
|
getCoupon() {
|
||||||
|
this.loadingPreferential = true;
|
||||||
this.chooseCouponId = ''
|
this.chooseCouponId = ''
|
||||||
//组装请求参数
|
//组装请求参数 必须有会员id 以及 商品 和 油品的任意一种
|
||||||
if (this.chooseVipUser.hasOwnProperty("id") && (this.goodsList.length > 0 || (this.oilGunClearing != '' && this.oilGunClearing.hasOwnProperty("oilNameId")))) {
|
if (this.chooseVipUser.hasOwnProperty("id") && this.oilGunClearing != '' && this.oilGunClearing.hasOwnProperty("oilNameId") ) {
|
||||||
//已选择会员且(选了商品或者加了油)
|
//已选择会员且(选了商品或者加了油)
|
||||||
let dataObj = {
|
let dataObj = {
|
||||||
userId: this.chooseVipUser.id,
|
userId: this.chooseVipUser.id,
|
||||||
@ -1500,9 +1556,11 @@ export default {
|
|||||||
getCouponList(dataObj).then(res => {
|
getCouponList(dataObj).then(res => {
|
||||||
console.log("返回的可用的优惠券", res)
|
console.log("返回的可用的优惠券", res)
|
||||||
this.couponList = res.data
|
this.couponList = res.data
|
||||||
|
this.loadingPreferential = false;
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.couponList = []
|
this.couponList = []
|
||||||
|
this.loadingPreferential = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
restVipUser() {
|
restVipUser() {
|
||||||
@ -2048,6 +2106,7 @@ export default {
|
|||||||
},
|
},
|
||||||
handleSelect(row) {
|
handleSelect(row) {
|
||||||
let bo1 = true
|
let bo1 = true
|
||||||
|
console.log('当前选择的商品',row)
|
||||||
// 如果 item 存在 goodsList 则 属性+1 不存在直接添加到数组
|
// 如果 item 存在 goodsList 则 属性+1 不存在直接添加到数组
|
||||||
// 使用 map 生成新数组 防止vue监听不到数组内数据变化
|
// 使用 map 生成新数组 防止vue监听不到数组内数据变化
|
||||||
this.goodsList = this.goodsList.map(
|
this.goodsList = this.goodsList.map(
|
||||||
|
Loading…
Reference in New Issue
Block a user