StatusDisplay.vue 879 B

12345678910111213141516171819202122232425262728293031323334
  1. <script setup lang="ts">
  2. interface Props {
  3. status: number
  4. staticUrl: string
  5. }
  6. const props = defineProps<Props>()
  7. const statusConfig = computed(() => {
  8. const statusMap = {
  9. 1: { text: '处理中', color: 'text-#ff9300', icon: null },
  10. 2: { text: '充值成功', color: 'text-#52C41A', icon: 'videoRight-right.png' },
  11. 3: { text: '充值失败', color: 'text-#FF4D3A', icon: 'videoRight-err.png' },
  12. }
  13. return statusMap[props.status as keyof typeof statusMap] || { text: '', color: '', icon: null }
  14. })
  15. </script>
  16. <template>
  17. <view class="flex items-center justify-center gap-16rpx">
  18. <image
  19. v-if="statusConfig.icon"
  20. class="h-40rpx w-40rpx"
  21. :src="`${staticUrl}/${statusConfig.icon}`"
  22. />
  23. <view
  24. class="text-32rpx font-bold"
  25. :class="statusConfig.color"
  26. >
  27. {{ statusConfig.text }}
  28. </view>
  29. </view>
  30. </template>