From 5cc504bb4440c7d96c8b4b6907df57a8b64719ff Mon Sep 17 00:00:00 2001 From: Dev Date: Wed, 23 Sep 2026 14:30:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E7=8E=B0=E8=A7=84=E5=88=99=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/service/AccountWithdrawService.php | 8 + frontend/miniapp/config/api.js | 2 +- .../miniapp/pages/usercenter/balance/index.js | 16 ++ .../pages/usercenter/balance/index.json | 1 + .../pages/usercenter/balance/index.wxml | 36 +++++ .../pages/usercenter/balance/index.wxss | 152 ++++++++++++++++++ 6 files changed, 214 insertions(+), 1 deletion(-) diff --git a/backend/application/common/service/AccountWithdrawService.php b/backend/application/common/service/AccountWithdrawService.php index 8c715dc..4a50920 100644 --- a/backend/application/common/service/AccountWithdrawService.php +++ b/backend/application/common/service/AccountWithdrawService.php @@ -42,6 +42,14 @@ class AccountWithdrawService */ public static function applyWithdraw($userId, $amount, string $name = '') { + //每个自然日仅可发起一次提现申请 + $todayCount = self::$Model::where('user_id', $userId) + ->whereTime('createtime', 'today') + ->count(); + if ($todayCount >= 10) { + throw new \Exception('每个自然日仅可发起10次提现申请,请明日再试'); + } + //开启事务 抛出异常时自动回滚 Db::transaction(function () use ($userId, $amount, $name) { if($name){ diff --git a/frontend/miniapp/config/api.js b/frontend/miniapp/config/api.js index 9fa605f..0b52cbe 100644 --- a/frontend/miniapp/config/api.js +++ b/frontend/miniapp/config/api.js @@ -1,7 +1,7 @@ // 接口环境:按小程序运行版本自动切换,无需注释切换域名 // develop: 开发者工具运行/真机预览调试 | trial: 上传后的体验版 | release: 审核发布的正式版 const API_ROOTS = { - develop: 'http://code.syoai.cn', // 本地开发(phpStudy,hosts 需将 codebg.cn 指向 127.0.0.1) + develop: 'https://code.syoai.cn', // 本地开发(phpStudy,hosts 需将 codebg.cn 指向 127.0.0.1) trial: 'https://code.syoai.cn', // 体验版(线上,需 https + 备案域名) release: 'https://code.syoai.cn', // 正式版(线上,需 https + 备案域名) }; diff --git a/frontend/miniapp/pages/usercenter/balance/index.js b/frontend/miniapp/pages/usercenter/balance/index.js index d979ab4..c514425 100644 --- a/frontend/miniapp/pages/usercenter/balance/index.js +++ b/frontend/miniapp/pages/usercenter/balance/index.js @@ -17,6 +17,18 @@ Page({ withdrawAmount: '', withdrawName: '', cancelBtnStyle: 'color: #ff0000; border-color: #ff0000; background-color: #fff;', + // 提现规则:默认折叠,仅展示核心摘要 + rulesExpanded: false, + briefRules: ['单笔 1-200 元', '每日限 10 次', '单日限额 2000 元', '1-3 个工作日到账'], + ruleList: [ + { title: '单笔额度', desc: '单笔最低 1 元,最高 200 元,以「可提现余额」为准' }, + { title: '提现次数', desc: '每个自然日最多可发起 10 次提现申请' }, + { title: '单日限额', desc: '同一自然日累计提现金额不超过 2000 元,超出请次日再试' }, + { title: '到账方式', desc: '转账至本人微信零钱,需填写与微信实名一致的姓名' }, + { title: '到账时间', desc: '审核通过后 1-3 个工作日内到账,节假日顺延' }, + { title: '审核说明', desc: '工作日统一审核处理,审核期间该笔金额将暂时冻结' }, + { title: '驳回处理', desc: '被驳回的提现金额将自动退回可提现余额,可重新发起' }, + ], }, /** @@ -130,6 +142,10 @@ Page({ onWithdraw() { this.setData({ showWithdrawDialog: true }); }, + // 展开/收起提现规则 + onToggleRules() { + this.setData({ rulesExpanded: !this.data.rulesExpanded }); + }, onWithdrawAmountInput(e) { this.setData({ withdrawAmount: e.detail.value }); }, diff --git a/frontend/miniapp/pages/usercenter/balance/index.json b/frontend/miniapp/pages/usercenter/balance/index.json index 75a02b4..713d846 100644 --- a/frontend/miniapp/pages/usercenter/balance/index.json +++ b/frontend/miniapp/pages/usercenter/balance/index.json @@ -2,6 +2,7 @@ "usingComponents": { "t-button": "tdesign-miniprogram/button/button", "t-dialog": "tdesign-miniprogram/dialog/dialog", + "t-icon": "tdesign-miniprogram/icon/icon", "t-input": "tdesign-miniprogram/input/input", "t-empty": "tdesign-miniprogram/empty/empty", "t-load-more": "/components/load-more/index", diff --git a/frontend/miniapp/pages/usercenter/balance/index.wxml b/frontend/miniapp/pages/usercenter/balance/index.wxml index 075ba3a..c741547 100644 --- a/frontend/miniapp/pages/usercenter/balance/index.wxml +++ b/frontend/miniapp/pages/usercenter/balance/index.wxml @@ -23,6 +23,41 @@ 提现 + + + + + + 提现规则 + + + {{rulesExpanded ? '收起' : '展开'}} + + + + + + + + + {{item}} + + + + + + + + {{index + 1}} + + {{item.title}} + {{item.desc}} + + + + + + 余额明细 @@ -56,5 +91,6 @@ + 单笔 1-200 元,每日最多 10 次,单日累计不超过 2000 元;到账至微信零钱,1-3 个工作日内到账 \ No newline at end of file diff --git a/frontend/miniapp/pages/usercenter/balance/index.wxss b/frontend/miniapp/pages/usercenter/balance/index.wxss index fca5952..3b559ca 100644 --- a/frontend/miniapp/pages/usercenter/balance/index.wxss +++ b/frontend/miniapp/pages/usercenter/balance/index.wxss @@ -83,6 +83,158 @@ border-color: #ffffff; } +/* ================= 提现规则(可折叠) ================= */ +.rules-card { + margin: 0 24rpx 24rpx; + background: var(--bg-card); + border-radius: var(--radius-lg); + box-shadow: var(--shadow-card); + overflow: hidden; +} + +.rules-header { + display: flex; + align-items: center; + justify-content: space-between; + padding: 28rpx 32rpx; +} + +.rules-header--hover { + background: var(--bg-grey); +} + +.rules-header-left { + display: flex; + align-items: center; +} + +.rules-header-title { + margin-left: 12rpx; + font-size: 30rpx; + font-weight: 600; + color: var(--text-primary); +} + +.rules-header-right { + display: flex; + align-items: center; +} + +.rules-toggle-text { + font-size: 24rpx; + color: var(--brand); + margin-right: 4rpx; +} + +.rules-arrow { + transition: transform 0.28s ease; + transform: rotate(0deg); +} + +.rules-arrow.is-expand { + transform: rotate(180deg); +} + +/* 折叠态:核心要点 */ +.rules-brief { + display: flex; + flex-wrap: wrap; + max-height: 220rpx; + padding: 0 24rpx 28rpx; + overflow: hidden; + opacity: 1; + transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.3s ease; +} + +.rules-brief.is-hide { + max-height: 0; + padding-top: 0; + padding-bottom: 0; + opacity: 0; +} + +.brief-item { + display: flex; + align-items: center; + height: 52rpx; + margin: 8rpx 8rpx 0 0; + padding: 0 20rpx; + background: var(--brand-light); + border-radius: var(--radius-round); +} + +.brief-icon { + margin-right: 8rpx; +} + +.brief-text { + font-size: 24rpx; + color: var(--brand); + line-height: 52rpx; +} + +/* 展开态:完整规则(max-height 过渡动画) */ +.rules-body { + max-height: 0; + overflow: hidden; + transition: max-height 0.3s ease; +} + +.rules-body.is-expand { + max-height: 1400rpx; +} + +.rules-body-inner { + padding: 4rpx 32rpx 28rpx; + border-top: 1px solid var(--border-level-1); +} + +.rule-item { + display: flex; + align-items: flex-start; + padding: 20rpx 0 0; +} + +.rule-index { + flex: 0 0 36rpx; + height: 36rpx; + margin-top: 6rpx; + border-radius: var(--radius-round); + background: var(--brand-light); + color: var(--brand); + font-size: 22rpx; + font-weight: 600; + line-height: 36rpx; + text-align: center; +} + +.rule-content { + flex: 1; + margin-left: 16rpx; +} + +.rule-title { + font-size: 26rpx; + font-weight: 600; + color: var(--text-primary); + line-height: 40rpx; +} + +.rule-desc { + margin-top: 2rpx; + font-size: 24rpx; + color: var(--text-tertiary); + line-height: 38rpx; +} + +/* 提现弹窗内提示 */ +.dialog-tips { + padding: 24rpx 8rpx 8rpx; + font-size: 22rpx; + color: var(--text-placeholder); + line-height: 36rpx; +} + .balance-detail { margin: 24rpx; background: var(--bg-card);