[html]<div id="warframe-trading">
<!-- Заголовок -->
<div class="trading-header">
<div class="trading-title">🛒 РУЧНАЯ ТОРГОВАЯ СИСТЕМА</div>
<div class="trading-balance">Платина: <span class="editable" contenteditable="true">1000</span> ♢</div>
</div>
<!-- Инструкция -->
<div class="instruction-box">
<div class="instruction-title">💡 КАК ИСПОЛЬЗОВАТЬ:</div>
<div class="instruction-steps">
<div>1. Редактируйте цифры прямо в ячейках</div>
<div>2. Добавляйте/удаляйте строки таблицы</div>
<div>3. Копируйте HTML код для сохранения</div>
</div>
</div>
<!-- Торговая таблица -->
<div class="trade-table-section">
<div class="section-title">ТАБЛИЦА ТОРГОВЛИ</div>
<div class="table-controls">
<button class="control-btn add-row-btn" onclick="addTradeRow()">➕ Добавить строку</button>
<button class="control-btn calculate-btn" onclick="calculateTradeTotal()">📊 Посчитать итог</button>
<button class="control-btn clear-btn" onclick="clearTradeTable()">🗑️ Очистить таблицу</button>
</div>
<div class="trade-table-container">
<table class="trade-table" id="trade-table">
<thead>
<tr>
<th width="40">№</th>
<th width="200">Предмет</th>
<th width="100">Кол-во</th>
<th width="120">Цена за шт. (♢)</th>
<th width="120">Общая цена (♢)</th>
<th width="80">Действия</th>
</tr>
</thead>
<tbody>
<tr>
<td class="row-number">1</td>
<td><span class="editable" contenteditable="true">Нерв</span></td>
<td><span class="editable" contenteditable="true">5</span></td>
<td><span class="editable" contenteditable="true">2</span></td>
<td class="total-price">10</td>
<td class="actions">
<button class="action-btn delete-btn" onclick="deleteRow(this)">🗑️</button>
<button class="action-btn calc-btn" onclick="calculateRow(this)">🔢</button>
</td>
</tr>
<tr>
<td class="row-number">2</td>
<td><span class="editable" contenteditable="true">Разрыв</span></td>
<td><span class="editable" contenteditable="true">1</span></td>
<td><span class="editable" contenteditable="true">45</span></td>
<td class="total-price">45</td>
<td class="actions">
<button class="action-btn delete-btn" onclick="deleteRow(this)">🗑️</button>
<button class="action-btn calc-btn" onclick="calculateRow(this)">🔢</button>
</td>
</tr>
</tbody>
<tfoot>
<tr class="total-row">
<td colspan="4" class="total-label">ОБЩАЯ СТОИМОСТЬ:</td>
<td class="grand-total" id="grand-total">55</td>
<td></td>
</tr>
</tfoot>
</table>
</div>
</div>
<!-- История сделок -->
<div class="history-section">
<div class="section-title">ИСТОРИЯ СДЕЛОК</div>
<div class="history-controls">
<button class="control-btn" onclick="addHistoryEntry()">➕ Добавить запись</button>
<button class="control-btn export-btn" onclick="exportTradeData()">💾 Экспорт данных</button>
</div>
<div class="history-table-container">
<table class="history-table" id="history-table">
<thead>
<tr>
<th width="100">Дата</th>
<th>Описание сделки</th>
<th width="100">Сумма (♢)</th>
<th width="80">Действия</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="editable" contenteditable="true">01.12.2023</span></td>
<td><span class="editable" contenteditable="true">Продал моды новичку</span></td>
<td><span class="editable" contenteditable="true">+55</span></td>
<td class="actions">
<button class="action-btn delete-btn" onclick="deleteHistoryRow(this)">🗑️</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- Шаблоны предметов -->
<div class="templates-section">
<div class="section-title">ШАБЛОНЫ ПРЕДМЕТОВ</div>
<div class="templates-grid">
<div class="template-item" onclick="insertTemplate('Нерв', 2)">⛰️ Нерв (2♢)</div>
<div class="template-item" onclick="insertTemplate('Рубидо', 2)">🔴 Рубидо (2♢)</div>
<div class="template-item" onclick="insertTemplate('Аура', 3)">🔵 Аура (3♢)</div>
<div class="template-item" onclick="insertTemplate('Разрыв', 45)">💥 Разрыв (45♢)</div>
<div class="template-item" onclick="insertTemplate('Серьезный урон', 35)">⚔️ Серьезный урон (35♢)</div>
<div class="template-item" onclick="insertTemplate('Скорость', 25)">⚡ Скорость (25♢)</div>
<div class="template-item" onclick="insertTemplate('Нитайн', 25)">❄️ Нитайн (25♢)</div>
<div class="template-item" onclick="insertTemplate('Аргоны', 40)">💠 Аргоны (40♢)</div>
</div>
</div>
</div>
<style>
/* Основные стили */
#warframe-trading {
background: #141316;
border: 2px solid #2a4c6e;
border-radius: 8px;
padding: 20px;
font-family: 'Roboto', sans-serif;
color: #b8c4ce;
max-width: 1000px;
margin: 20px auto;
box-shadow: 0 0 30px rgba(74, 140, 223, 0.2);
}
/* Заголовок */
.trading-header {
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid #2a4c6e;
padding-bottom: 15px;
margin-bottom: 20px;
}
.trading-title {
font-size: 24px;
font-weight: bold;
color: #4a8cdf;
text-shadow: 0 0 10px rgba(74, 140, 223, 0.5);
}
.trading-balance {
font-size: 18px;
color: #d4af37;
font-weight: bold;
}
/* Инструкция */
.instruction-box {
background: linear-gradient(135deg, #1a1a1d, #0a0a0c);
border: 1px solid #2a4c6e;
border-radius: 6px;
padding: 15px;
margin-bottom: 20px;
}
.instruction-title {
color: #4a8cdf;
font-weight: bold;
margin-bottom: 8px;
font-size: 14px;
}
.instruction-steps {
font-size: 12px;
color: #8b9bb4;
}
.instruction-steps div {
margin: 4px 0;
}
/* Секции */
.section-title {
background: linear-gradient(90deg, #2a4c6e, #1a1a1d);
padding: 8px 12px;
border-radius: 4px;
font-size: 14px;
font-weight: bold;
margin-bottom: 15px;
border-left: 3px solid #4a8cdf;
}
/* Кнопки управления */
.table-controls, .history-controls {
display: flex;
gap: 10px;
margin-bottom: 15px;
flex-wrap: wrap;
}
.control-btn {
background: linear-gradient(135deg, #2a4c6e, #1a1a1d);
border: 1px solid #4a8cdf;
color: #b8c4ce;
padding: 8px 12px;
border-radius: 4px;
cursor: pointer;
font-size: 12px;
transition: all 0.3s ease;
}
.control-btn:hover {
background: linear-gradient(135deg, #4a8cdf, #2a4c6e);
transform: translateY(-1px);
}
.calculate-btn {
background: linear-gradient(135deg, #4a8cdf, #2a4c6e);
}
.clear-btn {
background: linear-gradient(135deg, #df4a8c, #8c2a4a);
}
.export-btn {
background: linear-gradient(135deg, #4CAF50, #2E7D32);
}
/* Таблицы */
.trade-table-container, .history-table-container {
background: #1a1a1d;
border: 1px solid #2a4c6e;
border-radius: 6px;
overflow: hidden;
}
.trade-table, .history-table {
width: 100%;
border-collapse: collapse;
font-size: 12px;
}
.trade-table th, .history-table th {
background: linear-gradient(135deg, #2a4c6e, #1a1a1d);
padding: 10px 8px;
text-align: left;
border-bottom: 1px solid #2a4c6e;
color: #4a8cdf;
font-weight: bold;
}
.trade-table td, .history-table td {
padding: 8px;
border-bottom: 1px solid #2a4c6e;
vertical-align: middle;
}
.trade-table tbody tr:hover, .history-table tbody tr:hover {
background: rgba(74, 140, 223, 0.1);
}
/* Редактируемые ячейки */
.editable {
background: rgba(255, 255, 255, 0.05);
padding: 4px 8px;
border-radius: 3px;
border: 1px dashed transparent;
min-width: 40px;
display: inline-block;
transition: all 0.3s ease;
}
.editable:focus {
outline: none;
border-color: #4a8cdf;
background: rgba(74, 140, 223, 0.2);
}
/* Цены и итоги */
.total-price, .grand-total {
color: #d4af37;
font-weight: bold;
font-size: 13px;
}
.total-row {
background: rgba(212, 175, 55, 0.1) !important;
}
.total-label {
color: #d4af37;
font-weight: bold;
text-align: right;
padding-right: 20px !important;
}
.grand-total {
font-size: 16px;
color: #d4af37;
}
/* Кнопки действий */
.actions {
text-align: center;
}
.action-btn {
background: none;
border: 1px solid #2a4c6e;
color: #b8c4ce;
padding: 4px 8px;
border-radius: 3px;
cursor: pointer;
font-size: 10px;
margin: 0 2px;
transition: all 0.3s ease;
}
.action-btn:hover {
transform: scale(1.1);
}
.delete-btn:hover {
border-color: #df4a8c;
color: #df4a8c;
}
.calc-btn:hover {
border-color: #4a8cdf;
color: #4a8cdf;
}
/* Шаблоны предметов */
.templates-section {
margin-top: 20px;
}
.templates-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
gap: 8px;
}
.template-item {
background: #1a1a1d;
border: 1px solid #2a4c6e;
border-radius: 4px;
padding: 8px 12px;
font-size: 11px;
cursor: pointer;
transition: all 0.3s ease;
text-align: center;
}
.template-item:hover {
border-color: #4a8cdf;
background: rgba(74, 140, 223, 0.2);
transform: translateY(-1px);
}
/* Номера строк */
.row-number {
color: #8b9bb4;
font-size: 11px;
text-align: center;
}
/* Адаптивность */
@media (max-width: 768px) {
.trading-header {
flex-direction: column;
gap: 10px;
text-align: center;
}
.table-controls, .history-controls {
flex-direction: column;
}
.trade-table-container {
overflow-x: auto;
}
.templates-grid {
grid-template-columns: repeat(2, 1fr);
}
}
</style>
<script>
// Добавление новой строки в таблицу торговли
function addTradeRow() {
const table = document.getElementById('trade-table').getElementsByTagName('tbody')[0];
const rowCount = table.rows.length + 1;
const newRow = table.insertRow();
newRow.innerHTML = `
<td class="row-number">${rowCount}</td>
<td><span class="editable" contenteditable="true">Новый предмет</span></td>
<td><span class="editable" contenteditable="true">1</span></td>
<td><span class="editable" contenteditable="true">0</span></td>
<td class="total-price">0</td>
<td class="actions">
<button class="action-btn delete-btn" onclick="deleteRow(this)">🗑️</button>
<button class="action-btn calc-btn" onclick="calculateRow(this)">🔢</button>
</td>
`;
updateRowNumbers();
}
// Удаление строки из таблицы торговли
function deleteRow(button) {
const row = button.closest('tr');
row.remove();
updateRowNumbers();
calculateTradeTotal();
}
// Удаление строки из истории
function deleteHistoryRow(button) {
const row = button.closest('tr');
row.remove();
}
// Расчет одной строки
function calculateRow(button) {
const row = button.closest('tr');
const cells = row.getElementsByTagName('td');
const quantity = parseInt(cells[2].textContent) || 0;
const price = parseInt(cells[3].textContent) || 0;
const total = quantity * price;
cells[4].textContent = total;
calculateTradeTotal();
}
// Расчет общей стоимости
function calculateTradeTotal() {
const totalCells = document.querySelectorAll('.total-price');
let grandTotal = 0;
totalCells.forEach(cell => {
grandTotal += parseInt(cell.textContent) || 0;
});
document.getElementById('grand-total').textContent = grandTotal;
}
// Обновление номеров строк
function updateRowNumbers() {
const rows = document.querySelectorAll('.trade-table tbody tr');
rows.forEach((row, index) => {
row.querySelector('.row-number').textContent = index + 1;
});
}
// Очистка таблицы
function clearTradeTable() {
if (confirm('Очистить всю таблицу торговли?')) {
const table = document.getElementById('trade-table').getElementsByTagName('tbody')[0];
table.innerHTML = '';
addTradeRow(); // Добавляем одну пустую строку
calculateTradeTotal();
}
}
// Добавление записи в историю
function addHistoryEntry() {
const table = document.getElementById('history-table').getElementsByTagName('tbody')[0];
const now = new Date();
const dateStr = `${now.getDate().toString().padStart(2, '0')}.${(now.getMonth()+1).toString().padStart(2, '0')}.${now.getFullYear()}`;
const newRow = table.insertRow();
newRow.innerHTML = `
<td><span class="editable" contenteditable="true">${dateStr}</span></td>
<td><span class="editable" contenteditable="true">Новая сделка</span></td>
<td><span class="editable" contenteditable="true">+0</span></td>
<td class="actions">
<button class="action-btn delete-btn" onclick="deleteHistoryRow(this)">🗑️</button>
</td>
`;
}
// Вставка шаблона предмета
function insertTemplate(name, price) {
addTradeRow();
const table = document.getElementById('trade-table').getElementsByTagName('tbody')[0];
const lastRow = table.rows[table.rows.length - 1];
lastRow.cells[1].querySelector('.editable').textContent = name;
lastRow.cells[3].querySelector('.editable').textContent = price;
calculateRow(lastRow.cells[5].querySelector('.calc-btn'));
}
// Экспорт данных (имитация)
function exportTradeData() {
const tradeData = {
balance: document.querySelector('.trading-balance .editable').textContent,
trades: [],
history: []
};
// Собираем данные торгов
const tradeRows = document.querySelectorAll('.trade-table tbody tr');
tradeRows.forEach(row => {
const cells = row.cells;
tradeData.trades.push({
item: cells[1].textContent,
quantity: cells[2].textContent,
price: cells[3].textContent,
total: cells[4].textContent
});
});
// Собираем историю
const historyRows = document.querySelectorAll('.history-table tbody tr');
historyRows.forEach(row => {
const cells = row.cells;
tradeData.history.push({
date: cells[0].textContent,
description: cells[1].textContent,
amount: cells[2].textContent
});
});
alert('Данные готовы для копирования!\n\nСкопируйте весь HTML код этого блока для сохранения.');
console.log('Данные для сохранения:', tradeData);
}
// Автоматический расчет при изменении значений
document.addEventListener('input', function(e) {
if (e.target.classList.contains('editable')) {
const row = e.target.closest('tr');
if (row && row.querySelector('.calc-btn')) {
setTimeout(() => calculateRow(row.querySelector('.calc-btn')), 100);
}
}
});
// Инициализация
document.addEventListener('DOMContentLoaded', function() {
calculateTradeTotal();
});
</script>[/html]
