Repository navigation
feat(payment): 充值优惠阶梯,支持赠金与折扣两种模式 - #7802
Merged
Merged
Conversation
- 后台支付设置新增「充值赠送阶梯」(满 X 送 Y%,RECHARGE_BONUS_TIERS)与 Markdown 活动文案 (RECHARGE_BONUS_NOTICE):阈值按用户输入的支付金额命中(取不超过金额的最大档), 赠送按到账基数(输入 × 充值倍率)计算;严格校验写入、宽松解析读取,订阅订单不参与 - 下单时按当时配置计算赠送并落库:payment_orders 新增 bonus_amount 列(迁移 241), amount 仍为到账总额,到账/兑换码/退款逻辑不变;推广返利基数改为 amount - bonus_amount - checkout-info 下发 recharge_bonus_tiers / recharge_bonus_notice;创建订单与订单查询响应带 bonus_amount - 充值页:快捷金额按钮右上角「+N%」角标 + 第二行到账金额,金额卡顶部渲染活动文案, 订单摘要新增赠送额度行并在有赠送时始终显示到账余额;订单列表/详情/支付结果/成功面板显示含赠送 - 后台新增 RechargeBonusTierEditor(行内校验重复/非法阈值,自动排序并显示区间预览) - 补后端单测、契约测试与前端 vitest,zh/en 文案
- 新增全局模式开关 RECHARGE_BONUS_MODE(bonus / discount),接入支付配置、后台设置接口与 checkout-info - 折扣模式:到账不变,实付基数按百分比打折(按币种精度取整),手续费 / 每日限额 / 渠道选实例沿用折后基数; 百分比须 < 100,运行时 ≥ 100 按无优惠处理 - 充值页角标改为单行红色价签(赠金「+20%」/ 折扣「20% OFF」),第二行按模式显示到账或折后实付; 摘要卡折扣模式显示优惠行,渠道限额校验改用折后实付 - 后台「充值优惠阶梯」拆为独立卡片:赠金 / 折扣切换、紧凑档位表格、区间预览、活动文案 - 补前后端单测与 zh/en 文案
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
设计
后台按支付金额配置优惠档位(满 X 享 Y%),整条阶梯只有一种模式,同时支持赠金和折扣:
命中规则取不超过支付金额的最大档位;优惠在下单时按当时配置计算并落库,之后改配置不影响已建订单;订阅订单不参与。两种模式落库形态一致:
amount为到账总额,bonus_amount为其中免费部分,pay_amount为实收;推广返利基数改为amount - bonus_amount。另可配置 Markdown 活动文案在充值页展示。改动
RECHARGE_BONUS_TIERS/RECHARGE_BONUS_MODE/RECHARGE_BONUS_NOTICE(写路径严格校验,读路径宽松解析,折扣百分比须 < 100);payment_orders新增bonus_amount列(迁移 241);下单时报价并落库,到账 / 兑换码 / 退款逻辑不变;checkout-info 下发阶梯、模式与文案,创建订单与订单查询响应带bonus_amount测试
payment_recharge_bonus_test.go覆盖归一化 / 宽松解析 / 档位命中 / 两种模式报价 / 折扣百分比校验,契约测试补新字段;go test -tags=unit ./...通过rechargeBonus工具函数、AmountInput、SettingsView新增用例;vitest run全量通过,vue-tsc / eslint / i18n 检查通过效果图