liujie
1 天以前 74f8b8074a2fb391b5363b4dca5f99bf31993430
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
@layout("/common/_container.html"){
<div class="row">
    <div class="col-sm-12">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>抽成规则</h5>
            </div>
            <div class="ibox-content">
                <div class="row row-lg">
                    <div class="col-sm-12">
 
                        <input hidden="hidden" id="type" value="${type}">
                        <input hidden="hidden" id="branchOfficeId" value="${branchOfficeId}">
 
                        <div class="initialLevel col-sm-12 control-label form-group"  >
                            <div class="initialLevel col-sm-3 control-label form-group"  >
                                <label class="control-label" >分公司抽成设置:</label>
                            </div>
                        </div>
 
                        @if(roleType == 1){
                            <div class="initialLevel col-sm-12 control-label form-group" style="text-align: left" >
                                <div class="initialLevel col-sm-3 control-label form-group"  >
                                    <span class="control-label" >司机订单保险费,每单固定抽取</span>
                                    <input class="control-label" id="num1" name="num1" value="${num1}" type="number" min="0" style="height: 30px;width: 80px">
                                    <span class="control-label" >元</span>
                                </div>
                            </div>
                        @}
 
                        <div class="switch-container">
                            @if(type == 1){
                                <button class="switch-btn active" value="1" onclick="switchTab(this, '包月')">包月</button>
                            @}
                            @if(type == 2){
                                <button class="switch-btn active" value="2" onclick="switchTab(this, '按单')">按单</button>
                            @}
                        </div>
 
                        @if(type == 1){
                            <div id="month" class="initialLevel col-sm-12 control-label form-group" style="text-align: left" >
                                <div class="initialLevel col-sm-3 control-label form-group"  >
                                    <span class="control-label" >抽成,每月平台抽取分公司</span>
                                    <input class="control-label" id="num2" name="num2" value="${num2}" type="number" min="0" style="height: 30px;width: 80px">
                                    <span class="control-label" >元</span>
                                </div>
                            </div>
                        @}
                        @if(type == 2){
                            <div id="monad" class="initialLevel col-sm-12 control-label form-group" style="text-align: left" >
                                <div class="initialLevel col-sm-3 control-label form-group"  >
                                    <span class="control-label" >抽成,每单平台抽取分公司</span>
                                    <input class="control-label" id="num3" name="num3" value="${num3}" type="number" min="0" style="height: 30px;width: 80px">
                                    <span class="control-label" >元</span>
                                </div>
                            </div>
                        @}
                        <div class="initialLevel col-sm-12 control-label form-group"  >
                            <div class="initialLevel col-sm-3 control-label form-group"  >
                                <label class="control-label" >代检车抽成设置:</label>
                            </div>
                        </div>
                        @if(roleType == 1){
                        <div class="initialLevel col-sm-12 control-label form-group" style="text-align: left" >
                            <div class="initialLevel col-sm-3 control-label form-group"  >
                                <span class="control-label" >每单抽取分公司</span>
                                <input class="control-label" id="num5" name="num5" value="${num5!}" type="number" min="0" style="height: 30px;width: 80px">
                                <span class="control-label" >元</span>
                            </div>
                        </div>
                        @}
                        <div class="row btn-group-m-t">
                            <div class="col-sm-10" style="text-align: center">
                                <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="TSystemConfig.extractionRulesSubmit()"/>
                            </div>
                        </div>
 
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="${ctxPath}/static/modular/system/tBranchOffice/tSystemConfig.js"></script>
<style>
    .switch-container {
        display: flex;
        margin: 20px;
        border-radius: 4px;
        overflow: hidden;
        width: fit-content;
    }
 
    .switch-btn {
        padding: 8px 20px;
        cursor: pointer;
        border: none;
        background: #f0f0f0;
        color: #666;
        transition: all 0.3s ease;
        font-size: 14px;
    }
 
    .switch-btn.active {
        background: #409EFF;
        color: white;
    }
 
    /* 去除按钮之间的边框 */
    .switch-btn:not(:last-child) {
        border-right: 1px solid #ddd;
    }
 
    /* 鼠标悬停效果 */
    .switch-btn:hover:not(.active) {
        background: #e0e0e0;
    }
</style>
<script>
    function switchTab(element, type) {
        // 切换按钮状态
        document.querySelectorAll('.switch-btn').forEach(btn => {
            btn.classList.remove('active');
        });
        element.classList.add('active');
        console.log(element)
        console.log(type)
 
        // 根据类型显示或隐藏模块
        if (type == '包月') {
            document.getElementById('month').style.display = 'block';
            document.getElementById('monad').style.display = 'none';
            $("#type").val(1)
        } else if (type == '按单') {
            document.getElementById('month').style.display = 'none';
            document.getElementById('monad').style.display = 'block';
            $("#type").val(2)
        }
 
    }
    $("input[name=num1]").bind('input',function(){
        var value = $(this).val()
        regexp(value)
    })
    $("input[name=num2]").bind('input',function(){
        var value = $(this).val()
        regexp(value)
    })
    $("input[name=num3]").bind('input',function(){
        var value = $(this).val()
        regexp(value)
    })
    $("input[name=num4]").bind('input',function(){
        var value = $(this).val()
        regexp(value)
    })
    // function regexp(value){
    //     var reg=/^[1-9]\d*$/;//由 1-9开头 的正则表达式
    //     //先判断是否为整数 在判断 是否在 1-总页  整数范围之内
    //     if(reg.test(value)){
    //         if(parseInt(value) <= 0){
    //             Feng.error("请输入大于0的正整数");
    //             return;
    //         }
    //     }else{
    //         Feng.error("请输入大于0的正整数");
    //         return;
    //     }
    // }
    function regexp(value){
        var reg=/^(\d+.?)?\d{0,2}$/;//由 1-9开头 的正则表达式 整数
        var reg1 = /^(([1-9]{1}\d*)|(0{1}))(\.\d{2})$/; // 两位小数
        //先判断是否为整数 在判断 是否在 1-总页  整数范围之内
        if(reg.test(value)){
            if(value == 0){
                Feng.error("请输入大于0的整数或保留两位小数");
                return;
            }
        }else{
            Feng.error("请输入整数或保留两位小数");
            return;
        }
    }
</script>
@}