broker.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <view>
  3. <view class="text-center bg-white codebox">
  4. <view class="text-xl padding-lr padding-top">
  5. <text class="text-black">我的邀请码</text>
  6. </view>
  7. <view class="text-center solid-bottom text-sm padding text-grey">
  8. <view>请被邀请人扫码完成注册登录</view>
  9. <view>邀请成功会您将会根据任务产生收益</view>
  10. </view>
  11. <view class="padding">
  12. <image class="codeimg" mode="widthFix" @click="refCode" :src="userinfo.wxampcode"></image>
  13. <view class="flex flex-direction">
  14. <button class="cu-btn round bg-gray margin-top-sm lg" @tap="saveImage">保存我的邀请码</button>
  15. </view>
  16. </view>
  17. </view>
  18. <!-- <view class="text-center bg-white codebox">
  19. <view class="cu-list grid col-2">
  20. <view class="cu-item">
  21. <view class="cuIcon text-red">{{countobj.tuser}}</view>
  22. <text>今日用户</text>
  23. </view>
  24. <view class="cu-item">
  25. <view class="cuIcon text-red">{{countobj.user}}</view>
  26. <text>累计用户</text>
  27. </view>
  28. <block v-if="brokerinfo.powerreport==1">
  29. <view class="cu-item">
  30. <view class="cuIcon text-red">{{countobj.tentry}}</view>
  31. <text>今日报备</text>
  32. </view>
  33. <view class="cu-item">
  34. <view class="cuIcon text-red">{{countobj.entry}}</view>
  35. <text>累计报备</text>
  36. </view>
  37. </block>
  38. </view>
  39. </view> -->
  40. <!-- <view class="padding-sm"></view>
  41. <view class="padding-xl"></view>
  42. <view class="cu-bar tabbar bg-white foot">
  43. <view class="action text-blue" @tap="goNavPage('/pages/broker/broker')">
  44. <view class="cuIcon-qrcode"></view>
  45. 邀请码
  46. </view>
  47. <view class="action" @tap="goNavPage('/pages/broker/myuser')">
  48. <view class="cuIcon-friend"></view>
  49. 我的用户
  50. </view>
  51. <view class="action" @tap="goNavPage('/pages/my/myentry')">
  52. <view class="cuIcon-upload"></view>
  53. 报备记录
  54. </view>
  55. <view class="action" @tap="goNavPage('/pages/broker/myorder')">
  56. <view class="cuIcon-recharge"></view>
  57. 订单信息
  58. </view>
  59. <view class="action" @tap="goNavPage('/pages/broker/income')">
  60. <view class="cuIcon-moneybag"></view>
  61. 我的收益
  62. </view>
  63. </view> -->
  64. </view>
  65. </template>
  66. <script>
  67. var _this;
  68. export default {
  69. data() {
  70. return {
  71. userinfo: false,
  72. brokerinfo: false,
  73. }
  74. },
  75. onLoad: function() {
  76. _this = this;
  77. _this.userinfo = uni.getStorageSync('userinfo') || false;
  78. _this.brokerinfo = uni.getStorageSync('brokerinfo') || false;
  79. if (_this.userinfo===false || _this.brokerinfo===false){
  80. uni.reLaunch({
  81. url: "/pages/my/my"
  82. });
  83. return false;
  84. }
  85. if (_this.userinfo.wxampcode==""){
  86. _this.refCode();
  87. }
  88. },
  89. methods: {
  90. saveImage: function() {
  91. uni.downloadFile({
  92. url: _this.userinfo.wxampcode, //仅为示例,并非真实的资源
  93. success: (res) => {
  94. if (res.statusCode === 200) {
  95. uni.saveImageToPhotosAlbum({
  96. filePath: res.tempFilePath,
  97. success: function () {
  98. uni.showModal({
  99. title: '信息提示',
  100. content: "邀请码已保存到手机相册,注意查收。",
  101. showCancel: false
  102. });
  103. }
  104. });
  105. }
  106. }
  107. });
  108. },
  109. refCode: function() {
  110. _this.$req.ajax({
  111. path: "my/refcode",
  112. data: {
  113. userid: _this.userinfo.id
  114. }
  115. }).then((data) => {
  116. _this.userinfo.wxampcode = data.wxampcode+"?" + Math.random();
  117. uni.setStorageSync('userinfo', _this.userinfo);
  118. }).catch((err) => {
  119. uni.showModal({
  120. title: '信息提示',
  121. content: err,
  122. showCancel: false
  123. });
  124. });
  125. },
  126. goNavPage: function(pageurl) {
  127. _this.userinfo = _this.checkLogin("/pages/my/my");
  128. if (_this.userinfo===false){
  129. return false;
  130. }
  131. uni.redirectTo({
  132. url: pageurl
  133. });
  134. },
  135. }
  136. }
  137. </script>
  138. <style>
  139. .codebox{ width: 680rpx; margin: 40rpx auto 0rpx auto; border-radius: 8rpx; overflow: hidden; }
  140. </style>