feat(finance): 优化师傅提现规则动态下发展示与免手续费配置
这个提交包含在:
@@ -523,8 +523,8 @@
|
||||
<div class="fc-card-box">
|
||||
<div class="fc-card-box-header">
|
||||
<h3 class="fc-card-box-title">
|
||||
<i class="fa fa-percent text-info"></i> 提现通道手续费
|
||||
<small>通常按 0.60% 抵扣微信官方商户号资金出款成本</small>
|
||||
<i class="fa fa-percent text-info"></i> 提现手续费设置
|
||||
<small>支持在后台随时灵活切换免手续费、按比例或按笔固定计收(微信官方商家转账本身不收转账手续费)</small>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="fc-card-box-body">
|
||||
@@ -532,9 +532,9 @@
|
||||
<label class="control-label col-xs-12 col-sm-2">手续费方式:</label>
|
||||
<div class="col-xs-12 col-sm-4">
|
||||
<select id="c-wd-fee-mode" class="form-control js-wd-fee-mode js-wd-fee-field" name="row[withdraw_fee_mode]">
|
||||
<option value="percent" {if $cfg.withdraw_fee_mode == 'percent'}selected{/if}>按比例收取 (%) - 推荐</option>
|
||||
<option value="free" {if $cfg.withdraw_fee_mode == 'free'}selected{/if}>免手续费(推荐:平台全额承担)</option>
|
||||
<option value="percent" {if $cfg.withdraw_fee_mode == 'percent'}selected{/if}>按比例收取 (%)</option>
|
||||
<option value="fixed" {if $cfg.withdraw_fee_mode == 'fixed'}selected{/if}>每笔固定金额 (元/笔)</option>
|
||||
<option value="free" {if $cfg.withdraw_fee_mode == 'free'}selected{/if}>免手续费(平台替师傅全额承担)</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@@ -556,7 +556,7 @@
|
||||
<input id="c-wd-fee-max" type="number" step="0.01" min="0" class="form-control js-wd-fee-field" name="row[withdraw_fee_max]" value="{$cfg.withdraw_fee_max|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<span class="fc-field-note">推荐费率 0.60%,最少与最多填 0 表示不设保底和封顶</span>
|
||||
<span class="fc-field-note">最少与最多填 0 表示不设保底和封顶</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1535,6 +1535,10 @@ class Master extends MasterBase
|
||||
'updatetime' => $now,
|
||||
]);
|
||||
|
||||
$feeNote = $fee > 0
|
||||
? '手续费 ¥' . number_format($fee, 2, '.', '')
|
||||
: '免手续费';
|
||||
|
||||
Db::name('wallet_log')->insert([
|
||||
'user_type' => 'master',
|
||||
'user_id' => (int)$lockedMaster['id'],
|
||||
@@ -1542,7 +1546,7 @@ class Master extends MasterBase
|
||||
'amount' => -$amount,
|
||||
'balance' => $newMoney,
|
||||
'order_id' => 0,
|
||||
'remark' => '提现申请(手续费 ¥' . number_format($fee, 2, '.', '') . ',预计到账 ¥' . number_format($arrive, 2, '.', '') . ')',
|
||||
'remark' => '提现申请(' . $feeNote . ',预计到账 ¥' . number_format($arrive, 2, '.', '') . ')',
|
||||
'createtime' => $now,
|
||||
]);
|
||||
Db::commit();
|
||||
|
||||
@@ -47,13 +47,13 @@ class FinanceConfigService
|
||||
'withdraw_require_realname' => '1',
|
||||
'withdraw_min_amount' => '10.00',
|
||||
'withdraw_max_amount' => '200.00',
|
||||
'withdraw_daily_amount' => '2000.00',
|
||||
'withdraw_daily_amount' => '200.00',
|
||||
'withdraw_daily_count' => '3',
|
||||
'withdraw_allow_weekdays' => '1,2,3,4,5,6,7',
|
||||
'withdraw_time_start' => '00:00',
|
||||
'withdraw_time_end' => '23:59',
|
||||
'withdraw_fee_mode' => 'percent',
|
||||
'withdraw_fee_rate' => '0.60',
|
||||
'withdraw_fee_mode' => 'free',
|
||||
'withdraw_fee_rate' => '0.00',
|
||||
'withdraw_fee_fixed' => '0.00',
|
||||
'withdraw_fee_min' => '0.00',
|
||||
'withdraw_fee_max' => '0.00',
|
||||
@@ -323,11 +323,11 @@ class FinanceConfigService
|
||||
: -1;
|
||||
|
||||
if ($cfg['fee_mode'] === 'free' || ($cfg['fee_mode'] === 'percent' && $cfg['fee_rate'] <= 0) || ($cfg['fee_mode'] === 'fixed' && $cfg['fee_fixed'] <= 0)) {
|
||||
$feeText = '免通道手续费';
|
||||
$feeText = '免提现手续费';
|
||||
} elseif ($cfg['fee_mode'] === 'fixed') {
|
||||
$feeText = '手续费 ¥' . number_format($cfg['fee_fixed'], 2, '.', '') . '/笔';
|
||||
} else {
|
||||
$feeText = '通道费率 ' . rtrim(rtrim(number_format($cfg['fee_rate'], 2, '.', ''), '0'), '.') . '%';
|
||||
$feeText = '手续费率 ' . rtrim(rtrim(number_format($cfg['fee_rate'], 2, '.', ''), '0'), '.') . '%';
|
||||
if ($cfg['fee_min'] > 0 || $cfg['fee_max'] > 0) {
|
||||
$parts = [];
|
||||
if ($cfg['fee_min'] > 0) {
|
||||
@@ -342,7 +342,88 @@ class FinanceConfigService
|
||||
|
||||
$minTxt = rtrim(rtrim(number_format($cfg['min_amount'], 2, '.', ''), '0'), '.');
|
||||
$maxTxt = rtrim(rtrim(number_format($cfg['max_amount'], 2, '.', ''), '0'), '.');
|
||||
$ruleTip = "完工核销后工费即刻入账;单笔 ¥{$minTxt}~¥{$maxTxt} 可提现,{$feeText}。";
|
||||
$minFmt = number_format($cfg['min_amount'], 2, '.', '');
|
||||
$maxFmt = number_format($cfg['max_amount'], 2, '.', '');
|
||||
|
||||
if ($cfg['daily_amount'] > 0) {
|
||||
$dailyAmtTxt = rtrim(rtrim(number_format($cfg['daily_amount'], 2, '.', ''), '0'), '.');
|
||||
$remainAmtTxt = rtrim(rtrim(number_format(max(0.00, (float)$remainDailyAmount), 2, '.', ''), '0'), '.');
|
||||
$remainAmtFmt = number_format(max(0.00, (float)$remainDailyAmount), 2, '.', '');
|
||||
$amountRuleText = "单笔 ¥{$minFmt} ~ ¥{$maxFmt},每日累计上限 ¥{$dailyAmtTxt}(今日剩余 ¥{$remainAmtFmt})";
|
||||
$dailyLimitSub = "日限 ¥{$dailyAmtTxt} · 剩 ¥{$remainAmtTxt}";
|
||||
} else {
|
||||
$amountRuleText = "单笔 ¥{$minFmt} ~ ¥{$maxFmt},每日不限累计额度";
|
||||
$dailyLimitSub = '单日不限累计额度';
|
||||
}
|
||||
|
||||
if ($cfg['daily_count'] > 0) {
|
||||
$dailyCountText = "每日最多 {$cfg['daily_count']} 次(今日剩余 {$remainDailyCount} 次)";
|
||||
$dailyCountMain = "每日最多 {$cfg['daily_count']} 次";
|
||||
$dailyCountSub = "今日剩余 {$remainDailyCount} 次";
|
||||
} else {
|
||||
$dailyCountText = '每日不限提现次数';
|
||||
$dailyCountMain = '每日不限次数';
|
||||
$dailyCountSub = '不限申请笔数';
|
||||
}
|
||||
|
||||
$weekdayLabel = self::formatAllowWeekdaysLabel($cfg['allow_weekdays']);
|
||||
$openTimeText = $weekdayLabel . ' ' . $cfg['time_start'] . ' - ' . $cfg['time_end'];
|
||||
|
||||
$arrivalParts = [];
|
||||
if (in_array('wechat', $cfg['channels'], true)) {
|
||||
if ($cfg['transfer_mode'] === 'wx_mch_transfer') {
|
||||
if ($cfg['audit_mode'] === 'auto_small' && $cfg['auto_max_amount'] > 0) {
|
||||
$autoMaxTxt = rtrim(rtrim(number_format($cfg['auto_max_amount'], 2, '.', ''), '0'), '.');
|
||||
$arrivalParts[] = "微信零钱:单笔 ≤ ¥{$autoMaxTxt} 免审自动发起转账,24小时内确认收款实时到账;超出额度经财务审核通过后,确认收款实时到账";
|
||||
} else {
|
||||
$arrivalParts[] = '微信零钱:财务审核通过后发起转账,24小时内在页面确认收款实时到账';
|
||||
}
|
||||
} else {
|
||||
$arrivalParts[] = '微信零钱:财务审核并人工打款后到账';
|
||||
}
|
||||
}
|
||||
if (in_array('bank', $cfg['channels'], true)) {
|
||||
$arrivalParts[] = '银行储蓄卡:财务审核并打款至收款银行卡后到账';
|
||||
}
|
||||
$arrivalTimeText = implode(';', $arrivalParts);
|
||||
|
||||
if (in_array('wechat', $cfg['channels'], true) && $cfg['transfer_mode'] === 'wx_mch_transfer') {
|
||||
if ($cfg['audit_mode'] === 'auto_small' && $cfg['auto_max_amount'] > 0) {
|
||||
$autoMaxTxt = rtrim(rtrim(number_format($cfg['auto_max_amount'], 2, '.', ''), '0'), '.');
|
||||
$arrivalMain = '确认收款实时到账';
|
||||
$arrivalSub = "≤¥{$autoMaxTxt}免审 · 24h内确认";
|
||||
} else {
|
||||
$arrivalMain = '审核后实时到账';
|
||||
$arrivalSub = '转账后24h内确认收款';
|
||||
}
|
||||
} else {
|
||||
$arrivalMain = '财务审核打款';
|
||||
$arrivalSub = in_array('bank', $cfg['channels'], true) ? '审核后打款至银行卡' : '审核后人工打款到账';
|
||||
}
|
||||
|
||||
$realnameText = $cfg['require_realname']
|
||||
? '需完成师傅实名认证审核通过后方可发起提现'
|
||||
: ($cfg['max_amount'] >= self::WX_TRANSFER_REALNAME_THRESHOLD
|
||||
? '单笔满 ¥2,000.00 需完成实名认证'
|
||||
: '大额提现按微信规范校验实名');
|
||||
|
||||
$ruleGrid = [
|
||||
['key' => 'amount', 'label' => '可提现额度', 'value' => "¥{$minTxt} ~ ¥{$maxTxt}", 'sub' => $dailyLimitSub],
|
||||
['key' => 'count', 'label' => '每日提现次数', 'value' => $dailyCountMain, 'sub' => $dailyCountSub],
|
||||
['key' => 'time', 'label' => '提现时间', 'value' => "{$cfg['time_start']} - {$cfg['time_end']}", 'sub' => $weekdayLabel . '开放申请'],
|
||||
['key' => 'arrival', 'label' => '到账时间', 'value' => $arrivalMain, 'sub' => $arrivalSub],
|
||||
];
|
||||
|
||||
$rules = [
|
||||
['key' => 'amount', 'label' => '可提现额度', 'value' => $amountRuleText],
|
||||
['key' => 'count', 'label' => '每日提现次数', 'value' => $dailyCountText],
|
||||
['key' => 'time', 'label' => '提现时间', 'value' => $openTimeText],
|
||||
['key' => 'arrival', 'label' => '到账时间', 'value' => $arrivalTimeText],
|
||||
['key' => 'fee', 'label' => '手续费说明', 'value' => $feeText],
|
||||
['key' => 'auth', 'label' => '认证要求', 'value' => $realnameText],
|
||||
];
|
||||
|
||||
$ruleTip = "单笔 ¥{$minTxt}~¥{$maxTxt} 可提现,{$dailyCountText},{$openTimeText} 开放,{$feeText}。";
|
||||
if (!$cfg['enabled']) {
|
||||
$ruleTip = $cfg['close_tip'];
|
||||
}
|
||||
@@ -377,10 +458,43 @@ class FinanceConfigService
|
||||
'audit_mode' => $cfg['audit_mode'],
|
||||
'auto_max_amount' => $cfg['auto_max_amount'],
|
||||
'arrival_desc' => $arrivalDesc,
|
||||
'amount_rule_text' => $amountRuleText,
|
||||
'daily_count_text' => $dailyCountText,
|
||||
'open_time_text' => $openTimeText,
|
||||
'arrival_time_text' => $arrivalTimeText,
|
||||
'realname_text' => $realnameText,
|
||||
'rule_grid' => $ruleGrid,
|
||||
'rules' => $rules,
|
||||
'rule_tip' => $ruleTip,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 将允许提现星期数组格式化为可读中文周期
|
||||
*/
|
||||
protected static function formatAllowWeekdaysLabel(array $weekdays): string
|
||||
{
|
||||
$days = array_values(array_unique(array_map('intval', $weekdays)));
|
||||
sort($days);
|
||||
if ($days === [1, 2, 3, 4, 5, 6, 7]) {
|
||||
return '每日';
|
||||
}
|
||||
if ($days === [1, 2, 3, 4, 5]) {
|
||||
return '周一至周五';
|
||||
}
|
||||
if ($days === [6, 7]) {
|
||||
return '周六、周日';
|
||||
}
|
||||
$dayNames = [1 => '周一', 2 => '周二', 3 => '周三', 4 => '周四', 5 => '周五', 6 => '周六', 7 => '周日'];
|
||||
$labels = [];
|
||||
foreach ($days as $d) {
|
||||
if (isset($dayNames[$d])) {
|
||||
$labels[] = $dayNames[$d];
|
||||
}
|
||||
}
|
||||
return !empty($labels) ? implode('、', $labels) : '每日';
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验师傅发起的提现请求(全量业务规则 + 微信小程序商家转账硬规范)
|
||||
*
|
||||
|
||||
在新工单中引用
屏蔽一个用户