index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <!-- 抽奖结果弹窗 -->
  3. <view class="aleart" v-if="aleartStatus">
  4. <image src="../../../../static/images/poster-close.png" class="close" @click="posterImageClose"></image>
  5. <view class="title">
  6. {{aleartData.title}}
  7. </view>
  8. <view class="aleart-body">
  9. <image v-if="aleartData.img" class="goods-img" :src="aleartData.img" mode=""></image>
  10. <text class="msg">{{aleartData.msg}}</text>
  11. </view>
  12. <view class="btn" @click="posterImageClose()">
  13. {{aleartData.btn}}
  14. </view>
  15. <slot name="bottom"></slot>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. data() {
  21. return {
  22. aleartData: {}
  23. }
  24. },
  25. props: {
  26. aleartType: {
  27. type: Number,
  28. default:0
  29. },
  30. alData: {
  31. type: Object,
  32. default:()=>{}
  33. },
  34. aleartStatus: {
  35. type: Boolean,
  36. default: false
  37. }
  38. },
  39. watch: {
  40. aleartType(type) {
  41. if (type === 1) {
  42. this.aleartData = {
  43. title: '暂无抽奖资格',
  44. msg: `您未关注公众号`,
  45. btn: '我知道了'
  46. }
  47. } else if (type === 2) {
  48. this.aleartData = {
  49. title: '抽奖结果',
  50. img: this.alData.image,
  51. msg: this.alData.prompt,
  52. btn: '立即领取',
  53. type: this.alData.type
  54. }
  55. }
  56. },
  57. aleartStatus(status) {
  58. if (!status) {
  59. this.aleartData = {}
  60. }
  61. }
  62. },
  63. methods: {
  64. //隐藏弹窗
  65. posterImageClose(type) {
  66. this.$emit("close", false)
  67. },
  68. }
  69. }
  70. </script>
  71. <style lang="scss" scoped>
  72. .aleart {
  73. width: 500rpx;
  74. // height: 714rpx;
  75. position: fixed;
  76. left: 50%;
  77. transform: translateX(-50%);
  78. z-index: 9999;
  79. top: 50%;
  80. margin-top: -357rpx;
  81. background-color: #fff;
  82. padding: 30rpx;
  83. border-radius: 12rpx;
  84. .title {
  85. font-size: 18px;
  86. color: #E82C27;
  87. font-weight: bold;
  88. text-align: center;
  89. padding-bottom: 10rpx;
  90. border-bottom: 1px solid rgba(#E82C27, 0.2);
  91. }
  92. .aleart-body {
  93. display: flex;
  94. align-items: center;
  95. justify-content: center;
  96. flex-direction: column;
  97. padding: 60rpx 0;
  98. .goods-img {
  99. width: 150rpx;
  100. height: 150rpx;
  101. }
  102. .msg {
  103. font-size: 30rpx;
  104. color: #282828;
  105. }
  106. }
  107. .btn {
  108. width: 100%;
  109. padding: 15rpx 0;
  110. color: #fff;
  111. background: linear-gradient(90deg, #F34A46 0%, #FA9532 100%);
  112. border-radius: 20px;
  113. text-align: center;
  114. }
  115. .close {
  116. width: 46rpx;
  117. height: 75rpx;
  118. position: fixed;
  119. right: 0;
  120. top: -73rpx;
  121. display: block;
  122. }
  123. }
  124. </style>