diff --git a/fuintAdmin/src/assets/styles/element-ui.scss b/fuintAdmin/src/assets/styles/element-ui.scss index 7a437847a..1f30b7fb7 100644 --- a/fuintAdmin/src/assets/styles/element-ui.scss +++ b/fuintAdmin/src/assets/styles/element-ui.scss @@ -124,3 +124,14 @@ .el-pagination.is-background .el-pager li:hover{ color: #FF9655 !important;/*hover时候的文字颜色*/ } + +/* 修改选中状态的背景色 */ +.el-radio .el-radio__input.is-checked .el-radio__inner { + background-color: #FF9655; /* 你想要的任何颜色 */ + border-color: #FF9655; +} + +/* 修改选中状态的文字颜色 */ +.el-radio .el-radio__input.is-checked+ .el-radio__label { + color: #FF9655 !important; /* 文字颜色 */ +} diff --git a/fuintAdmin/src/views/userGrade/index.vue b/fuintAdmin/src/views/userGrade/index.vue index 0120f5b65..92c5c4487 100644 --- a/fuintAdmin/src/views/userGrade/index.vue +++ b/fuintAdmin/src/views/userGrade/index.vue @@ -647,7 +647,7 @@ - + @@ -677,30 +677,25 @@ -
-
- - - {{ item }} -
-
+ + 可用 + 不可用 +
-
- - - {{ item }} -
+ + 永久 + 自定义 + + - 至 +
- -
-
- - - {{ item }} - - - - + + + + 适用时间段 + 不可用时间段 + + + +
+ +
+ 每周 + + + +
+ + 每月 + -
+ +
@@ -749,28 +751,25 @@
- +
-
- - - {{ item }} - - - - - - - -
+ + 每周 + + + + + 每月 + + + + + +
@@ -1107,7 +1106,9 @@ export default { catchTypeList: [], // 是否显示弹出层 open: false, - form2: {}, + form2: { + availableOrUn:'0' + }, open2: false, gradeList: [], @@ -1178,6 +1179,9 @@ export default { total2: 0, // 表单校验 rules: { + availableOrUn:[ + {required: true, message: "不能为空", trigger: "blur"}, + ], grade: [ {required: true, message: "升降顺序不能为空", trigger: "blur"}, {pattern: /^[0-9]{1,10}$/, message: `必须正整数`, trigger: 'blur'} @@ -1244,14 +1248,17 @@ export default { suitTimeSlotType: [ {required: true, message: "请选择适用时间段", trigger: "blur"}, ], + noUseTimeType: [ + {required: true, message: "请选择不适用时间段", trigger: "blur"}, + ], suitTimeSlotFront: [ {required: true, message: "请选择适用时间段", trigger: "blur"}, ], noUseDate: [ - {required: true, message: "请选择指定不可用日期", trigger: "blur"}, + {required: true, message: "请选择不适用时间段", trigger: "blur"}, ], noUseTimeFront: [ - {required: true, message: "请选择指定不可用日期", trigger: "blur"}, + {required: true, message: "请选择不适用时间段", trigger: "blur"}, ], } }; @@ -1374,10 +1381,11 @@ export default { handleAdd2() { this.form2 = { usePaymentWay: [], - holidayIsUse: 0, - suitDateType: 0, - suitTimeSlotType: 0, - noUseTimeType: 0, + holidayIsUse: '0', + suitDateType: '0', + suitTimeSlotType: '0', + noUseTimeType: '0', + availableOrUn:'0' } this.weekDay = [] this.monthDay = [] diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/controller/FleetLinesChangeController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/controller/FleetLinesChangeController.java new file mode 100644 index 000000000..479faa0ff --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/controller/FleetLinesChangeController.java @@ -0,0 +1,41 @@ +package com.fuint.business.fleet.controller; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.fuint.business.fleet.service.IFleetLinesChangeService; +import com.fuint.business.fleet.vo.FleetLinesChangeVo; +import com.fuint.business.order.dto.CardBalanceChangeDto; +import com.fuint.business.order.vo.CardBalanceChangeVo; +import com.fuint.framework.web.BaseController; +import com.fuint.framework.web.ResponseObject; +import io.lettuce.core.dynamic.annotation.Param; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestParam; + +/** + *

+ * 车队额度变化表 前端控制器 + *

+ * + * @author dianliang + * @since 2024-09-25 + */ +@Controller +@RequestMapping("/fleet-lines-change") +public class FleetLinesChangeController extends BaseController { + + @Autowired + private IFleetLinesChangeService fleetLinesChangeService; + public ResponseObject queryByPageUni(@RequestParam(value = "page",defaultValue = "1") Integer page, + @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize, + @Param("integralDetail") FleetLinesChangeVo fleetLinesChangeVo) { + Page page1 = new Page(page, pageSize); + IPage iPageList = fleetLinesChangeService.queryByPageUni(page1, fleetLinesChangeVo); + return getSuccessResult(iPageList); + } + +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/entity/FleetLinesChange.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/entity/FleetLinesChange.java new file mode 100644 index 000000000..9767ba744 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/entity/FleetLinesChange.java @@ -0,0 +1,70 @@ +package com.fuint.business.fleet.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 车队额度变化表 + *

+ * + * @author dianliang + * @since 2024-09-25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("fleet_lines_change") +@ApiModel(value="FleetLinesChange对象", description="车队额度变化表") +public class FleetLinesChange implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "车队id") + private Integer fleetId; + + @ApiModelProperty(value = "店铺id") + private Integer storeId; + + @ApiModelProperty(value = "调整类型:0增加、1扣除") + private String adjustType; + + @ApiModelProperty(value = "调整额度") + private BigDecimal adjustLimit; + + @ApiModelProperty(value = "创建人") + private String createBy; + + @ApiModelProperty(value = "创建时间") + private LocalDateTime createTime; + + @ApiModelProperty(value = "更新人") + private String updateBy; + + @ApiModelProperty(value = "更新时间") + private LocalDateTime updateTime; + + @ApiModelProperty(value = "剩余额度") + private BigDecimal remainingCreditLimit; + + @ApiModelProperty(value = "被调整额度的用户id") + private Integer userId; + + @ApiModelProperty(value = "订单id") + private Integer orderId; + + +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/mapper/FleetLinesChangeMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/mapper/FleetLinesChangeMapper.java new file mode 100644 index 000000000..012a080f3 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/mapper/FleetLinesChangeMapper.java @@ -0,0 +1,20 @@ +package com.fuint.business.fleet.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.fuint.business.fleet.entity.FleetLinesChange; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.fuint.business.fleet.vo.FleetLinesChangeVo; + +/** + *

+ * 车队额度变化表 Mapper 接口 + *

+ * + * @author dianliang + * @since 2024-09-25 + */ +public interface FleetLinesChangeMapper extends BaseMapper { + + IPage queryAllByLimit(Page page1, FleetLinesChangeVo fleetLinesChangeVo); +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/mapper/xml/FleetLinesChangeMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/mapper/xml/FleetLinesChangeMapper.xml new file mode 100644 index 000000000..b5fb9dbf0 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/mapper/xml/FleetLinesChangeMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/fuintBackend/fuint-application/src/main/resources/mapper/MtUserFuelMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/mapper/xml/MtUserFuelMapper.xml similarity index 100% rename from fuintBackend/fuint-application/src/main/resources/mapper/MtUserFuelMapper.xml rename to fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/mapper/xml/MtUserFuelMapper.xml diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/FleetInfoService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/FleetInfoService.java index 9259db0fd..095bc2185 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/FleetInfoService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/FleetInfoService.java @@ -6,6 +6,8 @@ import com.fuint.business.fleet.entity.FleetInfo; import com.fuint.business.fleet.vo.FleetInfoUniVo; import com.fuint.business.fleet.vo.FleetInfoVo; +import java.util.List; + /** * 车队信息(FleetInfo)表服务接口 * @@ -65,7 +67,7 @@ public interface FleetInfoService { * @param storeId * @return */ - FleetInfoUniVo queryByStoreId(Integer storeId); + List queryByStoreId(Integer storeId); /** * 新增车队信息(小程序) diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/IFleetLinesChangeService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/IFleetLinesChangeService.java new file mode 100644 index 000000000..54589f218 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/IFleetLinesChangeService.java @@ -0,0 +1,20 @@ +package com.fuint.business.fleet.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.fuint.business.fleet.entity.FleetLinesChange; +import com.baomidou.mybatisplus.extension.service.IService; +import com.fuint.business.fleet.vo.FleetLinesChangeVo; + +/** + *

+ * 车队额度变化表 服务类 + *

+ * + * @author dianliang + * @since 2024-09-25 + */ +public interface IFleetLinesChangeService extends IService { + + IPage queryByPageUni(Page page1, FleetLinesChangeVo fleetLinesChangeVo); +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetInfoServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetInfoServiceImpl.java index 4fb9f0d26..9ddbc71b3 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetInfoServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetInfoServiceImpl.java @@ -1,6 +1,7 @@ package com.fuint.business.fleet.service.impl; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -35,9 +36,11 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.Random; +import java.util.stream.Collectors; /** @@ -219,22 +222,29 @@ public class FleetInfoServiceImpl extends ServiceImpl * @return */ @Override - public FleetInfoUniVo queryByStoreId(Integer storeId) { + public List queryByStoreId(Integer storeId) { AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); - - FleetInfo fleetInfo = baseMapper.selectOne(new LambdaQueryWrapper() - .eq(FleetInfo::getStoreId, storeId) - .eq(FleetInfo::getUserId, nowAccountInfo.getId()) - .last("limit 1")); - - if (ObjectUtil.isEmpty(fleetInfo)) { - throw new RuntimeException("该会员未绑定车队"); + //查询当前登录人的车队信息 + List fleetMembers = fleetMemberMapper.selectList(new LambdaQueryWrapper() + .eq(FleetMember::getStoreId, storeId) + .eq(FleetMember::getUserId, nowAccountInfo.getId())); + //获取所在车队的id集合 + List fleetIds = fleetMembers.stream().map(FleetMember::getFleetId).collect(Collectors.toList()); + if (CollUtil.isEmpty(fleetIds)) { + throw new RuntimeException("未绑定车队"); } -// FleetInfo fleetInfo = baseMapper.selectById(fleetMember.getFleetId()); - FleetInfoUniVo fleetInfoUniVo = BeanUtil.copyProperties(fleetInfo, FleetInfoUniVo.class); - fleetInfoUniVo.setStoreName(mtStoreMapper.selectById(storeId).getName()); - return fleetInfoUniVo; + List fleetInfos = baseMapper.selectList(new LambdaQueryWrapper() + .eq(FleetInfo::getStoreId, storeId) + .in(FleetInfo::getId, fleetIds)); + + List fleetInfoUniVos = new ArrayList<>(); + for (FleetInfo fleetInfo : fleetInfos) { + FleetInfoUniVo fleetInfoUniVo = BeanUtil.copyProperties(fleetInfo, FleetInfoUniVo.class); + fleetInfoUniVo.setStoreName(mtStoreMapper.selectById(storeId).getName()); + fleetInfoUniVos.add(fleetInfoUniVo); + } + return fleetInfoUniVos; } /** diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetLinesChangeServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetLinesChangeServiceImpl.java new file mode 100644 index 000000000..58267200b --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/service/impl/FleetLinesChangeServiceImpl.java @@ -0,0 +1,42 @@ +package com.fuint.business.fleet.service.impl; + +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.fuint.business.fleet.entity.FleetLinesChange; +import com.fuint.business.fleet.mapper.FleetLinesChangeMapper; +import com.fuint.business.fleet.service.IFleetLinesChangeService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fuint.business.fleet.vo.FleetLinesChangeVo; +import com.fuint.common.dto.AccountInfo; +import com.fuint.common.util.TokenUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + *

+ * 车队额度变化表 服务实现类 + *

+ * + * @author dianliang + * @since 2024-09-25 + */ +@Service +public class FleetLinesChangeServiceImpl extends ServiceImpl implements IFleetLinesChangeService { + + @Autowired + private FleetLinesChangeMapper fleetLinesChangeMapper; + @Override + public IPage queryByPageUni(Page page1, FleetLinesChangeVo fleetLinesChangeVo) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + fleetLinesChangeVo.setUserId(nowAccountInfo.getId()); + if (ObjectUtil.isNotEmpty(fleetLinesChangeVo.getStartTime())) { + DateTime parse = DateUtil.parse(fleetLinesChangeVo.getStartTime(), "yyyy-MM"); + fleetLinesChangeVo.setStartTime(DateUtil.beginOfMonth(parse).toString()); + fleetLinesChangeVo.setEndTime(DateUtil.endOfMonth(parse).toString()); + } + return this.baseMapper.queryAllByLimit(page1, fleetLinesChangeVo); + } +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/vo/FleetLinesChangeVo.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/vo/FleetLinesChangeVo.java new file mode 100644 index 000000000..d4d89ec50 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/fleet/vo/FleetLinesChangeVo.java @@ -0,0 +1,23 @@ +package com.fuint.business.fleet.vo; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fuint.business.fleet.entity.FleetLinesChange; +import lombok.Data; + +@Data +public class FleetLinesChangeVo extends FleetLinesChange { + /** + * 用户名称 + */ + private String userName; + /** + * 操作人名称 + */ + private String creatName; + + @JsonIgnore + private String startTime; + + @JsonIgnore + private String endTime; +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/entity/IntegralGift.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/entity/IntegralGift.java index 4f2de9e03..744262c5e 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/entity/IntegralGift.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/entity/IntegralGift.java @@ -128,5 +128,15 @@ public class IntegralGift extends BaseEntity { */ private Integer storeId; + /** + * 兑换说明 + */ + private String exchangeInstructions; + + /** + * 使用须知 + */ + private String useInstructions; + } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/controller/CardCouponController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/controller/CardCouponController.java index 328752d6b..95331d536 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/controller/CardCouponController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/controller/CardCouponController.java @@ -148,7 +148,7 @@ public class CardCouponController extends BaseController { public ResponseObject selectAllByPageAndStoreId(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo, @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize, @Param("cardCoupon") CardCoupon cardCoupon) { Page page = new Page(pageNo, pageSize); - return getSuccessResult(this.cardCouponService.pageVo(page, cardCoupon)); + return getSuccessResult(this.cardCouponService.selectAllByPageAndStoreId(page, cardCoupon)); } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/entity/CardCoupon.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/entity/CardCoupon.java index 7f9d3bea2..33da5ad28 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/entity/CardCoupon.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/entity/CardCoupon.java @@ -66,6 +66,8 @@ public class CardCoupon extends Model { private Integer zkStartAmount; //折扣卷满多少元的终 private Integer zkEndAmount; + //折扣最大优惠金额 + private Double zkMaxAmount; //适用会员等级 可多选 private String membershipLevel; //生效日期类型1.领取后多少天内有效 2指定具体使用日期 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/CardCouponMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/CardCouponMapper.java index bc32e70b6..ea5f2d758 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/CardCouponMapper.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/CardCouponMapper.java @@ -4,9 +4,12 @@ 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.cardCoupon.entity.CardCoupon; +import com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponUniVo; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * 油站优惠卷表2024(CardCoupon)表数据库访问层 * @@ -17,5 +20,6 @@ import org.apache.ibatis.annotations.Param; public interface CardCouponMapper extends BaseMapper { IPage pageVo(Page page, @Param("cardCoupon") CardCoupon cardCoupon); + IPage selectAllByPageAndStoreId(Page page, @Param("cardCoupon")CardCoupon cardCoupon); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/xml/CardCouponMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/xml/CardCouponMapper.xml index 4be750732..d1e0241ef 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/xml/CardCouponMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/xml/CardCouponMapper.xml @@ -27,5 +27,44 @@ order by cc.create_time desc + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/xml/CardCouponUserMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/xml/CardCouponUserMapper.xml index 6550b31ef..d3ee783ef 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/xml/CardCouponUserMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/xml/CardCouponUserMapper.xml @@ -8,7 +8,7 @@ main.mt_user_id AS mtUserId FROM card_coupon_user main - LEFT JOIN card_coupon cc ON main.card_coupon_id = cc.id + INNER JOIN card_coupon cc ON main.card_coupon_id = cc.id WHERE main.store_id = #{storeId} AND main.mt_user_id = #{userId} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/CardCouponService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/CardCouponService.java index 7b23fce67..81631d374 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/CardCouponService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/CardCouponService.java @@ -20,5 +20,7 @@ public interface CardCouponService extends IService { * @return */ int isOnLine(Integer id); + + IPage selectAllByPageAndStoreId(Page page, CardCoupon cardCoupon); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/CardCouponUserService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/CardCouponUserService.java index dc104a17e..caac2f6d8 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/CardCouponUserService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/CardCouponUserService.java @@ -44,5 +44,15 @@ public interface CardCouponUserService extends IService { * @return */ IPage queryPage(Page page,CardCouponUserVo cardCouponUserVo); + + /** + * 查某用户某些优惠券的使用记录 + * @author vinjor-M + * @date 17:31 2024/9/25 + * @param userId 用户id + * @param couponIdList 优惠券idList + * @return java.util.List + **/ + List selectListByUsed(Integer userId,List couponIdList); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/impl/CardCouponServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/impl/CardCouponServiceImpl.java index 8f09a2de7..6dd229a56 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/impl/CardCouponServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/impl/CardCouponServiceImpl.java @@ -1,14 +1,26 @@ package com.fuint.business.marketingActivity.cardCoupon.service.impl; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.mapper.CardCouponMapper; import com.fuint.business.marketingActivity.cardCoupon.service.CardCouponService; +import com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponUniVo; +import com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponVO; +import com.fuint.business.store.entity.MtStore; +import com.fuint.business.store.mapper.MtStoreMapper; +import com.fuint.common.dto.AccountInfo; +import com.fuint.common.util.TokenUtil; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; +import java.util.List; + /** * 油站优惠卷表2024(CardCoupon)表服务实现类 * @@ -18,6 +30,8 @@ import org.springframework.stereotype.Service; @Service("cardCouponService") public class CardCouponServiceImpl extends ServiceImpl implements CardCouponService { + @Autowired + private MtStoreMapper mtStoreMapper; @Override public IPage pageVo(Page page, CardCoupon cardCoupon) { return baseMapper.pageVo( page, cardCoupon); @@ -32,5 +46,27 @@ public class CardCouponServiceImpl extends ServiceImpl cardCouponUniVos = baseMapper.selectAllByPageAndStoreId(page, cardCoupon); + + List cardCouponVos = new ArrayList<>(); + //循环店铺优惠券 + for (CardCouponUniVo coupon : cardCouponUniVos.getRecords()) { + //查询该优惠券是否已到达限制数量 + if (coupon.getTfGetNum() < coupon.getTfTotal()){ + CardCouponUniVo cardCouponUniVo = BeanUtil.copyProperties(coupon, CardCouponUniVo.class); + //计算领取的比例 + double scale = (coupon.getTfGetNum() * 1.0 / coupon.getTfTotal()) * 100; + cardCouponUniVo.setScale(scale + "%"); + } + } + return cardCouponUniVos; + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/impl/CardCouponUserServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/impl/CardCouponUserServiceImpl.java index b73932e9b..f3edda2f1 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/impl/CardCouponUserServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/service/impl/CardCouponUserServiceImpl.java @@ -145,5 +145,24 @@ public class CardCouponUserServiceImpl extends ServiceImpl + * @author vinjor-M + * @date 17:31 2024/9/25 + **/ + @Override + public List selectListByUsed(Integer userId, List couponIdList) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() + .eq(CardCouponUser::getMtUserId,userId) + .in(CardCouponUser::getCardCouponId,couponIdList) + //已核销的 + .eq(CardCouponUser::getStatus,"1"); + return this.list(queryWrapper); + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/vo/CardCouponUniVo.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/vo/CardCouponUniVo.java new file mode 100644 index 000000000..c4a75b6ed --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/vo/CardCouponUniVo.java @@ -0,0 +1,14 @@ +package com.fuint.business.marketingActivity.cardCoupon.vo; + +import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon; +import lombok.Data; + +@Data +public class CardCouponUniVo extends CardCoupon { + //店铺名称 + private String storeName; + //已领取比例 + private String scale; + //兑换券类型 + private String typeName; +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardGift/service/impl/CardGiftServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardGift/service/impl/CardGiftServiceImpl.java index 48c68c7ec..834c3f872 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardGift/service/impl/CardGiftServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardGift/service/impl/CardGiftServiceImpl.java @@ -1,5 +1,6 @@ package com.fuint.business.marketingActivity.cardGift.service.impl; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; @@ -12,6 +13,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.fuint.business.marketingActivity.cardGift.mapper.CardGiftMapper; import com.fuint.business.marketingActivity.cardGift.entity.CardGift; import com.fuint.business.marketingActivity.cardGift.service.CardGiftService; +import com.fuint.business.marketingActivity.cardGift.vo.CardGiftVo; +import com.fuint.business.marketingActivity.cardGiftActive.entity.CardGiftActive; +import com.fuint.business.marketingActivity.cardGiftActive.mapper.CardGiftActiveMapper; import com.fuint.business.member.entity.LJStaff; import com.fuint.business.member.service.ILJStaffService; import com.fuint.business.oilDepotConfiguration.entity.OilDepotConfig; @@ -30,6 +34,7 @@ import com.fuint.common.util.TokenUtil; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.SecurityUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; @@ -64,6 +69,8 @@ public class CardGiftServiceImpl extends ServiceImpl i private LJUserService ljUserService; @Resource private ILJStaffService ljStaffService; + @Autowired + private CardGiftActiveMapper cardGiftActiveMapper; /** * 新增数据 @@ -246,7 +253,23 @@ public class CardGiftServiceImpl extends ServiceImpl i LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(CardGift::getUserId,userId); queryWrapper.orderByDesc(CardGift::getUpdateTime); - return page(page,queryWrapper); + IPage page1 = page(page, queryWrapper); + List cardGiftVos = new ArrayList<>(); + for (Object record : page1.getRecords()) { + CardGiftVo cardGiftVo = BeanUtil.copyProperties(record, CardGiftVo.class); + CardGiftActive cardGiftActive = cardGiftActiveMapper.selectOne(new LambdaQueryWrapper() + .eq(CardGiftActive::getId, cardGiftVo.getActiveId()) + .last("limit 1")); + if (ObjectUtils.isNotEmpty(cardGiftActive)) { + cardGiftVo.setActiveName(cardGiftActive.getActiveName()); + } + cardGiftVos.add(cardGiftVo); + } + page1.setRecords(cardGiftVos); + + //查询兑换记录的活动名称 + + return page1; } /** diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardGift/vo/CardGiftVo.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardGift/vo/CardGiftVo.java new file mode 100644 index 000000000..ffe1ee7a4 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardGift/vo/CardGiftVo.java @@ -0,0 +1,9 @@ +package com.fuint.business.marketingActivity.cardGift.vo; + +import com.fuint.business.marketingActivity.cardGift.entity.CardGift; +import lombok.Data; + +@Data +public class CardGiftVo extends CardGift { + private String activeName; +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/GrowthValueChangeMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/GrowthValueChangeMapper.xml index 5506cf6da..0940cb5ae 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/GrowthValueChangeMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/GrowthValueChangeMapper.xml @@ -11,6 +11,9 @@ and gvc.user_id = #{growthValueChange.userId} + + and gvc.from_type = #{growthValueChange.fromType} + and gvc.create_time between #{growthValueChange.startTime} and #{growthValueChange.endTime} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/MtUserExpressAddressController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/MtUserExpressAddressController.java index 339ac6fec..d3b3bcf83 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/MtUserExpressAddressController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/controller/MtUserExpressAddressController.java @@ -89,6 +89,7 @@ public class MtUserExpressAddressController extends BaseController { /** * 查询默认快递地址 */ + @GetMapping("getDefault") public ResponseObject getDefault() { return getSuccessResult(this.mtUserExpressAddressService.getDefault()); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/MtUserExpressAddressMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/MtUserExpressAddressMapper.java index 8812c70a8..02bb415d8 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/MtUserExpressAddressMapper.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/MtUserExpressAddressMapper.java @@ -1,5 +1,6 @@ package com.fuint.business.userManager.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.userManager.entity.MtUserExpressAddress; @@ -14,7 +15,7 @@ import java.util.List; * @author makejava * @since 2023-11-09 09:31:12 */ -public interface MtUserExpressAddressMapper { +public interface MtUserExpressAddressMapper extends BaseMapper { /** * 通过ID查询单条数据 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/MtUserExpressAddressServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/MtUserExpressAddressServiceImpl.java index 216c269a4..565354ea4 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/MtUserExpressAddressServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/MtUserExpressAddressServiceImpl.java @@ -1,8 +1,10 @@ package com.fuint.business.userManager.service.impl; import cn.hutool.core.util.ObjectUtil; +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.userManager.entity.MtUserExpressAddress; import com.fuint.business.userManager.mapper.MtUserExpressAddressMapper; import com.fuint.business.userManager.service.MtUserExpressAddressService; @@ -21,7 +23,7 @@ import java.util.List; * @since 2023-11-09 09:31:33 */ @Service("mtUserExpressAddressService") -public class MtUserExpressAddressServiceImpl implements MtUserExpressAddressService { +public class MtUserExpressAddressServiceImpl extends ServiceImpl implements MtUserExpressAddressService { @Resource private MtUserExpressAddressMapper mtUserExpressAddressMapper; @@ -101,8 +103,10 @@ public class MtUserExpressAddressServiceImpl implements MtUserExpressAddressServ @Override public MtUserExpressAddress getDefault() { AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); - - return null; + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("user_id", nowAccountInfo.getId()); + queryWrapper.eq("if_default", "1"); + return baseMapper.selectOne(queryWrapper); } @Override diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/pay/service/impl/PayCenterServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/pay/service/impl/PayCenterServiceImpl.java index 8740166f6..f68d40643 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/pay/service/impl/PayCenterServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/pay/service/impl/PayCenterServiceImpl.java @@ -3,6 +3,8 @@ package com.fuint.pay.service.impl; import cn.hutool.core.date.DateField; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONArray; +import cn.hutool.json.JSONUtil; import com.alibaba.fastjson.JSONObject; import com.fuint.business.marketingActivity.activePrice.entity.ActivePriceRecord; import com.fuint.business.marketingActivity.activePrice.entity.ActivePriceRule; @@ -13,6 +15,8 @@ import com.fuint.business.marketingActivity.activePrice.service.ActivePriceServi import com.fuint.business.marketingActivity.activePrice.service.ActiveSubPriceService; import com.fuint.business.marketingActivity.activePrice.vo.ActivePriceRuleRespVO; import com.fuint.business.marketingActivity.activePrice.vo.ActiveSubPriceRespVO; +import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon; +import com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser; import com.fuint.business.marketingActivity.cardCoupon.service.CardCouponUserService; import com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponVO; import com.fuint.business.userGroup.entity.UserDiscount; @@ -27,6 +31,7 @@ import com.fuint.pay.service.PayCenterService; import com.fuint.pay.util.CheckUtil; import com.fuint.pay.vo.ActivityVO; import com.fuint.pay.vo.CouponVO; +import com.fuint.pay.vo.GoodsVO; import com.google.common.collect.ImmutableList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -166,11 +171,13 @@ public class PayCenterServiceImpl implements PayCenterService { List actTypeList = Arrays.asList("1,2".split(StrUtil.COMMA)); List recordAllList = activePriceRecordService.selectListByUserIdAndActIds(userId, filteredList.stream().map(ActivePriceRuleRespVO::getId).collect(Collectors.toList()),null,actTypeList); - filteredList = filteredList.stream() - //过滤掉超过每日参加次数限制的 - .filter(rule -> checkUtil.checkUseNum(rule.getId(),rule.getDayLimitNum(),nowDate,recordAllList, "day")) - //过滤掉超过累计参加次数限制的 - .filter(rule -> checkUtil.checkUseNum(rule.getId(),rule.getLimitNum(),null,recordAllList,null)).collect(Collectors.toList()); + if(!recordAllList.isEmpty()){ + filteredList = filteredList.stream() + //过滤掉超过每日参加次数限制的 + .filter(rule -> checkUtil.checkUseNum(rule.getId(),rule.getDayLimitNum(),nowDate,recordAllList, "day")) + //过滤掉超过累计参加次数限制的 + .filter(rule -> checkUtil.checkUseNum(rule.getId(),rule.getLimitNum(),null,recordAllList,null)).collect(Collectors.toList()); + } /*4.得到用户最终可以参加的活动,计算优惠金额并转换成统一的对象*/ List rtnList = new ArrayList<>(); if(!filteredList.isEmpty()){ @@ -227,13 +234,15 @@ public class PayCenterServiceImpl implements PayCenterService { List actTypeList = Arrays.asList("3".split(StrUtil.COMMA)); List recordAllList = activePriceRecordService.selectListByUserIdAndActIds(userId, null,filteredList.stream().map(ActiveSubPriceRespVO::getId).collect(Collectors.toList()),actTypeList); - filteredList = filteredList.stream() - //过滤掉超过每日参加次数限制的 - .filter(rule -> checkUtil.checkUseNum(rule.getId(),rule.getDayLimitNum(),nowDate,recordAllList,"day")) - //过滤掉超过每月参加次数限制的 - .filter(rule -> checkUtil.checkUseNum(rule.getId(),rule.getMonthLimitNum(),nowDate,recordAllList,"month")) - //过滤掉超过累计参加次数限制的 - .filter(rule -> checkUtil.checkUseNum(rule.getId(),rule.getLimitNum(),null,recordAllList,null)).collect(Collectors.toList()); + if(!recordAllList.isEmpty()){ + filteredList = filteredList.stream() + //过滤掉超过每日参加次数限制的 + .filter(rule -> checkUtil.checkUseNum(rule.getId(),rule.getDayLimitNum(),nowDate,recordAllList,"day")) + //过滤掉超过每月参加次数限制的 + .filter(rule -> checkUtil.checkUseNum(rule.getId(),rule.getMonthLimitNum(),nowDate,recordAllList,"month")) + //过滤掉超过累计参加次数限制的 + .filter(rule -> checkUtil.checkUseNum(rule.getId(),rule.getLimitNum(),null,recordAllList,null)).collect(Collectors.toList()); + } /*4.得到用户最终可以参加的活动,计算优惠金额并转换成统一的对象*/ List rtnList = new ArrayList<>(); if(!filteredList.isEmpty()){ @@ -350,26 +359,58 @@ public class PayCenterServiceImpl implements PayCenterService { Integer storeId = nowAccountInfo.getStoreId(); int userId = Integer.parseInt(map.get("userId")); //油号id - Integer oilId = Integer.valueOf(map.get("oilId")); - //油单价 - Double oilPrice = Double.valueOf(map.get("oilPrice")); + Integer oilId = Integer.valueOf(map.getOrDefault("oilId","99999")); //加油金额(不含商品金额) - Double oilAmount = Double.valueOf(map.get("oilAmount")); - //订单总额(含商品金额) - Double orderAmount = Double.valueOf(map.get("orderAmount")); + Double oilAmount = Double.valueOf(map.getOrDefault("oilAmount","0")); //油升数 - Double oilLiter = Double.valueOf(map.get("oilLiter")); + Double oilLiter = Double.valueOf(map.getOrDefault("oilLiter","0")); + //选择的商品 + List goodsList = new ArrayList<>(); + String goodsStr = map.getOrDefault("goods",""); + if(StringUtils.isNotEmpty(goodsStr)){ + JSONArray goodsArray = JSONUtil.parseArray(map.get("goods")); + goodsList = goodsArray.toList(GoodsVO.class); + } /*1.先查满足条件的所有生效中的优惠券*/ List couponVOList = cardCouponUserService.selectAllList(storeId, userId, nowDate); /*2.进行初步过滤,这里只过滤优惠券硬性的限制*/ + List finalGoodsList = goodsList; List filteredList = couponVOList.stream() //当前时间在 适用时间段内 或者 当前时间不在 不适用时间段内的 - .filter(rule -> this.checkTimeCouponPrex(rule,nowDate)).collect(Collectors.toList()); -// //是否满足最低消费金额 -// .filter(rule-> rule.getConsumeAmount() <=oilAmount) -// //适用当前支付方式的 -// .filter(rule-> rule.getUsePaymentWay().contains(payWay)) + .filter(rule -> this.checkTimeCouponPrex(rule,nowDate)) + //如果是油品券,需要过滤出当前油品可用的 + .filter(rule -> checkUtil.checkOilCoupon(rule,oilId)) + //如果是油品券,需要过滤出达到满减条件的 + .filter(rule -> checkUtil.checkMaxCoupon(rule,oilAmount,oilLiter)) + //如果是单品立减券,需要过滤出当前选择的商品可用且满足最低消费金额的 + .filter(rule-> checkUtil.checkGoodsCoupon(rule, finalGoodsList)).collect(Collectors.toList()); + if(filteredList.isEmpty()){ + return new ArrayList<>(); + } + /*3.再次过滤,这里过滤掉用户已经超出参加次数限制的*/ + List filteredCoupIdList = filteredList.stream().map(CardCoupon::getId).collect(Collectors.toList()); + //查出本用户这些优惠券的使用记录 + List usedList = cardCouponUserService.selectListByUsed(userId,filteredCoupIdList); + if(!usedList.isEmpty()){ + //过滤 + filteredList = filteredList.stream() + //过滤掉使用次数限制的 + .filter(rule->checkUtil.checkUseNumCoupon(rule.getId(),rule.getLimitTotalDay(), rule.getLimitTotalNum(), nowDate,usedList)).collect(Collectors.toList()); + } + /*4.得到用户最终可以使用的优惠券,计算优惠金额并转换成统一的对象*/ List rtnList = new ArrayList<>(); + if(!filteredList.isEmpty()){ + for(CardCouponVO rule:filteredList){ + CouponVO couponVO = new CouponVO(); + couponVO.setId(rule.getDataId()); + couponVO.setCouponId(rule.getId()); + couponVO.setName(rule.getName()); + couponVO.setUseWithOther(rule.getUseWithOther()); + //计算优惠金额 + couponVO.setDisAmount(checkUtil.computeDisAmountCoupon(rule,oilAmount,oilLiter)); + rtnList.add(couponVO); + } + } return rtnList; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/pay/util/CheckUtil.java b/fuintBackend/fuint-application/src/main/java/com/fuint/pay/util/CheckUtil.java index 6a3735d12..cd0dc80de 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/pay/util/CheckUtil.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/pay/util/CheckUtil.java @@ -8,14 +8,18 @@ import com.fuint.business.marketingActivity.activePrice.entity.ActivePriceRecord import com.fuint.business.marketingActivity.activePrice.entity.ActiveSubPriceRule; import com.fuint.business.marketingActivity.activePrice.vo.ActivePriceRuleRespVO; import com.fuint.business.marketingActivity.activePrice.vo.ActiveSubPriceRespVO; +import com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser; +import com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponVO; import com.fuint.business.userGroup.entity.UserDiscount; import com.fuint.common.util.StringUtils; +import com.fuint.pay.vo.GoodsVO; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import java.math.BigDecimal; import java.text.DecimalFormat; import java.time.LocalDate; +import java.time.LocalDateTime; import java.time.LocalTime; import java.util.*; import java.util.stream.Collectors; @@ -234,6 +238,127 @@ public class CheckUtil { } } } + /** + * 判断当前加油的油号是否符合优惠券预设的油号----优惠券专用 + * @author vinjor-M + * @date 14:42 2024/9/21 + * @param couponVO 优惠券对象 + * @param oilId 当前加油选择的油号id + * @return java.lang.Boolean + **/ + public Boolean checkOilCoupon(CardCouponVO couponVO, Integer oilId){ + //代金券、折扣券、油品立减券才需要判断油品是否满足 + List couponTypeList = Arrays.asList("1","3","4"); + if(couponTypeList.contains(couponVO.getType())){ + if("1".equals(couponVO.getOilLimit())){ + //不限制油品,符合 + return true; + }else{ + //限制油品 + if(StringUtils.isNotEmpty(couponVO.getOilNumber())){ + List oilIdList = Arrays.asList(couponVO.getOilNumber().split(StrUtil.COMMA)); + return oilIdList.contains(oilId.toString()); + }else{ + //没有配置可用油号,不满足 + return false; + } + } + }else{ + //其他券不需要判断油品 + return true; + } + } + /** + * 判断当前加油金额或者加油升数是否达到满减条件----优惠券专用 + * @author vinjor-M + * @date 14:42 2024/9/21 + * @param couponVO 优惠券对象 + * @param oilAmount 加油金额 + * @param oilLiter 加油升数 + * @return java.lang.Boolean + **/ + public Boolean checkMaxCoupon(CardCouponVO couponVO, Double oilAmount,Double oilLiter){ + //代金券、折扣券、油品立减券才需要判断加油升数、加油金额是否达到满减条件 + List couponTypeList = Arrays.asList("1","3","4"); + if(couponTypeList.contains(couponVO.getType())){ + Double thisValue; + if("1".equals(couponVO.getUseType())){ + //加油金额 + thisValue = oilAmount; + }else if("2".equals(couponVO.getUseType())){ + //加油升数 + thisValue = oilLiter; + }else { + //超出预设值范围,不满足 + return false; + } + if("1".equals(couponVO.getType())){ + //代金券 + return checkMaxCouponChild(null,couponVO.getReachAmount(),thisValue); + }else if("3".equals(couponVO.getType())){ + //折扣券 + return checkMaxCouponChild(couponVO.getZkStartAmount().doubleValue(),couponVO.getZkEndAmount().doubleValue(),thisValue); + }else if("4".equals(couponVO.getType())){ + //油品立减券 + return checkMaxCouponChild(null,couponVO.getReachAmount(),thisValue); + }else{ + //超出预设值范围,不可用 + return false; + } + }else{ + //其他券不需要判断,默认满足 + return true; + } + } + + /** + * 判断加油金额或者加油升数是否符合某区间范围 + * @author vinjor-M + * @date 16:45 2024/9/25 + * @param min 最小值,可能为null + * @param max 最大值,一定有值 + * @param thisValue 加油金额或加油升数,一定有值 + * @return java.lang.Boolean + **/ + public Boolean checkMaxCouponChild(Double min,Double max,Double thisValue){ + if(null==min){ + return thisValue>=max; + }else { + return isBetween(thisValue,min,max); + } + } + + /** + * 判断当前订单选择的商品是否满足优惠券的使用规则----优惠券专用 + * @author vinjor-M + * @date 14:42 2024/9/21 + * @param couponVO 优惠券对象 + * @param goodsList 选择的商品列表 + * @return java.lang.Boolean + **/ + public Boolean checkGoodsCoupon(CardCouponVO couponVO, List goodsList){ + if("5".equals(couponVO.getType()) || goodsList.isEmpty()){ + //单品立减券 + if(StringUtils.isNotEmpty(couponVO.getProductIds())){ + //限制使用的商品id + List ruleGoodsList = Arrays.asList(couponVO.getProductIds().split(StrUtil.COMMA)); + //过滤出符合条件的本订单的商品 + List filteredList = goodsList.stream().filter(goods->ruleGoodsList.contains(goods.getId())).collect(Collectors.toList()); + //计算符合条件的商品订单总金额 + double orderAmount =0.0; + if(!filteredList.isEmpty()){ + orderAmount = filteredList.stream().mapToDouble(GoodsVO::getAmount).sum(); + } + return orderAmount>=couponVO.getReachAmount(); + }else{ + //未设置可用商品,不符合 + return false; + } + }else{ + //其他券或者本订单未选择商品不需要判断商品 + return true; + } + } /** @@ -279,6 +404,55 @@ public class CheckUtil { return maxNum>nowNum; } + /** + * 判断当前优惠券每多少天使用了多少次 是否满足优惠券设置的限制条件 + * @author vinjor-M + * @date 14:51 2024/9/21 + * @param coupId 优惠券id + * @param dayNum 多少天内 + * @param maxNum 最大次数限制 + * @param nowDate 结算日期 + * @param recordAllList 所有使用记录 + * @return java.lang.Boolean + **/ + public Boolean checkUseNumCoupon(Integer coupId, Integer dayNum, Integer maxNum, Date nowDate, List recordAllList){ + if(0==dayNum){ + //每多少天 设置为0,代表不显示 + return true; + } + int nowNum = 0; + //开始时间是结算时间 向前推 dayNum 天 + LocalDateTime startTime = DateUtil.offsetDay(nowDate,-3).toLocalDateTime(); + //结束时间为结算的时间 + LocalDateTime endTime = DateUtil.date(nowDate).toLocalDateTime(); + //优惠券使用时间过滤出近 dayNum 天内使用的次数 + nowNum = (int) recordAllList.stream() + .filter(item->item.getCardCouponId().equals(coupId)) + .filter(item->checkDateTimeIsIn(item.getUseTime(),startTime,endTime)) + .count(); + return maxNum>nowNum; + } + + /** + * 判断一个时间是否在一个时间区间内 + * @author vinjor-M + * @date 18:09 2024/9/25 + * @param useDate 使用时间 + * @param startTime 时间区间起始 + * @param endTime 时间区间结束 + * @return java.lang.Boolean + **/ + private Boolean checkDateTimeIsIn(Date useDate,LocalDateTime startTime,LocalDateTime endTime){ + LocalDateTime userDateTime = DateUtil.date(useDate).toLocalDateTime(); + if(userDateTime.isAfter(startTime) && userDateTime.isBefore(endTime)){ + return true; + }else if(userDateTime.equals(startTime ) || userDateTime.equals(endTime)){ + return true; + }else{ + return false; + } + } + /** * 根据活动优惠规则,计算优惠金额,,四舍五入保留2位小数--分时优惠和限时特价使用 * @author vinjor-M @@ -399,6 +573,48 @@ public class CheckUtil { return Double.valueOf(df.format(disAmount)); } + /** + * 根据优惠券优惠规则,计算优惠金额,,四舍五入保留2位小数--优惠券专用 + * @author vinjor-M + * @date 16:35 2024/9/21 + * @param coupon 优惠券 + * @param oilAmount 加油总价 + * @param oilLiter 加油升数 + * @return java.lang.Double + **/ + public Double computeDisAmountCoupon(CardCouponVO coupon, Double oilAmount, Double oilLiter){ + //默认优惠后总价等于原来的总价 + Double newOilAmount = oilAmount; + //优惠金额 + Double disAmount = 0.0; + DecimalFormat df = new DecimalFormat("#.00"); + try { + //1 按加油金额,否则 按加油升数 + Double thisValue = "1".equals(coupon.getUseType())?oilAmount:oilLiter; + if("1".equals(coupon.getType())){ + //代金券-直接拿优惠金额 + disAmount = coupon.getReduceAmount(); + }else if("3".equals(coupon.getType())){ + //折扣券,打折 + newOilAmount = newOilAmount*coupon.getZkData(); + disAmount = oilAmount - newOilAmount; + if(disAmount>coupon.getZkMaxAmount()){ + //超出折扣最大优惠金额 + disAmount = coupon.getZkMaxAmount(); + } + }else if("4".equals(coupon.getType())){ + //油品立减券,每满多少升减多少钱 + //计算能除尽多少次,就减多少次 + int thisInt = (int) (thisValue / coupon.getLjOilNum()); + //计算优惠金额 + disAmount = thisInt * coupon.getLjOilAmount(); + } + }catch (Exception e){ + log.error("优惠券优惠金额计算失败:"+e.getMessage(),e); + } + return Double.valueOf(df.format(disAmount)); + } + /** * 从一个日期里面获取时间,00:00格式 * @author vinjor-M @@ -512,7 +728,7 @@ public class CheckUtil { * @return boolean **/ private static boolean isBetween(double value, double min, double max) { - return value > min && value < max; + return value >= min && value <= max; } /** diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/pay/vo/CouponVO.java b/fuintBackend/fuint-application/src/main/java/com/fuint/pay/vo/CouponVO.java index 3f517a70b..a77efa1c6 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/pay/vo/CouponVO.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/pay/vo/CouponVO.java @@ -11,8 +11,14 @@ import java.io.Serializable; **/ @Data public class CouponVO implements Serializable { - /** 优惠券id */ + /** 优惠券和用户关联表的id */ private Integer id; + /** 优惠券id */ + private Integer couponId; /** 优惠券名称 */ private String name; + /**是否可与其他优惠一起使用1可以0不可以*/ + private String useWithOther; + /** 优惠金额 */ + private Double disAmount; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/pay/vo/GoodsVO.java b/fuintBackend/fuint-application/src/main/java/com/fuint/pay/vo/GoodsVO.java new file mode 100644 index 000000000..2bbb75016 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/pay/vo/GoodsVO.java @@ -0,0 +1,20 @@ +package com.fuint.pay.vo; + +import lombok.Data; + +/** + * 订单选择的商品 + * @author vinjor-M + * @date 14:42 2024/9/25 +**/ +@Data +public class GoodsVO { + /** 商品id */ + private String id; + /** 商品数量 */ + private Integer num; + /** 商品单价 */ + private Double price; + /** 总金额 */ + private Double amount; +} diff --git a/fuintBackend/fuint-application/src/main/resources/application.properties b/fuintBackend/fuint-application/src/main/resources/application.properties index 597d7d885..1fa299b97 100644 --- a/fuintBackend/fuint-application/src/main/resources/application.properties +++ b/fuintBackend/fuint-application/src/main/resources/application.properties @@ -1,7 +1,7 @@ # \u57FA\u672C\u914D\u7F6E server.port=8080 env.profile=dev -env.properties.path=D:/workspaces/oil-stations/fuintBackend/configure/ +env.properties.path=D:/my_project/oil-station/fuintBackend/configure/ #env.properties.path=F:/work/oilSystem/fuintBackend/configure/ #env.properties.path=D:/oil/new-oil/oilSystem/fuintBackend/configure/ #env.properties.path=D:/work/oilSystem/fuintBackend/configure/ diff --git a/fuintBackend/lib/mvn.txt b/fuintBackend/lib/mvn.txt index ec3724568..d1ba7cb41 100644 --- a/fuintBackend/lib/mvn.txt +++ b/fuintBackend/lib/mvn.txt @@ -1 +1 @@ -mvn install:install-file -Dfile=D:\Code\yuzhan\oil-station\fuintBackend\lib\yly_sdk_2.2.jar -DgroupId=yly_sdk -DartifactId=yly_sdk -Dversion=2.2 -Dpackaging=jar +mvn install:install-file -Dfile=D:\Code\yuzhan\oil-station\fuintBackend\lib\yly_sdk_2.2.jar -DgroupId=yly_sdk -DartifactId=yly_sdk -Dversion=2.2 -Dpackaging=jar \ No newline at end of file diff --git a/fuintCashierWeb/src/views/cashier/NewComponents/newHome.vue b/fuintCashierWeb/src/views/cashier/NewComponents/newHome.vue index 3c604c641..59a54ad77 100644 --- a/fuintCashierWeb/src/views/cashier/NewComponents/newHome.vue +++ b/fuintCashierWeb/src/views/cashier/NewComponents/newHome.vue @@ -65,7 +65,7 @@
活动优惠 -
-¥0.00
+
@@ -83,22 +83,19 @@
优惠券 -
-¥0.00
+
- -
- 优惠券1 -
-¥0.00
+
+ +
+ {{null==item.ruleName?item.actName:item.ruleName}}
-¥{{item.disAmount}}
+
+
-
- 优惠券2 -
-¥0.00
-
-
- 优惠券3 -
-¥0.00
+
+ 暂无可用优惠券
@@ -433,6 +430,7 @@ ¥{{ payForm.realyPayBills }}
+
0 || (this.oilGunClearing!='' && this.oilGunClearing.hasOwnProperty("oilNameId")))){ + //已选择会员且(选了商品或者加了油) let dataObj = { - userId: this.chooseVipUser.id, - oilId: this.oilGunClearing.oilNameId, - oilPrice:this.oilGunClearing.oilPrice, - oilAmount: this.oilGunClearing.amount, - orderAmount: this.orderAmount, - oilLiter: oilLiter + userId: this.chooseVipUser.id + } + if(this.oilGunClearing!='' && this.oilGunClearing.hasOwnProperty("oilNameId")){ + //加油油枪有值 + dataObj['oilId'] = this.oilGunClearing.oilNameId + dataObj['oilAmount'] = this.oilGunClearing.amount + dataObj['oilLiter'] = this.oilLiter + } + if(this.goodsList.length>0){ + let goodsArray = [] + for (let i = 0; i < this.goodsList.length; i++) { + let thisGoods = this.goodsList[i] + let goods = { + id: thisGoods.id, + num:thisGoods.num, + price:thisGoods.retailPrice, + amount:thisGoods.retailPrice * thisGoods.num + } + goodsArray.push(goods) + dataObj['goods'] = JSON.stringify(goodsArray) + } + console.log(dataObj) } getCouponList(dataObj).then(res => { - console.log("返回结果",res) + console.log("返回的可用的优惠券",res) + this.couponList = res.data }) + }else{ + this.couponList=[] } }, copyToClipboard(textToCopy) { diff --git a/gasStation-uni/pages.json b/gasStation-uni/pages.json index 1cd59e3b3..001bd2d0c 100644 --- a/gasStation-uni/pages.json +++ b/gasStation-uni/pages.json @@ -269,6 +269,12 @@ "navigationStyle": "custom" } }, + { + "path": "Coupons/details", + "style": { + "navigationBarTitleText": "卡券详情" + } + }, { @@ -278,6 +284,14 @@ } }, + + { + "path": "growthValue/index", + "style": { + "navigationBarTitleText": "成长值明细" + + } + }, { "path": "VIP/vip", "style": { diff --git a/gasStation-uni/pages/my/my.vue b/gasStation-uni/pages/my/my.vue index 0732c91c4..fc5c44415 100644 --- a/gasStation-uni/pages/my/my.vue +++ b/gasStation-uni/pages/my/my.vue @@ -120,7 +120,7 @@ 车牌管理 - + @@ -383,6 +383,11 @@ url: '/pagesMy/licensePlate/index' }) }, + goCZZ() { + uni.navigateTo({ + url: '/pagesMy/growthValue/index' + }) + }, goFleet() { uni.navigateTo({ url: '/pagesMy/fleetInfo/index' diff --git a/gasStation-uni/pagesHome/Address/Address.vue b/gasStation-uni/pagesHome/Address/Address.vue index ffd585ca0..83afc8f1c 100644 --- a/gasStation-uni/pagesHome/Address/Address.vue +++ b/gasStation-uni/pagesHome/Address/Address.vue @@ -8,7 +8,7 @@ - + {{item.name || '--'}} 先生 @@ -97,7 +97,6 @@ if (item.ifDefault == 1) { item.checked = true } - this.$set(item, 'checked', item.checked); // 正确更新响应式属性 }) console.log(res, this.dataList, 98); this.$forceUpdate() diff --git a/gasStation-uni/pagesHome/PointsMall/PointsMall.vue b/gasStation-uni/pagesHome/PointsMall/PointsMall.vue index 3685eb3f6..761092b6c 100644 --- a/gasStation-uni/pagesHome/PointsMall/PointsMall.vue +++ b/gasStation-uni/pagesHome/PointsMall/PointsMall.vue @@ -34,18 +34,18 @@ {{item.exchangePoints}} + v-if="item.exchangeMethod == '积分' || item.exchangeMethod == '积分+金额' || item.exchangeMethod == '积分+加钱购'">{{item.exchangePoints}}积分 + ¥{{item.exchangeAmount}} - 积分 + - ¥3.5 + ¥{{item.market || 0}} { if (res.code == 200) { this.integralGiftList = res.data.records - console.log(this.integralGiftList,142); + console.log(res.data, 142); + }else{ + this.integralGiftList = [] } }) }, diff --git a/gasStation-uni/pagesHome/PointsRedemption/details.vue b/gasStation-uni/pagesHome/PointsRedemption/details.vue index d1ac13861..8d9b9509c 100644 --- a/gasStation-uni/pagesHome/PointsRedemption/details.vue +++ b/gasStation-uni/pagesHome/PointsRedemption/details.vue @@ -3,13 +3,15 @@ - + + - 虚拟物品 - 300ml瓶装 + {{giftInfo.giftName}} + {{giftInfo.goodsName || ''}} - 兑换券 + {{giftInfo.giftType}} 剩余3张 @@ -20,48 +22,152 @@ 兑换内容 - 本兑换券为一次性使用券,持有人凭此券可在指定兑换 - 点免费兑换一瓶可口可乐经典口味瓶装饮料(规格为 - 300毫升)。此券仅限兑换同等价值商品,不找零,不 - 兑换现金,不可与其他优惠活动同时使用。 + {{giftInfo.exchangeInstructions || '--'}} 使用须知 - 有效期:领取后3天内有效 + {{giftInfo.useInstructions || '--'}} 兑换方式 - 门店自提 + {{giftInfo.exchangeMethod || '--'}} 适用门店 - + 导航 - 中建锦绣广场二期站 - 山东省济南市槐荫区 | 3.0km + {{store.name}} + {{store.address}} | {{distance}}km - 100积分 + + {{giftInfo.exchangePoints}}积分 + + + ¥{{giftInfo.exchangeAmount}} + + 立即兑换 + \ No newline at end of file diff --git a/gasStation-uni/pagesMy/fleetInfo/index.vue b/gasStation-uni/pagesMy/fleetInfo/index.vue index 807988e67..dce3d18d6 100644 --- a/gasStation-uni/pagesMy/fleetInfo/index.vue +++ b/gasStation-uni/pagesMy/fleetInfo/index.vue @@ -4,7 +4,7 @@ *车队名称 - + @@ -32,15 +32,15 @@ - + + src="@/static/my/fleetAdd.png"> 添加管理员 保存 - + @@ -59,13 +59,14 @@ value: "xxxxxx", value1: true, show: false, - columns: [ - ['管理员', '小王', '小李'] - ], + columns: [], + // 员工列表信息 + staffList: [], + fleetInfo:{}, } }, - onLoad() { - + onShow() { + this.getStaffList(uni.getStorageSync("storeId")) }, onPullDownRefresh() { //下拉刷新 @@ -73,12 +74,7 @@ }, onReachBottom() { // 触底加载 - if (this.pageNo >= this.totalPage) { - uni.showToast({ - title: '没有下一页数据', - icon: 'none' - }) - } else { + if (this.pageNo >= this.totalPage) {} else { this.pageNo++ } @@ -88,6 +84,18 @@ }, methods: { + // 获取当前店铺员工信息列表 + getStaffList(storeId) { + this.columns = [] + let _this = this; + request({ + url: "business/member/staff/queryList1/" + storeId, + method: 'get', + }).then((res) => { + _this.staffList = res.data + _this.columns.push(_this.staffList) + }) + }, cancel() { this.show = false }, diff --git a/gasStation-uni/pagesMy/growthValue/index.vue b/gasStation-uni/pagesMy/growthValue/index.vue new file mode 100644 index 000000000..ebd5fb102 --- /dev/null +++ b/gasStation-uni/pagesMy/growthValue/index.vue @@ -0,0 +1,293 @@ + + + + + \ No newline at end of file diff --git a/gasStation-uni/pagesMy/licensePlate/addCar.vue b/gasStation-uni/pagesMy/licensePlate/addCar.vue index 0a20ece88..a4b7ccf07 100644 --- a/gasStation-uni/pagesMy/licensePlate/addCar.vue +++ b/gasStation-uni/pagesMy/licensePlate/addCar.vue @@ -4,16 +4,17 @@ 请输入车牌号 - - - - + + + + - 保存 + 保存 + @confirm="confirm1" @cancel="cancel1" :overlay="false"> + @@ -26,11 +27,16 @@ return { title: '', List: [], + showIndex: 1, pageNo: 1, pageSize: 10, totalPage: '', value: '', + value1: '', + value2: '', show: false, + show1: false, + show2: false, } }, onLoad() {}, @@ -47,14 +53,51 @@ components: { + }, + watch() { + }, methods: { + // 提交车牌号信息 + submitCar() { + let carNo = this.value + this.value1 + this.value2 + let storeId = uni.getStorageSync("storeId") + request({ + url: '/business/userManager/userCarNo', + method: 'post', + data: { + storeId: storeId, + carNo: carNo + }, + }).then(res => { + if (res.code == 200) { + uni.navigateBack() + } + }) + }, + upShow(num) { + this.showIndex = num + this.show = true + }, // 按键被点击(点击退格键不会触发此事件) valChange(val) { // 将每次按键的值拼接到value变量中,注意+=写法 - this.value += val; - console.log(this.value); + this.ifChange(val) + + }, + ifChange(val) { + if (this.showIndex == 1) { + this.value = val; + } + if (this.showIndex == 2) { + this.value1 = val; + } + if (this.showIndex == 3) { + this.value2 += val; + } + }, + // 退格键被点击 backspace() { // 删除value的最后一个字符 diff --git a/gasStation-uni/pagesMy/licensePlate/index.vue b/gasStation-uni/pagesMy/licensePlate/index.vue index 21dd337fd..1c4ad9923 100644 --- a/gasStation-uni/pagesMy/licensePlate/index.vue +++ b/gasStation-uni/pagesMy/licensePlate/index.vue @@ -11,9 +11,9 @@ - - 鲁A 659KG - + + {{item.carNo || '暂无'}} + 解绑 @@ -34,7 +34,7 @@ data() { return { title: '', - List: [], + list: [], pageNo: 1, pageSize: 10, totalPage: '', @@ -42,7 +42,9 @@ type: 1, show: false, title: "温馨提示", - content: '确定解绑?' + content: '确定解绑?', + // 需要解绑的车牌号id + carNoId:'', } }, onLoad() {}, @@ -56,14 +58,35 @@ this.pageNo++ } }, - + onShow() { + this.getCarNo() + }, components: { }, methods: { - goAdd(){ + goDelete(id){ + this.carNoId = id + this.show = !this.show + }, + getCarNo() { + request({ + url: '/business/userManager/userCarNo', + method: 'get', + }).then(res => { + if (res.code == 200) { + this.list = res.data + if (this.list.length>0){ + this.type = 1 + }else{ + this.type = 0 + } + } + }) + }, + goAdd() { uni.navigateTo({ - url:"/pagesMy/licensePlate/addCar" + url: "/pagesMy/licensePlate/addCar" }) }, cancel1() { @@ -71,6 +94,15 @@ }, confirm1() { this.show = false + request({ + url: '/business/userManager/userCarNo/'+this.carNoId, + method: 'delete', + }).then(res => { + if (res.code == 200){ + this.carNoId = '' + this.getCarNo() + } + }) }, goback() { uni.navigateBack() diff --git a/gasStation-uni/static/imgs/czz.png b/gasStation-uni/static/imgs/czz.png new file mode 100644 index 000000000..7b72b6d3c Binary files /dev/null and b/gasStation-uni/static/imgs/czz.png differ