index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <view class="custom-popup" v-if="visible" @touchmove.stop.prevent>
  3. <view class="popup-mask"></view>
  4. <view class="packet-dialog-container">
  5. <view class="dialog-body">
  6. <image src="/pages-sell/static/search/packet-dialog.png" class="dialog-bg" mode="widthFix"></image>
  7. <view class="content-overlay">
  8. <text class="dialog-title">惊喜红包!</text>
  9. <view class="amount-wrapper">
  10. <text class="amount-num">15</text>
  11. <text class="amount-unit">元</text>
  12. </view>
  13. <view class="condition-box">
  14. <text>满0.01可用 24小时有效</text>
  15. </view>
  16. <view class="btn-accept" @click="close">
  17. <text>开心收下</text>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="close-area" @click="close">
  22. <view class="close-icon-custom">×</view>
  23. </view>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. export default {
  29. name: 'PacketDialog',
  30. props: {
  31. value: {
  32. type: Boolean,
  33. default: false
  34. }
  35. },
  36. data() {
  37. return {
  38. visible: false
  39. }
  40. },
  41. watch: {
  42. value: {
  43. handler(val) {
  44. this.visible = val;
  45. },
  46. immediate: true
  47. },
  48. visible(val) {
  49. this.$emit('input', val);
  50. }
  51. },
  52. methods: {
  53. close() {
  54. this.visible = false;
  55. }
  56. }
  57. }
  58. </script>
  59. <style lang="scss" scoped>
  60. .custom-popup {
  61. position: fixed;
  62. top: 0;
  63. left: 0;
  64. right: 0;
  65. bottom: 0;
  66. z-index: 999;
  67. display: flex;
  68. align-items: center;
  69. justify-content: center;
  70. transition: all 0.3s ease-in-out;
  71. .popup-mask {
  72. position: absolute;
  73. top: 0;
  74. left: 0;
  75. width: 100%;
  76. height: 100%;
  77. background: #000000;
  78. opacity: 0.7;
  79. }
  80. }
  81. .packet-dialog-container {
  82. position: relative;
  83. display: flex;
  84. flex-direction: column;
  85. align-items: center;
  86. z-index: 1000;
  87. .dialog-body {
  88. position: relative;
  89. width: 640rpx;
  90. // height is determined by image aspect ratio
  91. .dialog-bg {
  92. width: 100%;
  93. display: block;
  94. }
  95. .content-overlay {
  96. position: absolute;
  97. top: 0;
  98. left: 0;
  99. width: 100%;
  100. height: 100%;
  101. display: flex;
  102. flex-direction: column;
  103. align-items: center;
  104. justify-content: center;
  105. padding-top: 120rpx;
  106. padding-left: 50rpx;
  107. .dialog-title {
  108. font-size: 38rpx;
  109. font-weight: bold;
  110. color: #B31700;
  111. margin-bottom: 20rpx;
  112. padding-top: 50rpx;
  113. }
  114. .amount-wrapper {
  115. display: flex;
  116. align-items: baseline;
  117. justify-content: center;
  118. margin-bottom: 20rpx;
  119. .amount-num {
  120. font-family: Arial;
  121. font-weight: bold;
  122. font-size: 80rpx;
  123. color: #B31700;
  124. background: linear-gradient(214deg, rgba(179,23,0,0.69) 0%, rgba(255,132,0,0.69) 100%);
  125. -webkit-background-clip: text;
  126. -webkit-text-fill-color: transparent;
  127. }
  128. .amount-unit {
  129. color: #B31700;
  130. font-size: 38rpx;
  131. font-weight: bold;
  132. margin-left: 4rpx;
  133. }
  134. }
  135. .condition-box {
  136. padding: 4rpx 20rpx;
  137. border-radius: 8rpx;
  138. text {
  139. font-size: 24rpx;
  140. color: #B31700;
  141. }
  142. }
  143. .btn-accept {
  144. width: 300rpx;
  145. height: 96rpx;
  146. background: linear-gradient(180deg, #FFF5D6 0%, #FFDFA8 100%);
  147. border-radius: 48rpx;
  148. display: flex;
  149. align-items: center;
  150. justify-content: center;
  151. box-shadow: 0 4rpx 10rpx rgba(179, 23, 0, 0.3);
  152. margin-top: 20rpx; // Adjust positioning
  153. text {
  154. color: #B31700;
  155. font-size: 32rpx;
  156. font-weight: bold;
  157. }
  158. }
  159. }
  160. }
  161. .close-area {
  162. position: absolute;
  163. top: 0rpx;
  164. right: 0;
  165. .close-icon-custom {
  166. width: 60rpx;
  167. height: 60rpx;
  168. border: 2rpx solid #fff;
  169. border-radius: 50%;
  170. color: #fff;
  171. font-size: 50rpx;
  172. line-height: 54rpx;
  173. display: flex;
  174. align-items: center;
  175. justify-content: center;
  176. padding-bottom: 6rpx; // Visual adjustment for 'x'
  177. }
  178. }
  179. }
  180. </style>