LifeDiscountCoupon 添加 couponType 和 discountRate 字段LifeDiscountCouponDto 添加 couponType 和 discountRate 字段LifeDiscountCouponVo 添加 couponType 和 discountRate 字段LifeDiscountCouponFriendRuleVo 添加 couponType 和 discountRate 字段✅ 创建优惠券验证 (LifeDiscountCouponServiceImpl.addDiscountCoupon)
nominalValue 和 minimumSpendingAmountdiscountRate 和 minimumSpendingAmount
✅ 使用优惠券计算 (LifeUserOrderService)
nominalValue 作为减免金额✅ 优惠券规则构建 (LifeDiscountCouponServiceImpl.buildDiscountCouponRule)
✅ 好评赠券通知 (LifeDiscountCouponStoreFriendServiceImpl.issueCouponForGoodRating)
✅ 好友赠券SQL查询 (LifeDiscountCouponStoreFriendMapper)
getReceivedSendFriendCouponList (好友赠我-优惠券):添加 coupon_type 和 discount_rategetReceivedSendFriendCouponListwzhy (我赠好友-优惠券):添加 coupon_type 和 discount_rate
✅ 好友赠券规则查询 (LifeDiscountCouponFriendRuleDetailMapper)
getRuleList:添加 coupon_type 和 discount_rate-- 添加优惠券类型字段
ALTER TABLE `life_discount_coupon`
ADD COLUMN `coupon_type` INT DEFAULT NULL COMMENT '优惠券类型:1-满减券,2-折扣券' AFTER `valid_date`;
-- 添加折扣率字段
ALTER TABLE `life_discount_coupon`
ADD COLUMN `discount_rate` DECIMAL(10,2) DEFAULT NULL COMMENT '折扣率(0-100,用于折扣券,例如80表示8折)' AFTER `coupon_type`;
couponType 判断显示方式:
couponType = 1(满减券):显示 nominalValue 元couponType = 2(折扣券):显示 discountRate 折couponType 为 null 时,按满减券处理couponType 显示不同的优惠信息group_merchant/src/pages/voucherRecord/index.vue (第81行)group_merchant/src/pages/couponManagement/couponsDetail.vue (第13-20行)group_merchant/src/components/IssueCoupons/IssueCoupons.vue (第14-19行)group_merchant/src/pages/couponDetails/index.vuegroup_merchant/src/pages/couponManagement/couponsDetail.vuelife_coupon)和团购券,不涉及优惠券(life_discount_coupon)的核销CouponManageServiceImpl.verifyCoupon、CouponManageServiceImpl.verifyOrderLifeDiscountCouponStoreFriendServiceImpl.setFriendCoupon、issueFriendCouponLifeDiscountCouponStoreFriendServiceImpl.issueCouponForGoodRatingStoreOperationalStatisticsServiceImpl.getCouponDatacouponType 为 null 时,代码按满减券处理数据迁移:如需将旧数据统一为满减券,可执行:
UPDATE `life_discount_coupon` SET `coupon_type` = 1 WHERE `coupon_type` IS NULL;
前端适配:前端需要根据 couponType 字段判断显示方式,这是必须的改动
验证逻辑:创建优惠券时必须选择类型并填写对应字段,已添加验证
后端改动已完成,主要包括:
前端需要适配: