```mermaid
---
title: 0.佣金提现配置流程
---
flowchart TD
    Start((开始))
    --> Login[使用平台管理员或有权限账号登录]

    Login --> HasPermission{是否有「提现配置管理」权限?}
    HasPermission -->|否| NoPermission[无权限，流程终止]
    HasPermission -->|是| EnterSettingPage[进入佣金提现配置页面]

    subgraph SettingFlow[提现配置设置流程]
        EnterSettingPage --> CheckCurrent[查看当前生效配置]
        CheckCurrent --> NeedNewConfig{是否需要新增配置?}

        NeedNewConfig -->|否| KeepCurrent[继续沿用当前配置]
        NeedNewConfig -->|是| FillConfig[填写配置项<br/>每日提现次数、最低提现金额、手续费率]

        FillConfig --> ValidateConfig{配置内容是否有效?}
        ValidateConfig -->|否| FixConfig[提示错误并重新填写]
        FixConfig --> FillConfig

        ValidateConfig -->|是| SaveConfig[保存新配置]
        SaveConfig --> AutoReplace[系统自动将旧配置失效]
        AutoReplace --> NewConfigActive[新配置生效]
    end

    subgraph VerifyFlow[生效验证流程]
        KeepCurrent --> VerifyEntry[进入验收环节]
        NewConfigActive --> VerifyEntry

        VerifyEntry --> CheckCurrentAfterSave[在「当前生效配置」核对最新参数]
        CheckCurrentAfterSave --> CheckHistory[在「配置历史列表」核对新旧配置状态]
        CheckHistory --> NeedBusinessVerify{是否需要做业务验证?}

        NeedBusinessVerify -->|否| VerifyPass[配置验收通过]
        NeedBusinessVerify -->|是| GoWithdrawalTest[进入代理提现申请验证<br/>（结合 8.代理佣金提现以及审批流程）]

        GoWithdrawalTest --> CheckMinAmount[核对最低提现金额规则是否生效]
        CheckMinAmount --> CheckDailyLimit[核对每日提现次数限制是否生效]
        CheckDailyLimit --> CheckFeeRate[核对手续费计算是否符合配置]
        CheckFeeRate --> BusinessVerifyResult{业务验证是否通过?}

        BusinessVerifyResult -->|是| VerifyPass
        BusinessVerifyResult -->|否| BackToSetting[返回提现配置页面调整后复测]
        BackToSetting --> FillConfig
    end

    VerifyPass --> End([流程结束])

    %% ==================== 样式美化 ====================
    style Start fill:#90EE90,stroke:#2E7D32,stroke-width:2px
    style End fill:#FF9999,stroke:#C62828,stroke-width:2px
    style NoPermission fill:#FFCDD2,stroke:#D32F2F
    style FixConfig fill:#FFCCBC,stroke:#E64A19
    style BackToSetting fill:#FFCCBC,stroke:#E64A19

    classDef decision fill:#FFF3E0,stroke:#F57C00,stroke-width:2px
    class HasPermission,NeedNewConfig,ValidateConfig,NeedBusinessVerify,BusinessVerifyResult decision
```
