result.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <view class="result-container" :class="type">
  3. <u-icon
  4. v-if="type === 'approve'"
  5. size="150"
  6. color="#157a2c"
  7. name="checkmark-circle-fill"
  8. ></u-icon>
  9. <u-icon v-else size="150" color="#ff0000" name="close-circle-fill"></u-icon>
  10. <view class="status-text">{{ configs[type][status] }}</view>
  11. <view class="btn-wrapper">
  12. <button @click="back">返回上一页</button>
  13. </view>
  14. <view class="back-text"> {{ delay }}秒钟后返回详情页 </view>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. data () {
  20. return {
  21. status: '0',
  22. type: 'approve',
  23. configs: {
  24. approve: ['已审核', '已验收'],
  25. refuse: ['审核已驳回', '验收不通过']
  26. },
  27. delay: 5,
  28. timer: null
  29. }
  30. },
  31. onLoad (options) {
  32. this.type = options.type || 'approve'
  33. this.status = options.status || '0'
  34. this.timeCount()
  35. },
  36. onHide () {
  37. clearInterval(this.timer)
  38. },
  39. onUnload () {
  40. clearInterval(this.timer)
  41. },
  42. methods: {
  43. back () {
  44. uni.navigateBack({
  45. delta: 1
  46. })
  47. },
  48. timeCount () {
  49. clearInterval(this.timer)
  50. this.timer = setInterval(() => {
  51. this.delay--
  52. if (this.delay <= 0) {
  53. clearInterval(this.timer)
  54. this.back()
  55. }
  56. }, 1000)
  57. }
  58. }
  59. }
  60. </script>
  61. <style lang="scss" scoped>
  62. .result-container {
  63. display: flex;
  64. justify-content: center;
  65. flex-direction: column;
  66. align-items: center;
  67. padding-top: 120rpx;
  68. &.refuse {
  69. .status-text {
  70. color: #ff0000;
  71. }
  72. }
  73. .status-text {
  74. padding: 40rpx 0;
  75. font-size: 38rpx;
  76. }
  77. .btn-wrapper {
  78. button {
  79. width: 200rpx;
  80. font-size: 28rpx;
  81. height: 48rpx;
  82. line-height: 46rpx;
  83. border: 1px solid $j-primary-border-green;
  84. color: $j-primary-border-green;
  85. background: #fff;
  86. }
  87. }
  88. .back-text {
  89. padding: 20rpx;
  90. color: #ccc;
  91. font-size: 28rpx;
  92. }
  93. }
  94. </style>