|
|
@@ -91,6 +91,9 @@
|
|
|
<div id="toolbar" class="toolbar">
|
|
|
{:build_toolbar('refresh')}
|
|
|
<!-- 添加访问general/txmx/summary接口的按钮 -->
|
|
|
+ <button id="gas-btn" class="btn btn-primary" onclick="loadGas()">
|
|
|
+ {:__('手续费转账')}
|
|
|
+ </button>
|
|
|
<button id="summary-btn" class="btn btn-primary" onclick="loadSummary()">
|
|
|
{:__('归集转账')}
|
|
|
</button>
|
|
|
@@ -108,17 +111,132 @@
|
|
|
|
|
|
</div>
|
|
|
<script>
|
|
|
+ function loadGas() {
|
|
|
+ // 显示加载中的提示(可选)
|
|
|
+ const loadingAlert = alert('数据加载中,请稍候...');
|
|
|
+
|
|
|
+ // 使用AJAX请求访问general/txmx/summary接口
|
|
|
+ fetch('{:url("general/txmx/summary")}')
|
|
|
+ .then(response => response.json())
|
|
|
+ .then(data => {
|
|
|
+ // 关闭加载提示(如果有)
|
|
|
+ if(loadingAlert) document.body.removeChild(loadingAlert);
|
|
|
+
|
|
|
+ // 处理返回的数据
|
|
|
+ console.log(data);
|
|
|
+
|
|
|
+ // 显示"已完成"弹窗
|
|
|
+ const doneAlert = document.createElement('div');
|
|
|
+ doneAlert.innerHTML = `
|
|
|
+ <div style="
|
|
|
+ position: fixed;
|
|
|
+ top: 50%;
|
|
|
+ left: 50%;
|
|
|
+ transform: translate(-50%, -50%);
|
|
|
+ padding: 20px 40px;
|
|
|
+ background: #4CAF50;
|
|
|
+ color: white;
|
|
|
+ border-radius: 8px;
|
|
|
+ box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
|
|
+ z-index: 1000;
|
|
|
+ font-family: Arial, sans-serif;
|
|
|
+ font-size: 18px;
|
|
|
+ animation: fadeIn 0.3s, fadeOut 0.3s 2s forwards;
|
|
|
+ ">
|
|
|
+ 已完成!
|
|
|
+ </div>
|
|
|
+ `;
|
|
|
+
|
|
|
+ // 添加淡入淡出动画
|
|
|
+ const style = document.createElement('style');
|
|
|
+ style.innerHTML = `
|
|
|
+ @keyframes fadeIn {
|
|
|
+ from { opacity: 0; }
|
|
|
+ to { opacity: 1; }
|
|
|
+ }
|
|
|
+ @keyframes fadeOut {
|
|
|
+ from { opacity: 1; }
|
|
|
+ to { opacity: 0; }
|
|
|
+ }
|
|
|
+ `;
|
|
|
+ document.head.appendChild(style);
|
|
|
+
|
|
|
+ document.body.appendChild(doneAlert);
|
|
|
+
|
|
|
+ // 3秒后移除弹窗
|
|
|
+ setTimeout(() => {
|
|
|
+ document.body.removeChild(doneAlert);
|
|
|
+ document.head.removeChild(style);
|
|
|
+ }, 2300);
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.error('Error loading summary:', error);
|
|
|
+ // 错误时显示错误提示(可选)
|
|
|
+ alert('加载失败: ' + error.message);
|
|
|
+ });
|
|
|
+ }
|
|
|
function loadSummary() {
|
|
|
+ // 显示加载中的提示(可选)
|
|
|
+ const loadingAlert = alert('数据加载中,请稍候...');
|
|
|
+
|
|
|
// 使用AJAX请求访问general/txmx/summary接口
|
|
|
fetch('{:url("general/txmx/summary")}')
|
|
|
.then(response => response.json())
|
|
|
.then(data => {
|
|
|
- // 处理返回的数据,例如显示在某个位置
|
|
|
+ // 关闭加载提示(如果有)
|
|
|
+ if(loadingAlert) document.body.removeChild(loadingAlert);
|
|
|
+
|
|
|
+ // 处理返回的数据
|
|
|
console.log(data);
|
|
|
- // 这里可以添加代码来显示数据,例如在一个模态框中或直接更新页面内容
|
|
|
+
|
|
|
+ // 显示"已完成"弹窗
|
|
|
+ const doneAlert = document.createElement('div');
|
|
|
+ doneAlert.innerHTML = `
|
|
|
+ <div style="
|
|
|
+ position: fixed;
|
|
|
+ top: 50%;
|
|
|
+ left: 50%;
|
|
|
+ transform: translate(-50%, -50%);
|
|
|
+ padding: 20px 40px;
|
|
|
+ background: #4CAF50;
|
|
|
+ color: white;
|
|
|
+ border-radius: 8px;
|
|
|
+ box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
|
|
+ z-index: 1000;
|
|
|
+ font-family: Arial, sans-serif;
|
|
|
+ font-size: 18px;
|
|
|
+ animation: fadeIn 0.3s, fadeOut 0.3s 2s forwards;
|
|
|
+ ">
|
|
|
+ 已完成!
|
|
|
+ </div>
|
|
|
+ `;
|
|
|
+
|
|
|
+ // 添加淡入淡出动画
|
|
|
+ const style = document.createElement('style');
|
|
|
+ style.innerHTML = `
|
|
|
+ @keyframes fadeIn {
|
|
|
+ from { opacity: 0; }
|
|
|
+ to { opacity: 1; }
|
|
|
+ }
|
|
|
+ @keyframes fadeOut {
|
|
|
+ from { opacity: 1; }
|
|
|
+ to { opacity: 0; }
|
|
|
+ }
|
|
|
+ `;
|
|
|
+ document.head.appendChild(style);
|
|
|
+
|
|
|
+ document.body.appendChild(doneAlert);
|
|
|
+
|
|
|
+ // 3秒后移除弹窗
|
|
|
+ setTimeout(() => {
|
|
|
+ document.body.removeChild(doneAlert);
|
|
|
+ document.head.removeChild(style);
|
|
|
+ }, 2300);
|
|
|
})
|
|
|
.catch(error => {
|
|
|
console.error('Error loading summary:', error);
|
|
|
+ // 错误时显示错误提示(可选)
|
|
|
+ alert('加载失败: ' + error.message);
|
|
|
});
|
|
|
}
|
|
|
</script>
|