feat(withdraw): 后台支持提现总开关与方式过滤并升级钱包与提现页面体验

这个提交包含在:
chen
2026-09-19 15:41:25 +08:00
父节点 efab61498d
当前提交 3868becc63
共有 17 个文件被更改,包括 1872 次插入 和 116 次删除

查看文件

@@ -195,21 +195,39 @@ class Config extends Common
'partner_mode', 'partner_enable', 'partner_count_type', 'partner_active_days',
'partner_chain_max_depth', 'partner_push3_amounts', 'partner_madow_mode',
'partner_show_madow_rate',
'partner_madow_base_rate', 'partner_madow_step_orders', 'partner_voucher_times',
'partner_voucher_days', 'partner_maker_bonus', 'partner_maker_peer_rate',
'partner_madow_base_rate', 'partner_madow_step_orders',
'partner_madow_rule_title', 'partner_madow_rules',
'partner_madow_withdraw_enable', 'partner_madow_withdraw_min',
'partner_voucher_times', 'partner_voucher_days',
'partner_voucher_rule_title', 'partner_voucher_rules',
'partner_maker_bonus', 'partner_maker_peer_rate',
'partner_maker_overtaken_rate', 'partner_team_total', 'partner_venue_split',
'partner_county_full', 'partner_venue_share_per_order', 'partner_county_share_per_order',
'partner_venue_peer_rate', 'partner_county_peer_rate',
'partner_role_name_taster', 'partner_role_name_maker', 'partner_role_name_venue',
'partner_role_name_county', 'partner_role_name_partner',
];
$ruleDefaults = [
'partner_madow_rule_title' => '市值与增值规则',
'partner_madow_rules' => [
['title' => 'dmepa获取与核算', 'desc' => '平台合伙人与创客达成考核或完成订单后,系统将于次日 00:30 起统一参与每日dmepa加权核算并自动分发。'],
['title' => '市值动态增值', 'desc' => '市值随全平台订单增加而上浮增值。全网完成订单总量越多,dmepa单价所对应的市值越高,共享生态红利。'],
['title' => '价值说明与权益', 'desc' => '市值仅作为平台数字生态资产价值参考展示,不可直接兑换现金提现。具体权益按平台股东与合伙人章程执行。'],
],
'partner_voucher_rule_title' => '兑换券释放与使用规则',
'partner_voucher_rules' => [
['title' => '赠送与释放天数', 'desc' => '会员在平台完成符合条件的商城订单后,系统将按订单金额(默认 1.5 倍)生成兑换券计划,分 365 天按日线性释放。'],
['title' => '每日自动到账', 'desc' => '系统将于次日 00:30 起统一执行日结核算,按期释放的兑换券将自动计入您的「可用兑换券」账户,无需手动领取。'],
['title' => '全场购物直接抵扣', 'desc' => '可用兑换券可在平台商城下单结算时作为现金抵扣使用,尊享优惠抵扣权益。'],
],
];
if ('GET' === $this->request->method()) {
$all = ShoproConfig::getConfigs('shop.commission', false) ?: [];
$configs = [];
foreach ($keys as $key) {
$configs[$key] = $all[$key] ?? null;
}
$defaults = [
$defaults = array_merge([
'partner_mode' => 1,
'partner_enable' => 1,
'partner_count_type' => 'order',
@@ -218,6 +236,8 @@ class Config extends Common
'partner_push3_amounts' => [398, 400, 600],
'partner_madow_mode' => 'madow',
'partner_show_madow_rate' => 1,
'partner_madow_withdraw_enable' => 1,
'partner_madow_withdraw_min' => 1,
'partner_madow_base_rate' => '0.00000075',
'partner_madow_step_orders' => 1,
'partner_voucher_times' => 1.5,
@@ -237,13 +257,23 @@ class Config extends Common
'partner_role_name_venue' => '酒道馆',
'partner_role_name_county' => '区县代理',
'partner_role_name_partner' => '合伙股东',
];
], $ruleDefaults);
foreach ($defaults as $key => $value) {
if ($configs[$key] === null || $configs[$key] === '') {
$configs[$key] = $value;
}
}
$configs['partner_show_madow_rate'] = isset($configs['partner_show_madow_rate']) ? intval($configs['partner_show_madow_rate']) : 1;
$configs['partner_madow_withdraw_enable'] = isset($configs['partner_madow_withdraw_enable']) ? intval($configs['partner_madow_withdraw_enable']) : 1;
$configs['partner_madow_withdraw_min'] = isset($configs['partner_madow_withdraw_min']) ? floatval($configs['partner_madow_withdraw_min']) : 1.0;
foreach (['partner_madow_rules', 'partner_voucher_rules'] as $ruleKey) {
if (isset($configs[$ruleKey]) && is_string($configs[$ruleKey])) {
$decoded = json_decode($configs[$ruleKey], true);
if (is_array($decoded)) {
$configs[$ruleKey] = $decoded;
}
}
}
} elseif ('POST' === $this->request->method()) {
check_env('commission');
$params = $this->request->param();
@@ -256,6 +286,12 @@ class Config extends Common
if (isset($save['partner_show_madow_rate'])) {
$save['partner_show_madow_rate'] = intval($save['partner_show_madow_rate']);
}
if (isset($save['partner_madow_withdraw_enable'])) {
$save['partner_madow_withdraw_enable'] = intval($save['partner_madow_withdraw_enable']);
}
if (isset($save['partner_madow_withdraw_min'])) {
$save['partner_madow_withdraw_min'] = max(0.0, floatval($save['partner_madow_withdraw_min']));
}
// 确保数据库存在 partner_show_madow_rate 配置行
$existConfig = ShoproConfig::where('code', 'shop.commission.partner_show_madow_rate')->find();
if (!$existConfig) {
@@ -269,6 +305,29 @@ class Config extends Common
'weigh' => 86
]);
}
// 确保数据库存在规则条目等必要配置行
$ensureConfigs = [
'shop.commission.partner_madow_withdraw_enable' => ['name' => '开启dmepa提现', 'desc' => '1=开启 0=关闭', 'type' => 'int', 'value' => '1', 'weigh' => 86],
'shop.commission.partner_madow_withdraw_min' => ['name' => 'dmepa最低提现金额', 'desc' => 'dmepa最低提现金额(元)', 'type' => 'number', 'value' => '1', 'weigh' => 86],
'shop.commission.partner_madow_rule_title' => ['name' => 'dmepa规则弹窗标题', 'desc' => '我的dmepa市值规则弹窗标题', 'type' => 'string', 'value' => '市值与增值规则', 'weigh' => 86],
'shop.commission.partner_madow_rules' => ['name' => 'dmepa规则说明条目', 'desc' => '我的dmepa市值规则条目', 'type' => 'array', 'value' => json_encode($ruleDefaults['partner_madow_rules'], JSON_UNESCAPED_UNICODE), 'weigh' => 86],
'shop.commission.partner_voucher_rule_title' => ['name' => '兑换券规则弹窗标题', 'desc' => '兑换券规则弹窗标题', 'type' => 'string', 'value' => '兑换券释放与使用规则', 'weigh' => 89],
'shop.commission.partner_voucher_rules' => ['name' => '兑换券规则说明条目', 'desc' => '兑换券规则条目', 'type' => 'array', 'value' => json_encode($ruleDefaults['partner_voucher_rules'], JSON_UNESCAPED_UNICODE), 'weigh' => 89],
];
foreach ($ensureConfigs as $confCode => $confMeta) {
$existConfig = ShoproConfig::where('code', $confCode)->find();
if (!$existConfig) {
ShoproConfig::create([
'code' => $confCode,
'parent_code' => 'shop.commission',
'name' => $confMeta['name'],
'description' => $confMeta['desc'],
'type' => $confMeta['type'],
'value' => $confMeta['value'],
'weigh' => $confMeta['weigh'],
]);
}
}
foreach (['partner_role_name_taster', 'partner_role_name_maker', 'partner_role_name_venue', 'partner_role_name_county', 'partner_role_name_partner'] as $roleKey) {
if (isset($save[$roleKey])) {
$save[$roleKey] = trim((string) $save[$roleKey]);
@@ -346,6 +405,13 @@ class Config extends Common
if ('GET' === $this->request->method()) {
$configs = ShoproConfig::getConfigs('shop.recharge_withdraw', false);
if ($configs && isset($configs['withdraw'])) {
if (!isset($configs['withdraw']['status'])) {
$configs['withdraw']['status'] = !empty($configs['withdraw']['methods']) ? 1 : 0;
} else {
$configs['withdraw']['status'] = intval($configs['withdraw']['status']);
}
}
} elseif ('POST' === $this->request->method()) {
$params = $this->request->param();
if (!isset($params['recharge']['methods'])) {
@@ -357,7 +423,15 @@ class Config extends Common
if (!isset($params['withdraw']['methods'])) {
$params['withdraw']['methods'] = [];
}
if (!isset($params['withdraw']['status'])) {
$params['withdraw']['status'] = 0;
} else {
$params['withdraw']['status'] = intval($params['withdraw']['status']);
}
$configs = ShoproConfig::setConfigs('shop.recharge_withdraw', $params);
if ($configs && isset($configs['withdraw'])) {
$configs['withdraw']['status'] = isset($configs['withdraw']['status']) ? intval($configs['withdraw']['status']) : (!empty($configs['withdraw']['methods']) ? 1 : 0);
}
}
$this->success('操作成功', null, $configs);
}

查看文件

@@ -47,6 +47,9 @@ class Config extends Common
}
$config[self::getShortCode($row)] = $row->value;
}
if ($code === 'shop.recharge_withdraw.withdraw' && !isset($config['status'])) {
$config['status'] = !empty($config['methods']) ? 1 : 0;
}
}
// 设置配置缓存
cache("config:{$code}", $config);
@@ -124,6 +127,19 @@ class Config extends Common
$config->value = $value;
$config->save();
}
} else {
// 自动补齐缺失的提现开关配置项,确保热更新无缝落地
if ($code === 'shop.recharge_withdraw.withdraw.status') {
self::create([
'code' => $code,
'parent_code' => 'shop.recharge_withdraw.withdraw',
'name' => '开启提现',
'type' => 'boolean',
'value' => (string)intval($value),
'rule' => 'required',
'weigh' => 50
]);
}
}
}

查看文件

@@ -16,6 +16,8 @@ class Withdraw extends Common
'status_text',
'charge_rate_format',
'withdraw_info_hidden',
'withdraw_info_display',
'is_madow_withdraw',
'withdraw_type_text',
'wechat_transfer_state_text',
];
@@ -90,9 +92,84 @@ class Withdraw extends Common
return bcmul((string)$value, '100', 1) . '%';
}
public function getIsMadowWithdrawAttr($value, $data)
{
$info = $this->withdraw_info ?? ($data['withdraw_info'] ?? null);
if (is_string($info)) {
$info = json_decode($info, true) ?: [];
}
if (!is_array($info)) {
return false;
}
return (isset($info['wallet_type']) && $info['wallet_type'] === 'madow')
|| (isset($info['提现资产']) && strcasecmp($info['提现资产'], 'dmepa') === 0);
}
public function getWithdrawInfoDisplayAttr($value, $data)
{
$info = $this->withdraw_info ?? ($data['withdraw_info'] ?? null);
if (is_string($info)) {
$info = json_decode($info, true) ?: [];
}
if (!is_array($info)) {
return [];
}
$display = [];
$isMadow = (isset($info['wallet_type']) && $info['wallet_type'] === 'madow')
|| (isset($info['提现资产']) && strcasecmp($info['提现资产'], 'dmepa') === 0);
if ($isMadow) {
$display['提现资产'] = 'DMEPA';
// 扣除 DMEPA
$madowAmount = $info['madow_amount'] ?? ($info['扣除DMEPA'] ?? ($info['扣除dmepa'] ?? null));
if ($madowAmount !== null) {
$madowClean = trim(str_ireplace(['dmepa', ' '], '', (string)$madowAmount));
$display['扣除DMEPA'] = $madowClean . ' DMEPA';
}
// 市值汇率
$rate = $info['rate'] ?? ($info['市值汇率'] ?? ($info['折算汇率'] ?? null));
if ($rate !== null) {
if (is_numeric($rate)) {
$rateClean = rtrim(rtrim(number_format((float)$rate, 12, '.', ''), '0'), '.');
$display['市值汇率'] = '1 DMEPA ≈ ' . $rateClean . ' 元';
} else {
$rateStr = (string)$rate;
$rateClean = trim(str_replace(['1 DMEPA ≈', '元/dmepa', '元/DMEPA', '元', ' '], '', $rateStr));
$display['市值汇率'] = '1 DMEPA ≈ ' . $rateClean . ' 元';
}
}
// 换算市值
$marketValue = $info['换算市值'] ?? ($data['amount'] ?? ($this->amount ?? null));
if ($marketValue !== null) {
$valClean = trim(str_replace(['元', ' '], '', (string)$marketValue));
$display['换算市值'] = number_format((float)$valClean, 2, '.', '') . ' 元';
}
}
// 填充银行卡或其它常规账户信息,并过滤英文底层键
$excludeKeys = ['wallet_type', 'madow_amount', 'rate', '提现资产', '扣除DMEPA', '扣除dmepa', '市值汇率', '折算汇率', '换算市值'];
foreach ($info as $k => $v) {
if (!in_array($k, $excludeKeys)) {
$display[$k] = $v;
}
}
return $display;
}
public function getWithdrawInfoHiddenAttr($value, $data)
{
$withdraw_info = $value ?: ($this->withdraw_info ?? null);
if (is_string($withdraw_info)) {
$withdraw_info = json_decode($withdraw_info, true) ?: [];
}
if (!is_array($withdraw_info)) {
return [];
}
foreach ($withdraw_info as $key => &$info) {
if (in_array($key, ['微信用户', '真实姓名'])) {

查看文件

@@ -576,6 +576,21 @@
</template>
<template v-if="form.model.withdraw">
<div class="sa-title is-line">提现配置</div>
<el-form-item label="开启提现">
<div>
<div class="sa-flex">
<el-switch v-model="form.model.withdraw.status" :active-value="1"
:inactive-value="0"></el-switch>
<div class="label-tip"
:class="form.model.withdraw.status == 1?'sa-color--primary':''">
{{form.model.withdraw.status == 1?'开启':'关闭'}}
</div>
</div>
<div class="tip">
<div> 关闭提现后,用户端将隐藏提现入口且禁止提现操作 </div>
</div>
</div>
</el-form-item>
<el-form-item label="提现方式">
<el-checkbox-group v-model="form.model.withdraw.methods">
<el-checkbox label="wechat">到微信零钱</el-checkbox>
@@ -928,10 +943,10 @@
</div>
<div class="tip">默认 398 / 400 / 600,三者之和建议等于主售价</div>
</el-form-item>
<div class="sa-title is-line">马豆</div>
<div class="sa-title is-line">dmepa</div>
<el-form-item label="发放模式">
<el-radio-group v-model="form.model.partner_madow_mode">
<el-radio label="madow">马豆</el-radio>
<el-radio label="madow">dmepa</el-radio>
<el-radio label="cash">现金</el-radio>
</el-radio-group>
</el-form-item>
@@ -943,7 +958,35 @@
</el-form-item>
<el-form-item label="显示马币市值">
<el-switch v-model="form.model.partner_show_madow_rate" :active-value="1" :inactive-value="0"></el-switch>
<div class="tip">开启后,移动端“我的马豆”资产卡片将显示“马币市值 1 马豆 ≈ xxxx 元 生态增值”指示胶囊;关闭则隐藏该胶囊。</div>
<div class="tip">开启后,移动端“我的dmepa”资产卡片将显示“市值 1 dmepa ≈ xxxx 元 生态增值”指示胶囊;关闭则隐藏该胶囊。</div>
</el-form-item>
<el-form-item label="开启dmepa提现">
<el-switch v-model="form.model.partner_madow_withdraw_enable" :active-value="1" :inactive-value="0"></el-switch>
<div class="tip">开启后,移动端“我的dmepa”页面将显示提现按钮,支持持仓dmepa按实时市值提现到银行卡;关闭后隐藏提现入口并禁止提现。</div>
</el-form-item>
<el-form-item label="dmepa最低提现金额">
<el-input class="sa-w-360" v-model="form.model.partner_madow_withdraw_min" type="number" placeholder="1">
<template #append>元</template>
</el-input>
<div class="tip">每次dmepa折合现金提现的最低申请金额(元)</div>
</el-form-item>
<el-form-item label="市值规则弹窗标题">
<el-input class="sa-w-360" v-model="form.model.partner_madow_rule_title" placeholder="市值与增值规则"></el-input>
</el-form-item>
<el-form-item label="市值规则说明条目">
<div style="width: 100%; max-width: 660px;">
<div v-for="(item, index) in form.model.partner_madow_rules" :key="index" style="margin-bottom: 12px; padding: 12px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px;">
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;">
<div style="display: flex; align-items: center;">
<span style="display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: #e0b467; color: #fff; font-size: 12px; font-weight: bold; margin-right: 8px;">{{ index + 1 }}</span>
<el-input style="width: 260px;" v-model="item.title" placeholder="条目标题(如:dmepa获取与核算)" size="small"></el-input>
</div>
<el-button type="danger" link size="small" @click="onDeleteMadowRule(index)">删除</el-button>
</div>
<el-input type="textarea" :rows="2" v-model="item.desc" placeholder="条目详细说明内容..."></el-input>
</div>
<el-button icon="Plus" size="small" @click="onAddMadowRule">添加规则条目</el-button>
</div>
</el-form-item>
<div class="sa-title is-line">兑换券</div>
<el-form-item label="倍数">
@@ -952,6 +995,24 @@
<el-form-item label="释放天数">
<el-input class="sa-w-360" v-model="form.model.partner_voucher_days" type="number"></el-input>
</el-form-item>
<el-form-item label="释放规则弹窗标题">
<el-input class="sa-w-360" v-model="form.model.partner_voucher_rule_title" placeholder="兑换券释放与使用规则"></el-input>
</el-form-item>
<el-form-item label="释放规则说明条目">
<div style="width: 100%; max-width: 660px;">
<div v-for="(item, index) in form.model.partner_voucher_rules" :key="index" style="margin-bottom: 12px; padding: 12px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px;">
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;">
<div style="display: flex; align-items: center;">
<span style="display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: #e0b467; color: #fff; font-size: 12px; font-weight: bold; margin-right: 8px;">{{ index + 1 }}</span>
<el-input style="width: 260px;" v-model="item.title" placeholder="条目标题(如:赠送与释放天数)" size="small"></el-input>
</div>
<el-button type="danger" link size="small" @click="onDeleteVoucherRule(index)">删除</el-button>
</div>
<el-input type="textarea" :rows="2" v-model="item.desc" placeholder="条目详细说明内容..."></el-input>
</div>
<el-button icon="Plus" size="small" @click="onAddVoucherRule">添加规则条目</el-button>
</div>
</el-form-item>
<div class="sa-title is-line">创客</div>
<el-form-item label="V1–V6 单笔基数">
<div class="sa-flex" style="gap:8px;flex-wrap:wrap">

查看文件

@@ -45,11 +45,26 @@
<sa-user-profile :user="scope.row.user" :id="scope.row.user_id"></sa-user-profile>
</template>
</el-table-column>
<el-table-column label="提现金额/实际到账" min-width="166">
<el-table-column label="提现金额/实际到账" min-width="170">
<template #default="scope">
<div class="sa-table-line-1">
{{ scope.row.amount || '-' }}/{{ scope.row.paid_fee }}元
</div>
<template v-if="scope.row.is_madow_withdraw">
<div class="sa-flex" style="margin-bottom: 2px;">
<el-tag size="small" type="warning" effect="dark" style="background: linear-gradient(135deg, #d4af37, #aa7c11); border: none; font-weight: bold; border-radius: 4px; height: 20px; line-height: 20px; padding: 0 6px;">
DMEPA提现
</el-tag>
</div>
<div class="sa-table-line-1" style="color: #b88200; font-weight: bold;">
换算市值: {{ scope.row.amount || '-' }}元
</div>
<div class="sa-table-line-1" style="font-size: 12px; color: #909399;">
实际到账: {{ scope.row.paid_fee }}元
</div>
</template>
<template v-else>
<div class="sa-table-line-1">
{{ scope.row.amount || '-' }}/{{ scope.row.paid_fee }}元
</div>
</template>
</template>
</el-table-column>
<el-table-column label="费率/手续费" min-width="132">
@@ -78,12 +93,21 @@
<el-table-column label="打款信息" min-width="380">
<template #default="scope">
<div class="sa-flex-col sa-col-top">
<div v-for="(value, key) in scope.row.withdraw_info" :key="value" class="sa-flex">
<div class="sa-table-line-1"> {{ key }}:{{ value }} </div>
<el-icon class="copy-document" @click="onClipboard(value)">
<copy-document />
</el-icon>
</div>
<template v-for="(value, key) in (scope.row.withdraw_info_display || scope.row.withdraw_info)">
<div v-if="!['wallet_type', 'madow_amount', 'rate'].includes(key)" :key="key" class="sa-flex" style="margin-bottom: 2px;">
<div class="sa-table-line-1">
<span v-if="['市值汇率', '换算市值', '提现资产', '扣除DMEPA'].includes(key)" style="color: #b88200; font-weight: bold;">
{{ key }}: {{ value }}
</span>
<span v-else>
{{ key }}: {{ value }}
</span>
</div>
<el-icon class="copy-document" @click="onClipboard(value)">
<copy-document />
</el-icon>
</div>
</template>
<div v-if="scope.row.withdraw_type === 'wechat'" class="sa-flex">
<div class="sa-table-line-1">
打款状态: {{ scope.row.wechat_transfer_state_text }} | {{