fix(wallet): 放开未入驻账号查看提现规则与新增withdrawRules公开接口
这个提交包含在:
@@ -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')
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -103,6 +103,12 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 提现规则加载失败重试条(绝不使用假数据兜底) -->
|
||||
<view class="rule-error-bar" v-else-if="ruleLoadFailed">
|
||||
<text class="rule-error-txt">提现规则加载失败,请检查服务端是否已更新或点击重试</text>
|
||||
<view class="rule-retry-btn clickable-hover" @tap="load">重试</view>
|
||||
</view>
|
||||
|
||||
<!-- 收支账单与提现明细 -->
|
||||
<view class="bill-card">
|
||||
<view class="card-head">
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 }),
|
||||
|
||||
在新工单中引用
屏蔽一个用户