return-notice.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <!-- 添加退回提示区域 -->
  3. <view class="return-notice" @click="handleReturn">
  4. <view class="notice-content">
  5. <view class="title-row">
  6. <text class="title">退回不通过书籍</text>
  7. <text class="tag" v-if="orderInfo.firstOrder == 1">首次免费退</text>
  8. </view>
  9. <view class="countdown">
  10. 您需要在
  11. <u-count-down
  12. v-if="!isRestStopped"
  13. class="time"
  14. :timestamp="orderInfo.restTime"
  15. separator="zh"
  16. separator-size="28"
  17. separator-color="#FF0000"
  18. color="#FF0000"
  19. bg-color="transparent"
  20. ></u-count-down>
  21. <text v-else class="time">{{ hmsTextZh }}</text>
  22. 内处理
  23. </view>
  24. </view>
  25. <u-icon name="arrow-right" size="28" color="#999"></u-icon>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. props: {
  31. orderInfo: {
  32. type: Object,
  33. default: {}
  34. }
  35. },
  36. computed: {
  37. // 是否停止倒计时
  38. isRestStopped() {
  39. const stop = this.orderInfo && this.orderInfo.restStop
  40. return Number(stop) === 1
  41. },
  42. // 当停止时,静态显示“时分秒”
  43. hmsTextZh() {
  44. const secRaw = this.orderInfo && this.orderInfo.restTime
  45. const sec = Math.max(0, Number(secRaw || 0))
  46. const h = String(Math.floor(sec / 3600)).padStart(2, '0')
  47. const m = String(Math.floor((sec % 3600) / 60)).padStart(2, '0')
  48. const s = String(sec % 60).padStart(2, '0')
  49. return `${h}时${m}分${s}秒`
  50. }
  51. },
  52. methods: {
  53. handleReturn() {
  54. this.$emit('close')
  55. }
  56. }
  57. }
  58. </script>
  59. <style lang="scss" scoped>
  60. // 添加新的样式
  61. .return-notice {
  62. margin: 30rpx;
  63. padding: 30rpx;
  64. display: flex;
  65. justify-content: space-between;
  66. align-items: center;
  67. background: #FFF4F4;
  68. border-radius: 10rpx;
  69. border: 2rpx solid #FF0000;
  70. .notice-content {
  71. flex: 1;
  72. .title-row {
  73. display: flex;
  74. align-items: center;
  75. margin-bottom: 12rpx;
  76. .title {
  77. font-size: 32rpx;
  78. font-weight: 500;
  79. color: #333;
  80. }
  81. .tag {
  82. margin-left: 12rpx;
  83. padding: 4rpx 12rpx;
  84. background: #FF4B4B;
  85. color: #fff;
  86. font-size: 24rpx;
  87. border-radius: 4rpx;
  88. }
  89. }
  90. .countdown {
  91. font-size: 28rpx;
  92. color: #666;
  93. .time {
  94. color: #FF4B4B;
  95. }
  96. }
  97. }
  98. }
  99. </style>