2025-11-01
对企业微信端项目管理页面的订单分配板块进行了UI优化,主要包括项目基本信息的折叠展开功能和操作按钮的横排布局优化。
HTML 修改 (stage-order.component.html)
<!-- 卡片头部添加点击事件和展开图标 -->
<div class="card-header" (click)="toggleProjectInfo()">
  <h3 class="card-title">
    <!-- 保留原有的图标和标题 -->
  </h3>
  <!-- 新增:展开/收起图标 -->
  <div class="expand-toggle" [class.expanded]="projectInfoExpanded">
    <svg class="toggle-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
      <path fill="currentColor" d="M256 294.1L383 167c9.4-9.4 24.6-9.4 33.9 0s9.3 24.6 0 34L273 345c-9.1 9.1-23.7 9.3-33.1.7L95 201.1c-4.7-4.7-7-10.9-7-17s2.3-12.3 7-17c9.4-9.4 24.6-9.4 33.9 0l127.1 127z"/>
    </svg>
  </div>
</div>
<!-- 卡片内容添加折叠类 -->
<div class="card-content" [class.collapsed]="!projectInfoExpanded">
  <!-- 原有的表单内容 -->
</div>
SCSS 样式 (stage-order.component.scss)
.card-header {
  // 添加 flex 布局
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  
  // 添加悬停效果
  &:hover {
    background: rgba(var(--primary-rgb), 0.03);
  }
  
  // 展开图标样式
  .expand-toggle {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(var(--primary-rgb), 0.08);
    
    .toggle-icon {
      transition: transform 0.3s ease;
    }
    
    &.expanded .toggle-icon {
      transform: rotate(180deg); // 展开时图标旋转180度
    }
  }
}
.card-content {
  // 添加折叠动画
  max-height: 2000px;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.4s ease, opacity 0.3s ease;
  opacity: 1;
  
  &.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
  }
}
TypeScript 逻辑 (stage-order.component.ts)
export class StageOrderComponent implements OnInit {
  // 折叠展开状态
  projectInfoExpanded: boolean = false;
  // 切换展开/收起
  toggleProjectInfo(): void {
    this.projectInfoExpanded = !this.projectInfoExpanded;
    this.cdr.markForCheck();
  }
}
保存草稿 (btn-outline)
预览 (btn-secondary)
确认订单 (btn-primary)
HTML 修改 (stage-order.component.html)
<div class="action-buttons-horizontal">
  <!-- 保存草稿按钮 -->
  <button class="btn btn-outline" (click)="saveDraft()" [disabled]="saving">
    <svg class="icon">...</svg>
    保存草稿
  </button>
  <!-- 新增:预览按钮 -->
  <button class="btn btn-secondary" (click)="viewPreview()" [disabled]="saving">
    <svg class="icon">...</svg>
    预览
  </button>
  <!-- 确认订单按钮 -->
  <button class="btn btn-primary" (click)="submitForOrder()" [disabled]="saving">
    <svg class="icon">...</svg>
    确认订单
  </button>
</div>
SCSS 样式 (stage-order.component.scss)
.action-buttons-horizontal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px 16px;
  margin-top: 24px;
  background: linear-gradient(to bottom, #ffffff, #f8f9fa);
  border-radius: 12px;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.05);
  .btn {
    flex: 1;
    max-width: 200px;
    min-height: 50px;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    position: relative;
    overflow: hidden;
    
    // 涟漪效果
    &::before {
      content: '';
      position: absolute;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.3);
      transition: width 0.6s, height 0.6s;
    }
    
    &:active::before {
      width: 300px;
      height: 300px;
    }
    
    // 主按钮样式
    &.btn-primary {
      background: linear-gradient(135deg, #3880ff 0%, #2f6ce5 100%);
      color: white;
      box-shadow: 0 4px 16px rgba(56, 128, 255, 0.25);
      
      &:hover:not(:disabled) {
        transform: translateY(-3px);
        box-shadow: 0 6px 20px rgba(56, 128, 255, 0.4);
      }
    }
    
    // 次要按钮样式
    &.btn-secondary {
      background: linear-gradient(135deg, #0cd1e8 0%, #0ab3c9 100%);
      color: white;
      box-shadow: 0 4px 16px rgba(12, 209, 232, 0.25);
      
      &:hover:not(:disabled) {
        transform: translateY(-3px);
        box-shadow: 0 6px 20px rgba(12, 209, 232, 0.4);
      }
    }
    
    // 边框按钮样式
    &.btn-outline {
      background: white;
      color: #3880ff;
      border: 2px solid #3880ff;
      
      &:hover:not(:disabled) {
        background: #3880ff;
        color: white;
        transform: translateY(-3px);
      }
    }
  }
}
// 移动端响应式
@media (max-width: 480px) {
  .action-buttons-horizontal {
    flex-direction: column;
    gap: 12px;
    
    .btn {
      max-width: 100%;
      width: 100%;
    }
  }
}
TypeScript 逻辑 (stage-order.component.ts)
// 预览功能
viewPreview(): void {
  console.log('查看预览', {
    projectInfo: this.projectInfo,
    quotation: this.quotation
  });
  // 可以添加一个模态框来展示预览内容
}
transform 代替 top/left 位置变化opacity 实现淡入淡出max-height 配合 overflow: hidden 实现折叠transition 而非 animation布局策略:
// 小屏手机(≤480px)
.action-buttons-horizontal {
  flex-direction: row;          // 保持横向
  gap: 8px;                      // 减小间距
  padding: 16px 12px;            // 优化内边距
  overflow-x: auto;              // 支持滚动(如果需要)
  
  .btn {
    flex: 1;                     // 等宽分配
    min-width: 90px;             // 最小宽度90px
    padding: 12px 16px;          // 适度的内边距
    font-size: 13px;             // 合适的字体大小
    min-height: 48px;            // 符合触摸标准
    white-space: nowrap;         // 文字不换行
  }
}
触摸优化:
屏幕适配表: | 屏幕宽度 | 按钮间距 | 按钮高度 | 字体大小 | 图标大小 | 布局方式 | |---------|---------|---------|---------|---------|---------| | >768px | 16px | 50px | 15px | 20px | 横排 | | 481-768px | 12px | 50px | 14px | 18px | 横排 | | ≤480px | 8px | 48px | 13px | 16px | 横排 |
如果需要,可以进一步优化:
修改的文件:
stage-order.component.html - HTML 模板stage-order.component.scss - 样式文件stage-order.component.ts - 组件逻辑新增的文件:
ORDER-STAGE-UI-IMPROVEMENTS.md - 本文档本次优化主要聚焦于提升用户体验和视觉效果,通过以下方式实现:
所有修改都保持了与现有代码的兼容性,未影响任何业务逻辑和数据处理。