fix: align affiliate settings schema

This commit is contained in:
2026-08-16 18:47:43 +08:00
parent 001eb66532
commit 99db790a6f
3 changed files with 48 additions and 45 deletions
@@ -2,24 +2,24 @@ export const affiliateSchema = {
key: 'payment.affiliate',
title: '推广返佣',
icon: 'fas fa-share-alt',
description: '配置返佣比例、归因窗口和结算说明。',
description: '配置推广归因、佣金比例、结算和提现规则。',
defaults: {
pay_rebate_s: false,
pay_rebate_ratio: 10,
payment_affiliate_window_days: 30,
payment_affiliate_require_paid_order: true,
pay_rebate_self_s: true,
pay_rebate_show_users: true,
payment_affiliate_user_ratio: 10,
pay_rebate_ratio_vip_1: 0,
pay_rebate_ratio_vip_2: 0,
pay_rebate_poster_s: true,
pay_rebate_poster_img: '',
pay_rebate_poster_title: '',
pay_rebate_poster_desc: '',
pay_rebate_text_desc: '',
pay_rebate_text_details: '',
pay_rebate_text_discount: '',
affiliate_enabled: false,
affiliate_ratio: 5,
affiliate_order_types: ['membership', 'content'],
affiliate_touch_window_days: 30,
affiliate_settlement_days: 7,
affiliate_allow_self_purchase: false,
affiliate_show_stats: true,
affiliate_promotion_text: '',
affiliate_earnings_text: '',
affiliate_withdrawal_agreement: '',
affiliate_payout_channels: ['alipay', 'wechat'],
affiliate_min_withdrawal: 50,
affiliate_withdrawal_fee: 5,
affiliate_daily_withdrawal_count: 3,
affiliate_daily_withdrawal_limit: 500,
affiliate_withdrawal_reset_time: '00:00',
},
groups: [
{
@@ -27,33 +27,26 @@ export const affiliateSchema = {
title: '返佣策略',
icon: 'fas fa-project-diagram',
fields: [
{ key: 'pay_rebate_s', label: '启用推广返佣结构', type: 'switch', default: false },
{ key: 'pay_rebate_ratio', label: '返佣比例(%)', type: 'number', default: 10, min: 0, max: 100, dependsOn: { key: 'pay_rebate_s', value: true } },
{ key: 'payment_affiliate_window_days', label: '归因窗口(天)', type: 'number', default: 30, min: 1, max: 365, dependsOn: { key: 'pay_rebate_s', value: true } },
{ key: 'payment_affiliate_require_paid_order', label: '仅对已支付订单返佣', type: 'switch', default: true, dependsOn: { key: 'pay_rebate_s', value: true } },
{ key: 'pay_rebate_self_s', label: '自购返佣', type: 'switch', default: true, dependsOn: { key: 'pay_rebate_s', value: true } },
{ key: 'pay_rebate_show_users', label: '显示推广用户', type: 'switch', default: true, dependsOn: { key: 'pay_rebate_s', value: true } },
{ key: 'affiliate_enabled', label: '启用推广返佣', type: 'switch', default: false },
{ key: 'affiliate_ratio', label: '全站佣金比例(%)', type: 'number', default: 5, min: 0, max: 100, dependsOn: { key: 'affiliate_enabled', value: true } },
{ key: 'affiliate_order_types', label: '适用订单类型', type: 'checkbox', default: ['membership', 'content'], sanitize_type: 'array', options: [{ label: '会员订单', value: 'membership' }, { label: '付费内容', value: 'content' }], dependsOn: { key: 'affiliate_enabled', value: true } },
{ key: 'affiliate_touch_window_days', label: '首次触达窗口(天)', type: 'number', default: 30, min: 1, max: 365, dependsOn: { key: 'affiliate_enabled', value: true } },
{ key: 'affiliate_settlement_days', label: '结算观察期(天)', type: 'number', default: 7, min: 0, max: 90, dependsOn: { key: 'affiliate_enabled', value: true } },
{ key: 'affiliate_allow_self_purchase', label: '允许自购返佣', type: 'switch', default: false, dependsOn: { key: 'affiliate_enabled', value: true } },
{ key: 'affiliate_show_stats', label: '展示推广统计', type: 'switch', default: true, dependsOn: { key: 'affiliate_enabled', value: true } },
],
},
{
key: 'user-ratio',
title: '用户返佣比例',
icon: 'fas fa-users-cog',
key: 'withdrawal',
title: '提现规则',
icon: 'fas fa-wallet',
fields: [
{ key: 'payment_affiliate_user_ratio', label: '普通用户比例(%)', type: 'number', default: 10, min: 0, max: 100, dependsOn: { key: 'pay_rebate_s', value: true } },
{ key: 'pay_rebate_ratio_vip_1', label: 'VIP1比例(%)', type: 'number', default: 0, min: 0, max: 100, dependsOn: { key: 'pay_rebate_s', value: true } },
{ key: 'pay_rebate_ratio_vip_2', label: 'VIP2比例(%)', type: 'number', default: 0, min: 0, max: 100, dependsOn: { key: 'pay_rebate_s', value: true } },
],
},
{
key: 'poster',
title: '推广海报',
icon: 'fas fa-image',
fields: [
{ key: 'pay_rebate_poster_s', label: '启用推广海报', type: 'switch', default: true, dependsOn: { key: 'pay_rebate_s', value: true } },
{ key: 'pay_rebate_poster_img', label: '海报背景图', type: 'media', default: '', dependsOn: { key: 'pay_rebate_s', value: true } },
{ key: 'pay_rebate_poster_title', label: '海报标题', type: 'input', default: '', dependsOn: { key: 'pay_rebate_s', value: true } },
{ key: 'pay_rebate_poster_desc', label: '海报描述', type: 'input', default: '', dependsOn: { key: 'pay_rebate_s', value: true } },
{ key: 'affiliate_min_withdrawal', label: '最低提现金额', type: 'number', default: 50, min: 0, max: 99999, dependsOn: { key: 'affiliate_enabled', value: true } },
{ key: 'affiliate_withdrawal_fee', label: '提现手续费(%)', type: 'number', default: 5, min: 0, max: 100, dependsOn: { key: 'affiliate_enabled', value: true } },
{ key: 'affiliate_daily_withdrawal_count', label: '每日可提现次数', type: 'number', default: 3, min: 0, max: 99999, dependsOn: { key: 'affiliate_enabled', value: true } },
{ key: 'affiliate_daily_withdrawal_limit', label: '每日提现上限', type: 'number', default: 500, min: 0, max: 999999, dependsOn: { key: 'affiliate_enabled', value: true } },
{ key: 'affiliate_withdrawal_reset_time', label: '重置时间', type: 'input', default: '00:00', help: '按站点 WordPress 时区重置,格式 HH:MM。', dependsOn: { key: 'affiliate_enabled', value: true } },
{ key: 'affiliate_payout_channels', label: '可用收款渠道', type: 'checkbox', default: ['alipay', 'wechat'], sanitize_type: 'array', options: [{ label: '支付宝收款码', value: 'alipay' }, { label: '微信收款码', value: 'wechat' }], dependsOn: { key: 'affiliate_enabled', value: true } },
],
},
{
@@ -61,10 +54,10 @@ export const affiliateSchema = {
title: '文案设置',
icon: 'fas fa-pen-fancy',
fields: [
{ key: 'pay_rebate_text_desc', label: '返佣说明', type: 'textarea', default: '', dependsOn: { key: 'pay_rebate_s', value: true } },
{ key: 'pay_rebate_text_details', label: '明细说明', type: 'textarea', default: '', dependsOn: { key: 'pay_rebate_s', value: true } },
{ key: 'pay_rebate_text_discount', label: '折扣文案', type: 'input', default: '', dependsOn: { key: 'pay_rebate_s', value: true } },
{ key: 'affiliate_promotion_text', label: '推广说明', type: 'textarea', default: '', dependsOn: { key: 'affiliate_enabled', value: true } },
{ key: 'affiliate_earnings_text', label: '收益说明', type: 'textarea', default: '', dependsOn: { key: 'affiliate_enabled', value: true } },
{ key: 'affiliate_withdrawal_agreement', label: '提现协议', type: 'textarea', default: '', dependsOn: { key: 'affiliate_enabled', value: true } },
],
},
],
}
};
+4 -1
View File
@@ -1,6 +1,9 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
import { dirname, resolve } from 'path'
import { fileURLToPath } from 'url'
const __dirname = dirname(fileURLToPath(import.meta.url))
export default defineConfig({
plugins: [vue()],
+7
View File
@@ -150,6 +150,13 @@ class SchemaPayment {
['key' => 'affiliate_allow_self_purchase', 'label' => '允许自购返佣', 'type' => 'switch', 'default' => false],
['key' => 'affiliate_show_stats', 'label' => '展示推广统计', 'type' => 'switch', 'default' => true],
]],
['key' => 'withdrawal', 'title' => '提现规则', 'fields' => [
['key' => 'affiliate_min_withdrawal', 'label' => '最低提现金额', 'type' => 'number', 'default' => 50, 'min' => 0, 'max' => 99999],
['key' => 'affiliate_withdrawal_fee', 'label' => '提现手续费(%)', 'type' => 'number', 'default' => 5, 'min' => 0, 'max' => 100],
['key' => 'affiliate_daily_withdrawal_count', 'label' => '每日可提现次数', 'type' => 'number', 'default' => 3, 'min' => 0, 'max' => 99999],
['key' => 'affiliate_daily_withdrawal_limit', 'label' => '每日提现上限', 'type' => 'number', 'default' => 500, 'min' => 0, 'max' => 999999],
['key' => 'affiliate_withdrawal_reset_time', 'label' => '重置时间', 'type' => 'input', 'default' => '00:00'],
]],
['key' => 'text', 'title' => '文案设置', 'fields' => [
['key' => 'affiliate_promotion_text', 'label' => '推广说明', 'type' => 'textarea', 'default' => ''],
['key' => 'affiliate_earnings_text', 'label' => '收益说明', 'type' => 'textarea', 'default' => ''],