diff --git a/server/application/api/controller/Master.php b/server/application/api/controller/Master.php index 6ed5c2a..1cbf84f 100644 --- a/server/application/api/controller/Master.php +++ b/server/application/api/controller/Master.php @@ -19,7 +19,7 @@ use think\Db; */ class Master extends MasterBase { - protected $noNeedLogin = ['hall', 'orderDetail', 'resolveLocation']; + protected $noNeedLogin = ['hall', 'orderDetail', 'resolveLocation', 'withdrawRules']; /** * 师傅入驻申请 @@ -1315,11 +1315,33 @@ class Master extends MasterBase } /** - * 收入概览(含待确认收款的微信商家转账单与提现申请记录) + * 公开获取师傅提现规则配置(免入驻认证即可查看真实后台配置,供钱包页展示) + */ + public function withdrawRules() + { + $master = $this->masterInfo(); + $withdrawConfig = FinanceConfigService::buildMasterWithdrawClientPayload($master ?: ['id' => 0]); + $limits = PaymentService::getWithdrawLimits(); + $limits['today_used'] = $withdrawConfig['today_amount']; + $limits['today_remain'] = $withdrawConfig['remain_daily_amount'] >= 0 + ? $withdrawConfig['remain_daily_amount'] + : (float)$limits['daily_user_limit']; + + $this->success('', [ + 'withdraw_config' => $withdrawConfig, + 'withdraw_limits' => $limits, + ]); + } + + /** + * 收入概览(含待确认收款的微信商家转账单与提现申请记录;已登录即可查看余额与提现规则) */ public function income() { - $master = $this->requireMasterProfile(); + $master = $this->masterInfo(); + if (!$master) { + $this->error(__('Please login first'), null, 401); + } // 顺带轻量同步最新 3 笔处理中的微信转账提现单(如师傅上次已确认收款但未回调或超时自动退回) $syncCandidates = Db::name('withdraw') diff --git a/server/application/common/library/FinanceConfigService.php b/server/application/common/library/FinanceConfigService.php index cb1834a..d3cd355 100644 --- a/server/application/common/library/FinanceConfigService.php +++ b/server/application/common/library/FinanceConfigService.php @@ -288,6 +288,12 @@ class FinanceConfigService */ public static function getMasterTodayWithdrawStats(int $masterId): array { + if ($masterId <= 0) { + return [ + 'today_count' => 0, + 'today_amount' => 0.00, + ]; + } $todayStart = strtotime(date('Y-m-d 00:00:00')); $rows = Db::name('withdraw') ->field('amount') diff --git a/yjyf-master-app/pages/master/wallet.vue b/yjyf-master-app/pages/master/wallet.vue index 285d8c0..a4cdb32 100644 --- a/yjyf-master-app/pages/master/wallet.vue +++ b/yjyf-master-app/pages/master/wallet.vue @@ -103,6 +103,12 @@ + + + 提现规则加载失败,请检查服务端是否已更新或点击重试 + 重试 + + @@ -451,6 +457,7 @@ const confirmingId = ref(0); const activeLog = ref(null); const activeWithdraw = ref(null); + const ruleLoadFailed = ref(false); const availMoney = computed(() => Number(income.value?.money || 0)); const withdrawCfg = computed(() => income.value?.withdraw_config || null); @@ -683,6 +690,7 @@ } async function load() { + ruleLoadFailed.value = false; try { const res = await api.masterIncome(); income.value = res; @@ -693,7 +701,27 @@ const refreshed = withdrawList.value.find(item => item.id === activeWithdraw.value.id); activeWithdraw.value = refreshed || null; } - } catch (e) {} + return; + } catch (e) { + try { + const ruleRes = await api.masterWithdrawRules(); + if (ruleRes && ruleRes.withdraw_config) { + income.value = Object.assign({ + money: 0, + frozen_money: 0, + today_income: 0, + total_income: 0 + }, income.value || {}, { + withdraw_config: ruleRes.withdraw_config, + withdraw_limits: ruleRes.withdraw_limits || {} + }); + return; + } + } catch (re) {} + if (!withdrawCfg.value) { + ruleLoadFailed.value = true; + } + } } function openWithdraw() { @@ -1138,6 +1166,37 @@ line-height: 1.5; font-variant-numeric: tabular-nums; } + .rule-error-bar { + margin: 20rpx $yjyf-space-md 0; + padding: 18rpx 22rpx; + background: $yjyf-bg-card; + border-radius: $yjyf-radius-md; + box-shadow: $yjyf-shadow-card; + display: flex; + align-items: center; + justify-content: space-between; + gap: 16rpx; + } + .rule-error-txt { + flex: 1; + min-width: 0; + font-size: $yjyf-font-sub; + color: $yjyf-danger; + line-height: 1.45; + } + .rule-retry-btn { + height: 52rpx; + padding: 0 22rpx; + border-radius: $yjyf-radius-pill; + background: $yjyf-primary-bg; + color: $yjyf-primary; + font-size: $yjyf-font-sub; + font-weight: 600; + display: inline-flex; + align-items: center; + justify-content: center; + flex-shrink: 0; + } /* 账单卡片 */ .bill-card { diff --git a/yjyf-master-app/utils/api.js b/yjyf-master-app/utils/api.js index 8c17812..3562e3b 100644 --- a/yjyf-master-app/utils/api.js +++ b/yjyf-master-app/utils/api.js @@ -65,6 +65,7 @@ export default { masterVerifyCode: (data) => post('/master/verifyCode', data), masterRequestDiff: (data) => post('/master/requestDiff', data), masterIncome: () => get('/master/income'), + masterWithdrawRules: () => get('/master/withdrawRules', {}, { silent: true }), masterToggle: (data) => post('/master/toggleWork', data), masterUpdateLocation: (data) => post('/master/updateLocation', data), masterResolveLocation: (data) => get('/master/resolveLocation', data, { silent: true }),