index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <script lang="ts">
  2. import Vue from 'vue'
  3. import { spreadInfo } from '@/api/user'
  4. export default Vue.extend({
  5. name: 'Index',
  6. data() {
  7. return {
  8. userInfo: {}
  9. }
  10. },
  11. computed: {
  12. user() { return this.$store.state.user.user }
  13. },
  14. mounted() {
  15. this.init()
  16. },
  17. methods: {
  18. init() {
  19. spreadInfo().then(res => {
  20. console.log(res.data)
  21. this.userInfo = res.data
  22. })
  23. },
  24. copyLink() {
  25. const url = window.location.protocol + '//' + window.location.host + '/login?inviteCode=' + this.user.inviteCode
  26. navigator.clipboard.writeText(url)
  27. this.$notify({
  28. title: '提示',
  29. message: '复制成功',
  30. type: 'success'
  31. })
  32. }
  33. }
  34. })
  35. </script>
  36. <template>
  37. <div class="body">
  38. <div class="banner">
  39. <img class="coin" src="/static/image/goldcoin.png">
  40. <div class="title">邀请有奖</div>
  41. <div class="desc">邀请新用户注册并消费,可获得现金奖励。</div>
  42. <div class="invite-code">我的邀请码:<span class="code">{{ user.inviteCode }}</span></div>
  43. </div>
  44. <div class="describe">
  45. <div class="title">邀请返利</div>
  46. <div class="desc">当您邀请朋友注册后,TA的每次消费,您都能获得TA消费金额一定比例的现金奖励。绑定取款账户后,即可提现至您的收款账户。</div>
  47. </div>
  48. <div class="amount-count">
  49. <div class="background">Rebate</div>
  50. <div class="amount">
  51. <div class="title">总计返利金额:</div>
  52. <div class="count">¥{{ userInfo.total_amount }}</div>
  53. </div>
  54. <div class="button-list">
  55. <router-link to="/setting/wallet" class="button">
  56. <div class="text">绑定 / 提现<span class="el-icon-top-right" /></div>
  57. </router-link>
  58. <div class="button">
  59. <div class="text" @click="copyLink()">复制分享链接</div>
  60. </div>
  61. </div>
  62. </div>
  63. </div>
  64. </template>
  65. <style scoped>
  66. .body{
  67. .describe{
  68. color: #222222;
  69. margin-top: 36px;
  70. padding: 0 12px;
  71. .title{
  72. font-size: 26px;
  73. font-weight: bolder;
  74. }
  75. .desc{
  76. margin-top: 4px;
  77. font-size: 15px;
  78. color: #555555;
  79. }
  80. }
  81. .banner{
  82. border-radius: 16px;
  83. padding: 16px 48px;
  84. position: relative;
  85. display: flex;
  86. gap: 64px;
  87. align-items: flex-end;
  88. background-image: linear-gradient(90deg,#FF712D,#FFAB1D,#FF712D);
  89. .coin{
  90. transition-duration: 300ms;
  91. transform-origin: center bottom;
  92. filter: drop-shadow(0 0 8px #00000033);
  93. width: 134px;
  94. height: 96px;
  95. object-fit: cover;
  96. object-position: top center;
  97. position: absolute;
  98. right: 220px;
  99. bottom: 0;
  100. }
  101. .title{
  102. color: #fffcec;
  103. font-weight: bolder;
  104. font-size: 28px;
  105. text-shadow: 0 0 6px #FF712D;
  106. }
  107. .desc{
  108. color: #fffcec;
  109. font-weight: bolder;
  110. text-shadow: 0 0 6px #FF712D;
  111. }
  112. .invite-code{
  113. margin-left: auto;
  114. color: white;
  115. font-size: 16px;
  116. position: relative;
  117. text-shadow: 0 0 6px #FF712D;
  118. .code{
  119. font-weight: bolder;
  120. }
  121. }
  122. &:hover {
  123. .coin{
  124. transform: scale(1.04);
  125. }
  126. }
  127. }
  128. .amount-count{
  129. position: relative;
  130. overflow: hidden;
  131. background-color: #759be8;
  132. color: white;
  133. border-radius: 16px;
  134. margin-top: 36px;
  135. padding: 24px 24px 24px 48px;
  136. display: flex;
  137. justify-content: space-between;
  138. align-items: flex-end;
  139. .background{
  140. pointer-events: none;
  141. color: #ffffff09;
  142. position: absolute;
  143. font-size: 170px;
  144. font-weight: bolder;
  145. right: -20px;
  146. bottom: -60px;
  147. }
  148. .button-list{
  149. position: relative;
  150. display: flex;
  151. gap: 16px;
  152. .button{
  153. color: white;
  154. text-decoration: none;
  155. font-size: 14px;
  156. cursor: pointer;
  157. padding: 10px 20px;
  158. border-radius: 8px;
  159. display: flex;
  160. align-items: center;
  161. justify-content: center;
  162. background: #ffffff44;
  163. &:hover{
  164. background: #ffffff55;
  165. }
  166. }
  167. }
  168. .count{
  169. margin-top: 12px;
  170. font-size: 48px;
  171. font-weight: bolder;
  172. }
  173. }
  174. }
  175. </style>