/* 基础样式重置 */ * { margin: 0; padding: 0; box-sizing: border-box; } /* 移动端优化 */ html { /* 防止iOS Safari缩放 */ -webkit-text-size-adjust: 100%; /* 防止横屏时字体缩放 */ text-size-adjust: 100%; /* 平滑滚动 */ scroll-behavior: smooth; } body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif; background-color: #f5f5f5; line-height: 1.4; /* 支持安全区域 */ padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); /* 移动端触摸优化 */ -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; /* 防止橡皮筋效果 */ overscroll-behavior: contain; } /* 主容器 */ .coupon-center-container { min-height: 100vh; background: #f5f5f5; /* 适配移动端安全区域 */ min-height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom)); padding-bottom: max(20px, env(safe-area-inset-bottom)); /* 为固定标题栏留出空间 */ padding-top: calc(44px + env(safe-area-inset-top)); } /* 页面头部 */ .page-header { background: #ffffff; padding: 0; position: fixed; top: 0; left: 0; right: 0; z-index: 100; border-bottom: 1px solid #f0f0f0; /* 状态栏高度适配 - 模拟微信小程序标准导航栏位置 */ padding-top: env(safe-area-inset-top); height: calc(44px + env(safe-area-inset-top)); } .header-content { display: flex; align-items: center; justify-content: center; padding: 0 16px; height: 44px; margin-top: 0; position: relative; } .header-back { width: 28px; height: 28px; cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: background-color 0.2s ease; position: absolute; left: 16px; top: 50%; transform: translateY(-50%); } .header-back:hover { background-color: #f5f5f5; } .header-back svg { width: 18px; height: 18px; } .header-back svg path { stroke: #333333; } .header-title { font-size: 17px; font-weight: 600; color: #333333; text-align: center; line-height: 1.2; } .header-placeholder { width: 28px; height: 28px; } /* 优惠券列表容器 */ .coupon-list-container { padding: 12px; /* 适配移动端安全区域 */ padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); padding-bottom: max(20px, env(safe-area-inset-bottom)); } /* 优惠券项 */ .coupon-item { margin-bottom: 12px; } .coupon-card { background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08); position: relative; cursor: pointer; transition: transform 0.2s ease, box-shadow 0.2s ease; } .coupon-card:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12); } /* 优惠券主体 */ .coupon-main { display: flex; padding: 16px; position: relative; } .coupon-main::after { content: ''; position: absolute; right: 0; top: 50%; transform: translateY(-50%); width: 1px; height: 30px; background: linear-gradient(to bottom, transparent, #e5e5e5, transparent); } .coupon-left { flex: 0 0 100px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: linear-gradient(135deg, #ff6b6b, #ff8e8e); color: #fff; border-radius: 6px; padding: 12px 8px; margin-right: 16px; min-height: 80px; } .coupon-value { display: flex; align-items: baseline; margin-bottom: 4px; } .value-number { font-size: 28px; font-weight: 700; line-height: 1; } .value-unit { font-size: 12px; font-weight: 500; margin-left: 2px; } .value-text { font-size: 18px; font-weight: 700; } .coupon-desc { font-size: 11px; opacity: 0.9; text-align: center; line-height: 1.2; } .coupon-right { flex: 1; display: flex; flex-direction: column; justify-content: center; padding-left: 8px; } .coupon-name { font-size: 16px; font-weight: 600; color: #333; margin-bottom: 6px; line-height: 1.3; } .coupon-time { font-size: 12px; color: #999; margin-bottom: 4px; } .coupon-stock { font-size: 12px; color: #ff6b6b; font-weight: 500; } /* 领取按钮区域 */ .coupon-action { padding: 12px 16px; background: #f8f9fa; border-top: 1px solid #eee; } .receive-btn { width: 100%; height: 40px; background: linear-gradient(135deg, #ff6b6b, #ff8e8e); color: #fff; border: none; border-radius: 20px; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.3s ease; } .receive-btn:hover { background: linear-gradient(135deg, #ff5252, #ff7979); transform: translateY(-1px); } .receive-btn.disabled { background: #ccc; color: #999; cursor: not-allowed; } .receive-btn.disabled:hover { transform: none; background: #ccc; } .receive-btn:not(.disabled):active { transform: scale(0.98); opacity: 0.8; } /* 加载状态 */ .loading-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 16px; text-align: center; } .loading-spinner { width: 40px; height: 40px; border: 3px solid #f3f3f3; border-top: 3px solid #ff6b6b; border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 16px; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } .loading-text { font-size: 16px; color: #666; } /* 空状态 */ .empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 16px; text-align: center; } .empty-icon { font-size: 60px; margin-bottom: 16px; opacity: 0.6; } .empty-text { font-size: 16px; color: #666; margin-bottom: 8px; } .empty-desc { font-size: 14px; color: #999; } /* 响应式适配 */ @media (max-width: 480px) { .coupon-left { flex: 0 0 80px; padding: 8px 6px; margin-right: 12px; } .value-number { font-size: 24px; } .coupon-name { font-size: 14px; } .coupon-main { padding: 12px; } .coupon-action { padding: 10px 12px; } } @media (max-width: 360px) { .header-content { padding: 0 12px; } .coupon-list-container { padding: 12px 8px; } .coupon-left { flex: 0 0 70px; padding: 6px 4px; } .value-number { font-size: 20px; } .coupon-desc { font-size: 10px; } }