Step.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <view class="step-main">
  3. <view v-for="item in list" :key="item.value" class="step-item flex_c_c_f">
  4. <view class="step-icon-box flex_c_c">
  5. <!-- :class="item.value <= step ? 'step-icon-active' : 'step-icon'" -->
  6. <view :class="getClassIcon(item.value)"></view>
  7. </view>
  8. <view :class="item.value === step ? `step-name-active` : 'step-name'">{{ item.name }}</view>
  9. <!-- :class="item.value <= step ? 'step-hr step-hr-active' : 'step-hr'" -->
  10. <view :class="getClass(item.value)" v-if="item.value != 0"></view>
  11. </view>
  12. </view>
  13. </template>
  14. <script setup>
  15. import { computed, ref } from 'vue';
  16. import { inject } from 'vue';
  17. const formData = inject('formData');
  18. console.log("TCL: formData", formData)
  19. const props = defineProps({
  20. step: {
  21. type: Number,
  22. default: 0
  23. }
  24. });
  25. const list = [
  26. {
  27. name: '上传资质',
  28. value: 0
  29. },
  30. {
  31. name: '填写信息',
  32. value: 1
  33. },
  34. {
  35. name: '审核中',
  36. value: 2
  37. },
  38. {
  39. name: '审核完成',
  40. value: 3
  41. }
  42. ]
  43. const getClassIcon = (value) => {
  44. if (value === props.step && formData.appStatus === '3') {
  45. return ' step-error'
  46. }
  47. if (value <= props.step) {
  48. return 'step-icon-active'
  49. }
  50. return 'step-icon'
  51. }
  52. const getClass = (value) => {
  53. if (value === props.step && formData.appStatus === '3') {
  54. return 'step-hr step-error-hr'
  55. }
  56. if (value <= props.step) {
  57. return 'step-hr step-hr-active'
  58. }
  59. return 'step-hr'
  60. }
  61. </script>
  62. <style lang="scss" scoped>
  63. .step-main {
  64. padding: 40rpx 0 36rpx;
  65. background: #fff;
  66. width: 100%;
  67. display: flex;
  68. .step-item {
  69. flex: 1;
  70. position: relative;
  71. }
  72. .step-icon-box {
  73. width: 38rpx;
  74. height: 38rpx;
  75. background: #FFE8D3;
  76. border-radius: 38rpx;
  77. position: relative;
  78. z-index: 3;
  79. .step-icon {
  80. width: 22rpx;
  81. height: 22rpx;
  82. border-radius: 22rpx;
  83. background: #FFFFFF;
  84. }
  85. .step-icon-active {
  86. width: 22rpx;
  87. height: 22rpx;
  88. border-radius: 22rpx;
  89. background: #FF6E51;
  90. }
  91. }
  92. .step-name {
  93. font-family: PingFang SC;
  94. font-size: 22rpx;
  95. font-weight: normal;
  96. line-height: normal;
  97. letter-spacing: normal;
  98. color: #666666;
  99. }
  100. .step-name-active {
  101. font-family: PingFang SC;
  102. font-size: 22rpx;
  103. font-weight: normal;
  104. line-height: normal;
  105. letter-spacing: normal;
  106. color: #333333;
  107. }
  108. .step-hr {
  109. border: 8rpx solid #FFE8D3;
  110. height: 1rpx;
  111. width: 100%;
  112. z-index: 0;
  113. position: absolute;
  114. top: 10rpx;
  115. left: -50%;
  116. background: #FFE8D3;
  117. }
  118. .step-hr-active {
  119. border-color: #FFB87C;
  120. background: #FFB87C
  121. }
  122. .step-hr:first-child {
  123. border: none
  124. }
  125. .step-error {
  126. width: 22rpx;
  127. height: 22rpx;
  128. border-radius: 22rpx;
  129. background: #C4C4C4;
  130. }
  131. .step-error-hr {
  132. border-color: #C4C4C4;
  133. background: #C4C4C4
  134. }
  135. }
  136. </style>