From 879a75e26e94d766e893e47d65a0b239e04ce94a Mon Sep 17 00:00:00 2001
From: zj <1772600164@qq.com>
Date: Tue, 10 Jun 2025 16:58:26 +0800
Subject: [PATCH] 后台修改杠杆

---
 src/main/webapp/contract_order_list_content.jsp |  109 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 107 insertions(+), 2 deletions(-)

diff --git a/src/main/webapp/contract_order_list_content.jsp b/src/main/webapp/contract_order_list_content.jsp
index e7315ff..a7bdea1 100644
--- a/src/main/webapp/contract_order_list_content.jsp
+++ b/src/main/webapp/contract_order_list_content.jsp
@@ -127,13 +127,44 @@
 							<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">
@@ -167,9 +198,83 @@
 <%@ 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>
\ No newline at end of file
+</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>
\ No newline at end of file

--
Gitblit v1.9.3