采购详情支持手动修改

This commit is contained in:
2026-07-28 17:51:14 +08:00
parent 0883566045
commit 24bfe66773
7 changed files with 516 additions and 101 deletions

View File

@@ -20,7 +20,7 @@
<input type="password" id="login-pass" placeholder="密码">
<button class="primary-btn" onclick="login()" style="width:100%;">登录</button>
<p id="login-error" style="color:red; margin-top:8px;"></p>
<div class="version">v2.6</div>
<div class="version">v2.7</div>
</div>
</div>
@@ -66,6 +66,17 @@
</button>
</div>
<div class="purchase-panel-body" id="purchase-panel-body"></div>
<!-- 新建采购输入栏 -->
<div class="input-area">
<label class="file-upload-btn" title="上传图片">
<input type="file" id="purchase-file-input" accept="image/*" multiple style="display:none;" onchange="handlePurchaseFileSelect(event)">
<svg viewBox="0 0 24 24"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>
</label>
<textarea id="purchase-msg-input" placeholder="输入采购信息..." rows="1"></textarea>
<button class="send-btn" onclick="sendFromPurchase()">
<svg viewBox="0 0 24 24"><line x1="22" y1="2" x2="11" y2="13"></line><polygon points="22 2 15 22 11 13 2 9 22 2"></polygon></svg>
</button>
</div>
</div>
<!-- 聊天窗口 -->
@@ -75,6 +86,9 @@
<svg viewBox="0 0 24 24"><polyline points="15 18 9 12 15 6"></polyline></svg>
</button>
<span class="chat-title" id="current-chat-name"></span>
<button class="icon-btn" onclick="backToPurchase()" title="关闭聊天">
<svg viewBox="0 0 24 24"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>
</button>
</div>
<div class="messages" id="messages-container"></div>
<div class="input-area">
@@ -116,13 +130,91 @@
</div>
</div>
<div id="detail-modal" class="modal-overlay hidden">
<!-- 采购汇总弹窗 -->
<div id="summary-modal" class="modal-overlay hidden">
<div class="modal">
<button class="modal-close-btn" onclick="closeDetailModal()">
<button class="modal-close-btn" onclick="closeSummaryModal()">
<svg viewBox="0 0 24 24"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>
</button>
<h3 id="detail-title"></h3>
<div id="detail-content"></div>
<h3 id="summary-title"></h3>
<div id="summary-content"></div>
</div>
</div>
<!-- 采购详情编辑弹窗 -->
<div id="detail-modal" class="modal-overlay hidden">
<div class="modal detail-modal">
<div class="detail-header">
<input type="text" id="edit-item" class="detail-title-input" placeholder="物品名称">
<button class="icon-btn" onclick="closeDetailModal()">
<svg viewBox="0 0 24 24"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>
</button>
</div>
<div class="edit-form">
<div class="edit-row">
<label>数量</label><input type="number" id="edit-quantity" inputmode="decimal" min="0" step="1">
</div>
<div class="edit-row">
<label>单价</label><input type="number" id="edit-unit-price" inputmode="decimal" min="0" step="0.01">
</div>
<div class="edit-row">
<label>邮费</label><input type="number" id="edit-freight" inputmode="decimal" min="0" step="0.01">
</div>
<div class="edit-row amount-row">
<label>金额</label><span class="edit-amount" id="edit-amount">0</span>
</div>
<div class="edit-row">
<label>付款</label>
<select id="edit-payment-method">
<option>未指定</option><option>支付宝</option><option>微信</option><option>银行卡</option><option>现金</option><option>对公转账</option>
</select>
</div>
<div class="edit-row">
<label>发票</label>
<select id="edit-invoice-type">
<option>无票</option><option>普票</option><option>专票</option>
</select>
</div>
<div class="edit-row">
<label>状态</label>
<select id="edit-status">
<option>待付款</option><option>已付款</option><option>已收货</option><option>已完成</option>
</select>
</div>
<div class="edit-row">
<label>申请人</label><input type="text" id="edit-applicant">
</div>
<div class="edit-row">
<label>时间</label><input type="text" id="edit-time" placeholder="yyyy/MM/dd HH:mm:ss">
</div>
<div class="edit-row">
<label>备注</label><textarea id="edit-remarks" rows="2"></textarea>
</div>
<!-- 附件 -->
<div class="edit-section">
<div class="edit-section-header">
<span>附件</span>
<label class="attach-add-btn" title="添加附件">
<input type="file" id="detail-file-input" accept="image/*" multiple style="display:none;" onchange="handleDetailFileUpload(event)">
<svg viewBox="0 0 24 24"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg>
</label>
</div>
<div class="attach-gallery" id="edit-attachments"></div>
</div>
<!-- 操作历史(折叠) -->
<details class="edit-section" id="edit-history-section">
<summary class="edit-section-header history-summary"><span>操作历史</span></summary>
<ul class="history-list" id="edit-history"></ul>
</details>
<!-- 按钮 -->
<div class="edit-buttons">
<button class="save-btn" onclick="savePurchase()">保存</button>
<button class="danger-btn" id="delete-purchase-btn" onclick="deletePurchaseDetail()">删除</button>
</div>
</div>
</div>
</div>
</div>
@@ -134,13 +226,20 @@
<script src="/js/auth.js"></script>
<script>
document.addEventListener('input', function(e) {
if (e.target.id === 'msg-input') {
if (e.target.id === 'msg-input' || e.target.id === 'purchase-msg-input') {
e.target.style.height = 'auto';
e.target.style.height = e.target.scrollHeight + 'px';
}
});
document.addEventListener('keydown', function(e) {
if (e.target.id === 'msg-input' && e.key === 'Enter' && !e.ctrlKey) { e.preventDefault(); sendMessage(); }
if (e.target.id === 'purchase-msg-input' && e.key === 'Enter' && !e.ctrlKey) { e.preventDefault(); sendFromPurchase(); }
});
// 实时计算金额
document.addEventListener('input', function(e) {
if (['edit-quantity','edit-unit-price','edit-freight'].includes(e.target.id)) {
updateEditAmount();
}
});
init();
</script>