team.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. <template>
  2. <view class="content">
  3. <view class="view1"
  4. style="box-shadow: rgba(183, 183, 183, 0.3) 1px 1px 10px 1px;border-radius: 20upx;margin-bottom: 20upx;">
  5. <view style="display: flex;">
  6. <view style="margin: 70upx 0 0 20upx;height: 100upx; width: 300upx; text-align: center;">
  7. <view style="font-size: 40upx;">{{ countChildren }}</view>
  8. <view style="font-size: 28upx;margin-left: 20upx;">邀请好友(人)</view>
  9. </view>
  10. <view style="margin: 70upx 0 0 75upx;height: 100upx; width: 300upx;text-align: center;" @click="goDet">
  11. <view style="font-size: 40upx;">{{ teamMoney?teamMoney:0 }}</view>
  12. <view style="font-size: 28upx;">我的收益</view>
  13. </view>
  14. </view>
  15. <view style="margin: 20rpx 30rpx;font-size: 28rpx;color: #557EFD;" v-if="userType==1">
  16. <view>*用户可得邀请好友开通会员奖励</view>
  17. <view style="margin: 20rpx 0rpx;font-size: 28rpx;color: #82A9FE;" v-if="yijiyongjin">
  18. *一级可得{{yijiyongjin*100}}%的消费奖励</view>
  19. <view style="margin: 20rpx 0rpx;font-size: 28rpx;color: #82A9FE;" v-if="erjiyongjin">
  20. *二级可得{{erjiyongjin*100}}%的消费奖励</view>
  21. </view>
  22. <view style="margin: 20rpx 30rpx;font-size: 28rpx;color: #557EFD;" v-if="userType==2">
  23. <view>*企业可得邀请人在平台消费奖励</view>
  24. <view style="margin: 20rpx 0rpx;font-size: 28rpx;color: #82A9FE;" v-if="yijiyongjin">
  25. *一级可得{{yijiyongjin*100}}%的消费奖励</view>
  26. <view style="margin: 20rpx 0rpx;font-size: 28rpx;color: #82A9FE;" v-if="erjiyongjin">
  27. *二级可得{{erjiyongjin*100}}%的消费奖励</view>
  28. </view>
  29. <!-- <view style="margin: 20rpx 30rpx;font-size: 28rpx;color: #82A9FE;" v-if="yijiyongjin">
  30. *可得一级好友平台佣金的{{yijiyongjin*100}}%</view> -->
  31. <!-- <view style="margin: 20rpx 30rpx;font-size: 28rpx;color: #82A9FE;" v-if="erjiyongjin">
  32. *可得二级好友平台佣金的{{erjiyongjin*100}}%</view> -->
  33. <button class="yaoqing_btn" @click="goYao">邀请好友</button>
  34. </view>
  35. <view class="navbar">
  36. <view class="nav-item" :class="{current: type == 1}" @click="changeList(1)">
  37. 一级( {{countChildren}} )
  38. </view>
  39. <view class="nav-item" :class="{current: type == 2}" @click="changeList(2)">
  40. 二级( {{countChildrenChildren}} )
  41. </view>
  42. </view>
  43. <view class="view2"
  44. style="box-shadow: rgba(183, 183, 183, 0.3) 1px 1px 10px 1px;border-radius: 20upx;margin-bottom: 50upx;padding-bottom: 20rpx;">
  45. <view style="display: flex;flex-direction: row;padding: 20upx;">
  46. <view style="width: 15%;">编号</view>
  47. <view style="width: 20%;">头像</view>
  48. <view style="width: 40%;">昵称</view>
  49. <view style="width: 35%;text-align: center;">时间</view>
  50. </view>
  51. <view class="flex justify-between align-center padding" v-if="list.length > 0" v-for="(item, index) in list"
  52. :key="index" style="margin-bottom: 16upx;">
  53. <view style="width: 15%;">
  54. <view style="font-size: 28upx;margin-left: 15upx;margin-top: 6upx;">{{ index + 1 }}
  55. </view>
  56. </view>
  57. <view style="width: 20%;">
  58. <image :src="item.avatar?item.avatar:'../../static/image/logo.png'" class="round"
  59. style="width: 50rpx;height: 50rpx;"></image>
  60. </view>
  61. <view style="width: 40%;display: flex;flex-direction: row;align-items: center;">
  62. <view style="font-size: 28upx;width: 90%;overflow: hidden;">{{ item.userName?item.userName:'' }}
  63. </view>
  64. </view>
  65. <view style="width: 35%;text-align: center;">
  66. <view style="font-size: 28upx;">
  67. {{ item.createTime.substr(0,10) }}
  68. </view>
  69. </view>
  70. </view>
  71. <empty v-if="list.length==0"></empty>
  72. </view>
  73. </view>
  74. </template>
  75. <script>
  76. import empty from '@/components/empty.vue'
  77. export default {
  78. components: {
  79. empty
  80. },
  81. data() {
  82. return {
  83. countChildren: 0,
  84. countChildrenChildren: 0,
  85. YaoqingShangJin: 0,
  86. setting: 1,
  87. list: [],
  88. page: 1,
  89. limit: 10,
  90. type: 1,
  91. status: 0,
  92. teamCount: 0,
  93. teamMoney: 0,
  94. isFenxiao: '否',
  95. oneTeamCount: 0,
  96. twoTeamCount: 0,
  97. yijiyongjin: '',
  98. erjiyongjin: '',
  99. currentTab: 0,
  100. tabsnva: [{
  101. loadingType: ''
  102. }],
  103. tabList: [{
  104. state: 'zs',
  105. text: '一级',
  106. type: 1,
  107. number: 0
  108. }, {
  109. state: 'fzs',
  110. text: '二级',
  111. type: 2,
  112. number: 0
  113. }],
  114. count: 0,
  115. userType: ''
  116. };
  117. },
  118. onLoad() {
  119. let YaoqingShangJin = this.$queue.getData('YaoqingShangJin');
  120. if (YaoqingShangJin && YaoqingShangJin != 0) {
  121. this.YaoqingShangJin = YaoqingShangJin;
  122. }
  123. //用户信息
  124. this.getUserInfo();
  125. //邀请的用户
  126. this.getMoney();
  127. //用户推广信息
  128. this.getTeamMoney()
  129. },
  130. methods: {
  131. getUserInfo() {
  132. this.$Request.getT('/app/user/selectUserById').then(res => {
  133. if (res.code == 0) {
  134. this.userType = res.data.userType
  135. this.yijiyongjin = res.data.zhiRate ? res.data.zhiRate : 0;
  136. this.erjiyongjin = res.data.feiRate ? res.data.feiRate : 0;
  137. uni.setStorageSync('avatar', res.data.avatar)
  138. uni.setStorageSync('invitationCode', res.data.invitationCode)
  139. uni.setStorageSync('zhiFuBao', res.data.zhiFuBao)
  140. uni.setStorageSync('zhiFuBaoName', res.data.zhiFuBaoName)
  141. }
  142. });
  143. },
  144. //用户推广信息
  145. getTeamMoney() {
  146. this.$Request.getT('/app/invite/getExtensionData').then(res => {
  147. if (res.code == 0) {
  148. this.teamMoney = res.data.extensionProfit
  149. this.countChildren = res.data.countChildren
  150. this.countChildrenChildren = res.data.countChildrenChildren
  151. }
  152. });
  153. },
  154. goYao() {
  155. if (this.userType == 1) {
  156. uni.navigateTo({
  157. url: '/pages/my/invitationUser'
  158. });
  159. } else {
  160. uni.navigateTo({
  161. url: '/pages/my/invitationUserqy'
  162. });
  163. }
  164. },
  165. changeList(zhishu) {
  166. this.page = 1
  167. this.type = zhishu
  168. this.getMoney()
  169. },
  170. //切换一级二级
  171. changeTab(e) {
  172. console.log('eeeeeeeee', e)
  173. this.currentTab = e.target.current;
  174. if (this.currentTab == 0) {
  175. this.type = 1
  176. this.getMoney()
  177. } else if (this.currentTab == 1) {
  178. this.type = 2
  179. this.getMoney()
  180. }
  181. },
  182. //邀请的用户
  183. getMoney() {
  184. this.loadingType = 1;
  185. uni.showLoading({
  186. title: '加载中...'
  187. });
  188. let data = {
  189. page: this.page,
  190. limit: this.limit,
  191. type: this.type,
  192. }
  193. this.$Request.getT('/app/invite/getExtensionList', data).then(res => {
  194. if (res.code == 0 && res.data) {
  195. this.count = res.data.total
  196. if (this.page == 1) {
  197. this.list = res.data.records
  198. } else {
  199. this.list = [...this.list, ...res.data.records]
  200. }
  201. }
  202. uni.hideLoading();
  203. uni.stopPullDownRefresh();
  204. });
  205. },
  206. goDet() {
  207. uni.navigateTo({
  208. url: './earnings'
  209. })
  210. }
  211. },
  212. onPullDownRefresh: function() {
  213. this.page = 1;
  214. this.getMoney();
  215. },
  216. onReachBottom() {
  217. if (this.list.length < this.count) {
  218. this.page = this.page + 1;
  219. this.getMoney()
  220. } else {
  221. uni.showToast({
  222. title: '没有更多了',
  223. icon: 'none'
  224. })
  225. }
  226. },
  227. };
  228. </script>
  229. <style lang="scss">
  230. @import '../../static/css/index.css';
  231. .view1 {
  232. background-color: #FFFFFF;
  233. width: 93%;
  234. // height: 300upx;
  235. margin-left: 26upx;
  236. border-radius: 20upx;
  237. margin-top: 20upx;
  238. padding-bottom: 32upx;
  239. }
  240. .view2 {
  241. background-color: #FFFFFF;
  242. width: 93%;
  243. // height: 100%;
  244. border-top-left-radius: 20upx;
  245. border-top-right-radius: 20upx;
  246. margin-left: 26upx;
  247. margin-top: 20upx;
  248. }
  249. .navbar {
  250. display: flex;
  251. height: 40px;
  252. border-radius: 20upx;
  253. box-shadow: 0 1px 5px rgba(0, 0, 0, .06);
  254. position: relative;
  255. z-index: 10;
  256. margin: 0 24rpx;
  257. border-radius: 20rpx;
  258. overflow: hidden;
  259. .nav-item {
  260. flex: 1;
  261. display: flex;
  262. justify-content: center;
  263. align-items: center;
  264. height: 100%;
  265. font-size: 15px;
  266. position: relative;
  267. &.current {
  268. background-color: #82A9FE;
  269. color: #FFFFFF;
  270. &:after {
  271. content: '';
  272. position: absolute;
  273. left: 50%;
  274. bottom: 0;
  275. transform: translateX(-50%);
  276. width: 44px;
  277. height: 0;
  278. // border-bottom: 2px solid $base-color;
  279. }
  280. }
  281. }
  282. }
  283. .yaoqing_btn {
  284. // width: 80%;
  285. line-height: 80upx;
  286. margin-top: 30upx;
  287. height: 85upx;
  288. color: #FFFFFF;
  289. background: #82A9FE;
  290. margin-left: 32upx;
  291. margin-right: 32upx;
  292. background-size: 100%;
  293. }
  294. </style>