|
@@ -116,7 +116,10 @@
|
|
|
<th>群组ID</th>
|
|
|
<th>群组名称</th>
|
|
|
<th>状态</th>
|
|
|
- <th>费率(%)</th>
|
|
|
+ <th>入款费率(%)</th>
|
|
|
+ <th>入款汇率</th>
|
|
|
+ <th>出款费率(%)</th>
|
|
|
+ <th>出款汇率</th>
|
|
|
<th>创建时间</th>
|
|
|
<th>操作</th>
|
|
|
</tr>
|
|
@@ -183,8 +186,20 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="mb-3">
|
|
|
- <label for="editFeeRate" class="form-label">费率 (%)</label>
|
|
|
- <input type="number" class="form-control" id="editFeeRate" step="0.1" min="0" max="100" required>
|
|
|
+ <label for="editInFeeRate" class="form-label">入款费率 (%)</label>
|
|
|
+ <input type="number" class="form-control" id="editInFeeRate" step="0.01" min="0" max="100" required>
|
|
|
+ </div>
|
|
|
+ <div class="mb-3">
|
|
|
+ <label for="editInExchangeRate" class="form-label">入款汇率</label>
|
|
|
+ <input type="number" class="form-control" id="editInExchangeRate" step="0.0001" min="0" required>
|
|
|
+ </div>
|
|
|
+ <div class="mb-3">
|
|
|
+ <label for="editOutFeeRate" class="form-label">出款费率 (%)</label>
|
|
|
+ <input type="number" class="form-control" id="editOutFeeRate" step="0.01" min="0" max="100" required>
|
|
|
+ </div>
|
|
|
+ <div class="mb-3">
|
|
|
+ <label for="editOutExchangeRate" class="form-label">出款汇率</label>
|
|
|
+ <input type="number" class="form-control" id="editOutExchangeRate" step="0.0001" min="0" required>
|
|
|
</div>
|
|
|
</form>
|
|
|
</div>
|
|
@@ -276,7 +291,10 @@
|
|
|
${group.is_active ? '启用' : '禁用'}
|
|
|
</span>
|
|
|
</td>
|
|
|
- <td>${parseFloat(group.fee_rate || 0).toFixed(1)}%</td>
|
|
|
+ <td>${parseFloat(group.in_fee_rate || 0).toFixed(2)}%</td>
|
|
|
+ <td>${parseFloat(group.in_exchange_rate || 1).toFixed(4)}</td>
|
|
|
+ <td>${parseFloat(group.out_fee_rate || 0).toFixed(2)}%</td>
|
|
|
+ <td>${parseFloat(group.out_exchange_rate || 1).toFixed(4)}</td>
|
|
|
<td>${new Date(group.created_at).toLocaleString()}</td>
|
|
|
<td>
|
|
|
<button class="btn btn-sm btn-primary btn-action" onclick="editGroup('${group.id}')">
|
|
@@ -340,7 +358,10 @@
|
|
|
document.getElementById('editGroupId').value = group.id;
|
|
|
document.getElementById('editGroupName').value = group.group_name;
|
|
|
document.getElementById('editGroupStatus').checked = group.is_active;
|
|
|
- document.getElementById('editFeeRate').value = group.fee_rate || 0;
|
|
|
+ document.getElementById('editInFeeRate').value = group.in_fee_rate || 0;
|
|
|
+ document.getElementById('editInExchangeRate').value = group.in_exchange_rate || 1;
|
|
|
+ document.getElementById('editOutFeeRate').value = group.out_fee_rate || 0;
|
|
|
+ document.getElementById('editOutExchangeRate').value = group.out_exchange_rate || 1;
|
|
|
|
|
|
const modal = new bootstrap.Modal(document.getElementById('editGroupModal'));
|
|
|
modal.show();
|
|
@@ -367,9 +388,13 @@
|
|
|
const groupId = document.getElementById('editGroupId').value;
|
|
|
const groupName = document.getElementById('editGroupName').value;
|
|
|
const isActive = document.getElementById('editGroupStatus').checked;
|
|
|
- const feeRate = parseFloat(document.getElementById('editFeeRate').value) || 0;
|
|
|
+ const inFeeRate = parseFloat(document.getElementById('editInFeeRate').value) || 0;
|
|
|
+ const inExchangeRate = parseFloat(document.getElementById('editInExchangeRate').value) || 1;
|
|
|
+ const outFeeRate = parseFloat(document.getElementById('editOutFeeRate').value) || 0;
|
|
|
+ const outExchangeRate = parseFloat(document.getElementById('editOutExchangeRate').value) || 1;
|
|
|
|
|
|
- if (isNaN(feeRate) || feeRate < 0 || feeRate > 100) {
|
|
|
+ if (isNaN(inFeeRate) || inFeeRate < 0 || inFeeRate > 100 ||
|
|
|
+ isNaN(outFeeRate) || outFeeRate < 0 || outFeeRate > 100) {
|
|
|
Swal.fire({
|
|
|
icon: 'error',
|
|
|
title: '输入错误',
|
|
@@ -378,6 +403,16 @@
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ if (isNaN(inExchangeRate) || inExchangeRate <= 0 ||
|
|
|
+ isNaN(outExchangeRate) || outExchangeRate <= 0) {
|
|
|
+ Swal.fire({
|
|
|
+ icon: 'error',
|
|
|
+ title: '输入错误',
|
|
|
+ text: '汇率必须大于0'
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
try {
|
|
|
const token = localStorage.getItem('token');
|
|
|
const response = await fetch(`/api/groups/${groupId}`, {
|
|
@@ -386,7 +421,14 @@
|
|
|
'Authorization': `Bearer ${token}`,
|
|
|
'Content-Type': 'application/json'
|
|
|
},
|
|
|
- body: JSON.stringify({ groupName, isActive, feeRate })
|
|
|
+ body: JSON.stringify({
|
|
|
+ group_name: groupName,
|
|
|
+ is_active: isActive,
|
|
|
+ in_fee_rate: inFeeRate,
|
|
|
+ in_exchange_rate: inExchangeRate,
|
|
|
+ out_fee_rate: outFeeRate,
|
|
|
+ out_exchange_rate: outExchangeRate
|
|
|
+ })
|
|
|
});
|
|
|
|
|
|
if (response.ok) {
|