index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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: `1、您未关注公众号
  45. 2、您未获得VIP权限,获取VIP途径:`,
  46. btn: '我知道了'
  47. }
  48. } else if (type === 2) {
  49. this.aleartData = {
  50. title: '抽奖结果',
  51. img: this.alData.image,
  52. msg: this.alData.prompt,
  53. btn: '立即领取',
  54. type: this.alData.type
  55. }
  56. }
  57. },
  58. aleartStatus(status) {
  59. if (!status) {
  60. this.aleartData = {}
  61. }
  62. }
  63. },
  64. methods: {
  65. //隐藏弹窗
  66. posterImageClose(type) {
  67. this.$emit("close", false)
  68. },
  69. }
  70. }
  71. </script>
  72. <style lang="scss" scoped>
  73. .aleart {
  74. width: 500rpx;
  75. // height: 714rpx;
  76. position: fixed;
  77. left: 50%;
  78. transform: translateX(-50%);
  79. z-index: 9999;
  80. top: 50%;
  81. margin-top: -357rpx;
  82. background-color: #fff;
  83. padding: 30rpx;
  84. border-radius: 12rpx;
  85. .title {
  86. font-size: 18px;
  87. color: #E82C27;
  88. font-weight: bold;
  89. text-align: center;
  90. padding-bottom: 10rpx;
  91. border-bottom: 1px solid rgba(#E82C27, 0.2);
  92. }
  93. .aleart-body {
  94. display: flex;
  95. align-items: center;
  96. justify-content: center;
  97. flex-direction: column;
  98. padding: 60rpx 0;
  99. .goods-img {
  100. width: 150rpx;
  101. height: 150rpx;
  102. }
  103. .msg {
  104. font-size: 30rpx;
  105. color: #282828;
  106. }
  107. }
  108. .btn {
  109. width: 100%;
  110. padding: 15rpx 0;
  111. color: #fff;
  112. background: linear-gradient(90deg, #F34A46 0%, #FA9532 100%);
  113. border-radius: 20px;
  114. text-align: center;
  115. }
  116. .close {
  117. width: 46rpx;
  118. height: 75rpx;
  119. position: fixed;
  120. right: 0;
  121. top: -73rpx;
  122. display: block;
  123. }
  124. }
  125. </style>