blind_list.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <template>
  2. <view class="blind_box">
  3. <view class="blind_box_top">
  4. <image
  5. src="@/static/user/lost_gift.png"
  6. mode="widthFix"
  7. class="img"
  8. v-if="item.status == 3"
  9. ></image>
  10. <image
  11. src="@/static/user/gift.png"
  12. mode="widthFix"
  13. class="img"
  14. v-if="item.status == 1"
  15. ></image>
  16. <view
  17. class="see"
  18. :class="{ disable: item.status == 3 }"
  19. @click="seeBlind"
  20. >
  21. <trans _t="查看" />
  22. </view>
  23. </view>
  24. <view class="blind_box_bottom">
  25. <trans _t="请注意盲盒有效期"></trans>
  26. <view class="expiration">
  27. <trans _t="有效期限:" />
  28. <view class="time"
  29. >{{ getRemainingDays(item.update) }}
  30. <trans _t="天" />
  31. </view>
  32. </view>
  33. </view>
  34. <view class="lost" v-if="item.status == 3">
  35. <image src="/static/user/expired.png" mode="widthFix" class="img"></image>
  36. </view>
  37. <view class="lost" v-if="item.status == 2">
  38. <image
  39. src="/static/user/converted.png"
  40. mode="widthFix"
  41. class="img"
  42. ></image>
  43. </view>
  44. <codeModel ref="codeModelRef" :deatil="item" />
  45. </view>
  46. </template>
  47. <script setup>
  48. import { ref, computed } from "vue";
  49. import { t } from "@/locale";
  50. import { useGlobal, getRemainingDays } from "@/utils";
  51. import codeModel from "./codeModel";
  52. const codeModelRef = ref(null);
  53. const props = defineProps({
  54. item: {
  55. type: Object,
  56. default: () => ({}),
  57. },
  58. });
  59. const seeBlind = () => {
  60. codeModelRef.value && codeModelRef.value.open();
  61. };
  62. </script>
  63. <style lang="less" scoped>
  64. @import url("@/style.less");
  65. .blind_box {
  66. position: relative;
  67. width: 100%;
  68. padding: 0 20rpx 20rpx;
  69. border-radius: 20rpx;
  70. background: #ffffff;
  71. box-shadow: 0rpx 8rpx 20rpx 0rpx #d8d8d8;
  72. .lost {
  73. position: absolute;
  74. top: -10rpx;
  75. left: 50%;
  76. width: 190rpx;
  77. height: 186rpx;
  78. transform: translateX(-95rpx);
  79. .img {
  80. width: 100%;
  81. }
  82. }
  83. &_top {
  84. .flex_position(space-between);
  85. .img {
  86. width: 140rpx;
  87. height: 140rpx;
  88. }
  89. .see {
  90. height: 66rpx;
  91. line-height: 66rpx;
  92. text-align: center;
  93. .size(28rpx);
  94. color: var(--light);
  95. border-radius: 10rpx;
  96. padding: 0 50rpx;
  97. background: var(--black);
  98. }
  99. .disable {
  100. background: var(--bor-color1);
  101. }
  102. }
  103. &_bottom {
  104. .flex_position(space-between);
  105. margin-top: 8rpx;
  106. color: var(--text-02);
  107. .size(28rpx);
  108. .expiration {
  109. display: flex;
  110. .time {
  111. font-weight: 700;
  112. color: var(--black);
  113. }
  114. }
  115. }
  116. }
  117. </style>