dm-design/商家端APP/工作台/订单列表/shop-order-prepare.html

548 lines
16 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>备货清单</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
background-color: #f7f7f7;
-webkit-font-smoothing: antialiased;
padding-bottom: 80px;
}
.navbar {
background-color: #053C23;
color: white;
padding: 12px 16px;
display: flex;
align-items: center;
position: sticky;
top: 0;
z-index: 100;
}
.navbar-back {
width: 24px;
height: 24px;
margin-right: 12px;
cursor: pointer;
}
.navbar-title {
font-size: 17px;
font-weight: 500;
}
.page-content {
padding-bottom: 20px;
}
.order-header {
padding: 16px;
margin-bottom: 4px;
background-color: white;
}
.order-header-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 8px;
}
.order-number {
font-size: 14px;
color: #333;
}
.order-number .number {
font-size: 20px;
font-weight: 700;
}
.order-status {
font-size: 14px;
}
.status-preparing {
color: #666;
}
.status-waiting {
color: #fa4350;
}
.order-no-row {
display: flex;
align-items: center;
padding-top: 4px;
}
.order-no {
font-size: 12px;
color: #666;
}
.copy-btn {
margin-left: 4px;
font-size: 12px;
color: #09542B;
cursor: pointer;
padding: 2px 4px;
display: inline-flex;
align-items: center;
gap: 2px;
}
.remark-section {
display: flex;
background-color: white;
padding: 12px 16px;
margin-bottom: 8px;
}
.remark-label {
color: #666;
padding-right: 8px;
white-space: nowrap;
}
.remark-content {
flex: 1;
}
.remark-text {
line-height: 1.5;
color: #333;
}
.remark-notice {
font-size: 12px;
color: #666;
padding-top: 2px;
display: flex;
align-items: center;
gap: 4px;
}
.products-section {
padding: 8px 12px;
background-color: white;
}
.product-card {
padding: 10px;
font-size: 14px;
line-height: 1.1;
background-color: #fff;
border: 1px solid #ebeef5;
border-radius: 8px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.02);
}
.product-card:not(:last-child) {
margin-bottom: 10px;
}
.product-content {
display: flex;
align-items: flex-start;
}
.product-image {
width: 80px;
height: 80px;
border-radius: 4px;
object-fit: cover;
background-color: #f5f5f5;
}
.product-info {
flex: 1;
padding-left: 8px;
}
.product-name {
font-size: 15px;
color: #333;
margin-bottom: 4px;
line-height: 1.3;
}
.product-spec-row {
display: flex;
align-items: center;
justify-content: space-between;
color: #666;
padding: 4px 0;
font-size: 12px;
}
.product-price {
text-align: right;
font-size: 14px;
color: #333;
padding: 4px 0;
}
.product-cost-row {
display: flex;
align-items: center;
justify-content: flex-end;
padding: 4px 0;
font-size: 12px;
color: #666;
}
.footer-buttons {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background-color: white;
padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
border-top: 1px solid #eee;
display: flex;
gap: 12px;
}
.btn {
flex: 1;
padding: 12px 24px;
border: none;
border-radius: 24px;
font-size: 16px;
cursor: pointer;
transition: all 0.3s;
}
.btn-primary {
background-color: #09542B;
color: white;
}
.btn-primary:active {
background-color: #053C23;
}
.btn-secondary {
background-color: #f0f0f0;
color: #333;
}
.timer {
font-variant-numeric: tabular-nums;
}
/* 弹窗样式 */
.modal {
display: none;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
z-index: 1000;
align-items: center;
justify-content: center;
}
.modal.show {
display: flex;
}
.modal-content {
background-color: white;
border-radius: 12px;
padding: 20px;
margin: 0 20px;
max-width: 300px;
width: 100%;
}
.modal-title {
font-size: 16px;
font-weight: 500;
text-align: center;
margin-bottom: 20px;
}
.modal-buttons {
display: flex;
gap: 12px;
}
.modal-button {
flex: 1;
padding: 10px;
border: 1px solid #ddd;
background-color: white;
border-radius: 6px;
cursor: pointer;
font-size: 15px;
}
.modal-button:active {
background-color: #f5f5f5;
}
.toast {
display: none;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: rgba(0, 0, 0, 0.7);
color: white;
padding: 12px 24px;
border-radius: 6px;
z-index: 2000;
}
.toast.show {
display: block;
}
</style>
</head>
<body>
<div class="navbar">
<svg class="navbar-back" viewBox="0 0 1024 1024" fill="white" onclick="history.back()">
<path d="M671.968 912c-12.288 0-24.576-4.672-33.952-14.048L286.048 545.984c-18.752-18.72-18.752-49.12 0-67.872l351.968-352c18.752-18.752 49.12-18.752 67.872 0 18.752 18.72 18.752 49.12 0 67.872L387.872 512l318.016 318.016c18.752 18.752 18.752 49.12 0 67.872C696.544 907.328 684.256 912 671.968 912z"/>
</svg>
<div class="navbar-title">备货清单</div>
</div>
<div class="page-content">
<!-- 订单头部信息 -->
<div class="order-header">
<div class="order-header-row">
<div>
<span class="order-number">
#<span class="number" id="daySn">4</span>
</span>
</div>
<div class="order-status status-preparing">
正在备货 <span class="timer" id="prepareTimer">00:00:00</span>
</div>
</div>
<div class="order-no-row">
<span class="order-no">订单号:<span id="orderNo">SO20250715154408001</span></span>
<div class="copy-btn" onclick="copyOrderNo()">
<svg width="12" height="12" viewBox="0 0 1024 1024" fill="currentColor">
<path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"/>
</svg>
复制
</div>
</div>
</div>
<!-- 订单备注 -->
<div class="remark-section">
<div class="remark-label">订单备注</div>
<div class="remark-content">
<div class="remark-text">请帮忙挑选新鲜的蔬菜,谢谢!</div>
<div class="remark-notice">
<svg width="12" height="12" viewBox="0 0 1024 1024" fill="currentColor">
<path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"/>
<path d="M464 336a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z"/>
</svg>
若上述备注信息和您备货商品无关,请忽略
</div>
</div>
</div>
<!-- 商品列表 -->
<div class="products-section">
<!-- 商品1 -->
<div class="product-card">
<div class="product-content">
<img src="https://via.placeholder.com/80" alt="商品图片" class="product-image">
<div class="product-info">
<div class="product-name">新鲜有机西红柿</div>
<div class="product-spec-row">
<div>500g/份</div>
<div>x 1</div>
</div>
<div class="product-price">¥ 12.80</div>
<div class="product-cost-row">
<div>成本 ¥8.50</div>
</div>
</div>
</div>
</div>
<!-- 商品2 -->
<div class="product-card">
<div class="product-content">
<img src="https://via.placeholder.com/80" alt="商品图片" class="product-image">
<div class="product-info">
<div class="product-name">农家土鸡蛋</div>
<div class="product-spec-row">
<div>10个/盒</div>
<div>x 1</div>
</div>
<div class="product-price">¥ 28.00</div>
<div class="product-cost-row">
<div>成本 ¥18.00</div>
</div>
</div>
</div>
</div>
<!-- 商品3 -->
<div class="product-card">
<div class="product-content">
<img src="https://via.placeholder.com/80" alt="商品图片" class="product-image">
<div class="product-info">
<div class="product-name">精选五常大米</div>
<div class="product-spec-row">
<div>2.5kg/袋</div>
<div>x 1</div>
</div>
<div class="product-price">¥ 45.00</div>
<div class="product-cost-row">
<div>成本 ¥32.00</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- 底部按钮 -->
<div class="footer-buttons">
<button class="btn btn-primary" onclick="showCompleteModal()">备货完成</button>
<button class="btn btn-secondary" onclick="handlePrint()">打印订单</button>
</div>
<!-- 备货完成弹窗 -->
<div class="modal" id="completeModal">
<div class="modal-content">
<div class="modal-title">是否确认备货完成?</div>
<div class="modal-buttons">
<button class="modal-button" onclick="handleRefund()">补差价</button>
<button class="modal-button" onclick="handleConfirm()">确认</button>
<button class="modal-button" onclick="closeModal()">取消</button>
</div>
</div>
</div>
<!-- Toast提示 -->
<div class="toast" id="toast"></div>
<script>
// 获取URL参数
function getUrlParam(name) {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get(name);
}
// 初始化订单数据
const orderNo = getUrlParam('orderNo') || 'SO20250715154408001';
const daySn = getUrlParam('daySn') || '4';
const startTime = getUrlParam('startTime') || '2025-07-15 15:44:08';
document.getElementById('orderNo').textContent = orderNo;
document.getElementById('daySn').textContent = daySn;
// 时间计时器
function updateTimer() {
const timer = document.getElementById('prepareTimer');
const orderTime = new Date(startTime);
const currentTime = new Date();
const diffInMilliseconds = currentTime - orderTime;
if (diffInMilliseconds < 0) return;
const totalSeconds = Math.floor(diffInMilliseconds / 1000);
const hours = Math.floor(totalSeconds / 3600);
const minutes = Math.floor((totalSeconds % 3600) / 60);
const seconds = totalSeconds % 60;
timer.textContent =
String(hours).padStart(2, '0') + ':' +
String(minutes).padStart(2, '0') + ':' +
String(seconds).padStart(2, '0');
}
// 每秒更新计时器
updateTimer();
setInterval(updateTimer, 1000);
// 复制订单号
function copyOrderNo() {
const orderNoText = document.getElementById('orderNo').textContent;
if (navigator.clipboard) {
navigator.clipboard.writeText(orderNoText).then(() => {
showToast('复制成功');
});
} else {
const textarea = document.createElement('textarea');
textarea.value = orderNoText;
document.body.appendChild(textarea);
textarea.select();
document.execCommand('copy');
document.body.removeChild(textarea);
showToast('复制成功');
}
}
// 显示备货完成弹窗
function showCompleteModal() {
document.getElementById('completeModal').classList.add('show');
}
// 关闭弹窗
function closeModal() {
document.getElementById('completeModal').classList.remove('show');
}
// 补差价
function handleRefund() {
closeModal();
showToast('补差价功能开发中');
}
// 确认备货完成
function handleConfirm() {
closeModal();
showToast('备货完成');
setTimeout(() => {
history.back();
}, 1500);
}
// 打印订单
function handlePrint() {
window.print();
}
// 显示Toast
function showToast(message) {
const toast = document.getElementById('toast');
toast.textContent = message;
toast.classList.add('show');
setTimeout(() => {
toast.classList.remove('show');
}, 2000);
}
// 点击弹窗外部关闭
document.getElementById('completeModal').addEventListener('click', function(e) {
if (e.target === this) {
closeModal();
}
});
</script>
</body>
</html>