invite.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. <!--
  2. * @Author: your name
  3. * @Date: 2021-03-18 11:16:06
  4. * @LastEditTime: 2021-03-29 15:02:40
  5. * @LastEditors: Please set LastEditors
  6. * @Description: In User Settings Edit
  7. * @FilePath: \rebatedine-mini\src\pagesSub\commission\invite.vue
  8. -->
  9. <template>
  10. <view class="main">
  11. <network-error />
  12. <view class="top">
  13. <feed class="top-feed"
  14. v-show="feedContent"
  15. :content="feedContent"></feed>
  16. <view class="container">
  17. <button class="button"
  18. v-if="!userInfo"
  19. @click="jumpToLogin">立即邀请</button>
  20. <button class="button"
  21. open-type="share"
  22. v-if="userInfo">立即邀请</button>
  23. <button class="button-disable">面对面扫码 敬请期待</button>
  24. </view>
  25. </view>
  26. <view class="middle">
  27. <view class="middle-top">
  28. <view class="middle-top-left">
  29. <view class="middle-top-left-top">
  30. <text class="number">{{(userInfo.total_amount/100).toFixed(1)}}</text>
  31. <text class="unit">元</text>
  32. </view>
  33. <text class="tips">累计收益</text>
  34. </view>
  35. <view class="middle-top-right">
  36. <view class="middle-top-right-top">
  37. <text class="number">{{userInfo.invite_count}}</text>
  38. <text class="unit">位</text>
  39. </view>
  40. <text class="tips">成功邀请</text>
  41. </view>
  42. </view>
  43. <view class="middle-middle">
  44. <button class="middle-middle-button"
  45. v-if="!userInfo"
  46. @click="jumpToLogin">
  47. <text class="text">立即邀请好友</text>
  48. <image class="icon"
  49. src="~@/static/icon/icon_commission_go.png"></image>
  50. </button>
  51. <button class="middle-middle-button"
  52. open-type="share"
  53. v-if="userInfo">
  54. <text class="text">立即邀请好友</text>
  55. <image class="icon"
  56. src="~@/static/icon/icon_commission_go.png"></image>
  57. </button>
  58. <view class="middle-middle-money"
  59. @click="jumpToCommission">
  60. <image class="icon"
  61. src="~@/static/icon/icon_commission_book.png"></image>
  62. <text class="text">查看返利金</text>
  63. </view>
  64. </view>
  65. </view>
  66. <image mode="widthFix"
  67. class="award-info"
  68. :src="awardUrl"></image>
  69. </view>
  70. </template>
  71. <script>
  72. import Feed from '../../components/feed'
  73. import * as userApi from '../../api/userApi'
  74. import * as commissionApi from '../../api/commissionApi'
  75. export default {
  76. components: {
  77. Feed
  78. },
  79. data () {
  80. return {
  81. feeds: [],
  82. feedContent: null,
  83. feedTimer: null
  84. }
  85. },
  86. onUnload () {
  87. if (this.feedTimer) {
  88. clearInterval(this.feedTimer)
  89. }
  90. },
  91. onShow () {
  92. userApi.getUserInfoByToken().then(({ code, data }) => {
  93. if (code === 200) {
  94. this.$store.commit('updateUserInfo', data)
  95. }
  96. })
  97. this.feedTimer = setInterval(() => {
  98. if (this.feeds.length === 0) {
  99. commissionApi.getCommissionFeedList().then(({ code, data }) => {
  100. if (code === 200) {
  101. this.feeds = data
  102. if (this.feeds.length > 0) {
  103. const item = this.feeds.pop()
  104. this.feedContent = item.content
  105. }
  106. }
  107. })
  108. } else {
  109. const item = this.feeds.pop()
  110. this.feedContent = item.content
  111. }
  112. }, 3000)
  113. },
  114. onHide () {
  115. if (this.feedTimer) {
  116. clearInterval(this.feedTimer)
  117. this.feedTimer = null
  118. }
  119. },
  120. onShareAppMessage (res) {
  121. const title = '亲爱的,我请你趣吃霸王餐啦!赶紧查收!'
  122. return {
  123. title: title,
  124. path: this.getShareUrl(),
  125. imageUrl: 'https://image.qcbwc.cn/share/invite-share.png'
  126. }
  127. },
  128. onShareTimeline (res) {
  129. const title = '亲爱的,我请你趣吃霸王餐啦!赶紧查收!'
  130. return {
  131. title: title,
  132. path: this.getShareUrl(),
  133. imageUrl: 'https://image.qcbwc.cn/share/invite-share.png'
  134. }
  135. },
  136. methods: {
  137. change () {
  138. this.show = !this.show
  139. },
  140. getShareUrl () {
  141. let url = '/pages/index'
  142. if (this.userInfo) {
  143. url += '?invite_id=' + this.userInfo.id
  144. }
  145. return url
  146. },
  147. jumpToLogin () {
  148. uni.navigateTo({ url: '/pagesSub/other/login' })
  149. },
  150. jumpToCommission () {
  151. uni.navigateTo({
  152. url: '/pagesSub/commission/commission'
  153. })
  154. }
  155. },
  156. computed: {
  157. awardUrl () {
  158. return 'https://image.qcbwc.cn/background/invite_bottom.png?t=' + new Date().getTime()
  159. },
  160. userInfo () {
  161. return this.$store.state.userInfo
  162. }
  163. }
  164. }
  165. </script>
  166. <style lang="scss" scoped>
  167. .top {
  168. height: 1354rpx;
  169. background-image: url('https://image.qcbwc.cn/background/invite_top.png');
  170. background-size: 100%;
  171. .top-feed {
  172. width: 100%;
  173. position: absolute;
  174. display: flex;
  175. justify-content: center;
  176. margin-top: 274rpx;
  177. }
  178. .container {
  179. width: 100%;
  180. position: absolute;
  181. display: flex;
  182. flex-direction: column;
  183. justify-content: center;
  184. align-items: center;
  185. margin-top: 956rpx;
  186. .button {
  187. height: 88rpx;
  188. line-height: 88rpx;
  189. width: 65%;
  190. background: linear-gradient(
  191. 180deg,
  192. #fcf9c7 0%,
  193. #fcd890 52%,
  194. #fdbb61 100%
  195. );
  196. box-shadow: 0px 4rpx 20rpx 0px rgba(141, 14, 33, 0.31);
  197. border-radius: 44rpx;
  198. margin-bottom: 32rpx;
  199. font-size: 32rpx;
  200. color: #e40c0c;
  201. font-weight: 600;
  202. }
  203. .button-disable {
  204. height: 88rpx;
  205. width: 65%;
  206. line-height: 88rpx;
  207. border-radius: 44rpx;
  208. margin-bottom: 32rpx;
  209. font-size: 32rpx;
  210. font-weight: 600;
  211. background: #d3d4d5;
  212. box-shadow: 0px 4rpx 20rpx 0px rgba(141, 14, 33, 0.31);
  213. border-radius: 44rpx;
  214. color: #767778;
  215. font-weight: 600;
  216. }
  217. }
  218. }
  219. .middle {
  220. height: 624rpx;
  221. background-image: url('https://image.qcbwc.cn/background/invite_middle.png');
  222. background-size: 100%;
  223. &-top {
  224. position: absolute;
  225. display: flex;
  226. width: 90%;
  227. margin-left: 5%;
  228. margin-top: 130rpx;
  229. &-left {
  230. border-right: 2rpx solid #d3d4d5;
  231. }
  232. &-left,
  233. &-right {
  234. flex: 1;
  235. display: flex;
  236. flex-direction: column;
  237. align-items: center;
  238. justify-content: center;
  239. &-top {
  240. display: flex;
  241. justify-content: center;
  242. align-items: flex-end;
  243. color: #ed2701;
  244. .number {
  245. font-size: 80rpx;
  246. font-weight: 600;
  247. }
  248. .unit {
  249. margin-bottom: 14rpx;
  250. font-size: 28rpx;
  251. margin-left: 4rpx;
  252. font-weight: 600;
  253. }
  254. }
  255. .tips {
  256. font-size: 28rpx;
  257. color: #98999a;
  258. font-weight: 400;
  259. }
  260. }
  261. }
  262. &-middle {
  263. position: absolute;
  264. margin-top: 404rpx;
  265. width: 100%;
  266. display: flex;
  267. flex-direction: column;
  268. justify-content: center;
  269. align-items: center;
  270. &-button {
  271. display: flex;
  272. width: 65%;
  273. height: 88rpx;
  274. line-height: 88rpx;
  275. justify-content: center;
  276. align-items: center;
  277. background: linear-gradient(
  278. 180deg,
  279. #ff6160 0%,
  280. #ff2b39 52%,
  281. #ff0823 100%
  282. );
  283. box-shadow: 0px 4rpx 20rpx 0px rgba(141, 14, 33, 0.31);
  284. border-radius: 44rpx;
  285. .text {
  286. font-size: 32rpx;
  287. font-weight: 600;
  288. color: #fcebc6;
  289. }
  290. .icon {
  291. width: 36rpx;
  292. height: 36rpx;
  293. margin-left: 12rpx;
  294. }
  295. }
  296. &-money {
  297. display: flex;
  298. align-items: center;
  299. justify-content: center;
  300. margin-top: 40rpx;
  301. .icon {
  302. width: 24rpx;
  303. height: 24rpx;
  304. margin-right: 8rpx;
  305. }
  306. .text {
  307. color: #ff6632;
  308. font-size: 24rpx;
  309. font-weight: 400;
  310. }
  311. }
  312. }
  313. }
  314. .award-info {
  315. width: 100%;
  316. }
  317. </style>