uni-stepBar.vue 2.8 KB

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