uni-stepBar.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <!-- 步骤条容器 -->
  3. <view class="step">
  4. <!-- 遍历步骤列表 -->
  5. <view class="item dis f-c" v-for="(item, index) in stepList" :key="index">
  6. <!-- 步骤内容行 -->
  7. <view class="dis a-c j-s">
  8. <!-- 左侧:图标和标题 -->
  9. <view class="dis a-c">
  10. <!-- 状态图标 -->
  11. <view class="dis a-c j-c mr-2 " :class="[
  12. item.show == null ? 'tag1' :
  13. item.show == false ? 'reject' : 'tag'
  14. ]">
  15. <!-- 失败状态图标 -->
  16. <u-icon v-if="item.show==false" name="close" color="#fff" size="11" :bold="true" />
  17. <!-- 成功状态图标 -->
  18. <u-icon v-if="item.show" name="checkmark" color="#333" size="11" :bold="true" />
  19. </view>
  20. <!-- 步骤标题 -->
  21. <text class="title active">
  22. {{ item.title }}
  23. </text>
  24. </view>
  25. <!-- 右侧:时间显示 -->
  26. <text class="time" v-if="item.time">
  27. {{ item.time }}
  28. </text>
  29. </view>
  30. <!-- 步骤连接线(最后一个不显示) -->
  31. <view class="line" v-if="index != stepList.length - 1"></view>
  32. <!-- 驳回状态显示原因 -->
  33. <view class="rejectionReason " v-if="item.content && item.status==false">
  34. {{item.content}}
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. export default {
  41. name: 'StepProgress',
  42. props: {
  43. /**
  44. * 步骤数据列表
  45. * 结构示例:
  46. * [
  47. * {
  48. * title: '步骤1', // 步骤标题
  49. * show: true, // 状态:true-成功, false-失败, null-未完成
  50. * time: '2023-01-01' // 完成时间(可选)
  51. * }
  52. * ]
  53. */
  54. stepList: {
  55. type: Array,
  56. default: () => [],
  57. }
  58. },
  59. // 移除了不必要的空生命周期和方法
  60. }
  61. </script>
  62. <style lang="scss" scoped>
  63. .step {
  64. .item {
  65. // 步骤项间距
  66. // 状态图标样式
  67. .tag {
  68. // 成功状态
  69. width: 30rpx;
  70. height: 30rpx;
  71. background: #FDE935;
  72. border-radius: 50%;
  73. }
  74. .tag1 {
  75. // 未完成状态
  76. width: 26rpx;
  77. height: 26rpx;
  78. background: #FFFFFF;
  79. border-radius: 50%;
  80. border: 2rpx solid #FDE935;
  81. }
  82. .reject {
  83. // 失败状态
  84. width: 30rpx;
  85. height: 30rpx;
  86. background: #FF4545;
  87. border-radius: 50%;
  88. }
  89. // 标题样式
  90. .title {
  91. font-size: 30rpx;
  92. color: #666;
  93. &.active {
  94. // 已完成步骤的标题样式
  95. color: #333;
  96. font-weight: bold;
  97. }
  98. }
  99. // 时间样式
  100. .time {
  101. font-size: 22rpx;
  102. color: #999;
  103. }
  104. // 连接线样式
  105. .line {
  106. height: 40rpx;
  107. margin-left: 15rpx;
  108. border-left: 1rpx dashed #333;
  109. }
  110. .rejectionReason {
  111. padding: 20rpx;
  112. box-sizing: border-box;
  113. background: #FAFAFA;
  114. margin-top: 10rpx;
  115. margin-left: 50rpx;
  116. border-radius: 6rpx 6rpx 6rpx 6rpx;
  117. font-size: 30rpx;
  118. color: #666;
  119. }
  120. }
  121. }
  122. </style>