team.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="status_bar"><!-- 这里是状态栏 --></view>
  5. <view class="body-title">
  6. <view class="goback-box" @click="toBack"><image class="goback" src="../../static/icon/fanhui.png" mode=""></image></view>
  7. <view class="header">我的推广</view>
  8. </view>
  9. <view class="content-bg"><image src="../../static/img/tg-bg.png" mode=""></image></view>
  10. <view class="money-box">
  11. <view class="money">{{ all || '0' }}</view>
  12. <view>我的推广人数</view>
  13. </view>
  14. </view>
  15. <!-- <view class="yeji">
  16. <view class="yeji-a">
  17. <view class="yeji-buttom">{{ userInfo.self_achievement * 1 || 0 }}</view>
  18. <view class="yeji-top">个人业绩</view>
  19. </view>
  20. <view class="border"></view>
  21. <view class="yeji-a">
  22. <view class="yeji-buttom">{{ userInfo.group_achievement * 1 || 0 }}</view>
  23. <view class="yeji-top">团队业绩</view>
  24. </view>
  25. </view> -->
  26. <swiper :current="tabCurrentIndex" :style="{ height: maxheight }" class="swiper-box" duration="300" @change="changeTab">
  27. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  28. <scroll-view class="list-scroll-content" :style="{ height: maxheight }" scroll-y @scrolltolower="loadData">
  29. <!-- 空白页 -->
  30. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  31. <!-- 订单列表 -->
  32. <view v-for="(item, index) in tabItem.orderList" :key="index" class="order-item flex">
  33. <view class="title-box flex_item">
  34. <view class="title-avatar"><image :src="item.avatar"></image></view>
  35. <view class="list_tpl">
  36. <view class="title">
  37. <view class="title-name clamp">{{ item.nickname }}</view>
  38. </view>
  39. <view class="time">
  40. <text>{{ item.time }}</text>
  41. </view>
  42. </view>
  43. <view class="list-left">
  44. <!-- <view class="money">
  45. <text>第{{ item.layer }}层</text>
  46. </view> -->
  47. <view class="money">
  48. <text>{{ item.numberCount == null ? '未购买' : item.numberCount + '元' }}</text>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  54. </scroll-view>
  55. </swiper-item>
  56. </swiper>
  57. </view>
  58. </template>
  59. <script>
  60. import { spread } from '@/api/user.js';
  61. import { mapState, mapMutations } from 'vuex';
  62. export default {
  63. onReady(res) {
  64. var _this = this;
  65. uni.getSystemInfo({
  66. success: resu => {
  67. const query = uni.createSelectorQuery();
  68. query.select('.swiper-box').boundingClientRect();
  69. query.exec(function(res) {
  70. _this.maxheight = resu.windowHeight - res[0].top + 'px';
  71. console.log('打印页面的剩余高度', _this.height);
  72. });
  73. },
  74. fail: res => {}
  75. });
  76. },
  77. data() {
  78. return {
  79. // 头部图高度
  80. maxheight: '',
  81. tabCurrentIndex: 0,
  82. navList: [
  83. {
  84. state: 0,
  85. text: '直接推荐',
  86. loadingType: 'more',
  87. orderList: [],
  88. page: 1, //当前页数
  89. limit: 10 //每次信息条数
  90. }
  91. ],
  92. all: '',
  93. list: ''
  94. };
  95. },
  96. computed: {
  97. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  98. },
  99. onLoad(options) {},
  100. onShow() {
  101. this.loadData();
  102. },
  103. methods: {
  104. // 页面跳转
  105. navto(e) {
  106. uni.navigateTo({
  107. url: e
  108. });
  109. },
  110. //获取收入支出信息
  111. async loadData(source) {
  112. //这里是将订单挂载到tab列表下
  113. let index = this.tabCurrentIndex;
  114. let navItem = this.navList[index];
  115. let state = navItem.state;
  116. if (source === 'tabChange' && navItem.loaded === true) {
  117. //tab切换只有第一次需要加载数据
  118. return;
  119. }
  120. if (navItem.loadingType === 'loading') {
  121. //防止重复加载
  122. return;
  123. }
  124. if (navItem.loadingType === 'noMore') {
  125. //防止重复加载
  126. return;
  127. }
  128. // 修改当前对象状态为加载中
  129. navItem.loadingType = 'loading';
  130. spread({
  131. page: navItem.page,
  132. limit: navItem.limit
  133. })
  134. .then(({ data }) => {
  135. console.log(data);
  136. this.total = data.total;
  137. this.totalLevel = data.totalLevel;
  138. this.all = this.total + this.totalLevel;
  139. if (data.list.length > 0) {
  140. this.list = data.list;
  141. navItem.orderList = navItem.orderList.concat(data.list);
  142. navItem.page++;
  143. }
  144. this.$nextTick(function() {
  145. if (navItem.limit == data.list.length) {
  146. //判断是否还有数据, 有改为 more, 没有改为noMore
  147. navItem.loadingType = 'more';
  148. return;
  149. } else {
  150. //判断是否还有数据, 有改为 more, 没有改为noMore
  151. navItem.loadingType = 'noMore';
  152. }
  153. });
  154. this.$set(navItem, 'loaded', true);
  155. })
  156. .catch(e => {
  157. console.log(e);
  158. });
  159. },
  160. //swiper 切换
  161. changeTab(e) {
  162. this.tabCurrentIndex = e.target.current;
  163. this.loadData('tabChange');
  164. },
  165. //顶部tab点击
  166. tabClick(index) {
  167. this.tabCurrentIndex = index;
  168. },
  169. // 点击返回 我的页面
  170. toBack() {
  171. uni.switchTab({
  172. url: '/pages/user/user'
  173. });
  174. }
  175. }
  176. };
  177. </script>
  178. <style lang="scss">
  179. page {
  180. background: #f8f8f8;
  181. height: 100%;
  182. }
  183. .status_bar {
  184. height: var(--status-bar-height);
  185. width: 100%;
  186. background: #5dbc7c;
  187. }
  188. .content-money {
  189. position: relative;
  190. height: 480rpx;
  191. .content-bg {
  192. position: absolute;
  193. top: 0;
  194. left: 0;
  195. right: 0;
  196. width: 750rpx;
  197. height: 480rpx;
  198. image {
  199. width: 100%;
  200. height: 100%;
  201. }
  202. }
  203. .body-title {
  204. height: 80rpx;
  205. text-align: center;
  206. font-size: 35rpx;
  207. position: relative;
  208. .header {
  209. position: absolute;
  210. left: 0;
  211. top: 0;
  212. width: 100%;
  213. font-size: 36rpx;
  214. font-family: PingFang SC;
  215. font-weight: bold;
  216. color: #fffeff;
  217. height: 80rpx;
  218. font-size: 36rpx;
  219. font-weight: 700;
  220. z-index: 9;
  221. display: flex;
  222. justify-content: center;
  223. align-items: center;
  224. }
  225. .goback-box {
  226. position: absolute;
  227. left: 18rpx;
  228. top: 0;
  229. height: 80rpx;
  230. display: flex;
  231. align-items: center;
  232. }
  233. .goback {
  234. z-index: 100;
  235. width: 34rpx;
  236. height: 34rpx;
  237. }
  238. }
  239. }
  240. .money-box {
  241. position: relative;
  242. z-index: 2;
  243. padding-top: 70rpx;
  244. color: #ffffff;
  245. text-align: center;
  246. .money {
  247. font-size: 72rpx;
  248. font-family: PingFang SC;
  249. font-weight: bold;
  250. color: #ffffff;
  251. }
  252. .text {
  253. font-size: 30rpx;
  254. }
  255. }
  256. .order-item {
  257. padding: 20rpx 30rpx;
  258. line-height: 1.5;
  259. .title-box {
  260. width: 100%;
  261. .title-avatar {
  262. flex-shrink: 0;
  263. width: 100rpx;
  264. height: 100rpx;
  265. margin-right: 25rpx;
  266. border-radius: 100%;
  267. image {
  268. width: 100%;
  269. height: 100%;
  270. border-radius: 100%;
  271. }
  272. }
  273. .list_tpl {
  274. width: 85%;
  275. .title {
  276. display: flex;
  277. justify-content: flex-start;
  278. font-size: $font-lg;
  279. color: $font-color-base;
  280. overflow: hidden; //超出的文本隐藏
  281. text-overflow: ellipsis; //溢出用省略号显示
  282. white-space: nowrap;
  283. line-height: 1;
  284. text-align: center;
  285. .title-name {
  286. max-width: 40%;
  287. }
  288. .dl {
  289. margin-left: 10rpx;
  290. width: 93rpx;
  291. height: 32rpx;
  292. border-radius: 16rpx;
  293. image {
  294. width: 93rpx;
  295. height: 32rpx;
  296. border-radius: 16rpx;
  297. }
  298. }
  299. .class {
  300. display: inline-block;
  301. margin-left: 10rpx;
  302. padding: 6rpx;
  303. text-align: center;
  304. border: 1px solid #2e58ff;
  305. border-radius: 16rpx;
  306. font-size: 20rpx;
  307. font-family: PingFang SC;
  308. font-weight: 500;
  309. color: #2e58ff;
  310. }
  311. }
  312. .time {
  313. font-size: $font-base;
  314. color: $font-color-light;
  315. }
  316. }
  317. }
  318. .list-left {
  319. width: 50%;
  320. }
  321. .money {
  322. text-align: right;
  323. color: #db1935;
  324. font-size: $font-lg;
  325. }
  326. }
  327. .yeji {
  328. position: relative;
  329. margin: -72rpx auto 0;
  330. width: 690rpx;
  331. height: 143rpx;
  332. background: #ffffff;
  333. box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50, 50, 52, 0.06);
  334. border-radius: 10rpx;
  335. display: flex;
  336. align-items: center;
  337. .yeji-a {
  338. width: 50%;
  339. display: flex;
  340. flex-direction: column;
  341. justify-content: center;
  342. align-items: center;
  343. .yeji-top {
  344. font-size: 28rpx;
  345. font-family: PingFang SC;
  346. font-weight: bold;
  347. color: #333333;
  348. }
  349. .yeji-buttom {
  350. font-size: 42rpx;
  351. font-family: PingFang SC;
  352. font-weight: bold;
  353. color: #333333;
  354. }
  355. }
  356. .border {
  357. width: 1rpx;
  358. height: 51rpx;
  359. background: #dddddd;
  360. }
  361. }
  362. </style>