You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

150 lines
3.9 KiB

  1. <template>
  2. <view class="new-user-coupon" v-if="showPopup">
  3. <view class="mask" @click="closePopup"></view>
  4. <view class="coupon-container">
  5. <view class="coupon-content">
  6. <view style="position: relative;">
  7. <image class="coupon-image"
  8. style="height: 800rpx;"
  9. src="https://image.hhlm1688.com/2025/08/08168577fd3c2c428785038ee249736e54Rectangle 9031@3x.png"
  10. mode="aspectFill"></image>
  11. <image
  12. style="width: 280rpx;height: 70rpx;
  13. position: absolute;
  14. left: 50%;
  15. top: 20rpx;
  16. transform: translate(-50%, 0%);"
  17. mode="aspectFill"
  18. src="https://image.hhlm1688.com/2025/08/07767f2fc0a686433bb9e3f90bc6e60990Group%201000001612@3x.png"/>
  19. <image class="coupon-image"
  20. style="position: absolute;left: 50%;top: 50%;
  21. width: 80%;
  22. transform: translate(-50%, -50%);"
  23. :src="NewUserCoupon.couponPoster || image"
  24. mode="widthFix"></image>
  25. </view>
  26. <view class="coupon-btn" @click="getCoupon">立即领取</view>
  27. </view>
  28. <view class="close-btn" @click="closePopup">
  29. <text class="close-icon">×</text>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. import { getToken } from '@/utils/auth'
  36. import { mapState } from 'vuex'
  37. export default {
  38. name: 'NewUserCoupon',
  39. data() {
  40. return {
  41. showPopup: true,
  42. image : '',
  43. }
  44. },
  45. computed : {
  46. ...mapState(['NewUserCoupon']),
  47. },
  48. methods: {
  49. closePopup() {
  50. this.showPopup = false
  51. this.$emit('close')
  52. },
  53. getCoupon() {
  54. // 检查用户是否已登录
  55. if (!getToken() || !this.userInfo.phone) {
  56. // 未登录,跳转到登录页面
  57. uni.navigateTo({
  58. url: '/pages_order/auth/login?url=/pages_order/newUser/index'
  59. })
  60. } else {
  61. // 已登录,跳转到新用户优惠券页面
  62. this.closePopup()
  63. uni.navigateTo({
  64. url: '/pages_order/newUser/index'
  65. })
  66. }
  67. }
  68. }
  69. }
  70. </script>
  71. <style lang="scss">
  72. .new-user-coupon {
  73. position: fixed;
  74. top: 0;
  75. left: 0;
  76. width: 100%;
  77. height: 100%;
  78. z-index: 999;
  79. display: flex;
  80. align-items: center;
  81. justify-content: center;
  82. .mask {
  83. position: absolute;
  84. top: 0;
  85. left: 0;
  86. width: 100%;
  87. height: 100%;
  88. background-color: rgba(0, 0, 0, 0.6);
  89. }
  90. .coupon-container {
  91. position: relative;
  92. width: 560rpx;
  93. z-index: 1000;
  94. display: flex;
  95. flex-direction: column;
  96. align-items: center;
  97. }
  98. .coupon-content {
  99. display: flex;
  100. flex-direction: column;
  101. align-items: center;
  102. }
  103. .coupon-image {
  104. width: 560rpx;
  105. border-radius: 20rpx;
  106. }
  107. .coupon-btn {
  108. position: relative;
  109. margin-top: -100rpx;
  110. width: 300rpx;
  111. height: 80rpx;
  112. background: #FFB13F;
  113. color: #FFFFFF;
  114. font-size: 32rpx;
  115. font-weight: bold;
  116. border-radius: 40rpx;
  117. display: flex;
  118. align-items: center;
  119. justify-content: center;
  120. }
  121. .close-btn {
  122. position: relative;
  123. margin-top: 40rpx;
  124. width: 60rpx;
  125. height: 60rpx;
  126. background: rgba(255, 255, 255, 0.8);
  127. border-radius: 50%;
  128. display: flex;
  129. align-items: center;
  130. justify-content: center;
  131. .close-icon {
  132. color: #666;
  133. font-size: 40rpx;
  134. font-weight: bold;
  135. }
  136. }
  137. }
  138. </style>