综述: 新增专员APP工作台订单管理演示页面

- 新增专员端订单列表演示页面,实现订单类型切换(普通订单、预售订单)、订单状态切换(待取货、待配送、待送达)功能,展示订单基本信息、配送方式、备货进度等,支持打印订单、开始配送、确认送达、联系客户等交互操作
- 新增专员端订单详情演示页面,展示订单详细信息、多店铺订单列表、商品备货状态,提供取货弹窗、配送操作等功能,优化专员工作流程体验
This commit is contained in:
linbin 2025-10-16 01:25:39 +08:00
parent 1a6270b3fe
commit 02f4adf076
2 changed files with 1343 additions and 0 deletions

View File

@ -0,0 +1,636 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>工作台 - 大妈集市专员端</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
background-color: #f7f7f7;
}
.navbar {
background: linear-gradient(135deg, #053C23 0%, #0a5a35 100%);
color: white;
padding: 12px 16px;
text-align: center;
font-size: 18px;
font-weight: 500;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.category-tabs {
display: flex;
background: linear-gradient(135deg, #053C23 0%, #0a5a35 100%);
padding: 0 16px 12px;
gap: 12px;
}
.category-tab {
flex: 1;
padding: 8px 16px;
background: rgba(255, 255, 255, 0.2);
color: white;
border: none;
border-radius: 20px;
cursor: pointer;
transition: all 0.3s;
font-size: 14px;
}
.category-tab.active {
background: white;
color: #053C23;
font-weight: 500;
}
.tabs {
display: flex;
background: white;
border-bottom: 1px solid #e5e5e5;
position: sticky;
top: 0;
z-index: 100;
}
.tab {
flex: 1;
padding: 14px 0;
text-align: center;
cursor: pointer;
position: relative;
color: #666;
font-size: 15px;
transition: all 0.3s;
}
.tab.active {
color: #053C23;
font-weight: 500;
}
.tab.active::after {
content: '';
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 30px;
height: 3px;
background: #053C23;
border-radius: 2px;
}
.order-list {
padding: 10px;
}
.order-card {
background: white;
border-radius: 8px;
margin-bottom: 10px;
padding: 12px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
cursor: pointer;
transition: all 0.3s;
}
.order-card:hover {
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
transform: translateY(-2px);
}
.order-header {
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 10px;
border-bottom: 1px solid #f0f0f0;
margin-bottom: 10px;
}
.order-number {
font-size: 14px;
color: #333;
}
.order-time {
font-size: 12px;
color: #999;
}
.order-info {
display: flex;
align-items: center;
justify-content: space-between;
padding: 8px 0;
color: #808080;
font-size: 13px;
}
.progress-wrapper {
display: flex;
align-items: center;
flex: 1;
}
.progress-bar {
width: 140px;
height: 6px;
background: #e5e5e5;
border-radius: 3px;
margin: 0 8px;
overflow: hidden;
}
.progress-fill {
height: 100%;
background: linear-gradient(90deg, #4CAF50 0%, #8BC34A 100%);
border-radius: 3px;
transition: width 0.3s;
}
.arrow-icon {
color: #ccc;
font-size: 18px;
}
.btn-print {
background: white;
border: 1px solid #053C23;
color: #053C23;
padding: 6px 16px;
border-radius: 16px;
font-size: 13px;
cursor: pointer;
transition: all 0.3s;
margin-left: auto;
}
.btn-print:hover {
background: #053C23;
color: white;
}
.btn-group {
display: flex;
gap: 10px;
margin-top: 10px;
padding-top: 10px;
border-top: 1px solid #f0f0f0;
}
.btn-secondary {
flex: 1;
background: white;
border: 1px solid #053C23;
color: #053C23;
padding: 8px 16px;
border-radius: 16px;
font-size: 14px;
cursor: pointer;
transition: all 0.3s;
}
.btn-secondary:hover {
background: #f5f5f5;
}
.btn-primary {
flex: 1;
background: #053C23;
border: 1px solid #053C23;
color: white;
padding: 8px 16px;
border-radius: 16px;
font-size: 14px;
cursor: pointer;
transition: all 0.3s;
}
.btn-primary:hover {
background: #0a5a35;
}
.contact-buttons {
display: flex;
gap: 8px;
margin-top: 8px;
}
.btn-icon {
flex: 1;
background: white;
border: 1px solid #053C23;
color: #053C23;
padding: 6px 12px;
border-radius: 16px;
font-size: 13px;
cursor: pointer;
transition: all 0.3s;
display: flex;
align-items: center;
justify-content: center;
gap: 4px;
}
.btn-icon:hover {
background: #f5f5f5;
}
.btn-confirm {
width: 100%;
background: #053C23;
border: 1px solid #053C23;
color: white;
padding: 8px 16px;
border-radius: 16px;
font-size: 14px;
cursor: pointer;
transition: all 0.3s;
margin-top: 8px;
}
.btn-confirm:hover {
background: #0a5a35;
}
.delivery-info-section {
background: #f9f9f9;
padding: 8px;
border-radius: 6px;
margin: 8px 0;
}
.receiver-info {
display: flex;
justify-content: space-between;
padding: 4px 0;
color: #333;
font-size: 14px;
font-weight: 500;
}
.empty-state {
text-align: center;
padding: 60px 20px;
color: #999;
}
.empty-icon {
font-size: 60px;
margin-bottom: 16px;
opacity: 0.3;
}
.badge {
background: #ff4444;
color: white;
border-radius: 10px;
padding: 2px 6px;
font-size: 11px;
margin-left: 4px;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.order-card {
animation: fadeIn 0.3s ease;
}
.toast {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: rgba(0, 0, 0, 0.8);
color: white;
padding: 12px 24px;
border-radius: 8px;
z-index: 2000;
display: none;
animation: fadeIn 0.3s;
}
.toast.show {
display: block;
}
</style>
</head>
<body>
<div class="navbar">华侨城农贸市场</div>
<div class="category-tabs">
<button class="category-tab active" data-category="1">普通订单</button>
<button class="category-tab" data-category="3">预售订单</button>
</div>
<div class="tabs">
<div class="tab active" data-tab="2">待取货 <span class="badge">3</span></div>
<div class="tab" data-tab="3">待配送 <span class="badge">1</span></div>
<div class="tab" data-tab="4">待送达 <span class="badge">2</span></div>
</div>
<div class="order-list" id="orderList">
<!-- 订单列表将通过JavaScript动态生成 -->
</div>
<!-- Toast提示 -->
<div id="toast" class="toast"></div>
<script>
// 模拟订单数据
const mockOrders = {
2: [ // 待取货
{
settlementOrderNo: 'S2024101201', // 结算订单号
daySn: '1', // 结算订单流水号
payTime: '2024-10-12 09:30:15',
preparedCount: 3,
totalCount: 4,
distance: 2.5,
expectDeliveryTime: 15,
deliveryType: 3, // 1-全国配送, 2-专员配送, 3-自提
orderCategory: 1 // 普通订单
},
{
settlementOrderNo: 'S2024101202',
daySn: '2',
payTime: '2024-10-12 10:15:30',
preparedCount: 4,
totalCount: 4,
distance: 1.8,
expectDeliveryTime: 12,
deliveryType: 4, // 4-同城配送
orderCategory: 1
},
{
settlementOrderNo: 'S2024101203',
daySn: '3',
payTime: '2024-10-12 11:00:45',
preparedCount: 2,
totalCount: 5,
distance: 3.2,
expectDeliveryTime: 20,
deliveryType: 1,
orderCategory: 1
}
],
3: [ // 待配送
{
settlementOrderNo: 'S2024101204',
daySn: '4',
orderNo: 'O2024101204001',
unitOrderNo: 'U2024101204',
payTime: '2024-10-12 08:20:10',
preparedCount: 3,
totalCount: 3,
distance: 4.5,
expectDeliveryTime: 25,
deliveryType: 1,
orderCategory: 1,
orderStatus: 3 // 待配送状态
},
{
settlementOrderNo: 'S2024101207',
daySn: '7',
orderNo: 'O2024101207001',
unitOrderNo: 'U2024101207',
payTime: '2024-10-12 09:00:00',
preparedCount: 3,
totalCount: 3,
distance: 3.5,
expectDeliveryTime: 20,
deliveryType: 4, // 同城配送
deliveryAddress: '深圳市南山区科技园南区深圳湾科技生态园10栋A座2601',
orderCategory: 1,
orderStatus: 3 // 待配送状态
}
],
4: [ // 待送达
{
settlementOrderNo: 'S2024101205',
daySn: '5',
payTime: '2024-10-12 07:45:20',
preparedCount: 2,
totalCount: 2,
distance: 1.2,
expectDeliveryTime: 8,
deliveryType: 4, // 修改为同城配送
deliveryAddress: '深圳市福田区华强北街道振兴路101号华强广场3栋1808室',
receiverName: '张先生',
receiverPhone: '13800138000',
orderCategory: 1
},
{
settlementOrderNo: 'S2024101206',
daySn: '6',
payTime: '2024-10-12 08:10:35',
preparedCount: 5,
totalCount: 5,
distance: 2.8,
expectDeliveryTime: 18,
deliveryType: 1,
orderCategory: 1
}
]
};
let currentTab = '2';
let currentCategory = '1';
// 渲染订单列表
function renderOrders() {
const orderList = document.getElementById('orderList');
const orders = mockOrders[currentTab] || [];
if (orders.length === 0) {
orderList.innerHTML = `
<div class="empty-state">
<div class="empty-icon">📦</div>
<div>暂无订单</div>
</div>
`;
return;
}
orderList.innerHTML = orders.map(order => {
const percent = (order.preparedCount / order.totalCount * 100).toFixed(0);
const deliveryTypeMap = {
1: '全国配送',
2: '专员配送',
3: '自提',
4: '同城配送'
};
const deliveryTypeText = deliveryTypeMap[order.deliveryType] || '未知';
return `
<div class="order-card" onclick="goToDetail('${order.settlementOrderNo}')">
<div class="order-header">
<div>
<div class="order-number">结算订单流水号 ${order.daySn}</div>
<div class="order-time">${order.payTime}</div>
</div>
</div>
<div class="order-info">
<div>结算订单号:${order.settlementOrderNo}</div>
</div>
${order.orderNo ? `
<div class="order-info">
<div>订单编号:${order.orderNo}</div>
</div>
` : ''}
<div class="order-info">
<div>配送方式:${deliveryTypeText}</div>
</div>
${order.deliveryAddress ? `
<div class="order-info">
<div>配送地址:${order.deliveryAddress}</div>
</div>
` : ''}
<div class="order-info">
<div>配送距离 ${order.distance.toFixed(2)}km</div>
<div>约${order.expectDeliveryTime}分钟</div>
</div>
${currentTab === '2' ? `
<div class="order-info">
<div class="progress-wrapper">
<span>备货情况</span>
<div class="progress-bar">
<div class="progress-fill" style="width: ${percent}%"></div>
</div>
<span>${order.preparedCount}/${order.totalCount}</span>
</div>
<span class="arrow-icon"></span>
</div>
<div class="order-info">
<button class="btn-print" onclick="handlePrint(event, '${order.settlementOrderNo}')">打印订单</button>
</div>
` : ''}
${currentTab === '3' ? `
<div class="btn-group">
<button class="btn-secondary" onclick="handlePrint(event, '${order.settlementOrderNo}')">打印订单</button>
<button class="btn-primary" onclick="handleStartDelivery(event, '${order.settlementOrderNo}')">开始配送</button>
</div>
` : ''}
${currentTab === '4' && order.receiverName ? `
<div class="delivery-info-section">
<div class="receiver-info">
<span>收货人:${order.receiverName}</span>
<span>${order.receiverPhone}</span>
</div>
</div>
<div class="contact-buttons">
<button class="btn-icon" onclick="handleSendMessage(event, '${order.receiverPhone}')">
<span>💬</span>
<span>发送信息</span>
</button>
<button class="btn-icon" onclick="handleCall(event, '${order.receiverPhone}')">
<span>📞</span>
<span>电话联系</span>
</button>
</div>
<button class="btn-confirm" onclick="handleConfirmDelivery(event, '${order.settlementOrderNo}')">确认送达</button>
` : ''}
</div>
`;
}).join('');
}
// 标签切换
document.querySelectorAll('.tab').forEach(tab => {
tab.addEventListener('click', () => {
document.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
tab.classList.add('active');
currentTab = tab.dataset.tab;
renderOrders();
});
});
// 订单类型切换
document.querySelectorAll('.category-tab').forEach(tab => {
tab.addEventListener('click', () => {
document.querySelectorAll('.category-tab').forEach(t => t.classList.remove('active'));
tab.classList.add('active');
currentCategory = tab.dataset.category;
renderOrders();
});
});
// 跳转到订单详情
function goToDetail(settlementOrderNo) {
const order = Object.values(mockOrders).flat().find(o => o.settlementOrderNo === settlementOrderNo);
if (order) {
// 将订单信息存储到sessionStorage模拟页面跳转传参
sessionStorage.setItem('currentOrder', JSON.stringify(order));
window.location.href = '专员端-订单详情演示.html';
}
}
// 打印订单
function handlePrint(event, settlementOrderNo) {
event.stopPropagation();
showToast('正在打印订单 ' + settlementOrderNo);
}
// 开始配送
function handleStartDelivery(event, settlementOrderNo) {
event.stopPropagation();
showToast('开始配送订单 ' + settlementOrderNo);
// 这里可以添加实际的配送逻辑
}
// 发送信息
function handleSendMessage(event, phone) {
event.stopPropagation();
showToast('正在发送信息给 ' + phone);
// 这里可以跳转到短信应用或站内消息
}
// 电话联系
function handleCall(event, phone) {
event.stopPropagation();
showToast('正在拨打电话 ' + phone);
// 这里可以触发拨打电话
// window.location.href = 'tel:' + phone;
}
// 确认送达
function handleConfirmDelivery(event, settlementOrderNo) {
event.stopPropagation();
if (confirm('确认订单已送达?')) {
showToast('订单 ' + settlementOrderNo + ' 已确认送达');
// 这里可以添加确认送达的逻辑
}
}
// 显示Toast
function showToast(message) {
const toast = document.getElementById('toast');
toast.textContent = message;
toast.classList.add('show');
setTimeout(() => {
toast.classList.remove('show');
}, 2000);
}
// 初始化
renderOrders();
</script>
</body>
</html>

View File

@ -0,0 +1,707 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>订单详情 - 大妈集市专员端</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
background-color: #e5e5e5;
}
.navbar {
background: linear-gradient(135deg, #053C23 0%, #0a5a35 100%);
color: white;
padding: 12px 16px;
display: flex;
align-items: center;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.back-btn {
font-size: 24px;
cursor: pointer;
margin-right: 12px;
}
.navbar-title {
font-size: 18px;
font-weight: 500;
}
.info-bar {
background: #e5e5e5;
padding: 0 20px;
display: flex;
align-items: center;
justify-content: space-between;
height: 40px;
color: #333;
font-size: 14px;
}
.info-time {
font-size: 12px;
color: #808080;
margin-left: 8px;
}
.countdown {
color: #ff4444;
display: flex;
align-items: center;
gap: 4px;
}
.divider {
background: #e5e5e5;
height: 10px;
width: 100%;
}
.order-note {
background: white;
padding: 30px 20px;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 10px solid #e5e5e5;
}
.note-label {
color: #808080;
font-size: 18px;
margin-right: 40px;
flex-shrink: 0;
}
.note-content {
flex: 1;
color: #000;
font-size: 18px;
}
.shop-list {
padding: 0 20px;
background: white;
}
.shop-item {
padding: 20px 0;
border-bottom: 1px solid #e5e5e5;
}
.shop-item:last-child {
border-bottom: none;
}
.shop-header {
display: flex;
align-items: center;
flex-wrap: wrap;
padding-bottom: 8px;
font-size: 18px;
font-weight: 400;
color: #333;
}
.shop-status {
display: flex;
align-items: center;
justify-content: space-between;
height: 40px;
font-size: 16px;
}
.status-item {
display: flex;
align-items: center;
}
.status-icon {
width: 21px;
height: 21px;
margin-left: 10px;
}
.btn-pickup {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: none;
padding: 8px 20px;
border-radius: 20px;
font-size: 14px;
cursor: pointer;
transition: all 0.3s;
box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}
.btn-pickup:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}
.completed {
color: #4CAF50;
}
.footer {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: white;
padding: 12px 20px;
border-top: 1px solid #e5e5e5;
display: flex;
gap: 12px;
}
.btn-secondary {
flex: 1;
background: white;
border: 1px solid #053C23;
color: #053C23;
padding: 10px;
border-radius: 20px;
font-size: 15px;
cursor: pointer;
transition: all 0.3s;
}
.btn-secondary:hover {
background: #f5f5f5;
}
.btn-primary {
flex: 1;
background: linear-gradient(135deg, #053C23 0%, #0a5a35 100%);
color: white;
border: none;
padding: 10px;
border-radius: 20px;
font-size: 15px;
cursor: pointer;
transition: all 0.3s;
box-shadow: 0 2px 8px rgba(5, 60, 35, 0.3);
}
.btn-primary:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(5, 60, 35, 0.4);
}
/* 弹窗样式 */
.modal {
display: none;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
z-index: 1000;
animation: fadeIn 0.3s;
align-items: center;
justify-content: center;
}
.modal.show {
display: flex;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes slideUp {
from {
opacity: 0;
transform: translateY(20px) scale(0.95);
}
to {
opacity: 1;
transform: translateY(0) scale(1);
}
}
/* 取货弹窗 */
.pickup-popup {
background: white;
border-radius: 12px;
width: 90%;
max-width: 400px;
max-height: 80vh;
display: flex;
flex-direction: column;
z-index: 1001;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
opacity: 0;
transition: all 0.3s;
}
.pickup-popup.show {
animation: slideUp 0.3s forwards;
}
.popup-header {
background: #e5e5e5;
padding: 12px 16px;
text-align: center;
font-size: 16px;
font-weight: 500;
border-radius: 12px 12px 0 0;
position: relative;
}
.close-btn {
position: absolute;
right: 12px;
top: 50%;
transform: translateY(-50%);
font-size: 24px;
color: #666;
cursor: pointer;
line-height: 1;
padding: 4px;
}
.close-btn:hover {
color: #333;
}
.popup-body {
flex: 1;
overflow-y: auto;
padding: 10px;
}
.product-item {
display: flex;
padding: 12px 0;
border-bottom: 1px solid #e5e5e5;
}
.product-item:last-child {
border-bottom: none;
}
.product-image {
width: 46px;
height: 46px;
border-radius: 6px;
border: 1px solid #e5e5e5;
margin-right: 10px;
object-fit: cover;
cursor: pointer;
}
.product-info {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
color: #808080;
font-size: 13px;
}
.product-name {
color: #333;
margin-bottom: 4px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.product-spec {
display: flex;
justify-content: space-between;
}
.popup-footer {
border-top: 1px solid #e5e5e5;
padding: 12px 16px;
display: flex;
justify-content: flex-end;
border-radius: 0 0 12px 12px;
}
.toast {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: rgba(0, 0, 0, 0.8);
color: white;
padding: 12px 24px;
border-radius: 8px;
z-index: 2000;
display: none;
animation: fadeIn 0.3s;
}
.toast.show {
display: block;
}
.content-wrapper {
padding-bottom: 60px;
}
</style>
</head>
<body>
<div class="navbar">
<span class="back-btn" onclick="goBack()"></span>
<span class="navbar-title">订单详情</span>
</div>
<div class="content-wrapper">
<div class="info-bar">
<div>
<span>单号 #<span id="daySn"></span></span>
<span class="info-time" id="payTime"></span>
</div>
<div class="countdown">
<span>剩余</span>
<span id="countdown">--:--</span>
</div>
</div>
<div class="info-bar">
<div>订单编号 <span id="unitOrderNo"></span></div>
</div>
<div class="info-bar">
<span style="color: #808080;">摊位数<span id="shopCount"></span></span>
<span style="color: #808080;">商品数<span id="productCount"></span></span>
<span></span>
</div>
<div class="order-note">
<div class="note-label">订单备注</div>
<div class="note-content" id="orderRemark"></div>
</div>
<div class="shop-list" id="shopList">
<!-- 店铺列表将通过JavaScript动态生成 -->
</div>
</div>
<!-- 取货弹窗 -->
<div id="pickupModal" class="modal">
<div class="pickup-popup" id="pickupPopup">
<div class="popup-header">
核对货品
<span class="close-btn" onclick="closePickupPopup()">×</span>
</div>
<div class="popup-body" id="productList">
<!-- 商品列表将通过JavaScript动态生成 -->
</div>
<div class="popup-footer">
<button class="btn-primary" onclick="handlePickupDone()">取货完成</button>
</div>
</div>
</div>
<!-- Toast提示 -->
<div id="toast" class="toast"></div>
<script>
// 从sessionStorage获取订单信息
let orderInfo = null;
try {
orderInfo = JSON.parse(sessionStorage.getItem('currentOrder'));
} catch (e) {
// 如果没有订单信息,使用模拟数据
orderInfo = {
unitOrderNo: 'U2024101201',
daySn: '20241012001',
payTime: '2024-10-12 09:30:15',
preparedCount: 3,
totalCount: 4,
distance: 2.5,
expectDeliveryTime: 15,
deliveryType: 1,
orderCategory: 1,
orderStatus: 2 // 默认待取货状态
};
}
// 判断是否为待配送订单
const isDeliveryPending = orderInfo.orderStatus === 3;
// 模拟订单详细数据
const mockOrderDetail = {
shopCount: 4,
productCount: 12,
remark: '请尽快配送,客户急需',
shopOrderDTOList: [
{
shopOrderNo: 'S2024101201',
daySn: '1', // 店铺订单流水号
shopName: '张大妈生鲜店',
detailAddress: 'A区23号',
pickStatus: 0, // 0:未取货 1:已取货 2:待备货
products: [
{
productImg: 'https://via.placeholder.com/46/4CAF50/FFFFFF?text=蔬菜',
productName: '新鲜蔬菜 - 有机西红柿',
productSpecName: '500g/份',
productCount: 2
},
{
productImg: 'https://via.placeholder.com/46/2196F3/FFFFFF?text=水果',
productName: '优质水果 - 进口苹果',
productSpecName: '1kg/盒',
productCount: 1
}
]
},
{
shopOrderNo: 'S2024101202',
daySn: '2',
shopName: '李阿姨水果摊',
detailAddress: 'B区05号',
pickStatus: 0,
products: [
{
productImg: 'https://via.placeholder.com/46/FF9800/FFFFFF?text=水果',
productName: '新鲜香蕉',
productSpecName: '500g/把',
productCount: 3
}
]
},
{
shopOrderNo: 'S2024101203',
daySn: '3',
shopName: '王师傅肉类专营',
detailAddress: 'C区12号',
pickStatus: 1, // 已取货
products: [
{
productImg: 'https://via.placeholder.com/46/E91E63/FFFFFF?text=肉类',
productName: '精品肉类 - 鲜猪肉',
productSpecName: '250g/份',
productCount: 2
}
]
},
{
shopOrderNo: 'S2024101204',
daySn: '4',
shopName: '海鲜大咖',
detailAddress: 'D区08号',
pickStatus: 2, // 待备货
products: [
{
productImg: 'https://via.placeholder.com/46/9C27B0/FFFFFF?text=海鲜',
productName: '海鲜水产 - 活虾',
productSpecName: '300g/份',
productCount: 4
}
]
}
]
};
let currentShop = null;
// 初始化页面
function initPage() {
// 显示订单基本信息
document.getElementById('daySn').textContent = orderInfo.daySn;
document.getElementById('payTime').textContent = orderInfo.payTime;
document.getElementById('unitOrderNo').textContent = orderInfo.unitOrderNo;
document.getElementById('shopCount').textContent = mockOrderDetail.shopCount;
document.getElementById('productCount').textContent = mockOrderDetail.productCount;
document.getElementById('orderRemark').textContent = mockOrderDetail.remark;
// 启动倒计时
startCountdown();
// 渲染店铺列表
renderShopList();
}
// 倒计时
function startCountdown() {
// 模拟30分钟倒计时
let seconds = 30 * 60;
function update() {
const minutes = Math.floor(seconds / 60);
const secs = seconds % 60;
document.getElementById('countdown').textContent =
`${String(minutes).padStart(2, '0')}:${String(secs).padStart(2, '0')}`;
if (seconds > 0) {
seconds--;
setTimeout(update, 1000);
}
}
update();
}
// 渲染店铺列表
function renderShopList() {
const shopList = document.getElementById('shopList');
shopList.innerHTML = mockOrderDetail.shopOrderDTOList.map(shop => {
// 如果是待配送订单,所有店铺订单状态都显示为"取货完成"
const displayPickStatus = isDeliveryPending ? 1 : shop.pickStatus;
return `
<div class="shop-item">
<div class="shop-header">
<span>${shop.shopName}(${shop.detailAddress})</span>
</div>
<div style="color: #808080; font-size: 14px; padding: 4px 0 8px 0;">
店铺订单流水号 ${shop.daySn}
</div>
<div class="shop-status">
<div class="status-item ${displayPickStatus === 1 ? 'completed' : displayPickStatus === 2 ? '' : ''}">
<span>${displayPickStatus === 2 ? '待备货' : '备货完成'}</span>
${displayPickStatus !== 2 ? `
<img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234CAF50'%3E%3Cpath d='M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z'/%3E%3C/svg%3E" class="status-icon" alt="完成" />
` : ''}
</div>
${!isDeliveryPending && displayPickStatus === 0 ? `
<button class="btn-pickup" onclick="openPickupPopup('${shop.shopOrderNo}')">取货</button>
` : displayPickStatus === 1 ? `
<div class="status-item completed">
<span>取货完成</span>
<img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234CAF50'%3E%3Cpath d='M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z'/%3E%3C/svg%3E" class="status-icon" alt="完成" />
</div>
` : ''}
</div>
</div>
`;
}).join('');
}
// 打开取货弹窗
function openPickupPopup(shopOrderNo) {
const shop = mockOrderDetail.shopOrderDTOList.find(s => s.shopOrderNo === shopOrderNo);
if (!shop) return;
currentShop = shop;
// 渲染商品列表
const productList = document.getElementById('productList');
productList.innerHTML = shop.products.map((product, index) => `
<div class="product-item">
<img src="${product.productImg}" class="product-image" alt="${product.productName}"
onclick="previewImage('${product.productImg}')" />
<div class="product-info">
<div class="product-name">${product.productName}</div>
<div class="product-spec">
<span>${product.productSpecName}</span>
<span>x${product.productCount}</span>
</div>
</div>
</div>
`).join('');
// 显示弹窗
const modal = document.getElementById('pickupModal');
const popup = document.getElementById('pickupPopup');
modal.classList.add('show');
// 延迟一帧后添加show类确保动画能够播放
requestAnimationFrame(() => {
popup.classList.add('show');
});
}
// 关闭取货弹窗
function closePickupPopup() {
const modal = document.getElementById('pickupModal');
const popup = document.getElementById('pickupPopup');
popup.classList.remove('show');
// 等待动画结束后移除modal
setTimeout(() => {
modal.classList.remove('show');
}, 300);
}
// 处理取货完成
function handlePickupDone() {
// 显示操作选择
const actions = ['补差价', '确认'];
const actionIndex = Math.random() > 0.5 ? 1 : prompt('请选择操作:\n0 - 补差价\n1 - 确认', '1');
if (actionIndex === null) {
return;
}
if (actionIndex === '0') {
// 补差价
closePickupPopup();
showToast('正在跳转到补差价页面...');
setTimeout(() => {
window.open('退差价演示页面.html', '_blank');
}, 500);
} else {
// 确认取货
const needPhoto = confirm('是否拍照留痕?');
if (needPhoto) {
showToast('正在打开相机...');
setTimeout(() => {
completePickup();
}, 1000);
} else {
completePickup();
}
}
}
// 完成取货
function completePickup() {
if (currentShop) {
currentShop.pickStatus = 1;
showToast('取货成功');
closePickupPopup();
renderShopList();
}
}
// 图片预览
function previewImage(url) {
showToast('预览图片: ' + url);
}
// 显示Toast
function showToast(message) {
const toast = document.getElementById('toast');
toast.textContent = message;
toast.classList.add('show');
setTimeout(() => {
toast.classList.remove('show');
}, 2000);
}
// 返回
function goBack() {
window.location.href = '专员端-订单列表演示.html';
}
// 点击模态框背景关闭
document.getElementById('pickupModal').addEventListener('click', function(e) {
if (e.target === this) {
closePickupPopup();
}
});
// 初始化页面
initPage();
</script>
</body>
</html>