newcomerGift.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <script setup lang="ts">
  2. import { useUserStore } from '~/stores/user'
  3. import {toRefs} from "vue";
  4. import {couponTypeFilter} from "~/utils/filter";
  5. const props = defineProps({
  6. //弹窗是否弹起
  7. couponModal: {
  8. type: Boolean,
  9. default: false
  10. },
  11. newPeopleCouponList: {
  12. type: Array,
  13. default: []
  14. }
  15. })
  16. const { couponModal } = toRefs(props)
  17. const { userInfo } = useUserStore()
  18. //关闭弹窗
  19. const emit = defineEmits(['onCloseSucceeded'])
  20. const handleClose = async()=>{
  21. emit('onCloseSucceeded')
  22. }
  23. const getTime = (time: string) => {
  24. let reg = new RegExp('-', 'g') //g代表全部
  25. return time ? time.split(' ')[0].substring(2, 10) : ''
  26. }
  27. </script>
  28. <template>
  29. <!-- 新人礼弹窗 -->
  30. <div class="coupon_modal" @touchmove.stop.prevent="moveStop" v-if="couponModal">
  31. <div class="mask"></div>
  32. <div class="_container">
  33. <div class="_tit alimama">新人专属大礼包</div>
  34. <div class="_look oppoSans-R">优惠券将发放至个人账户,可在“我的优惠券”查看</div>
  35. <div class="_box cursors">
  36. <div class="_item acea-row row-middle" v-for="item in newPeopleCouponList" :key="item.id">
  37. <div class="_price_box">
  38. <div class="_price line-heightOne"><span class="text-20px">¥</span>{{ item.money }}</div>
  39. <div class="_man">满{{ item.minPrice }}可用</div>
  40. </div>
  41. <div class="flex-1 _desc">
  42. <div v-if="item.category === 3" class="_text line1 line-heightOne oppoSans-M">全平台通用</div>
  43. <div v-else class="_text line1 line-heightOne oppoSans-M">
  44. 仅限指定{{ couponTypeFilter(item.category) }}可用
  45. </div>
  46. <div v-if="item.isFixedTime" class="_end line1 line-heightOne oppoSans-M">
  47. {{ getTime(item.useStartTime) + ' ~ ' + getTime(item.useEndTime) + '可用' }}
  48. </div>
  49. <div v-else class="_end line1 line-heightOne">{{ '领取后' + item.day + '天内可用' }}</div>
  50. </div>
  51. </div>
  52. </div>
  53. <div class="_btn cursors" @click="handleClose()"></div>
  54. <span class="guanbi iconfont icon-danchuangguanbi cursors" @click="handleClose()"></span>
  55. </div>
  56. </div>
  57. </template>
  58. <style lang="scss" scoped>
  59. .mask {
  60. position: fixed;
  61. top: 0;
  62. left: 0;
  63. right: 0;
  64. bottom: 0;
  65. background-color: rgba(0, 0, 0, 0.5);
  66. z-index: 100;
  67. }
  68. .coupon_modal {
  69. ._container {
  70. position: fixed;
  71. left: 50%;
  72. top: 50%;
  73. transform: translate(-50%, -50%);
  74. width: 370px;
  75. height: 459px;
  76. background-size: cover;
  77. background: url('@/assets/images/coupon_modal_bg.png');
  78. background-repeat: no-repeat;
  79. z-index: 330;
  80. ._tit {
  81. text-align: center;
  82. // height: 42px;
  83. font-size: 26px;
  84. font-weight: 600;
  85. color: #ffe9be;
  86. // line-height: 42px;
  87. text-shadow: 0px 2px 2px rgba(0, 0, 0, 0.2);
  88. margin-top: 137px;
  89. }
  90. ._look {
  91. text-align: center;
  92. font-size: 12px;
  93. color: #fff;
  94. margin: 10px auto 18px;
  95. }
  96. ._box {
  97. width: 370px;
  98. height: 166px;
  99. margin: auto;
  100. padding: 0 26px;
  101. overflow-y: scroll;
  102. overflow-x: hidden;
  103. ._item {
  104. width: 318px;
  105. height: 82px;
  106. background: url('@/assets/images/coupon_item_bg.png');
  107. }
  108. }
  109. ._item {
  110. width: 100%;
  111. height: 140px;
  112. border-radius: 14px;
  113. background-size: cover;
  114. padding: 17px 0;
  115. ._price_box {
  116. width: 118px;
  117. padding: 0 15px;
  118. text-align: center;
  119. border-right: 1px dashed #e6e6e6;
  120. ._price {
  121. font-size: 32px;
  122. color: #e93323;
  123. font-weight: 600;
  124. }
  125. ._man {
  126. font-size: 12px;
  127. color: #666;
  128. margin-top: 5px;
  129. }
  130. }
  131. ._desc {
  132. padding: 0 18px;
  133. width: 80px;
  134. ._text {
  135. //width: 280px;
  136. font-size: 18px;
  137. color: #282828;
  138. }
  139. ._end {
  140. //width: 280px;
  141. margin-top: 12px;
  142. font-size: 12px;
  143. color: #999;
  144. }
  145. }
  146. ~ ._item {
  147. margin-top: 12px;
  148. }
  149. }
  150. ._btn {
  151. width: 188px;
  152. height: 44px;
  153. background-size: cover;
  154. background: url('@/assets/images/coupon_modal_btn.png');
  155. margin: 23px auto 0;
  156. }
  157. .guanbi {
  158. font-size: 24px;
  159. color: #fff;
  160. position: absolute;
  161. top: 12px;
  162. right: -53px;
  163. }
  164. }
  165. }
  166. </style>