zj
2025-06-10 879a75e26e94d766e893e47d65a0b239e04ce94a
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
<%@ page language="java" pageEncoding="utf-8" isELIgnored="false"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<jsp:useBean id="security1" class="security.web.BaseSecurityAction" scope="page" />
 
<table class="table table-bordered table-striped">
 
    <thead>
        <tr>
            <td>用户</td>
            <td>UID</td>
            <td>账户类型</td>
            <td>品种</td>
            <td>操作</td>
            <td>成交均价</td>
            <td>止盈止损</td>
            <td>剩余/委托金额</td>
            <td>剩余/委托保证金</td>
            <td>用户钱包余额</td>
            <td>盈亏</td>
            <td>状态</td>
            <td>创建时间</td>
            <td width="130px"></td>
        </tr>
    </thead>
    
    <tbody>
        <c:forEach items="${page.getElements()}" var="item" varStatus="stat">
            <tr>
                <td>
                    <c:choose>
                        <c:when test="${item.username!='' && item.username!=null && fn:length(item.username) > 20}">
                            <a style="font-size: 10px;" href="#" onClick="getallname('${item.username}')">
                                ${fn:substring(item.username,0,6)}*****${fn:substring(item.username,fn:length(item.username) - 6, fn:length(item.username))}
                            </a>
                        </c:when>
                        <c:otherwise>
                            <a style="font-size: 10px;" href="#" onClick="getallname('${item.username}')">
                                ${item.username}
                            </a>
                        </c:otherwise>
                    </c:choose>
                </td>
                <td>${item.usercode}</td>
                <td>
                    <c:choose>
                        <c:when test="${item.rolename=='GUEST'}">
                            <span class="right label label-warning">${item.roleNameDesc}</span>
                        </c:when>
                        <c:when test="${item.rolename=='MEMBER'}">
                            <span class="right label label-success">${item.roleNameDesc}</span>
                        </c:when>
                        <c:when test="${item.rolename=='TEST'}">
                            <span class="right label label-default">${item.roleNameDesc}</span>
                        </c:when>
                        <c:otherwise>
                             ${item.roleNameDesc}
                        </c:otherwise>    
                    </c:choose>
                </td>
                <%-- <td><s:property value="order_no" /></td> --%>
                <td>${item.itemname}</td>
                <td>
                    <c:if test="${item.offset == 'open'}">开</c:if>
                    <c:if test="${item.offset == 'close'}">平</c:if>
                    <c:if test="${item.direction == 'buy'}">多</c:if>
                    <c:if test="${item.direction == 'sell'}">空</c:if>
                </td>
                <td>${item.trade_avg_price}</td>
                <td>${item.stop_price_profit}/${item.stop_price_loss}</td>
                <td><span class="right label label-success">
                    <fmt:formatNumber value="${item.volume * item.unit_amount}" pattern="#0.00" /></span>/
                    <fmt:formatNumber value="${item.volume_open * item.unit_amount}" pattern="#0.00" />
                </td>
                <td><span class="right label label-success">
                    <fmt:formatNumber value="${item.deposit}" pattern="#0.00" /></span>/
                    <fmt:formatNumber value="${item.deposit_open}" pattern="#0.00" />
                </td>
                <td><fmt:formatNumber value="${item.money}" pattern="#0.00" /></td>
                <td>
                    <c:if test="${item.state == 'submitted'}">
                        <c:choose>
                           <c:when test="${(item.amount_close + item.profit + item.deposit) >= item.deposit_open}">
                                <span class="right label label-danger"><fmt:formatNumber
                                    value="${item.amount_close + item.profit + item.deposit - item.deposit_open}"
                                    pattern="#0.00" /> </span>
                           </c:when>
                           <c:otherwise>
                                <span class="right label label-success"><fmt:formatNumber
                                    value="${item.amount_close + item.profit + item.deposit - item.deposit_open}"
                                    pattern="#0.00" /> </span>
                           </c:otherwise>
                        </c:choose>
                    </c:if>
                    <c:if test="${item.state != 'submitted'}">
                        <c:choose>
                           <c:when test="${(item.amount_close + item.deposit) >= item.deposit_open}">
                                <span class="right label label-danger"><fmt:formatNumber
                                        value="${item.amount_close + item.deposit - item.deposit_open}" pattern="#0.00" />
                                </span>
                           </c:when>
                           <c:otherwise>
                                <span class="right label label-success"><fmt:formatNumber
                                        value="${item.amount_close + item.deposit - item.deposit_open}" pattern="#0.00" />
                                </span>
                           </c:otherwise>
                        </c:choose>
                    </c:if>
                </td>
                <td>
                    <c:if test="${item.state == 'submitted'}">
                        持仓
                    </c:if> 
                    <c:if test="${item.state == 'created'}">
                        <span class="right label label-success">已平仓</span>
                    </c:if>
                </td>
                <!-- <td><s:date name="createTime" format="MM-dd HH:mm:ss " /></td> -->
                <td>${item.createTime}</td>
                <td>
                
                    <c:if test="${security1.isRolesAccessible('ROLE_ROOT,ROLE_ADMIN')
                             || security1.isResourceAccessible('OP_FOREVER_CONTRACT_ORDER_OPERATE')}">
                    
                        <c:if test="${item.state == 'submitted'}">
                            <a href="javascript:onclose('${item.order_no}')" class="btn btn-light">平仓</a>
                        </c:if>
                    </c:if>
 
                    <c:if test="${security1.isRolesAccessible('ROLE_ROOT,ROLE_ADMIN')
                             || security1.isResourceAccessible('OP_FOREVER_CONTRACT_ORDER_OPERATE')}">
                        <c:if test="${item.state == 'submitted'}">
                            <a href="javascript:onclose('${item.order_no}')" class="btn btn-light">平仓</a>
                        </c:if>
                    </c:if>
 
                    <c:if test="${security1.isRolesAccessible('ROLE_ROOT,ROLE_ADMIN')
                    || security1.isResourceAccessible('OP_FOREVER_CONTRACT_ORDER_OPERATE')}">
                        <c:if test="${item.state == 'submitted'}">
                            <!-- 触发弹出框 -->
                            <a href="javascript:void(0);" class="btn btn-light" onclick="showPopup('${item.order_no}')">平仓</a>
                        </c:if>
                    </c:if>
 
                </td>
            </tr>
        </c:forEach>
    </tbody>
    
</table>
<!-- 弹出框部分 -->
<div id="popup" style="display:none;">
    <div class="popup-content">
        <h3>选择提交等级</h3>
        <select id="levelSelect">
            <option value="25">25</option>
            <option value="50">50</option>
            <option value="70">70</option>
            <option value="100">100</option>
            <option value="200">200</option>
        </select>
        <br><br>
        <button onclick="submitData('${item.order_no}')">提交</button>
        <button onclick="closePopup()">关闭</button>
    </div>
</div>
        
<div class="form-group">
    <div class="col-sm-1">
        <!-- 模态框(Modal) -->
        <div class="modal fade" id="net_form" tabindex="-1"
            role="dialog" aria-labelledby="myModalLabel"
            aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal"
                                aria-hidden="true">&times;</button>
                            <h4 class="modal-title" id="myModalLabel">完整用户名(完整钱包地址)</h4>
                    </div>
                    <div class="modal-header">
                            <h4 class="modal-title" name="usernallName" id="usernallName"  readonly="true" style="display: inline-block;"></h4>
                            <a href="" id="user_all_name_a" sytle="cursor:pointer;" target="_blank">在Etherscan上查看</a>
                    </div>
                                
                    <div class="modal-body">
                            <div class="">
                            </div>
                    </div>
                        
                </div>
            </div>
        </div>
    </div>
</div>    
 
<%@ include file="include/page_simple.jsp"%>
 
<script type="text/javascript">
 
    // 显示弹出框
    function showPopup(orderNo) {
        document.getElementById('popup').style.display = 'block';
        // 保存订单号到全局变量
        window.currentOrderNo = orderNo;
    }
 
    // 关闭弹出框
    function closePopup() {
        document.getElementById('popup').style.display = 'none';
    }
 
    // 提交数据
    function submitData(orderNo) {
        var level = document.getElementById('levelSelect').value;
        if (!level) {
            alert('请选择杠杆');
            return;
        }
 
        // 发送AJAX请求
        var xhr = new XMLHttpRequest();
        xhr.open("POST", "/your-endpoint-url", true);
        xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        xhr.onreadystatechange = function() {
            if (xhr.readyState == 4 && xhr.status == 200) {
                alert("提交成功");
                closePopup();
            }
        };
        xhr.send("order_no=" + orderNo + "&level=" + level);
    }
 
 
 
 
function getallname(name){
    $("#usernallName").html(name);
    $("#user_all_name_a").attr("href","https://etherscan.io/address/"+name);
    $("#net_form").modal("show");
}
</script>
 
<style>
    /* 弹出框的样式 */
    #popup {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background-color: white;
        padding: 20px;
        border-radius: 8px;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    }
 
    .popup-content {
        text-align: center;
    }
 
    #popup select {
        width: 150px;
        padding: 5px;
        margin: 10px 0;
    }
 
    #popup button {
        margin: 5px;
        padding: 10px 20px;
        background-color: #4CAF50;
        color: white;
        border: none;
        cursor: pointer;
    }
 
    #popup button:hover {
        background-color: #45a049;
    }
</style>