Step.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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. const getClassIcon = (value) => {
  40. if (value === props.step && formData.appStatus === '3') {
  41. return ' step-error'
  42. }
  43. if (value <= props.step) {
  44. return 'step-icon-active'
  45. }
  46. return 'step-icon'
  47. }
  48. const getClass = (value) => {
  49. if (value === props.step && formData.appStatus === '3') {
  50. return 'step-hr step-error-hr'
  51. }
  52. if (value <= props.step) {
  53. return 'step-hr step-hr-active'
  54. }
  55. return 'step-hr'
  56. }
  57. </script>
  58. <style lang="scss" scoped>
  59. .step-main {
  60. padding: 40rpx 0 36rpx;
  61. background: #fff;
  62. width: 100%;
  63. display: flex;
  64. .step-item {
  65. flex: 1;
  66. position: relative;
  67. }
  68. .step-icon-box {
  69. width: 38rpx;
  70. height: 38rpx;
  71. background: #FFE8D3;
  72. border-radius: 38rpx;
  73. position: relative;
  74. z-index: 3;
  75. .step-icon {
  76. width: 22rpx;
  77. height: 22rpx;
  78. border-radius: 22rpx;
  79. background: #FFFFFF;
  80. }
  81. .step-icon-active {
  82. width: 22rpx;
  83. height: 22rpx;
  84. border-radius: 22rpx;
  85. background: #FF6E51;
  86. }
  87. }
  88. .step-name {
  89. font-family: PingFang SC;
  90. font-size: 22rpx;
  91. font-weight: normal;
  92. line-height: normal;
  93. letter-spacing: normal;
  94. color: #666666;
  95. }
  96. .step-name-active {
  97. font-family: PingFang SC;
  98. font-size: 22rpx;
  99. font-weight: normal;
  100. line-height: normal;
  101. letter-spacing: normal;
  102. color: #333333;
  103. }
  104. .step-hr {
  105. border: 8rpx solid #FFE8D3;
  106. height: 1rpx;
  107. width: 100%;
  108. z-index: 0;
  109. position: absolute;
  110. top: 10rpx;
  111. left: -50%;
  112. background: #FFE8D3;
  113. }
  114. .step-hr-active {
  115. border-color: #FFB87C;
  116. background: #FFB87C
  117. }
  118. .step-hr:first-child {
  119. border: none
  120. }
  121. .step-error {
  122. width: 22rpx;
  123. height: 22rpx;
  124. border-radius: 22rpx;
  125. background: #C4C4C4;
  126. }
  127. .step-error-hr {
  128. border-color: #C4C4C4;
  129. background: #C4C4C4
  130. }
  131. }
  132. </style>