promote.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <view>
  3. <view class="card">
  4. <image
  5. src="https://guosen-bucket-ldt.obs.cn-south-1.myhuaweicloud.com:443/aa85f1da8bd84ad2944fe88dd4ef7045-hyRO9DPsxdFr399bc3fe4c0fb52273af5c8f694e1356.png">
  6. </image>
  7. <view class="info">
  8. <view class="data">
  9. <view class="top">
  10. <image :src="userinfo.avatar" mode=""></image>
  11. <text class="nickname">{{userinfo.nickName}}</text>
  12. </view>
  13. <view class="bottom">
  14. <view>我是联兑通独家代理</view>
  15. <view>扫码成为渠道合伙人</view>
  16. </view>
  17. </view>
  18. <view class="qrcode">
  19. <image :show-menu-by-longpress="true" :src="promotionQrCode" mode=""></image>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. data() {
  28. return {
  29. userinfo: {},
  30. promotionQrCode: ''
  31. }
  32. },
  33. onLoad() {
  34. this.getQrCode()
  35. this.fetchUserDetail()
  36. },
  37. methods: {
  38. fetchUserDetail() {
  39. this.$api.loginUser.detail({
  40. id: this.vuex_userId
  41. }).then(res => {
  42. this.userinfo = res.data
  43. })
  44. },
  45. getQrCode() {
  46. if (this.$cache.get('promotionQrCode')) {
  47. this.promotionQrCode = this.$cache.get('promotionQrCode')
  48. } else {
  49. this.createWxaQrCode()
  50. }
  51. },
  52. createWxaQrCode() {
  53. let params = {
  54. type: this.$global.platform.SHOP,
  55. path: '/pages/login/register?promotionCode=' + this.vuex_userId
  56. }
  57. this.$api.wxApp.createWxaQrCode(params).then(res => {
  58. if (!this.$isEmpty(res.data.link)) {
  59. this.promotionQrCode = res.data.link
  60. this.$cache.put('promotionQrCode', res.data.link)
  61. } else {
  62. this.$dialog.showModalAndBack('获取推广码失败')
  63. }
  64. })
  65. }
  66. }
  67. }
  68. </script>
  69. <style lang="scss">
  70. .card {
  71. margin: 20rpx;
  72. display: flex;
  73. flex-direction: column;
  74. align-items: center;
  75. justify-content: center;
  76. background-color: #FFFFFF;
  77. image {
  78. width: 100%;
  79. height: 882rpx;
  80. }
  81. .info {
  82. width: 100%;
  83. padding: 30rpx 30rpx 30rpx 50rpx;
  84. display: flex;
  85. justify-content: space-between;
  86. .data {
  87. display: flex;
  88. flex-direction: column;
  89. justify-content: center;
  90. .top {
  91. display: flex;
  92. image {
  93. width: 80rpx;
  94. height: 80rpx;
  95. border-radius: 50%;
  96. }
  97. .nickname {
  98. display: flex;
  99. justify-content: center;
  100. align-items: center;
  101. margin-left: 20rpx;
  102. font-weight: 800;
  103. font-size: 34rpx;
  104. }
  105. }
  106. .bottom {
  107. line-height: 40rpx;
  108. color: #333333;
  109. margin-top: 30rpx;
  110. margin-left: 10rpx;
  111. }
  112. }
  113. .qrcode {
  114. display: flex;
  115. justify-content: center;
  116. align-items: center;
  117. image {
  118. width: 250rpx;
  119. height: 250rpx;
  120. }
  121. }
  122. }
  123. }
  124. </style>